From 801770456ae3750a44e0989b0025a98ccbad24e6 Mon Sep 17 00:00:00 2001
From: bob <bob.zhang@highdatas.com>
Date: 星期四, 13 八月 2020 17:13:53 +0800
Subject: [PATCH] 最新

---
 src/views/Home.vue |  339 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 323 insertions(+), 16 deletions(-)

diff --git a/src/views/Home.vue b/src/views/Home.vue
index be171ab..d566a4f 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -5,7 +5,7 @@
 				<div style="width: 100%;height: 60px;"></div>
 				<el-menu
 				    class="el-menu-vertical-demo"
-				    :unique-opened="false"
+				    :unique-opened="true"
 						:default-active="defaultActive"
 				    @select ="menuSelect"
 				    @open ="menuSelect"
@@ -42,15 +42,86 @@
 		  <el-container>
 		    <el-header style="text-align: right; font-size: 15px;padding-right: 40px;">
 					<i class="el-icon-user-solid"></i>
-					<span>admin</span>
+					<span>{{userName}}</span>
+					<el-badge :hidden="badge_drawer == 0" :max="99" :value="badge_drawer" class="item_badge" style="line-height: 32px;">
+						<el-button v-if="drawer_" size="small" type="primary" @click="showDrawer_table">閫� 鐭�</el-button>
+					</el-badge>
+					<el-button size="small" type="primary" @click="upPassword">淇敼瀵嗙爜</el-button>
 					<el-button size="small" type="primary" @click="Cancel">閫� 鍑�</el-button>
 		    </el-header>
 		    
 		    <el-main style="background-color: #f7f8f9;">
-					<router-view name="home"></router-view>
+					<el-drawer
+					  :visible.sync="drawer_table"
+					  direction="rtl"
+					  size="500px">
+					   <el-table 
+						 v-loading="loading_table3"
+						 :data="gridData"
+						 :header-cell-style="{'width': '100%', 'text-align': 'center', 'background-color': 'rgb(247, 248, 249)'}"
+						 >
+					      <el-table-column property="code" label="椤圭洰鍙�" width="150" align="center" show-overflow-tooltip :formatter="code_"></el-table-column>
+					      <el-table-column property="name" label="椤圭洰鍚嶇О" width="200" show-overflow-tooltip :formatter="name_"></el-table-column>
+								<el-table-column prop="orderNo" label="鏈熸" align="center"></el-table-column>
+								<el-table-column prop="isOverdue" label="鏄惁閫炬湡" align="center" :formatter="isOverdue_"></el-table-column>
+								<el-table-column prop="billTime" label="寮�绁ㄦ棩鏈�" width="180" align="center">
+									<template v-slot="{row}">
+										<div>
+											<el-date-picker style="width: 160px;" size="mini" v-model="row.billTime" type="date" placeholder="閫夋嫨鏃ユ湡" @change="moneyChange(row)">
+											</el-date-picker>
+										</div>
+									</template>
+								</el-table-column>
+								<el-table-column prop="money" label="寮�绁ㄩ噾棰�" width="160" align="center">
+									<template v-slot="{row}">
+										<div>
+											<el-input-number size="mini" v-model="row.money" @change="moneyChange(row)"></el-input-number>
+										</div>
+									</template>
+								</el-table-column>
+								<el-table-column prop="gatherTime" label="鏀舵鏃ユ湡" width="180" align="center">
+									<template v-slot="{row}">
+										<div>
+											<el-date-picker style="width: 160px;" size="mini" v-model="row.gatherTime" type="date" placeholder="閫夋嫨鏃ユ湡" @change="moneyChange(row)">
+											</el-date-picker>
+										</div>
+									</template>
+								</el-table-column>
+								
+								<el-table-column fixed="right" label="纭鏀舵" width="140" align="center">
+								  <template v-slot="{row}">
+								    <el-row>
+								      <el-button type="primary" size="mini" @click="confirmPhase(row)">纭鏀舵</el-button>
+								    </el-row>
+								  </template>
+								</el-table-column>
+					    </el-table>
+					</el-drawer>
+					
+					<router-view @refreshDrawer="getbadge_drawer" name="home"></router-view>
 		    </el-main>
 		  </el-container>
 		</el-container>
+		
+		<el-dialog custom-class="z_master_dialog" v-if="dialog_2_2" title="鏂板鍏艰亴鎴愬憳" :visible.sync="dialog_2_2" width="400px">
+		  <el-form ref="ruleForm" label-position="left" :model="ruleForm" status-icon :rules="rules" label-width="90px" class="demo-ruleForm">
+				<el-form-item label="鍘熷瘑鐮�" prop="pass_obj">
+				  <el-input type="password" size="small" v-model="ruleForm.pass_obj"></el-input>
+				</el-form-item>
+				<el-form-item label="鏂板瘑鐮�" prop="pass">
+		      <el-input type="password" size="small" v-model="ruleForm.pass" autocomplete="off"></el-input>
+		    </el-form-item>
+		    <el-form-item label="纭瀵嗙爜" prop="checkPass">
+		      <el-input type="password" size="small" v-model="ruleForm.checkPass" autocomplete="off"></el-input>
+		    </el-form-item>
+		  </el-form>
+			
+			<div slot="footer" class="dialog-footer" style="text-align: right;">
+		    <el-button type="" size="small" @click="dialog_2_2 = false">鍙� 娑�</el-button>
+		    <el-button type="primary" size="small" @click="savePassword">淇濆瓨骞堕噸鏂扮櫥褰�</el-button>
+		  </div>
+		</el-dialog>
+		
 	</div>
 </template>
 
@@ -61,55 +132,144 @@
 	  navigationItem
 	},
   data() {
-
+		var validatePass = (rule, value, callback) => {
+			if (value === '' || !(/^[A-Za-z0-9]{6,10}$/).test(value) || value.length<6 || value.length>10) {
+				callback(new Error('璇疯緭鍏ュ瘑鐮侊紝鐢卞瓧姣嶅拰鏁板瓧缁勬垚涓旈暱搴﹀湪6~10涔嬮棿'));
+			} else {
+				if (this.ruleForm.checkPass !== '') {
+					this.$refs.ruleForm.validateField('checkPass');
+				}
+				callback();
+			}
+		};
+		var validatePass2 = (rule, value, callback) => {
+			if (value === '') {
+				callback(new Error('璇峰啀娆¤緭鍏ュ瘑鐮�'));
+			} else if (value !== this.ruleForm.pass) {
+				callback(new Error('涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!'));
+			} else {
+				callback();
+			}
+		};
 		return {
 			breadcrumbItems:[],
 			defaultActive: "",
 			navList:[],
+			
+			dialog_2_2: false,
+			ruleForm: {},
+			badge_drawer: 0,
+			drawer_:false,
+			drawer_table: false,
+			loading_table3: false,
+			gridData: [],
+			timer: null,
+			rules: {
+				pass_obj: [
+					{required: true, message: '璇疯緭鍏ュ師瀵嗙爜', trigger: ['blur', 'change']}
+				],
+				pass: [
+					{required: true, validator: validatePass, trigger: ['blur', 'change']}
+				],
+				checkPass: [
+					{required: true, validator: validatePass2, trigger: ['blur', 'change']}
+				]
+			},
 		}
   },
 	created() {
-		let userId_ = localStorage.getItem('userId');
-		let departId = localStorage.getItem('departId');
+		//let userId_ = localStorage.getItem('userId');
+		let userId_ = this.$cookies.get('userId');
+		this.userName = this.$cookies.get('userName');
+		let departId = this.$cookies.get('departId');
+		//this.userName = localStorage.getItem('userName');
+		//let departId = localStorage.getItem('departId');
 		if (!userId_ || !departId) {
-			this.$router.push('/login');
+			this.$router.push('/login').catch(err => {err});
 		}
 		else {
 			this.defaultActive = "mine";
-			this.$router.push('/mine');
+			this.$router.push('/mine').catch(err => {err});
 			let type;
-			if(departId == "100" || departId == "500") {
+			
+			if(departId) {
 				type = departId;
+				this.$cookies.set('assign', false);
+				// localStorage.setItem('assign', false);
 			}else {
 				type = "all";
+				this.$cookies.set('assign', false);
+				//localStorage.setItem('assign', true);
 			}
 			
 			this.getMenu(type);
 		}
+		
+		if (departId == "300") {
+			this.drawer_ = true;
+			this.getbadge_drawer();
+			
+			this.timer = setInterval(()=>{
+				this.getbadge_drawer()
+			},1000 * 60 * 5);
+		}
+	},
+	
+	beforeDestroy() {//鍦╒ue瀹炰緥鐨勭敓鍛藉懆鏈熺粨鏉熷墠鎵ц
+	  clearInterval(this.timer);
 	},
 	
   methods: {
-		getMenu(type) {
+		getMenu(userType) {
 			let DayDatas = {
 				 all: [
 					{'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈�
 					{'id': "111", 'title': "椤圭洰绠$悊", 'path': "0_111"}, //杩斿洖鐨勬暟缁勫瓧娈�
 					{'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"},
-					{'id': "111_1", 'title': "淇℃伅骞垮満", 'path': 'project2', 'parentId': "111"}, //
-					{'id': "111_2", 'title': "椤圭洰鎬昏", 'path': 'Overview', 'parentId': "111"}, //
-					{'id': "111_3", 'title': "椤圭洰鍒嗘瀽", 'path': 'project3', 'parentId': "111"}, //
-					{'id': "111_4", 'title': "褰掓。鎶ュ憡", 'path': 'project4', 'parentId': "111"}, //
+					{'id': "113", 'title': "璐㈠姟绠$悊", 'path': "0_113"},
+					{'id': "111_1", 'title': "淇℃伅骞垮満", 'path': 'square', 'parentId': "111"}, //
+					{'id': "111_2", 'title': "椤圭洰鎬昏", 'path': 'list', 'parentId': "111"}, //
+					{'id': "111_3", 'title': "椤圭洰鍒嗘瀽", 'path': 'Overview', 'parentId': "111"}, //
+					// {'id': "111_4", 'title': "褰掓。鎶ュ憡", 'path': 'project4', 'parentId': "111"}, //
 					{'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, //
+					{'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, //
+					
+					{'id': "113_1", 'title': "瀹為檯鏀粯璐圭敤", 'path': 'actualPayment', 'parentId': "113"}, //
+					{'id': "113_2", 'title': "鍚堝悓瀹屾垚缁熻", 'path': 'completeStatistics', 'parentId': "113"}, //
+					{'id': "113_3", 'title': "鍏艰亴鏀粯纭", 'path': 'partTimeExpenses', 'parentId': "113"}, //
+				//	{'id': "113_4", 'title': "鎴愭湰鏍哥畻", 'path': 'costAccounting', 'parentId': "113"}, //
+					{'id': "113_5", 'title': "宸插洖娆剧粺璁�", 'path': 'collectionStatistics', 'parentId': "113"}, //
 				],
 				100: [
 						{'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈�
+						{'id': "111", 'title': "椤圭洰绠$悊", 'path': "0_111"}, //杩斿洖鐨勬暟缁勫瓧娈�
 						{'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"},
+						{'id': "111_1", 'title': "淇℃伅骞垮満", 'path': 'square', 'parentId': "111"}, //
+						
+						//{'id': "111_2", 'title': "椤圭洰鎬昏", 'path': 'list', 'parentId': "111"}, //
+						//{'id': "111_3", 'title': "椤圭洰鍒嗘瀽", 'path': 'Overview', 'parentId': "111"}, //
+						
 						{'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, //
+						{'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, //
 					],
+				300:[
+					{'id': "113", 'title': "璐㈠姟绠$悊", 'path': "0_113"},
+					{'id': "113_1", 'title': "瀹為檯鏀粯璐圭敤", 'path': 'actualPayment', 'parentId': "113"}, //
+						{'id': "113_2", 'title': "鍚堝悓瀹屾垚缁熻", 'path': 'completeStatistics', 'parentId': "113"}, //
+						{'id': "113_3", 'title': "鍏艰亴鏀粯纭", 'path': 'partTimeExpenses', 'parentId': "113"}, //
+						{'id': "113_5", 'title': "宸插洖娆剧粺璁�", 'path': 'collectionStatistics', 'parentId': "113"}, //
+				],
+				400: [
+					{'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈�
+					{'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"},
+					{'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, //
+					{'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, //
+				],
 				500: [
 					{'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈�
 					{'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"},
 					{'id': "112_1", 'title': "浠诲姟鍒楄〃", 'path': 'calendarTask', 'parentId': "112"}, //
+					{'id': "112_2", 'title': "浠诲姟鎬昏", 'path': 'taskOverview', 'parentId': "112"}, //
 				],
 			};
 			
@@ -148,14 +308,154 @@
 			this.navList = result;
 		},
 		
+		upPassword() {
+			this.ruleForm = {};
+			this.dialog_2_2 = true;
+		},
+		
+		savePassword() {
+			let me = this;
+			let is_null1 = true;
+			this.$refs.ruleForm.validate((valid) => {
+				if (!valid) {
+					is_null1 = false;
+				}
+			});
+			
+			if (is_null1) {
+				let url_ = "/api/user/changePass/" + this.$cookies.get('userId');
+				let params_ = {
+					prePass: this.ruleForm.pass_obj,
+					newPass: this.ruleForm.checkPass,
+				};
+				this.$axios.get(url_,{
+				  params: params_
+				}).then(data_ => {
+					window.console.log(data_);
+					if (data_.data.status == "1009") {
+						me.$message.error("淇濆瓨澶辫触锛�" + data_.data.message);
+					}
+					else {
+						me.$router.push('/login').catch(err => {err});
+					}
+					//me.$cookies.set('userId', null);
+				}).catch(error =>{
+					
+				})
+			}
+		},
+		
 		Cancel() {
-			this.$router.push('/login');
+			//localStorage.setItem('userId', null);
+			this.$cookies.set('userId', null);
+			this.$router.push('/login').catch(err => {err});
 		},
 		menuSelect(index, a){
 		 let isPage = index.substring(0,2);
 		 if (isPage != "0_") {
-			this.$router.push('/'+ index);
+			this.$router.push('/'+ index).catch(err => {err});
 		 }
+		},
+		
+		getbadge_drawer() {
+			let me = this;
+			let url = "/api/scheme/bill/notice/count";
+			me.badge_drawer = 0;
+			this.getUrl(url, null, function(data_) {
+				if (data_.data.data) {
+					me.badge_drawer = data_.data.data;
+				}
+			})
+		},
+		
+		showDrawer_table() {
+			this.drawer_table = true;
+			this.getGridData();
+		},
+		
+		getGridData() {
+			let me = this;
+			let url = "/api/scheme/bill/notice";
+			me.loading_table3 = true;
+			me.gridData = [];
+			this.getUrl(url, null, function(data_) {
+				me.loading_table3 = false;
+				if (data_.data.data) {
+					me.gridData = data_.data.data;
+				}
+				else {
+					me.gridData = [];
+				}
+			})
+		},
+		
+		confirmPhase(row) {
+			let me = this;
+			let url = "/api/scheme/bill/check/" + row.id;
+			
+			let params = {
+				checkUser: this.$cookies.get('userId'),
+				money: row.money
+			}
+			this.getUrl(url, params, function(data_) {
+				me.getGridData();
+			})
+		},
+		
+		moneyChange(row) {
+			let me = this;
+			let url = "/api/scheme/bill/addOrUpdate";
+			
+			let params = {...row};
+			params.parentId = me.tableData2[0].id;
+			this.postUrl(url, params, function(data_) {
+			})
+		},
+		code_(row, colum, val ,index){
+			return row.scheme.code;
+		},
+		
+		name_(row, colum, val ,index){
+			return row.scheme.name;
+		},
+		
+		isOverdue_(row, colum, val ,index){
+			let gatherTime_ = row.gatherTime;
+			
+			if (new Date() > new Date(gatherTime_)) {
+				return "鏄�";
+			}
+			else{
+				return "鍚�";
+			}
+		},
+		
+		getUrl(url, params, callback){
+		  let me = this;
+		  this.$axios.get(url,{
+		    params: params
+		  }).then(data_ => {
+		    //console.log(data_);
+		    if (callback) {
+		      callback(data_);
+		    }
+		  })
+		  .catch(error =>{
+		    //console.log(error);
+		  })
+		},
+		postUrl(url, params, callback){
+		  let me = this;
+		  this.$axios.post(url,params)
+		  .then(data_ => {
+		    //console.log(data_);
+		    if (callback) {
+		      callback(data_);
+		    }
+		  })
+		  .catch(error =>{
+		    //console.log(error);
+		  })
 		},
 		
 	  /* handleSelect(key, keyPath){
@@ -188,4 +488,11 @@
   .el-aside {
     color: #333;
   }
+	
+	.class_form_z1 .el-form-item{
+		margin-bottom: 5px
+	}
+	.z_master_dialog .el-dialog__body{
+		padding-top: 0px;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0