Browse Source

配置划分接口调用

duy 1 year ago
parent
commit
fdd1950dee

+ 9 - 0
src/api/tentative/testcollect.js

@@ -112,4 +112,13 @@ export const cancelAllocation = (row) => {
     method: 'post',
     params: row
   })
+}
+
+//匹配划分
+export const matching = (row) => {
+  return request({
+    url: '/api/blade-manager/trial/summary/matching',
+    method: 'post',
+    data: row
+  })
 }

+ 11 - 11
src/router/views/index.js

@@ -323,22 +323,22 @@ export default [{
         import ( /* webpackChunkName: "views" */ '@/views/tentative/testclassify')
     }, {
       path: '/tentative/testcollect',
-      name: '试验台账分类配置',
+      name: '试验汇总分类配置',
       meta: {
         i18n: 'testcollect'
       },
       component: () =>
-        import ( /* webpackChunkName: "views" */ '@/views/tentative/testcollect')
-    },
-    {
-        path: '/tentative/testclassifyset',
-        name: '试验汇总分类配置',
-        meta: {
-          i18n: 'testclassifyset'
-        },
-        component: () =>
-          import ( /* webpackChunkName: "views" */ '@/views/tentative/testclassifyset')
+        import ( /* webpackChunkName: "views" */ '@/views/tentative/testclassifyset')
     },
+    // {
+    //     path: '/tentative/testclassifyset',
+    //     name: '试验汇总分类配置',
+    //     meta: {
+    //       i18n: 'testclassifyset'
+    //     },
+    //     component: () =>
+    //       import ( /* webpackChunkName: "views" */ '@/views/tentative/testclassifyset')
+    // },
     {
         path: '/tentative/dataMap',
         name: '数据映射配置',

+ 56 - 36
src/views/tentative/components/configDivision.vue

@@ -12,7 +12,7 @@
    <div class="mg-b-10">
     <el-alert
         :closable="false"
-        title="选择需要关联的清表 注意:每次只能单选操作"
+        title="勾选试验划分节点,被勾选的节点数据将会汇总到当前台账分类中"
         type="warning">
       </el-alert>
    </div>
@@ -21,12 +21,12 @@
           style="width: 100%"
           v-model="testGLExcelFrom.name"
           placeholder="请选择"
-          @change="changetherr()"
+          @change="changetherr"
         >
           <el-option
             v-for="(item, key) in testGLExcelData"
             :key="key"
-            :label="item.name"
+            :label="item.projectName"
             :value="item.id"
           >
           </el-option>
@@ -44,10 +44,10 @@
             style="margin-top: 10px"
             :props="testGLExcelProps"
             :data="testexceldata"
-            node-key="id"
+            node-key="primaryKeyId"
             accordion
             show-checkbox
-            @check="checkchange"
+            @check-change="checkchange"
             v-loading="testGLExcelLoading"
           >
           </el-tree>
@@ -63,7 +63,7 @@
           style="margin-left: 30px"
           type="primary"
           v-throttle="2000"
-          @click="saveLinkTab()"
+          @click="saveLink()"
           >确 定</el-button
         >
       </span>
@@ -71,18 +71,19 @@
    </template>
    
    <script>
-     import {
-  getList as getListQing,
-  tabLazytreeAll,
-  saveLinkTab,
-  getExcelHtml,
-} from "@/api/exctab/excelmodel";
+
+import { getProjectList,findProjectTree } from "@/api/manager/projectinfo";
+import {matching} from "@/api/tentative/testcollect";
     export default{
         props: {
             testGLExcel: {
                 type: Boolean,
                 default:false
             },
+            setId:{
+              type:[String,Number],
+              default:''
+            }
         
         },
         data(){
@@ -100,9 +101,9 @@
                 testGLExcelData:[],
                 testexceldata:[],
                 testGLExcelProps: {
-                label: "name",
+                label: "title",
                 children: "children",
-                disabled: "hasChildren",
+                // disabled: "hasChildren",
                 isLeaf: function (data) {
                 let tag = false;
                 if (!data.hasChildren) {
@@ -127,13 +128,10 @@
 
                 this.testGLExcel = false;
             },
-            async tabLazytreeAll() {
+            async tabLazytreeAll(val,pid) {
                 //清表树信息
                 this.GLExcelLoading = true;
-                const { data: res } = await tabLazytreeAll({
-                    modeId: this.testGLExcelFrom.name,
-                    name: this.testGLExcelFrom.search,
-                });
+                const { data: res } = await findProjectTree(val,pid);
                 this.testGLExcelLoading = false;
                 console.log(res);
                 if (res.code === 200 && res.msg === "操作成功") {
@@ -141,18 +139,21 @@
                 }
              },
             async getList(da) {
-            //获取清表模板信息
-                const { data: res } = await getListQing(da);
-                        console.log(res);
-                        if (res.code === 200 && res.msg === "操作成功") {
-                        this.testGLExcelData = res.data.records;
-                        }
+                    getProjectList(1, 999).then((res) => {
+                      this.testGLExcelData = res.data.data.records;
+                    });
+                  
              },
-            changetherr() {
-                //清表类型选择框change事件
+            changetherr(val) {
                 if (this.testGLExcelFrom.name != "") {
                     this.testGLExcelFrom.search = "";
-                    this.tabLazytreeAll();
+                    let pid=''
+                    this.testGLExcelData.forEach((ele)=>{
+                      if(ele.id===val){
+                        pid=ele.referenceWbsTemplateIdTrial
+                      }
+                    })
+                    this.tabLazytreeAll(val,pid);
                 }
             },
             filterNode222(value,data,node) {
@@ -169,19 +170,35 @@
                     return result;
              },
             getReturnNode2(node,_array,value){
-                let isPass = node.data &&  node.data.name && node.data.name.indexOf(value) !== -1;
+                let isPass = node.data &&  node.data.title && node.data.title.indexOf(value) !== -1;
                 isPass?_array.push(isPass):'';
                 if(!isPass && node.level!=1 && node.parent){
                     this.getReturnNode2(node.parent,_array,value);
                 }
             },
-            checkchange(data) {
-                //节点选中回调
-                if (this.$refs.tree.getCheckedNodes().length === 0) {
-                this.$refs.tree.setCheckedKeys([]);
-                } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
-                this.$refs.tree.setCheckedKeys([data.id]);
-                }
+            checkchange(data1,data2,data3) {
+          
+            },
+            saveLink(){
+              let checkIds=this.$refs.tree.getCheckedKeys()
+              if(checkIds.length==0){
+                this.$message.warning('请选择关联的内容')
+                return
+              }
+              matching({
+                classId:this.setId,
+                ids:checkIds.join(',')
+              }).then(() => {
+                  this.$message({
+                    type: "success",
+                    message: "操作成功!"
+                  });
+                  this.testGLExcel=false
+                }, error => {
+               
+                  console.log(error);
+                });
+
             },
         },
         watch:{
@@ -200,6 +217,9 @@
                     this.$refs.tree.filter(val);
                 }
             },
+            setId(val){
+                this.setId=val
+            }
         }
     }
    </script>

+ 2 - 1
src/views/tentative/testclassifyset.vue

@@ -93,7 +93,7 @@
       </span>
     </el-dialog>
     <!-- 配置划分数据 -->
-    <configDivision :testGLExcel="testGLExcel"></configDivision>
+    <configDivision :testGLExcel="testGLExcel" :setId="setId"></configDivision>
     </basic-container>
   </template>
   
@@ -409,6 +409,7 @@ import configDivision from "./components/configDivision.vue";
     //配置划分
     configurationClick(row){
       this.testGLExcel=true
+      this.setId=row.id
     },
     //数据映射配置
     associatedClick() {