فهرست منبع

更改军车值班单位单选,司机拉取人力资源的

sunyanqiang 2 سال پیش
والد
کامیت
602b0bc77c
2فایلهای تغییر یافته به همراه65 افزوده شده و 56 حذف شده
  1. 12 3
      src/api/combatduty/militarydutyinfo.js
  2. 53 53
      src/views/combatduty/militarydutyinfo/index.vue

+ 12 - 3
src/api/combatduty/militarydutyinfo.js

@@ -52,10 +52,10 @@ export function exportMilitarydutyinfo(query) {
   })
 }
 
-// 查询人员管理列表
+// 获取人力资源司机名字
 export function listPeople(query) {
   return request({
-    url: '/peopleManage/people/list',
+    url: '/peopleManage/people/list2',
     method: 'get',
     params: query
   })
@@ -103,4 +103,13 @@ export function updatestatus() {
     url: '/militaryvehicleManagement/thebus/updatestatus',
     method: 'put',
   })
-}
+}
+
+
+// export function listPeople(query) {
+//   return request({
+//     url: '/peopleManage/people/lis2t',
+//     method: 'get',
+//     params: query
+//   })
+// }

+ 53 - 53
src/views/combatduty/militarydutyinfo/index.vue

@@ -125,9 +125,9 @@
         </template>
       </el-table-column>
       <!-- <el-table-column label="号码号牌ID" align="center" prop="numberPlateId" /> -->
-      <el-table-column label="号码号牌" align="center" prop="numberPlateName" show-overflow-tooltip/>
+      <el-table-column label="号码号牌" align="center" prop="numberPlateName" show-overflow-tooltip />
       <!-- <el-table-column label="车属单位" align="center" prop="carUnitId" :formatter="carUnitIdFormat" /> -->
-      <el-table-column label="车属单位名称" align="center" prop="carUnitName" show-overflow-tooltip/>
+      <el-table-column label="车属单位名称" align="center" prop="carUnitName" show-overflow-tooltip />
       <el-table-column label="车辆类别" align="center" prop="carType" />
       <el-table-column label="车辆状态" align="center" prop="carStates">
         <template slot-scope="scope">
@@ -136,8 +136,8 @@
       </el-table-column>
       <el-table-column label="所在位置" align="center" prop="adress" />
       <!-- <el-table-column label="司机id" align="center" prop="driverId" /> -->
-      <el-table-column label="司机名字" align="center" prop="driverName" show-overflow-tooltip/>
-      <el-table-column label="联系方式" align="center" prop="telephone" show-overflow-tooltip/>
+      <el-table-column label="司机名字" align="center" prop="driverName" show-overflow-tooltip />
+      <el-table-column label="联系方式" align="center" prop="telephone" show-overflow-tooltip />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
         <template slot-scope="scope">
           <el-button size="btu" type="text" @click="handleUpdate(scope.row)"
@@ -162,10 +162,9 @@
             end-placeholder value-format="yyyy-MM-dd" v-if="qdflg == 1"></el-date-picker>
         </el-form-item>
         <el-form-item label="车属单位" prop="carUnitId">
-          <el-select v-model="busDuoDan"  placeholder="" class="ren_yuans" multiple filterable
-            @remove-tag="selent">
+          <el-select v-model="form.carUnitId" placeholder="" filterable clearable>
             <el-option v-for="dict in deptOptions" :key="dict.deptId" :label="dict.deptName" :value="dict.deptId"
-              @click.native="danFn()">
+              @click.native="carUnitNamechange(dict)">
             </el-option>
           </el-select>
         </el-form-item>
@@ -176,9 +175,9 @@
           </el-select>
         </el-form-item>
         <el-form-item label="司机名字" prop="driverId">
-          <el-select v-model="busDuoShi" filterable  placeholder="" class="ren_yuans" multiple
+          <el-select v-model="busDuoShi" filterable placeholder="" class="ren_yuans" multiple
             @remove-tag="busShi(busDuoShi)">
-            <el-option v-for="item,i in rylist" :key="i" :label="item.nickName" :value="item.userId"
+            <el-option v-for="item,i in rylist" :key="i" :label="item.name" :value="item.id"
               @click.native="driverNamefun(item)">
             </el-option>
           </el-select>
@@ -231,16 +230,12 @@ import {
   updateMilitarydutyinfo,
   exportMilitarydutyinfo,
   rllist,
-  listPeople,
   getDept,
   getthebus,
-  listPeoples,
-  updatestatus
+  updatestatus,
+  listPeople
 } from "@/api/combatduty/militarydutyinfo";
 import { listThebus } from "@/api/militaryvehicleManagement/thebus";
-import {
-  getUnitUsers,
-} from "@/api/workingArrangements/workTask";
 
 export default {
   name: "Militarydutyinfo",
@@ -294,6 +289,13 @@ export default {
             trigger: "blur",
           },
         ],
+        carUnitId: [
+          {
+            required: true,
+            message: "单位不能为空",
+            trigger: "blur",
+          },
+        ]
       },
       //人员数据
       rylist: [],
@@ -347,27 +349,27 @@ export default {
     },
     //删除所有单位的某一个触发
     selent() {
-      this.renyuanEs();
+      // this.renyuanEs();
       this.busDuoShi = [];
       this.tags = [];
       this.arr = [];
       this.busDuoList = [];
     },
-    //点击多选单位
-    danFn() {
-      this.renyuanEs();
-    },
-    //获取多选单位下的人员
-    renyuanEs() {
-      if (this.busDuoDan.length > 0) {
-        var ids = this.busDuoDan.join(",");
-        getUnitUsers(ids).then((res) => {
-          this.rylist = res.data;
-        });
-      } else {
-        this.rylist = [];
-      }
-    },
+    // //点击多选单位
+    // danFn() {
+    //   this.renyuanEs();
+    // },
+    // //获取多选单位下的人员
+    // renyuanEs() {
+    //   if (this.busDuoDan.length > 0) {
+    //     var ids = this.busDuoDan.join(",");
+    //     getUnitUsers(ids).then((res) => {
+    //       this.rylist = res.data;
+    //     });
+    //   } else {
+    //     this.rylist = [];
+    //   }
+    // },
     // 修改拿回来的数据放到车牌上
     getBianList() {
       this.buses = [];
@@ -375,7 +377,7 @@ export default {
       this.suoYouBus.forEach((item, i) => {
         if (this.form.numberPlateIdList.indexOf(item.id) != -1) {
           this.buses.push(item);
-        }else{
+        } else {
           this.buses.push(item);
         }
       });
@@ -394,8 +396,8 @@ export default {
     },
     // 获取每个单位下的司机
     getRen(id) {
-      listPeoples({ deptId: id }).then((res) => {
-        this.rylist = res.data;
+      listPeople({ deptId: id }).then((res) => {
+        this.rylist = res.rows;
       });
     },
     //岗位
@@ -411,11 +413,10 @@ export default {
     //获取人员
     getrylist() {
       listPeople().then((res) => {
-        if (res.code == 200) {
-          this.rylist = res.rows;
-        }
+        this.rylist = res.rows;
       });
     },
+    // 单位获取
     gettreeselect() {
       getDept().then((res) => {
         if (res.code == 200) {
@@ -463,7 +464,7 @@ export default {
         telephone: null,
         modelInfo: null,
       };
-      this.rylist=[];
+      this.rylist = [];
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -493,7 +494,6 @@ export default {
       this.chuFn = true;
       this.form.carStates = '2';
       this.busDuoList = [];
-      this.busDuoDan = [];
       this.busDuoShi = [];
       this.tags = [];
       this.arr = [];
@@ -501,6 +501,7 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
+      this.gettreeselect();
       this.getthebusfun();
       this.tags = [];
       this.arr = [];
@@ -509,8 +510,8 @@ export default {
       getMilitarydutyinfo(id).then((response) => {
         this.baoCun = false;
         this.form = response.data;
+        this.form.carUnitId=response.data.carUnitId*1;
         this.busDuoList = response.data.numberPlateIdList;
-        this.busDuoDan = response.data.unitId.map(Number);
         this.busDuoShi = response.data.sjId.map(Number);
         let ponst = response.data.phone;
         ponst.forEach(item => {
@@ -524,17 +525,16 @@ export default {
         this.open = true;
         this.title = "修改军车值班";
         this.qdflg = 2;
-        this.renyuanEs();
+        this.getRen(this.form.carUnitId);
       });
     },
     // 保存并继续编辑按钮
     submitForm1() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          if (this.busDuoList.length > 0 && this.busDuoDan.length > 0 && this.busDuoShi.length > 0) {
+          if (this.busDuoList.length > 0 && this.busDuoShi.length > 0) {
             // 手机号
             this.form.phone = this.arr;
-            this.form.unitId = this.busDuoDan;
             this.form.sjId = this.busDuoShi;
             this.form.numberPlateIdList = this.busDuoList
             this.form.timequjian = this.form.attendedTime;
@@ -546,7 +546,6 @@ export default {
             this.form.carStates = '1';
             this.getthebusfun();
             this.busDuoList = [];
-            this.busDuoDan = [];
             this.busDuoShi = [];
             this.tags = [];
             this.arr = [];
@@ -561,10 +560,9 @@ export default {
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.id != null) {
-            if (this.busDuoList.length > 0 && this.busDuoDan.length > 0 && this.busDuoShi.length > 0) {
+            if (this.busDuoList.length > 0 && this.busDuoShi.length > 0) {
               this.form.numberPlateIdList = this.busDuoList
               this.form.phone = this.arr;
-              this.form.unitId = this.busDuoDan;
               this.form.sjId = this.busDuoShi;
               updateMilitarydutyinfo(this.form).then((response) => {
                 this.$modal.msgSuccess("修改成功");
@@ -576,10 +574,9 @@ export default {
             }
 
           } else {
-            if (this.busDuoList.length > 0 && this.busDuoDan.length > 0 && this.busDuoShi.length > 0) {
+            if (this.busDuoList.length > 0 && this.busDuoShi.length > 0) {
               // 手机号
               this.form.phone = this.arr;
-              this.form.unitId = this.busDuoDan;
               this.form.sjId = this.busDuoShi;
               this.form.timequjian = this.form.attendedTime;
               this.form.attendedTime = this.form.attendedTime.join(",");
@@ -627,12 +624,12 @@ export default {
     },
     //司机联系方式
     driverNamefun(val) {
-      if (this.arr.indexOf(val.phonenumber) != -1) {
+      if (this.arr.indexOf(val.phone) != -1) {
 
       } else {
-        this.arr.push(val.phonenumber)
+        this.arr.push(val.phone)
         this.tags.push({
-          name: val.phonenumber,
+          name: val.phone,
           type: 'info'
         })
         this.arr1.push(val)
@@ -643,9 +640,12 @@ export default {
       // this.form.driverId = val.id;
     },
     carUnitNamechange(val) {
-      this.form.carUnitId = val.deptId;
       this.form.carUnitName = val.deptName;
-      // this.getRen(this.form.carUnitId);
+      this.getRen(this.form.carUnitId);
+      this.busDuoShi = [];
+      this.tags = [];
+      this.arr = [];
+      this.busDuoList = [];
     },
     numberPlateNamechange(val) {
       this.form.numberPlateId = val.id;