|
|
|
@ -378,10 +378,18 @@ |
|
|
|
<div style="height: 635px"> |
|
|
|
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;"> |
|
|
|
<el-form-item label="SGS报告编号/SGS Report Number"> |
|
|
|
<el-input v-model="modalData.sgsReportNumber" :disabled="isRohsFieldDisabled('sgsReportNumber')" style="width: 252px"></el-input> |
|
|
|
<el-input v-model="modalData.sgsReportNumber" :disabled="isRohsFieldDisabled('sgsReportNumber')" style="width: 190px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="状态/Status"> |
|
|
|
<el-select v-model="modalData.rohsStatus" clearable :disabled="isRohsFieldDisabled('rohsStatus')" style="width: 190px"> |
|
|
|
<el-option label="Active" value="Active"></el-option> |
|
|
|
<el-option label="Dead" value="Dead"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-form :inline="true" label-position="top" :model="modalData"> |
|
|
|
<el-form-item label="报告日期/Expired Date"> |
|
|
|
<el-date-picker v-model="modalData.expiredDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('expiredDate')" style="width: 180px" :editable=false></el-date-picker> |
|
|
|
<el-date-picker v-model="modalData.expiredDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('expiredDate')" style="width: 190px" :editable=false></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="有效期数值/Valid Until Value"> |
|
|
|
<el-input-number |
|
|
|
@ -391,16 +399,19 @@ |
|
|
|
:step="1" |
|
|
|
:precision="0" |
|
|
|
:disabled="isValidUntilValueDisabled()" |
|
|
|
style="width: 150px"> |
|
|
|
style="width: 190px"> |
|
|
|
</el-input-number> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="有效期单位/Valid Until Unit"> |
|
|
|
<dict-data-select v-model="modalData.validUntil" clearable :disabled="isValidUntilUnitDisabled()" style="width: 180px" dict-type="rohs_valid_until"></dict-data-select> |
|
|
|
<dict-data-select v-model="modalData.validUntil" clearable :disabled="isValidUntilUnitDisabled()" style="width: 190px" dict-type="rohs_valid_until"></dict-data-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="失效日期/Expiry Date"> |
|
|
|
<el-date-picker v-model="modalData.expiryDate" type="date" value-format="yyyy-MM-dd" disabled style="width: 192px" :editable=false></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-form :inline="true" label-position="top" :model="modalData"> |
|
|
|
<el-form-item label="是否符合RoHS/Meet RoHS Req"> |
|
|
|
<el-radio-group v-model="modalData.isMeetRohsRequirement" :disabled="isRohsFieldDisabled('isMeetRohsRequirement')" style="width: 252px"> |
|
|
|
<el-radio-group v-model="modalData.isMeetRohsRequirement" :disabled="isRohsFieldDisabled('isMeetRohsRequirement')" style="width: 190px"> |
|
|
|
<el-radio label="Y" @click.native.prevent="radioClick('isMeetRohsRequirement', 'Y')">是</el-radio> |
|
|
|
<el-radio label="N" @click.native.prevent="radioClick('isMeetRohsRequirement', 'N')">否</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
@ -411,7 +422,7 @@ |
|
|
|
true-label="Y" |
|
|
|
false-label="N" |
|
|
|
:disabled="isRohsFieldDisabled('isAhGrade')" |
|
|
|
style="width: 200px">材料属性是否是AH/Is AH Grade</el-checkbox> |
|
|
|
style="width: 190px">材料属性是否是AH/Is AH Grade</el-checkbox> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="HSF供应商等级/Supplier Class"> |
|
|
|
<el-radio-group v-model="modalData.hsfSupplierClassification" :disabled="isRohsFieldDisabled('hsfSupplierClassification')" style="width: 200px"> |
|
|
|
@ -919,6 +930,11 @@ |
|
|
|
<el-form-item label="SGS报告编号/SGS Report Number"> |
|
|
|
<el-input :value="currentRow.sgsReportNumber || ''" disabled style="width: 252px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="状态/Status"> |
|
|
|
<el-input :value="currentRow.rohsStatus || ''" disabled style="width: 180px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-form :inline="true" label-position="top" :model="currentRow"> |
|
|
|
<el-form-item label="报告日期/Expired Date"> |
|
|
|
<el-date-picker :value="currentRow.expiredDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 180px"></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
@ -928,6 +944,9 @@ |
|
|
|
<el-form-item label="有效期单位/Valid Until Unit"> |
|
|
|
<el-input :value="currentRow.validUntil || ''" disabled style="width: 180px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="失效日期/Expiry Date"> |
|
|
|
<el-date-picker :value="currentRow.expiryDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 180px"></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-form :inline="true" label-position="top" :model="currentRow"> |
|
|
|
<el-form-item label="是否符合RoHS/Meet RoHS Req"> |
|
|
|
@ -1301,7 +1320,9 @@ export default { |
|
|
|
remark: '', |
|
|
|
status: '', |
|
|
|
sgsReportNumber: '', |
|
|
|
rohsStatus: 'Active', |
|
|
|
expiredDate: '', |
|
|
|
expiryDate: '', |
|
|
|
fiberInformation: '', |
|
|
|
hsfStandard: '', |
|
|
|
hsfApprover: '', |
|
|
|
@ -1365,6 +1386,15 @@ export default { |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
'modalData.expiredDate' () { |
|
|
|
this.syncExpiryDateByRule() |
|
|
|
}, |
|
|
|
'modalData.validUntilValue' () { |
|
|
|
this.syncExpiryDateByRule() |
|
|
|
}, |
|
|
|
'modalData.validUntil' () { |
|
|
|
this.syncExpiryDateByRule() |
|
|
|
}, |
|
|
|
'modalData.endCustomer' () { |
|
|
|
this.applyHsfStandardDefaultByCustomer(this.modalData) |
|
|
|
} |
|
|
|
@ -1494,6 +1524,92 @@ export default { |
|
|
|
} |
|
|
|
return text.length >= 10 ? text.substring(0, 10) : text |
|
|
|
}, |
|
|
|
parseDateOnly (value) { |
|
|
|
const text = this.normalizeDateOnly(value) |
|
|
|
if (!text) { |
|
|
|
return null |
|
|
|
} |
|
|
|
const parts = text.split('-') |
|
|
|
if (parts.length !== 3) { |
|
|
|
return null |
|
|
|
} |
|
|
|
const year = Number.parseInt(parts[0], 10) |
|
|
|
const month = Number.parseInt(parts[1], 10) |
|
|
|
const day = Number.parseInt(parts[2], 10) |
|
|
|
if (Number.isNaN(year) || Number.isNaN(month) || Number.isNaN(day)) { |
|
|
|
return null |
|
|
|
} |
|
|
|
const date = new Date(year, month - 1, day) |
|
|
|
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) { |
|
|
|
return null |
|
|
|
} |
|
|
|
return date |
|
|
|
}, |
|
|
|
normalizeValidUntilUnitType (unitValue) { |
|
|
|
const text = String(unitValue || '').trim().toLowerCase() |
|
|
|
if (!text) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
if (text === 'd' || text === 'day' || text === 'days' || text.includes('日')) { |
|
|
|
return 'day' |
|
|
|
} |
|
|
|
if (text === 'w' || text === 'week' || text === 'weeks' || text.includes('周')) { |
|
|
|
return 'week' |
|
|
|
} |
|
|
|
if (text === 'm' || text === 'month' || text === 'months' || text.includes('月')) { |
|
|
|
return 'month' |
|
|
|
} |
|
|
|
if (text === 'y' || text === 'year' || text === 'years' || text.includes('年')) { |
|
|
|
return 'year' |
|
|
|
} |
|
|
|
return '' |
|
|
|
}, |
|
|
|
addMonthsKeepDay (baseDate, monthDelta) { |
|
|
|
const year = baseDate.getFullYear() |
|
|
|
const month = baseDate.getMonth() |
|
|
|
const day = baseDate.getDate() |
|
|
|
const targetFirstDay = new Date(year, month + monthDelta, 1) |
|
|
|
const targetYear = targetFirstDay.getFullYear() |
|
|
|
const targetMonth = targetFirstDay.getMonth() |
|
|
|
const lastDay = new Date(targetYear, targetMonth + 1, 0).getDate() |
|
|
|
return new Date(targetYear, targetMonth, Math.min(day, lastDay)) |
|
|
|
}, |
|
|
|
addYearsKeepDay (baseDate, yearDelta) { |
|
|
|
const targetYear = baseDate.getFullYear() + yearDelta |
|
|
|
const month = baseDate.getMonth() |
|
|
|
const day = baseDate.getDate() |
|
|
|
const lastDay = new Date(targetYear, month + 1, 0).getDate() |
|
|
|
return new Date(targetYear, month, Math.min(day, lastDay)) |
|
|
|
}, |
|
|
|
calculateExpiryDateByRule (reportDate, validUntilValue, validUntilUnit) { |
|
|
|
const baseDate = this.parseDateOnly(reportDate) |
|
|
|
const durationValue = this.normalizeValidUntilValue(validUntilValue) |
|
|
|
const unitType = this.normalizeValidUntilUnitType(validUntilUnit) |
|
|
|
if (!baseDate || !durationValue || !unitType) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
let resultDate = new Date(baseDate.getTime()) |
|
|
|
if (unitType === 'day') { |
|
|
|
resultDate.setDate(resultDate.getDate() + durationValue) |
|
|
|
} else if (unitType === 'week') { |
|
|
|
resultDate.setDate(resultDate.getDate() + durationValue * 7) |
|
|
|
} else if (unitType === 'month') { |
|
|
|
resultDate = this.addMonthsKeepDay(baseDate, durationValue) |
|
|
|
} else if (unitType === 'year') { |
|
|
|
resultDate = this.addYearsKeepDay(baseDate, durationValue) |
|
|
|
} else { |
|
|
|
return '' |
|
|
|
} |
|
|
|
return this.normalizeDateOnly(resultDate) |
|
|
|
}, |
|
|
|
syncExpiryDateByRule () { |
|
|
|
if (!this.modalData) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const expiryDate = this.calculateExpiryDateByRule(this.modalData.expiredDate, this.modalData.validUntilValue, this.modalData.validUntil) |
|
|
|
this.$set(this.modalData, 'expiryDate', expiryDate) |
|
|
|
return expiryDate |
|
|
|
}, |
|
|
|
getCurrentDateString () { |
|
|
|
return this.normalizeDateOnly(new Date()) |
|
|
|
}, |
|
|
|
@ -2154,8 +2270,12 @@ export default { |
|
|
|
this.$set(target, 'validUntilValue', this.normalizeValidUntilValue(validUntilValue)) |
|
|
|
const applicationDate = target.applicationDate || fallbackData.applicationDate || '' |
|
|
|
const plannedMassProductionDate = target.plannedMassProductionDate || fallbackData.plannedMassProductionDate || '' |
|
|
|
const expiredDate = target.expiredDate || fallbackData.expiredDate || '' |
|
|
|
const normalizedExpiredDate = this.normalizeDateOnly(expiredDate) |
|
|
|
this.$set(target, 'applicationDate', this.normalizeDateOnly(applicationDate)) |
|
|
|
this.$set(target, 'plannedMassProductionDate', this.normalizeDateOnly(plannedMassProductionDate)) |
|
|
|
this.$set(target, 'expiredDate', normalizedExpiredDate) |
|
|
|
this.$set(target, 'expiryDate', this.calculateExpiryDateByRule(normalizedExpiredDate, target.validUntilValue, target.validUntil)) |
|
|
|
}, |
|
|
|
refreshCurrentTabTable () { |
|
|
|
if (this.activeTable === 'approvalInformation') { |
|
|
|
@ -2300,6 +2420,7 @@ export default { |
|
|
|
row.plannedMassProductionDate = this.normalizeDateOnly(row.plannedMassProductionDate) |
|
|
|
row.expectReportTime = this.normalizeDateOnly(row.expectReportTime) |
|
|
|
row.expiredDate = this.normalizeDateOnly(row.expiredDate) |
|
|
|
row.expiryDate = this.normalizeDateOnly(row.expiryDate) |
|
|
|
row.validUntilDisplay = this.getValidUntilDisplay(row.validUntilValue, row.validUntil) |
|
|
|
return row |
|
|
|
}) |
|
|
|
@ -2482,7 +2603,9 @@ export default { |
|
|
|
remark: '', |
|
|
|
status: '草稿', |
|
|
|
sgsReportNumber: '', |
|
|
|
rohsStatus: 'Active', |
|
|
|
expiredDate: '', |
|
|
|
expiryDate: '', |
|
|
|
fiberInformation: '', |
|
|
|
hsfStandard: '', |
|
|
|
hsfApprover: '', |
|
|
|
@ -2522,6 +2645,7 @@ export default { |
|
|
|
if (!this.validateValidUntilPair()) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.syncExpiryDateByRule() |
|
|
|
this.modalData.qualificationDocumentsNeeded = this.modalData.qualificationDocumentsNeededList.join(';') |
|
|
|
this.modalData.testReportIncludingItems = this.modalData.testReportIncludingItemsList.join(';') |
|
|
|
this.modalData.materialClassify = this.modalData.materialClassifyList.join(';') |
|
|
|
@ -2593,6 +2717,7 @@ export default { |
|
|
|
if (!this.validateValidUntilPair()) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.syncExpiryDateByRule() |
|
|
|
if (!this.nodeAuthorityLoaded) { |
|
|
|
this.$message.warning('节点权限加载中,请稍后重试') |
|
|
|
return |
|
|
|
|