Browse Source

单台机器统计,定时清洗规则

李天标 5 years ago
parent
commit
391caad5dd

+ 3 - 3
App.vue

@@ -20,9 +20,9 @@
 				 this._i18n.locale = 'zh-CN'
 			 }
 			 uni.setTabBarItem({ index: 0,text: this.$t('tabs.tab1')});
-			 uni.setTabBarItem({ index: 1,text: this.$t('tabs.tab2')});
-			 uni.setTabBarItem({ index: 2,text: this.$t('tabs.tab3')});
-			 uni.setTabBarItem({ index: 3,text: this.$t('tabs.tab4')});
+			 // uni.setTabBarItem({ index: 1,text: this.$t('tabs.tab2')});
+			 // uni.setTabBarItem({ index: 2,text: this.$t('tabs.tab3')});
+			 // uni.setTabBarItem({ index: 3,text: this.$t('tabs.tab4')});
 			 uni.setTabBarItem({ index: 4,text: this.$t('tabs.tab5')});
 		},
 		// onShow: function() {

+ 5 - 5
common/lang/zh.js

@@ -55,8 +55,8 @@ export default {
 		data:'暂无数据',
 	},
 	equipmentStatusList:{
-		door:'远程开门',
-		open:'开门',
+		door:'一键清洗',
+		open:'清洗',
 		opensuccess:'开门成功',
 		title:'机器状态',
 		red:'红色代表机器报警',
@@ -67,9 +67,9 @@ export default {
 		off:'开/关机:已关机',
 		equipmentNo:'机器唯一码',
 		area:'所在地',
-		temperature :'炉头温度',
-		equipmentTemperature:'内温度',
-		humidity:'内湿度',
+		temperature :'机器温度',
+		equipmentTemperature:'内温度',
+		humidity:'内湿度',
 		alarm:'报警内容',
 		tip:'提示',
 		sleepTip:'是否休眠?',

+ 2 - 1
components/mix-tree/mix-tree.vue

@@ -1,4 +1,4 @@
-<template>
+<!-- <template>
 	<view class="content">
 		<view class="mix-tree-list">
 			<block v-for="(item, index) in treeList" :key="index">
@@ -148,3 +148,4 @@
 		opacity: 0;
 	}
 </style>
+ -->

File diff suppressed because it is too large
+ 3377 - 3377
components/u-charts/u-charts.js


File diff suppressed because it is too large
+ 1019 - 0
components/wing-time-selector/wing-time-selector.vue


+ 51 - 21
pages.json

@@ -16,31 +16,55 @@
 		{
 		    "path" : "pages/Charts/mainStatistics",
 		    "style" : {
-				"navigationBarTitleText":"统计图表"
+				"navigationBarTitleText":"首页"
 				// "disableScroll": true
 				// "enablePullDownRefresh": true
 			}
 		},
+		// {
+		//     "path" : "pages/User/merchantList",
+		//     "style" : {
+		// 		"navigationBarTitleText":"机器销售",
+		// 		// "disableScroll": true,
+		// 		"enablePullDownRefresh": true
+		// 	}
+		// },
+		// {
+		//     "path" : "pages/User/equipmentSratisticsList",
+		//     "style" : {
+		// 		"navigationBarTitleText":"机器排行",
+		// 		// "disableScroll": true,
+		// 		"enablePullDownRefresh": true
+		// 	}
+		// },
+		// {
+		//     "path" : "pages/User/equipmentStatusList",
+		//     "style" : {
+		// 		"navigationBarTitleText":"机器状态",
+		// 		// "disableScroll": true,
+		// 		"enablePullDownRefresh": true
+		// 	}
+		// },
 		{
-		    "path" : "pages/User/merchantList",
+		    "path" : "pages/Setting/Setting",
 		    "style" : {
-				"navigationBarTitleText":"机器销售",
+				"navigationBarTitleText":"机器设置",
 				// "disableScroll": true,
 				"enablePullDownRefresh": true
 			}
 		},
 		{
-		    "path" : "pages/User/equipmentSratisticsList",
+		    "path" : "pages/Setting/singleStatistics",
 		    "style" : {
-				"navigationBarTitleText":"机器排行",
+				"navigationBarTitleText":"单机统计",
 				// "disableScroll": true,
 				"enablePullDownRefresh": true
 			}
 		},
 		{
-		    "path" : "pages/User/equipmentStatusList",
+		    "path" : "pages/Setting/cleanRule",
 		    "style" : {
-				"navigationBarTitleText":"机器状态",
+				"navigationBarTitleText":"清洗规则",
 				// "disableScroll": true,
 				"enablePullDownRefresh": true
 			}
@@ -112,23 +136,29 @@
 				"selectedIconPath": "static/img/homeHL.png",
 				"text": "首页"
 			},
+			// {
+			// 	"pagePath": "pages/User/merchantList",
+			// 	"iconPath": "static/img/merchantList.png",
+			// 	"selectedIconPath": "static/img/merchantListHL.png",
+			// 	"text": "机器销售"
+			// },
+			// {
+			// 	"pagePath": "pages/Charts/equipmentStatistics",
+			// 	"iconPath": "static/img/equipmentSratisticsList.png",
+			// 	"selectedIconPath": "static/img/equipmentSratisticsListHL.png",
+			// 	"text": "机器排行"
+			// },
+			// {
+			// 	"pagePath": "pages/User/equipmentStatusList",
+			// 	"iconPath": "static/img/equipment.png",
+			// 	"selectedIconPath": "static/img/equipmentHL.png",
+			// 	"text": "机器状态"
+			// },
 			{
-				"pagePath": "pages/User/merchantList",
-				"iconPath": "static/img/merchantList.png",
-				"selectedIconPath": "static/img/merchantListHL.png",
-				"text": "机器销售"
-			},
-			{
-				"pagePath": "pages/Charts/equipmentStatistics",
-				"iconPath": "static/img/equipmentSratisticsList.png",
-				"selectedIconPath": "static/img/equipmentSratisticsListHL.png",
-				"text": "机器排行"
-			},
-			{
-				"pagePath": "pages/User/equipmentStatusList",
+				"pagePath": "pages/Setting/Setting",
 				"iconPath": "static/img/equipment.png",
 				"selectedIconPath": "static/img/equipmentHL.png",
-				"text": "机器状态"
+				"text": "机器设置"
 			},
 			{
 				"pagePath": "pages/User/user",

File diff suppressed because it is too large
+ 579 - 501
pages/Charts/mainStatistics.vue


+ 126 - 0
pages/Setting/Setting.vue

@@ -0,0 +1,126 @@
+<template>
+	<view class="">
+		<uni-collapse :show-animation="true">
+			<view class="titlelist" style="position: relative;" v-for="equipment in merchantList[0].equipmentList" :key="equipment.id">
+				<uni-collapse-item :title="getEquipmentTitle(equipment)">
+					<uni-list>
+						<uni-list-item title="使用统计" note="单台机器的使用次数统计" @click="useStatistics(equipment.id,equipment.name)" thumb="../../static/img/统计.png"></uni-list-item>
+						<uni-list-item title="清洗规则" note="设定机器每天的清洗时间段" @click="rule(equipment.id,equipment.name,equipment.rule)" thumb="../../static/img/任务.png"></uni-list-item>
+						<uni-list-item title="支付" note="按天数/次数支付" show-extra-icon="true" thumb="../../static/img/支付.png"></uni-list-item>
+						<uni-list-item title="参数调整" thumb="../../static/img/参数.png"></uni-list-item>
+					</uni-list>
+				</uni-collapse-item>
+			</view>
+		</uni-collapse>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapActions,
+		mapMutations
+	} from 'vuex'
+	import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
+	import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
+	import uniList from '@/components/uni-list/uni-list.vue'
+	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
+	import {
+		dateUtils
+	} from '@/common/util.js';
+	export default {
+		components: {
+			uniCollapse,
+			uniCollapseItem,
+			uniList,
+			uniListItem,
+		},
+		data() {
+			return {
+				globalUser: {},
+				merchantList: [{
+					equipmentList: []
+				}],
+				extraIcon: {
+					color: '#4cd964',
+					size: '22',
+					type: 'spinner'
+				},
+				statusNormal: 'status-normal',
+				statusError: 'status-error',
+				sleepChecked: null,
+				onffChecked: null,
+				time: null,
+				timeAll: {
+
+				},
+			}
+		},
+		computed: {
+			...mapState(['loginUser']),
+		},
+		onShow() {
+			this.globalUser = uni.getStorageSync("globalUser");
+			// uni.setNavigationBarTitle({
+			// 	title: this.$t('equipmentStatusList.title')
+			// });
+			// uni.setTabBarItem({
+			// 	index: 3,
+			// 	text: this.$t('tabs.tab4')
+			// });
+			var token = uni.getStorageSync("token");
+			if (token.length > 1) {
+				this.getEquipmentListData();
+			} else {
+				uni.reLaunch({
+					url: '../Login/Login',
+				});
+			}
+
+		},
+		methods: {
+			...mapActions('chart', ['getEquipmentListByUser']),
+			getEquipmentTitle(equipment) {
+				return equipment.name ? equipment.name : '暂无名称';
+			},
+			getEquipmentListData() {
+				this.getEquipmentListByUser(this.globalUser)
+					.then(data => {
+						this.merchantList = data;
+						var listName = data[0].equipmentList;
+						var listId = data[0].id;
+						if (listId != null && listId != '1') {
+							uni.setStorageSync("listName", listName);
+						}
+						uni.stopPullDownRefresh();
+					}, _ => void uni.stopPullDownRefresh());
+			},
+			useStatistics(equipmentId,equipmentName) {
+				uni.setStorageSync('nowEquipmentId', equipmentId);
+				uni.setStorageSync('nowEquipmentName', equipmentName);
+				uni.navigateTo({
+					url: 'singleStatistics',
+				});
+			},
+			rule(equipmentId,equipmentName,rule){
+				uni.setStorageSync('nowEquipmentId', equipmentId);
+				uni.setStorageSync('nowEquipmentName', equipmentName);
+				if(rule!=''){
+					uni.setStorageSync('nowEquipmentRule', rule);
+				}
+				
+				uni.navigateTo({
+					url: 'cleanRule',
+				});
+			},
+		}
+	}
+</script>
+
+<style>
+	.titlelist {
+		color: #363D44;
+		font-size: 16upx;
+		font-family: "PingFang-SC-Medium";
+	}
+</style>

+ 319 - 0
pages/Setting/cleanRule.vue

@@ -0,0 +1,319 @@
+<template>
+	<view class="content">
+		<view class="box-title">{{ title }}</view>
+		<timeSelector showType="time" @btnConfirm="btnConfirm0" @btnCancel="btnCancel0">
+			<view class="box-time">
+				<input type="text" class="input" :value="time0" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm1" @btnCancel="btnCancel1">
+			<view class="box-time">
+				<input type="text" class="input" :value="time1" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm2" @btnCancel="btnCancel2">
+			<view class="box-time">
+				<input type="text" class="input" :value="time2" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm3" @btnCancel="btnCancel3">
+			<view class="box-time">
+				<input type="text" class="input" :value="time3" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm4" @btnCancel="btnCancel4">
+			<view class="box-time">
+				<input type="text" class="input" :value="time4" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm5" @btnCancel="btnCancel5">
+			<view class="box-time">
+				<input type="text" class="input" :value="time5" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm6" @btnCancel="btnCancel6">
+			<view class="box-time">
+				<input type="text" class="input" :value="time6" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm7" @btnCancel="btnCancel7">
+			<view class="box-time">
+				<input type="text" class="input" :value="time7" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm8" @btnCancel="btnCancel8">
+			<view class="box-time">
+				<input type="text" class="input" :value="time8" />
+			</view>
+		</timeSelector>
+		<timeSelector showType="time" @btnConfirm="btnConfirm9" @btnCancel="btnCancel9">
+			<view class="box-time">
+				<input type="text" class="input" :value="time9" />
+			</view>
+		</timeSelector>
+
+		<view class="bu">
+			<button type="primary" @click="submit()" class="button">
+				<p class="p">提交</p>
+			</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapActions,
+		mapMutations
+	} from 'vuex';
+	import timeSelector from '@/components/wing-time-selector/wing-time-selector.vue';
+	export default {
+		components: {
+			timeSelector
+		},
+		data() {
+			return {
+				title: '当前定时清洗时间',
+				time0: '',
+				time1: '',
+				time2: '',
+				time3: '',
+				time4: '',
+				time5: '',
+				time6: '',
+				time7: '',
+				time8: '',
+				time9: ''
+			};
+		},
+		onLoad() {
+			var rule = uni.getStorageSync("nowEquipmentRule");
+			var rules = rule.split(",");
+			if(rules.length>0){
+				for(var i=0;i<rules.length;i++){
+					switch (i) {
+					    case 0:
+					        this.time0=rules[i];
+					        break;
+					    case 1:
+					        this.time1=rules[i];
+					         break;
+					    case 2:
+					        this.time2=rules[i];
+					         break;
+					    case 3:
+					        this.time3=rules[i];
+					         break;
+					    case 4:
+					        this.time4=rules[i];
+					         break;
+					    case 5:
+					        this.time5=rules[i];
+					         break;
+					    case 6:
+					        this.time6=rules[i];
+							break;
+						case 7:
+						    this.time7=rules[i];
+						    break;
+						case 8:
+						    this.time8=rules[i];
+						    break;
+						case 9:
+						    this.time9=rules[i];
+						    break;
+					} 
+				}
+			}
+		},
+		onShow() {
+			
+		},
+		methods: {
+			...mapActions('chart', ['updateRule']),
+			btnConfirm0(e) {
+				console.log('确定时间为:', e);
+				this.time0 = e.value;
+			},
+			btnCancel0() {
+				this.time0 = '';
+			},
+
+			btnConfirm1(e) {
+				this.time1 = e.value;
+			},
+			btnCancel1() {
+				this.time1 = '';
+			},
+
+			btnConfirm2(e) {
+				this.time2 = e.value;
+			},
+			btnCancel2() {
+				this.time2 = '';
+			},
+
+			btnConfirm3(e) {
+				this.time3 = e.value;
+			},
+			btnCancel3() {
+				this.time3 = '';
+			},
+
+			btnConfirm4(e) {
+				this.time4 = e.value;
+			},
+			btnCancel4() {
+				this.time4 = '';
+			},
+
+			btnConfirm5(e) {
+				this.time5 = e.value;
+			},
+			btnCancel5() {
+				this.time5 = '';
+			},
+
+			btnConfirm6(e) {
+				this.time6 = e.value;
+			},
+			btnCancel6() {
+				this.time6 = '';
+			},
+
+			btnConfirm7(e) {
+				this.time7 = e.value;
+			},
+			btnCancel7() {
+				this.time7 = '';
+			},
+
+			btnConfirm8(e) {
+				this.time8 = e.value;
+			},
+			btnCancel8() {
+				this.time8 = '';
+			},
+
+			btnConfirm9(e) {
+				this.time9 = e.value;
+			},
+			btnCancel9() {
+				this.time9 = '';
+			},
+			submit() {
+				var rules = [];
+				if (this.time0 != '') {
+					rules.push(this.time0);
+				}
+				if (this.time1 != '') {
+					rules.push(this.time1);
+				}
+				if (this.time2 != '') {
+					rules.push(this.time2);
+				}
+				if (this.time3 != '') {
+					rules.push(this.time3);
+				}
+				if (this.time4 != '') {
+					rules.push(this.time4);
+				}
+				if (this.time5 != '') {
+					rules.push(this.time5);
+				}
+				if (this.time6 != '') {
+					rules.push(this.time6);
+				}
+				if (this.time7 != '') {
+					rules.push(this.time7);
+				}
+				if (this.time8 != '') {
+					rules.push(this.time8);
+				}
+				if (this.time9 != '') {
+					rules.push(this.time9);
+				}
+				var rule;
+				if (rules.length > 0) {
+					rule = rules.join(",");
+				}
+
+				const param = {};
+				var equipmentId = uni.getStorageSync("nowEquipmentId");
+				if (equipmentId != '') {
+					param['equipmentId'] = equipmentId;
+				}
+				if (rule != '') {
+					param['rule'] = rule;
+				}
+				return this.updateRule(param)
+					.then(data => {
+						if (data == "SUCCESS") {
+							uni.showToast({
+								title: "修改成功",
+								icon: 'none',
+								duration: 1000
+							});
+						}
+						if (data == "ERROR") {
+							uni.showToast({
+								title: "修改失败",
+								icon: 'none',
+								duration: 1000
+							});
+						}
+						if (data == "") {
+							uni.showToast({
+								title: "修改异常",
+								icon: 'none',
+								duration: 1000
+							});
+						}
+					}, _ => void uni.stopPullDownRefresh());
+			},
+		}
+	};
+</script>
+
+<style>
+	.box-title {
+		margin: 24rpx;
+		font-size: 40rpx;
+		font-weight: bold;
+		color: #333333;
+		padding-left: 40upx;
+	}
+
+	.box-time {
+		margin: 24rpx;
+		font-size: 30rpx;
+		color: #3496fb;
+		padding-top: 10upx;
+		padding-left: 40upx;
+	}
+
+	.input {
+		/* padding: 10upx 20upx 10upx 0upx; */
+		padding-left: 20upx;
+		padding-top: 10upx;
+		background-color: #FFFFFF;
+		width: 600upx;
+		height: 50upx;
+		box-shadow: 0upx 0upx 20upx #D3D3D3;
+		border-radius: 5upx;
+	}
+
+	.bu {
+		font-size: 50upx
+	}
+
+	.button {
+		width: 220upx;
+		height: 100upx;
+	}
+
+	.p {
+		/* transform: translateY(-8upx); */
+		font-size: 50upx
+	}
+</style>

+ 452 - 0
pages/Setting/singleStatistics.vue

@@ -0,0 +1,452 @@
+<template>
+	<view>
+		<view class="head">
+			<view class="">
+				<image class="userFlagimg" src="../../static/img/userFlag.png" mode=""></image>
+			</view>
+			<view class="pname">
+				<font class="wenzi" style="color: #BDD6F3;font-size:28upx"> {{$t('mainStatistics.name')}}: {{pnameData}}</font>
+			</view>
+			<view class="company">
+				<font style="color: #BDD6F3;font-size:28upx">{{$t('mainStatistics.company')}}</font>
+			</view>
+		</view>
+		<view class="ri">
+			<view class="riShell">
+				<view class="riImg">
+					<image style="width: 64upx;height: 64upx;padding-top: 20upx;" :src="$t('mainStatistics.dayImg')"></image>
+				</view>
+				<view class="riTitle">
+					<view style="text-align:left;font-size:28upx;font-family:PingFang-SC-Medium">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.dayTotalMoney')}}:</font>
+						<font style="color: #ED341F;">{{dayRandomTimes}}</font>
+					</view>
+					<view style="text-align:left;font-size:28upx;font-family:PingFang-SC-Medium">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.dayTotalNum')}}:</font>
+						<font style="color: #ED341F;">{{dayRegularTimes}}</font>
+					</view>
+				</view>
+			</view>
+			<view class="riqi">
+				<view style="text-align:right" class="tody">
+					<font style="color: #596D83;">{{today}}</font>
+				</view>
+				<view style="text-align:right" class="xingqi">
+					<font style="color: #596D83;">{{week}}</font>
+				</view>
+			</view>
+		</view>
+		<view class="fourTitle">
+			<view class="four">
+				<view class="fourImg">
+					<image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.weekImg')" mode=""></image>
+				</view>
+				<view class="fourShell">
+					<view class="one">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.weekTotalMoney')}}:</font>
+						<font style="color: #ED341F;">{{weekRandomTimes}}</font>
+					</view>
+					<view class="two">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.weekTotalNum')}}:</font>
+						<font style="color: #ED341F;">{{weekRegularTimes}}</font>
+					</view>
+				</view>
+			</view>
+
+			<view class="four">
+				<view class="fourImg">
+					<image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.monthImg')" mode=""></image>
+				</view>
+				<view class="fourShell">
+					<view class="one">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.monthTotalMoney')}}:</font>
+						<font style="color: #ED341F;">{{monthRandomTimes}}</font>
+					</view>
+					<view class="two">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.monthTotalNum')}}:</font>
+						<font style="color: #ED341F;">{{monthRegularTimes}}</font>
+					</view>
+				</view>
+			</view>
+
+			<view class="four">
+				<view class="fourImg">
+					<image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.yearImg')" mode=""></image>
+				</view>
+				<view class="fourShell">
+					<view class="one">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.yearTotalMoney')}}:</font>
+						<font style="color: #ED341F;">{{yearRandomTimes}}</font>
+					</view>
+					<view class="two">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.yearTotalNum')}}:</font>
+						<font style="color: #ED341F;">{{yearRegularTimes}}</font>
+					</view>
+				</view>
+			</view>
+
+			<view class="four">
+				<view class="fourImg">
+					<image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.allImg')" mode=""></image>
+				</view>
+				<view class="fourShell">
+					<view class="one">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.machineTotalNum')}}:</font>
+						<font style="color: #ED341F;">{{machineTotalNum}}</font>
+					</view>
+					<view class="two">
+						<font class="fontLeft" style="color: #596D83;">{{$t('mainStatistics.machineUseNum')}}:</font>
+						<font style="color: #ED341F;">{{machineUseNum}}</font>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	import {
+		mapState,
+		mapActions,
+		mapMutations
+	} from 'vuex';
+	import uCharts from '@/components/u-charts/u-charts.js';
+	import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
+	import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
+	import uniList from '@/components/uni-list/uni-list.vue'
+	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
+	import {
+		dateUtils
+	} from '@/common/util.js';
+	var _self;
+	export default {
+		name: 'mainStatistics',
+		props: {
+			equipmentId: '',
+			adminId: '',
+			pname: '',
+		},
+		components: {
+			uniCollapse,
+			uniCollapseItem,
+			uniList,
+			uniListItem,
+		},
+		data() {
+			return {
+				machineTotalNum: 0,
+				machineUseNum: 0,
+				dayRandomTimes: 0,
+				dayRegularTimes: 0,
+				weekRandomTimes: 0,
+				weekRegularTimes: 0,
+				monthRandomTimes: 0,
+				monthRegularTimes: 0,
+				yearRandomTimes: 0,
+				yearRegularTimes: 0,
+				today: '',
+				week: '',
+				pnameData:''
+			}
+		},
+
+		computed: {
+			...mapState(['loginUser']),
+			// pnameData: {
+			// 	get() {
+			// 		return this.pname;
+			// 	}
+			// },
+		},
+		onShow() {
+			
+			var equipmentId = uni.getStorageSync("nowEquipmentId");
+			if(equipmentId!=null||equipmentId!=''){
+				this.equipmentId=equipmentId;
+			}
+			var equipmentName = uni.getStorageSync("nowEquipmentName");
+			if(equipmentName!=null||equipmentName!=''){
+				this.pnameData=equipmentName;
+			}
+			var token = uni.getStorageSync("token");
+			if (token.toString().length > 1) {
+				this.init();
+
+			} else {
+				uni.reLaunch({
+					url: '../Login/Login',
+				});
+			}
+			// this.input = this.input + 1;
+			var test = uni.getStorageSync('test');
+			var globalUser = uni.getStorageSync("globalUser");
+			this.globalUser = globalUser;
+			if (globalUser.toString().length > 1) {
+				//判断是不是初次登陆
+				if (test == 2) {
+					this.init();
+				}
+			}
+			var id = this.adminId;
+
+			this.day();
+			// this.equipmentStatus();
+		},
+		mounted() {
+			var token = uni.getStorageSync("token");
+			if (token.toString().length > 1) {
+				this.init();
+			} else {
+				uni.reLaunch({
+					url: '../Login/Login',
+				});
+			}
+			// this.day();
+			this.equipmentStatus();
+		},
+		methods: {
+			...mapActions('chart', ['getStatistics', 'getMainStatistics', 'getMachineNum', 'getEquipmentListByUser']),
+			async init() {
+				if (!this.pname) {
+					this.pname = this.loginUser.name;
+				}
+				_self = this;
+				await this.getMainStatisticsData();
+				// await this.getEquipmentListData();
+				//初次登陆跳转后,把test变成2
+				uni.setStorageSync('test', '2');
+
+			},
+			day() {
+				var date = new Date();
+				// var daystr = dateUtils.formateDate(date, 'yyyy年MM月dd日');
+				var daystr = dateUtils.formateDate(date, 'yyyy-MM-dd');
+				this.today = daystr;
+				// var str= '星期'+'日一二三四五六'.charAt(date.getDay());
+				this.week = this.$t('mainStatistics.week' + date.getDay());
+
+			},
+			equipmentStatus() {
+				var id = uni.getStorageSync("globalUser").id;
+				var token = uni.getStorageSync("token");
+				uni.request({
+					url: this.serverurl + '/TEquipment/equipmentStatus',
+					data: {
+						"adminId": id
+					},
+					header: {
+						'token': token
+					},
+					method: "POST",
+					success: (res) => {
+
+					},
+				});
+			},
+			getMainStatisticsData() {
+				const param = {};
+				if (this.adminId) { // 子组件,则拿传过来的参
+					param['adminId'] = this.adminId;
+				} else if ('admin' !== this.loginUser['username']) { //否则为主页,拿登录用户
+					param['adminId'] = this.loginUser['id'];
+				}
+				var globalUser = uni.getStorageSync("globalUser");
+				if (globalUser.id != 1) {
+					if (param.adminId == null || param.adminId == undefined) {
+						param['adminId'] = globalUser.id;
+					}
+				}
+				if (this.equipmentId) {
+					param['equipmentId'] = this.equipmentId;
+				}
+				// console.log('getMainStatisticsData:{}', param);
+				var adminId = param.adminId;
+				var equipmentId = this.equipmentId;
+				var serverurl = this.serverurl;
+				var token = uni.getStorageSync("token");
+				uni.request({
+					url: serverurl + '/TEquipment/getMachineNum',
+					data: {
+						"adminId": adminId,
+						"equipmentId": equipmentId
+					},
+					method: "POST",
+					header: {
+						'token': token
+					},
+					success: (res) => {
+						var list = res.data.data;
+						this.machineTotalNum = list[0];
+						this.machineUseNum = list[1];
+					}
+				});
+				return this.getMainStatistics(param)
+					.then(data => {
+						for (let bean of data) {
+							if (bean['categorie'] === 'day') {
+								if (bean['randomTimes'] != null) {
+									this.dayRandomTimes = bean['randomTimes'];
+								}
+								if (bean['regularTimes'] != null) {
+									this.dayRegularTimes = bean['regularTimes'];
+								}
+
+
+							}
+							if (bean['categorie'] === 'week') {
+								if (bean['randomTimes'] != null) {
+									this.weekRandomTimes = bean['randomTimes'];
+								}
+								if (bean['regularTimes'] != null) {
+									this.weekRegularTimes = bean['regularTimes'];
+								}
+
+
+							}
+							if (bean['categorie'] === 'month') {
+								if (bean['randomTimes'] != null) {
+									this.monthRandomTimes = bean['randomTimes'];
+								}
+								if (bean['regularTimes'] != null) {
+									this.monthRegularTimes = bean['regularTimes'];
+								}
+
+
+							}
+							if (bean['categorie'] === 'year') {
+								if (bean['randomTimes'] != null) {
+									this.yearRandomTimes = bean['randomTimes'];
+								}
+								if (bean['regularTimes'] != null) {
+									this.yearRegularTimes = bean['regularTimes'];
+								}
+
+
+							}
+						}
+						uni.stopPullDownRefresh();
+					}, _ => void uni.stopPullDownRefresh());
+			},
+		}
+	}
+</script>
+
+<style>
+	page {
+		/* background: #F2F2F2; */
+		background: #FFFFFF;
+		width: 750upx;
+		overflow-x: hidden;
+	}
+
+	.head {
+		display: flex;
+		flex-direction: row;
+		background: #206DC3;
+		width: 750upx;
+		height: 180upx;
+	}
+
+	.company {
+		width: 48%;
+		text-align: right;
+	}
+
+	.pname {
+		display: flex;
+		flex-direction: row;
+		width: 40%;
+	}
+
+	.userFlagimg {
+		padding-left: 30upx;
+		padding-top: 10upx;
+		width: 26upx;
+		height: 28upx;
+	}
+
+	.wenzi {
+		padding-left: 5upx;
+		/* text-align:right; */
+		white-space: nowrap;
+		overflow: hidden;
+		/* text-overflow: ellipsis; */
+	}
+
+	.ri {
+		width: 690upx;
+		height: 180upx;
+		background: #FFFFFF;
+		border-radius: 15upx;
+		/* 上移 */
+		transform: translateY(-90upx);
+		text-align: center;
+		margin: auto;
+		display: flex;
+		flex-direction: row;
+		/* 阴影 */
+		box-shadow: 0upx -1upx 20upx #D3D3D3;
+		/* box-shadow:0px 0px  10px 5px #aaa; */
+	}
+
+	.riShell {
+		display: flex;
+		flex-direction: row;
+		margin: auto;
+	}
+
+	.riTitle {
+		display: flex;
+		flex-direction: column;
+		margin: auto;
+	}
+
+	.riqi {
+		display: flex;
+		flex-direction: column;
+		margin: auto;
+	}
+
+	.fourTitle {
+		width: 690upx;
+		height: 294upx;
+		display: flex;
+		flex-direction: row;
+		flex-wrap: wrap;
+		background: #FFFFFF;
+		box-shadow: 0upx 0upx 20upx #D3D3D3;
+		margin: auto;
+		border-radius: 15upx;
+		transform: translateY(-60upx);
+	}
+
+	.four {
+		display: flex;
+		flex-direction: row;
+		margin: auto;
+		width: 48%;
+	}
+
+	.fourImg {
+		width: 54upx;
+		height: 54upx;
+	}
+
+	.qiun-padding {
+		padding: 2%;
+		width: 96%;
+	}
+
+	.qiun-wrap {
+		display: flex;
+		flex-wrap: wrap;
+	}
+
+	.qiun-rows {
+		display: flex;
+		flex-direction: row !important;
+	}
+
+	.fontLeft {
+		margin-right: 6upx;
+	}
+</style>

+ 0 - 14
pages/User/equipmentStatusList.vue

@@ -242,20 +242,6 @@
 			},
 			OnOff(id, code) {
 				var that = this;
-				// var token = uni.getStorageSync("token");
-				// uni.request({
-				// 	url: that.serverurl + '/TEquipment/onoffStatus',
-				// 	data: {
-				// 		"equipmentId": id
-				// 	},
-				// 	header:{
-				// 		'token':token
-				// 	},
-				// 	method: "POST",
-				// 	success: (res) => {
-
-				// 	},
-				// });
 				var ddd = this.timeAll.get(id);
 				if (that.timeAll.get(id) != null) {
 					var stamp = Date.parse(new Date());

BIN
static/img/任务.png


BIN
static/img/参数.png


BIN
static/img/支付.png


BIN
static/img/统计.png


+ 7 - 0
store/modules/chart.js

@@ -76,6 +76,13 @@ export default {
 					return data;
 				});
 		},
+		updateRule({ commit },param) {
+			return apis.sz.post('/TEquipment/updateRule',param)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
 	}
 }