Explorar o código

班表管理,班次管理前端页面问题修改及优化

yejian016332 %!s(int64=3) %!d(string=hai) anos
pai
achega
f422ea6e81

+ 145 - 135
imcs-ui/src/api/User.js

@@ -1,135 +1,145 @@
-import axiosApi from './AxiosApi.js'
-
-const apiList = {
-  page: {
-    method: 'POST',
-    url: `/authority/user/page`
-  },
-  save: {
-    method: 'POST',
-    url: `/authority/user`
-  },
-  update: {
-    method: 'PUT',
-    url: `/authority/user`
-  },
-  updateBaseInfo: {
-    method: 'PUT',
-    url: `/authority/user/base`
-  },
-  avatar: {
-    method: 'PUT',
-    url: `/authority/user/avatar`
-  },
-  delete: {
-    method: 'DELETE',
-    url: `/authority/user`
-  },
-  reset: {
-    method: 'POST',
-    url: `/authority/user/reset`
-  },
-  updatePassword: {
-    method: 'PUT',
-    url: `/authority/user/password`
-  },
-  reload: {
-    method: 'POST',
-    url: `/authority/user/reload`
-  },
-  preview: {
-    method: 'POST',
-    url: `/authority/user/preview`
-  },
-  export: {
-    method: 'POST',
-    url: `/authority/user/export`
-  },
-  import: {
-    method: 'POST',
-    url: `/authority/user/import`
-  }
-}
-
-export default {
-  page (data) {
-    return axiosApi({
-      ...apiList.page,
-      data
-    })
-  },
-  save (data) {
-    return axiosApi({
-      ...apiList.save,
-      data
-    })
-  },
-  update (data) {
-    return axiosApi({
-      ...apiList.update,
-      data
-    })
-  },
-  updateBaseInfo (data) {
-    return axiosApi({
-      ...apiList.updateBaseInfo,
-      data
-    })
-  },
-  updatePassword (data) {
-    return axiosApi({
-      ...apiList.updatePassword,
-      data
-    })
-  },
-  delete (data) {
-    return axiosApi({
-      ...apiList.delete,
-      data
-    })
-  },
-  get (id) {
-    return axiosApi({
-      method: 'GET',
-      url: `/authority/user/${id}`
-    })
-  },
-  reset (data) {
-    return axiosApi({
-      ...apiList.reset,
-      data
-    })
-  },
-  avatar (data) {
-    return axiosApi({
-      ...apiList.avatar,
-      data
-    })
-  },
-  reload (userId) {
-    return axiosApi({
-      ...apiList.reload,
-      formData: true,
-      data: { userId: userId }
-    })
-  },
-  preview (data) {
-    return axiosApi({
-      ...apiList.preview,
-      data
-    })
-  },
-  export (data) {
-    return axiosApi({
-      ...apiList.export,
-      responseType: "blob",
-      data
-    })
-  },
-  import (data) {
-    return axiosApi({
-      ...apiList.import,
-      data
-    })
-  }
-}
+import axiosApi from './AxiosApi.js'
+
+const apiList = {
+  page: {
+    method: 'POST',
+    url: `/authority/user/page`
+  },
+  save: {
+    method: 'POST',
+    url: `/authority/user`
+  },
+  update: {
+    method: 'PUT',
+    url: `/authority/user`
+  },
+  updateBaseInfo: {
+    method: 'PUT',
+    url: `/authority/user/base`
+  },
+  avatar: {
+    method: 'PUT',
+    url: `/authority/user/avatar`
+  },
+  delete: {
+    method: 'DELETE',
+    url: `/authority/user`
+  },
+  reset: {
+    method: 'POST',
+    url: `/authority/user/reset`
+  },
+  updatePassword: {
+    method: 'PUT',
+    url: `/authority/user/password`
+  },
+  reload: {
+    method: 'POST',
+    url: `/authority/user/reload`
+  },
+  preview: {
+    method: 'POST',
+    url: `/authority/user/preview`
+  },
+  export: {
+    method: 'POST',
+    url: `/authority/user/export`
+  },
+  import: {
+    method: 'POST',
+    url: `/authority/user/import`
+  },
+  getCurrUser: {
+    method: 'POST',
+    url: `/authority/user/getCurrUser`
+  }
+}
+
+export default {
+  page (data) {
+    return axiosApi({
+      ...apiList.page,
+      data
+    })
+  },
+  save (data) {
+    return axiosApi({
+      ...apiList.save,
+      data
+    })
+  },
+  update (data) {
+    return axiosApi({
+      ...apiList.update,
+      data
+    })
+  },
+  updateBaseInfo (data) {
+    return axiosApi({
+      ...apiList.updateBaseInfo,
+      data
+    })
+  },
+  updatePassword (data) {
+    return axiosApi({
+      ...apiList.updatePassword,
+      data
+    })
+  },
+  delete (data) {
+    return axiosApi({
+      ...apiList.delete,
+      data
+    })
+  },
+  get (id) {
+    return axiosApi({
+      method: 'GET',
+      url: `/authority/user/${id}`
+    })
+  },
+  reset (data) {
+    return axiosApi({
+      ...apiList.reset,
+      data
+    })
+  },
+  avatar (data) {
+    return axiosApi({
+      ...apiList.avatar,
+      data
+    })
+  },
+  reload (userId) {
+    return axiosApi({
+      ...apiList.reload,
+      formData: true,
+      data: { userId: userId }
+    })
+  },
+  preview (data) {
+    return axiosApi({
+      ...apiList.preview,
+      data
+    })
+  },
+  export (data) {
+    return axiosApi({
+      ...apiList.export,
+      responseType: "blob",
+      data
+    })
+  },
+  import (data) {
+    return axiosApi({
+      ...apiList.import,
+      data
+    })
+  },
+  getCurrUser (data) {
+    return axiosApi({
+      ...apiList.getCurrUser,
+      data
+    })
+  },
+}

+ 1 - 1
imcs-ui/src/api/classScheduleMgr/shiftChangeMgr.js

@@ -86,7 +86,7 @@ export default {
   },
   delete (data) {
     return axiosApi({
-      ...apiList.remove,
+      ...apiList.delete,
       data
     })
   },

+ 2 - 2
imcs-ui/src/views/zuihou/classScheduleMgr/shiftChangeMgr/Index.vue

@@ -91,7 +91,7 @@
         </template>
       </el-table-column>
       <el-table-column prop="createTime" :label='$t("calssSchedule.table.staffChange.createTime")' :show-overflow-tooltip="true" width="180px"></el-table-column>
-      <el-table-column prop="statusTime" :label='$t("calssSchedule.table.staffChange.statusTime")' width="180px"></el-table-column>
+      <el-table-column prop="auditTime" :label='$t("calssSchedule.table.staffChange.statusTime")' width="180px"></el-table-column>
       <el-table-column
         :label="$t('table.operation')"
         fixed="right"
@@ -359,7 +359,7 @@
 	      this.$refs.table.clearSelection()
 	    },
 	    delete (ids) {
-	      shiftChangeMgrApi.remove({ ids: ids }).then(response => {
+	      shiftChangeMgrApi.delete({'ids': ids}).then(response => {
 	        const res = response.data
 	        if (res.isSuccess) {
 	          this.$message({

+ 69 - 48
imcs-ui/src/views/zuihou/classScheduleMgr/shiftChangeMgr/components/Edit.vue

@@ -9,28 +9,28 @@
   	top="50px"
   >
     <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
-    	<el-form-item :label='$t("calssSchedule.table.staffChange.auditUser")+":"' prop="applyUserId">
-          <el-cascader
-          	v-model="tenant.applyUserId"
-          	key="1"
-          	:options="applyList"
-          	:props="{ checkStrictly: true , emitPath: false, expandTrigger: 'click'}"
-          	:show-all-levels="false"
-          	filterable
-          	clearable
-          	:placeholder='$t("common.pleaseSelect")'
-          	style="width: 100%;"
-          	@change="cascaderChange"
-          >
-        	</el-cascader>
-      </el-form-item>
+<!--    	<el-form-item :label='$t("calssSchedule.table.staffChange.auditUser")+":"' prop="applyUserId">-->
+<!--          <el-cascader-->
+<!--          	v-model="tenant.applyUserId"-->
+<!--          	key="1"-->
+<!--          	:options="deptUserList"-->
+<!--          	:props="{ checkStrictly: true , emitPath: false, expandTrigger: 'click'}"-->
+<!--          	:show-all-levels="false"-->
+<!--          	filterable-->
+<!--          	clearable-->
+<!--          	:placeholder='$t("common.pleaseSelect")'-->
+<!--          	style="width: 100%;"-->
+<!--          	@change="cascaderChange"-->
+<!--          >-->
+<!--        	</el-cascader>-->
+<!--      </el-form-item>-->
       <el-form-item :label='$t("calssSchedule.table.staffChange.applyTime")+":"' prop="applyTime">
       	<el-date-picker v-model="tenant.applyTime" type="date" value-format="yyyy-MM-dd" :placeholder='$t("common.pleaseSelect")' style="width: 100%;" @change="dateChange"></el-date-picker>
       </el-form-item>
-      <el-form-item :label='$t("calssSchedule.table.staffChange.model")+":"' prop="applyList" style="border-bottom: 1px solid #EEEEEE;">
+      <el-form-item :label='$t("calssSchedule.table.staffChange.model")+":"' prop="" style="border-bottom: 1px solid #EEEEEE;">
       	<template>
 				  <el-checkbox-group v-model="tenant.applyList">
-				    <el-checkbox v-for="item in applyCheckbox" :key="item.id" :label="item.id">{{item.name.data}}</el-checkbox>
+				    <el-checkbox v-for="item in this.applyCheckbox" :key="item.id" :label="item.id">{{item.name.data}}</el-checkbox>
 				  </el-checkbox-group>
 				</template>
       </el-form-item>
@@ -39,7 +39,7 @@
           <el-cascader
           	v-model="tenant.changeUserId"
           	key="2"
-          	:options="applyList"
+          	:options="deptUserList"
           	:props="{ checkStrictly: true , emitPath: false, expandTrigger: 'click'}"
           	:show-all-levels="false"
           	filterable
@@ -56,7 +56,7 @@
       <el-form-item :label='$t("calssSchedule.table.staffChange.remark")+":"' prop="changeList">
       	<template>
 				  <el-checkbox-group v-model="tenant.changeList">
-				    <el-checkbox v-for="item in updateCheckbox" :key="item.id" :label="item.id">{{item.name.data}}</el-checkbox>
+				    <el-checkbox v-for="item in this.updateCheckbox" :key="item.id" :label="item.id">{{item.name.data}}</el-checkbox>
 				  </el-checkbox-group>
 				</template>
       </el-form-item>
@@ -74,6 +74,7 @@
 	import classesMgrApi from "@/api/classScheduleMgr/classesMgr"
 	// 【部门组织】-API
 	import orgApi from "@/api/Org"
+  import userApi from "@/api/User"
 	// 【日期格式化】组件
 	import moment from "moment"
 
@@ -96,7 +97,8 @@ export default {
       screenWidth: 0,
       width: this.initWidth(),
       confirmDisabled: false,
-      applyList: [],
+      loginUserId: null,
+      deptUserList: [],
       applyCheckbox: [],  // 【更换班表-申请人】
       updateCheckbox: [],  // 【更换班表-更换人】
       dicts:{
@@ -104,9 +106,9 @@ export default {
       },
       roles: [],
       rules: {
-        applyUserId: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
+        // applyUserId: [
+        // 	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        // ],
         changeUserId: [
         	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
         ],
@@ -138,6 +140,8 @@ export default {
   },
   mounted () {
   	// this.applyList = this.$constWKS.CASCADERLIST,
+    // 获取当前用户
+    this.getCurrUser()
   	// 部门人员-级联数据
   	this.getDeptUser()
     window.onresize = () => {
@@ -149,41 +153,42 @@ export default {
   methods: {
   	// 【申请人】值变化事件
   	cascaderChange(userId){
-  		console.log("【申请人】值变化: ", userId)
   		// 【申请日期】的值
   		let date = this.tenant.applyTime
-  		if(!!date){
-  			// 查询【申请人】的班次列表
-  			this.applyClassList(true, userId, moment(date).format('YYYY-MM-DD'))
-  		}
+      // 查询【申请人】的班次列表
+
+      if(null != userId && userId != undefined && null != date && date != undefined){
+          this.applyClassList(true, userId, moment(date).format('YYYY-MM-DD'))
+      }
   	},
   	// 【申请日期】值变化事件
   	dateChange(val){
-  		let userId = this.tenant.applyUserId
-  		console.log("【申请日期】值变化: ", moment(val).format('YYYY-MM-DD'))
-  		if(!!userId){
-  			// 查询【申请人】的班次列表
-  			this.applyClassList(true, userId, moment(val).format('YYYY-MM-DD'))
-  		}
+  		let userId = this.loginUserId
+        console.log(userId)
+        console.log(val)
+        console.log(null != userId && userId != undefined && null != val && val != undefined)
+      // 查询【申请人】的班次列表
+      if(null != userId && userId != undefined && null != val && val != undefined){
+          this.applyClassList(true, userId, moment(val).format('YYYY-MM-DD'))
+      }
   	},
   	// 【更换人】值变化事件
   	cascaderChange2(userId){
-  		console.log("【更换人】值变化: ", userId)
   		// 【更换日期】的值
   		let date = this.tenant.changeTime
-  		if(!!date){
   			// 查询【更换人】的班次列表
-  			this.applyClassList(false, userId, moment(date).format('YYYY-MM-DD'))
-  		}
+        console.log(null != userId && userId != undefined && null != date && date != undefined)
+      if(null != userId && userId != undefined && null != date && date != undefined){
+          this.applyClassList(false, userId, moment(date).format('YYYY-MM-DD'))
+      }
   	},
   	// 【更换日期】值变化事件
   	dateChange2(val){
   		let userId = this.tenant.changeUserId
-  		console.log("【更换日期】值变化: ", moment(val).format('YYYY-MM-DD'))
-  		if(!!userId){
-  			// 查询【更换人】的班次列表
-  			this.applyClassList(false, userId, moment(val).format('YYYY-MM-DD'))
-  		}
+      // 查询【更换人】的班次列表
+      if(null != userId && userId != undefined && null != val && val != undefined){
+          this.applyClassList(false, userId, moment(val).format('YYYY-MM-DD'))
+      }
   	},
     initTenant () {
       return {
@@ -209,7 +214,12 @@ export default {
     setTenant (val, dicts) {
     	if(val){
     		this.tenant = { ...val }
+        this.type = "edit"
     	}
+    	if(this.type ==="edit"){
+    	  this.applyClassList(true, val.applyUserId, val.applyTime)
+        this.applyClassList(false, val.changeUserId, val.changeTime)
+      }
       // 字典表
       this.dicts = dicts
     },
@@ -223,8 +233,6 @@ export default {
       this.tenant = this.initTenant()
     },
     submitForm () {
-    	//console.log("Form数据:", this.tenant)
-    	// return false
       this.$refs.form.validate((valid) => {
         if (valid) {
           this.confirmDisabled = true
@@ -239,6 +247,7 @@ export default {
       })
     },
     save () {
+      this.tenant.applyUserId = this.loginUserId
       shiftChangeMgrApi.save(this.tenant)
         .then((response) => {
           const res = response.data
@@ -259,6 +268,7 @@ export default {
         })
     },
     update () {
+      this.tenant.applyUserId = this.loginUserId
       shiftChangeMgrApi.update(this.tenant)
         .then((response) => {
           const res = response.data
@@ -280,9 +290,10 @@ export default {
     },
     // 【更换班表】-列表数据
     applyClassList(flag, val, date){
+  	    console.log(val)
+        console.log(date)
     	classesMgrApi.getListById({userId: val, date}).then(res => {
     		res = res.data
-    		console.log("【更换班表】-列表数据: ", res)
     		if (res.isSuccess) {
     			// 如果是【申请人-更换班表】
 		    	if(flag){
@@ -292,16 +303,26 @@ export default {
 		    	}
 	      }
     	})
+        console.log(this.applyCheckbox)
+        console.log(this.updateCheckbox)
     },
     // 【部门人员】-级联数据
     getDeptUser(){
     	orgApi.getDeptUser({}).then(res => {
     		res = res.data
-    		// console.log("【部门人员】-级联数据: ", res)
     		if(res.isSuccess){
-    			this.applyList = res.data
+    			this.deptUserList = res.data
     		}
     	})
+    },
+
+    getCurrUser(){
+      userApi.getCurrUser({}).then(res => {
+        res = res.data
+        if(res.isSuccess){
+            this.loginUserId = res.data.id
+        }
+      })
     }
 
   }