Browse Source

Merge branch 'feature_bug' into dev

feature
mk 1 year ago
parent
commit
8b3c1cba7a
  1. 79
      src/views/components/resiExpand/editExpand.vue

79
src/views/components/resiExpand/editExpand.vue

@ -72,7 +72,6 @@
<el-cascader v-model.trim="form[itemj.id].partyOrgId" :props="casProps"
:options="itemk.opction" class="list_item_width_1" clearable size="small"
@change="handlePartyOrgCascadarChange" ></el-cascader>
<!-- {{form[itemj.id].partyOrgId}} -->
</template>
<template v-else-if="itemk.itemType == 'number'">
@ -277,42 +276,50 @@ export default {
}
}
},
showForm() {
this.$nextTick(() => {
console.log(this.form,'拓展组件form');
console.log(this.formList,'拓展组件formList');
const promises = this.formList.forEach((item) => {
item.form.map(async (group) => {
return group.children.reduce(async (accPromise, item) => {
const acc = await accPromise;
acc[item.formName] = null;
this.form[item.pformName].id = item.id
if (item.itemType == 'checkbox') {
this.form[item.pformName][item.formName] = item.value || []
} else if (item.itemType == 'cascader1' && item.orgPath) {
await this.getOrgTree()
this.form[item.pformName][item.formName] = item.orgPath.split(':') || null
} else{
this.form[item.pformName][item.formName] = item.value != null?item.value:null;
}
if (item.opctionUrl) {
try {
item.opction = await this.getDictDataForm(item.opctionUrl, item.opctionParams);
} catch (error) {
console.error('Error fetching options:', error);
}
}
return acc;
}, Promise.resolve({}));
})
})
Promise.all(promises).then((results) => {
async showForm() {
await this.$nextTick();
console.log(this.form, '拓展组件form');
console.log(this.formList, '拓展组件formList');
const promises = this.formList.map(async (item) => {
const groupPromises = item.form.map(async (group) => {
await group.children.reduce(async (accPromise, childItem) => {
const acc = await accPromise;
acc[childItem.formName] = null;
this.form[childItem.pformName].id = childItem.id;
if (childItem.itemType === 'checkbox') {
this.form[childItem.pformName][childItem.formName] = childItem.value || [];
} else if (childItem.itemType === 'cascader1' && childItem.orgPath) {
await this.getOrgTree();
let maxId = this.formList.filter(item => item.formId == 'parymemberInfoDto')[0].form[0].children.filter(item => item.formName == 'partyOrgId')[0].opction[0].id;
let orgId = JSON.parse(JSON.stringify(childItem.orgPath.split(':')));
orgId = orgId.slice(orgId.findIndex(item => item === maxId), orgId.length - 1)
this.form[childItem.pformName][childItem.formName] = orgId;
} else {
this.form[childItem.pformName][childItem.formName] = childItem.value != null ? childItem.value : null;
}
if (childItem.opctionUrl) {
try {
childItem.opction = await this.getDictDataForm(childItem.opctionUrl, childItem.opctionParams);
} catch (error) {
console.error('Error fetching options:', error);
}
}
return acc;
}, Promise.resolve({}));
});
return Promise.all(groupPromises);
});
try {
await Promise.all(promises);
console.log('Form processing complete');
} catch (error) {
console.error('Error processing form:', error);
}
},
}).catch((error) => {
console.error('Error fetching options:', error);
});
})
},
async getDictDataForm(url, params) {
try {
const { data } = await this.$http.post(url, params);

Loading…
Cancel
Save