gangyj 2 жил өмнө
parent
commit
522b71d8d1

+ 27 - 0
src/api/manager/archivetree.js

@@ -100,3 +100,30 @@ export const submitArchiveTreeSort = (data) => {
     data
   })
 }
+
+//设置立卷规则保存接口
+export const saveArchiveAutoRule = (params) => {
+    return request({
+      url: '/api/blade-manager/archiveTree/saveArchiveAutoRule',
+      method: 'post',
+      params
+    })
+  }
+
+  //删除立卷规则接口
+export const removeArchiveAutoRule = (params) => {
+    return request({
+      url: '/api/blade-manager/archiveTree/removeArchiveAutoRule',
+      method: 'post',
+      params
+    })
+  }
+
+  //查看立卷规则接口
+export const getArchiveAutoRule = (params) => {
+    return request({
+      url: '/api/blade-manager/archiveTree/getArchiveAutoRule',
+      method: 'post',
+      params
+    })
+  }

+ 156 - 20
src/views/manager/archivetree.vue

@@ -256,9 +256,9 @@
                     :props="Rightprops"
                     :data="rightData"
                     node-key="id"
-                    ref="tree"
+                    ref="settree"
                     class="filter-tree"
-                    show-checkbox
+                    show-checkbox :check-strictly="true"
                     @check-change="handleCheckChange"
                   >
                    <div class="custom-tree-node" slot-scope="{ node, data }"   @mouseover="mouseOver(data)"
@@ -625,9 +625,7 @@
       append-to-body
     >
      <el-checkbox-group v-model="checkList">
-      <el-checkbox label="复选框 A" style="margin-bottom:10px"></el-checkbox><br/>
-      <el-checkbox label="复选框 B" style="margin-bottom:10px"></el-checkbox><br/>
-      <el-checkbox label="复选框 C" style="margin-bottom:10px"></el-checkbox><br/>
+      <el-checkbox :label="node.id" v-for="node in nodesList" :key="node.id" style="margin-bottom:10px">{{node.pathName}}</el-checkbox><br/>
     </el-checkbox-group>
       <span
         slot="footer"
@@ -636,12 +634,13 @@
         <el-button @click="highVisible=false,highVisible=false">取 消</el-button>
         <el-button
           type="primary"
-          @click="editSort()"
+          @click="setRecordsHandle()"
         >确 定</el-button>
       </span>
     </el-dialog>
+
     <!-- 查看配置 -->
-    <el-dialog
+    <!-- <el-dialog
         title="设置最高并卷层级"
         :visible.sync="configVisible"
         width="50%"
@@ -668,13 +667,42 @@
             @click="editSort()"
           >确 定</el-button>
         </span>
+      </el-dialog> -->
+      <el-dialog
+        :visible.sync="configVisible"
+        width="50%"
+        append-to-body
+      >
+        <div v-if="configInfo && configInfo.type">
+          <div>
+            <span>配置类别:</span>
+            <span v-if="configInfo.type == 1">最高并卷层级</span>
+            <span v-if="configInfo.type == 2">分类并卷</span>
+            <span v-if="configInfo.type == 3">独立组卷</span>
+          </div>
+        </div>
+        <div style="text-align: center;font-size: 22px;" v-else>
+          该节点尚未配置
+        </div>
+
+        <span
+          slot="footer"
+          class="dialog-footer"
+        >
+          <el-button @click="configVisible=false">取 消</el-button>
+          <el-button
+            type="primary"
+            @click="editSort()"
+          >确 定</el-button>
+        </span>
       </el-dialog>
+
   </basic-container>
 </template>
 
 <script>
 import ManualSorting from '@/components/WbsTree/ManualSorting'
-import { archiveTreeInit, lazyTree, dictionary, remove, archiveTreeSave, archiveTreeUpdate, archiveTreeDetail, archiveTreetree, submitDisplayConfigTree, getSameGradeNode, submitArchiveTreeSort } from "@/api/manager/archivetree";
+import { archiveTreeInit, lazyTree, dictionary, remove, archiveTreeSave, archiveTreeUpdate, archiveTreeDetail, archiveTreetree, submitDisplayConfigTree, getSameGradeNode, submitArchiveTreeSort,saveArchiveAutoRule,getArchiveAutoRule } from "@/api/manager/archivetree";
 import {getWbsList} from "@/api/manager/wbsinfo";
 import { getToken } from '@/util/auth';
 import { roletree } from "@/api/system/role.js";
@@ -936,8 +964,32 @@ export default {
         },
         highVisible:false,
         configVisible:false,
+
+        archiveAutoType:'',//最高1  分类2  独立3
+        nodesList:[],
+
+        configInfo:null,
+    }
+  },
+
+  computed:{
+    setName(){
+      let name = '';
+      switch (this.archiveAutoType) {
+        case 1:
+          name = '设置最高并卷层级';
+          break;
+        case 2:
+          name = '设置分类并卷层级';
+          break;
+        case 3:
+          name = '设置单独并卷层级';
+          break;
+      }
+      return name;
     }
   },
+
   methods: {
     //切换tabs
      handleClick(tab, event) {
@@ -950,19 +1002,74 @@ export default {
      confighandleClick(tab, event) {
         console.log(tab, event);
      },
+
+
      setHigh(){
-        this.highVisible=true
-       console.log('设置最高');
+      if(this.showHighVisible()){
+        this.archiveAutoType =1;
+      }
+        
+       //console.log('设置最高');
      },
      setType(){
-          console.log('设置类型');
+      if(this.showHighVisible()){
+        this.archiveAutoType =2;
+      }
+        //console.log('设置类型');
      },
     setAlone(){
-      console.log('设置独立');
+      if(this.showHighVisible()){
+        this.archiveAutoType =3;
+      }
+      //console.log('设置独立');
      },
-     viewConfig(data){
-       console.log(data,'查看配置');
-       this.configVisible=true
+      
+    showHighVisible(){
+      if(!this.publictreevalue && !this.testtreevalue){
+        this.$message({
+          message: '请先在下拉框选择树,在勾选树节点,再进行设置',
+          type: 'warning'
+        });
+        return false;
+      }
+      let nodes = this.$refs.settree.getCheckedNodes();
+      if(nodes.length < 1){
+        this.$message({
+          message: '请先勾选节点,再进行设置',
+          type: 'warning'
+        });
+        return false;
+      }
+      nodes.forEach((element)=>{
+        element.pathName = this.getTreeNodePath(element,'settree')
+      })
+      //console.log(nodes)
+      this.checkList = [];
+      this.nodesList = nodes;
+      this.highVisible=true;
+      return true;
+    },
+
+    async viewConfig(data){
+       //console.log(data,'查看配置');
+       this.configInfo = null;
+       const { data: res } = await  getArchiveAutoRule({
+        nodeId:data.id,//归档树节点的id 或者 挂载wbs节点的ID(具体哪个ID待定)
+        iswbsNode:false,//是否是wbs节点 flase 不是 true 是 (先false,具体怎么区分后面再看
+       })
+
+       if (res.code == 200 && res.msg == "操作成功") {
+        //console.log(res.data)
+        if(res.data.type){
+          this.configInfo = res.data;
+        }else if(res.data.archiveAutoType){
+          this.configInfo = {
+            type:2,
+            data:res.data
+          }
+        }
+        this.configVisible=true
+      }
      },
      handleCheckChange(data, checked, indeterminate) {
         console.log(data, checked, indeterminate);
@@ -1418,11 +1525,11 @@ export default {
       this.checkXuan = []
     },
     async archiveTreetree (da) {//右侧树全加载接口
-      const { data: res } = await archiveTreetree(da)
-      console.log(res);
-      if (res.code == 200 && res.msg == "操作成功") {
-        this.rightData = res.data
-      }
+      // const { data: res } = await archiveTreetree(da)
+      // console.log(res);
+      // if (res.code == 200 && res.msg == "操作成功") {
+      //   this.rightData = res.data
+      // }
     },
     //#endregion
 
@@ -1495,7 +1602,36 @@ export default {
       if (res.code == 200 && res.msg == "操作成功") {
         this.rightData = res.data
       }
+    },
+
+    //获取树节点名字路径
+    getTreeNodePath(node,refName){
+      let nodeInfo = this.$refs[refName].getNode(node.id);
+      //console.log(nodeInfo)
+      let pathArr = [];
+      while (nodeInfo.parent) {
+        pathArr.push(nodeInfo.data.title)
+        nodeInfo = nodeInfo.parent
+      }
+      return pathArr.reverse().join('/');
+    },
+
+    async setRecordsHandle(){
+      const { data: res } = await saveArchiveAutoRule({
+        archiveAutoType:this.archiveAutoType,//最高1  分类2  独立3
+        selectNodeIds:this.checkList.join(','),//鼠标选择的节点ID(只要鼠标选择的节点,选择节点的下级子节点那种不要),逗号拼接
+        iswbsNode:false,//是否是wbs节点   flase 不是 true 是 (先false,具体怎么区分后面再看)
+      })
+
+      if (res.code == 200 && res.msg == "操作成功") {
+        this.$message({
+          type: 'success',
+          message: '设置成功'
+        })
+        this.highVisible = false;
+      }
     }
+
   },
   watch: {
     filterText (val) {