Browse Source

元素表排序

duy 2 years ago
parent
commit
c8b2b76e3b

+ 10 - 0
src/api/exctab/excelmodel.js

@@ -253,3 +253,13 @@ export const downExcelFile = (fileId) => {
       responseType: 'arraybuffer'
     })
 }
+//清表模板树节点排序
+export const exctabSort = (ids) => {
+    return request({
+        url: '/api/blade-manager/exceltab/tab-sort',
+        method: 'post',
+        params: {
+            ids,
+        }
+    })
+}

+ 1 - 3
src/views/manager/projectinfo/independent.vue

@@ -410,10 +410,8 @@ export default {
   },
   methods: {
  async sortpai(data,node) {
-      console.log(data,node);
       this.curNode=node;
-      this.curTreeData=data
-      
+      this.curTreeData=data;
       await this.findWbsTreePrivateSameLevel(node,data)
       this.sortTag = true;
       this.sortTag2 = true;

+ 18 - 12
src/views/manager/wbsinfo/element.vue

@@ -31,7 +31,7 @@
                  <el-link :underline="false">
                             <i
                               class="el-icon-sort"
-                              @click="sortpai(data, node)"
+                              @click.stop="sortpai(data, node)"
                               v-if="node.level == 2"
                               title="调整排序"
                             ></i>
@@ -507,6 +507,7 @@ import {saveElement, remove as removeElement, updateBatchElements, getTemplate,i
 import FormulaEdit from "@/views/formula/edit.vue";
 import PublicWbs from './PublicWbs.vue'
 import { searchNodeTables, } from "@/api/exctab/excelmodel";
+import {wbsInfotabSort} from "@/api/manager/wbsinfo";
 import { getDictionary } from "@/api/system/dict";
 import ManualSorting from '@/components/WbsTree/ManualSorting'
 
@@ -730,6 +731,7 @@ export default {
       defaultExpandKey:[],//默认展开的节点
       sortTag: false,
       sortTag2: false,
+      sort:[]
     }
   },
   computed:{
@@ -755,12 +757,14 @@ export default {
     },
     async sortpai(data,node) {
       console.log(data,node);
+      this.curNode=node;
+      this.curTreeData=data;
       await this.findWbsTreePrivateSameLevel(node,data)
       this.sortTag = true;
       this.sortTag2 = true;
     },
     editSort() {
-      this.wbsTreePrivateSort();
+      this.wbsInfotabSort();
     },
     bianhua() {
       this.sortTag2 = false;
@@ -768,15 +772,17 @@ export default {
         this.sortTag2 = true;
       });
     },
-    async wbsTreePrivateSort() {
-      //wbs私有树节点手动排序
-      // const { data: res } = await wbsTreePrivateSort(this.sort);
-      // console.log(res);
-      // if (res.code == 200) {
-      //   this.sortTag = false;
-      //   this.sortTag2 = false;
-      //   this. refreshTreeData();
-      // }
+    async wbsInfotabSort() {
+      //元素库、独立库节点排序
+      var newArr=this.sort.map((v)=>{return v.id})
+      newArr=newArr.join(',')
+      const { data: res } = await wbsInfotabSort(newArr);
+      console.log(res);
+      if (res.code == 200) {
+        this.sortTag = false;
+        this.sortTag2 = false;
+        this.refreshTreeData();
+      }
     },
     async findWbsTreePrivateSameLevel(node,data) {
        const { data: res } =await tabTypeLazyTreeAll({parentId:node.data.parentId,current:1,size:1000});
@@ -1027,7 +1033,7 @@ export default {
       tabTypeLazyTreeAll(
        {parentId:this.curTreeData.parentId,current:1,size:1000}
       ).then((res) => {
-        this.$refs.trees.updateKeyChildren(
+        this.$refs.avueTree.updateKeyChildren(
          this.curTreeData.parentId,
          res.data.data.records
         );