<template>
	<view>
		<uni-row style="margin-bottom: 3px;background-color:cadetblue;height: 34px;">
			<uni-col :span="2">
				<u-icon name="arrow-left" size="18" @click="onClosePage"
					style="margin-left: 20px;margin-top: 8px;"></u-icon>
			</uni-col>
			<uni-col :span="7">
				<view class="demo-uni-col dark"
					style="color: white;text-align: left;font-weight: 400;font-size: 24px;margin-top: 2px;">
					{{datestr}}
				</view>
			</uni-col>
			<uni-col :span="7">
				<view class="demo-uni-col dark"
					style="color: white;text-align: center;font-weight: 400;font-size: 24px;">{{pagename}}</view>
			</uni-col>
			<uni-col :span="7">
				<view class="demo-uni-col dark"
					style="color: white;text-align: right;margin-right: 3px;font-weight: 400;font-size: 24px;margin-top: 2px;">
					{{timestr}}
				</view>
			</uni-col>
		</uni-row>
		<uni-row style="margin-bottom: 3px;background-color:#3c9cff;height: 270px;"
			v-show="pageindex == 0 ? false : true">
			<view style="margin-top: 13px;margin-bottom: 10px;background-color:#FFE4C4;height: 90%;width: 100%;">
				<uni-col :span="12">
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								注肥循环次数:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.ct}}次
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								管道压力下限:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.lpl}}pa
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								流量脉冲设置:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.fp}}P/L
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								注肥保护时间:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.fpt}}秒
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								流速下限设定:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.fll}}L/分
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								流速上限设定:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.flu}}L/分
							</view>
						</uni-col>
					</uni-row>
				</uni-col>
				<uni-col :span="12">
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								搅拌循环次数:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.cmt}}次
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								搅拌接通时间:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.mt}}秒
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								搅拌断开时间:</view>
						</uni-col>
						<uni-col :span="12">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 30px;font-size: 14px;">
								{{itemProperty.mut}}秒
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								注肥A桶搅拌:</view>
						</uni-col>
						<uni-col :span="12">
							<u-button :type="`${itemProperty.fsa == 1? 'success':'primary'}`"
								:text="`${itemProperty.fsa == 1? '启用中':'未启用'}`"
								style="margin-top: 5px;margin-bottom: 5px;margin-left: 5px;margin-right: 5px;height: 30px;width: 95%;"></u-button>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								注肥B桶搅拌:</view>
						</uni-col>
						<uni-col :span="12">
							<u-button :type="`${itemProperty.fsb == 1? 'success':'primary'}`"
								:text="`${itemProperty.fsb == 1? '启用中':'未启用'}`"
								style="margin-top: 5px;margin-bottom: 5px;margin-left: 5px;margin-right: 5px;height: 30px;width: 95%;"></u-button>
						</uni-col>
					</uni-row>
					<uni-row style="border: 1px solid white;height: 40px;">
						<uni-col :span="12">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 30px;font-size: 14px;">
								注肥C桶搅拌:</view>
						</uni-col>
						<uni-col :span="12">
							<u-button :type="`${itemProperty.fsc == 1? 'success':'primary'}`"
								:text="`${itemProperty.fsc == 1? '启用中':'未启用'}`"
								style="margin-top: 5px;margin-bottom: 5px;margin-left: 5px;margin-right: 5px;height: 30px;width: 95%;"></u-button>
						</uni-col>
					</uni-row>
				</uni-col>
			</view>
		</uni-row>
		<uni-row style="margin-bottom: 3px;" v-show="pageindex == 1 ? false : true">
			<uni-col :span="6">
				<view class="demo-uni-col " style="height: 270px;background-color: gray;margin-right: 3px;">
					<uni-row style="height: 52%;">
						<uni-col :span="4">
							<u-icon size="30"
								:name="`${itemProperty.abs == 1? '../../../static/images/head/guanfullon.png':'../../../static/images/head/00009.png'}`"
								style="margin-top: 40px;margin-left: 5px;"></u-icon>
						</uni-col>
						<uni-col :span="14" style="height: 100%;margin-top: 15px;">
							<u-icon label="A桶" labelPos="top" label-color="white" size="80"
								:name="`${itemProperty.abs == 1? '../../../static/images/head/guanfull.png':'../../../static/images/head/00003.png'}`"></u-icon>
						</uni-col>
						<uni-col :span="6" style="height: 100%;">
							<view style="height: 100%;width: 100%;">
								<uni-row style="height: 50%;"><u-icon label="加水阀" labelPos="bottom" label-color="white"
										size="30"
										:name="`${itemProperty.awvs == 1? '../../../static/images/head/flagon.png':'../../../static/images/head/00015.png'}`"
										style="margin-top: 20px;"></u-icon></uni-row>
								<uni-row style="height: 50%;"><u-icon label="A桶阀" labelPos="bottom" label-color="white"
										size="30"
										:name="`${itemProperty.abvs == 1? '../../../static/images/head/flagon.png':'../../../static/images/head/00015.png'}`"></u-icon></uni-row>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="height: 24%;">
						<u-button text="加水" @click="onSoakA(itemProperty.ac)"
							:type="`${itemProperty.ac == 1? 'success':'info'}`" style="width: 70%;border-radius: 20px;"
							:icon="`${ (flagbut== 0 || flagbut ==1) ? '': '../../../static/images/head/lock.png'}` "
							:disabled="disabled1"></u-button>
					</uni-row>
					<uni-row style="height: 24%;"><u-button text="注肥" @click="onFertilizationA(itemProperty.acf)"
							:type="`${itemProperty.acf == 1? 'success':'info'}`" style="width: 70%;border-radius: 20px;"
							:icon="`${ (flagbut== 0 || flagbut ==2) ? '': '../../../static/images/head/lock.png'}` "
							:disabled="disabled2"></u-button></uni-row>
				</view>
			</uni-col>
			<uni-col :span="6">
				<view class="demo-uni-col " style="height: 270px;background-color: gray;margin-right: 3px;">
					<uni-row style="height: 52%;">
						<uni-col :span="4">
							<u-icon size="30"
								:name="`${itemProperty.bbs == 1? '../../../static/images/head/guanfullon.png':'../../../static/images/head/00009.png'}`"
								style="margin-top: 40px;margin-left: 5px;"></u-icon>
						</uni-col>
						<uni-col :span="14" style="height: 100%;margin-top: 15px;">
							<u-icon label="B桶" labelPos="top" label-color="white" size="80"
								:name="`${itemProperty.bbs == 1? '../../../static/images/head/guanfull.png':'../../../static/images/head/00003.png'}`"></u-icon>
						</uni-col>
						<uni-col :span="6" style="height: 100%;">
							<view style="height: 100%;width: 100%;">
								<uni-row style="height: 50%;"><u-icon label="加水阀" labelPos="bottom" label-color="white"
										size="30"
										:name="`${itemProperty.bwvs == 1? '../../../static/images/head/flagon.png':'../../../static/images/head/00015.png'}`"
										style="margin-top: 20px;"></u-icon></uni-row>
								<uni-row style="height: 50%;"><u-icon label="B桶阀" labelPos="bottom" label-color="white"
										size="30"
										:name="`${itemProperty.bbvs == 1? '../../../static/images/head/flagon.png':'../../../static/images/head/00015.png'}`"></u-icon></uni-row>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="height: 24%;">
						<u-button text="加水" @click="onSoakB(itemProperty.bc)"
							:type="`${itemProperty.bc == 1? 'success':'info'}`" style="width: 70%;border-radius: 20px;"
							:icon="`${ (flagbut== 0 || flagbut ==3) ? '': '../../../static/images/head/lock.png'}` "
							:disabled="disabled3"></u-button>
					</uni-row>
					<uni-row style="height: 24%;"><u-button text="注肥" @click="onFertilizationB(itemProperty.bcf)"
							:type="`${itemProperty.bcf == 1? 'success':'info'}`" style="width: 70%;border-radius: 20px;"
							:icon="`${ (flagbut== 0 || flagbut ==4) ? '': '../../../static/images/head/lock.png'}` "
							:disabled="disabled4"></u-button></uni-row>
				</view>
			</uni-col>
			<uni-col :span="6">
				<view class="demo-uni-col " style="height: 270px;background-color: gray;margin-right: 3px;">
					<uni-row style="height: 52%;">
						<uni-col :span="4">
							<u-icon size="30"
								:name="`${itemProperty.cbs == 1? '../../../static/images/head/guanfullon.png':'../../../static/images/head/00009.png'}`"
								style="margin-top: 40px;margin-left: 5px;"></u-icon>
						</uni-col>
						<uni-col :span="14" style="height: 100%;margin-top: 15px;">
							<u-icon label="C桶" labelPos="top" label-color="white" size="80"
								:name="`${itemProperty.cbs == 1? '../../../static/images/head/guanfull.png':'../../../static/images/head/00003.png'}`"></u-icon>
						</uni-col>
						<uni-col :span="6" style="height: 100%;">
							<view style="height: 100%;width: 100%;">
								<uni-row style="height: 50%;"><u-icon label="加水阀" labelPos="bottom" label-color="white"
										size="30"
										:name="`${itemProperty.cwvs == 1? '../../../static/images/head/flagon.png':'../../../static/images/head/00015.png'}`"
										style="margin-top: 20px;"></u-icon></uni-row>
								<uni-row style="height: 50%;"><u-icon label="C桶阀" labelPos="bottom" label-color="white"
										size="30"
										:name="`${itemProperty.cbvs == 1? '../../../static/images/head/flagon.png':'../../../static/images/head/00015.png'}`"></u-icon></uni-row>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="height: 24%;">
						<u-button text="加水" @click="onSoakC(itemProperty.cc)"
							:type="`${itemProperty.cc == 1? 'success':'info'}`" style="width: 70%;border-radius: 20px;"
							:icon="`${ (flagbut== 0 || flagbut ==5) ? '': '../../../static/images/head/lock.png'}` "
							:disabled="disabled5"></u-button>
					</uni-row>
					<uni-row style="height:24%;"><u-button text="注肥" @click="onFertilizationC(itemProperty.ccf)"
							:type="`${itemProperty.ccf == 1? 'success':'info'}`" style="width: 70%;border-radius: 20px;"
							:icon="`${ (flagbut== 0 || flagbut ==6) ? '': '../../../static/images/head/lock.png'}` "
							:disabled="disabled6"></u-button></uni-row>
				</view>
			</uni-col>
			<uni-col :span="6">
				<view class="demo-uni-col " style="height: 270px;">
					<uni-row style="height: 10%;border-radius: 4px;border-top: 2px solid #000;">
						<uni-col :span="12" style="background-color:gainsboro;height: 100%;">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 22px;font-size: 14px;">
								流速</view>
						</uni-col>
						<uni-col :span="12" style="background-color:white;height: 100%;">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 22px;font-size: 14px;">
								{{itemProperty.fs}}L/min
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="height: 10%;border-radius: 4px;border-top: 2px solid #000;">
						<uni-col :span="12" style="background-color:gainsboro;height: 100%;">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 22px;font-size: 14px;">
								压力</view>
						</uni-col>
						<uni-col :span="12" style="background-color:white;height: 100%;">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 22px;font-size: 14px;">
								{{itemProperty.pr}}Mpa
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="height: 10%;border-radius: 4px;border-top: 2px solid #000;">
						<uni-col :span="12" style="background-color:gainsboro;height: 100%;">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 22px;font-size: 14px;">
								循环次数</view>
						</uni-col>
						<uni-col :span="12" style="background-color:white;height: 100%;">
							<view
								style="border: 1px solid #000;height: 80%;margin-top: 2px;margin-bottom: 2px;text-align: center;line-height: 22px;font-size: 14px;">
								{{itemProperty.wct}}
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="height: 10%;border-radius: 4px;border-top: 2px solid #000;"
						v-if="itemProperty.acl==1">
						<uni-col :span="12" style="background-color:gainsboro;height: 100%;">
							<view
								style="height:100%;width: 100%;text-align: center;margin-top: 2px;line-height: 22px;font-size: 14px;">
								报警</view>
						</uni-col>
						<uni-col :span="12" style="background-color:white;height: 100%;">
							<u-button text="取消" @click="onAlarmCancel(itemProperty.acl)"
								:type="`${itemProperty.acl == 1? 'error':'info'}`"
								style="width: 70%;border-radius: 20px;"></u-button>
						</uni-col>
					</uni-row>
					<uni-row style="height: 10%;border-radius: 4px;float: left;"><u-icon label="注肥阀" labelPos="left"
							label-color="blak" size="30"
							:name="`${itemProperty.alf == 1? '../../../static/images/head/flagon.png':'../../../static/images/head/00015.png'}`"
							style="margin-top: 20px;"></u-icon></uni-row>

				</view>
			</uni-col>
		</uni-row>
		<uni-row style="margin-bottom: 3px;background-color:cadetblue;height: 34px;">
			<uni-col :span="5">
				<u-button text="主画面" :type="`${pageindex == 1? 'info':'primary'}`" @click="pageselect(0)"
					style="height: 30px;width: 80%;margin-bottom: 2px;margin-top: 2px;"></u-button>
			</uni-col>
			<uni-col :span="5" v-if="user.userType==0">
				<u-button text="参数设置" :type="`${pageindex == 1? 'primary':'info'}`" @click="pageselect(1)"
					style="height: 30px;width: 80%;margin-bottom: 2px;margin-top: 2px;"></u-button>
			</uni-col>
		</uni-row>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				item: {},
				itemProperty: {},
				timestr: "",
				datestr: "",
				flagbut: 0,
				disabled1: false,
				disabled2: false,
				disabled3: false,
				disabled4: false,
				disabled5: false,
				disabled6: false,
				pagename: "主画面",
				reartype: "primary",
				pageindex: 0,
				mqttshow: false, // h5端手动链接mqtt按钮显示
				mqttConnected: false, //	mqtt链接状态
				user: store.state.user.user,
				topics: []
			}
		},
		onLoad(options) {
			// #ifdef APP-PLUS
			plus.screen.lockOrientation('landscape-primary');
			plus.navigator.setFullscreen(true);
			// #endif
			if (options.item != null) {
				this.item = JSON.parse(decodeURIComponent(options.item));
				this.itemProperty = this.item.deviceData;
				this.setDeviceProperty();
			}
			let topic = "jsy/iot/push/outProduct/" + this.item.deviceCode;
			this.topics.push(topic)
			this.mqttSubscribes(this.topics);
			getApp().addMsgEvent("mqtt", "mqtt_fertilizerKL", function(e) {
				if (e.type == "state") {
					that.mqttConnected = e.connected;
				} else if (e.type == "msg") {
					this.itemProperty = e.data;
					this.devicePropertyStatus();
				}
			});
		},
		onUnload() {
			this.mqttUnSubscribes(this.topics);
		},
		methods: {
			mqttSubscribes(topics) {
				getApp().mqttSubscribes(topics);
			},
			mqttUnSubscribes(topics) {
				getApp().mqttUnsubscribes(topics);
			},
			setDeviceProperty() {
				if (!this.itemProperty.ac) {
					this.itemProperty.ac = "0";
				}
				if (!this.itemProperty.acf) {
					this.itemProperty.acf = "0";
				}
				if (!this.itemProperty.bc) {
					this.itemProperty.bc = "0";
				}
				if (!this.itemProperty.bcf) {
					this.itemProperty.bcf = "0";
				}
				if (!this.itemProperty.cc) {
					this.itemProperty.cc = "0";
				}
				if (!this.itemProperty.ccf) {
					this.itemProperty.ccf = "0";
				}
				if (this.itemProperty.ac == 0 && this.itemProperty.acf == 0 && this.itemProperty.bc == 0 && this
					.itemProperty.bcf == 0 && this.itemProperty.cc ==
					0 && this.itemProperty.ccf == 0) {
					this.flagbut = 0;
					this.disabled1 = false;
					this.disabled2 = false;
					this.disabled3 = false;
					this.disabled4 = false;
					this.disabled5 = false;
					this.disabled6 = false;
				} else {
					if (this.itemProperty.ac == 1) {
						this.flagbut = 1;
						this.disabled1 = false;
						this.disabled2 = true;
						this.disabled3 = true;
						this.disabled4 = true;
						this.disabled5 = true;
						this.disabled6 = true;
					}
					if (this.itemProperty.acf == 1) {
						this.flagbut = 2;
						this.disabled1 = true;
						this.disabled2 = false;
						this.disabled3 = true;
						this.disabled4 = true;
						this.disabled5 = true;
						this.disabled6 = true;
					}
					if (this.itemProperty.bc == 1) {
						this.flagbut = 3;
						this.disabled1 = true;
						this.disabled2 = true;
						this.disabled3 = false;
						this.disabled4 = true;
						this.disabled5 = true;
						this.disabled6 = true;
					}
					if (this.itemProperty.bcf == 1) {
						this.flagbut = 4;
						this.disabled1 = true;
						this.disabled2 = true;
						this.disabled3 = true;
						this.disabled4 = false;
						this.disabled5 = true;
						this.disabled6 = true;
					}
					if (this.itemProperty.cc == 1) {
						this.flagbut = 5;
						this.disabled1 = true;
						this.disabled2 = true;
						this.disabled3 = true;
						this.disabled4 = true;
						this.disabled5 = false;
						this.disabled6 = true;
					}
					if (this.itemProperty.ccf == 1) {
						this.flagbut = 6;
						this.disabled1 = true;
						this.disabled2 = true;
						this.disabled3 = true;
						this.disabled4 = true;
						this.disabled5 = true;
						this.disabled6 = false;
					}
				}
			},
			onRear(g) {
				var par = {
					controlKey: "fd",
					deviceTypeId: 4,
					operationType: 12,
					deviceCode: this.item.deviceCode,
					controlValve: g
				};
				controlHeadSwitch(par).then(res => {});
			},

			onSoakA(e) {
				var par = {
					controlKey: "ac",
					deviceTypeId: 4,
					operationType: 11,
					deviceCode: this.item.deviceCode,
					controlValve: e == 1 ? 0 : 1
				};
				controlHeadSwitch(par).then(res => {});
			},


			onSoakB(e) {
				var par = {
					controlKey: "bc",
					deviceTypeId: 4,
					operationType: 11,
					deviceCode: this.item.deviceCode,
					controlValve: e == 1 ? 0 : 1
				};
				controlHeadSwitch(par).then(res => {});
			},

			onSoakC(e) {
				var par = {
					controlKey: "cc",
					deviceTypeId: 4,
					operationType: 11,
					deviceCode: this.item.deviceCode,
					controlValve: e == 1 ? 0 : 1
				};
				controlHeadSwitch(par).then(res => {});
			},

			onFertilizationA(e) {
				var par = {
					controlKey: "acf",
					deviceTypeId: 4,
					operationType: 11,
					deviceCode: this.item.deviceCode,
					controlValve: e == 1 ? 0 : 1
				};
				controlHeadSwitch(par).then(res => {});
			},

			onFertilizationB(e) {
				var par = {
					controlKey: "bcf",
					deviceTypeId: 4,
					operationType: 11,
					deviceCode: this.item.deviceCode,
					controlValve: e == 1 ? 0 : 1
				};
				controlHeadSwitch(par).then(res => {});
			},

			onFertilizationC(e) {
				var par = {
					controlKey: "ccf",
					deviceTypeId: 4,
					operationType: 11,
					deviceCode: this.item.deviceCode,
					controlValve: e == 1 ? 0 : 1
				};
				controlHeadSwitch(par).then(res => {});
			},
			onAlarmCancel(e) {
				var par = {
					controlKey: "acl",
					deviceTypeId: 4,
					operationType: 11,
					deviceCode: this.item.deviceCode,
					controlValve: 0
				};
				controlHeadSwitch(par).then(res => {});

			},

			getNowFormatDay() {
				var date = new Date();
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				var d = date.getDate();
				if (month < 10) {
					month = "0" + month;
				}
				if (d < 10) {
					d = "0" + d;
				}
				return year + "/" + month + "/" + d;
			},


			getNowFormatDateTime() {
				var date = new Date();
				var hour = date.getHours();
				var minute = date.getMinutes();
				var second = date.getSeconds();
				if (hour < 10) {
					hour = "0" + hour;
				}
				if (minute < 10) {
					minute = "0" + minute;
				}
				if (second < 10) {
					second = "0" + second;
				}
				return hour + ":" + minute + ":" + second;
			},

			//关闭页面
			onClosePage() {
				uni.navigateBack({
					delta: 1
				})
			},

			pageselect(e) {
				this.pageindex = e;
				if (e == 0) {
					this.pagename = '主画面';
				} else {
					this.pagename = '参数设置';
				}
			}
		}
	}
</script>

<style lang="scss">
	.uni-page-head {
		display: none
	}

	.demo-uni-col {
		height: 32px;
		border-radius: 2px;
	}

	.dark {
		background-color: cadetblue;
	}

	.light {
		background-color: cadetblue;
	}
</style>