diff --git a/src/views/modules/yieldReport/com_tid_upload_mt_log.vue b/src/views/modules/yieldReport/com_tid_upload_mt_log.vue index 1610bbc..b3a0d88 100644 --- a/src/views/modules/yieldReport/com_tid_upload_mt_log.vue +++ b/src/views/modules/yieldReport/com_tid_upload_mt_log.vue @@ -71,19 +71,20 @@ - + - - - - - - + - + + @@ -299,7 +300,6 @@ export default { if (!this.pageData.site || !this.pageData.resourceId) { return } - this.uploadForm.date = this.getTodayDateString() const params = { site: this.pageData.site, resourceId: this.pageData.resourceId, @@ -323,12 +323,12 @@ export default { this.mesShiftLogs = [] return } - const currentDate = this.getTodayDateString() + const queryDate = this.normalizeDateValue(this.uploadForm.date) || this.getTodayDateString() const shiftValue = this.getShiftValueForApi() - this.uploadForm.date = currentDate + this.uploadForm.date = queryDate const params = { machineNo: this.uploadForm.machineNo, - date: currentDate, + date: queryDate, shift: shiftValue, type: 'MT' } @@ -547,6 +547,23 @@ export default { return (size / 1024).toFixed(2) }, + normalizeDateValue (dateValue) { + if (!dateValue) { + return '' + } + if (Object.prototype.toString.call(dateValue) === '[object Date]') { + return this.formatDateValue(dateValue) + } + const value = String(dateValue) + if (value.indexOf(' ') > -1) { + return value.split(' ')[0] + } + if (value.indexOf('T') > -1) { + return value.split('T')[0] + } + return value + }, + validateUploadMtForm () { if (this.saveLoading) { return false @@ -622,8 +639,8 @@ export default { if (!this.validateUploadMtForm()) { return } - const currentDate = this.getTodayDateString() - this.uploadForm.date = currentDate + const uploadDate = this.normalizeDateValue(this.uploadForm.date) || this.getTodayDateString() + this.uploadForm.date = uploadDate this.saveLoading = true this.uploadResults = [] this.resetUploadProgress() @@ -636,7 +653,7 @@ export default { for (let i = 0; i < taskFileList.length; i++) { const currentFileItem = taskFileList[i] this.uploadProgress.running = 1 - const result = await this.uploadSingleMtFile(currentFileItem, i, currentDate) + const result = await this.uploadSingleMtFile(currentFileItem, i, uploadDate) this.uploadProgress.running = 0 resultList.push(result)