From d0be57c51de4ed3bf6e8d9a68242f24a5716e65d Mon Sep 17 00:00:00 2001
From: zhangyanpeng <bob.zhang@highdatas.com>
Date: 星期三, 06 五月 2020 19:34:51 +0800
Subject: [PATCH] 添加修改密码功能

---
 src/views/calendarTask.vue |  363 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 358 insertions(+), 5 deletions(-)

diff --git a/src/views/calendarTask.vue b/src/views/calendarTask.vue
index e17c74a..918f00f 100644
--- a/src/views/calendarTask.vue
+++ b/src/views/calendarTask.vue
@@ -1,12 +1,365 @@
 <template>
-	<div>鏃ュ巻浠诲姟鍒楄〃</div>
+	<div class="calendar_div" ref="calendar_div">
+		<div style="float: left; width: 75%;" class="z_calendar_table">
+			<ele-calendar
+				:render-content="renderContent"
+				:data="datedef"
+				:prop="prop"
+				@pick="datePick"
+				@date-change="dateChange"
+			></ele-calendar>
+		</div>
+		
+		<div class="z_right" >
+			<div v-for="(task_itm, k) in DayDataTree" :key="k" class="right_row">
+				<h3>{{task_itm.name}}</h3>
+				<span>{{task_itm.desp}}</span>
+				<div v-for="(type_itm, k_) in task_itm.children" :key="k_" class="right_row_">
+					<span>{{k_+1}}銆亄{type_itm.typeStr}}</span>
+					<el-button size="mini" type="primary" v-if="userId === task_itm.userId" style="float: right; margin-top: 10px;" @click="handleTask(type_itm.id, type_itm.mustAttach, type_itm)">澶勭悊浠诲姟</el-button>
+				</div>
+			</div>
+		</div>
+		
+		<el-dialog width="40%" top="10%" :visible.sync="dialog_1" v-if="dialog_1">
+			<div slot="title" class="dialog-title" style="text-align: left;">
+			  <span> 浠诲姟澶勭悊 </span>
+			</div>
+				<!-- 涓婁紶鏂囦欢-->
+			<div v-if="handleTaskType.mustAttach" style="height: 150px;">
+				<el-upload
+					class="upload-demo"
+					:action="upload_url"
+					:data="upData"
+					:limit="1"
+					:file-list="fileList"
+					:auto-upload='false'
+					ref="upload"
+					:on-success="upSuccess"
+					:on-error="upError"
+					>
+					<el-button size="medium" type="text">閫夋嫨鏂囦欢</el-button>
+					<div slot="tip" class="el-upload__tip">鏂囦欢涓嶈秴杩�50M</div>
+				</el-upload>
+			</div>
+			<div style="text-align: left;">
+				<span>鎻忚堪</span>
+				<el-input
+					type="textarea"
+					:rows="2"
+					placeholder="璇疯緭鍏ュ唴瀹�"
+					@change="setDesc"
+					v-model="desc_task">
+				</el-input>
+			</div>
+			
+			<!-- 澶勭悊瀹屾垚 -->
+			<div slot="footer" class="dialog-footer">
+			<!-- 	<el-button v-if="handleTaskType.mustAttach" @click="submitUpload">鐐瑰嚮涓婁紶</el-button> -->
+				<el-button @click="Cancel">鍙� 娑�</el-button>
+				<el-button type="primary" @click="doHandleTask">澶勭悊瀹屾垚</el-button>
+			</div>
+		</el-dialog>
+		
+	</div>
 </template>
 
 <script>
-	export default {
-	  
-	};
-</script>
+	import eleCalendar from "ele-calendar";
+	import 'ele-calendar/dist/vue-calendar.css';
+    export default {
+        components: {
+					eleCalendar
+        },
+        data(){
+        	return{
+						isZ: true,
+						me_date: null,
+        		datedef:[
+							{'date': "2020-01-01", 'task': 3},
+							{'date': "2020-01-11", 'task': 2},
+						],
+						prop:'date' ,//瀵瑰簲鏃ユ湡瀛楁鍚�
+						DayDataTree: [],
+						userId:undefined,
+						dialog_1: false,
+						handleTaskType: {},
+						upload_url: "",
+						desc_task: "",
+						upData: {},
+						fileList: [],
+        	}
+        },
+				
+				mounted() {
+					let header_height = this.$refs.calendar_div.getElementsByClassName('z_calendar_table')[0].offsetHeight;
+					this.$refs.calendar_div.getElementsByClassName('z_right')[0].style['height'] = header_height + "px";
+					
+					//鑾峰彇褰撴湀鏁版嵁
+					let nowDate = new Date();
+					this.me_date = nowDate;
+					var imoment = this.$moment(nowDate);
+					let iformat = imoment.format('YYYY-MM');
+					let systemDate = iformat + '-01 00:00:00';
+					this.getDatedef(systemDate);
+					this.userId = localStorage.getItem('userId');
+				},
+				
+        methods: {
+          renderContent(h, parmas) {
+						let defdate= parmas.defdate;
+						//鎶婃椂闂磋浆鎴愭椂闂存埑
+						var imoment = this.$moment(defdate);
+						//鎶婃椂闂磋繘琛屾牸寮忓寲
+						let geshi = imoment.format('YYYY-MM-DD');
+						//鎷垮埌鏃堕棿鎵�瀵瑰簲鐨勬槦鏈�
+						let week = imoment.day();
+						const loop = data =>{
+							return (
+								data.defvalue.value ? (<div class='z_calendar_s'><div>{data.defvalue.text}</div> 
+								<span class='class_task'>{data.defvalue.value.task}涓换鍔�</span>
+								</div>) : <div>{data.defvalue.text}</div>);
+						};
+						return (
+							<div class="z_calendar_call" style="height: 10vh; min-height: 60px; border-right: 1px solid #ebeef5; border-bottom: 1px solid #ebeef5;">
+								<div style="height: 100%;" >
+								 {loop(parmas)}
+								</div>
+							</div>
+						);
+          },
+					
+					handleTask(id, mustAttach, type_itm) {
+						this.upload_url = "/api/api/file/fileUpload/" + id;
+						this.handleTaskType = type_itm;
+						this.dialog_1 = true;
+					},
+					
+					setDesc(val) {
+						this.upData = {//璁剧疆瑕佷紶鐨勫弬鏁�
+							desp: val
+						};
+					},
+					
+					doHandleTask() {
+						//姝d鐨勬槑缁嗕换鍔″畬鎴�
+						let id = this.handleTaskType.id;
+						if (!this.desc_task) {
+							this.$message('璇峰~鍐欐弿杩�');
+							return
+						}
+						
+						if(this.handleTaskType.mustAttach) {
+							this.$refs.upload.submit();//寮�濮嬩笂浼�
+						}
+						else {
+							var me = this;
+							let params = this.upData
+							let url = "/api/detail/deal/" + id;
+							this.$axios.get(url, {
+								params	
+								})
+								.then(data_ => {
+								//	console.log(data_);
+									if(data_.data.success) {
+										this.$message('澶勭悊鎴愬姛');
+										me.Cancel();
+									}else {
+										this.$message({message:'澶勭悊浠诲姟澶辫触', type: 'warning'});
+									}
+								}).catch(error => {
+								//	console.log(error);
+								});
+						}
+						
+						
+						
+						/* if (this.dialog_1) {
+							this.Cancel();
+						} */
+					},
+					
+				submitUpload() {
+					this.handleTaskType; //瑕佸鐞嗙殑鏄庣粏鏁版嵁
+					
+					this.upData = {//璁剧疆瑕佷紶鐨勫弬鏁�
+						
+					},
+					this.upload_url; //璁剧疆涓婁紶鎺ュ彛
+					 this.$refs.upload.submit();//寮�濮嬩笂浼�
+				 },
+				 
+				 upSuccess(response, file, fileList) {
+					 this.$message('涓婁紶鎴愬姛');
+					 this.Cancel();
+				 },
+				 
+				 upError(err, file, fileList) {
+					 this.$message('涓婁紶澶辫触');
+				 },
+					
+					Cancel() {
+						this.isZ = false;
+						this.isZ = true;
+						this.dialog_1 = false;
+						
+					//	let header_height = this.$refs.calendar_div.getElementsByClassName('z_calendar_table')[0].offsetHeight;
+					//	this.$refs.calendar_div.getElementsByClassName('z_right')[0].style['height'] = header_height + "px";
+						this.DayDataTree = [];
+						var imoment = this.$moment(this.me_date);
+						let iformat = imoment.format('YYYY-MM');
+						let systemDate = iformat + '-01 00:00:00';
+						this.getDatedef(systemDate);
+					},
+					
+					dateChange(date_) {
+						this.me_date = date_;
+						var imoment = this.$moment(date_);
+						let iformat = imoment.format('YYYY-MM');
+						let systemDate = iformat + '-01 00:00:00';
+						this.getDatedef(systemDate);
+					},
+					
+					datePick(date, event, row, dome) {
+						 var imoment = this.$moment(date);
+						 // 鏍煎紡鍖栨垚锛屽勾鏈堟棩
+						 let iformat = imoment.format('YYYY-MM-DD');
+						 // 鏍煎紡鍖栵紝鎷垮埌鏃�
+						 let idate = imoment.date();
+						 // 鎷垮埌鏄熸湡
+						 let week = imoment.day();
+						 this.getDayData(iformat);
+					},
+					
+					getDatedef(month_) {//鑾峰彇鎸囧畾骞存湀鐨勬暟鎹�傚弬鏁版槸'2019-12-01'瀛楃涓诧紝閮芥槸1鍙枫�傚湪鏃ュ巻涓樉绀�
+						/* aa:[
+							{'date': "2020-01-01", 'task': 3}, //杩斿洖鐨勬暟缁勫瓧娈靛寘鍚繖涓や釜瀛楁
+							{'date': "2020-01-11", 'task': 2},
+						], */
+						let url = "/api/detail/getMonth";
+						let params =  {
+							startTime: this.$moment(month_).format('YYYY-MM-DD')
+						};
+						
+						this.$axios.get(url, {
+								params
+							})
+							.then(data_ => {
+							//	console.log(data_);
+								window.console.log(data_);
+								let datas= data_.data.data;
+								datas = datas.map(el => {
+									var imoment = this.$moment(el.date);
+									// 鏍煎紡鍖栨垚锛屽勾鏈堟棩
+									let iformat = imoment.format('YYYY-MM-DD');
+								    el.date = iformat;
+									return el;
+								})
+								this.datedef = datas;
+							}).catch(error => {
+						//		console.log(error);
+							});
+					},
+					
+					getDayData(date_) {//鑾峰彇鎸囧畾鏃ョ殑浠诲姟銆傚'2019-12-21'瀛楃涓层�傚湪鍙充晶鏄剧ず鐨�
+						let url = "/api/detail/getDay";
+						let params =  {
+							startTime: this.$moment(date_).format('YYYY-MM-DD')
+						};
+						
+						this.$axios.get(url, {
+								params
+							})
+							.then(data_ => {
+							//	console.log(data_);
+								window.console.log(data_);
+								// let DayDatas = [
+								// 	{'id': "111", 'name': "娴嬭瘯1椤圭洰", 'desc': "姝ら」鐩富瑕侀拡瀵规彁楂樻晥鐜囧拰閿�鍞噺"}, //杩斿洖鐨勬暟缁勫瓧娈�
+								// 	{'id': "111_1", 'name': "绔嬮鏈嶅姟", 'mustAttach': true, 'parentId': "111"}, //
+								// 	{'id': "111_2", 'name': "鏂规寮�鍙戞湇鍔�", 'mustAttach': false, 'parentId': "111"}, //
+								// ];
+								let list = data_.data.data;
+								let parId = "";
+								let obj = {};
+								let result = [];
+											
+								list.map(el => {
+								    obj[el.id] = el;
+								})
+								for(let i=0, len = list.length; i < len; i++) {
+								    let id = list[i].parentId;
+								    //璁剧疆鏄剧ず瀛楁
+								    list[i].value = list[i].id;
+								    list[i].label = list[i].name;
+											
+								    if(id == parId || !id) {
+								        if(!obj[list[i].id].children) {
+								          obj[list[i].id].children = [];
+								        }
+								        result.push(list[i]);
+								        continue;
+								    }
+								    if(obj[id].children) {
+								        obj[id].children.push(list[i]);
+								    } else {
+								        obj[id].children = [list[i]];
+								    }
+								}
+								this.DayDataTree = result;
+							}).catch(error => {
+							//	console.log(error);
+							})
+						 
+					},
+					
+				}
+		}
+</script> 
 
 <style>
+	.z_calendar_s{
+		height: 100%;
+		background-color: #40ff9e;
+	}
+	
+	.z_calendar_call :hover{
+		background-color: #9ec6f1;
+	}
+	
+	.z_right {
+		float: right; 
+		width: 24%; 
+		border: 1px solid #e4eef9; 
+		overflow: auto; 
+		border-radius: 10px; 
+		box-shadow: 0px 0px 10px 5px #D0E2E9;
+	}
+	
+	.class_task{
+		font-weight: bold;
+		font-size: 15px;
+		color: #999;
+	}
+	.calendar_div table th{
+		border-top: 1px solid #ebeef5;
+		border-right: 1px solid #ebeef5;
+		background-color: #b5d8fd;
+	} 
+	.calendar_div .el-date-table-calendar td.current[data-v-55be3324]:not(.disabled){
+		
+	}
+	.right_row {
+		padding: 5px;
+		padding-left: 10px;
+		text-align: left;
+		box-sizing: border-box;
+		border-bottom: 1px solid #999
+	}
+	.right_row_ {
+		height: 60px; 
+		line-height: 60px; 
+		text-align: left; 
+		border-bottom: 1px solid #ece5e5
+	}
+	
 </style>

--
Gitblit v1.8.0