ZaiZai 1 year ago
parent
commit
6f0c706eb5

+ 16 - 0
src/api/modules/project/tree.js

@@ -65,4 +65,20 @@ export default {
             data: form,
         })
     },
+    //获取归档树同级节点
+    async getSameGradeNode(form) {
+        return HcApi({
+            url: '/api/blade-manager/archiveTree/get-same-grade-node',
+            method: 'get',
+            params: form,
+        })
+    },
+    //提交归档树手动排序
+    async submitTreeSort(form) {
+        return HcApi({
+            url: '/api/blade-manager/archiveTree/submit-tree-sort',
+            method: 'post',
+            data: form,
+        })
+    },
 }

+ 0 - 1
src/views/exctab/element/add-col-tab.vue

@@ -109,7 +109,6 @@ const dialogClose = () => {
     isShow.value = false
     submitLoading.value = false
     tableData.value = []
-    dataInfo.value = {}
     emit('close')
 }
 </script>

+ 0 - 2
src/views/exctab/element/element-lib.vue

@@ -132,8 +132,6 @@ const dialogSubmit = async () => {
 const dialogClose = () => {
     isShow.value = false
     submitLoading.value = false
-    dataInfo.value = {}
-    datas.value = []
     formModel.value = {}
     emit('close')
 }

+ 0 - 1
src/views/exctab/element/index.vue

@@ -276,7 +276,6 @@ const webTemplateClick = () => {
 //关闭抽屉
 const drawerClose = () => {
     isShow.value = false
-    dataInfo.value = {}
     emit('close')
 }
 </script>

+ 0 - 2
src/views/exctab/element/web-temp.vue

@@ -368,8 +368,6 @@ const uniqueArr = (arr1, arr2) => {
 const dialogClose = () => {
     isShow.value = false
     submitLoading.value = false
-    dataInfo.value = {}
-    datas.value = []
     emit('close')
 }
 </script>

+ 0 - 1
src/views/exctab/excel/excel-upload.vue

@@ -115,7 +115,6 @@ const dialogClose = () => {
     isShow.value = false
     submitLoading.value = false
     tableData.value = []
-    datas.value = {}
     emit('close')
 }
 </script>

+ 0 - 1
src/views/exctab/excel/template.vue

@@ -410,7 +410,6 @@ const fullScreenClick = () => {
 const drawerClose = () => {
     isShow.value = false
     tableTempExcelProps.value = {}
-    dataInfo.value = {}
     emit('close')
 }
 </script>

+ 0 - 1
src/views/exctab/excel/tree-sort.vue

@@ -89,7 +89,6 @@ const dialogClose = () => {
     isShow.value = false
     submitLoading.value = false
     tableData.value = []
-    datas.value = {}
     emit('close')
 }
 </script>

+ 0 - 1
src/views/project/list/info-dialog.vue

@@ -111,7 +111,6 @@ const getContractList = async (id) => {
 
 //关闭弹窗
 const dialogClose = () => {
-    projectId.value = ''
     projectInfo.value = {}
     isShow.value = false
     emit('close')

+ 13 - 1
src/views/project/tree/drawer-temp.vue

@@ -34,6 +34,8 @@
         </hc-body>
         <!-- 树节点新增 -->
         <HcTreeNodeForm v-model="isTreeFormShow" :info="dataInfo" :data="treeFormData" :node="treeFormNode" :type="treeFormType" @finish="pseudoRefresh" />
+        <!-- 树节点排序 -->
+        <HcTreeNodeSort v-model="isTreeSortShow" :data="treeSortData" @finish="pseudoRefresh" />
     </hc-drawer>
 </template>
 
@@ -42,6 +44,7 @@ import { ref, watch } from 'vue'
 import { HcFirmMsg } from 'hc-vue3-ui'
 import { getArrValue, isNullES } from 'js-fast-way'
 import HcTreeNodeForm from './tree-form.vue'
+import HcTreeNodeSort from './tree-sort.vue'
 import mainApi from '~api/project/tree'
 
 const props = defineProps({
@@ -126,6 +129,11 @@ const treeMenuClick = ({ key, data, node }) => {
         treeFormData.value = data
         treeFormNode.value = node
         isTreeFormShow.value = true
+    } else if (key === 'rank') {
+        treeSortData.value = data
+        isTreeSortShow.value = true
+    } else if (key === 'del') {
+        console.log('删除')
     } else if (key === 'sync') {
         syncTreeNode(data.id)
     }
@@ -137,6 +145,10 @@ const treeFormData = ref({})
 const treeFormNode = ref({})
 const treeFormType = ref('新增')
 
+//树节点排序
+const isTreeSortShow = ref(false)
+const treeSortData = ref({})
+
 //同步树节点
 const syncTreeNode = (id) => {
     HcFirmMsg({ text: '是否同步该节点?' }, async (resolve) => {
@@ -155,6 +167,7 @@ const pseudoRefresh = () => {
     treeFormData.value = {}
     treeFormNode.value = {}
     treeFormType.value = ''
+    treeSortData.value = {}
     setTimeout(()=> {
         isTreeMode.value = val
     }, 300)
@@ -218,7 +231,6 @@ const treeNodeTap = ({ data }) => {
 //关闭抽屉
 const drawerClose = () => {
     isShow.value = false
-    dataInfo.value = {}
     emit('close')
 }
 </script>

+ 0 - 3
src/views/project/tree/tree-form.vue

@@ -265,9 +265,6 @@ const dialogSubmit = async () => {
 const dialogClose = () => {
     isShow.value = false
     submitLoading.value = false
-    formInfo.value = {}
-    dataInfo.value = {}
-    nodeInfo.value = {}
     formModel.value = {}
     emit('close')
 }

+ 92 - 0
src/views/project/tree/tree-sort.vue

@@ -0,0 +1,92 @@
+<template>
+    <hc-dialog v-model="isShow" title="调整排序" widths="800px" is-table @close="dialogClose">
+        <hc-table
+            ref="tableRef" :column="tableColumn" :datas="tableData" is-row-drop is-sort
+            quick-sort @row-drop="rowDropTap" @row-sort="rowSortTap"
+        />
+        <template #footer>
+            <el-button hc-btn @click="dialogClose">取消</el-button>
+            <el-button hc-btn type="primary" :disabled="tableData.length <= 0" :loading="submitLoading" @click="dialogSubmit">提交</el-button>
+        </template>
+    </hc-dialog>
+</template>
+
+<script setup>
+import { nextTick, ref, watch } from 'vue'
+import { getArrValue, getObjValue } from 'js-fast-way'
+import mainApi from '~api/project/tree'
+
+const props = defineProps({
+    data: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//事件
+const emit = defineEmits(['finish', 'close'])
+
+//双向绑定
+const isShow = defineModel('modelValue', {
+    default: false,
+})
+
+//监听可否编辑
+const datas = ref(props.data)
+watch(() => props.data, (val) => {
+    datas.value = getObjValue(val)
+}, { immediate: true, deep: true })
+
+//监听显示
+watch(isShow, (val) => {
+    if (val) getDataApi()
+})
+
+//表格
+const tableRef = ref(null)
+const tableColumn = [{ key: 'nodeName', name: '表名' }]
+const tableData = ref([])
+
+//处理数据
+const getDataApi = async () => {
+    const { id } = getObjValue(datas.value)
+    const { data } = await mainApi.getSameGradeNode({ id })
+    tableData.value = getArrValue(data)
+}
+
+// 行拖拽
+const rowDropTap = (rows) => {
+    tableData.value = [] // 先清空,否则排序会异常
+    nextTick(() => {
+        tableRef.value?.setData(rows)
+    })
+}
+
+// 点击排序
+const rowSortTap = (rows) => {
+    tableData.value = [] // 先清空,否则排序会异常
+    nextTick(() => {
+        tableData.value = rows
+    })
+}
+
+//提交
+const submitLoading = ref(false)
+const dialogSubmit = async () => {
+    submitLoading.value = true
+    const { isRes } = await mainApi.submitTreeSort(tableData.value)
+    submitLoading.value = false
+    if (!isRes) return
+    window.$message.success('保存成功')
+    dialogClose()
+    emit('finish')
+}
+
+//关闭弹窗
+const dialogClose = () => {
+    isShow.value = false
+    submitLoading.value = false
+    tableData.value = []
+    emit('close')
+}
+</script>

+ 0 - 1
src/views/system/modules/dict/dict.vue

@@ -266,7 +266,6 @@ const dialogClose = () => {
 //关闭字典配置弹窗
 const configDialogClose = () => {
     isShow.value = false
-    dictInfo.value = {}
     tableData.value = []
     emit('close')
 }

+ 0 - 1
src/views/system/modules/dictbiz/dictbiz.vue

@@ -266,7 +266,6 @@ const dialogClose = () => {
 //关闭字典配置弹窗
 const configDialogClose = () => {
     isShow.value = false
-    dictInfo.value = {}
     tableData.value = []
     emit('close')
 }

+ 0 - 1
src/views/system/modules/user/role.vue

@@ -80,7 +80,6 @@ const dialogSubmit = async () => {
 //关闭弹窗
 const dialogClose = () => {
     isShow.value = false
-    userRoles.value = []
     submitLoading.value = false
     emit('close')
 }