Kaynağa Gözat

排班管理

xiao547607 4 yıl önce
ebeveyn
işleme
d753ccfe44

+ 18 - 14
src/api/base/workPersonScheduling.js

@@ -1,58 +1,62 @@
 import request from '@/utils/request'
 import constant from '@/constant'
 
-function pageList(formData){
+function pageList(formData) {
   return request.post(constant.serverUrl + "/base/workPersonScheduling/pageList", formData);
 }
 
-function create(){
+function create() {
   return request.get(constant.serverUrl + "/base/workPersonScheduling/create");
 }
 
-function edit(id){
+function edit(id) {
   return request.get(constant.serverUrl + "/base/workPersonScheduling/edit/" + id);
 }
 
-function add(formModel){
-  return request.post(constant.serverUrl + "/base/workPersonScheduling/add", formModel,{
+function add(formModel) {
+  return request.post(constant.serverUrl + "/base/workPersonScheduling/add", formModel, {
     headers: {
       "Content-Type": "application/json"
     }
   });
 }
 
-function update(formModel){  
-  return request.post(constant.serverUrl + "/base/workPersonScheduling/update", formModel,{
+function update(formModel) {
+  return request.post(constant.serverUrl + "/base/workPersonScheduling/update", formModel, {
     headers: {
       "Content-Type": "application/json"
     }
   });
 }
 
-function remove(id){
+function remove(id) {
   return request.post(constant.serverUrl + "/base/workPersonScheduling/delete/" + id);
 }
 
-function batchRemove(idList){
-  return request.post(constant.serverUrl + "/base/workPersonScheduling/batchDelete",idList,{
+function batchRemove(idList) {
+  return request.post(constant.serverUrl + "/base/workPersonScheduling/batchDelete", idList, {
     headers: {
       "Content-Type": "application/json"
     }
   });
 }
 
-function findScheduling(formData){
+function findScheduling(formData) {
   return request.post(constant.serverUrl + "/base/workPersonScheduling/findScheduling", formData);
 }
 
-function changeScheduling(formData){
+function changeScheduling(formData) {
   return request.post(constant.serverUrl + "/base/workPersonScheduling/changeScheduling", formData);
 }
 
-function changePersonShift(formData){
+function changePersonShift(formData) {
   return request.post(constant.serverUrl + "/base/workPersonScheduling/changePersonShift", formData);
 }
 
+function findWPSByParameter(formData) {
+  return request.post(constant.serverUrl + "/base/workPersonScheduling/findWPSByParameter", formData);
+}
+
 export default {
-  pageList,create,edit,add,update,remove,batchRemove,findScheduling,changeScheduling,changePersonShift
+  pageList, create, edit, add, update, remove, batchRemove, findScheduling, changeScheduling, changePersonShift, findWPSByParameter
 }

+ 41 - 14
src/views/base/workPersonScheduling-list.vue

@@ -43,13 +43,14 @@
           >是否包含下级单位</el-checkbox
         >
       </el-form-item>
-      <!-- <el-form-item label="人员id" prop="personId">
+      <el-form-item label="姓名" prop="personName">
         <el-input
           type="text"
           size="mini"
-          v-model="queryModel.personId"
+          v-model="queryModel.personName"
+          style="width: 100px"
         ></el-input>
-      </el-form-item> -->
+      </el-form-item>
       <el-form-item>
         <el-button
           type="primary"
@@ -114,9 +115,11 @@
               <template v-for="(item, index) in row.personNumberMap[col.day]">
                 <div
                   v-html="showItem(item)"
-                  :key="index + ''"
-                  v-on:click="changeWork(row.id, row.name, col.day)"
-                  style="white-space: pre-wrap;cursor:pointer;"
+                  :key="index"
+                  v-on:click="
+                    changeWork(row.companyId, row.id, row.name, col.day)
+                  "
+                  style="white-space: pre-wrap; cursor: pointer"
                 ></div>
               </template>
             </div>
@@ -146,7 +149,7 @@
       :close-on-click-modal="false"
     >
       <el-form label-width="150px" v-loading="changeWorkDisabled">
-        <el-form-item label="用户" prop="changeCompanyId">
+        <el-form-item label="用户" prop="changeUser">
           <el-input
             type="text"
             v-model="changeUser"
@@ -162,7 +165,7 @@
             height="200"
           ></el-select-tree>
         </el-form-item>
-        <el-form-item label="班次">
+        <el-form-item label="班次" prop="changeShiftId">
           <el-select
             v-model="changeShiftId"
             filterable
@@ -245,14 +248,13 @@ export default {
       changeDay: "",
       changeCompanyId: "",
       shiftData: [],
-      changeShiftId: "",
+      changeShiftId: [],
       changeWorkDisabled: false,
       changeUser: "",
     };
   },
   created() {
     var self = this;
-
     companyInfoApi.treeList().then(function (response) {
       var jsonData = response.data;
       if (jsonData.result) {
@@ -363,10 +365,35 @@ export default {
         this.handleQuery();
       }
     },
-    changeWork(personId, personName, day) {
-      this.changePersonId = personId;
-      this.changeDay = day;
-      this.changeUser = personName + ",调班日期:" + day + "日";
+    changeWork(companyId, personId, personName, day) {
+      var self = this;
+      self.changePersonId = personId;
+      self.changeDay = day;
+      self.changeUser = personName + ",调班日期:" + day + "日";
+      self.changeCompanyId = companyId;
+      var formData = new FormData();
+      formData.append("queryMonth", self.queryModel.queryMonth);
+      formData.append("day", day);
+      formData.append("personId", personId);
+
+      workPersonSchedulingApi
+        .findWPSByParameter(formData)
+        .then(function (response) {
+          var jsonData = response.data;
+          if (jsonData.result) {
+            var shiftIds = jsonData.data.shiftIds;
+            if (shiftIds != null) {
+              self.changeShiftId = shiftIds.split(",");
+            }
+          } else {
+            self.$message({
+              showClose: true,
+              dangerouslyUseHTMLString: true,
+              message: jsonData.message,
+            });
+          }
+        });
+
       this.batchChangeWork = true;
     },
     handleBatchChangeWork() {