From 1d87d23ddb41af30e875c8126d0c75d178e417f3 Mon Sep 17 00:00:00 2001
From: mk <2403457699@qq.com>
Date: Wed, 5 Jun 2024 13:56:11 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E7=BB=84=E7=BB=87=E5=9B=9E=E6=98=BE?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/resiExpand/editExpand.vue | 79 ++++++++++---------
1 file changed, 43 insertions(+), 36 deletions(-)
diff --git a/src/views/components/resiExpand/editExpand.vue b/src/views/components/resiExpand/editExpand.vue
index 55250372f..0f0d4827c 100644
--- a/src/views/components/resiExpand/editExpand.vue
+++ b/src/views/components/resiExpand/editExpand.vue
@@ -72,7 +72,6 @@
-
@@ -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);