Browse Source

优化员工选择油枪,根据油站来展示,因为获取不到当前登陆人是哪个油站,所以只能根据选择的油站来展示

MS-QJVSRANLTYEO\Administrator 4 years ago
parent
commit
e01faa7443
1 changed files with 38 additions and 21 deletions
  1. 38 21
      Yijia-SaaS/yijia-ui/src/views/station/personnel/index.vue

+ 38 - 21
Yijia-SaaS/yijia-ui/src/views/station/personnel/index.vue

@@ -59,22 +59,6 @@
     <!-- 添加或修改油站员工信息对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="姓名" prop="personnelName">
-          <el-input v-model="form.personnelName" placeholder="请输入员工姓名" />
-        </el-form-item>
-        <el-form-item label="负责枪号" prop="gunNo">
-<!--          <el-input v-model="form.gunNo" placeholder="请输入员工负责枪号" />-->
-          <el-checkbox-group v-model="gunNoList">
-            <el-checkbox
-              v-for = "item in checkList"
-              :key=item.oilGunId
-              :label="item.oilGunNo"
-              :value="item.oilGunNo"
-            >
-              {{item.oilGunNo+"号枪/"+item.oilName}}
-            </el-checkbox>
-          </el-checkbox-group>
-        </el-form-item>
         <el-form-item label="油站名称" prop="stationId" >
           <el-select
             v-model="form.stationId"
@@ -91,6 +75,26 @@
             ></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="油站名称" v-show="false" prop="personnelName">
+          <el-input v-model="form.stationName" placeholder="请输入油站名称" />
+        </el-form-item>
+        <el-form-item label="姓名" prop="personnelName">
+          <el-input v-model="form.personnelName" placeholder="请输入员工姓名" />
+        </el-form-item>
+        <el-form-item label="负责枪号" prop="gunNo">
+<!--          <el-input v-model="form.gunNo" placeholder="请输入员工负责枪号" />-->
+          <el-checkbox-group v-model="gunNoList">
+            <el-checkbox
+              v-for = "item in checkList"
+              :key=item.oilGunId
+              :label="item.oilGunNo"
+              :value="item.oilGunNo"
+            >
+              {{item.oilGunNo+"号枪/"+item.oilName}}
+            </el-checkbox>
+          </el-checkbox-group>
+        </el-form-item>
+
 <!--        <el-form-item label="二维码" prop="qrCode">
           <el-input v-model="form.qrCode" placeholder="请输入二维码" />
         </el-form-item>-->
@@ -108,7 +112,7 @@
 
 <script>
 import { listPersonnel, getPersonnel, delPersonnel, addPersonnel, updatePersonnel, exportPersonnel } from "@/api/station/personnel";
-import {stationinfo,selectGun} from "@/api/station/gun";
+import {stationinfo,selectGun,listGun} from "@/api/station/gun";
 
 export default {
   name: "Personnel",
@@ -146,6 +150,10 @@ export default {
         qrCode: null,
         personnelPhone: null
       },
+      // 查询参数
+      queryInfo: {
+        stationId: null
+      },
       // 表单参数
       form: {},
       // 表单校验
@@ -158,10 +166,10 @@ export default {
     stationinfo().then(response => {
       this.stationOptions = response.rows;
     });
-    //获取油枪
-    selectGun().then(response => {
-      this.checkList = response.rows;
-    });
+    // //获取油枪 目前获取所有的,因为不能根据当前用户来确定当前油站
+    // selectGun().then(response => {
+    //   this.checkList = response.rows;
+    // });
   },
   methods: {
     /** 查询油站员工信息列表 */
@@ -178,7 +186,12 @@ export default {
       obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
         return item.stationId === e;//筛选出匹配数据
       })
+
       this.form.stationName=obj.stationName;
+      this.queryInfo.stationId=obj.stationId;
+      listGun(this.queryInfo).then(response => {
+        this.checkList = response.rows;
+      });
     },
     // 取消按钮
     cancel() {
@@ -231,6 +244,10 @@ export default {
         if(this.form.gunNo!=null &&this.form.gunNo!="" ){
           this.gunNoList=this.form.gunNo.split(",");
         }
+        this.queryInfo.stationId=row.stationId;
+        listGun(this.queryInfo).then(response => {
+          this.checkList = response.rows;
+        });
         this.open = true;
         this.title = "修改油站员工信息";
       });