<template>
	<view>
		<cu-custom bgColor="bg-gradual-blueness" :isBack="true" :isRingt="true">
			<block slot="backText">返回</block>
			<block slot="content">动火作业管理</block>
		</cu-custom>
		<view class="apps-box">
			<view class="apps-row">
				<view class="apps-title">
					<text class="apps-title-line"></text>
					<text>动火台账</text>
				</view>
				<view class="apps-warp">
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/list/list">
						<view class="imgs action">
						  <image src="../../../../static/icon-apps/icon-902.png" mode=""></image>
						</view>
						<view class="text-semi" style="text-align: center;">
						  <view>动火台账</view>
						</view>
					</navigator>
				</view>
			</view>
			<view class="apps-row">
				<view class="apps-title">
					<text class="apps-title-line"></text>
					<text>动火申请审批</text>
				</view>
				<view class="apps-warp">
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/apply/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-yxkj-1.png" mode=""></image>
							<view v-if="hotCount[0]>0" class="cu-tag badge">{{hotCount[0]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>动火作业</view>
							<view>申请管理</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/unit-principal/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-zl-9.png" mode=""></image>
							<view v-if="hotCount[1]>0" class="cu-tag badge">{{hotCount[1]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>动火单位</view>
							<view>负责人确认</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/contracting-unit/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-yxkj-4.png" mode=""></image>
							<view v-if="hotCount[2]>0" class="cu-tag badge">{{hotCount[2]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>项目发包</view>
							<view>单位签发</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/on-site-jurisdiction/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-904.png" mode=""></image>
							<view v-if="hotCount[3]>0" class="cu-tag badge">{{hotCount[3]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>现场管辖单位</view>
							<view>负责人审核</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/hot-work-permit-unit/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-807.png" mode=""></image>
							<view v-if="hotCount[4]>0" class="cu-tag badge">{{hotCount[4]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>动火许可</view>
							<view>签发单位</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/hot-work-safety-unit/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-807.png" mode=""></image>
							<view v-if="hotCount[5]>0" class="cu-tag badge">{{hotCount[5]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>安全总监</view>
							<view>审批</view>
						</view>
					</navigator>

				</view>
			</view>
			<view class="apps-row">
				<view class="apps-title">
					<text class="apps-title-line"></text>
					<text>动火许可及操作</text>
				</view>
				<view class="apps-warp">
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/hot-work-isued-unit/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-807.png" mode=""></image>
							<view v-if="hotCount[6]>0" class="cu-tag badge">{{hotCount[6]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>动火许可证</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/hot-work-before-unit-leader/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-807.png" mode=""></image>
							<view v-if="hotCount[7]>0" class="cu-tag badge">{{hotCount[7]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>动火前现场</view>
							<view>管辖单位确认</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/site-leader/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-905.png" mode=""></image>
							<view v-if="hotCount[8]>0" class="cu-tag badge">{{hotCount[8]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>现场负责人</view>
							<view>确认</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/hot-work-after-unit-leader/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-807.png" mode=""></image>
							<view v-if="hotCount[9]>0" class="cu-tag badge">{{hotCount[9]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>动火后现场</view>
							<view>管辖单位确认</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/delay-fire-monitoring/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-zl-4.png" mode=""></image>
							<view v-if="hotCount[10]>0" class="cu-tag badge">{{hotCount[10]}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>延时监火</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/archive/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-902.png" mode=""></image>
							<!--						  <view v-if="hotCount[11]>0" class="cu-tag badge">{{hotCount[11]}}</view>-->
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>归档管理</view>
						</view>
					</navigator>
					<navigator class="apps-item" hover-class="none" url="/pages/application/eight-assignments/hotwork/gasAnalysis/list">
						<view class="imgs action">
							<image src="../../../../static/icon-apps/icon-902.png" mode=""></image>
							<view v-if="myGasAnaly>0" class="cu-tag badge">{{myGasAnaly}}</view>
						</view>
						<view class="text-semi" style="text-align: center;">
							<view>气体分析</view>
						</view>
					</navigator>
				</view>
			</view>
			<view class="cu-tabbar-height"></view>
		</view>
	</view>
</template>

<script>
	import {
		basePath,
		corpinfoId,
		loginUser,
	} from '@/common/tool.js';
	export default {
		data() {
			return {
				hotCount :[0,0,0,0,0,0,0,0,0,0,0,0,0,0] ,
				myGasAnaly:0
			};
		},
		onShow() {
			this.getData();
		},
		methods: {
			getData(){
				var _this = this;
				uni.showLoading({
					title:"加载中..."
				});//加载中动画
				uni.request({
					url: basePath +'/app/hotworkapplication/getCountByMyApproval',
					method: 'POST',
					dataType: 'json',
					header: {
						'Content-type':'application/x-www-form-urlencoded'
					},
					data: {
						CORPINFO_ID:corpinfoId,
						USER_ID:loginUser.USER_ID,
						tm:new Date().getTime()
					},
					success: (res) => {
						_this.hotCount =[0,0,0,0,0,0,0,0,0,0,0,0,0,0]
						uni.hideLoading();//结束加载中动画
						if ("success" == res.data.result) {
							if(res.data.myGasAnaly.count){
								_this.myGasAnaly = res.data.myGasAnaly.count
							}
							for (let i in res.data.varList) {
								let item = res.data.varList[i];
								let itemCout = item.count
								let itemState = item.STATE
								if(itemCout >0){
									_this.hotCount[itemState] = itemCout
								}
							}
							this.$forceUpdate();
						}
					}
				})
			},
		}
	}
</script>

<style>
	.app-banner{
		width: 100%;
		height: 380upx;
	}
	.app-banner image{
		width: 100%;
		height: 100%;
	}
.apps-box {}

	.apps-row {
		padding: 20upx 20upx 10upx 20upx;
		background-color: #fff;
		margin-top: 20upx;
	}
	.apps-row:first-child{
		margin-top: 0;
	}

	.apps-title {
		position: relative;
		padding-left: 20upx;
		color: #989898;
		padding-bottom: 20upx;
	}

	.apps-title-line {
		display: inline-block;
		background-color: #37a6ff;
		width: 10upx;
		height: 23upx;
		position: absolute;
		left: 0upx;
		top: 11upx;
	}

	.apps-warp {
		display: flex;
		flex-wrap: wrap;
	}

	.apps-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 25%;
		font-size: 25upx;
		margin-bottom: 20upx;
	}
	.apps-item .text-semi{
		margin-top: 6upx;
	}
	.apps-item .action{
		position: relative;
	}
	.apps-item .action .cu-tag.badge{
		right: -20upx;
	}
	.apps-item .imgs {
		width: 50upx;
		height: 50upx;
	}

	.apps-item .imgs image {
		width: 100%;
		height: 100%;
	}
</style>
