Przeglądaj źródła

处理模板页面字典样式渲染异常问题

lph 1 rok temu
rodzic
commit
fdd730a8c0

+ 13 - 5
zkqy-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -1209,12 +1209,20 @@ export default {
 
     // 设置表格字段样式
     async setFieldStyleData(tableList) {
+      console.log(JSON.parse(JSON.stringify(tableList)));
       let fieldConditionList = this.styleList.filter(
         (item) => item.styleType == 1 || item.styleType == 2
       );
       if (!fieldConditionList.length) return tableList;
       let res = await this.setDictStyleData();
-      this.dictStyleObj = res;
+
+      this.dictStyleObj = res.reduce((pre, item) => {
+        return {
+          ...pre,
+          ...item,
+        };
+      }, {});
+      // console.log("this.dictStyleObj", this.dictStyleObj);
       tableList.forEach((row) => {
         // if (!row.styleFieldObj) row.styleFieldObj = {};
         for (let i = 0; i < fieldConditionList.length; i++) {
@@ -1261,11 +1269,10 @@ export default {
         (item) => item.styleType == 2
       );
       if (!fieldConditionList.length) return;
-
-      return new Promise((resolve, reject) => {
-        fieldConditionList.forEach((item) => {
+      let PromiseList = fieldConditionList.map((item) => {
+        return new Promise((resolve, reject) => {
+          let temp = {};
           try {
-            let temp = {};
             listData({
               isEnablePaging: false,
               dictType: item.styleCondtion,
@@ -1278,6 +1285,7 @@ export default {
           }
         });
       });
+      return Promise.all(PromiseList);
     },
 
     // 内链页面跳转