ZaiZai 3 hónapja
szülő
commit
5e56a519b7
3 módosított fájl, 198 hozzáadás és 34 törlés
  1. 1 1
      public/version.json
  2. 196 32
      src/views/project/list/edit-formula.vue
  3. 1 1
      vite.config.js

+ 1 - 1
public/version.json

@@ -1,3 +1,3 @@
 {
-  "value": "20241112180306"
+  "value": "20241113172202"
 }

+ 196 - 32
src/views/project/list/edit-formula.vue

@@ -215,7 +215,7 @@
                                         </div>
                                     </div>
                                     <div class="input-box">
-                                        <draggable v-if="selectEleFormula.length > 0" v-model="selectEleFormula" item-key="index">
+                                        <draggable v-if="selectEleFormula3.length > 0" v-model="selectEleFormula3" item-key="index">
                                             <template #item="{ element }">
                                                 <span class="element-class" :class="[`is-${element.type}`, element.selected ? 'is-cur' : '']" @click="selectEleFormulaItem(element)">{{ element.name }}</span>
                                             </template>
@@ -265,7 +265,7 @@
                                         </div>
                                     </div>
                                     <div class="input-box">
-                                        <draggable v-if="selectEleFormula.length > 0" v-model="selectEleFormula" item-key="index">
+                                        <draggable v-if="selectEleFormula4.length > 0" v-model="selectEleFormula4" item-key="index">
                                             <template #item="{ element }">
                                                 <span class="element-class" :class="[`is-${element.type}`, element.selected ? 'is-cur' : '']" @click="selectEleFormulaItem(element)">{{ element.name }}</span>
                                             </template>
@@ -450,8 +450,18 @@ const resultFormulaItem = (item) => {
 //是否重置函数
 const isResetFun = ref(false)
 const resetFunClick = () => {
-    isResetFun.value = !isResetFun.value
-    isScrollBar.value = !isResetFun.value
+    if (deviationRangeShow.value) {
+        window?.$message.warning('请先关闭允许偏差值范围')
+        return
+    }
+    const val = !isResetFun.value
+    if (val) {
+        curRangeFocusIndex.value = 99
+    } else {
+        curRangeFocusIndex.value = 0
+    }
+    isResetFun.value = val
+    isScrollBar.value = !val
 }
 
 //tree树配置
@@ -593,10 +603,27 @@ const getNodeDetailApi = async (item) => {
     isResetFunEleLoading.value = false
 }
 
-//重置函数 元素字段被点击
+//元素字段被点击
 const selectEleFormula = ref([])
+const selectEleFormula3 = ref([])
+const selectEleFormula4 = ref([])
 const resetFunEleTagClick = (item) => {
-    const arr = selectEleFormula.value
+    const index = curRangeFocusIndex.value
+    if (index <= 0) {
+        window?.$message.warning('非正常操作')
+        return
+    }
+    let arr = []
+    if (index === 99) {
+        //重置函数
+        arr = selectEleFormula.value
+    } else if (index === 3) {
+        //参数1
+        arr = selectEleFormula3.value
+    } else if (index === 4) {
+        //参数2
+        arr = selectEleFormula4.value
+    }
     let { type, name } = getObjValue(arr[arr.length - 1])
     if (type === 'Text') {
         window?.$message.warning('元素无法连续出现在输入值后面')
@@ -608,7 +635,7 @@ const resetFunEleTagClick = (item) => {
     }
     if (arr.length === 0 || ['Operator', 'Brackets'].includes(type) || name === '(') {
         if (!isNullES(item.tableElementKey)) {
-            selectEleFormula.value.push({
+            const obj = {
                 type: 'Element',
                 name: item.eName,
                 id: item.id,
@@ -616,7 +643,14 @@ const resetFunEleTagClick = (item) => {
                 tableElementKey: item.tableElementKey,
                 index: getRandom(5),
                 children: [],
-            })
+            }
+            if (index === 99) {
+                selectEleFormula.value.push(obj)
+            } else if (index === 3) {
+                selectEleFormula3.value.push(obj)
+            } else if (index === 4) {
+                selectEleFormula4.value.push(obj)
+            }
         }
     } else {
         window?.$message.warning('当前操作不符合要求')
@@ -641,11 +675,27 @@ const promptMessageBox = async () => {
     })
 }
 
-//重置函数 输入值
+//输入值
 const resetFunText = async () => {
     const val = await promptMessageBox()
     if (isNullES(val)) return
-    const arr = selectEleFormula.value
+    const index = curRangeFocusIndex.value
+    if (index <= 0) {
+        window?.$message.warning('非正常操作')
+        return
+    }
+    //获取数组
+    let arr = []
+    if (index === 99) {
+        //重置函数
+        arr = selectEleFormula.value
+    } else if (index === 3) {
+        //参数1
+        arr = selectEleFormula3.value
+    } else if (index === 4) {
+        //参数2
+        arr = selectEleFormula4.value
+    }
     if (arr.length > 0) {
         let { type, name } = getObjValue(arr[arr.length - 1])
         if (type === 'Element') {
@@ -661,27 +711,68 @@ const resetFunText = async () => {
             return
         }
     }
-    selectEleFormula.value.push({
+    //公共对象
+    const obj = {
         type: 'Text',
         name: val,
         selected: false,
         index: getRandom(5),
-    })
+    }
+    if (index === 99) {
+        selectEleFormula.value.push(obj)
+    } else if (index === 3) {
+        selectEleFormula3.value.push(obj)
+    } else if (index === 4) {
+        selectEleFormula4.value.push(obj)
+    }
 }
 
-//重置函数 括号
+//括号
 const resetFunBrackets = (val) => {
-    selectEleFormula.value.push({
+    const index = curRangeFocusIndex.value
+    if (index <= 0) {
+        window?.$message.warning('非正常操作')
+        return
+    }
+    //公共对象
+    const obj = {
         type: 'Brackets',
         name: val,
         selected: false,
         index: getRandom(5),
-    })
+    }
+    if (index === 99) {
+        //重置函数
+        selectEleFormula.value.push(obj)
+    } else if (index === 3) {
+        //参数1
+        selectEleFormula3.value.push(obj)
+    } else if (index === 4) {
+        //参数2
+        selectEleFormula4.value.push(obj)
+    }
 }
 
-//重置函数 运算符
+//运算符
 const resetFunOperator = (val) => {
-    const arr = selectEleFormula.value, map = formulaMenuMap.value
+    const index = curRangeFocusIndex.value
+    if (index <= 0) {
+        window?.$message.warning('非正常操作')
+        return
+    }
+    //获取数组
+    let arr = []
+    if (index === 99) {
+        //重置函数
+        arr = selectEleFormula.value
+    } else if (index === 3) {
+        //参数1
+        arr = selectEleFormula3.value
+    } else if (index === 4) {
+        //参数2
+        arr = selectEleFormula4.value
+    }
+    const map = formulaMenuMap.value
     if (arr.length <= 0) {
         window?.$message.warning('公式开头不能是运算符号')
         return
@@ -696,40 +787,107 @@ const resetFunOperator = (val) => {
         return
     }
     const obj = getObjValue(map[val])
-    selectEleFormula.value.push({
+    //公共对象
+    const data = {
         type: 'Operator',
         name: symbolReg.exec(obj.name)[1],
         selected: false,
         template: obj.template,
         index: getRandom(5),
-    })
+    }
+    if (index === 99) {
+        selectEleFormula.value.push(data)
+    } else if (index === 3) {
+        selectEleFormula3.value.push(data)
+    } else if (index === 4) {
+        selectEleFormula4.value.push(data)
+    }
 }
 
-//重置函数 删除
+//删除
 const resetFunDel = () => {
-    const arr = deepClone(selectEleFormula.value)
-    if (arr.length <= 0) {
+    const index = curRangeFocusIndex.value
+    if (index <= 0) {
+        window?.$message.warning('非正常操作')
+        return
+    }
+    //获取数组
+    let arr = []
+    if (index === 99) {
+        //重置函数
+        arr = selectEleFormula.value
+    } else if (index === 3) {
+        //参数1
+        arr = selectEleFormula3.value
+    } else if (index === 4) {
+        //参数2
+        arr = selectEleFormula4.value
+    }
+    const newArr = deepClone(arr)
+    if (newArr.length <= 0) {
         window?.$message.warning('请先添加相关元素')
         return
     }
-    const index = arrIndex(arr, 'selected', true)
-    if (index !== -1) {
-        arr.splice(index, 1)
-        selectEleFormula.value = arr
+    const indexs = arrIndex(newArr, 'selected', true)
+    if (indexs !== -1) {
+        newArr.splice(indexs, 1)
+        if (index === 99) {
+            selectEleFormula.value = newArr
+        } else if (index === 3) {
+            selectEleFormula3.value = newArr
+        } else if (index === 4) {
+            selectEleFormula4.value = newArr
+        }
     } else {
-        arr.splice(arr.length - 1, 1)
-        selectEleFormula.value = arr
+        newArr.splice(newArr.length - 1, 1)
+        if (index === 99) {
+            selectEleFormula.value = newArr
+        } else if (index === 3) {
+            selectEleFormula3.value = newArr
+        } else if (index === 4) {
+            selectEleFormula4.value = newArr
+        }
     }
 }
 
-//重置函数 清空
+//清空
 const resetFunClear = () => {
-    selectEleFormula.value = []
+    const index = curRangeFocusIndex.value
+    if (index <= 0) {
+        window?.$message.warning('非正常操作')
+        return
+    }
+    if (index === 99) {
+        //重置函数
+        selectEleFormula.value = []
+    } else if (index === 3) {
+        //参数1
+        selectEleFormula3.value = []
+    } else if (index === 4) {
+        //参数2
+        selectEleFormula4.value = []
+    }
 }
 
 //被点击
 const selectEleFormulaItem = (item) => {
-    const arr = selectEleFormula.value
+    const index = curRangeFocusIndex.value
+    if (index <= 0) {
+        window?.$message.warning('非正常操作')
+        return
+    }
+    //获取数组
+    let arr = []
+    if (index === 99) {
+        //重置函数
+        arr = selectEleFormula.value
+    } else if (index === 3) {
+        //参数1
+        arr = selectEleFormula3.value
+    } else if (index === 4) {
+        //参数2
+        arr = selectEleFormula4.value
+    }
     for (let i = 0; i < arr.length; i++) {
         if (item.index === arr[i].index) {
             arr[i].selected = !arr[i].selected
@@ -737,7 +895,13 @@ const selectEleFormulaItem = (item) => {
             arr[i].selected = false
         }
     }
-    selectEleFormula.value = arr
+    if (index === 99) {
+        selectEleFormula.value = arr
+    } else if (index === 3) {
+        selectEleFormula3.value = arr
+    } else if (index === 4) {
+        selectEleFormula4.value = arr
+    }
 }
 
 //赋值给等号右边的数组

+ 1 - 1
vite.config.js

@@ -30,7 +30,7 @@ export default defineConfig({
                 manualChunks(id) {
                     let libStr = `
                     @vue,vue-router,pinia,hc-vue3-ui,js-fast-way,element-plus, @vojtechlanka/vue-tags-input,
-                    echarts,vuedraggable,split.js,nprogress,avue-plugin-ueditor,@smallwei/avue`
+                    echarts,split.js,nprogress,avue-plugin-ueditor,@smallwei/avue`
                     const libs = libStr.split(',')
                     if (id.includes('node_modules')) {
                         const arr = id.toString().split('node_modules/')[1].split('/')