From 84326b11401f217cd483d13bc72cec4ffd5da7ce Mon Sep 17 00:00:00 2001
From: bob <bob.zhang@highdatas.com>
Date: 星期三, 25 十一月 2020 10:02:22 +0800
Subject: [PATCH] 2020-11-13

---
 src/views/Home.vue |  510 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 456 insertions(+), 54 deletions(-)

diff --git a/src/views/Home.vue b/src/views/Home.vue
index 177f1f1..52881b2 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -1,83 +1,478 @@
 <template>
 	<div style="100%;height: 100%;margin: 0;">
-		<el-container style="height: 100%; width: 100%; border: 1px solid #eee">
-	
+		<el-container style="height: 100vh; box-sizing: border-box;">
 		  <el-aside width="200px" style="background-color: rgb(238, 241, 246); ">
-			<div style="width: 100%;height: 60px;"></div>
-		    <el-menu default-active="1"  @select="handleSelect">
-				<el-menu-item index="0">
-				  <i class="el-icon-menu"></i>
-				  <span slot="title">棣栭〉</span>
-				</el-menu-item>
+				<div style="width: 100%;height: 60px;"></div>
+				<el-menu
+				    class="el-menu-vertical-demo"
+				    :unique-opened="true"
+					:default-active="defaultActive"
+				    @select ="menuSelect"
+				    @open ="menuSelect"
+				    @close ="menuSelect"
+				    active-text-color="#409EFF"
+				    >
+				  <navigationItem v-for="menu in navList" :key="menu.path" :item="menu" />
+				</el-menu>
 				
-				
-		      <el-submenu index="1">
-				 <template slot="title">
-				           <i class="el-icon-menu"></i>
-				           <span>椤圭洰绠$悊</span>
-				         </template>
-		        <el-menu-item-group>
-		          <el-menu-item index="1-1">淇℃伅骞垮満</el-menu-item>
-		          <el-menu-item index="1-2">椤圭洰鎬昏</el-menu-item>
-		          <el-menu-item index="1-3">椤圭洰鍒嗘瀽</el-menu-item>
-		          <el-menu-item index="1-4">褰掓。鎶ュ憡</el-menu-item>
-		        </el-menu-item-group>
-		      
-		      </el-submenu>
-				<el-menu-item index="2">
-				  <i class="el-icon-menu"></i>
-				  <span slot="title">浠诲姟绠$悊</span>
-				</el-menu-item>
-					
-		      
-		    </el-menu>
+		    <!-- <el-menu default-active="1"  @select="handleSelect">
+					<el-menu-item index="0">
+						<i class="el-icon-menu"></i>
+						<span slot="title">棣栭〉</span>
+					</el-menu-item>
+						<el-submenu index="1">
+							<template slot="title">
+								<i class="el-icon-menu"></i>
+								<span>椤圭洰绠$悊</span>
+							</template>
+							<el-menu-item-group>
+								<el-menu-item index="1-1">淇℃伅骞垮満</el-menu-item>
+								<el-menu-item index="1-2">椤圭洰鎬昏</el-menu-item>
+								<el-menu-item index="1-3">椤圭洰鍒嗘瀽</el-menu-item>
+								<el-menu-item index="1-4">褰掓。鎶ュ憡</el-menu-item>
+							</el-menu-item-group>
+						</el-submenu>
+					<el-menu-item index="2">
+						<i class="el-icon-menu"></i>
+						<span slot="title">浠诲姟绠$悊</span>
+					</el-menu-item>
+		    </el-menu> -->
 		  </el-aside>
 		  
 		  <el-container>
-			
-			 
 		    <el-header style="text-align: right; font-size: 15px;padding-right: 40px;">
-				<i class="el-icon-user-solid"></i>
-				<span>admin</span>
+					<i class="el-icon-user-solid"></i>
+					<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>
-				<router-view></router-view>
+		    <el-main style="background-color: #f7f8f9;">
+					<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>
 
-
-
 <script>
-
+import navigationItem from '../components/menu/navigationItem.vue'
 export default {
+	components: {
+	  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 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').catch(err => {err});
+		}
+		else {
+			this.defaultActive = "mine";
+			this.$router.push('/mine').catch(err => {err});
+			let type;
+			
+			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: {
-	  handleSelect(key, keyPath){
-	          switch(key){
-	            case '0':
+		getMenu(userType) {
+			let DayDatas = {
+				 all: [
+					{'id': "110", 'title': "棣栭〉", 'path': "mine"}, //杩斿洖鐨勬暟缁勫瓧娈�
+					{'id': "111", 'title': "椤圭洰绠$悊", 'path': "0_111"}, //杩斿洖鐨勬暟缁勫瓧娈�
+					{'id': "112", 'title': "浠诲姟绠$悊", 'path': "0_112"},
+					{'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"}, //
+				],
+			};
+			
+			let list = [];
+			if (!userType || userType=='undefined') {
+				list = DayDatas['all'];
+			}
+			else {
+				list = DayDatas[userType];
+			}
+			
+			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].title = list[i].title;
+			    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.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() {
+			//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).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){
+			switch(key){
+				case '0':
 					this.$router.push('/mine');
 					this.breadcrumbItems = ["棣栭〉"];
-	              break;
-	            case '2':
-	              this.$router.push('/project')
-	            	this.breadcrumbItems = ["棣栭〉"];
-	              break;
-	            case '3':
-	              this.$router.push('/Page3')
-	             
-	              break;
-	          }
-	        },
+					break;
+				case '2':
+					this.$router.push('/project')
+					this.breadcrumbItems = ["棣栭〉"];
+					break;
+				case '3':
+					this.$router.push('/Page3')
+					break;
+			}
+		}, */
 
   }
 };
@@ -93,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