Browse Source

Merge branch 'main' of http://39.108.216.210:3000/web/admin into main

duy 3 months ago
parent
commit
6f17ce99b2
2 changed files with 69 additions and 17 deletions
  1. 1 1
      public/version.json
  2. 68 16
      src/views/project/list/edit-formula.vue

+ 1 - 1
public/version.json

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

+ 68 - 16
src/views/project/list/edit-formula.vue

@@ -56,8 +56,13 @@
                                     <hc-search-input v-model="resetFunTree" @search="resetFunTreeSearch" />
                                 </template>
                                 <el-tree
-                                    ref="treeResetFunLazyRef" :default-expanded-keys="treeResetFunLazyExpanded" node-key="id" :props="defaultProps"
-                                    :expand-on-click-node="false" lazy highlight-current :load="treeResetFunLazyLoad" @node-click="treeResetFunLazyClick"
+                                    v-if="isResetFunTreeLazy" ref="treeResetFunLazyRef" :default-expanded-keys="treeResetFunLazyExpanded" node-key="id"
+                                    :props="defaultProps" :expand-on-click-node="false" lazy highlight-current :load="treeResetFunLazyLoad"
+                                    @node-click="treeResetFunLazyClick"
+                                />
+                                <el-tree
+                                    v-else ref="treeResetFunAllRef" :data="resetFunTreeAll" :props="defaultProps" node-key="id"
+                                    :expand-on-click-node="false" @node-click="treeResetFunLazyClick"
                                 />
                             </hc-card>
                         </template>
@@ -66,7 +71,7 @@
                                 <hc-search-input v-model="resetFunEle" placeholder="请输入你想搜索的元素字段" @search="resetFunEleSearch" />
                             </template>
                             <div class="body h-full">
-                                <div class="tag-box">
+                                <div v-loading="isResetFunEleLoading" class="tag-box">
                                     <template v-for="(item, index) in resetFunEleData" :key="index">
                                         <el-button v-if="item.k" type="primary" plain size="small" @click="resetFunEleTagClick(item)">{{ item.name }}</el-button>
                                         <el-button v-else type="primary" plain size="small" @click="resetFunEleTagClick(item)">{{ item.eName }}</el-button>
@@ -309,12 +314,14 @@ const defaultProps = {
 
 //重置函数懒加载树
 const treeResetFunLazyRef = ref(null)
+const treeResetFunAllRef = ref(null)
 const treeResetFunLazyExpanded = ref([])
 
 //获取重置函数懒加载树的数据
 const treeResetFunLoading = ref(false)
 const treeResetFunLazyLoad = async (node, resolve) => {
     const { level, data } = node
+    treeResetFunItemData.value = data
     let parentId = level !== 0 ? data.id : 12345678910
     const { eleType, node: dataNode, tableType } = getObjValue(dataInfo.value)
     const treeNode = getObjValue(dataNode)
@@ -362,14 +369,56 @@ const treeResetFunLazyClick = async (data, node) => {
 
 //重置函数树搜索
 const resetFunTree = ref('')
-const resetFunTreeSearch = () => {
-
+const resetFunTreeAll = ref([])
+const isResetFunTreeLazy = ref(true)
+const resetFunTreeSearch = async () => {
+    if (isNullES(resetFunTree.value)) {
+        isResetFunTreeLazy.value = true
+        return
+    }
+    isResetFunTreeLazy.value = false
+    treeResetFunLoading.value = true
+    const obj = treeResetFunItemData.value
+    const parentId = obj.hasChildren ? obj.id : ''
+    const { data, code } = await privateApi.tabTypeLazyTreeAll({
+        parentId: parentId,
+        current:1,
+        size:1000,
+        titleName: resetFunTree.value,
+    })
+    if (code !== 200) {
+        resetFunTreeAll.value = []
+        treeResetFunLoading.value = false
+        return
+    }
+    resetFunTreeAll.value = getArrValue(data?.records)
+    treeResetFunLoading.value = false
 }
 
 //重置函数元素搜索
 const resetFunEle = ref('')
-const resetFunEleSearch = () => {
-
+const isResetFunEleLoading = ref(false)
+const resetFunEleSearch = async () => {
+    const { initTableId } = treeResetFunItemData.value
+    if (isNullES(initTableId)) {
+        resetFunEleData.value = []
+        isResetFunEleLoading.value = false
+        return
+    }
+    isResetFunEleLoading.value = true
+    if (isNullES(resetFunEle.value)) {
+        const { data } = await treeApi.getTableElments({
+            id: initTableId,
+        })
+        resetFunEleData.value = getArrValue(data)
+    } else {
+        const { data } = await treeApi.getTableElments({
+            id: initTableId,
+            search: resetFunEle.value,
+        })
+        resetFunEleData.value = getArrValue(data)
+    }
+    isResetFunEleLoading.value = false
 }
 
 //获取节点详情
@@ -378,9 +427,11 @@ const getNodeDetailApi = async (item) => {
     await useClick(300)
     if (isNullES(item.initTableId)) {
         resetFunEleData.value = []
+        isResetFunEleLoading.value = false
         return
     }
     if (item.hasChildren === false || item.isLinkTable === 2) {
+        isResetFunEleLoading.value = true
         const { data } = await treeApi.getTableElments({
             id: item.initTableId,
         })
@@ -388,6 +439,7 @@ const getNodeDetailApi = async (item) => {
     } else {
         resetFunEleData.value = []
     }
+    isResetFunEleLoading.value = false
 }
 
 //重置函数 元素字段被点击
@@ -537,15 +589,6 @@ const selectEleFormulaItem = (item) => {
     selectEleFormula.value = arr
 }
 
-//保存
-const submitLoading = ref(false)
-const submitClick = async () => {
-    //重置函数
-    if (isResetFun.value) {
-        setProcessFormula()
-    }
-}
-
 //赋值给等号右边的数组
 const processFormula = ref([])
 const setProcessFormula = () => {
@@ -612,6 +655,15 @@ const projectQueryClick = () => {
     console.log('原来就没做这个功能')
 }
 
+//保存
+const submitLoading = ref(false)
+const submitClick = async () => {
+    //重置函数
+    if (isResetFun.value) {
+        setProcessFormula()
+    }
+}
+
 //关闭抽屉
 const drawerClose = () => {
     isShow.value = false