Эх сурвалжийг харах

处理添加公式数据缓存及空值宽度自适应

yangg 9 сар өмнө
parent
commit
82d49796f3

+ 1 - 1
.env.development

@@ -2,5 +2,5 @@
 ENV = 'development'
 port = 8080
 # base api
-VUE_APP_BASE_API = 'http://192.168.1.199:8084'
+VUE_APP_BASE_API = 'http://58.246.234.210:8084'
 #192.168.1.199

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/index.html


+ 0 - 0
dist/static/css/chunk-141bb9eb.ce959b8e.css → dist/static/css/chunk-55322408.ce959b8e.css


+ 0 - 0
dist/static/css/chunk-042e52bc.68741a84.css → dist/static/css/chunk-b33cf6cc.68741a84.css


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/app.fedff5c5.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-042e52bc.f1b6967a.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-141bb9eb.fbe21d1f.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-48922aa8.86234cc0.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-55322408.a7c2edda.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-b33cf6cc.c42b7557.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/chunk-cde19f0e.9ea08112.js


+ 14 - 0
src/views/document/com/components/Formula/dataInfo.vue

@@ -346,12 +346,26 @@ export default {
 
           // 添加这行来强制重新获取数据
           _this.getInfo(_this.dataForm.id);
+          _this.resetFormAfterSave();
         })
         .catch((error) => {
           console.error("保存失败:", error);
           _this.$message.error("保存失败,请重试");
         });
     },
+    resetFormAfterSave() {
+      this.dataForm = {
+        id: 0,
+        name: "",
+        formula: "",
+        intro: "",
+        status: 5,
+        use_status: 5,
+        params: "[]",
+        point: 0,
+      };
+      // If you have any other data that needs to be reset, do it here
+    },
 
     //产品详情
     getInfo(id) {

+ 20 - 11
src/views/document/com/components/TextArea/index.vue

@@ -311,7 +311,7 @@ export default {
             }
           }
 
-        /*   console.log("识别的变量:", variables); // 添加日志 */
+          /*   console.log("识别的变量:", variables); // 添加日志 */
 
           // 定义一个安全的评估函数
           const safeEval = (formula, variables) => {
@@ -331,7 +331,7 @@ export default {
 
           try {
             const result = safeEval(formual, variables);
-           /*  console.log("计算结果:", result); // 添加日志 */
+            /*  console.log("计算结果:", result); // 添加日志 */
 
             let formattedResult;
             if (typeof result === "number" && !isNaN(result)) {
@@ -480,12 +480,18 @@ export default {
       this.$el.addEventListener("input", this.adjustInputWidth, true);
     },
     initializeInputWidths() {
-      const inputs = this.$el.querySelectorAll(".text-input-box");
+      const inputs = this.$el.querySelectorAll(
+        ".text-input-box, .text-input-boxs"
+      );
       inputs.forEach((input) => this.adjustInputWidth({ target: input }));
     },
 
+    // 修改这个方法,使其同时处理 variableNull 类型的输入框
     adjustInputWidth(event) {
-      if (event.target.classList.contains("text-input-box")) {
+      if (
+        event.target.classList.contains("text-input-box") ||
+        event.target.classList.contains("text-input-boxs")
+      ) {
         const input = event.target;
         const sizeCalculator = document.createElement("span");
         sizeCalculator.className = "size-calculator";
@@ -504,8 +510,13 @@ export default {
         document.body.removeChild(sizeCalculator);
       }
     },
+
+    // 修改这个方法,使其同时处理 variableNull 类型的输入框
     handleInputChange(event) {
-      if (event.target.classList.contains("text-input-box")) {
+      if (
+        event.target.classList.contains("text-input-box") ||
+        event.target.classList.contains("text-input-boxs")
+      ) {
         const attrId = event.target.id;
         const attrName = event.target.name;
         const dataIndex = parseInt(event.target.dataset.index, 10);
@@ -520,8 +531,6 @@ export default {
             }
           });
           this.$emit("onUpdateAttr", this.currentIndex, dataIndex, newValue);
-
-          // 使用 $nextTick 确保在 DOM 更新后执行
         } else {
           console.warn(`Unable to find attribute at index ${dataIndex}`);
         }
@@ -563,7 +572,7 @@ export default {
     //分析公式
     async analysisFormual(attrs) {
       let _this = this;
-     /*  console.log("开始分析公式:", attrs.formula); */
+      /*  console.log("开始分析公式:", attrs.formula); */
       let formual = attrs.formula;
 
       // 处理 [T][...][...] 引用
@@ -574,7 +583,7 @@ export default {
         async (match, p1, p2) => {
           try {
             let data = await _this.getModuleData(p1, p2);
-          /*   console.log(`获取到的数据: ${match} = ${data}`); */
+            /*   console.log(`获取到的数据: ${match} = ${data}`); */
             if (data === null || data === undefined) {
               console.warn(`获取到的数据无效: ${match}`);
               return "''"; // 返回空字符串而不是 0
@@ -790,7 +799,7 @@ export default {
       console.log("当前 coms:", _this.coms); */
 
       let item = _this.coms.filter((o) => o.name == code);
-    /*   console.log(`找到的模块:`, item); */
+      /*   console.log(`找到的模块:`, item); */
 
       if (item.length > 0) {
         let attr = item[0].attrs.filter((o) => o.name == attrName);
@@ -801,7 +810,7 @@ export default {
           return attr[0].content; // 返回原始值,不进行转换
         }
       }
-     /*  console.log("未找到匹配的模块或属性,返回空字符串"); */
+      /*  console.log("未找到匹配的模块或属性,返回空字符串"); */
       return ""; // 返回空字符串而不是 0
     },
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно