Browse Source

baseline

master
han\hanst 2 months ago
parent
commit
da73243fa7
  1. 65
      src/views/modules/sampleTracking/projectProofTracking.vue

65
src/views/modules/sampleTracking/projectProofTracking.vue

@ -1076,6 +1076,18 @@
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
style="width: 100%"
@change="handleProofDialogRequiredDeliveryDateChange">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="Baseline">
<el-date-picker
v-model="proofDialogData.baseline"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
style="width: 100%">
</el-date-picker>
</el-form-item>
@ -1091,14 +1103,14 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="6">
<el-form-item label="Importance">
<el-checkbox v-model="proofDialogData.importance" true-label="Y" false-label="N"></el-checkbox>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="24">
<el-col :span="18">
<el-form-item label="备注">
<el-input v-model="proofDialogData.remark" style="width: 100%" ></el-input>
</el-form-item>
@ -4073,6 +4085,7 @@ export default {
proofingNumber: '',
planStartDate: '',
requiredDeliveryDate: '',
baseline: '',
actualityDeliveryDate: '',
pmInqueryTime: '',
importance: 'N',
@ -4636,7 +4649,7 @@ export default {
handleOneKeyProofingNoChange (proofingNo) {
const selectedNo = this.isBlankValue(proofingNo) ? '' : String(proofingNo).trim()
if (this.oneKeyDialogMode !== 'create') {
// 修改模式下预计完成日期、打样开始日期以数据库已存值为准,不跟随打样单号自动回填/清空。
// 修改模式:库里已有日期保留;为空时才跟随打样单号回填,避免空日期一直缺值。
if (!selectedNo) {
this.oneKeyForm.proofingNo = ''
return
@ -4644,6 +4657,7 @@ export default {
const matchedInEdit = this.oneKeyProofingApplyOptions.find(item => item && item.applyNo === selectedNo)
if (matchedInEdit) {
this.oneKeyForm.proofingNo = matchedInEdit.applyNo
this.fillEmptyOneKeyProofingDatesFromApply(matchedInEdit)
}
return
}
@ -4662,6 +4676,23 @@ export default {
this.oneKeyForm.planStartDate = matched.createTime || ''
this.syncOneKeyBaselineByRequiredDeliveryDate(this.oneKeyForm.requiredDeliveryDate, false)
},
fillEmptyOneKeyProofingDatesFromApply (matched) {
if (!matched) {
return
}
let filledRequiredDate = false
if (this.isBlankValue(this.oneKeyForm.requiredDeliveryDate)) {
this.oneKeyForm.requiredDeliveryDate = matched.expectedFinishDate || ''
filledRequiredDate = true
}
if (this.isBlankValue(this.oneKeyForm.planStartDate)) {
this.oneKeyForm.planStartDate = matched.createTime || ''
}
// 仅在本次补了预计完成日期时尝试带出 baseline,避免覆盖修改态已有 baseline。
if (filledRequiredDate) {
this.syncOneKeyBaselineByRequiredDeliveryDate(this.oneKeyForm.requiredDeliveryDate, false)
}
},
handleOneKeyRequiredDeliveryDateChange (dateVal) {
this.syncOneKeyBaselineByRequiredDeliveryDate(dateVal, false)
},
@ -4745,6 +4776,21 @@ export default {
this.proofDialogData.requiredDeliveryDate = matched.expectedFinishDate || ''
// 打样开始日期默认取工程实验单创建日期;清空打样单时同步清空,避免残留旧单日期。
this.proofDialogData.planStartDate = matched.createTime || ''
this.syncProofDialogBaselineByRequiredDeliveryDate(this.proofDialogData.requiredDeliveryDate, false)
},
handleProofDialogRequiredDeliveryDateChange (dateVal) {
this.syncProofDialogBaselineByRequiredDeliveryDate(dateVal, false)
},
syncProofDialogBaselineByRequiredDeliveryDate (requiredDeliveryDate, forceSync) {
const normalizedRequiredDate = this.formatDate(requiredDeliveryDate)
if (!normalizedRequiredDate) {
return
}
const normalizedBaseline = this.formatDate(this.proofDialogData.baseline)
if (forceSync || !normalizedBaseline) {
// 新增打样时 baseline 首次默认跟随预计完成日期,后续允许用户改写。
this.proofDialogData.baseline = normalizedRequiredDate
}
},
loadProofDialogApplyOptions (projectNo) {
const normalizedProjectNo = this.normalizeProjectNo(projectNo)
@ -5523,6 +5569,7 @@ export default {
proofingNumber: '',
planStartDate: '',
requiredDeliveryDate: '',
baseline: '',
actualityDeliveryDate: '',
pmInqueryTime: '',
importance: 'N',
@ -5747,6 +5794,15 @@ export default {
}
return true
},
resolveProofDialogBaseline () {
const baseline = this.formatDate(this.proofDialogData.baseline)
if (baseline) {
return baseline
}
// 用户未填 baseline 时,按预计完成日期初始化,与一键创建口径一致。
const requiredDeliveryDate = this.formatDate(this.proofDialogData.requiredDeliveryDate)
return requiredDeliveryDate || null
},
buildProofPayload () {
return {
site: this.proofDialogData.site,
@ -5762,6 +5818,7 @@ export default {
proofingNumber: Number(this.proofDialogData.proofingNumber),
planStartDate: this.proofDialogData.planStartDate,
requiredDeliveryDate: this.proofDialogData.requiredDeliveryDate,
baseline: this.resolveProofDialogBaseline(),
actualityDeliveryDate: this.proofDialogData.actualityDeliveryDate || null,
pmInqueryTime: this.isBlankValue(this.proofDialogData.pmInqueryTime) ? null : this.proofDialogData.pmInqueryTime,
importance: this.normalizeImportanceValue(this.proofDialogData.importance),

Loading…
Cancel
Save