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

Loading…
Cancel
Save