Sfoglia il codice sorgente

fix: 修复生产原因不显示

yanghao 6 giorni fa
parent
commit
589a14a9b9
2 ha cambiato i file con 25 aggiunte e 23 eliminazioni
  1. 2 2
      config/env.dev.js
  2. 23 21
      pages/recordFilling/detail.vue

+ 2 - 2
config/env.dev.js

@@ -1,7 +1,7 @@
 // 开发环境配置
 export default {
-	apiUrl: 'http://192.168.188.16:48080',
-	// apiUrl: 'https://iot.deepoil.cc',
+	// apiUrl: 'http://192.168.188.16:48080',
+	apiUrl: 'https://iot.deepoil.cc',
 	// apiUrl: 'https://aims.deepoil.cc', //正式
 	apiUrlSuffix: '/admin-api',
 	// 其他开发环境配置...  

+ 23 - 21
pages/recordFilling/detail.vue

@@ -474,28 +474,30 @@ const queryList = (pageNo, pageSize) => {
                 // 如果是enum类型,且description不为null,则根据description获取对应字典项数组,赋值给enumList
                 if (nonSumItem.type == "enum" && nonSumItem.description) {
                   console.log("🚀 ~ onSumItem.description:");
-                  nonSumItem.enumList =
+                  const dictOptions =
                     nonSumItem.name === "非生产原因"
-                      ? getIntDictOptions(nonSumItem.description).map(
-                          (dict) => {
-                            return {
-                              ...dict,
-                              text: dict.label,
-                            };
-                          }
-                        )
-                      : getStrDictOptions(nonSumItem.description).map(
-                          (dict) => {
-                            return {
-                              ...dict,
-                              text: dict.label,
-                            };
-                          }
-                        );
-                  console.log(
-                    "🚀 ~  nonSumItem.enumList:",
-                    nonSumItem.enumList
-                  );
+                      ? getIntDictOptions(nonSumItem.description)
+                      : getStrDictOptions(nonSumItem.description);
+
+                  nonSumItem.enumList = dictOptions.map((dict) => {
+                    return {
+                      ...dict,
+                      text: dict.label,
+                    };
+                  });
+
+                  // 确保 fillContent 的类型与 enumList 中的 value 类型匹配
+                  if (nonSumItem.name === "非生产原因") {
+                    // 如果是"非生产原因",将 fillContent 转换为数字类型以匹配 getIntDictOptions
+                    if (
+                      nonSumItem.fillContent !== null &&
+                      nonSumItem.fillContent !== ""
+                    ) {
+                      nonSumItem.fillContent = parseInt(nonSumItem.fillContent);
+                    }
+                  }
+
+                  console.log("🚀 ~ nonSumItem.enumList:", nonSumItem.enumList);
                 }
               });
             }