Browse Source

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

yejian016332 3 years ago
parent
commit
b51b80342e

+ 96 - 95
imcs-ui/src/lang/zh/calssSchedule.js

@@ -1,95 +1,96 @@
-/**************** 【生产准备中心】菜单  **************/
-export default {
-	calssSchedule: {
-		// 本模型下的共通
-		common: {
-			aduio: '审核产品',
-			schedFlag0: '不需排班',
-			schedFlag1: '需要排班',
-			classSchul: '班表',
-			userSchul: '个人班表'
-		},
-		// 列表搜索表单名称
-		searchForm: {
-			name: '班表名称',
-			no: '编号',
-			numb: '工号',
-			deptName: '部门',
-			userName: '姓名',
-			month: '月份',
-			applyName: '申请人',
-			applyTime: '申请日期',
-			audioStatus: '审核状态'
-		},
-		// 按钮的名称
-	  	buttons: {
-	  		setClass: '设置班表',
-	  		allClear: '全部清除'
-	  	},
-	  	// 列表的cell名称
-		table: {
-			// 【班表管理】列表table字段名称
-			schedule: {
-				year: '年',
-				month: '月',
-				status: '状态',
-				addTime: '新增时间',
-				audioTime: '审核时间'
-			},
-			// 【班次管理】列表table字段名称
-			calsses: {
-				no: '编号',
-				name: '班次名称',
-				model: '班次时间段',
-				hours: '班次时间(小时)',
-				remark: '备注'
-			},
-			// 【排班人员管理】列表table字段名称
-			staff: {
-				type: '类型',
-				numbers: '人员数量',
-			},
-			// 【换班管理】列表table字段名称
-			staffChange: {
-				auditUser: '申请人',
-				applyTime: '申请日期',
-				model: '更换班表',
-				hours: '更换人',
-				changeTime: '更换日期',
-				remark: '更换班表',
-				auditStatus: '审核状态',
-				createTime: '新增时间',
-				statusTime: '审核时间'
-			},
-			// 【设置班表】列表table字段名称
-			setClass: {
-				deptName: '部门',
-				name: '姓名',
-				no: '工号'
-			}
-		},
-		// 表单数据名称
-		form: {
-			timeLength: '时间段',
-			sumTime: '总时间',
-			tipsColor: '标注颜色',
-			month: '班表月份',
-			deptUsers: '部门人员',
-			setDate: '设置日期',
-			setClass: '设置班次'
-		},
-		// 表单验证规则提示信息
-		rules: {
-		},
-		// 提示或者显示信息
-		tips:{
-			accossDay: '第二天',
-			startTime: '开始时间',
-			endTime: '结束时间',
-			areaTips: '删除班次管理数据后,会将班次管理数据全部删除,确认删除?',
-			schedulTips: '删除班表管理数据后,会将班表管理数据全部删除,确认删除?',
-			settingTips: '清除设置班表数据后,会将设置班表人员数据全部清除,确认清除?',
-			settingAllTips: '全部清除设置班表数据后,会将设置班表人员数据全部清除,确认全部清除?'
-		}
-	}
-}
+/**************** 【生产准备中心】菜单  **************/
+export default {
+	calssSchedule: {
+		// 本模型下的共通
+		common: {
+			aduio: '审核产品',
+			schedFlag0: '不需排班',
+			schedFlag1: '需要排班',
+			classSchul: '班表',
+			userSchul: '个人班表'
+		},
+		// 列表搜索表单名称
+		searchForm: {
+			name: '班表名称',
+			no: '编号',
+			numb: '工号',
+			deptName: '部门',
+			userName: '姓名',
+			month: '月份',
+			applyName: '申请人',
+			applyTime: '申请日期',
+			audioStatus: '审核状态'
+		},
+		// 按钮的名称
+	  	buttons: {
+	  		setClass: '设置班表',
+	  		allClear: '全部清除'
+	  	},
+	  	// 列表的cell名称
+		table: {
+			// 【班表管理】列表table字段名称
+			schedule: {
+				year: '年',
+				month: '月',
+				status: '状态',
+				addTime: '新增时间',
+				audioTime: '审核时间'
+			},
+			// 【班次管理】列表table字段名称
+			calsses: {
+				no: '编号',
+				name: '班次名称',
+				model: '班次时间段',
+				hours: '班次时间(小时)',
+				remark: '备注'
+			},
+			// 【排班人员管理】列表table字段名称
+			staff: {
+				type: '类型',
+				numbers: '人员数量',
+			},
+			// 【换班管理】列表table字段名称
+			staffChange: {
+				auditUser: '申请人',
+				applyTime: '申请日期',
+				model: '更换班表',
+				hours: '更换人',
+				changeTime: '更换日期',
+				remark: '更换班表',
+				auditStatus: '审核状态',
+				createTime: '新增时间',
+				statusTime: '审核时间'
+			},
+			// 【设置班表】列表table字段名称
+			setClass: {
+				deptName: '部门',
+				name: '姓名',
+				no: '工号'
+			}
+		},
+		// 表单数据名称
+		form: {
+			beginTime: '班次开始时间',
+      endTime: '班次结束时间',
+			sumTime: '总时间',
+			tipsColor: '标注颜色',
+			month: '班表月份',
+			deptUsers: '部门人员',
+			setDate: '设置日期',
+			setClass: '设置班次'
+		},
+		// 表单验证规则提示信息
+		rules: {
+		},
+		// 提示或者显示信息
+		tips:{
+			accossDay: '第二天',
+			startTime: '开始时间',
+			endTime: '结束时间',
+			areaTips: '删除班次管理数据后,会将班次管理数据全部删除,确认删除?',
+			schedulTips: '删除班表管理数据后,会将班表管理数据全部删除,确认删除?',
+			settingTips: '清除设置班表数据后,会将设置班表人员数据全部清除,确认清除?',
+			settingAllTips: '全部清除设置班表数据后,会将设置班表人员数据全部清除,确认全部清除?'
+		}
+	}
+}

+ 14 - 16
imcs-ui/src/views/zuihou/classScheduleMgr/classScheduleMgr/Index.vue

@@ -2,13 +2,10 @@
   <div class="app-container">
 		<!-- 搜索模块 -->
     <div class="filter-container">
-    	<span>
-    		<span>{{$t("calssSchedule.searchForm.name")}}:</span>
-    		<el-input v-model="queryParams.model.name" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
-    	</span>
+
     	<span style="margin-left: 15px;">
     		<span>{{$t("calssSchedule.searchForm.audioStatus")}}:</span>
-    		<el-select v-model="queryParams.model.status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 150px;">
+    		<el-select v-model="queryParams.model.auditStatus" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 150px;">
         	<el-option
 			      v-for="item in audioStatus"
 			      :key="item.value"
@@ -26,7 +23,7 @@
 	      </el-button>
       </span>
     </div>
-    
+
     <!-- 功能按钮 -->
     <el-row class="filter-container">
     	<el-col>
@@ -145,7 +142,7 @@
         <div v-html="preview.context" />
       </el-scrollbar>
     </el-dialog>
-    
+
     <el-dialog
       v-el-drag-dialog
       :close-on-click-modal="false"
@@ -170,7 +167,7 @@
 			  </el-row>
 			</template>
     </el-dialog>
-    
+
     <el-dialog
 		  title="设置班表"
 		  :visible.sync="dialogVisible"
@@ -192,8 +189,7 @@
 	// 【设置班表】-组件
 	import SettingClassSchedul from "@/views/zuihou/classScheduleMgr/settingClassSchedul/Index"
 	import elDragDialog from '@/directive/el-drag-dialog'
-	import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
-	import axios from 'axios'
+	import { initDicts, initQueryParams } from '@/utils/commons'
 	export default {
 	  name: "WarehouseTypeMgr",
 	  directives: { elDragDialog },
@@ -251,7 +247,7 @@
       }
 	  },
 	  mounted () {
-	    
+
 	  },
 	  methods: {
 	  	// 【设置班表】按钮-事件
@@ -265,7 +261,7 @@
 	  	},
 	  	// 【设置班表-确定】按钮事件
 	  	editClassSuccess(){
-	  		
+
 	  	},
 	  	// 【提交审核】按钮-事件
 	    updateStatus(status){
@@ -395,7 +391,7 @@
 	        })
 	        return
 	      }
-	
+
 	      this.$confirm(this.$t("calssSchedule.tips.schedulTips"), this.$t("common.tips"), {
 	      	distinguishCancelAndClose: true,
 	        confirmButtonText: this.$t("common.confirm"),
@@ -474,12 +470,14 @@
 	      this.dialog.isVisible = true
 	    },
 	    fetch (params = {}) {
+	  	  this.tableKey = !this.tableKey
+        this.selection  = []
 	      this.loading = true
 	      if (this.queryParams.timeRange) {
 	        this.queryParams.map.createTime_st = this.queryParams.timeRange[0]
 	        this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]
 	      }
-	
+
 	      this.queryParams.current = params.current ? params.current : this.queryParams.current
 	      this.queryParams.size = params.size ? params.size : this.queryParams.size
 	      classScheduleMgrApi.page(this.queryParams).then(response => {
@@ -489,7 +487,7 @@
 	        }
 	        // eslint-disable-next-line no-return-assign
 	      }).finally(() => this.loading = false)
-	     
+
 	    },
 	    cellClick (row, column) {
 	      if (column['columnKey'] === "operation") {
@@ -502,7 +500,7 @@
 	          this.$refs.table.toggleRowSelection(row)
 	        }
 	      })
-	
+
 	      if (!flag) {
 	        this.$refs.table.toggleRowSelection(row, true)
 	      }

+ 7 - 5
imcs-ui/src/views/zuihou/classScheduleMgr/classesMgr/Index.vue

@@ -17,7 +17,7 @@
 	      </el-button>
       </span>
     </div>
-    
+
     <!-- 功能按钮 -->
     <el-row class="filter-container">
     	<el-col>
@@ -192,7 +192,7 @@
       }
 	  },
 	  mounted () {
-	    
+
 	  },
 	  methods: {
 	    viewClose () {
@@ -238,7 +238,7 @@
 	        })
 	        return
 	      }
-	
+
 	      this.$confirm(this.$t("calssSchedule.tips.areaTips"), this.$t("common.tips"), {
 	      	distinguishCancelAndClose: true,
 	        confirmButtonText: this.$t("common.confirm"),
@@ -305,6 +305,8 @@
 	      this.dialog.isVisible = true
 	    },
 	    fetch (params = {}) {
+        this.tableKey = !this.tableKey
+	      this.selection = []
 	      this.loading = true
 	      // 搜索日期区间
 	      if (this.queryParams.timeRange) {
@@ -323,7 +325,7 @@
 	        }
 	        // eslint-disable-next-line no-return-assign
 	      }).finally(() => this.loading = false)
-	     
+
 	    },
 	    cellClick (row, column) {
 	      if (column['columnKey'] === "operation") {
@@ -336,7 +338,7 @@
 	          this.$refs.table.toggleRowSelection(row)
 	        }
 	      })
-	
+
 	      if (!flag) {
 	        this.$refs.table.toggleRowSelection(row, true)
 	      }

+ 74 - 32
imcs-ui/src/views/zuihou/classScheduleMgr/classesMgr/components/Edit.vue

@@ -1,11 +1,11 @@
 <template>
-  <el-dialog 
-  	:close-on-click-modal="false" 
-  	:close-on-press-escape="false" 
-  	:title="title" 
+  <el-dialog
+  	:close-on-click-modal="false"
+  	:close-on-press-escape="false"
+  	:title="title"
   	:append-to-body="true"
-  	:visible.sync="isVisible" 
-  	:width="width" 
+  	:visible.sync="isVisible"
+  	:width="width"
   	top="50px"
   >
     <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
@@ -14,33 +14,26 @@
 	          <el-option :key="index" :label="item" :value="key" v-for="(item, key, index) in dicts.FREQUENCY" />
 	        </el-select>
       </el-form-item>
-      <el-form-item 
-      	:label='$t("calssSchedule.form.timeLength")+":"' 
+      <el-form-item
+      	:label='$t("calssSchedule.form.beginTime")+":"'
       	prop="startTime"
-      	:rules='[
-		      { required: tenant.name.key == "04" ? false : true, message: this.$t("rules.require"), trigger: "change" }
-		    ]'
       >
-      	<el-col :span="18">
-      		<el-time-picker v-model="tenant.startTime" :disabled='tenant.name.key == "04" ? true : false' value-format="HH:mm:ss" :placeholder='$t("calssSchedule.tips.startTime")' style="width: 48%;"></el-time-picker>
-		      <span>~</span>
-		      <el-time-picker v-model="tenant.endTime" :disabled='tenant.name.key == "04" ? true : false' value-format="HH:mm:ss" :placeholder='$t("calssSchedule.tips.endTime")' style="width: 48%;"></el-time-picker>
+      	<el-col :span="16">
+      		<el-time-picker v-model="tenant.startTime" :disabled='tenant.name.key == "04" ? true : false' format="HH:mm" value-format="HH:mm" :placeholder='$t("calssSchedule.tips.startTime")' style="width: 40%;"></el-time-picker>
 		    </el-col>
-		    <el-col :span="6">
-		    	<span style="margin-left: 20px;">
+      </el-form-item>
+      <el-form-item
+        :label='$t("calssSchedule.form.endTime")+":"'
+        prop="endTime"
+      >
+        <el-col :span="16">
+          <el-time-picker v-model="tenant.endTime" :disabled='tenant.name.key == "04" ? true : false' format="HH:mm" value-format="HH:mm" :placeholder='$t("calssSchedule.tips.endTime")' style="width: 40%;"></el-time-picker>
+        </el-col>
+        <el-col :span="2">
+		    	<span style="margin-left: -220px;">
 		    		<el-checkbox v-model="tenant.accossDay" :disabled='tenant.name.key == "04" ? true : false'>{{$t("calssSchedule.tips.accossDay")}}</el-checkbox>
 		    	</span>
-		    	<!--<template>
-					  <el-checkbox-group v-for="item in updateCheckbox" v-model="tenant.model2">
-					    <el-checkbox :key="item.id" :label="item.name">{{item.name}}</el-checkbox>
-					  </el-checkbox-group>
-					</template>-->
-		    	<!--<template style="margin-left: 20px;">
-					  <el-checkbox-group :disabled='tenant.name.key == "04" ? true : false'>
-					    <el-checkbox v-model="tenant.accossDay" :label="1">{{$t("calssSchedule.tips.accossDay")}}</el-checkbox>
-					  </el-checkbox-group>
-					</template>-->
-		    </el-col>
+        </el-col>
       </el-form-item>
       <el-form-item :label='$t("calssSchedule.form.sumTime")+":"' prop="hours">
           <span>{{sumTime}}</span>
@@ -50,7 +43,7 @@
           <el-color-picker v-model="tenant.color" size="small"></el-color-picker>
       </el-form-item>
       <el-form-item :label='$t("calssSchedule.table.calsses.remark")+":"' prop="remark">
-      	<el-input v-model="tenant.remark" type="textarea" :rows="3" style="width: 100%;"/>
+      	<el-input v-model="tenant.remark" type="textarea" :rows="3" style="width: 100%;" />
       </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer">
@@ -60,7 +53,7 @@
   </el-dialog>
 </template>
 <script>
-	
+
 // 【班次管理】-API
 import classesMgrApi from "@/api/classScheduleMgr/classesMgr"
 
@@ -95,6 +88,37 @@ export default {
         ],
         color: [
         	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
+        ],
+        startTime: [
+          { required: true, validator: (rule, value, callback) => {
+                  if(this.tenant.name.key != '04'){
+                      console.log("value=" + value)
+                      if (value === null) {
+                          callback(new Error("请选择班表开始时间"))
+                      } else {
+                          callback()
+                      }
+                  }else{
+                      callback()
+                  }
+              }, trigger: ['blur','change'] }
+        ],
+        endTime: [
+            { required: true, validator: (rule, value, callback) => {
+                    console.log("value=" + value)
+                    if(this.tenant.name.key != '04'){
+                        if (value === null) {
+                            callback(new Error("请选择班表结束时间"))
+                        } else {
+                            callback()
+                        }
+                    }else{
+                        callback()
+                    }
+                }, trigger: ['blur','change'] }
+        ],
+        remark: [
+          {max: 200,message: "备注长度不能超过200"}
         ]
       }
     }
@@ -110,6 +134,16 @@ export default {
       }
     },
     sumTime(){
+      if(this.tenant.name.key != "04"){
+          if(this.tenant.startTime === null){
+              this.tenant.hours = 0
+              return 0
+          }
+          if(this.tenant.endTime === null){
+              this.tenant.hours = 0
+              return 0
+          }
+      }
     	// 一天的时间,换成毫秒数
     	let minite = 60*60*24*1000
     	let startTime = 0
@@ -141,10 +175,18 @@ export default {
   	// 【班次名称】值变化-事件
   	changeName(val){
   		// 如果是修改,【时间段】不让输入
+      this.$refs.form.validate((valid) => {
+          if (valid) {
+              return true
+          } else {
+              return false
+          }
+      })
   		if(val == "04"){
   			this.tenant.accossDay = false
   			this.tenant.startTime = null
   			this.tenant.endTime = null
+
   		}
   	},
     initTenant () {
@@ -152,8 +194,8 @@ export default {
         name: {
         	key: ''
         },
-        startTime: 0,
-        endTime: 0
+        startTime: null,
+        endTime: null
       }
     },
     initWidth () {