瀏覽代碼

班表管理问题修改

yejian 3 年之前
父節點
當前提交
55c1aa0c92

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

@@ -303,8 +303,23 @@
 	      this.search()
 	      this.search()
 	    },
 	    },
 	    add () {
 	    add () {
-	      this.$refs.edit.type = "add"
-	      this.$refs.edit.setTenant(false, this.dicts)
+        let monthBeginDay = "";
+        let now = new Date(); //当前日期
+        let nowDay = now.getDate(); //当前日
+        let nowMonth = now.getMonth() + 1; //当前月
+        let nowYear = now.getYear(); //当前年
+        console.log(nowMonth)
+        console.log(Number(this.objData.month))
+        if(nowMonth == Number(this.objData.month)){
+          monthBeginDay = this.objData.year + "-" + this.objData.month + "-" + nowDay;
+        }else{
+          monthBeginDay = this.objData.year + "-" + this.objData.month + "-" + "01 00:00:00";
+        }
+        let monthLastDay = this.objData.year + "-" + this.objData.month + "-" + this.getMonthDays(Number(this.objData.year),Number(this.objData.month));
+        console.log(monthBeginDay);
+        console.log(monthLastDay);
+        this.$refs.edit.type = "add"
+	      this.$refs.edit.setTenant(false, this.dicts,monthBeginDay,monthLastDay)
 	      this.dialog.title = this.$t("common.setting") + this.objData.year + this.$t("common.date.year") + this.objData.month + this.$t("common.date.month") + this.$t("calssSchedule.common.classSchul")
 	      this.dialog.title = this.$t("common.setting") + this.objData.year + this.$t("common.date.year") + this.objData.month + this.$t("common.date.month") + this.$t("calssSchedule.common.classSchul")
 	      this.dialog.isVisible = true
 	      this.dialog.isVisible = true
 	    },
 	    },
@@ -544,6 +559,39 @@
           if(!mark) {
           if(!mark) {
               el.dropDownVisible = false;
               el.dropDownVisible = false;
           }
           }
+      },
+      //获得某月的天数
+      getMonthDays(nowYear,myMonth){
+        let monthStartDate = new Date(nowYear, myMonth, 1);
+        let monthEndDate = new Date(nowYear, myMonth + 1, 1);
+        let days = (monthEndDate - monthStartDate)/(1000 * 60 * 60 * 24);
+        return days;
+      },
+      //获得本月的开始日期
+      getMonthStartDate(nowYear,nowMonth){
+        let monthStartDate = new Date(nowYear, nowMonth, 1);
+        return this.formatDate(monthStartDate);
+      },
+      //获得本月的结束日期
+      getMonthEndDate(nowYear,nowMonth){
+        let days= this.getMonthDays(nowYear,nowMonth);//获取当月总共有多少天
+        let monthEndDate = new Date(nowYear, nowMonth, days);
+        return this.formatDate(monthEndDate); //返回当月结束时间
+      },
+
+      //格式化日期:yyyy-MM-dd
+      formatDate(date) {
+        let myyear = date.getFullYear();
+        let mymonth = date.getMonth()+1;
+        let myweekday = date.getDate();
+
+        if(mymonth < 10){
+          mymonth = "0" + mymonth;
+        }
+        if(myweekday < 10){
+          myweekday = "0" + myweekday;
+        }
+        return (myyear+"-"+mymonth + "-" + myweekday);
       }
       }
 	  }
 	  }
 	}
 	}

+ 334 - 334
imcs-ui/src/views/zuihou/classScheduleMgr/settingClassSchedul/components/CalendarUser.vue

@@ -1,334 +1,334 @@
-<!-- DOM模板部分  -->
-<template>
-	<el-dialog 
-  	:close-on-click-modal="false" 
-  	:close-on-press-escape="false" 
-  	:title="title" 
-  	:append-to-body="true"
-  	:visible.sync="isUserVisible" 
-  	width="80%" 
-  	top="50px"
-  	>
-  		<!-- 基本信息 -->
-	    <el-row class="filter-container">
-	    	<el-col>
-	    		<span>姓名:{{user.userName}}</span>
-	    		<span style="margin-left: 15px;">月份:{{dateObj.year}}年{{dateObj.month}}月</span>
-	    		<span style="margin-left: 15px;">所属部门:{{user.orgName}}</span>
-	    	</el-col>
-	    </el-row>
-	    
-  		<!-- 功能按钮 -->
-	    <el-row class="filter-container">
-	    	<el-col>
-	    		<el-button type="primary" icon="el-icon-plus" size="medium" @click="add">{{ $t("common.add") }}</el-button>
-			    <el-button type="danger" icon="el-icon-delete" size="medium" @click="batchDelete">
-			        {{ $t("common.delete") }}
-			    </el-button>
-	    	</el-col>
-	    </el-row>
-	    
-	    <!-- 日历内容 -->
-		<el-calendar
-			class="calendarWks"
-			v-model="currDate"
-			@change="calChange"
-		>
-		  <!-- 这里使用的是 2.5 slot 语法,对于新项目请使用 2.6 slot 语法-->
-		  <template slot="dateCell" slot-scope="{date, data}">
-		   	<p :class="data.isSelected ? 'is-selected' : ''">
-		   		{{ data.day.split('-').slice(2).join('-') }}
-		   		<el-checkbox v-model="checks[data.day]" :disabled="data.type == 'current-month' ? false : true"></el-checkbox>
-		   		<!--<template v-for="item in userDateList">
-		   			<el-checkbox v-if="item.day == data.day" v-model="checks[data.day]" :disabled="data.type == 'current-month' ? false : true"></el-checkbox>
-		   		</template>-->
-		   		<!--{{dealMyDate(data.day)}}-->
-		    </p>
-		    <!--自定义内容-->
-          	<div>
-                <div v-for="item in userDateList">
-                   	<div v-if="item.day == data.day">
-	                    <span v-for="obj in item.data" :key="obj.keys" :style="obj.color" class="clsName">{{obj.text}}</span>
-                  	</div>
-            	</div>
-         	</div>
-		  </template>
-		</el-calendar>
-		
-		<!-- 【新增】组件-->
-		<edit-calendar
-	      ref="calendar"
-	      :dialog-visible="dialog.isVisible"
-	      :title="dialog.title"
-	      @close="editClose"
-	      @success="editSuccess"
-	    />
-  	</el-dialog>
-</template>
-
-<!-- JS部分 -->
-<script>
-	// 【新增】组件
-	import EditCalendar from "./EditCalendar"
-	// 加载共通的方法
-	import { initQueryParams, initDicts } from '@/utils/commons'
-	// 【设置班表】-API
-	import settingClassSchedulApi from "@/api/classScheduleMgr/settingClassSchedul"
-	export default{
-		name: 'CalendarUser',
-		components: { EditCalendar },
-		props: {
-			dialogVisible: {
-		      	type: Boolean,
-		      	default: false
-		    },
-		    title: {
-		      	type: String,
-		      	default: ''
-		    }
-		},
-		data () {
-			return {
-				checks: {}, // 选中日期
-				currDate: '',  // 默认日期
-				userDateList: {}, // 数据
-				dateObj: {}, // 年月对象
-				user: {}, // 人员对象
-				dialog: {
-			        isVisible: false,
-			        title: ""
-			    },
-			    dicts: {
-		          NATION: {}
-		        },
-				queryParams: initQueryParams({})
-			}
-		},
-		// 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
-	  	created() {
-	  		// 加载【字典】
-	  		initDicts(['NATION'], this.dicts);
-		},
-		computed: {
-			isUserVisible: {
-		      	get () {
-		        	return this.dialogVisible
-		      	},
-		      	set () {
-		        	this.close()
-		        	this.reset()
-		      	}
-		    },
-		    nationList() {
-	        	return convertEnum(this.dicts.NATION)
-      		}
-		},
-		mounted () {
-			/*this.$nextTick(() => {
-                // 点击前一个月
-                let prevBtn = document.querySelector(
-                    '.el-calendar__button-group .el-button-group>button:first-child');
-                prevBtn.addEventListener('click', (e) => {
-                    console.log(e);
-                })
-            })
-
-            this.$nextTick(() => {
-                // 点击后一个月
-                let prevBtn = document.querySelector(
-                    '.el-calendar__button-group .el-button-group>button:last-child');
-                prevBtn.addEventListener('click', (e) => {
-                    console.log(this.value);
-                })
-            })*/
-		},
-		methods: {
-			dealMyDate(v) {
-	            console.log(v)
-	            /*let len = this.userDateList.length
-	            let res = "<div>"
-	            for(let i=0; i<len; i++){
-	                if(this.userDateList[i].day == v) {
-	                	let obj = this.userDateList[i]
-	                	let leng = obj.data.length
-	                	if(leng > 0){
-	                		for(let j=0; j<obj.data.length; j++){
-		                		res += "<span style=\""+ obj.data[j].color +"\" class=\"clsName\">"+ obj.data[j].text +"</span>"
-		                	}
-	                	}
-	                    break
-	                }
-	            }
-	            res += "</div>"*/
-	            return ''
-	       },
-			// 日历值变化事件
-			calChange(e){
-				console.log("日历值变化事件:", e)
-			},
-			// 关闭组件-事件
-			close () {
-		      this.$emit('close')
-		    },
-		    // 重置组件内容-事件
-		    reset () {
-		    	
-		    },
-		    editClose () {
-		      	this.dialog.isVisible = false
-		    },
-		    editSuccess () {
-		      	// 查询日历的数据
-		    	this.fetch()
-		    },
-		    // 来自父组件的设置-函数
-		    setTenant (val, obj) {
-		    	this.user = val
-		    	this.dateObj = obj
-		    	this.currDate = this.dateObj.year +"-"+ this.dateObj.month
-		    	console.log("")
-		    	// 查询日历的数据
-		    	this.fetch()
-		    },
-		    // 【新增】按钮-事件
-		    add(){
-		    	this.$refs.calendar.type = "add"
-			    this.$refs.calendar.setTenant(this.user, this.dicts, this.dateObj)
-			    this.dialog.title = this.$t("common.setting") + this.dateObj.year + this.$t("common.date.year") + this.dateObj.month + this.$t("common.date.month") + this.$t("calssSchedule.common.classSchul")
-			    this.dialog.isVisible = true
-			    console.log("this.dialog == ", this.dateObj)
-		    },
-		    // 【删除】按钮-事件
-		    batchDelete(){
-		    	console.log("【删除】按钮-事件: ", this.checks)
-			    this.$confirm(this.$t("calssSchedule.tips.settingTips"), this.$t("common.tips"), {
-			      	distinguishCancelAndClose: true,
-			        confirmButtonText: this.$t("common.confirm"),
-			        cancelButtonText: this.$t("common.cancel"),
-			        type: "warning"
-			    }).then(() => {
-			      	let obj = {
-			      		dateList: new Array(),
-			      		strUserList: [this.user.userId]
-			      	}
-			      	// 获取对象的Key值(既是:日期)
-			      	let keys = Object.keys(this.checks)
-			      	keys.map(item => {
-			      		if(this.checks[item]){
-			      			obj.dateList.push(item)
-			      		}
-			      	})
-				    this.clearSchedule(obj)
-			    }).catch(() => {})
-		    },
-		    // 【清除、全部清除】-函数
-		    clearSchedule(obj){
-		    	settingClassSchedulApi.clearSchedule(obj).then(response => {
-		        const res = response.data
-		        if (res.isSuccess) {
-		          this.$message({
-		            message: this.$t("tips.deleteSuccess"),
-		            type: "success"
-		          })
-		          // 查询日历数据
-		          this.fetch()
-		        }
-		      })
-		    },
-		    // 获取个人数据
-		    fetch () {
-		      this.loading = true
-				// 分页数据
-		      	this.queryParams.current = 1
-		      	this.queryParams.size = 100
-		      	// 条件,日期和用的userId
-		      	this.queryParams.model = {
-		      		userId: this.user.userId,
-		      		year: this.dateObj.year,
-		      		month: this.dateObj.month
-		      	}
-		      
-		      	settingClassSchedulApi.pageList(this.queryParams).then(response => {
-			        const res = response.data
-			        if (res.isSuccess) {
-			          this.formatData(res.data)
-			        }
-			        // eslint-disable-next-line no-return-assign
-		      	}).finally(() => this.loading = false)
-		    },
-		    // 格式化,自己需要的渲染数据
-		    formatData(data){
-		    	//this.tableData = res.data
-		    	if(data.data && data.data.length > 0){
-		    		// 数据内容
-		    		let list = []
-		    		let dateList = []
-		    		data.data.map((item, index) => {
-		    			let keys = Object.keys(item)  // 对象的所有Key的数组
-		    			keys.map(val => {
-		    				// 如果字段是日期,格式化后,yyyy-MM-dd
-		    				if(val.indexOf("-") > -1){
-		    					// 如果值,存在--- "早班;#E20867,午班;#E30628"
-		    					if(!!item[val]){
-		    						// 组成新的数据
-		    						let dateObj = {
-		    							keys: 'WKS'+ Math.random(),
-		    							day: val,
-		    							data: []
-		    						}
-			    					let children = new Array()
-			    					let arr = item[val].split(",") // ["早班;#E20867","午班;#E30628"]
-			    					arr.map((res, keys) => {
-						  				let result = res.split(";")  // ["早班","#E20867"]/["午班","#E30628"]/
-						  				children.push({
-						  					day: val,
-						  					keys: 'W'+ keys,
-			    							text: result[0],
-			    							color: 'background:'+ result[1]
-			    						})
-						  			})
-			    					// 
-			    					dateObj.data = children
-			    					// 赋值
-			    					item[val] = children
-			    					// 
-			    					dateList.push(dateObj)
-		    					}
-		    				}
-		    			})
-		    			// 给数据赋值
-		    			list.push(item)
-		    		})
-		    		data.data = list
-		    		
-		    		this.userDateList = dateList
-		    		console.log("数据后111111:", dateList)
-		    	}
-		    	/*let arry = data.data
-		    	console.log("数据后的内容:", arry[0])
-		    	if(arry && arry.length > 0){
-		    		this.userDateList = arry[0]
-		    	}*/
-		    }
-		}
-	}
-</script>
-
-<!-- 全局样式 -->
-<style type="text/css">
-	.calendarWks .el-calendar__button-group{
-		display: none;
-	}
-</style>
-
-<!-- 局部样式css -->
-<style lang="scss" scoped>
-	.clsName{
-		color: white;
-		padding: 2px 6px;
-		margin: 5px;
-		-moz-border-radius: 3px;
-		-webkit-border-radius: 3px;
-		border-radius: 3px;
-	}
-</style>
+<!-- DOM模板部分  -->
+<template>
+	<el-dialog
+  	:close-on-click-modal="false"
+  	:close-on-press-escape="false"
+  	:title="title"
+  	:append-to-body="true"
+  	:visible.sync="isUserVisible"
+  	width="80%"
+  	top="50px"
+  	>
+  		<!-- 基本信息 -->
+	    <el-row class="filter-container">
+	    	<el-col>
+	    		<span>姓名:{{user.userName}}</span>
+	    		<span style="margin-left: 15px;">月份:{{dateObj.year}}年{{dateObj.month}}月</span>
+	    		<span style="margin-left: 15px;">所属部门:{{user.orgName}}</span>
+	    	</el-col>
+	    </el-row>
+
+  		<!-- 功能按钮 -->
+	    <el-row class="filter-container">
+	    	<el-col>
+	    		<el-button type="primary" icon="el-icon-plus" size="medium" @click="add">{{ $t("common.add") }}</el-button>
+			    <el-button type="danger" icon="el-icon-delete" size="medium" @click="batchDelete">
+			        {{ $t("common.delete") }}
+			    </el-button>
+	    	</el-col>
+	    </el-row>
+
+	    <!-- 日历内容 -->
+		<el-calendar
+			class="calendarWks"
+			v-model="currDate"
+			@change="calChange"
+		>
+		  <!-- 这里使用的是 2.5 slot 语法,对于新项目请使用 2.6 slot 语法-->
+		  <template slot="dateCell" slot-scope="{date, data}">
+		   	<p :class="data.isSelected ? 'is-selected' : ''">
+		   		{{ data.day.split('-').slice(2).join('-') }}
+		   		<el-checkbox v-model="checks[data.day]" :disabled="data.type == 'current-month' ? false : true"></el-checkbox>
+		   		<!--<template v-for="item in userDateList">
+		   			<el-checkbox v-if="item.day == data.day" v-model="checks[data.day]" :disabled="data.type == 'current-month' ? false : true"></el-checkbox>
+		   		</template>-->
+		   		<!--{{dealMyDate(data.day)}}-->
+		    </p>
+		    <!--自定义内容-->
+          	<div>
+                <div v-for="item in userDateList">
+                   	<div v-if="item.day == data.day">
+	                    <span v-for="obj in item.data" :key="obj.keys" :style="obj.color" class="clsName">{{obj.text}}</span>
+                  	</div>
+            	</div>
+         	</div>
+		  </template>
+		</el-calendar>
+
+		<!-- 【新增】组件-->
+		<edit-calendar
+	      ref="calendar"
+	      :dialog-visible="dialog.isVisible"
+	      :title="dialog.title"
+	      @close="editClose"
+	      @success="editSuccess"
+	    />
+  	</el-dialog>
+</template>
+
+<!-- JS部分 -->
+<script>
+	// 【新增】组件
+	import EditCalendar from "./EditCalendar"
+	// 加载共通的方法
+	import { initQueryParams, initDicts } from '@/utils/commons'
+	// 【设置班表】-API
+	import settingClassSchedulApi from "@/api/classScheduleMgr/settingClassSchedul"
+	export default{
+		name: 'CalendarUser',
+		components: { EditCalendar },
+		props: {
+			dialogVisible: {
+		      	type: Boolean,
+		      	default: false
+		    },
+		    title: {
+		      	type: String,
+		      	default: ''
+		    }
+		},
+		data () {
+			return {
+				checks: {}, // 选中日期
+				currDate: '',  // 默认日期
+				userDateList: {}, // 数据
+				dateObj: {}, // 年月对象
+				user: {}, // 人员对象
+				dialog: {
+			        isVisible: false,
+			        title: ""
+			    },
+			    dicts: {
+		          NATION: {}
+		        },
+				queryParams: initQueryParams({})
+			}
+		},
+		// 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+	  	created() {
+	  		// 加载【字典】
+	  		initDicts(['NATION'], this.dicts);
+		},
+		computed: {
+			isUserVisible: {
+		      	get () {
+		        	return this.dialogVisible
+		      	},
+		      	set () {
+		        	this.close()
+		        	this.reset()
+		      	}
+		    },
+		    nationList() {
+	        	return convertEnum(this.dicts.NATION)
+      		}
+		},
+		mounted () {
+			/*this.$nextTick(() => {
+                // 点击前一个月
+                let prevBtn = document.querySelector(
+                    '.el-calendar__button-group .el-button-group>button:first-child');
+                prevBtn.addEventListener('click', (e) => {
+                    console.log(e);
+                })
+            })
+
+            this.$nextTick(() => {
+                // 点击后一个月
+                let prevBtn = document.querySelector(
+                    '.el-calendar__button-group .el-button-group>button:last-child');
+                prevBtn.addEventListener('click', (e) => {
+                    console.log(this.value);
+                })
+            })*/
+		},
+		methods: {
+			dealMyDate(v) {
+	            console.log(v)
+	            /*let len = this.userDateList.length
+	            let res = "<div>"
+	            for(let i=0; i<len; i++){
+	                if(this.userDateList[i].day == v) {
+	                	let obj = this.userDateList[i]
+	                	let leng = obj.data.length
+	                	if(leng > 0){
+	                		for(let j=0; j<obj.data.length; j++){
+		                		res += "<span style=\""+ obj.data[j].color +"\" class=\"clsName\">"+ obj.data[j].text +"</span>"
+		                	}
+	                	}
+	                    break
+	                }
+	            }
+	            res += "</div>"*/
+	            return ''
+	       },
+			// 日历值变化事件
+			calChange(e){
+				console.log("日历值变化事件:", e)
+			},
+			// 关闭组件-事件
+			close () {
+		      this.$emit('close')
+		    },
+		    // 重置组件内容-事件
+		    reset () {
+
+		    },
+		    editClose () {
+		      	this.dialog.isVisible = false
+		    },
+		    editSuccess () {
+		      	// 查询日历的数据
+		    	this.fetch()
+		    },
+		    // 来自父组件的设置-函数
+		    setTenant (val, obj) {
+		    	this.user = val
+		    	this.dateObj = obj
+		    	this.currDate = this.dateObj.year +"-"+ this.dateObj.month
+		    	console.log("")
+		    	// 查询日历的数据
+		    	this.fetch()
+		    },
+		    // 【新增】按钮-事件
+		    add(){
+		    	this.$refs.calendar.type = "add"
+			    this.$refs.calendar.setTenant(this.user, this.dicts, this.dateObj)
+			    this.dialog.title = this.$t("common.setting") + this.dateObj.year + this.$t("common.date.year") + this.dateObj.month + this.$t("common.date.month") + this.$t("calssSchedule.common.classSchul")
+			    this.dialog.isVisible = true
+			    console.log("this.dialog == ", this.dateObj)
+		    },
+		    // 【删除】按钮-事件
+		    batchDelete(){
+		    	console.log("【删除】按钮-事件: ", this.checks)
+			    this.$confirm(this.$t("calssSchedule.tips.settingTips"), this.$t("common.tips"), {
+			      	distinguishCancelAndClose: true,
+			        confirmButtonText: this.$t("common.confirm"),
+			        cancelButtonText: this.$t("common.cancel"),
+			        type: "warning"
+			    }).then(() => {
+			      	let obj = {
+			      		dateList: new Array(),
+			      		strUserList: [this.user.userId]
+			      	}
+			      	// 获取对象的Key值(既是:日期)
+			      	let keys = Object.keys(this.checks)
+			      	keys.map(item => {
+			      		if(this.checks[item]){
+			      			obj.dateList.push(item)
+			      		}
+			      	})
+				    this.clearSchedule(obj)
+			    }).catch(() => {})
+		    },
+		    // 【清除、全部清除】-函数
+		    clearSchedule(obj){
+		    	settingClassSchedulApi.clearSchedule(obj).then(response => {
+		        const res = response.data
+		        if (res.isSuccess) {
+		          this.$message({
+		            message: this.$t("tips.deleteSuccess"),
+		            type: "success"
+		          })
+		          // 查询日历数据
+		          this.fetch()
+		        }
+		      })
+		    },
+		    // 获取个人数据
+		    fetch () {
+		      this.loading = true
+				// 分页数据
+		      	this.queryParams.current = 1
+		      	this.queryParams.size = 100
+		      	// 条件,日期和用的userId
+		      	this.queryParams.model = {
+		      		userId: this.user.userId,
+		      		year: this.dateObj.year,
+		      		month: this.dateObj.month
+		      	}
+
+		      	settingClassSchedulApi.pageList(this.queryParams).then(response => {
+			        const res = response.data
+			        if (res.isSuccess) {
+			          this.formatData(res.data)
+			        }
+			        // eslint-disable-next-line no-return-assign
+		      	}).finally(() => this.loading = false)
+		    },
+		    // 格式化,自己需要的渲染数据
+		    formatData(data){
+		    	//this.tableData = res.data
+		    	if(data.data && data.data.length > 0){
+		    		// 数据内容
+		    		let list = []
+		    		let dateList = []
+		    		data.data.map((item, index) => {
+		    			let keys = Object.keys(item)  // 对象的所有Key的数组
+		    			keys.map(val => {
+		    				// 如果字段是日期,格式化后,yyyy-MM-dd
+		    				if(val.indexOf("-") > -1){
+		    					// 如果值,存在--- "早班;#E20867,午班;#E30628"
+		    					if(!!item[val]){
+		    						// 组成新的数据
+		    						let dateObj = {
+		    							keys: 'WKS'+ Math.random(),
+		    							day: val,
+		    							data: []
+		    						}
+			    					let children = new Array()
+			    					let arr = item[val].split(",") // ["早班;#E20867","午班;#E30628"]
+			    					arr.map((res, keys) => {
+						  				let result = res.split(";")  // ["早班","#E20867"]/["午班","#E30628"]/
+						  				children.push({
+						  					day: val,
+						  					keys: 'W'+ keys,
+			    							text: result[0],
+			    							color: 'background:'+ result[1]
+			    						})
+						  			})
+			    					//
+			    					dateObj.data = children
+			    					// 赋值
+			    					item[val] = children
+			    					//
+			    					dateList.push(dateObj)
+		    					}
+		    				}
+		    			})
+		    			// 给数据赋值
+		    			list.push(item)
+		    		})
+		    		data.data = list
+
+		    		this.userDateList = dateList
+		    		console.log("数据后111111:", dateList)
+		    	}
+		    	/*let arry = data.data
+		    	console.log("数据后的内容:", arry[0])
+		    	if(arry && arry.length > 0){
+		    		this.userDateList = arry[0]
+		    	}*/
+		    }
+		}
+	}
+</script>
+
+<!-- 全局样式 -->
+<style type="text/css">
+	.calendarWks .el-calendar__button-group{
+		display: none;
+	}
+</style>
+
+<!-- 局部样式css -->
+<style lang="scss" scoped>
+	.clsName{
+		color: white;
+		padding: 2px 6px;
+		margin: 5px;
+		-moz-border-radius: 3px;
+		-webkit-border-radius: 3px;
+		border-radius: 3px;
+	}
+</style>

+ 8 - 3
imcs-ui/src/views/zuihou/classScheduleMgr/settingClassSchedul/components/Edit.vue

@@ -69,7 +69,8 @@ export default {
     return {
     return {
       pickerOptions: {
       pickerOptions: {
         disabledDate: (time) => {
         disabledDate: (time) => {
-          return time.getTime() < Date.now() - 86400000;
+          // return time.getTime() < Date.now() - 86400000;
+          return time.getTime() < new Date(this.tenant.monthBeginDay).getTime() || time.getTime() > new Date(this.tenant.monthLastDay).getTime()
         },
         },
       },
       },
       type: 'add',
       type: 'add',
@@ -129,7 +130,9 @@ export default {
       return {
       return {
       	frequencyId: '',
       	frequencyId: '',
       	dateList: [],
       	dateList: [],
-        userList: []
+        userList: [],
+        monthBeginDay: '',
+        monthLastDay: '',
       }
       }
     },
     },
     initWidth () {
     initWidth () {
@@ -142,10 +145,12 @@ export default {
         return '800px'
         return '800px'
       }
       }
     },
     },
-    setTenant (val, dicts) {
+    setTenant (val, dicts,monthBeginDay,monthLastDay) {
     	if(val){
     	if(val){
     		this.tenant = { ...val }
     		this.tenant = { ...val }
     	}
     	}
+      this.tenant.monthBeginDay = monthBeginDay
+      this.tenant.monthLastDay = monthLastDay
       // 字典表
       // 字典表
       this.dicts = dicts
       this.dicts = dicts
     },
     },

+ 306 - 276
imcs-ui/src/views/zuihou/classScheduleMgr/settingClassSchedul/components/EditCalendar.vue

@@ -1,276 +1,306 @@
-<template>
-  <el-dialog 
-  	:close-on-click-modal="false" 
-  	:close-on-press-escape="false" 
-  	:title="title" 
-  	:append-to-body="true"
-  	:visible.sync="isVisible" 
-  	width="500px" 
-  	top="50px"
-  >
-    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
-    	<el-form-item :label='$t("calssSchedule.form.deptUsers")+":"' prop="userList">
-          <el-input v-model="userName" :placeholder='$t("common.pleaseEnter")' :disabled="true"></el-input>
-      </el-form-item>
-      <el-form-item :label='$t("calssSchedule.form.setDate")+":"' prop="dateList">
-      	<el-date-picker v-model="tenant.dateList" :default-value="defTime" type="dates" value-format="yyyy-MM-dd" :placeholder='$t("common.pleaseSelect")' style="width: 100%;"></el-date-picker>
-      </el-form-item>
-      <el-form-item :label='$t("calssSchedule.form.setClass")+":"' prop="frequencyId">
-      	<template>
-				  <el-select v-model="tenant.frequencyId" :placeholder='$t("common.pleaseSelect")' style="width: 100%;">
-				    <el-option
-				      v-for="item in classesList"
-				      :key="item.id"
-				      :label="item.name.data"
-				      :value="item.id">
-				    </el-option>
-				  </el-select>
-				</template>
-      </el-form-item>
-    </el-form>
-    <div slot="footer" class="dialog-footer">
-      <el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
-      <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('common.confirm') }}</el-button>
-    </div>
-  </el-dialog>
-</template>
-<script>
-	// 【设置班表】-API
-	import settingClassSchedulApi from "@/api/classScheduleMgr/settingClassSchedul"
-	// 【班次管理】-API
-	import classesMgrApi from "@/api/classScheduleMgr/classesMgr"
-	// 【部门组织】-API
-	import orgApi from "@/api/Org"
-
-export default {
-  name: 'TenantEdit',
-  props: {
-    dialogVisible: {
-      type: Boolean,
-      default: false
-    },
-    title: {
-      type: String,
-      default: ''
-    }
-  },
-  data () {
-    return {
-      type: 'add',
-      userName: '',
-      defTime: null,
-      tenant: this.initTenant(),
-      screenWidth: 0,
-      width: this.initWidth(),
-      confirmDisabled: false,
-      classesList: [], // 班次设置,下拉数据
-      applyList: [],
-      applyCheckbox: [],  // 【更换班表-申请人】
-      updateCheckbox: [],  // 【更换班表-更换人】
-      dicts:{
-        NATION: {}
-      },
-      roles: [],
-      rules: {
-      	userList: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        date: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        frequencyId: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ]
-      }
-    }
-  },
-  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
-  created() {
-  	// [部门人员]的获取
-  	// this.applyList = this.$constWKS.CASCADERLIST
-  	this.getDeptUser()
-  	// [设置班次]的获取
-  	this.getClassesList()
-	},
-  computed: {
-    isVisible: {
-      get () {
-        return this.dialogVisible
-      },
-      set () {
-        this.close()
-        this.reset()
-      }
-    }
-  },
-  mounted () {
-    window.onresize = () => {
-      return (() => {
-        this.width = this.initWidth()
-      })()
-    }
-  },
-  methods: {
-    initTenant () {
-      return {
-      	frequencyId: '',
-      	dateList: [],
-        userList: []
-      }
-    },
-    initWidth () {
-      this.screenWidth = document.body.clientWidth
-      if (this.screenWidth < 991) {
-        return '90%'
-      } else if (this.screenWidth < 1400) {
-        return '45%'
-      } else {
-        return '800px'
-      }
-    },
-    setTenant (val, dicts, dateObj) {
-    	if(val){
-    		// 设置【部门人员】
-    		this.tenant.userList.push(val.userId)
-    		// 设置【部门人员-显示名称】
-    		this.userName = val.userName
-    		// 设置默认初始时间
-    		this.defTime = new Date(dateObj.year+"-"+dateObj.month)
-    	}
-      // 字典表
-      this.dicts = dicts
-    },
-    close () {
-      this.$emit('close')
-    },
-    reset () {
-      // 先清除校验,再清除表单,不然有奇怪的bug
-      this.$refs.form.clearValidate()
-      this.$refs.form.resetFields()
-      this.tenant = this.initTenant()
-    },
-    submitForm () {
-    	//console.log("Form数据:", this.tenant)
-    	//return false
-      this.$refs.form.validate((valid) => {
-        if (valid) {
-          this.confirmDisabled = true
-          if (this.type === 'add') {
-            this.save()
-          } else {
-            this.update()
-          }
-        } else {
-          return false
-        }
-      })
-    },
-    save () {
-      settingClassSchedulApi.setSchedule(this.tenant)
-        .then((response) => {
-          const res = response.data
-          if (res.isSuccess) {
-            this.isVisible = false
-            this.$message({
-              message: this.$t('tips.createSuccess'),
-              type: 'success'
-            })
-            // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
-          }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
-        })
-    },
-    update () {
-      settingClassSchedulApi.update(this.tenant)
-        .then((response) => {
-          const res = response.data
-          if (res.isSuccess) {
-            this.isVisible = false
-            this.$message({
-              message: this.$t('tips.updateSuccess'),
-              type: 'success'
-            })
-            // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
-          }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
-        })
-    },
-    // 【更换班表】-列表数据
-    applyClassList(flag, val){
-    	classesMgrApi.getListById({userId: ''}).then(res => {
-    		res = res.data
-    		console.log("【更换班表】-列表数据: ", res)
-    		if (res.isSuccess) {
-    			// 如果是【申请人-更换班表】
-		    	if(flag){
-		    		this.applyCheckbox = res.data
-		    	}else{  // 如果是【更换人-更换班表】
-		    		this.updateCheckbox =  res.data
-		    	}
-	      }
-    	})
-    },
-    // [设置班次]下拉的数据
-    getClassesList(){
-    	classesMgrApi.getList({}).then(res => {
-    		res = res.data
-    		console.log("【设置班次】-列表数据: ", res)
-    		if (res.isSuccess) {
-		    	this.classesList =  res.data
-	      }
-    	})
-    },
-    // 【部门人员】-级联数据
-    getDeptUser(){
-    	orgApi.getDeptUser({}).then(res => {
-    		res = res.data
-    		// console.log("【部门人员】-级联数据: ", res)
-    		if(res.isSuccess){
-    			this.applyList = res.data
-    		}
-    	})
-    }
-
-  }
-}
-</script>
-<style lang="scss" >
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409eff;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 100px;
-  height: 100px;
-  line-height: 100px;
-  text-align: center;
-}
-.avatar {
-  width: 100px;
-  height: 100px;
-  display: block;
-}
-.checkUsed{
-	display: inline-block;
-	margin-left: 10px;
-	color: #1890ff;
-}
-</style>
+<template>
+  <el-dialog
+  	:close-on-click-modal="false"
+  	:close-on-press-escape="false"
+  	:title="title"
+  	:append-to-body="true"
+  	:visible.sync="isVisible"
+  	width="500px"
+  	top="50px"
+  >
+    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
+    	<el-form-item :label='$t("calssSchedule.form.deptUsers")+":"' prop="userList">
+          <el-input v-model="userName" :placeholder='$t("common.pleaseEnter")' :disabled="true"></el-input>
+      </el-form-item>
+      <el-form-item :label='$t("calssSchedule.form.setDate")+":"' prop="dateList">
+      	<el-date-picker :picker-options="pickerOptions" v-model="tenant.dateList" :default-value="defTime" type="dates" value-format="yyyy-MM-dd" :placeholder='$t("common.pleaseSelect")' style="width: 100%;"></el-date-picker>
+      </el-form-item>
+      <el-form-item :label='$t("calssSchedule.form.setClass")+":"' prop="frequencyId">
+      	<template>
+				  <el-select v-model="tenant.frequencyId" :placeholder='$t("common.pleaseSelect")' style="width: 100%;">
+				    <el-option
+				      v-for="item in classesList"
+				      :key="item.id"
+				      :label="item.name.data"
+				      :value="item.id">
+				    </el-option>
+				  </el-select>
+				</template>
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
+      <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('common.confirm') }}</el-button>
+    </div>
+  </el-dialog>
+</template>
+<script>
+	// 【设置班表】-API
+	import settingClassSchedulApi from "@/api/classScheduleMgr/settingClassSchedul"
+	// 【班次管理】-API
+	import classesMgrApi from "@/api/classScheduleMgr/classesMgr"
+	// 【部门组织】-API
+	import orgApi from "@/api/Org"
+
+export default {
+  name: 'TenantEdit',
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      pickerOptions: {
+        disabledDate: (time) => {
+          // return time.getTime() < Date.now() - 86400000;
+          return time.getTime() < new Date(this.tenant.monthBeginDay).getTime() || time.getTime() > new Date(this.tenant.monthLastDay).getTime()
+        },
+      },
+      type: 'add',
+      userName: '',
+      defTime: null,
+      tenant: this.initTenant(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      confirmDisabled: false,
+      classesList: [], // 班次设置,下拉数据
+      applyList: [],
+      applyCheckbox: [],  // 【更换班表-申请人】
+      updateCheckbox: [],  // 【更换班表-更换人】
+      dicts:{
+        NATION: {}
+      },
+      roles: [],
+      rules: {
+      	userList: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        date: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        frequencyId: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ]
+      }
+    }
+  },
+  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+  created() {
+  	// [部门人员]的获取
+  	// this.applyList = this.$constWKS.CASCADERLIST
+  	this.getDeptUser()
+  	// [设置班次]的获取
+  	this.getClassesList()
+	},
+  computed: {
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+  },
+  methods: {
+    initTenant () {
+      return {
+      	frequencyId: '',
+      	dateList: [],
+        userList: [],
+        monthBeginDay: '',
+        monthLastDay: '',
+      }
+    },
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+    setTenant (val, dicts, dateObj) {
+    	if(val){
+    		// 设置【部门人员】
+    		this.tenant.userList.push(val.userId)
+    		// 设置【部门人员-显示名称】
+    		this.userName = val.userName
+    		// 设置默认初始时间
+    		this.defTime = new Date(dateObj.year+"-"+dateObj.month)
+
+        let monthBeginDay = "";
+        let now = new Date(); //当前日期
+        let nowDay = now.getDate(); //当前日
+        let nowMonth = now.getMonth() + 1; //当前月
+        if(nowMonth == Number(dateObj.month)){
+          monthBeginDay = dateObj.year + "-" + dateObj.month + "-" + nowDay;
+        }else{
+          monthBeginDay = dateObj.year + "-" + dateObj.month + "-" + "01 00:00:00";
+        }
+        let monthLastDay = dateObj.year + "-" + dateObj.month + "-" + this.getMonthDays(Number(dateObj.year),Number(dateObj.month));
+        console.log(monthBeginDay);
+        console.log(monthLastDay);
+        this.tenant.monthBeginDay = monthBeginDay;
+        this.tenant.monthLastDay = monthLastDay;
+
+    	}
+      // 字典表
+      this.dicts = dicts
+    },
+    close () {
+      this.$emit('close')
+    },
+    reset () {
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      this.$refs.form.clearValidate()
+      this.$refs.form.resetFields()
+      this.tenant = this.initTenant()
+    },
+    submitForm () {
+    	//console.log("Form数据:", this.tenant)
+    	//return false
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.confirmDisabled = true
+          if (this.type === 'add') {
+            this.save()
+          } else {
+            this.update()
+          }
+        } else {
+          return false
+        }
+      })
+    },
+    save () {
+      settingClassSchedulApi.setSchedule(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.createSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        })
+    },
+    update () {
+      settingClassSchedulApi.update(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.updateSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        })
+    },
+    // 【更换班表】-列表数据
+    applyClassList(flag, val){
+    	classesMgrApi.getListById({userId: ''}).then(res => {
+    		res = res.data
+    		console.log("【更换班表】-列表数据: ", res)
+    		if (res.isSuccess) {
+    			// 如果是【申请人-更换班表】
+		    	if(flag){
+		    		this.applyCheckbox = res.data
+		    	}else{  // 如果是【更换人-更换班表】
+		    		this.updateCheckbox =  res.data
+		    	}
+	      }
+    	})
+    },
+    // [设置班次]下拉的数据
+    getClassesList(){
+    	classesMgrApi.getList({}).then(res => {
+    		res = res.data
+    		console.log("【设置班次】-列表数据: ", res)
+    		if (res.isSuccess) {
+		    	this.classesList =  res.data
+	      }
+    	})
+    },
+    // 【部门人员】-级联数据
+    getDeptUser(){
+    	orgApi.getDeptUser({}).then(res => {
+    		res = res.data
+    		// console.log("【部门人员】-级联数据: ", res)
+    		if(res.isSuccess){
+    			this.applyList = res.data
+    		}
+    	})
+    },
+    getMonthDays(nowYear,myMonth){
+      let monthStartDate = new Date(nowYear, myMonth, 1);
+      let monthEndDate = new Date(nowYear, myMonth + 1, 1);
+      let days = (monthEndDate - monthStartDate)/(1000 * 60 * 60 * 24);
+      return days;
+    },
+
+  }
+}
+</script>
+<style lang="scss" >
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 100px;
+  height: 100px;
+  line-height: 100px;
+  text-align: center;
+}
+.avatar {
+  width: 100px;
+  height: 100px;
+  display: block;
+}
+.checkUsed{
+	display: inline-block;
+	margin-left: 10px;
+	color: #1890ff;
+}
+</style>