Explorar el Código

项目数据同步接口调用

duy hace 2 meses
padre
commit
a6ecdac987
Se han modificado 1 ficheros con 97 adiciones y 29 borrados
  1. 97 29
      src/views/manager/projectinfo/tree.vue

+ 97 - 29
src/views/manager/projectinfo/tree.vue

@@ -1927,8 +1927,8 @@
                     :expand-on-click-node="false"
                     highlight-current
                     node-key="primaryKeyId"
-                    ref="tree"
                    @check="handleCheckChange"
+                   ref="syncProTree"
                   >
                   </el-tree>
                  
@@ -1937,7 +1937,7 @@
         </el-card>
         <el-card class="box-card-2">
             <el-form ref="syncForm" :model="syncForm"  label-position="top">
-                <el-form-item label="同步范围">
+                <el-form-item label="同步范围" v-if="!isShowTable">
                       <el-radio-group v-model="syncForm.range">
                         <el-radio
                           v-for="item in rangeOptions"
@@ -1961,7 +1961,7 @@
                     </el-checkbox-group>
                   </el-form-item>
                   <el-form-item label="选择同步源" prop="templateId" v-else>
-                    <el-select v-model="syncForm.templateId" placeholder="请选择同步源" style="width: 100%;" size="small">
+                    <el-select v-model="syncForm.templateId" placeholder="请选择同步源" style="width: 100%;" size="small" @change="changeTemplateId">
                       <el-option
                         v-for="item in templateIdList"
                         :key="item.id"
@@ -1976,6 +1976,7 @@
               <el-table
               
               size="small"
+              ref="proTable"
                   :data="preTableData"
                   stripe
                   style="width: 100%"
@@ -1987,17 +1988,19 @@
                     width="55">
                   </el-table-column>
                   <el-table-column
-                    prop="date"
+                    prop="tableName"
                     label="表单名称"
                     width="180">
                   </el-table-column>
                   <el-table-column
-                    prop="name"
+                   prop="tableType"
+                  :formatter="formatTableType"
                     label="表单类型"
                     width="180">
                   </el-table-column>
                   <el-table-column
-                    prop="address"
+                      prop="tableOwner"
+                     :formatter="formatOwner"
                     label="所属方">
                   </el-table-column>
                 </el-table>
@@ -2062,9 +2065,9 @@ import {
   getLinekNodeTreelist,getNameRule,getTitleRange,saveOrUpdateNameRule,deletedNameRule
 } from "@/api/manager/wbsprivate";
 import { findProjectTree as getAlltree } from "@/api/manager/projectinfo";
-import { findProjectTreeTrial as getAlltreeTrial } from "@/api/manager/projectinfo";
+
 import { refrehPram } from "@/api/manager/wbstree";
-import { getTableElments } from "@/api/manager/wbstree";
+
 import { getList as getAttchFromOriginalName } from "@/api/resource/attach";
 import { getDictionary, getChildList } from "@/api/system/dict";
 import { mapGetters } from "vuex";
@@ -2077,6 +2080,7 @@ import {
 import { getStore, setStore } from "@/util/store";
 
 import { getTempProject,addSync } from "@/api/manager/ledger";
+import { selectByNodeTable   as findNodeTableByCondition1 } from "@/api/manager/wbstree";
 
 export default {
   data() {
@@ -2432,13 +2436,7 @@ export default {
         contractRangeName:'',
         formIds:''
       },
-      preTableData:
-      [{
-          date: '2016-05-03',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }
-      ],
+      preTableData:[],
       multipleSelection: [],
       checkIdList:[
        
@@ -4095,10 +4093,16 @@ export default {
 
     syncNodeTableHandle(data) {
      console.log('后管数据同步',data);
-     this.syncForm.size='1'
+     this.syncForm.range='1'
      this.proSyncTag=true
      this.isShowLeft=false
      this.isShowTable=true
+     this.getTypeOptions()
+      this.getRangeOptions()
+      this.getCheckIdList()
+      console.log(data.primaryKeyId,'ids');
+      
+      this.getTempProjectList(data.primaryKeyId)
      
     },
     syncProjectHandle(data) {
@@ -4135,10 +4139,20 @@ export default {
     //同步元素表单排序到合同段
     syncSortHandle(data) {
       console.log('同步到合同');
-       this.syncForm.size='2'
+       this.syncForm.range='2'
        this.proSyncTag=true
        this.isShowLeft=false
        this.isShowTable=true
+       this.getTypeOptions()
+      this.getRangeOptions()
+      this.getCheckIdList()
+      selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
+          if (res.data.data.length) {
+            this.preTableData = res.data.data;
+          } else {
+            this.preTableData = [];
+          }
+        });
       
     },
     typeTreeLoadNode(node, resolve) {
@@ -4714,6 +4728,41 @@ export default {
          
         }
      },
+    async changeTemplateId(val){
+    
+       let type=''
+       let projectId=''
+       for (let index = 0; index < this.templateIdList.length; index++) {
+            const elemet = this.templateIdList[index];
+            if(elemet.id==val){
+              type = elemet.type;
+              projectId=elemet.id
+             
+              break
+            }
+        }
+        if(type===2){
+          selectByNodeTable(this.curTreeData.id, projectId, this.id).then((res) => {
+          if (res.data.data.length) {
+            this.preTableData = res.data.data;
+          } else {
+            this.preTableData = [];
+          }
+        });
+        }else{
+          const { data: res } = await findNodeTableByCondition1( this.curTreeData.id )
+          if (res.code === 200) {
+            console.log(Array.isArray(res.data));
+            if (Array.isArray(res.data)) {
+              this.preTableData = res.data
+            
+            } else {
+              this.preTableData = []
+            }
+          }
+        }
+       
+     },
      async getCheckIdList(){
       let code=this.wbsType!==1?'wbs_sync_contract_range':'wbs_sync_contract_quality'
           getDictionary({
@@ -4724,7 +4773,24 @@ export default {
      },
      
     closeProSyncTag(){
-      this.syncForm={}
+      this.syncForm={
+        range:'',
+        rangeName:'',
+        type:[],
+        typeName:'',
+        templateId:'',
+        templateName:'',
+        contractRange:[],
+        contractRangeName:'',
+        formIds:''};
+      
+       if(this.$refs.syncProTree){
+        this.$refs.syncProTree.setCheckedKeys([])
+       }
+        if(this.$refs.proTable){
+          this.refs.proTable.clearSelection()
+        }
+        this.preTableData=[]
     },
     saveProTag(){
       console.log(this.syncForm,'this.syncForm');
@@ -4736,8 +4802,10 @@ export default {
        contractRange:this.syncForm.contractRange.join(',')
       }
       ).then((res) => {
+        this.saveProTagLoading=false
         if(res.data.code==200){
         this.$message.success(res.data.msg)
+        this.closeProSyncTag()
          
         }else{
           this.$message.error(res.data.msg)
@@ -4756,7 +4824,15 @@ export default {
         this.isIndeterminate = checkedCount > 0 && checkedCount < this.typeOptions.length;
      },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
+      let arr = []
+      if(val.length>0){
+        for (let index = 0; index < val.length; index++) {
+          let i = val[index];
+         arr.push(i.id)
+        }
+
+        this.syncForm.formIds=arr.join(',')
+      }
     },
     handleCommand(command){
       // this.$message('click on item ' + command);
@@ -4806,18 +4882,10 @@ export default {
   },
   'syncForm.templateId': {
     handler(newVal) {
-      // if (newVal && newVal.length) {
-      //   const selectedValues = newVal.map(key => {
-      //     const item = this.templateIdList.find(item => item.dictKey === key);
-      //     return item ? item.dictValue : key;
-      //   });
-      //   this.syncForm.templateName = selectedValues.join(',');
-      // } else {
-      //   this.syncForm.templateName = '';
-      // }
+ 
       if (newVal && newVal.length) {
           for (let index = 0; index < this.templateIdList.length; index++) {
-            const elemet = this.rangeOptions[index];
+            const elemet = this.templateIdList[index];
             if(elemet.id==newVal){
               this.syncForm.templateName = elemet.name;
               break