admin 3 vuotta sitten
vanhempi
commit
49293dbd93
2 muutettua tiedostoa jossa 40 lisäystä ja 17 poistoa
  1. 7 0
      src/api/manager/contractinfo.js
  2. 33 17
      src/views/manager/contractinfo/detail.vue

+ 7 - 0
src/api/manager/contractinfo.js

@@ -145,4 +145,11 @@ export const saveUserInfoByProjectTow = (list) => {
         method: 'post',
         data: list
     })
+}
+export const searchRole = (list) => {
+    return request({
+        url: '/api/blade-system/search/role',
+        method: 'get',
+        data: list
+    })
 }

+ 33 - 17
src/views/manager/contractinfo/detail.vue

@@ -374,7 +374,7 @@
                     v-for="(item,key) in roleList"
                     :label="item.id"
                     :key="key"
-                  >{{item.title}}</el-radio-button>
+                  >{{item.roleName}}</el-radio-button>
                 </el-radio-group>
               </div>
               <div>
@@ -387,7 +387,7 @@
                   <el-option
                     v-for="item in postList"
                     :key="item.id"
-                    :label="item.postName"
+                    :label="item.roleName"
                     :value="item.id"
                   ></el-option>
                 </el-select>
@@ -507,8 +507,7 @@
 <script>
 import { getProjectDeatil, findProjectTree } from "@/api/manager/projectinfo";
 import {
-  submitContractInfo, getContractInfo, delFileFromUrl,
-  findPostByType, findAllUserByCondition, findUserByName,
+  submitContractInfo, getContractInfo, delFileFromUrl, searchRole, findAllUserByCondition, findUserByName,
   saveUserInfoByProjectTow, removeUsersByIds, resetPasswordByUserId,
   submitWbsTreeInContract, getContractInfoTree
 } from "@/api/manager/contractinfo";
@@ -630,11 +629,7 @@ export default {
       flageData: [],
 
       rId: '',
-      roleList: [
-        { title: '施工方人员', id: '1', },
-        { title: '监理方人员', id: '2', },
-        { title: '业主方人员', id: '3', }
-      ],
+      roleList: [],
       postId: '',
       postList: [],
       contractUserList: [],
@@ -659,19 +654,29 @@ export default {
     activeType: async function (newValue) {
       if (newValue == '3') {
         this.getUserByName();
+        this.searchRole()
       } else if (newValue == '2') {
         await this.getLeftTree();
         this.getRightTree();
       }
     },
     rId: function (newValue) {
-      findPostByType(newValue).then((res) => {
-        this.postList = res.data.data;
-      }).catch(() => {
-        this.postList = [];
-      }).finally(() => {
-        this.postId = '';
+      this.roleList.forEach(val => {
+        if (val.id === this.rId) {
+          if (val.children) {
+            this.postList = val.children
+          } else {
+            this.postList = []
+          }
+        }
       })
+      // findPostByType(newValue).then((res) => {
+      //   this.postList = res.data.data;
+      // }).catch(() => {
+      //   this.postList = [];
+      // }).finally(() => {
+      //   this.postId = '';
+      // })
     },
     postId: function (newValue) {
       if (newValue) {
@@ -682,7 +687,6 @@ export default {
     }
   },
   created () {
-    this.rId = '1'
     this.init();
     //console.log(this.userInfo)
   },
@@ -696,6 +700,18 @@ export default {
     })
   },
   methods: {
+    async searchRole () {
+      const { data: res } = await searchRole()
+      console.log(res);
+      if (res.code === 200) {
+        this.roleList = []
+        res.data.forEach(val => {
+          if (val.roleName == "施工方" || val.roleName == "监理方" || val.roleName == "业主方") {
+            this.roleList.push(val)
+          }
+        })
+      }
+    },
     async init () {
       this.pid = this.$route.query.pid;
       this.cid = this.$route.query.cid;
@@ -911,7 +927,7 @@ export default {
         projectId: this.pid,
         contractId: this.contractForm.id,
         userId: this.userId,
-        postId: this.postId,
+        roleId: this.postId,
       }];
       saveUserInfoByProjectTow(list).then(() => {
         // this.findAllUserByCondition();