diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue index 67cde4d..ae84268 100644 --- a/src/views/modules/rohs/rohsRecord.vue +++ b/src/views/modules/rohs/rohsRecord.vue @@ -54,7 +54,11 @@ - + + + @@ -189,7 +193,7 @@ - + @@ -705,7 +709,7 @@ - + @@ -1307,6 +1311,28 @@ export default { canEditRohsMaterial () { return !this.showModalFlag }, + normalizeDateOnly (value) { + if (value === null || value === undefined || value === '') { + return '' + } + if (value instanceof Date && !Number.isNaN(value.getTime())) { + const year = value.getFullYear() + const month = String(value.getMonth() + 1).padStart(2, '0') + const day = String(value.getDate()).padStart(2, '0') + return year + '-' + month + '-' + day + } + const text = String(value).trim() + if (!text) { + return '' + } + if (text.includes('T')) { + return text.split('T')[0] + } + return text.length >= 10 ? text.substring(0, 10) : text + }, + getCurrentDateString () { + return this.normalizeDateOnly(new Date()) + }, normalizeValidUntilValue (value) { if (value === null || value === undefined || value === '') { return null @@ -1819,6 +1845,10 @@ export default { ? target.validUntilValue : fallbackData.validUntilValue this.$set(target, 'validUntilValue', this.normalizeValidUntilValue(validUntilValue)) + const applicationDate = target.applicationDate || fallbackData.applicationDate || '' + const plannedMassProductionDate = target.plannedMassProductionDate || fallbackData.plannedMassProductionDate || '' + this.$set(target, 'applicationDate', this.normalizeDateOnly(applicationDate)) + this.$set(target, 'plannedMassProductionDate', this.normalizeDateOnly(plannedMassProductionDate)) }, refreshCurrentTabTable () { if (this.activeTable === 'approvalInformation') { @@ -2021,11 +2051,11 @@ export default { this.modalData = { site: this.$store.state.user.site, referenceNo: tempReferenceNo, - applicant: '', - applicantName: '', + applicant: this.$store.state.user.name || '', + applicantName: this.$store.state.user.userDisplay || this.$store.state.user.user_display || '', pm: '', pmName: '', - applicationDate: '', + applicationDate: this.getCurrentDateString(), process: '', plannedMassProductionDate: '', color: '',