<template>
	<view>
		<view class="top">
			<image src="./icon/top.gif" mode="widthFix"></image>
		</view>
		<view class="content">
			<view class="segmented-control-x">
				<view class="segmented">
					<view class="title" :class="active==index?'active':''" v-for="(item,index) in nav" :key="index"
						@click="change_active(index)">
						{{item.title}}
					</view>
				</view>
				<view class="segmented-inner">
					<view class="nav" v-for="(item,index) in nav[active].list" :key="index" @click="navigator(item)">
						<view class="icon">
							<image :src="item.icon" mode=""></image>
						</view>
						<view class="name">{{item.name}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "t-p-zaoquan",
		data() {
			return {
				mine: "640181B0011010037723",
				org_num: "1014",
				mine_code: "zaoquan",

				active: 0,
				nav: [{
						title: "智能监测",
						list: [{
								icon: require("./icon/icon_2.png"),
								module: "rydw",
								name: "人员定位"
							},
							{
								icon: require("./icon/icon_3.png"),
								module: "aqjc",
								name: "安全监测"
							},
							{
								icon: require("./icon/icon_4.png"),
								module: "spjk",
								name: "视频监控"
							},

							// {
							// 	icon: require("./icon/icon_6.png"),
							// 	module: "scbb",
							// 	name: "生产报表"
							// }, {
							// 	icon: require("./icon/icon_7.png"),
							// 	module: "kjscl",
							// 	name: "矿井水处理"
							// }
						]
					},
					{
						title: "智能采煤",
						list: [{
								icon: require("./icon/sc_sj.png"),
								module: "zncm",
								name: "220707新智能综采",
								sys_code: ""
							}, {
								icon: require("./icon/sc_sj.png"),
								module: "zncm",
								name: "乳化泵",
								sys_code: "ruhuabeng"
							}, {
								icon: require("./icon/sc_sj.png"),
								module: "zncm",
								name: "采煤机",
								sys_code: "caimeiji"
							},
							{
								icon: require("./icon/sc_sj.png"),
								module: "zncm",
								name: "液压支架",
								sys_code: "yeyazhijia"
							}, {
								icon: require("./icon/sc_sj.png"),
								module: "zncm",
								name: "三机",
								sys_code: "sanji"
							}
						]
					},
					{
						title: "智能掘进",
						list: [{
							icon: require("./icon/sc_sj.png"),
							module: "znjj",
							name: "150201工作面胶带巷",
							sys_code: ""
						}]
					},
					{
						title: "供配电",
						list: [{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "五分区1200变电所",
								sys_code: "5fq1200"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "五分区950变电所",
								sys_code: "5fq950"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "22采区变电所-低压",
								sys_code: "22high"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "980变电所",
								sys_code: "980"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "1000变电所",
								sys_code: "1000low"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "1142变电所",
								sys_code: "1142"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "720变电所",
								sys_code: "720"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "880变电所",
								sys_code: "880"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "950变电所",
								sys_code: "950"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "929变电所",
								sys_code: "929"
							},
							{
								icon: require("./icon/chart.png"),
								module: "zngd",
								name: "22采区变电所-高压",
								sys_code: "22gy"
							},

						]
					},
					{
						title: "供排水",
						list: [{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "智能排水",
								sys_code: ""
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "5000方水池监控",
								sys_code: "5000"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "720水泵房",
								sys_code: "720"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "880水泵房",
								sys_code: "880"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "929水泵房",
								sys_code: "929"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "950水泵房",
								sys_code: "950"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "980水泵房",
								sys_code: "980"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "五分区950水泵房",
								sys_code: "5fq"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "清水泵房",
								sys_code: "qsb"
							},
							{
								icon: require("./icon/sc_paishui.png"),
								module: "znps",
								name: "正1000水泵房",
								sys_code: "p1000"
							}
						]
					},
					{
						title: "主运输",
						list: [{
							icon: require("./icon/sc_yunshu.png"),
							module: "zys",
							name: "主运输"
						}]
					},
					{
						title: "辅助运输",
						list: [{
							icon: require("./icon/sc_yeyazhijia.png"),
							module: "jkcr",
							name: "东井架空乘人器"
						}]
					},
					{
						title: "压风制氮",
						list: [{
								icon: require("./icon/sc_zhidan.png"),
								module: "yfzd",
								name: "1314压风制氮",
								sys_code: "1314"
							},
							{
								icon: require("./icon/sc_zhidan.png"),
								module: "yfzd",
								name: "12采区压风制氮",
								sys_code: "12"
							}
						]
					},
					{
						title: "智能通风",
						list: [{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "智能通风",
								sys_code: ""
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "东井通风",
								sys_code: "east"
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "西井通风",
								sys_code: "west"
							}, {
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "五分区通风机",
								sys_code: "5fq"
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "1314通风机",
								sys_code: "1314"
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "15201回风巷通风机",
								sys_code: "1200sm"
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "15201机巷通风机",
								sys_code: "1200car"
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "220708辅助巷通风机",
								sys_code: "220708fzx"
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "220708回风巷通风机",
								sys_code: "220708hfx"
							},
							{
								icon: require("./icon/sc_tongfeng.png"),
								module: "zntf",
								name: "13207机巷通风机",
								sys_code: "13207jx"
							},
						]
					},
					{
						title: "智慧园区",
						list: [{
								icon: require("./icon/icon_5.png"),
								module: "zncs",
								name: "地面车辆监测",
								sys_code: ""
							},
							{
								icon: require("./icon/icon_5.png"),
								module: "zncs",
								name: "井下车辆监测",
								sys_code: "downhole"
							},
							{
								icon: require("./icon/sc_zhidan.png"),
								module: "ycjc",
								name: "扬尘监测"
							},
							{
								icon: require("./icon/icon_6.png"),
								module: "zncdz",
								name: "智能充电桩"
							}
						]
					}
				],

			};
		},
		methods: {
			change_active(index) {
				this.active = index

				uni.pageScrollTo({
					scrollTop: 0,
					duration: 150
				});
			},
			navigator(item) {
				uni.showLoading({
					mask: true,
					title: "载入中..."
				})
				this.$p_api.product_data_query_power({
					staff_num: uni.getStorageSync('user').staff_num,
					data_module: item.module
				}).then((res) => {
					uni.hideLoading()
					if (res.data.content.status) {
						// 具备权限进入对应系统
						this.navigator_handler(item)
					} else {
						uni.showToast({
							icon: "none",
							title: "没有查看权限！"
						})
					}
				})
			},
			navigator_handler(item) {
				// 人员定位
				if (item.module == 'rydw') {
					uni.navigateTo({
						url: "../../production/personnel_orientation/personnel_orientation?mine=" + this.mine
					})
				}
				// 安全监测
				if (item.module == 'aqjc') {
					uni.navigateTo({
						url: "../../production/safety_monitoring/safety_monitoring?mine=" + this.mine
					})
				}
				// 视频监控
				if (item.module == 'spjk') {
					uni.navigateTo({
						url: "../../production/video_monitor/video_monitor?mine_code=" + this.mine_code
					})
				}
				// 生产报表
				if (item.module == 'scbb') {
					uni.navigateTo({
						url: "../../production/production_report/production_report?mine=" + this.mine +
							"&org_num=" + this.org_num,
					})
				}
				// 矿井水处理
				if (item.module == 'kjscl') {
					uni.navigateTo({
						url: "../../production/zaoquan/mine_water_treatment/mine_water_treatment?mine_code=" + this
							.mine_code
					})
				}
				// 智能采煤
				if (item.module == 'zncm') {
					if(item.sys_code == ''){
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/coal_mining/coal_mining"
						})
					}
					if(item.sys_code == 'ruhuabeng'){
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/coal_mining/emulsion_pump/emulsion_pump"
						})
					}
					if(item.sys_code == 'caimeiji'){
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/coal_mining/shearer/shearer"
						})
					}
					if(item.sys_code == 'yeyazhijia'){
						uni.navigateTo({
							url: "../../production/unified_automation_system/support/support?title=液压支架&sys_code=main"
						})
						
					}
					if(item.sys_code == 'sanji'){
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/coal_mining/sanji/sanji"
						})
					}
				}
				// 智能综掘
				if (item.module == 'znjj') {
					uni.navigateTo({
						url: "../../production/zaoquan/control_platform/driving/driving"
					})
				}
				// 压风制氮
				if (item.module == 'yfzd') {
					uni.navigateTo({
						url: "../../production/zaoquan/control_platform/air_nitrogen/air_nitrogen?title=" + item
							.name + "&sys_code=" + item.sys_code
					})
				}
				// 供配电
				if (item.module == 'zngd') {
					uni.navigateTo({
						url: "../../production/zaoquan/control_platform/substation/detail/detail?title=" + item
							.name + "&type=" + item.sys_code
					})
				}
				// 供排水
				if (item.module == 'znps') {
					if (item.sys_code == '') {
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/drainage/drainage"
						})
					} else if (item.sys_code == '5000') {
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/drainage/pool/pool?title=" + item
								.name + "&sys_code=" + item.sys_code
						})
					} else {
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/drainage/pump_house/pump_house?title=" +
								item.name + "&sys_code=" + item.sys_code
						})
					}
				}
				// 智能通风
				if (item.module == 'zntf') {
					if (item.sys_code == '') {
						uni.navigateTo({
							url: "../../production/zaoquan/control_platform/ventilate/ventilate"
						})
					} else {
						let zhutongfeng = ["east", "west", "1314", "5fq"]
						if (zhutongfeng.includes(item.sys_code)) {
							uni.navigateTo({
								url: "../../production/zaoquan/control_platform/ventilate/main_ventilation/main_ventilation" +
									"?title=" + item.name + "&sys_code=" + item.sys_code
							})
						} else {
							uni.navigateTo({
								url: "../../production/zaoquan/control_platform/ventilate/local_ventilation/local_ventilation" +
									"?title=" + item.name + "&sys_code=" + item.sys_code
							})
						}
					}
				}
				// 智能测速
				if (item.module == 'zncs') {
					if (item.sys_code == '') {
						uni.navigateTo({
							url: "../../production/zaoquan/vehicle_monitoring/speed_alarm/speed_alarm"
						})
					} else {
						uni.navigateTo({
							url: "../../production/zaoquan/vehicle_monitoring/vehicle_monitoring"
						})
					}
				}
				// 主运输
				if (item.module == 'zys') {
					uni.navigateTo({
						url: "../../production/zaoquan/control_platform/transport/transport"
					})
				}
				// 架空乘人器
				if (item.module == 'jkcr') {
					uni.navigateTo({
						url: "../../production/zaoquan/control_platform/aerial/aerial"
					})
				}
				// 扬尘监测
				if (item.module == 'ycjc') {
					uni.navigateTo({
						url: "../../production/zaoquan/control_platform/dust_emission/dust_emission"
					})
				}
				// 智能充电桩
				if (item.module == 'zncdz') {
					uni.navigateTo({
						url: "../../production/zaoquan/control_platform/charging_station/charging_station"
					})
				}
			}

		}
	}
</script>

<style lang="scss">
	page {
		background: linear-gradient(to bottom, #E4F8FF, #F3F5F9);
		background-color: #F3F5F9;
	}

	.top {
		image {
			width: 750rpx;
		}
	}

	.content {
		padding-bottom: 60rpx;
		background-color: #F3F5F9;

		.segmented-control-x {
			display: flex;
			justify-content: space-between;
			.segmented {
				margin-right: 20rpx;
				flex: 1.2;
				background-color: #FFF;
				border-radius: 0 20rpx 20rpx 0;
				overflow: hidden;

				.title {
					padding: 30rpx;
					font-size: 34rpx;
					font-weight: 700;
					text-align: center;
					line-height: 1.5;
					color: #999;
				}

				.active {
					background-color: #F3F5F9;
					color: #000;
				}
			}

			.segmented-inner {
				background-color: #FFF;
				flex: 2;
				border-radius: 20rpx 0 0 20rpx;
				overflow: hidden;
				box-sizing: border-box;
				padding: 40rpx 20rpx;

				display: grid;
				grid-template-columns: repeat(2, 1fr);
				grid-auto-rows: 200rpx;
				gap: 20rpx;

				.nav {
					text-align: center;

					.icon {
						margin-bottom: 10rpx;

						image {
							width: 80rpx;
							height: 80rpx;
						}
					}

					.name {
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						overflow: hidden;
						text-overflow: ellipsis;
						font-weight: 700;
						line-height: 1.5;
						font-size: 28rpx;
					}
				}
			}
		}
	}
</style>