Browse Source

feat:[模板管理][update]

lkf
luojie 3 months ago
parent
commit
4e70b39a55
3 changed files with 35 additions and 35 deletions
  1. +1
    -0
      src/components/Template/CustomTable.vue
  2. +32
    -33
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue
  3. +2
    -2
      src/views/business/comps/template/formConfig/paralleAndLadderConfig.js

+ 1
- 0
src/components/Template/CustomTable.vue View File

@ -515,6 +515,7 @@ export default {
}, },
// //
updateDataSourceByRowIndex(rowIndex, data) { updateDataSourceByRowIndex(rowIndex, data) {
console.log(rowIndex, data, "updateDataSourceByRowIndex")
this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data };
this.localDataSource = [...this.localDataSource]; this.localDataSource = [...this.localDataSource];
}, },

+ 32
- 33
src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue View File

@ -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() {
// paralleConfigsparalleTableFormData // paralleConfigsparalleTableFormData
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]});
});
}
} }
} }
} }
},
// ladderConfigsladderTableFormData
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() {

+ 2
- 2
src/views/business/comps/template/formConfig/paralleAndLadderConfig.js View File

@ -151,8 +151,8 @@ export const getParallelColumnsConfig = ($this) => {
prop: 'targetSolutionCode', prop: 'targetSolutionCode',
bodyType: 'select', bodyType: 'select',
bodyOptions: $this.getDictOptions('business_sp_nbgzy'), bodyOptions: $this.getDictOptions('business_sp_nbgzy'),
subType: 'span',
subKey: 'subTargetSolutionCode',
bodySubType: 'span',
bodySubKey: 'subTargetSolutionCode',
bodyFillType: 'preFill', bodyFillType: 'preFill',
width: 280 width: 280
}, },

Loading…
Cancel
Save