|
|
@ -169,46 +169,45 @@ export default { |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
// 为指定的表单数据数组分配编号 |
|
|
// 为指定的表单数据数组分配编号 |
|
|
async assignNumbersToTableData(tableDataArray) { |
|
|
|
|
|
if (!tableDataArray || tableDataArray.length === 0) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async assignNumbersToTableData(config) { |
|
|
|
|
|
const configs = this.formData[config] |
|
|
|
|
|
|
|
|
// 检查表单数据中是否有任何一行的subTargetSolutionCode有值 |
|
|
|
|
|
const hasAnyWithValue = tableDataArray.some(row => |
|
|
|
|
|
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); |
|
|
|
|
|
|
|
|
|
|
|
// 如果没有任何一行有值,则为所有行分配编号 |
|
|
|
|
|
if (!hasAnyWithValue) { |
|
|
|
|
|
const length = tableDataArray.length; |
|
|
|
|
|
const snList = await this.getLatestSn(length); |
|
|
|
|
|
tableDataArray.forEach((row, idx) => { |
|
|
|
|
|
row.subTargetSolutionCode = snList[idx] || ''; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async handleUpdateCode() { |
|
|
|
|
|
|
|
|
|
|
|
// 检查paralleConfigs中的paralleTableFormData数组 |
|
|
// 检查paralleConfigs中的paralleTableFormData数组 |
|
|
if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) { |
|
|
|
|
|
for (let i = 0; i < this.formData.paralleConfigs.length; i++) { |
|
|
|
|
|
const config = this.formData.paralleConfigs[i]; |
|
|
|
|
|
if (config.stepTableFormData && config.stepTableFormData.length > 0) { |
|
|
|
|
|
await this.assignNumbersToTableData(config.stepTableFormData); |
|
|
|
|
|
|
|
|
if (configs && configs.length > 0) { |
|
|
|
|
|
for (let i = 0; i < configs.length; i++) { |
|
|
|
|
|
const ref = config === "paralleConfigs" ? `paralleStepTableRef_${i}` : `ladderStepTableRef_${i}`; |
|
|
|
|
|
const {stepTableFormData = []} = configs[i]; |
|
|
|
|
|
if (stepTableFormData && stepTableFormData.length > 0) { |
|
|
|
|
|
const tableDataArray = stepTableFormData; |
|
|
|
|
|
// 检查表单数据中是否有任何一行的subTargetSolutionCode有值 |
|
|
|
|
|
const hasAnyWithValue = tableDataArray.some(row => |
|
|
|
|
|
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); |
|
|
|
|
|
// 如果没有任何一行有值,则为所有行分配编号 |
|
|
|
|
|
if (!hasAnyWithValue) { |
|
|
|
|
|
const length = tableDataArray.length; |
|
|
|
|
|
const snList = await this.getLatestSn(length); |
|
|
|
|
|
tableDataArray.forEach((row, idx) => { |
|
|
|
|
|
this.$refs[ref][0]?.updateDataSourceByRowIndex(idx,{subTargetSolutionCode: length==1?snList:snList[idx]}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 检查ladderConfigs中的ladderTableFormData数组 |
|
|
|
|
|
if (this.formData.ladderConfigs && this.formData.ladderConfigs.length > 0) { |
|
|
|
|
|
for (let i = 0; i < this.formData.ladderConfigs.length; i++) { |
|
|
|
|
|
const config = this.formData.ladderConfigs[i]; |
|
|
|
|
|
if (config.stepTableFormData && config.stepTableFormData.length > 0) { |
|
|
|
|
|
await this.assignNumbersToTableData(config.stepTableFormData); |
|
|
|
|
|
|
|
|
async handleUpdateCode() { |
|
|
|
|
|
this.assignNumbersToTableData("paralleConfigs"); |
|
|
|
|
|
this.assignNumbersToTableData("ladderConfigs"); |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
//通知后端保存数据 |
|
|
|
|
|
const params = { |
|
|
|
|
|
type: "fieldChanged", |
|
|
|
|
|
newRecord: null, |
|
|
|
|
|
resourceList: null, |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//新增平行配制 |
|
|
//新增平行配制 |
|
|
handleAddParalle() { |
|
|
handleAddParalle() { |
|
|
|