Browse Source

Merge branch 'master' of http://47.110.251.215:3000/web/saber into master

yangyj 2 năm trước cách đây
mục cha
commit
ffe1712849

+ 11 - 0
src/api/manager/wbsprivate.js

@@ -167,4 +167,15 @@ export const delTabInfoAll = (pKeyId) => {
       pKeyId,
     }
   })
+}
+//后管-删除项目表单
+export const delAprojectTab = (primaryKeyIds,projectId) => {
+  return request({
+    url: '/api/blade-manager/wbsPrivate/del-aprojecttab-info',
+    method: 'post',
+    params: {
+      primaryKeyIds,
+      projectId
+    }
+  })
 }

+ 9 - 3
src/views/manager/projectinfo/editElement/editElement.vue

@@ -257,6 +257,10 @@ export default {
       type:String,
       default:''
     },
+    initTableId:{
+      type:String,
+      default:''
+    },
     pid:{
       type:String,
       default:''
@@ -497,7 +501,8 @@ export default {
           formUploadError(){},
           uploadprogress(){},
           formRemoteMethod(){},
-          formRemoteChange(){}
+          formRemoteChange(){},
+          checkboxGroupChange(){}
         }
       })
       var component = new MyComponent().$mount()
@@ -531,7 +536,8 @@ export default {
           formUploadError(){},
           uploadprogress(){},
           formRemoteMethod(){},
-          formRemoteChange(){}
+          formRemoteChange(){},
+          checkboxGroupChange(){}
         }
       })
       var component = new MyComponent().$mount()
@@ -580,7 +586,7 @@ export default {
       }
     },
     async getElementInfoByTabId () {//获取字段信息
-      const { data: res } = await getElementInfoByTabId({ tabId: this.id })
+      const { data: res } = await getElementInfoByTabId({ tabId: this.initTableId })
       console.log(res);
       if (res.code === 200) {
         this.options = res.data

+ 17 - 18
src/views/manager/projectinfo/independent.vue

@@ -185,7 +185,7 @@
 </template>
 
 <script>
-import {tabTypeLazyTree,removeTableByCondition} from "@/api/manager/wbsprivate";
+import {tabTypeLazyTree,delAprojectTab} from "@/api/manager/wbsprivate";
 import {
   updateBatchNodeTableInfo,
   selectByNodeTable,
@@ -197,8 +197,6 @@ import {
   saveLinkTab,
   getExcelHtml,
 } from "@/api/exctab/excelmodel"
-import {
-  getDetail,} from "@/api/manager/wbsprivate";
 import Qute from "./qutediaolog/qute.vue";//引入元素库
 import Relation from './qutediaolog/relation.vue'//关联清表
 import EditElement from "@/views/manager/projectinfo/editElement/editElement.vue";//编辑元素
@@ -212,7 +210,7 @@ export default {
      ids () {
       let ids = [];
       this.selectionList.forEach(ele => {
-        ids.push(ele.id);
+        ids.push(ele.primaryKeyId);
       });
       return ids.join(",");
     }
@@ -485,15 +483,16 @@ export default {
         type: "warning"
       })
         .then(() => {
-          let ids=this.ids.split(',')
-          ids.forEach((item)=>{
-            return removeTableByCondition(item,this.projectid,this.wbsid);
-          })
+        return delAprojectTab(this.ids,this.projectid);
          
           
         })
         .then(() => {
-         this.tabTypeLazyTree(this.treeId, this.projectid,this.page.current,this.page.size)
+         this.tabTypeLazyTree(this.treeId, this.projectid,this.page.current,this.page.size).then((res)=>{
+          console.log(res,'res');
+          this.page.total=res.total;
+          this.loadData=res.records
+         })
 
           this.$message({
             type: "success",
@@ -513,13 +512,12 @@ export default {
      Associationlist(row) {
        console.log('关联清表',row);
        this.$refs.Relation.show()
-      // this.GLExcelFrom.name = row.modeId;
+      // this.GLExcelFrom.name = row.title;
    
       this.GLExcelFrom.id = row.primaryKeyId;
-      // this.GLExcelFrom.excelId =row.id;
-      // this.GLExcelFrom.ids = row.id;
-      // this.GLEidxcelFrom.initTableName =row.title;
-      // this.GLExcelFrom.excelId=row.excelId
+      this.GLExcelFrom.excelId =row.excelIds;
+      this.GLExcelFrom.ids = row.id;
+      this.GLExcelFrom.initTableName =row.initTableName
     },
        //#region 编辑元素
     async rightClick(row) {
@@ -527,9 +525,9 @@ export default {
       await this.getExcelHtml2(row.id);
       // console.log('编辑元素');
       this.editElementQuery.pkeyId = row.primaryKeyId;
-      // this.editElementQuery.excelId = excelId;
+      this.editElementQuery.excelId = row.excelIds;
       this.editElementQuery.id = row.id;
-      this.editElementQuery.initTableName =row. title;
+      this.editElementQuery.initTableName =row. initTableName;
       this.editElementQuery.pid = this.$route.query.pid;
       this.editElementQuery.wbsid = this.$route.query.wbsid;
       // this.editElementQuery.nodeid = this.curTreeData.id;
@@ -544,7 +542,7 @@ export default {
       }
     },
       //#region 调整表单
-    adjustExcel(pkeyId, excelId) {
+    adjustExcel(id,pkeyId) {
       this.excelHtml=true
       // console.log('调整表单');
       // //调整表单
@@ -552,8 +550,9 @@ export default {
       this.getExcelHtml(pkeyId);
     },
     handleEditFormula(row) {
-      console.log('公式');
+      console.log(row,'公式');
       this.curEleTable = row;
+      //  selectFormElements(this.curEleTable.initTableId).then((res) => {
       selectFormElements(this.curEleTable.id).then((res) => {
         this.editEleListFilter = res.data.data;
         this.editEleListAll = [].concat(this.editEleListFilter);

+ 3 - 4
src/views/manager/projectinfo/qutediaolog/relation.vue

@@ -152,10 +152,9 @@ export default {
                     size: 100000,
                     parentId: 0,
                 });
-                // setTimeout(() => {
-                //     console.log(11111111);
-                //     // this.$refs.tree.setCheckedKeys([this.GLExcelFrom.excelId]);
-                // }, 2000);
+                setTimeout(() => {
+                    this.$refs.tree.setCheckedKeys([this.GLExcelFrom.excelId]);
+                }, 2000);
             },
            GLExcelMD() {
                 //弹框关闭事件

+ 16 - 25
src/views/manager/projectinfo/tree.vue

@@ -444,7 +444,8 @@
                           scope.row.pkeyId,
                           scope.row.excelId,
                           scope.row.id,
-                          scope.row.initTableName
+                          scope.row.initTableName,
+                          scope.row.initTableId
                         )
                       "
                       >编辑元素</el-link
@@ -551,7 +552,8 @@
                           scope.row.pkeyId,
                           scope.row.excelId,
                           scope.row.id,
-                          scope.row.initTableName
+                          scope.row.initTableName,
+                          scope.row.initTableId
                         )
                       "
                       >编辑元素</el-link
@@ -1433,6 +1435,7 @@
         :initTableName="editElementQuery.initTableName"
         :pid="editElementQuery.pid"
         :wbsid="editElementQuery.wbsid"
+        :initTableId="editElementQuery.initTableId"
         :nodeid="editElementQuery.nodeid"
         @hideDialog="editElementVisible = false"
         v-if="editElementVisible"
@@ -1523,6 +1526,7 @@ export default {
         ids: "",
         excelId: "",
         initTableName: "",
+        initTableId:""
       },
       GLExcelData: [], //
       GLExcelProps: {
@@ -1670,9 +1674,10 @@ export default {
         excelId: "",
         id: "",
         initTableName: "",
+        initTableId:"",
         pid: "",
         wbsid: "",
-        nodeid: "",
+        nodeid: ""
       }, //传参
 
       syncBtnLoad: false,
@@ -1965,7 +1970,7 @@ export default {
 
     handleEdit(index, row) {
       this.curEleTable = row;
-      selectFormElements(this.curEleTable.id).then((res) => {
+      selectFormElements(this.curEleTable.initTableId).then((res) => {
         res.data.data.forEach((element) => {
           this.eleReg.exec(element.eAllowDeviation);
           // console.log(RegExp.$1)
@@ -2016,7 +2021,7 @@ export default {
     },
     handleEditFormula(index, row) {
       this.curEleTable = row;
-      selectFormElements(this.curEleTable.id).then((res) => {
+      selectFormElements(this.curEleTable.initTableId).then((res) => {
         this.editEleListFilter = res.data.data;
         this.editEleListAll = [].concat(this.editEleListFilter);
       });
@@ -2033,7 +2038,7 @@ export default {
     saveNewEle(row) {
       row.eAllowDeviation =
         (row.allow ? row.allow : "") + (row.deviation ? row.deviation : "");
-      row.fId = this.curEleTable.id;
+      row.fId = this.curEleTable.initTableId;
       row.initTableName = this.curEleTable.initTableName;
       if (row.eType == 4) {
         row.eLength = 0;
@@ -2128,8 +2133,6 @@ export default {
       this.nodeDetail.mixRatioTestIds = this.toJoin(newarr);
     },
     filterChange() {
-      //console.log(this.$refs)
-      //debugger
       if (this.treeData.length > 0) {
         this.$refs.treeall.filter(this.filterText);
         return;
@@ -2601,7 +2604,8 @@ export default {
             this.GLExcelFrom.id,
             this.GLExcelFrom.excelId,
             this.GLExcelFrom.ids,
-            this.GLExcelFrom.initTableName
+            this.GLExcelFrom.initTableName,
+            this.GLExcelFrom.initTableId
           );
         }
       } else {
@@ -2783,26 +2787,13 @@ export default {
     //#endregion
 
     //#region 编辑元素
-    async rightClick(pkeyId, excelId, id, initTableName) {
+    async rightClick(pkeyId, excelId, id, initTableName,initTableId) {
       await this.getExcelHtml2(pkeyId);
-
-      // this.$router.push({
-      //   path: '/project/editElement',
-      //   query: {
-      //     pkeyId: pkeyId,
-      //     excelId: excelId,
-      //     id: id,
-      //     initTableName,
-      //     pid: this.$route.query.pid,
-      //     wbsid: this.$route.query.wbsid,
-      //     nodeid:this.curTreeData.id,
-      //   }
-      // })
-
       this.editElementQuery.pkeyId = pkeyId;
       this.editElementQuery.excelId = excelId;
       this.editElementQuery.id = id;
       this.editElementQuery.initTableName = initTableName;
+      this.editElementQuery.initTableId = initTableId;
       this.editElementQuery.pid = this.$route.query.pid;
       this.editElementQuery.wbsid = this.$route.query.wbsid;
       this.editElementQuery.nodeid = this.curTreeData.id;
@@ -3081,7 +3072,7 @@ export default {
         path: '/project/independent',
         query: { pid: this.projectid,wbsid:this.$route.query.wbsid }
 
-      
+
       });
     }
 

+ 212 - 17
src/views/manager/wbsinfo/element.vue

@@ -129,6 +129,7 @@
           <el-table-column
             prop="tableOwner"
             label="所属方"
+
           >
             <template slot-scope="scope">
               <el-select
@@ -237,7 +238,7 @@
     <PublicWbs  ref="PublicWbs" :from="from"/>
     <!-- 编辑元素 -->
      <el-dialog
-      :title="(curEleTable.tableName?curEleTable.tableName:'')+'  元素编辑'"
+      :title="(curEleTable.title?curEleTable.title:'')+'  元素编辑'"
       :visible.sync="editEleVisible"
       width="80%"
       append-to-body
@@ -444,6 +445,7 @@
 import { detailExcel, excelType, tabLazytree,  wbstree, getWbsTypeList,} from '@/api/exctab/excelmodel';
 import {updateBatchNodeTableInfo,selectByNodeTable,selectFormElements} from "@/api/manager/wbstree";
 import {tabTypeLazyTreeAll,delTabInfoAll} from "@/api/manager/wbsprivate";
+import {saveElement, remove as removeElement, updateBatchElements, getTemplate,importWbsElement} from "@/api/manager/wbsformelement";
 import FormulaEdit from "@/views/formula/edit.vue";
 import PublicWbs from './PublicWbs.vue'
 import { searchNodeTables, } from "@/api/exctab/excelmodel";
@@ -461,6 +463,17 @@ export default {
       selectionList:[],
       tableTypelist:[],
       ownerTypeList:[],
+      dataTypeList:[],
+           //数据类型的默认长度
+      dataTypeDefaultMap: {
+        1: 250,//字符串
+        2: 50,//整数
+        3: 50,//小数
+        4: 50,//日期
+        5: 50,//数值
+        6: 50,//签名
+        7: 100,//文件
+      },
       page: {
         size: 10,
         current: 1,
@@ -496,6 +509,7 @@ export default {
           {
             label: "元素表类型",
             prop: "tabType",
+           
             // search: true,
             rules: [
               {
@@ -520,8 +534,9 @@ export default {
             ],
           },
           {
-            label: "所方",
+            label: "所方",
             prop: "tabOwner",
+        
 
             editDisplay: false,
             addDisplay: false,
@@ -648,6 +663,52 @@ export default {
     }
   },
   methods: {
+     addEleRow (list) {
+      list.push({});
+    },
+    delEleRow (index, list) {
+      list.splice(index, 1);
+    },
+    delEleRowHandle (index, list) {
+      let row = list[index];
+      if (row.id) {
+        //有id需要请求删除
+        this.$confirm('是否确认删除?', '删除元素', {
+          distinguishCancelAndClose: true,
+          confirmButtonText: '删除',
+          cancelButtonText: '取消'
+        }).then(() => {
+          // removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(() => {
+          //   list.splice(index, 1);
+          // })
+          // this.curEleTable.elementTotal --;
+             removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(() => {
+            list.splice(index, 1);
+          })
+          this.curEleTable.elementTotal --;
+        })
+      } else {
+        list.splice(index, 1);
+      }
+    },
+     formatTableType(row, column, cellValue) {
+      for (let i = 0; i < this.tableTypelist.length; i++) {
+        if (this.tableTypelist[i].dictKey == cellValue) {
+          return this.tableTypelist[i].dictValue;
+        }
+      }
+      return cellValue;
+      //console.log(cellValue)
+    },
+    formatOwner(row, column, cellValue) {
+      for (let i = 0; i < this.ownerTypeList.length; i++) {
+        if (this.ownerTypeList[i].dictKey == cellValue) {
+          return this.ownerTypeList[i].dictValue;
+        }
+      }
+      return cellValue;
+      //console.log(cellValue)
+    },
       currentChange (currentPage) {
         this.page.currentPage = currentPage;
       },
@@ -741,7 +802,8 @@ export default {
     editElement (row) {
       console.log(row,'row');
       this.curEleTable = row;
-      selectFormElements(this.curEleTable.initTableId).then((res) => {
+      // selectFormElements(this.curEleTable.initTableId).then((res) => {
+         selectFormElements(this.curEleTable.id).then((res) => {
         res.data.data.forEach((element) => {
           this.eleReg.exec(element.eAllowDeviation);
           //console.log(RegExp.$1)
@@ -752,6 +814,10 @@ export default {
         this.editEleList = res.data.data;
       })
       this.editEleVisible = true;
+    },
+      //修改数据类型,给个默认值
+    setDefaultLength (row) {
+      this.$set(row, 'eLength', this.dataTypeDefaultMap[row.eType]);
     },
     //分配节点
     distribution(row){
@@ -761,13 +827,113 @@ export default {
       
       // this.AssociatedPublicTap = true;
     },
-     handleEditFormula (index, row) {
-      // this.curEleTable = row;
-      // selectFormElements(this.curEleTable.initTableId).then((res) => {
+    
+    saveNewEle (row) {
+      if (!row.eName) {
+        this.$message({
+          type: "warning",
+          message: "请填写元素名称"
+        });
+        return;
+      }
+      if (!row.eType) {
+        this.$message({
+          type: "warning",
+          message: "请选择数据类型"
+        });
+        return;
+      }
 
-      //   this.editEleListFilter = res.data.data;
-      //   this.editEleListAll = [].concat(this.editEleListFilter);
-      // })
+      row.eAllowDeviation = (row.allow ? row.allow : '') + (row.deviation ? row.deviation : '');
+      row.fId = this.curEleTable.id;
+      row.initTableName = this.curEleTable.initTableName;
+      // if (row.eType == 4) {
+      //   this.$set(row, 'eLength', 0);
+      //   //row.eLength = 0;
+      // } else
+      if (!row.eLength) {
+        this.$message({
+          type: "warning",
+          message: "请填写长度"
+        });
+        return;
+      }
+
+      saveElement(row).then((res) => {
+        if (res.data.data) {
+          this.$set(row, 'id', res.data.data.id);
+          this.$set(row, 'ekey', res.data.data.ekey);
+          this.$message({
+            type: "success",
+            message: "保存成功!"
+          });
+        }
+      })
+    },
+    saveEles () {
+      for (let i = 0; i < this.editEleList.length; i++) {
+        if (!this.editEleList[i].id) {
+          this.$message({
+            type: "warning",
+            message: "请先将新增的元素点击保存"
+          });
+          return;
+        }
+        if (!this.editEleList[i].eName) {
+          this.$message({
+            type: "warning",
+            message: "请填写第" + (i + 1) + "条元素名称"
+          });
+          return;
+        }
+        if (!this.editEleList[i].eType) {
+          this.$message({
+            type: "warning",
+            message: "请选择第" + (i + 1) + "条数据类型"
+          });
+          return;
+        }
+        if ( !this.editEleList[i].eLength) {
+          this.$message({
+            type: "warning",
+            message: "请填写第" + (i + 1) + "条长度"
+          });
+          return;
+        }
+      }
+      if (this.editEleList.length > 0) {
+        this.editEleList.forEach((element) => {
+          element.eAllowDeviation = (element.allow ? element.allow : '') + (element.deviation ? element.deviation : '');
+          // if (element.eType == 4) {
+          //   this.$set(element, 'eLength', 0);
+          //   //element.eLength = 0;
+          // }
+        })
+        updateBatchElements(this.editEleList, this.curEleTable.initTableName).then(() => {
+          this.editEleVisible = false;
+          this.updateNodeTable();
+          this.$message({
+            type: "success",
+            message: "保存成功!"
+          });
+        })
+      } else {
+        this.editEleVisible = false;
+        this.updateNodeTable();
+        this.$message({
+          type: "success",
+          message: "保存成功!"
+        });
+      }
+    },
+     handleEditFormula ( row) {
+       console.log(row,'row');
+      this.curEleTable = row;
+      selectFormElements(this.curEleTable.id).then((res) => {
+
+        this.editEleListFilter = res.data.data;
+        this.editEleListAll = [].concat(this.editEleListFilter);
+      })
       this.editEleFormulaVisible = true;
     },
      //搜索 筛选
@@ -795,13 +961,15 @@ export default {
       console.log('编辑元素表单信息');
       // this.editElementFormTag=true
         console.log('编辑元素表单信息');
+        
         if (this.selectionList.length === 0) {
         this.$message.warning("请选择至少一条数据");
         return;
       }
        if (this.elemtData.length) {
         let da = []
-        this.formDatass = [...this.selectionList]
+        this.formDatass = [...this.selectionList];
+        console.log(this.formDatass,'his.formDatass111');
         this.formDatass.forEach(val => {
           da.push({
             tableType: val.tabType,
@@ -813,9 +981,21 @@ export default {
         })
         this.formDatass = da
         console.log(this.formDatass,'this.formDatass');
+        let fa=[]
+        this.formDatass.forEach(val=>{
+             let newarr= this.tableTypelist.filter(e => e.dictValue===val.tableType);
+             let newarr1= this.ownerTypeList.filter(e => e.dictValue===val.tableOwner);
+              fa.push({
+              tableType: newarr[0].dictKey,
+              tableOwner: newarr1[0].dictKey,
+              id: val.id,
+              tableName: val.tableName,
+              fillRate: val.fillRate,
+            })
+        })
+        this.formDatass=fa
         this.editElementFormTag = true;
-         this.getTableTypelist();
-         this.getOwnerTypelist();
+         
       }
     },
      getOwnerTypelist() {
@@ -831,6 +1011,19 @@ export default {
         this.ownerTypeList = res.data.data;
       });
     },
+    getDataTypelist() {
+      if (this.dataTypeList.length > 1) {
+        return;
+      }
+      getDictionary({
+        code: "data_type",
+      }).then((res) => {
+        res.data.data.forEach((element) => {
+          element.dictKey = Number(element.dictKey);
+        });
+        this.dataTypeList = res.data.data;
+      });
+    },
     getTableTypelist() {
       if (this.tableTypelist.length > 1) {
         return;
@@ -863,13 +1056,12 @@ export default {
           tag = false
           return
         } else {
-         let newarr= this.tableTypelist.filter(e => e.dictValue===val.tableType);
-         let newarr1= this.ownerTypeList.filter(e => e.dictValue===val.tableOwner);
+      
           da.push({
             id: val.id,
             nodeName: val.tableName,
-            tableType: newarr[0].dictKey,
-            tableOwner: newarr1[0].dictKey,
+            tableType: val.tableType,
+            tableOwner:val.tableOwner,
             fillRate: val.fillRate,
           })
         }
@@ -960,7 +1152,10 @@ export default {
     let id=12345678910
     this.tabTypeLazyTreeAll(id).then((res)=>{
             this.treeData=res.records;
-        })
+        });
+     this.getTableTypelist();
+     this.getOwnerTypelist();
+     this.getDataTypelist();
   },
   mounted () {
     // this.heightss = this.$refs.rulesss.clientHeight