2213980799@qq.com 1 год назад
Родитель
Сommit
64a4be4b66
2 измененных файлов с 21 добавлено и 5 удалено
  1. 11 0
      src/api/doc-manage/index.js
  2. 10 5
      src/views/doc/components/main.vue

+ 11 - 0
src/api/doc-manage/index.js

@@ -402,3 +402,14 @@ export async function updateLcyStatus(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 排序
+ * @data data
+ */
+ export async function moveDirectory(data) {
+  const res = await request.post('/fm/directory/moveDirectory', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 10 - 5
src/views/doc/components/main.vue

@@ -52,6 +52,7 @@
               :expand-on-click-node="false"
               :default-expand-all="true"
               @node-click="onNodeClick"
+              @node-drop="nodeDrop"
               :allow-drop="allowDrop"
             >
               <span
@@ -71,10 +72,7 @@
                     width="130"
                     v-model="visible"
                     @click.native="visible = false"
-                    v-if="
-                      data.id == rightData.id &&fileType===0 &&
-                      !isPop
-                    "
+                    v-if="data.id == rightData.id && fileType === 0 && !isPop"
                     :offset="30"
                   >
                     <div>
@@ -156,7 +154,8 @@ import {
   directoryDeleteAPI,
   getDocTreeListAPI,
   directoryUpdateAPi,
-  validationPersonal
+  validationPersonal,
+  moveDirectory
 } from '@/api/doc-manage';
 import { mapGetters } from 'vuex';
 import Power from './power/index.vue';
@@ -324,6 +323,12 @@ export default {
         })
         .catch(() => {});
     },
+    nodeDrop(to, form) {
+      moveDirectory({
+        targetId: form.data.id,
+        replaceId: to.data.id
+      });
+    },
     getTableList() {
       return this.$refs.tableRef.getTableList();
     }