Browse Source

班组人员获取方式调整

wangtao 1 year ago
parent
commit
b4e0378f2f
3 changed files with 55 additions and 14 deletions
  1. 1 1
      src/utils/request.js
  2. 50 12
      src/views/MochaITOM/crew/index.vue
  3. 4 1
      src/views/index/components/alarming.vue

+ 1 - 1
src/utils/request.js

@@ -15,7 +15,7 @@ let baseURL = process.env.VUE_APP_BASE_API
 axios.defaults.headers['Content-Type'] = 'application/json;multipart/form-data;charset=utf-8'
 const service = axios.create({
     baseURL: baseURL, // url = base url + request url
-    timeout: 10000, // request timeout
+    timeout: 20000, // request timeout
     // withCredentials:true,
 
 })

+ 50 - 12
src/views/MochaITOM/crew/index.vue

@@ -57,7 +57,7 @@
     </el-table>
 
     <!-- 修改、新增对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :before-close="cancel" :close-on-click-modal="false">
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :before-close="cancel" :close-on-click-modal="false">
       <el-form ref="form" :model="form" :rules="rules" label-width="auto" >
         <el-row :gutter="20">
           <el-col :span="12" >
@@ -74,7 +74,7 @@
                 <span>{{ scope.$index +1 }}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="switch" label="负任人" align='center'>
+            <el-table-column prop="switch" label="负任人" align='center' width="80">
               <template slot-scope="scope">
                 <el-switch
                   v-model="scope.row.switch"
@@ -82,19 +82,24 @@
                 ></el-switch>
               </template>
             </el-table-column>
-            <el-table-column prop="name" label="姓名" align='center'>
+            <el-table-column prop="userId" label="姓名" align='center' width="350">
               <template slot-scope="scope">
-                <span v-if="!scope.row.isEgdit">{{scope.row.name}}</span>
-                <el-input v-if="scope.row.isEgdit" v-model="scope.row.name"></el-input>
+                <el-select v-model="scope.row.userId" filterable placeholder="请选择" @change="userIdChange" style="width:310px">
+                  <el-option
+                    v-for="item in userArray"
+                    :key="item.userId"
+                    :label="item.label"
+                    :value="item.userId">
+                  </el-option>
+                </el-select>
               </template>
             </el-table-column>
-             <el-table-column prop="phone" label="手机号" align='center'>
+             <el-table-column prop="phone" label="手机号" align='center' disabled>
               <template slot-scope="scope">
-                <span v-if="!scope.row.isEgdit">{{scope.row.phone}}</span>
-                <el-input v-if="scope.row.isEgdit" v-model="scope.row.phone"  maxlength="11" ></el-input>
+                <span>{{scope.row.phone}}</span>
               </template>
             </el-table-column>
-            <el-table-column fixed="right" label="操作" align='center' >
+            <el-table-column fixed="right" label="操作" align='center' width="100">
               <template slot-scope="scope">
                 <el-button v-if="!scope.row.isEgdit" type="primary" size="small" @click='edit(scope.$index,scope.row)' icon="el-icon-edit" plain></el-button>
                 <el-button v-if="scope.row.isEgdit" type="success" size="small" @click='editSuccess(scope.$index,scope.row)' icon="el-icon-check" plain></el-button>
@@ -126,6 +131,7 @@
 </template>
 <script>
 import { addDevopsTeam, delDevopsTeam, updateDevopsTeam, getDevopsTeam, getTD } from "@/api/MochaITOM/crew";
+import {userList} from "@/api/system/user";
 export default {
   name: "DevopsTeam",
   data() {
@@ -158,6 +164,7 @@ export default {
         pageNo:1,
         pageSize:15,
       },
+      userArray:[],//人员信息
       // 表单参数
       form: {},
       // 表单校验
@@ -168,7 +175,7 @@ export default {
       },
       rules2: {
 
-        name: [
+        userId: [
           { required: true, message: "姓名不能为空",  trigger: "blur"  }
         ],
         phone: [
@@ -196,6 +203,7 @@ export default {
   },
   created() {
     this.getList();//初始化table
+    this.getUser()
   },
   methods: {
     //分页查询
@@ -224,8 +232,8 @@ export default {
         name:undefined,
         phone:undefined,
         switch:false,
-        label:1,
-        userId:1,
+        label:"",
+        userId:"",
       }
       this.list.push(item)
     },
@@ -352,6 +360,7 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           let arr = this.form.userIds
+          console.log(arr,12345)
           if(arr.length>0){
             for(let i = 0;i<arr.length;i++){
               if(!arr[i].name){
@@ -415,6 +424,35 @@ export default {
           this.$message.success("删除成功");
         }).catch(() => {});
     },
+    /**获取人员信息 */
+    getUser(){
+      userList({pageNo: 1,pageSize: 15000}).then(response => {
+          if(response.data.pageList){
+            for(let i =0;i<response.data.pageList.length;i++){
+              response.data.pageList[i].label = `${response.data.pageList[i].nickName}(${response.data.pageList[i].deptName})`
+              this.userArray.push(response.data.pageList[i])
+            }
+          }
+      });
+    },
+    /**班组人员改变 */
+    userIdChange(e){
+      var user = {}
+      for(let i=0;i<this.userArray.length;i++){
+        if(e == this.userArray[i].userId){
+          user = this.userArray[i]
+        }
+      }
+      setTimeout(()=>{
+        for(let i=0;i<this.list.length;i++){
+          if(e == this.list[i].userId){
+            // this.list[i].label = user.label
+            this.list[i].name = user.nickName
+            this.list[i].phone = user.phonenumber
+          }
+        }
+      },300)
+    }
   }
 };
 </script>

+ 4 - 1
src/views/index/components/alarming.vue

@@ -38,13 +38,14 @@ export default {
       path: "",
       socket: "",
       arrayList: [],
+      setIntervalStatue:null
     };
   },
   mounted() {
     // 初始化
     this.init();
     this.scroll();
-  setInterval(()=>{
+    this.setIntervalStatue = setInterval(()=>{
       this.scroll();
     },1000 * 10)
   },
@@ -132,6 +133,8 @@ export default {
   destroyed() {
     // 销毁监听
     this.socket.onclose = this.close;
+    clearInterval(this.setIntervalStatue)
+    this.setIntervalStatue = null
   },
 };
 </script>