Browse Source

feat:[模板管理][update]

lkf
luojie 3 months ago
parent
commit
a65a65ba04
3 changed files with 59 additions and 2 deletions
  1. +0
    -1
      src/components/Template/CustomTable.vue
  2. +50
    -0
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue
  3. +9
    -1
      src/views/business/comps/template/mixins/templateMixin.js

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

@ -223,7 +223,6 @@ export default {
methods: { methods: {
// //
getOtherItem(sItem) { getOtherItem(sItem) {
console.log(sItem, "other sItem")
return { return {
label: sItem.otherLabel ? this.$t(sItem.otherLabel) : this.$t("template.common.other"), label: sItem.otherLabel ? this.$t(sItem.otherLabel) : this.$t("template.common.other"),
fillType: sItem.bodyFillType, fillType: sItem.bodyFillType,

+ 50
- 0
src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue View File

@ -116,6 +116,14 @@ export default {
console.log(v, "fillType") console.log(v, "fillType")
} }
}, },
formData: {
immediate: true,
handler(v) {
if(v &&this.fillType === "actFill"){
this.handleUpdateCode();
}
}
}
}, },
computed: { computed: {
// //
@ -160,6 +168,48 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
//
async assignNumbersToTableData(tableDataArray) {
if (!tableDataArray || tableDataArray.length === 0) {
return;
}
// 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
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);
}
}
}
// 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);
}
}
}
},
// //
handleAddParalle() { handleAddParalle() {
// //

+ 9
- 1
src/views/business/comps/template/mixins/templateMixin.js View File

@ -1,4 +1,5 @@
import moment from 'moment'
import moment from 'moment';
import { getLatestSn } from '@/api/template';
export default { export default {
dicts: [ dicts: [
'business_pztj', 'business_pztj',
@ -121,6 +122,13 @@ export default {
this.setTemplateData({}) this.setTemplateData({})
}, },
methods: { methods: {
async getLatestSn(count = 1){
const res = await getLatestSn({count})
if(res.code === 200){
return res.data;
}
return null
},
getResource() { getResource() {
return this.resource return this.resource
}, },

Loading…
Cancel
Save