zhangh il y a 2 ans
Parent
commit
674dc6d1ad

+ 23 - 10
src/views/certificate/lists/addList.vue

@@ -182,6 +182,7 @@
           v-for="(item,key) in form.signPfxDeputieList"
           :key='key'
         >
+          <!-- 项目 -->
           <el-select
             style="width:300px;"
             class="martop20"
@@ -197,16 +198,17 @@
             >
             </el-option>
           </el-select>
+          <!-- 合同段 -->
           <el-select
             style="width:300px;"
             class="marleft20 martop20"
-            @focus="focusContractSection(form.signPfxDeputieList[key].projectId)"
+            @focus="focusContractSection(form.signPfxDeputieList[key].projectId,key)"
             :disabled='!form.signPfxDeputieList[key].projectId'
             v-model="form.signPfxDeputieList[key].contractId"
             placeholder="请选择"
           >
             <el-option
-              v-for="item in ContractSection"
+              v-for="item in ContractSection[key]"
               :key="item.id"
               :label="item.name"
               :value="item.id"
@@ -289,6 +291,12 @@ export default {
     }
   },
   methods: {
+    async init () {
+      if (this.$route.query.id != 0) {
+        await this.getById()
+      }
+      this.queryProjectAndContract()//获取项目和合同段
+    },
     //#region
     cancel () {//取消按钮
       this.$router.push('/certificate/list')
@@ -379,11 +387,10 @@ export default {
         roleId: '',
       })
     },
-    focusContractSection (projectId) {//获取合同段数据
+    focusContractSection (projectId, key) {//获取合同段数据
       this.projectMeiju.forEach(val => {
         if (val.id == projectId) {
-          this.ContractSection = val.contractInfoList
-          return
+          this.ContractSection[key] = val.contractInfoList
         }
       })
     },
@@ -395,6 +402,7 @@ export default {
     //#region //接口
     async getById () {//获取详细信息
       const { data: res } = await getById({ id: this.$route.query.id })
+      console.log(res);
       if (res.code == 200) {
         this.form = res.data
         this.form.certificateFileUrl = [{ raw: res.data.certificateFileUrl, name: this.form.certificateFileName }]
@@ -425,8 +433,13 @@ export default {
     },
     async queryProjectAndContract () {//获取项目和合同段
       const { data: res } = await queryProjectAndContract()
+      console.log(res);
       if (res.code == 200) {
         this.projectMeiju = res.data
+        this.form.signPfxDeputieList.forEach((val, key) => {
+          this.ContractSection.push(res.data[key].contractInfoList)
+        })
+        console.log(this.ContractSection);
       }
     },
     async findPfxType () {
@@ -456,14 +469,14 @@ export default {
     //#endregion
   },
   created () {
-    if (this.$route.query.id != 0) {
-      this.getById()
-    }
-    this.findUserByName()//关联用户
+    this.init()
     this.queryRole()//获取角色方
-    this.queryProjectAndContract()//获取项目和合同段
+    this.findUserByName()//关联用户
     this.findPfxType();//查询企业签章类型
   },
+  mounted () {
+
+  }
 }
 </script>
 

+ 6 - 7
src/views/manager/projectinfo/editElement/editElement.vue

@@ -184,6 +184,9 @@ import Vue from 'vue'
 export default {
   data () {
     return {
+      formData: {
+
+      },
       dataType: [],//数据类型
       tag: false,
       table: {
@@ -297,8 +300,8 @@ export default {
       var MyComponent = await Vue.extend({
         template: localStorage.getItem('editElement'),
         data () {
-          formData: {
-
+          return {
+            formData: {}
           }
         },
         methods: {
@@ -308,17 +311,13 @@ export default {
         }
       })
       var component = new MyComponent().$mount()
+      console.log(component.$el);
       document.getElementById('parent').appendChild(component.$el);
     },
     async copss () {
       let _that = this
       var MyComponent = await Vue.extend({
         template: localStorage.getItem('editElement'),
-        data () {
-          formData: {
-
-          }
-        },
         methods: {
           RightClick (tr, td, x1, x2, y1, y2) {//鼠标右键事件
             _that.RightClick2(tr, td, x1, x2, y1, y2)

+ 7 - 1
src/views/manager/wbsinfo/edit.vue

@@ -1443,7 +1443,13 @@ export default {
         children: 'children',
         label: 'title',
         isLeaf: function (data) {
-          return !data.hasChildren || (data.hasChildren && data.isExistForm == 1)
+          if (data.hasChildren && data.isExistForm != 1) {
+            return false
+          } else if (data.hasChildren && data.isExistForm == 1) {
+            return true
+          } else {
+            return true
+          }
         }
       },
       leftType: 5,

+ 146 - 61
src/views/system/user.vue

@@ -81,11 +81,20 @@
                 v-model="fromss.projectAndUserList[key].projectName"
                 :disabled="true"
               ></el-input>
-              <el-input
+              <el-select
                 class="marleft10"
                 v-model="fromss.projectAndUserList[key].contractName"
-                :disabled="true"
-              ></el-input>
+                placeholder="请选择"
+                @change="hetongChange(key)"
+              >
+                <el-option
+                  v-for="item in fromss.projectAndUserList[key].dataInfo"
+                  :key="item.id"
+                  :label="item.contractName"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
               <el-input
                 class="marleft10"
                 v-model="fromss.projectAndUserList[key].roleName"
@@ -155,7 +164,7 @@
               >
                 <el-option
                   v-for="item in roleIdsData"
-                  :key="item.id"
+                  :key="item.roleId"
                   :label="item.roleName"
                   :value="item.roleId"
                 >
@@ -942,13 +951,11 @@ export default {
       }
     },
     addfangfa () {//添加时确定添加按钮方法处理
-      let tag = true
       if (!this.fromss.projectId) {
         this.$message({
           type: "error",
           message: "请选择参与项目!"
         })
-        tag = false
         return
       }
       if (!this.fromss.contractId) {
@@ -956,7 +963,6 @@ export default {
           type: "error",
           message: "请选择合同段!"
         })
-        tag = false
         return
       }
       if (!this.fromss.roleIds) {
@@ -964,54 +970,107 @@ export default {
           type: "error",
           message: "请选择用户类型!"
         })
-        tag = false
         return
       }
-      this.fromss.projectAndUserList.forEach((val) => {
-        if (val.projectId == this.fromss.projectId && val.contractId == this.fromss.contractId) {
+      let tag = true, index = ''
+
+      if (this.fromss.projectAndUserList.length > 0) {
+        this.fromss.projectAndUserList.forEach((val, k) => {
+          if (val.projectId == this.fromss.projectId) {
+            index = k
+            tag = false
+          }
+        })
+      }
+      let das
+      if (tag) {
+        das = {
+          projectId: this.fromss.projectId,
+          contractId: this.fromss.contractId,
+          roleIds: this.fromss.roleIds,
+          roleName: '',
+          dataInfo: [{
+            contractName: '',
+            id: this.fromss.contractId,
+            roleIds: this.fromss.roleIds,
+            roleName: '',
+            roleType: '',
+          }],
+          contractName: this.fromss.contractId,
+        }
+        // 参与项目
+        this.projectData.forEach(vas => {
+          if (vas.id == this.fromss.projectId) {
+            das.projectName = vas.projectName
+          }
+        })
+        // 合同段
+        this.contractData.forEach(vas => {
+          if (vas.id == this.fromss.contractId) {
+            das.dataInfo[0].contractName = vas.contractName
+          }
+        })
+        // 用户类型
+        this.roleIdsData.forEach(vas => {
+          if (vas.roleId == this.fromss.roleIds) {
+            das.roleName = vas.roleName
+          }
+        })
+        //  添加进去
+        this.fromss.projectAndUserList.push(das)
+      } else {
+        let tags = true
+        this.fromss.projectAndUserList[index].dataInfo.forEach((val) => {
+          if (val.id == this.fromss.contractId) {
+            tags = false
+          }
+        })
+        if (tags) {
+          das = {
+            contractName: '',
+            id: this.fromss.contractId,
+            roleIds: this.fromss.roleIds,
+            roleName: '',
+            roleType: '',
+          }
+          // 参与项目
+          this.projectData.forEach(vas => {
+            if (vas.id == this.fromss.projectId) {
+              das.projectName = vas.projectName
+            }
+          })
+          // 合同段
+          this.contractData.forEach(vas => {
+            if (vas.id == this.fromss.contractId) {
+              das.contractName = vas.contractName
+            }
+          })
+          // 用户类型
+          this.roleIdsData.forEach(vas => {
+            if (vas.roleId == this.fromss.roleIds) {
+              das.roleName = vas.roleName
+            }
+          })
+          //  添加进去
+          this.fromss.projectAndUserList[index].dataInfo.push(das)
+          this.$message({
+            type: "success",
+            message: "添加成功"
+          })
+        } else {
           this.$message({
             type: "error",
-            message: "参与项目的合同段不能相同!"
+            message: "当前合同段已添加,无法继续添加"
           })
-          tag = false
-          return
         }
-        if (tag == false) return
-      })
-      if (tag == false) return
-
-      let tas = {
-        projectName: '',
-        contractName: '',
-        roleType: '',
-        roleName: ''
       }
-      this.projectData.forEach(val => {
-        if (val.id === this.fromss.projectId) {
-          tas.projectName = val.projectName
-        }
-      })
-      this.contractData.forEach(val => {
-        if (val.id === this.fromss.contractId) {
-          tas.contractName = val.projectName
-        }
-      })
-      this.roleIdsData.forEach(val => {
-        if (val.roleId === this.fromss.roleIds) {
-          tas.roleName = val.roleName
+    },
+    hetongChange (key) {//合同段changge事件
+      this.fromss.projectAndUserList[key].dataInfo.forEach(val => {
+        if (this.fromss.projectAndUserList[key].contractName == val.id) {
+          this.fromss.projectAndUserList[key].roleName = val.roleType + '|' + val.roleName
         }
       })
-      this.fromss.projectAndUserList.push({
-        projectId: this.fromss.projectId,
-        contractId: this.fromss.contractId,
-        roleId: this.fromss.roleIds,
-        projectName: tas.projectName,
-        contractName: tas.contractName,
-        roleName: tas.roleName
-      })
-      // this.fromss.projectId = ''
-      // this.fromss.contractId = ''
-      // this.fromss.roleIds = ''
     },
     async editKJ (row, index) {//编辑用户
       console.log(row);
@@ -1025,9 +1084,22 @@ export default {
     },
     deleteProject (key, type) {//删除参建项目按钮
       if (type == 'add') {
-        this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
+        console.log(key, type);
+        this.fromss.projectAndUserList[key].dataInfo.forEach(val => {
+          if (val.id == this.fromss.projectAndUserList[key].contractId) {
+            if (this.fromss.projectAndUserList[key].dataInfo.length == 1) {
+              this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
+            } else {
+              this.fromss.projectAndUserList[key].roleName = this.fromss.projectAndUserList[key].dataInfo[1].roleName
+              this.fromss.projectAndUserList[key].contractName = this.fromss.projectAndUserList[key].dataInfo[1].id
+              this.fromss.projectAndUserList[key].contractId = this.fromss.projectAndUserList[key].dataInfo[1].id
+              this.fromss.projectAndUserList[key].dataInfo.splice(val, 1)
+            }
+          }
+        })
+
       } else {
-        this.removeUsersByIds(this.fromss.projectAndUserList[key].id)
+        this.removeUsersByIds(this.fromss.projectAndUserList[key].contractName)
       }
     },
     async beforeClose (done) {//弹框关闭事件
@@ -1074,9 +1146,8 @@ export default {
       console.log(res);
       if (res.code === 200) {
         res.data.forEach(val => {
-          if (val.roleType) {
-            val.roleName = val.roleType + ' | ' + val.roleName
-          }
+          val.contractName = val.dataInfo[0].id
+          val.roleName = val.dataInfo[0].roleType + '|' + val.dataInfo[0].roleName
         })
         this.fromss.projectAndUserList = res.data
       }
@@ -1122,17 +1193,31 @@ export default {
       });
     },
     rowSave (row, done, loading) { //新增保存
-      add({ ...row, projectAndUserList: this.fromss.projectAndUserList }).then(() => {
-        this.initFlag = false;
-        this.onLoad(this.page);
-        this.$message({
-          type: "success",
-          message: "操作成功!"
+      if (this.fromss.projectAndUserList.length > 0) {
+        let projectAndUserList = []
+        this.fromss.projectAndUserList.forEach(val => {
+          if (val.dataInfo.length > 0) {
+            val.dataInfo.forEach(item => {
+              projectAndUserList.push({
+                projectId: val.projectId,
+                contractId: item.id,
+                roleId: item.roleIds,
+              })
+            })
+          }
+        })
+        add({ ...row, projectAndUserList }).then(() => {
+          this.initFlag = false;
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, () => {
+          loading();
         });
-        done();
-      }, () => {
-        loading();
-      });
+      }
     },
     rowUpdate (row, index, done, loading) {//修改按钮
       // row.roleId = row.roleId.join(",");

+ 2 - 2
vue.config.js

@@ -28,9 +28,9 @@ module.exports = {
                 //本地服务接口地址
                 // target: 'http://localhost',
                 // target: 'http://192.168.4.6',
-                target: 'http://47.110.251.215:8090',
+                // target: 'http://47.110.251.215:8090',
                 // target: 'http://192.168.4.12',
-                // target: 'http://192.168.4.44',
+                target: 'http://192.168.4.44',
                 //远程演示服务地址,可用于直接启动项目
                 //target: 'https://saber.bladex.vip/api',
                 ws: true,