Browse Source

席位人员过滤

CzRger 1 year ago
parent
commit
e79785ac22

+ 7 - 0
src/api/modules/seat.ts

@@ -34,3 +34,10 @@ export const editSeatDutyUnitEdit = (params: any) => handle({
   method: 'put',
   params
 })
+
+//  席位管理 > 座位下面过滤掉已分配的人员列表
+export const getSeatDutyUnitPersonList = (params: any) => handle({
+  url: `/${suffix}/seat/duty/unit/person/list`,
+  method: 'get',
+  params
+})

+ 33 - 24
src/views/system/seat-manage/index.vue

@@ -299,31 +299,40 @@ export default defineComponent({
     }
     const onSave = () => {
       ref_form.value.submit().then(() => {
-        ElMessageBox.confirm("是否提交?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
-        }).then(() => {
-          state.loadingForm = true
-          that.$api.editSeatDutyUnitEdit(Object.assign(state.seatInfo.editDutyInfo.deptForm, {
-            dutyUnitPersonList: state.seatInfo.editDutyInfo.tableData.map(v => {
-              v.unitId = state.seatInfo.editDutyInfo.deptForm.id
-              return v
-            }),
-            name: store.state.dictionary.deptMap.get(state.seatInfo.editDutyInfo.deptForm.deptId).organizationName
-          })).then(res => {
-            if (res.code === 200) {
-              onSeatClick(state.currentSeatId)
-              initSeat()
-              ElMessage.success(res.message)
-            } else {
-              ElMessage.error(res.message)
-            }
-            state.loadingForm = false
-          }).catch(() => {
-            state.loadingForm = false
+        if (state.seatInfo.editDutyInfo.tableData.length > 0) {
+          ElMessageBox.confirm("是否提交?", "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }).then(() => {
+            state.loadingForm = true
+            that.$api.editSeatDutyUnitEdit(Object.assign(state.seatInfo.editDutyInfo.deptForm, {
+              dutyUnitPersonList: state.seatInfo.editDutyInfo.tableData.map(v => {
+                v.unitId = state.seatInfo.editDutyInfo.deptForm.id
+                return v
+              }),
+              name: store.state.dictionary.deptMap.get(state.seatInfo.editDutyInfo.deptForm.deptId).organizationName
+            })).then(res => {
+              if (res.code === 200) {
+                onSeatClick(state.currentSeatId)
+                initSeat()
+                ElMessage.success(res.message)
+              } else {
+                ElMessage.error(res.message)
+              }
+              state.loadingForm = false
+            }).catch(() => {
+              state.loadingForm = false
+            })
+          }).catch(() => {})
+        } else {
+          ElMessage({
+            message: '请分配值班人员!',
+            grouping: true,
+            type: 'warning',
           })
-        }).catch(() => {})
+        }
+
       }).catch((e) => {
         ElMessage({
           message: e[0].message,

+ 2 - 1
src/views/system/seat-manage/people.vue

@@ -53,6 +53,7 @@ import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import {getAccountListByDeptId} from "@/api/modules/account";
 import {ElMessage, ElMessageBox} from "element-plus";
+import {getSeatDutyUnitPersonList} from "@/api/modules/seat";
 
 export default defineComponent({
   name: '',
@@ -90,7 +91,7 @@ export default defineComponent({
     const getPeople = () => {
       state.loadingPeople = true
       state.peopleList = []
-      that.$api.getAccountListByDeptId({externalId: store.state.dictionary.deptMap.get(state.cusDetail.deptId).externalId}).then(res => {
+      that.$api.getSeatDutyUnitPersonList({externalId: store.state.dictionary.deptMap.get(state.cusDetail.deptId).externalId}).then(res => {
         if (res.code === 200) {
           state.peopleList = res.data.filter(v => !state.selectUserId.includes(v.id))
         } else {