Преглед на файлове

公式引用菜单修改

duy преди 1 месец
родител
ревизия
39517f3a30
променени са 2 файла, в които са добавени 31 реда и са изтрити 13 реда
  1. 14 7
      src/views/data-fill/collapse-form/index.vue
  2. 17 6
      src/views/tentative/detect/components/ListItem.vue

+ 14 - 7
src/views/data-fill/collapse-form/index.vue

@@ -1164,16 +1164,23 @@ const tableFormRightTap = (
     //存储临时信息
     tableFormItemNode.value = { KeyName, index, startPos, endPos, pkeyId, initTableName:item.initTableName }
     console.log(clearFormula, 'clearFormula1111111')
+   // 先移除可能存在的旧菜单项
+    tableFormMenu.value = tableFormMenu.value.filter(
+        item => item.key !== 'cancelGs' && item.key !== 'addGs',
+    )
+
+    // 根据clearFormula值添加对应的菜单项
     if (clearFormula == 0) {
-         tableFormMenu.value.push({
-            label: '取消公式引用', key: 'cancelGs',
-         })
+        tableFormMenu.value.push({
+            label: '取消公式引用',
+            key: 'cancelGs',
+        })
     } else if (clearFormula == 1) {
         tableFormMenu.value.push({
-           label: '恢复公式引用', key: 'addGs',
-         })
-    }
-         
+            label: '恢复公式引用',
+            key: 'addGs',
+        })
+    }  
 
      
     contextMenuRef.value?.showMenu(event, false) //展开菜单

+ 17 - 6
src/views/tentative/detect/components/ListItem.vue

@@ -1093,14 +1093,25 @@ const onRightClick = (event, KeyName, index) => {
      console.log(baseData.value.id, 'baseData')
      const clearFormula = specialDom.getAttribute('clearFormula') || null
       console.log(clearFormula, 'clearFormula')
-     if (clearFormula == 0) {
-         tableFormMenu.value.push({
-            label: '取消公式引用', key: 'cancelGs',
-         })
+
+
+
+// 先移除可能存在的旧菜单项
+    tableFormMenu.value = tableFormMenu.value.filter(
+        item => item.key !== 'cancelGs' && item.key !== 'addGs',
+    )
+
+    // 根据clearFormula值添加对应的菜单项
+    if (clearFormula == 0) {
+        tableFormMenu.value.push({
+            label: '取消公式引用',
+            key: 'cancelGs',
+        })
     } else if (clearFormula == 1) {
         tableFormMenu.value.push({
-           label: '恢复公式引用', key: 'addGs',
-         })
+            label: '恢复公式引用',
+            key: 'addGs',
+        })
     }
    
     //存储临时信息