CzRger преди 1 година
родител
ревизия
08b5fc2582
променени са 5 файла, в които са добавени 114 реда и са изтрити 57 реда
  1. 15 14
      src/api/modules/seat.ts
  2. 16 1
      src/layout/header/head-com.vue
  3. 19 3
      src/store/modules/app.ts
  4. 4 0
      src/store/modules/dictionary-define.ts
  5. 60 39
      src/views/system/seat-manage/index.vue

+ 15 - 14
src/api/modules/seat.ts

@@ -2,21 +2,22 @@ import { handle } from '../index'
 
 const suffix = 'api'
 
-//  日志管理 > 列表
-export const getDailyReportList = (params: any) => handle({
-  url: `/${suffix}/daily/report/list`,
-  method: 'post',
-  params
-})
-//  日志管理 > 新增
-export const addDailyReportSave = (params: any) => handle({
-  url: `/${suffix}/daily/report/save`,
-  method: 'post',
-  params
+
+//  席位管理 > 值班老四位
+export const getSeatDutyPersonSearch = () => handle({
+  url: `/${suffix}/seat/duty/person/search`,
+  method: 'get',
 })
-//  日志管理 > 编辑
-export const editDailyReportEdit = (params: any) => handle({
-  url: `/${suffix}/daily/report/edit`,
+
+//  席位管理 > 值班老四位 > 编辑
+export const getSeatDutyPersonEdit = (params: any) => handle({
+  url: `/${suffix}/seat/duty/person/edit`,
   method: 'put',
   params
 })
+
+//  席位管理 > 列表
+export const getSeatDutyUnitList = () => handle({
+  url: `/${suffix}/seat/duty/unit/list`,
+  method: 'get',
+})

+ 16 - 1
src/layout/header/head-com.vue

@@ -44,7 +44,11 @@ export default defineComponent({
     })
     const dutyPeopleCpt = computed(() => {
       let str = ''
-      str += '值班厅领导:XXX     总值班:XXX    带班领导:XXX    值班员:XXX、XXX、XXX少时诵诗书所所所所所所所所所所所所所所所所所所所所所所所所'
+      const dutyHallLeader = `值班厅领导:${store.state.app.dutyInfo?.dutyHallLeader ? store.state.dictionary.dutyHallLeaderMap.get(store.state.app.dutyInfo.dutyHallLeader) : '无'}`
+      const totalClass = `总值班:${store.state.app.dutyInfo?.totalClass ? store.state.dictionary.totalClassMap.get(store.state.app.dutyInfo.totalClass) : '无'}`
+      const shiftLeader = `带班领导:${store.state.app.dutyInfo?.shiftLeader ? store.state.dictionary.shiftLeaderMap.get(store.state.app.dutyInfo.shiftLeader) : '无'}`
+      const dutyPerson = `值班员:${store.state.app.dutyInfo?.dutyPerson ? store.state.app.dutyInfo.dutyPerson.split(',').map(v => store.state.dictionary.dutyPersonMap.get(v)) : '无'}`
+      str += `${dutyHallLeader}   ${totalClass}   ${shiftLeader}   ${dutyPerson}`
       return str
     })
     const currentDateCpt = computed(() => {
@@ -77,6 +81,17 @@ export default defineComponent({
         toLogin()
       }).catch(() => {})
     }
+    //  获取字典
+    const initDictionary = () => {
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'duty_hall_leader')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'total_class')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'shift_leader')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'duty_person')
+    }
+    onMounted(() => {
+      initDictionary()
+      store.dispatch('app/LOAD_DUTY_INFO')
+    })
     return {
       ...toRefs(state),
       dutyPeopleCpt,

+ 19 - 3
src/store/modules/app.ts

@@ -1,7 +1,7 @@
-import * as api from '@/api/index'
 import {getUserInfoByUsername} from "@/api/modules/account";
 import {getSignTime} from "@/api/modules/sign";
 import {ElMessage} from "element-plus";
+import {getSeatDutyPersonSearch} from "@/api/modules/seat";
 
 const state = {
 	apiProxy: {
@@ -10,7 +10,8 @@ const state = {
 	userInfo: <any>{},
 	userRoleList: [],
 	timestamp: new Date().getTime(),
-	weekStart: 6
+	weekStart: 6,
+	dutyInfo: {}
 }
 
 const getters = {
@@ -33,6 +34,9 @@ const mutations = {
 			state.timestamp += 1000
 		}, 1000)
 	},
+	SET_DUTY_INFO(state: any, data: any) {
+		state.dutyInfo = data
+	},
 }
 
 const actions = {
@@ -61,7 +65,19 @@ const actions = {
 			}
 		})
 	},
-
+	LOAD_DUTY_INFO({ commit }: any) {
+		getSeatDutyPersonSearch().then((res) => {
+			if (res.code === 200) {
+				if (res.data) {
+					commit('SET_DUTY_INFO', res.data)
+				} else {
+					ElMessage.error('缺少值班人员')
+				}
+			} else {
+				ElMessage.error(res.message)
+			}
+		})
+	},
 }
 
 export default {

+ 4 - 0
src/store/modules/dictionary-define.ts

@@ -9,6 +9,10 @@ export const dictionaryDefine = {
 	config_week_submit_date: ['configWeekSubmitDateList', 'configWeekSubmitDateMap', 'configWeekSubmitDateObjMap'], //	公共配置-周报提交星期
 	oper_module: ['operModuleList', 'operModuleMap', 'operModuleObjMap'], //	操作记录-操作模块
 	oper_type: ['operTypeList', 'operTypeMap', 'operTypeObjMap'], //	操作记录-操作类型
+	duty_hall_leader: ['dutyHallLeaderList', 'dutyHallLeaderMap', 'dutyHallLeaderObjMap'], //	席位管理-值班厅领导
+	total_class: ['totalClassList', 'totalClassMap', 'totalClassObjMap'], //	席位管理-总值班
+	shift_leader: ['shiftLeaderList', 'shiftLeaderMap', 'shiftLeaderObjMap'], //	席位管理-带班领导
+	duty_person: ['dutyPersonList', 'dutyPersonMap', 'dutyPersonObjMap'], //	席位管理-值班员
 }
 
 const stateMap = {}

+ 60 - 39
src/views/system/seat-manage/index.vue

@@ -2,66 +2,42 @@
   <div class="__normal-page">
     <div class="__normal-content">
       <div class="seat">
-        <div class="seat-filter">
+        <div class="seat-filter" v-loading="loadingDuty">
           <CusForm>
             <CusFormColumn
                 :span="8"
                 label="值班厅领导"
                 link="select"
-                static
-                v-model:param="queryForm.shipId"
-                labelKey="label"
-                valueKey="value"
+                v-model:param="dutyForm.dutyHallLeader"
                 :clearable="false"
-                :options="[
-                    {label: '类型一', value: '1'},
-                    {label: '类型二', value: '2'},
-                    {label: '类型三', value: '3'},
-                ]"/>
+                :options="$store.state.dictionary.dutyHallLeaderList"
+                @change="setDuty"/>
             <CusFormColumn
                 :span="8"
                 label="总值班"
                 link="select"
-                static
-                v-model:param="queryForm.shipId"
-                labelKey="label"
-                valueKey="value"
+                v-model:param="dutyForm.totalClass"
                 :clearable="false"
-                :options="[
-                  {label: '类型一', value: '1'},
-                  {label: '类型二', value: '2'},
-                  {label: '类型三', value: '3'},
-              ]"/>
+                :options="$store.state.dictionary.totalClassList"
+                @change="setDuty"/>
             <CusFormColumn
                 :span="8"
                 label="带班领导"
                 link="select"
-                static
-                v-model:param="queryForm.shipId"
-                labelKey="label"
-                valueKey="value"
+                v-model:param="dutyForm.shiftLeader"
                 :clearable="false"
-                :options="[
-                  {label: '类型一', value: '1'},
-                  {label: '类型二', value: '2'},
-                  {label: '类型三', value: '3'},
-              ]"/>
+                :options="$store.state.dictionary.shiftLeaderList"
+                @change="setDuty"/>
             <CusFormColumn
                 :span="24"
                 label="值班员"
                 link="select"
-                static
-                v-model:param="queryForm.shipId2"
-                labelKey="label"
-                valueKey="value"
+                v-model:param="dutyForm.dutyPerson"
                 multiple
                 :clearable="false"
                 :filterable="false"
-                :options="[
-                  {label: '类型一', value: '1'},
-                  {label: '类型二', value: '2'},
-                  {label: '类型三', value: '3'},
-              ]"/>
+                :options="$store.state.dictionary.dutyPersonList"
+                @change="setDuty"/>
           </CusForm>
         </div>
         <div class="seat-position">
@@ -177,6 +153,8 @@ import {
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import PeopleCom from './people.vue'
+import {getSeatDutyPersonEdit} from "@/api/modules/seat";
+import {ElMessage} from "element-plus";
 
 export default defineComponent({
   name: '',
@@ -189,7 +167,8 @@ export default defineComponent({
     const route = useRoute();
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const state = reactive({
-      queryForm: {},
+      dutyForm: {},
+      loadingDuty: false,
       seatList: [],
       currentSeat: {},
       dutyInfo: {
@@ -278,7 +257,48 @@ export default defineComponent({
       state.transfer = JSON.parse(JSON.stringify(state.currentSeat))
       state.showPeople = true
     }
+    //  获取字典
+    const initDictionary = () => {
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'duty_hall_leader')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'total_class')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'shift_leader')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'duty_person')
+    }
+    const initDuty = () => {
+      state.dutyForm.dutyHallLeader = store.state.app.dutyInfo?.dutyHallLeader || ''
+      state.dutyForm.totalClass = store.state.app.dutyInfo?.totalClass || ''
+      state.dutyForm.shiftLeader = store.state.app.dutyInfo?.shiftLeader || ''
+      state.dutyForm.dutyPerson = store.state.app.dutyInfo?.dutyPerson ? store.state.app.dutyInfo?.dutyPerson.split(',') : []
+    }
+    const setDuty = () => {
+      setTimeout(() => {
+        state.loadingDuty = true
+        const params = {
+          id: store.state.app.dutyInfo?.id || null,
+          dutyHallLeader: state.dutyForm.dutyHallLeader || '',
+          totalClass: state.dutyForm.totalClass || '',
+          shiftLeader: state.dutyForm.shiftLeader || '',
+          dutyPerson: state.dutyForm.dutyPerson.join(',') || ''
+        }
+        that.$api.getSeatDutyPersonEdit(params).then(res => {
+          if (res.code === 200) {
+            store.dispatch('app/LOAD_DUTY_INFO')
+            ElMessage.success(res.message)
+          } else {
+            ElMessage.error(res.message)
+          }
+          state.loadingDuty = false
+        }).catch(() => {
+          state.loadingDuty = false
+        })
+      }, 100)
+    }
+    watch(() => store.state.app.dutyInfo, () => {
+      initDuty()
+    })
     onMounted(() => {
+      initDuty()
+      initDictionary()
       handleSearch()
     })
     return {
@@ -286,7 +306,8 @@ export default defineComponent({
       handlePage,
       onEdit,
       onEditCancel,
-      addPeople
+      addPeople,
+      setDuty
     }
   },
 })