<!--
 * @Title: 
 * @Description: 首页
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
	<view class="container">
		<!-- 导航栏  #3F9EFF-->
		<uni-nav-bar :fixed="true" backgroundColor="#3F9EFF" statusBar="false" height="75px">
			<block slot="left">
				<view class="view-flex-block-center">
					<image src="/static/images/logo_start.png" class="logo" mode="widthFix"></image>
				</view>
			</block>
			<view class="view-flex-block-center">
				<text style="color: #ffffff; font-size: 1rem;font-family: Microsoft YaHei;">{{title}}</text>
			</view>
			<block slot="right">
				<view style="margin-right:20rpx" @click="onNoticeMoreClick">
					<uni-badge class="uni-badge-left-margin" absolute="rightTop" :is-dot="noticeDot" :text="noticeValue"
						size="small">
						<uni-icons class="input-uni-icon" type="notification" size="24" color="#FFFFFF" />
					</uni-badge>
				</view>
			</block>
		</uni-nav-bar>
		<!-- 菜单切换 -->
		<uni-swipe-action v-if="permission.admin || permission.orgAdmin" ref="swipeAction">
			<uni-swipe-action-item :right-options="systemOptions" :show="swipeStatus" :auto-close="false"
				@change="swipeChange" @click="swipeBindClick">
				<view class="view-flex-block-center" style="height: 50px;width: 100%;background-color: aliceblue;"
					@click="onSwipeOpened">
					<view class="view-flex-inline-center">
						<uni-icons class="input-uni-icon" type="tune-filled" size="20" color="darkorange" />
						<text v-if="menuModel ==1"
							style="color: cadetblue;font-size: 1rem;margin-left: 5px;font-weight: bold;">点击切换应急系统</text>
						<text v-else-if="menuModel ==2"
							style="color: cadetblue;font-size: 1rem;margin-left: 5px;font-weight: bold;">点击切换运维系统</text>
					</view>
				</view>
			</uni-swipe-action-item>
		</uni-swipe-action>
		<view v-if="menuModel ==1">
			<!-- 头部按钮 -->
			<view class="nav">
				<u-grid :col="4" :border="false">
					<u-grid-item v-if="navButtonIndex[index]" bg-color="transparent" v-for="(item, index) in navButton"
						:key="index">
						<navigator v-if="item.badge" :url="item.url" hover-class="none" class="nav-item"
							open-type="navigate">
							<uni-badge class="uni-badge-left-margin" absolute="rightTop" :text="item.value"
								size="small">
								<image :src="item.img" mode="widthFix" class="nav-item-img"></image>
							</uni-badge>
							<view style="font-size: 0.8rem;font-weight: bold;">{{ item.name }}</view>
						</navigator>
						<navigator v-else :url="item.url" hover-class="none" class="nav-item" open-type="navigate">
							<image :src="item.img" mode="widthFix" class="nav-item-img"></image>
							<view style="font-size: 0.8rem;font-weight: bold;">{{ item.name }}</view>
						</navigator>
					</u-grid-item>
				</u-grid>
			</view>
			<!-- 新任务 -->
			<uni-section v-if="permission.companyServciePerson" title="新任务" titleColor="#5470c6" titleFontSize="0.8rem"
				:subTitle="realData.newCheckOrderCount">
				<template v-slot:right>
					<view v-if="loadMoreStatus === 'more'" class="line">
						<view class="block">
							<uni-icons class="input-uni-icon" type="more-filled" size="18" color="skyblue" />
						</view>
						<view class="block">
							<text style="margin-left: 2px;font-size:0.7rem;color:grey;"
								@click="onMoreUncomfireCheckOrderClick()">查看更多</text>
						</view>
					</view>
					<view v-else-if="loadMoreStatus === 'noMore'" class="line">
						<view class="block">
							<text style="font-size:0.7rem;color:gray;">暂无数据</text>
						</view>
					</view>
					<view v-else class="line">
						<view class="block">
							<text style="font-size:0.7rem;color:gray;">已全部加载</text>
						</view>
					</view>
				</template>
				<template v-slot:decoration>
					<view class="decoration"></view>
				</template>
				<uni-list style="min-height: 40px;">
					<uni-list-item v-for="item in unconfirmOrderList" :key="item.id">
						<template v-slot:body>
							<view class="item-block">
								<uni-row>
									<uni-col :span="18">
										<view class="line">
											<view class="block">
												<uni-icons class="input-uni-icon" type="home" size="18" color="grey" />
											</view>
											<view class="block rtu-name">
												{{item.rtuName}}
											</view>
											<view class="block rtu-code">
												[{{item.rtuCode}}]
											</view>
										</view>
									</uni-col>
									<uni-col :span="6">
										<view class="line-end">
											<view class="block"
												style="width: 140px;height:28px;border-radius:7px;background-color:lightblue"
												@click="onOrderItemClick(item.id)">
												<view class="line-center">
													<view class="block">
														<uni-icons class="input-uni-icon" type="auth" size="16"
															color="coral" />
													</view>
													<view class="block">
														<text
															style="padding-left:2px;color:black;font-size:0.7rem">查看任务</text>
													</view>
												</view>
											</view>
										</view>
									</uni-col>
								</uni-row>
								<view class="item-text-line">
									<uni-icons class="input-uni-icon" type="location" size="18" color="lightblue" />
									<text class="item-text">{{item.areaName}}</text>
								</view>
								<view class="item-text-line">
									<uni-icons class="input-uni-icon" type="compose" size="18" color="lightblue" />
									<text class="item-text" style="width: 60px;">备注：</text>
									<text class="item-text-ell">{{item.orderDesc}}</text>
								</view>
							</view>
						</template>
					</uni-list-item>
				</uni-list>
			</uni-section>
			<!-- 测站统计信息 -->
			<uni-section style="margin-bottom: 0px;" title="测站统计信息" titleColor="#5470c6" titleFontSize="0.8rem">
				<template v-slot:decoration>
					<view class="decoration"></view>
				</template>
				<view class="count-info-block">
					<uni-row>
						<uni-col :span="24">
							<view class="rtuCount">
								<view>
									<text class="name">测站数量：</text>
								</view>
								<view style="margin-left:10px;text-decoration-line: underline;"
									@click="onRtuManageViewClick">
									<text class="count">{{realData.rtus}}</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="warnRtuCount">
								<view>
									<text class="name">异常测站数量 ：</text>
								</view>
								<view style="margin-left:10px;text-decoration-line: underline;"
									@click="onWarningRtuViewClick">
									<text class="count">{{realData.warningRtus}}</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
				</view>
			</uni-section>
			<uni-section style="margin-bottom: 0px;" title="维修任务统计信息" titleColor="#5470c6" titleFontSize="0.8rem">
				<template v-slot:decoration>
					<view class="decoration"></view>
				</template>
				<view class="count-info-block">
					<uni-row>
						<uni-col :span="24">
							<view class="orderCount">
								<view>
									<text class="name">维修任务总数量：</text>
								</view>
								<view v-if="permission.companyServciePerson">
									<view v-if="realData.orderCount" style="margin-left:10px;">
										<text class="count">{{realData.orderCount}}</text>
									</view>
								</view>
								<view v-else>
									<view style="margin-left:10px;text-decoration-line: underline;"
										@click="onAllCheckOrderClick">
										<text class="count">{{realData.orderCount}}</text>
									</view>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="unconfirmOrderCount">
								<view>
									<text class="name">未确认维修任务数量：</text>
								</view>
								<view v-if="realData.unconfirmOrderCount"
									style="margin-left:10px;text-decoration-line: underline;"
									@click="onUncomfirecheckorderViewClick">
									<text class="count">{{realData.unconfirmOrderCount}}</text>
								</view>
								<view v-else style="margin-left:10px;text-decoration-line: underline;"
									@click="onUncomfirecheckorderViewClick">
									<text class="count">0</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="delayComfireOrders">
								<view>
									<text class="name">超时未确认维修任务数量：</text>
								</view>
								<view v-if="realData.delayComfireOrders"
									style="margin-left:10px;text-decoration-line: underline;"
									@click="onComfiredelaycheckorderClick">
									<text class="count">{{realData.delayComfireOrders}}</text>
								</view>
								<view v-else style="margin-left:10px;text-decoration-line: underline;"
									@click="onComfiredelaycheckorderClick">
									<text class="count">0</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="processOrderCount">
								<view>
									<text class="name">维修处理中任务数量：</text>
								</view>
								<view v-if="realData.processOrderCount"
									style="margin-left:10px;text-decoration-line: underline;"
									@click="onProcessCheckorderViewClick">
									<text class="count">{{realData.processOrderCount}}</text>
								</view>
								<view v-else style="margin-left:10px;text-decoration-line: underline;"
									@click="onProcessCheckorderViewClick">
									<text class="count">0</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="processOrderCount">
								<view>
									<text class="name">已处理任务数量：</text>
								</view>
								<view v-if="realData.reportOrder"
									style="margin-left:10px;text-decoration-line: underline;"
									@click="onReportCheckorderViewClick">
									<text class="count">{{realData.reportOrder}}</text>
								</view>
								<view v-else style="margin-left:10px;text-decoration-line: underline;"
									@click="onReportCheckorderViewClick">
									<text class="count">0</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
				</view>
			</uni-section>
			<uni-section title="本年度设备巡检统计信息" titleColor="#5470c6" titleFontSize="0.8rem">
				<template v-slot:decoration>
					<view class="decoration"></view>
				</template>
				<view class="count-info-block">
					<uni-row>
						<uni-col :span="24">
							<view class="equipmentInspectionCount">
								<view>
									<text class="name">需巡检站点数量：</text>
								</view>
								<view style="margin-left: 10px;text-decoration-line: underline;"
									@click="onInspectionManageClick">
									<text class="count">{{realData.equipmentInspectionCount}}</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="equipmentInspectionBeforeRainCount">
								<view>
									<text class="name">汛前已巡检设备数量：</text>
								</view>
								<view style="margin-left: 10px;text-decoration-line: underline;"
									@click="onFinishedBeforeRainInspectionClick">
									<text class="count">{{realData.equipmentInspectionBeforeRainReports}}</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="equipmentInspectionRainFirstCount">
								<view>
									<text class="name">汛中（一）已巡检设备数量：</text>
								</view>
								<view style="margin-left: 10px;text-decoration-line: underline;"
									@click="onFinishedRainFirstInspectionClick">
									<text class="count">{{realData.equipmentInspectionRainFirstReports}}</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
					<uni-row style="margin-top: 4px;">
						<uni-col :span="24">
							<view class="equipmentInspectionRainSecondCount">
								<view>
									<text class="name">汛中（二）已巡检设备数量：</text>
								</view>
								<view style="margin-left: 10px;text-decoration-line: underline;"
									@click="onFinishedRainSecondInspectionClick">
									<text class="count">{{realData.equipmentInspectionRainSecondReports}}</text>
								</view>
							</view>
						</uni-col>
					</uni-row>
				</view>
			</uni-section>
			<!-- 任务动态 -->
			<uni-section v-if="permission.admin || permission.orgAdmin || permission.companyAdmin"
				style="margin-bottom: 0px;" title="今日维修任务信息" titleColor="#5470c6" titleFontSize="0.8rem"
				:subTitle="realData.todayOrderProcessCount">
				<template v-slot:right>
					<view class="line-end">
						<uni-icons class="input-uni-icon" type="more-filled" size="18" color="skyblue" />
						<text style="margin-left: 4px;;font-size:0.7rem;color:grey;"
							@click="onMoreTodayCheckOrderReportClick()">查看更多</text>
					</view>
				</template>
				<template v-slot:decoration>
					<view class="decoration"></view>
				</template>
				<uni-list style="min-height: 40px;">
					<uni-list-item v-for="item in todayOrderProcessList" :key="item.id" showArrow clickable
						@click="onOrderReportItemClick(item.orderId)">
						<template v-slot:body>
							<view class="item-block">
								<view class="item-text-line">
									<view class="block">
										<image class="item-title-image" style="box-shadow:0 0 2px 2px lightblue"
											src="/static/images/list/order_item.png" mode="widthFix">
										</image>
									</view>
									<view class="block">
										<text class="rtu-name">{{item.rtuName}}</text>
									</view>
									<view class="block">
										<text class="rtu-code">[{{item.rtuCode}}]</text>
									</view>
								</view>
								<view class="item-text-line" style="margin-top: 2px;">
									<view class="block">
										<uni-icons class="input-uni-icon" type="loop" size="18" color="lightblue" />
									</view>
									<view class="block">
										<text class="item-text">状态：</text>
									</view>
									<view class="block">
										<text class="item-text">
											{{item.orderStatusName}}
										</text>
									</view>
								</view>
								<view class="item-text-line" style="margin-top: 2px;">
									<view class="block">
										<uni-icons class="input-uni-icon" type="person" size="18" color="lightblue" />
									</view>
									<view class="block">
										<text class="item-title">填报人：</text>
									</view>
									<view class="block">
										<text class="item-text">
											{{item.orderProcessUserName}}
										</text>
									</view>
								</view>
								<view class="item-text-line" style="margin-top: 2px;">
									<view class="block">
										<uni-icons class="input-uni-icon" type="calendar" size="18" color="lightblue" />
									</view>
									<view class="block">
										<text class="item-title">填报时间：</text>
									</view>
									<view class="block">
										<text class="item-text">
											{{item.updateTime}}
										</text>
									</view>
								</view>
								<view class="item-text-line" style="margin-top: 2px;">
									<view class="block">
										<uni-icons class="input-uni-icon" type="compose" size="18" color="lightblue" />
									</view>
									<view class="block">
										<text class="item-title" style="width: 50px;">说明：</text>
									</view>
									<text v-if="item.processDesc" class="item-text-ell">
										{{item.processDesc}}
									</text>
								</view>
								<!-- 		<view class="item-text-line" style="margin-top: 2px;">
								<text v-if="item.processDesc" class="item-text-ell">
									{{item.processDesc}}
								</text>
							</view> -->
							</view>
						</template>
					</uni-list-item>
				</uni-list>
			</uni-section>
			<!-- 巡检动态 -->
			<uni-section v-if="permission.admin || permission.orgAdmin || permission.companyAdmin" title="今日设备巡检信息"
				titleColor="#5470c6" titleFontSize="0.8rem" :subTitle="realData.todayIinspectionReportCount">
				<template v-slot:right>
					<view class="line-end">
						<uni-icons class="input-uni-icon" type="more-filled" size="18" color="skyblue" />
						<text style="font-size:0.7rem;color:grey;"
							@click="onMoreTodayInspectionReportInfoClick">查看更多</text>
					</view>
				</template>
				<template v-slot:decoration>
					<view class="decoration"></view>
				</template>
				<uni-list style="min-height: 40px;">
					<uni-list-item v-for="item in todayEquipmentInspectionList" :key="item.id" showArrow clickable
						@click="onInspectionItemClick(item.id,item.rainSeasonKind)">
						<template v-slot:body>
							<view class="list-item-block">
								<view class="line" style="margin-top: 2px;">
									<view class="block">
										<image class="item-title-image" style="box-shadow:0 0 2px 2px lightblue"
											src="/static/images/list/inspection_item.png" mode="widthFix">
										</image>
									</view>
									<view class="block">
										<text class="rtu-name">{{item.rtuName}}</text>
									</view>
									<view class="block">
										<text class="rtu-code">[{{item.rtuCode}}]</text>
									</view>
								</view>
								<view class="line" style="margin-top: 2px;">
									<view class="block">
										<uni-icons class="input-uni-icon" type="person" size="18" color="lightblue" />
									</view>
									<view class="block">
										<text class="item-title">填报人：</text>
									</view>
									<view class="block">
										<text class="item-text">
											{{item.servicePersonName}}
										</text>
									</view>
								</view>
								<view class="line" style="margin-top: 2px;">
									<view class="block">
										<uni-icons class="input-uni-icon" type="calendar" size="18" color="lightblue" />
									</view>
									<view class="block">
										<text class="item-title">填报时间：</text>
									</view>
									<view class="block">
										<text class="item-text">
											{{item.createTime}}
										</text>
									</view>
								</view>
								<view class="line" style="margin-top: 2px;">
									<view class="block">
										<uni-icons class="input-uni-icon" type="compose" size="18" color="lightblue" />
									</view>
									<view class="block">
										<text class="item-title" style="width: 50px;">说明：</text>
									</view>
									<text v-if="item.reportDesc" class="item-text-ell">
										{{item.reportDesc}}
									</text>
								</view>
							</view>
						</template>
					</uni-list-item>
				</uni-list>
			</uni-section>
		</view>
		<view v-else-if="menuModel ==2">
			<view class="nav">
				<u-grid :col="4" :border="false">
					<u-grid-item v-if="yjNavButtonIndex[index]" bg-color="transparent"
						v-for="(item, index) in yjNavButton" :key="index">
						<navigator v-if="item.badge" :url="item.url" hover-class="none" class="nav-item"
							open-type="navigate">
							<uni-badge class="uni-badge-left-margin" absolute="rightTop" :text="item.value"
								size="small">
								<image :src="item.img" mode="widthFix" class="nav-item-img"></image>
							</uni-badge>
							<view style="font-size: 0.8rem;font-weight: bold;">{{ item.name }}</view>
						</navigator>
						<navigator v-else :url="item.url" hover-class="none" class="nav-item" open-type="navigate">
							<image :src="item.img" mode="widthFix" class="nav-item-img"></image>
							<view style="font-size: 0.8rem;font-weight: bold;">{{ item.name }}</view>
						</navigator>
					</u-grid-item>
				</u-grid>
			</view>
			<uni-card title="快捷操作">
				<uni-row>
					<uni-col :span="12">
						<view class="view-flex-inline">
							<uni-icons class="input-uni-icon" type="arrow-right" size="20" color="coral" />
							<text class="text-under-line" style="font-size: 1rem;color: coral;"
								@click="toDangerAreaResidentRecord()">群众登记填报</text>
						</view>
					</uni-col>
					<uni-col :span="12">
						<view class="view-flex-inline">
							<uni-icons class="input-uni-icon" type="arrow-right" size="20" color="coral" />
							<text class="text-under-line" style="font-size: 1rem;color: coral;"
								@click="toDangerAreaCheck()">发起现场巡查</text>
						</view>
					</uni-col>
				</uni-row>
			</uni-card>
			<!-- 	预警信息 -->
			<uni-section title="预警响应信息" titleColor="#5470c6" titleFontSize="0.8rem">
				<template v-slot:right>
					<view v-if="loadMoreStatus === 'more'" class="view-flex-inline">
						<view class="view-flex-block-center">
							<uni-icons class="input-uni-icon" type="more-filled" size="18" color="skyblue" />
						</view>
						<view class="view-flex-block-center">
							<text style="margin-left: 2px;font-size:0.7rem;color:gray;"
								@click="onMoreYjWarnClick()">查看更多(<span
									style="color: red;">{{yjRealData.warnCountSubTitle}}</span>)</text>
						</view>
					</view>
					<view v-else-if="loadMoreStatus === 'noMore'" class="view-flex-inline">
						<view class="view-flex-block-center">
							<text style="font-size:0.7rem;color:gray;">暂无数据</text>
						</view>
					</view>
					<view v-else class="view-flex-inline">
						<view class="view-flex-block-center">
							<text style="font-size:0.7rem;color:gray;">已全部加载(<span
									style="color: red;">{{yjRealData.warnCountSubTitle}}</span>)</text>
						</view>
					</view>
				</template>
				<template v-slot:decoration>
					<view class="decoration"></view>
				</template>
				<uni-list style="min-height: 40px;">
					<uni-list-item v-for="item in yjWarnList" :key="item.id">
						<template v-slot:body>
							<view class="list-item-block">
								<view class="line" @click="toWarnDetailView(item)">
									<view class="block">
										<uni-icons class="input-uni-icon" type="notification" size="18" color="red" />
									</view>
									<view class="title text-ellipsis text-underline" style="color: blue;">
										{{item.warnName}}
									</view>
								</view>
								<view class="line">
									<text class="text text-ellipsis" style="color: gray;">预警信息：{{item.warnInfo}}</text>
								</view>
								<view class="line">
									<text class="text" style="color: gray;">预警时间：{{item.warnTime}}</text>
								</view>
								<view class="line">
									<text class="text" style="color: gray;">应转移人员：{{item.totalTransferPerson}}</text>
								</view>
								<view class="line">
									<text class="text" style="color: gray;">已转移：{{item.safetyTransferPerson}}</text>
								</view>
								<uni-row>
									<uni-col :span="8">
										<image style="height: 80px;" :src="toOss(item.warnQrUrl)" mode="heightFix"
											@click="toFullQrImage(item)"></image>
									</uni-col>
									<uni-col :span="16">
										<view class="item-button-group">
											<view class="item-button" @click="onDangerAreaCheckClick(item)">
												<view class="view-flex-inline-center">
													<uni-icons class="input-uni-icon" type="map-pin-ellipse" size="18"
														color="coral" />
													<text class="button-text">发起巡查</text>
												</view>
											</view>
											<view class="item-button" @click="toWarnDangerAreaCheckList(item)">
												<view class="view-flex-inline-center">
													<uni-icons class="input-uni-icon" type="map-pin-ellipse" size="18"
														color="coral" />
													<text class="button-text">巡查信息</text>
												</view>
											</view>
											<view class="item-button" @click="onTransferRecordClick(item)">
												<view class="view-flex-inline-center">
													<uni-icons class="input-uni-icon" type="auth" size="18"
														color="coral" />
													<text class="button-text">转移登记</text>
												</view>
											</view>
											<view class="item-button" @click="onTransferResidentListClick(item)">
												<view class="view-flex-inline-center">
													<uni-icons class="input-uni-icon" type="staff" size="18"
														color="coral" />
													<text class="button-text">转移清单</text>
												</view>
											</view>
										</view>
									</uni-col>
								</uni-row>
							</view>
						</template>
					</uni-list-item>
				</uni-list>
			</uni-section>
		</view>
	</view>
</template>

<script>
	import
	navBtns
	from "@/api/home.js";
	import {
		role
	} from "@/api/role.js";
	import {
		oss
	} from '@/common/setting';
	import http from '@/http/api.js';
	export default {
		components: {

		},
		data() {
			return {
				title: '山洪灾害监测预警防御平台运维系统',
				permission: {
					'admin': false,
					'orgAdmin': false,
					'companyAdmin': false,
					'companyServciePerson': false,
					'yjServicePerson': false,
				},
				//1 运维系统  2 应急系统
				subSystem: 0,
				//功能模块： 1运维 2 应急
				menuModel: 0,
				currentRole: '',
				current: 0,
				navButton: [],
				navButtonIndex: [],
				yjNavButton: [],
				yjNavButtonIndex: [],
				//more/loading/noMore
				loadMoreStatus: "noMore",
				timer: false,
				pageSize: 10,
				pageCurrent: 1,
				total: 0,
				noticeDot: false,
				noticeValue: 0,
				//以下为运维系统参数
				unconfirmOrderList: [],
				todayEquipmentInspectionList: [],
				todayOrderProcessList: [],
				realData: {
					todayOrderProcessCount: '维修任务数量：0',
					todayIinspectionReportCount: '设备巡检数量：0',
					newCheckOrderCount: '新任务数量：0'
				},
				//以下为应急系统参数
				yjRealData: {
					warnCountSubTitle: '0',
				},
				yjWarnList: [],
				show: false,
				swipeStatus: 'none',
				systemOptions: [{
						text: '运维',
						style: {
							fontSize: '1rem',
							backgroundColor: '#007aff'
						}
					},
					{
						text: '应急',
						style: {
							fontSize: '1rem',
							backgroundColor: '#F56C6C'
						}
					},
					{
						text: '取消',
						style: {
							fontSize: '1rem',
							backgroundColor: '#223641'
						}
					}
				],
			};
		},
		computed: {
			getProcessOrder() {
				if (this.realData.rtuCount && this.realData.unconfirmOrderCount) {
					return this.realData.rtuCount - this.realData.unconfirmOrderCount;
				}
				return 0;
			}
		},
		onLoad() {
			this.permission.admin = false;
			this.permission.orgAdmin = false;
			this.permission.companyAdmin = false;
			this.permission.companyServciePerson = false;
			this.permission.yjServicePerson = false;
			this.navButton = navBtns.navButtons;
			this.yjNavButton = navBtns.yjNavButtons;
			if (this.userInfo.role_name === role.admin) {
				this.permission.admin = true;
				this.navButtonIndex = navBtns.sysAdminNavButton;
				this.currentRole = role.admin;
				// if (this.subSystem == 1) {
				// 	this.navButtonIndex = navBtns.sysAdminNavButton;
				// } else if (this.subSystem == 2) {
				// 	this.navButtonIndex = navBtns.yjServicePersonNavButton;
				// }
				this.yjNavButtonIndex = navBtns.yjAdminNavButton;
			} else if (this.userInfo.role_name === role.orgAdmin) {
				this.permission.orgAdmin = true;
				this.currentRole = role.orgAdmin;
				//if (this.subSystem == 1) {
				this.navButtonIndex = navBtns.orgAdminNavButton;
				// } else if (this.subSystem == 2) {
				// 	this.navButtonIndex = navBtns.yjServicePersonNavButton;
				// }
				this.yjNavButtonIndex = navBtns.yjAdminNavButton;
			} else if (this.userInfo.role_name === role.companyAdmin) {
				this.permission.companyAdmin = true;
				this.currentRole = role.companyAdmin;
				this.navButtonIndex = navBtns.companyAdminNavButton;
			} else if (this.userInfo.role_name === role.companyServciePerson) {
				this.permission.companyServciePerson = true;
				this.currentRole = role.companyServciePerson;
				this.navButtonIndex = navBtns.companyServicePersonNavButton;
			} else if (this.userInfo.role_name === role.yjServicePerson) {
				this.permission.yjServicePerson = true;
				this.currentRole = role.yjServicePerson;
				//this.navButtonIndex = navBtns.yjServicePersonNavButton;
				this.yjNavButtonIndex = navBtns.yjServicePersonNavButton;
			}
			let subSystemSelectInfo = uni.getStorageSync("SubSystemSelectInfo");
			this.subSystem = subSystemSelectInfo.subSystem;
			if (this.subSystem == 1) {
				//this.title = '山洪灾害监测预警防御平台运维系统';
				this.menuModel = 1;
				uni.setTabBarItem({
					"index": 1,
					"iconPath": "static/images/tabbar/workbench.png",
					"selectedIconPath": "static/images/tabbar/workbench_selected.png",
					"text": "管理工作台",
				})
			} else if (this.subSystem == 2) {
				//this.title = '山洪灾害监测预警防御平台应急系统';
				this.menuModel = 2;
				uni.setTabBarItem({
					"index": 1,
					"iconPath": "static/images/tabbar/warn.png",
					"selectedIconPath": "static/images/tabbar/warn_selected.png",
					"text": "监测预警",
				})
			}
			if (this.$u.func.checkLogin()) {
				//console.log("timer start  +++++++ ")
				this.timer = true;
				setTimeout(this.timeCall, 10000);
				this.$nextTick(() => {
					if (this.subSystem == 1) {
						this.getHomeInfo();
						if (this.currentRole == role.admin || this.currentRole == role.orgAdmin) {
							this.getYjInfo();
						}
					} else if (this.subSystem == 2) {
						this.getYjInfo();
					}
				})
			}
		},
		onUnload() {
			this.timer = false;
		},
		onReady() {
			if (this.$u.func.checkLogin()) {} else {
				this.$u.func.logout();
			}
		},
		onShow() {
			//console.log("show+++++++++")
			// let subSystemSelectInfo = uni.getStorageSync("SubSystemSelectInfo");
			// this.subSystem = subSystemSelectInfo.subSystem;
			// if (this.subSystem == 1) {
			// 	this.title = '山洪灾害监测预警防御平台运维系统';
			// 	this.menuModel = 1;
			// 	uni.setTabBarItem({
			// 		"index": 1,
			// 		"iconPath": "static/images/tabbar/workbench.png",
			// 		"selectedIconPath": "static/images/tabbar/workbench_selected.png",
			// 		"text": "管理工作台",
			// 	})
			// } else if (this.subSystem == 2) {
			// 	this.title = '山洪灾害监测预警防御平台应急系统';
			// 	this.menuModel = 2;
			// 	uni.setTabBarItem({
			// 		"index": 1,
			// 		"iconPath": "static/images/tabbar/warn.png",
			// 		"selectedIconPath": "static/images/tabbar/warn_selected.png",
			// 		"text": "监测预警",
			// 	})
			// }
			// this.permission.admin = false;
			// this.permission.orgAdmin = false;
			// this.permission.companyAdmin = false;
			// this.permission.companyServciePerson = false;
			// this.permission.yjServicePerson = false;
			// this.navButton = navBtns.navButtons;
			// this.yjNavButton = navBtns.yjNavButtons;
			// if (this.userInfo.role_name === role.admin) {
			// 	this.permission.admin = true;
			// 	this.navButtonIndex = navBtns.sysAdminNavButton;
			// 	this.currentRole = role.admin;
			// 	this.yjNavButtonIndex = navBtns.yjAdminNavButton;
			// } else if (this.userInfo.role_name === role.orgAdmin) {
			// 	this.permission.orgAdmin = true;
			// 	this.currentRole = role.orgAdmin;
			// 	this.navButtonIndex = navBtns.orgAdminNavButton;
			// 	this.yjNavButtonIndex = navBtns.yjAdminNavButton;
			// } else if (this.userInfo.role_name === role.companyAdmin) {
			// 	this.permission.companyAdmin = true;
			// 	this.currentRole = role.companyAdmin;
			// 	this.navButtonIndex = navBtns.companyAdminNavButton;
			// } else if (this.userInfo.role_name === role.companyServciePerson) {
			// 	this.permission.companyServciePerson = true;
			// 	this.currentRole = role.companyServciePerson;
			// 	this.navButtonIndex = navBtns.companyServicePersonNavButton;
			// } else if (this.userInfo.role_name === role.yjServicePerson) {
			// 	this.permission.yjServicePerson = true;
			// 	this.currentRole = role.yjServicePerson;
			// 	this.yjNavButtonIndex = navBtns.yjServicePersonNavButton;
			// }
			if (this.timer == false) {
				//console.log("set timer")
				this.timer = true;
				setTimeout(this.timeCall, 10000);
				this.$nextTick(() => {
					if (this.subSystem == 1) {
						this.getHomeInfo();
						if (this.currentRole == role.admin || this.currentRole == role.orgAdmin) {
							this.getYjInfo();
						}
					} else if (this.subSystem == 2) {
						this.getYjInfo();
					}
				})
			}
		},
		onHide() {
			this.timer = false;
		},
		methods: {
			toOss(path) {
				return oss + path;
			},
			swipeBindClick(e) {
				let that = this;
				if (e.index == 0) {
					//运维
					if (this.menuModel != 1) {
						this.$nextTick(() => {
							that.menuModel = 1;
						})
					}
				} else if (e.index == 1) {
					//应急
					if (this.menuModel != 2) {
						this.$nextTick(() => {
							that.menuModel = 2;
						})
					}
				} else if (e.index == 2) {

				}
				this.$refs.swipeAction.closeAll();
			},
			onSwipeOpened() {
				if (this.swipeStatus === 'none') {
					this.swipeStatus = 'right';
					return;
				}
				if (this.swipeStatus === 'right') {
					this.swipeStatus = 'none';
					return;
				}
			},
			swipeChange(e) {
				this.swipeStatus = e;
			},
			timeCall() {
				if (this.timer == true) {
					if (this.subSystem == 1) {
						if (this.menuModel == 1) {
							this.getHomeInfo();
						} else if (this.menuModel == 2) {
							this.getYjInfo();
						}
					} else if (this.subSystem == 2) {
						this.getYjInfo();
					}
					setTimeout(this.timeCall, 10000);
				}
			},
			//跳转到工作台
			onRtuManageViewClick() {
				var url = '/pages/rtu-manage/rtumanage';
				uni.switchTab({
					url: url
				})
			},
			//查看设备异常信息
			onWarningRtuViewClick() {
				var url = '/pages/warning/warninglist';
				uni.navigateTo({
					url: url
				})
			},
			//跳转到维修任务
			onAllCheckOrderClick() {
				var url = '/pages/check-order/checkorderlist';
				uni.navigateTo({
					url: url
				})
			},
			//查看未确认维修任务
			onUncomfirecheckorderViewClick() {
				var url = '/pages/check-order/uncomfirecheckorderlistview';
				uni.navigateTo({
					url: url
				})
			},
			onProcessCheckorderViewClick() {
				var url = '/pages/check-order/processcheckorderlistview';
				uni.navigateTo({
					url: url
				})
			},
			onReportCheckorderViewClick() {
				if (this.permission.admin || this.permission.orgAdmin) {
					let url = '/pages/check-order/companycheckorderlist?type=4';
					uni.navigateTo({
						url: url
					})
				} else {
					let url = '/pages/check-order/servicepersoncheckorderlist?type=3';
					uni.navigateTo({
						url: url
					})
				}
			},
			//查看超时未确认维修任务
			onComfiredelaycheckorderClick() {
				var url = '/pages/check-order/comfiredelaycheckorderlist';
				uni.navigateTo({
					url: url
				})
			},
			onOrderReportItemClick(id) {
				//console.log("opne record ", id)
				var url = '/pages/check-order/orderprocessreportdetail?orderId=' + id;
				uni.navigateTo({
					url: url
				})
			},
			onNoticeMoreClick() {
				uni.navigateTo({
					url: '/pages/news/noticelist'
				})
			},
			onMoreTodayCheckOrderReportClick() {
				uni.navigateTo({
					url: '/pages/check-order/todaycheckorderrprocesseportlist'
				})
			},
			onOrderItemClick(id) {
				let url =
					'/pages/check-order/orderconfirm?id=' + id;
				uni.navigateTo({
					url: url
				})
			},
			//跳转到待巡检页面
			onInspectionManageClick() {
				var url = '/pages/equipment-inspection/inspectionlist';
				uni.navigateTo({
					url: url
				})
			},
			onFinishedBeforeRainInspectionClick() {
				var url = '/pages/equipment-inspection/finishedinspectionreportlist?rainSeasonKind=1';
				uni.navigateTo({
					url: url
				})
			},
			onFinishedRainFirstInspectionClick() {
				var url = '/pages/equipment-inspection/finishedinspectionreportlist?rainSeasonKind=2';
				uni.navigateTo({
					url: url
				})
			},
			onFinishedRainSecondInspectionClick() {
				var url = '/pages/equipment-inspection/finishedinspectionreportlist?rainSeasonKind=3';
				uni.navigateTo({
					url: url
				})
			},
			onMoreTodayInspectionReportInfoClick() {
				uni.navigateTo({
					url: '/pages/equipment-inspection/todayinspectionreportlist'
				})
			},
			onInspectionItemClick(id, rainSeasonKind) {
				//console.log("onInspectionItemClick " + id)
				var url = '/pages/equipment-inspection/inspectionreportview?id=' + id + "&type=" + rainSeasonKind;
				uni.navigateTo({
					url: url
				})
			},
			onMoreUncomfireCheckOrderClick() {
				uni.navigateTo({
					url: '/pages/check-order/uncomfirecheckorderlist'
				})
			},
			getHomeInfo() {
				let that = this;
				http.request({
					url: '/galaxy-business/home/real/info',
					method: 'GET'
				}).then(res => {
					if (res && res.success) {
						that.realData = res.data;
						that.realData['processOrderCount'] = that.realData.processCheckOrderCount;
						that.realData['todayOrderProcessCount'] = '今日已处理任务数量：' + that.realData
							.todayOrderProcessCount;
						that.realData['todayIinspectionReportCount'] = '今日已巡检数量：' + that.realData
							.todayIinspectionReportCount;
						that.realData['newCheckOrderCount'] = '新任务数量：' + that.realData
							.unconfirmOrderCount;
						if (that.realData.hasNewNotice) {
							that.noticeDot = true;
							that.noticeValue = that.realData.newNoticeCount;
						} else {
							that.noticeDot = false;
							that.noticeValue = 0;
						}
						that.getTodayOrderProcessList();
						that.getTodayInspectionReport();
						if (that.permission.companyServciePerson) {
							//console.log("companyServciePerson")
							that.getUnconfirmOrderList();
						}
					}
				}).catch(err => {
					console.log(JOSN.stringify(err))
				})
			},
			getUnconfirmOrderList() {
				let that = this;
				let postData = {};
				http.request({
					url: '/galaxy-business/rtu/check/order/unconfirm/last/list',
					method: 'GET',
					data: postData,
				}).then(res => {
					if (res.data != null) {
						that.unconfirmOrderList = res.data;
						if (that.realData.unconfirmOrderCount > 0) {
							if (that.realData.unconfirmOrderCount > that.unconfirmOrderList.length) {
								that.loadMoreStatus = "more";
							} else {
								that.loadMoreStatus = "load";
							}
						} else {
							that.loadMoreStatus = "noMore";
						}
					}
				}).catch(err => {
					console.log(JOSN.stringify(err))
				})
			},
			getTodayOrderProcessList() {
				const that = this;
				http.request({
					url: '/galaxy-business/rtu/check/order/process/today/list',
					method: 'GET'
				}).then(res => {
					that.todayOrderProcessList = [];
					if (res.data != null && res.data.length > 0) {
						that.todayOrderProcessList.push(res.data[0]);
					}
				}).catch(err => {
					console.log(JOSN.stringify(err))
				})
			},
			getTodayInspectionReport() {
				const that = this;
				http.request({
					url: '/galaxy-business/equipment/inspection/report/today/list',
					method: 'GET'
				}).then(res => {
					that.todayEquipmentInspectionList = [];
					if (res.data != null && res.data.length > 0) {
						that.todayEquipmentInspectionList.push(res.data[0]);
					}
				}).catch(err => {
					console.log(JOSN.stringify(err))
				})
			},
			//以下为应急系统代码
			toDangerAreaResidentRecord() {
				uni.navigateTo({
					url: '/pages/yjxt/resident/dangerarearesidentrecord',
				})
			},
			toDangerAreaCheck() {
				uni.navigateTo({
					url: '/pages/yjxt/check/dangerareacheck?type=1&id='
				})
			},
			toDangerAreaCheckList() {
				uni.navigateTo({
					url: '/pages/yjxt/check/dangerareachecklist?type=1&warnId='
				})
			},
			toWarnDangerAreaCheckList(item) {
				let url = '/pages/yjxt/check/dangerareachecklist?type=2&warnId=' + item.warnId;;
				uni.navigateTo({
					url: url
				})
			},
			onMoreYjWarnClick() {
				uni.navigateTo({
					url: '/pages/yjxt/warn/yjwarnlist'
				})
			},
			onDangerAreaCheckClick(item) {
				let url =
					'/pages/yjxt/check/dangerareacheck?type=2&warnId=' + item.warnId + '&warnAdcd=' + item.warnAdcd;
				uni.navigateTo({
					url: url
				})
			},
			onTransferRecordClick(item) {
				let url = '/pages/yjxt/transfer/residenttransferrecord?id=' + item.warnId;
				uni.navigateTo({
					url: url
				})
			},
			onTransferResidentListClick(item) {
				let url = '/pages/yjxt/transfer/transferresidentlist?id=' + item.warnId;
				uni.navigateTo({
					url: url
				})
			},
			getYjInfo() {
				let that = this;
				let params = {};
				params['warnStatus'] = 5;
				const current = this.pageCurrent;
				const size = this.pageSize;
				http.request({
					url: '/galaxy-business/yj/warn/page',
					method: 'GET',
					params: {
						current,
						size,
					},
					data: params,
				}).then(res => {
					if (res.data.records != null) {
						that.yjWarnList = res.data.records;
					}
					let total = res.data.total;
					if (total > 0) {
						if (total > that.pageSize) {
							that.loadMoreStatus = "more";
						} else {
							that.loadMoreStatus = "load";
						}
						that.yjRealData.warnCountSubTitle = total;
					} else {
						that.loadMoreStatus = "noMore";
						that.yjRealData.warnCountSubTitle = "0";
					}
				}).catch(err => {
					console.log(err)
				})
			},
			toWarnDetailView(item) {
				uni.navigateTo({
					url: '/pages/yjxt/warn/yjwarndetail?id=' + item.id
				})
			},
			toFullQrImage(item) {
				uni.navigateTo({
					url: '/pages/yjxt/warn/yjwarnqr?id=' + item.id
				})
			},
		}
	};
</script>

<style lang="scss" scoped>
	$nav-height: 75px;

	.decoration {
		width: 6px;
		height: 6px;
		margin-right: 4px;
		border-radius: 50%;
		background-color: cadetblue;
	}

	.item-block {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		width: 100%;
	}

	.line {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		width: 100%;
	}

	.line .block {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.line-end {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		width: 100%;
	}

	.line-end .block {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.line-center {
		display: flex;
		flex-direction: row;
		justify-content: center;
		width: 100%;
		height: 100%;
	}

	.line-center .block {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.rtu-name {
		margin-left: 5rpx;
		font-size: 0.7rem;
		font-weight: bold;
	}

	.rtu-code {
		margin-left: 5rpx;
		font-size: 0.6rem;
		color: gray;
	}

	.item-text-line {
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: flex-start;
		padding-left: 0px;
		padding-right: 0px;

		.block {
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
		}

		.item-title {
			font-size: 0.7rem;
		}

		.item-text {
			padding-left: 2px;
			padding-right: 5px;
			font-size: 0.7rem;
		}

		.item-text-ell {
			width: 100%;
			overflow: hidden;
			font-size: 0.7rem;
			white-space: nowrap;
			text-overflow: ellipsis;
		}

		.item-number {
			font-size: 0.7rem;
			margin-left: 2px;
			margin-right: 5px;
		}
	}

	.item-title-image {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		margin-right: 5px;
		width: 20px;
		height: 20px;
		border-radius: 50%;
	}

	.uni-badge-left-margin {
		margin-left: 0px;
	}

	.logo {
		flex-shrink: 0;
		width: 100rpx;
		height: auto;
	}

	.container {
		background-color: #f7f7f7;
		min-height: 100vh;
		overflow: hidden;

	}

	.nav {
		margin: 0rpx 0;
		box-sizing: border-box;
		padding: 0 10rpx;
		background-color: white;

		&-item {
			width: 100%;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: space-between;
			height: 130rpx;

			&-img {
				width: 80rpx;
				height: 80rpx;
			}

			&-name {
				font-size: 0.7rem;
				font-family: PingFang SC;
				font-weight: 500;
				color: #585b61;
			}
		}
	}
</style>