Browse Source

修改文件

ZaiZai 11 months ago
parent
commit
cf5cde4e6d
1 changed files with 43 additions and 1 deletions
  1. 43 1
      src/views/project/modules/list/wbs-tree.vue

+ 43 - 1
src/views/project/modules/list/wbs-tree.vue

@@ -108,7 +108,7 @@ import { nextTick, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { HcFirmMsg, getStore, setStore } from 'hc-vue3-ui'
 import { getArrValue, getObjValue, isNullES } from 'js-fast-way'
-import { getDictionaryData } from '~uti/tools'
+import { getDictionaryData, reloadPage } from '~uti/tools'
 import wbsTreeApi from '~api/wbs/tree'
 import mainApi from '~api/wbs/private'
 import TreeNodeEditDialog from './tree-node-edit.vue'
@@ -331,11 +331,53 @@ const treeMenuClick = async ({ key, node, data }) => {
             }
         })
     } else if (key === 'sync2') {
+        const { primaryKeyId, pKeyId } = data
+        const pid = primaryKeyId ? primaryKeyId : pKeyId
+        if (isNullES(pid)) {
+            window.$message.warning('参数异常,请稍后重试')
+            return
+        }
         //同步节点基础信息及表单URL
+        await HcFirmMsg({
+            text: `是否同步节点【${data.title}】到合同段?`,
+            loadingText: '数据同步中...',
+        }, (resolve) => {
+            const { error, code, msg } = mainApi.syncNodeinfo(pid)
+            resolve()
+            if (!error && code === 200) {
+                window.$message.success('同步成功')
+                getInfoTableData()
+            } else {
+                window.$message.error(msg ?? '同步失败')
+            }
+        })
     } else if (key === 'sort') {
         //调整排序
     } else if (key === 'del') {
+        if (node.level <= 1) {
+            window.$message.warning('当前节点无法删除')
+            return
+        }
+        const { primaryKeyId, pKeyId } = data
+        const pid = primaryKeyId ? primaryKeyId : pKeyId
+        if (isNullES(pid)) {
+            window.$message.warning('参数异常,请稍后重试')
+            return
+        }
         //删除节点
+        await HcFirmMsg({
+            text: `此操作将删除节点【${data.title}】,是否继续?`,
+            loadingText: '删除节点中...',
+        }, (resolve) => {
+            const { error, code, msg } = mainApi.del(pid)
+            resolve()
+            if (!error && code === 200) {
+                window.$message.success('删除成功')
+                reloadPage()
+            } else {
+                window.$message.error(msg ?? '删除失败')
+            }
+        })
     }
 }