Forráskód Böngészése

【进度】搭框架,提升开发进度

程志平 4 éve
szülő
commit
ea41f03bdc

+ 26 - 21
src/components/dev_mgr/DevMgr.vue

@@ -139,14 +139,19 @@
 			}
 		},
 		created() {
-			let params = {
-				page: this.currentPage,
-				rows: this.pageRows
+			var statue = sessionStorage.getItem('uname')
+			if (!statue || typeof(statue) == 'undefined' || statue == '' || statue == 'null') {
+				this.$router.replace('/')
+			} else {
+				let params = {
+					page: this.currentPage,
+					rows: this.pageRows
+				}
+				// 更新表格
+				this.updateTable('/HotWaters/waterlist.action', params)
+				// 取得楼栋号,填充下拉列表
+				this.getBuildsFillSelect()
 			}
-			// 更新表格
-			this.updateTable('/HotWaters/waterlist.action', params)
-			// 取得楼栋号,填充下拉列表
-			this.getBuildsFillSelect()
 		},
 		methods: {
 			/**
@@ -173,10 +178,10 @@
 						data: form
 					})
 					.then(res => {
-						this.$message.success('导入成功!')
+						this.$message.success('【设备导入成功!')
 					})
 					.catch(err => {
-						this.$message.error('导入失败1')
+						this.$message.error('【设备导入失败1')
 					})
 			},
 			/**
@@ -201,12 +206,12 @@
 								this.form_select.builds.push(tmp)
 							}
 						} else {
-							_this.$message.success('暂无数据!');
+							_this.$message.success('【楼栋号】暂无数据!');
 						}
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【楼栋号】请求异常: ' + err);
 					})
 			},
 			/**
@@ -227,12 +232,12 @@
 							_this.tableData = res.data.rows
 							_this.rows_total = res.data.total
 						} else {
-							_this.$message.success('暂无数据!');
+							_this.$message.success('【获取数据】暂无数据!');
 						}
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【获取数据】请求异常: ' + err);
 					})
 			},
 			/**
@@ -298,12 +303,12 @@
 								.data) != '{}') {
 							window.open('https://jtishfw.ncjti.edu.cn/jxch-smartmp' + res.data.downurl)
 						} else {
-							_this.$message.error('未获取到表格!');
+							_this.$message.error('【未获得】表格!');
 						}
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【导出表格】请求异常: ' + err);
 					})
 			},
 			/**
@@ -330,7 +335,7 @@
 						// console.log(res.data);
 						if (typeof(res.data.msg) != 'undefined' && res.data.msg != '' && res.data.msg == '删除成功' && JSON
 							.stringify(res.data) != '{}') {
-							_this.$message.success('数据删除成功!');
+							_this.$message.success('数据删除成功!');
 							let params = {
 								page: this.currentPage,
 								rows: this.pageRows
@@ -339,13 +344,13 @@
 							// 取得楼栋号,填充下拉列表
 							this.getBuildsFillSelect()
 						} else {
-							_this.$message.error('数据删除失败!');
+							_this.$message.error('数据删除失败!');
 						}
 						this.delDialogVisible = false
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【数据删除】请求异常: ' + err);
 					})
 			},
 			/**
@@ -378,7 +383,7 @@
 						console.log(res.data);
 						if (typeof(res.data.msg) != 'undefined' && res.data.msg != '' && res.data.msg == '修改成功' && JSON
 							.stringify(res.data) != '{}') {
-							_this.$message.success('数据修改成功!');
+							_this.$message.success('数据修改成功!');
 							let params = {
 								page: this.currentPage,
 								rows: this.pageRows
@@ -387,13 +392,13 @@
 							// 取得楼栋号,填充下拉列表
 							this.getBuildsFillSelect()
 						} else {
-							_this.$message.error('数据修改失败!');
+							_this.$message.error('数据修改失败!');
 						}
 						this.editdialogFormVisible = false
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【数据修改】请求异常: ' + err);
 					})
 			},
 			/**

+ 11 - 34
src/components/index/Index.vue

@@ -13,8 +13,8 @@
 			</el-row>
 			<el-row class="menu-row">
 				<el-col :span="24">
-					<el-menu router :default-active="$route.path" class="el-menu-vertical-demo" @open="handleOpen"
-						@close="handleClose" background-color="#1D3251" text-color="#fff" active-text-color="#fff">
+					<el-menu router :default-active="$route.path" class="el-menu-vertical-demo"
+						background-color="#1D3251" text-color="#fff" active-text-color="#fff">
 						<router-link to="devmgr">
 							<el-menu-item index="/index/devmgr">
 								<i class="el-icon-sbgl"></i>
@@ -81,44 +81,21 @@
 	export default {
 		data() {
 			return {
-				formInline: {
-					user: '',
-					options: [{
-						value: '选项1',
-						label: '黄金糕'
-					}, {
-						value: '选项2',
-						label: '双皮奶'
-					}, {
-						value: '选项3',
-						label: '蚵仔煎'
-					}, {
-						value: '选项4',
-						label: '龙须面'
-					}, {
-						value: '选项5',
-						label: '北京烤鸭'
-					}],
-					value: '代发地方'
-				}
+
 			}
 		},
 		methods: {
-			onSubmit() {
-				console.log('submit!');
-			},
-			handleOpen(key, keyPath) {
-				console.log(key, keyPath);
-			},
-			handleClose(key, keyPath) {
-				console.log(key, keyPath);
-			},
-			logout(done) {
+			logout() {
+				var _this = this
 				this.$confirm('确认退出?')
 					.then(_ => {
-						done();
+						// console.log(_);
+						sessionStorage.removeItem('uname')
+						_this.$router.replace('/')
 					})
-					.catch(_ => {});
+					.catch(_ => {
+						// console.log(_);
+					});
 			}
 		}
 	}

+ 35 - 28
src/components/login/Login.vue

@@ -45,9 +45,14 @@
 				console.log(rule, value, callback);
 				if (value === '') {
 					callback(new Error('请输入密码'));
-				} else {
-					callback();
 				}
+				setTimeout(() => {
+					if (value.length < 6) {
+						callback(new Error('密码长度不小于6位'));
+					} else {
+						callback();
+					}
+				}, 30);
 			};
 			return {
 				ruleForm: {
@@ -67,34 +72,36 @@
 			};
 		},
 		methods: {
-			onSubmit() {
-
-			},
 			submitForm(formName) {
-				let self = this;
-				this.$refs[formName].validate((valid) => {
-					this.loading = true;
-					requset.api_login(self.form)
-						.then(resp => {
-							this.loading = false;
-							if (resp.data.code == 200) {
-								let token = resp.data.data.token.access_token;
-								//存储用户名到数据库。
-								db.set("userName", resp.data.data.user.name);
-								//发送登录成功的action
-								this.loginAction(token);
-								this.$message("验证成功!");
-								this.$router.replace('/'); //跳转到首页
-							} else {
-								this.$message({
-									showClose: true,
-									message: resp.data.msg,
-									type: 'error'
-								});
-							}
+				// console.log(_this.$qs.stringify(_this.ruleForm));
+				let _this = this;
+				// _this.$refs[formName].validate((valid) => {
+				// 	_this.$axios.get('?', {
+				// 			params: _this.$qs.stringify(_this.ruleForm)
+				// 		})
+				// 		.then(res => {
+				// 			if (res.data.code == 200) {
+				// 				let token = res.data.data.token.access_token;
+				// 				//存储用户名到数据库。
+				// 				db.set("userName", res.data.data.user.name);
+				// 				//发送登录成功的action
+				// 				_this.loginAction(token);
+								sessionStorage.setItem('uname', 'admin1')
+								_this.$message.success("登陆成功!");
+								_this.$router.replace('/index'); //跳转到首页
+				// 			} else {
+				// 				_this.$message({
+				// 					showClose: true,
+				// 					message: "登陆异常:" + res.data.msg,
+				// 					type: 'error'
+				// 				});
+				// 			}
 
-						})
-				});
+				// 		})
+				// 		.catch(err => {
+				// 			_this.$message.error('捕捉异常:' + err.message)
+				// 		})
+				// });
 			}
 		}
 	}

+ 71 - 42
src/components/shangjiaduizhang/shangjiaduizhang.vue

@@ -53,7 +53,8 @@
 				</el-table>
 				<div style="margin-top: 20px" class="table-footer">
 					<div class="pages">
-						<el-pagination layout="prev, pager, next" :total="9000"></el-pagination>
+						<el-pagination :hide-on-single-page="true" layout="prev, pager, next" :total="rows_total">
+						</el-pagination>
 					</div>
 					<div class="export-table">
 						<el-button type="primary" size="small" @click="toggleSelection()">表格导出</el-button>
@@ -120,6 +121,7 @@
 				xiaofeiDialog: false,
 				// 表格数据
 				tableData: [],
+				rows_total: 0,
 				// 表格参数
 				table: {
 					currentPage: 1, // 当前所在页码
@@ -130,35 +132,49 @@
 			}
 		},
 		created() {
-			// 获取当天日期
-			var myDate = this.getNowFormatDate();
-			let params = {
-				page: this.table.currentPage,
-				rows: this.table.pageRows,
-				begin_time: myDate
-				// begin_time: '2021-08-10'
+			var statue = sessionStorage.getItem('uname')
+			if (!statue || typeof(statue) == 'undefined' || statue == '' || statue == 'null') {
+				this.$router.replace('/')
+			} else {
+				// 获取当天日期
+				var myDate = this.getNowFormatDate();
+				let params = {
+					page: this.table.currentPage,
+					rows: this.table.pageRows,
+					begin_time: myDate
+					// begin_time: '2021-08-10'
+				}
+				// 获取当日消费列表
+				this.getTodayXiaofei(params)
+				// 1. 获取年月日,并获取消费总金额
+				this.selectGetDate(myDate)
+				// 取得楼栋号,填充下拉列表
+				this.getBuildsFillSelect()
 			}
-			// 获取当日消费列表
-			this.getTodayXiaofei(params)
-			// 获取年月日消费总金额
-			this.get_year_month_amount('/HotWaters/watertotalFeel.action')
-			// 取得楼栋号,填充下拉列表
-			this.getBuildsFillSelect()
 		},
 		methods: {
-			// 日期下拉列表选择日期
+			/**
+			 * 1. 获取日期下拉列表选择的日期
+			 * 2. 拆分到对于的变量中,便于根据
+			 * @param {Object} val
+			 */
 			selectGetDate(val) {
 				console.log(val);
-				this.select_riqi.select_day = ''
-				this.select_riqi.select_month = ''
 				this.select_riqi.select_year = ''
+				this.select_riqi.select_month = ''
+				this.select_riqi.select_day = ''
 				if (val) {
 					this.select_riqi.select_year = val.split('-')[0]
-					this.select_riqi.select_month = val.split('-')[1]
+					this.select_riqi.select_month = val.split('-')[0] + '-' + val.split('-')[1]
+					this.select_riqi.select_day = val
 				} else {
-					this.filters.year = ""
-					this.filters.month = ""
+					this.select_riqi.select_year = ""
+					this.select_riqi.select_month = ""
+					this.select_riqi.select_day = ""
 				}
+
+				// 获取年月日消费总金额
+				this.get_year_month_day_amount()
 			},
 			//获取当前时间,格式YYYY-MM-DD
 			getNowFormatDate() {
@@ -189,7 +205,8 @@
 				this.$axios.get('/api/HotWaters/watergetdoms.action', params)
 					.then(res => {
 						console.log(res.data);
-						if (typeof(res.data.doms) != 'undefined' && res.data.doms != '' && JSON.stringify(res.data) !='{}') {
+						if (typeof(res.data.doms) != 'undefined' && res.data.doms != '' && JSON.stringify(res.data) !=
+							'{}') {
 							this.room_options.rooms = [{
 								value: 0,
 								label: '全部'
@@ -202,16 +219,18 @@
 								this.room_options.rooms.push(tmp)
 							}
 						} else {
-							_this.$message.success('宿舍号暂无数据!');
+							_this.$message.success('宿舍号暂无数据!');
 						}
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【宿舍号】请求异常: ' + err);
 					})
 			},
 			/**
-			 * 获取楼栋号下拉列表选择的id,并刷新表格
+			 * 1. 获取楼栋号下拉列表选择的id
+			 * 2. 刷新消费表格
+			 * 3. 获取宿舍号填充下拉列表
 			 * @param {Object} vId
 			 */
 			selectGetBuild(vId) {
@@ -226,11 +245,12 @@
 
 				// 获取宿舍号,填充宿舍号下拉列表
 				this.getRooms()
-				// 组合参数
+				// 组合参数,刷新消费表格
 				this.selectParams()
 			},
 			/**
-			 * 获取宿舍号下拉列表选择的id,并刷新表格
+			 * 1. 获取宿舍号下拉列表选择的id
+			 * 2. 刷新消费表格
 			 * @param {Object} vId
 			 */
 			selectGetroom(vId) {
@@ -243,11 +263,12 @@
 				this.room_options.room_value = obj.value
 				this.room_options.room_label = obj.label
 
-				// 组合参数
+				// 组合参数,刷新消费表格
 				this.selectParams()
 			},
 			/**
-			 * 组合参数
+			 * 1. 组合参数
+			 * 2. 刷新消费表格
 			 */
 			selectParams() {
 				var params = {}
@@ -262,11 +283,11 @@
 				if (this.select_riqi.select_day != '') {
 					params.begin_time = this.select_riqi.select_day
 				}
-				// 查询该栋的信息
+				// 刷新消费表格
 				this.getTodayXiaofei(params)
 			},
 			/**
-			 * 获取当日消费列表
+			 * 获取消费列表
 			 * @param {Object} params
 			 */
 			getTodayXiaofei(params) {
@@ -276,7 +297,8 @@
 					})
 					.then(res => {
 						// console.log(res.data);
-						if (typeof(res.data.rows) != 'undefined' && res.data.rows != '' && JSON.stringify(res.data) !='{}') {
+						if (typeof(res.data.rows) != 'undefined' && res.data.rows != '' && JSON.stringify(res.data) !=
+							'{}') {
 							this.tableData = []
 							for (var i = 0; i < res.data.rows.length; i++) {
 								let tmp = {
@@ -290,12 +312,12 @@
 								this.tableData.push(tmp)
 							}
 						} else {
-							_this.$message.success('当日消费暂无数据!');
+							_this.$message.success('当日消费暂无数据!');
 						}
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【当日消费】请求异常: ' + err);
 					})
 			},
 			/**
@@ -307,7 +329,8 @@
 				this.$axios.get('/api/HotWaters/watergetBuilds.action')
 					.then(res => {
 						// console.log(res.data);
-						if (typeof(res.data.builds) != 'undefined' && res.data.builds != '' && JSON.stringify(res.data) !='{}') {
+						if (typeof(res.data.builds) != 'undefined' && res.data.builds != '' && JSON.stringify(res
+								.data) != '{}') {
 							this.drom_options.builds = [{
 								value: 0,
 								label: '全部'
@@ -320,24 +343,30 @@
 								this.drom_options.builds.push(tmp)
 							}
 						} else {
-							_this.$message.success('楼栋号暂无数据!');
+							_this.$message.success('楼栋号暂无数据!');
 						}
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【楼栋号】请求异常: ' + err);
 					})
 			},
 			/**
 			 * 获取年月日消费总金额
-			 * @param {Object} url
+			 * @param {Object} params
 			 */
-			get_year_month_amount(url) {
+			get_year_month_day_amount() {
 				var _this = this
-				this.$axios.get('/api' + url)
+				this.$axios.get('/api/HotWaters/watertotalFeel.action', {
+						params: {
+							day: this.select_riqi.select_day,
+							month: this.select_riqi.select_month,
+							year: this.select_riqi.select_year
+						}
+					})
 					.then(res => {
 						// console.log(res.data);
-						if (typeof(res.data) != 'undefined' && res.data != '' && JSON.stringify(res.data) !='{}') {
+						if (typeof(res.data) != 'undefined' && res.data != '' && JSON.stringify(res.data) != '{}') {
 							// _this.$message.success('数据加载成功!');
 							this.xiaofei.day_balance = parseFloat(res.data.money_day).toFixed(2)
 							this.xiaofei.month_balance = parseFloat(res.data.money_month).toFixed(2)
@@ -345,12 +374,12 @@
 
 							this.today_xiaofei = parseFloat(res.data.money_day).toFixed(2)
 						} else {
-							_this.$message.success('年月消费暂无数据!');
+							_this.$message.success('/月消费暂无数据!');
 						}
 					})
 					.catch(err => {
 						// console.log(err);
-						_this.$message.error('请求异常: ' + err);
+						_this.$message.error('【年/月消费】请求异常: ' + err);
 					})
 			},
 			onSubmit() {

+ 1 - 1
src/components/yongshuifenxi/yongshuifenxi.css

@@ -249,7 +249,7 @@
 	cursor: pointer;
 }
 
-.day-btn {
+.my_active {
 	background: #298DEF;
 	color: #FFFFFF;
 }

+ 23 - 30
src/components/yongshuifenxi/yongshuifenxi.vue

@@ -31,9 +31,9 @@
 					<div class="pages">
 						<div class="tip">用水统计图</div>
 						<div class="right-tip">
-							<div class="dmy-btn day-btn">日</div>
-							<div class="dmy-btn month-btn">月</div>
-							<div class="dmy-btn year-btn">年</div>
+							<div class="dmy-btn" :class="{my_active:show_active == '日'}" @click="change_riqi('日')">日</div>
+							<div class="dmy-btn" :class="{my_active:show_active == '月'}" @click="change_riqi('月')">月</div>
+							<div class="dmy-btn" :class="{my_active:show_active == '年'}" @click="change_riqi('年')">年</div>
 						</div>
 					</div>
 					<!-- <div class="hygrometer" ref="hygrometer"></div> -->
@@ -53,11 +53,11 @@
 							<el-input v-model="formInline.user" placeholder="请输入姓名"></el-input>
 						</el-form-item>
 						<el-form-item>
-							<el-button type="primary" @click="onSubmit">查找</el-button>
+							<el-button type="primary" @click="onSearch">查找</el-button>
 						</el-form-item>
 					</el-form>
 					<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
-						@selection-change="handleSelectionChange" highlight-current-row>
+						highlight-current-row>
 						<el-table-column align="center" label="学号">
 							<template slot-scope="scope">{{ scope.row.id }}</template>
 						</el-table-column>
@@ -81,6 +81,7 @@
 	export default {
 		data() {
 			return {
+				show_active: '日',
 				charts: "",
 				opinionData: ["3", "2", "4", "4", "5"],
 				room_select_disabled: true,
@@ -238,8 +239,19 @@
 			});
 		},
 		methods: {
-			show_detail() {
-
+			change_riqi(riqi) {
+				this.show_active = riqi
+				// 获取查询年、月、日的数据的参数
+				var params = {}
+				if (riqi == '日') {
+					
+				} else if (riqi == '月') {
+					
+				} else if (riqi == '年') {
+					
+				}
+				// 查询年、月、日的数据
+				
 			},
 			drom_change() {
 				if (this.drom_value != 0) {
@@ -248,31 +260,12 @@
 					this.room_select_disabled = true
 				}
 			},
-			onSubmit() {
-				console.log('submit!');
-			},
-			handleOpen(key, keyPath) {
-				console.log(key, keyPath);
-			},
-			handleClose(key, keyPath) {
-				console.log(key, keyPath);
+			onSearch() {
+				console.log('onSearch!');
 			},
-			toggleSelection(rows) {
-				if (rows) {
-					rows.forEach(row => {
-						this.$refs.multipleTable.toggleRowSelection(row);
-					});
-				} else {
-					this.$refs.multipleTable.clearSelection();
-				}
-			},
-			show_detail(index, row) {
+			show_detail(e) {
 				this.editdialogFormVisible = true
-				console.log(index, row);
-			},
-			handleDelete(index, row) {
-				this.delDialogVisible = true
-				console.log(index, row);
+				console.log(e);
 			}
 		}
 	}

+ 2 - 2
src/main.js

@@ -7,7 +7,7 @@ import ElementUI from 'element-ui';
 import 'element-ui/lib/theme-chalk/index.css';
 import echarts from 'echarts'
 import axios from "axios"
-// import qs from "qs"
+import qs from "qs"
 
 // axios.defaults.timeout = 3000 //响应时间
 // axios.defaults.headers.post['Content-Type'] = 'multipart/form-data'; //配置请求头
@@ -18,7 +18,7 @@ console.log(process.env.NODE_ENV)
 
 Vue.use(ElementUI);
 
-// Vue.prototype.$qs = qs;
+Vue.prototype.$qs = qs;
 Vue.prototype.$axios = axios;
 Vue.prototype.$echarts = echarts
 

+ 7 - 6
src/router/index.js

@@ -12,6 +12,7 @@ import ZHGL from '@/components/zhanghaoguanli/zhanghaoguanli'
 Vue.use(Router)
 
 export default new Router({
+	mode: 'history',
 	routes: [{
 		path: '/',
 		name: 'Login',
@@ -19,29 +20,29 @@ export default new Router({
 	}, {
 		path: '/index',
 		name: 'index',
-		redirect:'/index/devmgr', // 设置默认打开的页面
+		redirect: '/index/devmgr', // 设置默认打开的页面
 		component: Index,
 		children: [{
 			path: 'devmgr',
 			name: 'DevMgr',
 			component: DevMgr
-		},{
+		}, {
 			path: 'balan',
 			name: 'Balance',
 			component: Balance
-		},{
+		}, {
 			path: 'sjdz',
 			name: 'SJDZ',
 			component: SJDZ
-		},{
+		}, {
 			path: 'ysfx',
 			name: 'YSFX',
 			component: YSFX
-		},{
+		}, {
 			path: 'flsz',
 			name: 'FLSZ',
 			component: FLSZ
-		},{
+		}, {
 			path: 'zhgl',
 			name: 'ZHGL',
 			component: ZHGL