<template>
	<!-- <section class="bottom-modules modules"> -->
	<!-- <section class="header">
            <article class="posi">
                <MOSTY.Assort title="" />
            </article>
            <section class="tabs">
                <article v-for="(item, index) in listData" :key="index" :class="{ 'active': actives == item.id }"
                    @click="handleTabs(item.id)">{{ item.title }}</article>
            </section>
        </section> -->
	<section class="m-content">
		<!-- <el-divider style="margin: 0 !important;" /> -->
		<section class="m-top">
			<section class="m-tl" @click="handleGoToPage('/dutyBook/jgryandzz/gljgandrypz', '安全管理机构和人员')">
				<h3>{{ statisticalData?.aqyInfo?.zzCount || 0 }}人</h3>
				<span>专职安全管理队伍</span>
			</section>
			<el-divider direction="vertical" />
			<section class="m-tr" @click="handleGoToPage('/dutyBook/jgryandzz/zrs', '责任书')">
				<section class="title-bj">安全责任书</section>
				<section class="tr-content">
					<section class="tr-content-tab">
						<h3>{{ statisticalData?.zrsInfo?.yqd || 0 }}<span style="font-size:12px">人</span></h3>
						<span>已签</span>
					</section>
					<section class="tr-content-tab">
						<h3>{{ statisticalData?.zrsInfo?.wqd || 0 }}<span style="font-size:12px">人</span></h3>
						<span>未签</span>
					</section>
				</section>
			</section>
			<section class="box-logo">
				<img :src="getImagePath('Mask_group_home.png')" />
			</section>
		</section>
		<section class="m-bottom">
			<section class="m-list" v-for="(item, index) in basicManage.list" :key="index"
				@click="handleGoToPage(item.url, item.name)">
				<section>
					<img style="width: 50px; height: 50px" :src="item.icon" />
				</section>
				<section>
					<article class="m-list-r">
						<span>{{ item.num }}</span>
						<h3>{{ item.title }}</h3>
					</article>
				</section>
			</section>
		</section>
	</section>
	<!-- </section> -->
</template>

<script setup>
import * as MOSTY from "@/components/MyComponents/index";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { getImgUrl } from "@/utils/tools.js"
const router = useRouter();
const store = useStore();
import { getApi } from "@/api/tobAcco_api.js";
import { ref, reactive, onMounted } from 'vue'
const getImagePath = (src) => {
	return 'assets/indexImages/' + src
};
const basicManage = ref({
	list: [
		{ title: '场所', dm: 'cs', num: 0, icon: getImagePath('gzt/image_4.png'), name: '场所管理', url: '/dm/site/yxkzgl/csbwgl/csxx' },
		{ title: '建筑物', dm: 'jzw', num: 0, icon: getImagePath('gzt/image_4.png'), name: '场所管理', url: '/dm/site/yxkzgl/csbwgl/csxx' },
		{ title: '重点部位', dm: 'zdbw', num: 0, icon: getImagePath('gzt/image_5.png'), name: '重点部位', url: '/cs/yxkzgl/xfaq/xfzdbw' },
		{ title: '车辆', dm: 'cl', num: 0, icon: getImagePath('gzt/image_6.png'), name: '车辆信息管理', url: '/dm/yxkzgl/jtaq/cl/clgl' },
		{ title: '驾驶员', dm: 'jsy', num: 0, icon: getImagePath('gzt/image_7.png'), name: '驾驶员信息管理', url: '/dm/yxkzgl/jsygl/jsygl' },
		{ title: '特种设备', dm: 'tzsb', num: 0, icon: getImagePath('gzt/image_8.png'), name: '特种设备', url: '/dm/equipment/specialType' },
		{ title: '安防器材', dm: 'afqc', num: 0, icon: getImagePath('gzt/image.png'), name: '安防器材', url: '/dm/equipment/afsbss/safety' },
		{ title: '消防器材', dm: 'xfqc', num: 0, icon: getImagePath('gzt/image.png'), name: '消防器材', url: '/dm/equipment/xfsbss/safety' },
		{ title: '生产设备', dm: 'scsb', num: 0, icon: getImagePath('gzt/image_8.png'), name: '生产设备设施', url: '/dm/equipment/production' },
		{ title: '变配电设备', dm: 'bpd', num: 0, icon: getImagePath('gzt/image_8.png'), name: '变配电设备设施', url: '/dm/equipment/distribution' },
	]
})
// const listData = ref([
// 	{ title: '基础管理', id: 1 },
// 	{ title: '岗位达标', id: 2 },
// 	{ title: '安全教育培训', id: 3 },
// 	{ title: '应急演练', id: 4 },
// ])
const actives = ref(1)
const statisticalData = ref({

})
onMounted(() => {
	queryData()
})
// const handleTabs = _index => {
// 	actives.value = _index
// }
const queryData = () => {
	getApi({}, `/mosty-jcgl/basicData/basicStatisticsCount`).then((res) => {
		statisticalData.value = res
		let _cl = basicManage.value.list.find(v => v.dm == 'cl')
		let _jzw = basicManage.value.list.find(v => v.dm == 'jzw')
		let _zdbw = basicManage.value.list.find(v => v.dm == 'zdbw')
		let _cs = basicManage.value.list.find(v => v.dm == 'cs')
		let _jsy = basicManage.value.list.find(v => v.dm == 'jsy')
		let _tzsb = basicManage.value.list.find(v => v.dm == 'tzsb')
		let _afqc = basicManage.value.list.find(v => v.dm == 'afqc')
		let _xfqc = basicManage.value.list.find(v => v.dm == 'xfqc')
		let _scsb = basicManage.value.list.find(v => v.dm == 'scsb')
		let _bpd = basicManage.value.list.find(v => v.dm == 'bpd')
		_cl.num = res['carInfo'].total
		_jzw.num = res['jzwInfo'].total
		_zdbw.num = res['xfzdbwInfo'].total
		_jsy.num = res['driverInfo'].total
		_tzsb.num = res['tzsbInfo'].total
		_afqc.num = res['aqqcInfo'].af
		_xfqc.num = res['aqqcInfo'].xf
		_scsb.num = res['scsbssInfo'].total
		_bpd.num = res['bpdsbInfo'].total
		_cs.num = res['csInfo'].sceneOfAllNum
	});
}
const handleGoToPage = (_url, _title) => {
	if (_url) {
		store.commit(
			"app/addTagsViewList",
			{
				fullPath: _url,
				meta: {
					meta: {
						title: _title
					}
				},
				name: _url,
				params: {},
				path: _url,
				query: {},
				title: _title
			},
			{
				immediate: true
			}
		);
		router.push(_url)
	}
}
</script>
<style scoped lang="scss">
// @import '../../style/index.scss';

.m-content {
	width: 100%;
	height: 130px;
	display: flex;
}

.m-top {
	display: flex;
	position: relative;
	align-items: center;
	justify-content: space-between;
	// margin-top: 6px;
	margin-right: 6px;
	width: 25%;
	height: 130px;
	background: linear-gradient(135deg, #048086 0%, #63AFB2 100%);
	border-radius: 5px 5px 5px 5px;

	.m-tl {
		// background: url("~@/assets/images/jcgl_bj.png") no-repeat center center;
		// background-size: 100%;
		flex: 3;
		height: 102px;
		padding: 25px 16px 26px 12px;
		box-sizing: border-box;
		color: #fff;
		cursor: pointer;

		>h3 {
			font-size: 22px;
			margin: 0;
			height: 24px;
		}

		>span {
			margin-top: 12px;
			font-size: 12px;
			display: block;
		}
	}

	.m-tr {
		flex: 5;
		height: 102px;
		// background: rgba(25, 138, 255, 0.04);
		// border: 1px solid rgba(25, 138, 255, 0.6);
		border-radius: 6px;
		color: #fff;
		margin-left: 5px;
		cursor: pointer;

		.title-bj {
			// background: url("~@/assets/images/jcgl_bj2.png") no-repeat top center;
			// background-size: 100%;
			width: 100%;
			height: 34px;
			font-size: 16px;
			text-align: center;
			line-height: 34px;
		}

		.tr-content {
			height: 32px;
			margin-top: 12px;
			display: flex;
			justify-content: space-between;
			padding: 0 30px;
			box-sizing: border-box;
			align-items: center;

			.tr-content-tab {
				>h3 {
					font-size: 22px;
					margin: 0;
					height: 24px;
				}

				>span {
					margin-top: 12px;
					font-size: 12px;
					display: block;
				}
			}
		}
	}

	.box-logo {
		position: absolute;
		right: 0px;
		bottom: 0px;
	}

	:deep(.el-divider--vertical) {
		display: inline-block;
		width: 1px;
		height: 100px;
		margin: 0 8px;
		width: 2px;
		height: 90px;
		background: rgba(255, 255, 255, 0.5);
		border-radius: 5px 5px 5px 5px;
		vertical-align: middle;
		position: relative;
	}
}

.m-bottom {
	// margin-top: 12px;
	display: flex;
	align-items: center;
	justify-content: space-around;
	// flex-wrap: wrap;
	width: 75%;

	.m-list {
		background: #fff;
		border-radius: 6px;
		width: 9.4%;
		height: 130px;
		display: flex;
		flex-direction: column;
		text-align: center;
		align-items: center;
		padding: 10px;
		justify-content: space-around;
		box-sizing: border-box;
		cursor: pointer;

		.m-list-r {
			// margin-left: 14px;
			color: #048086;

			>h3 {
				font-size: 12px;
				margin-top: 6px;
			}

			>span {
				font-size: 26px;
				margin-top: 6px;
			}
		}
	}
}

.header {
	display: flex;

	.posi {
		margin-left: 16px;
		width: 10px;
	}

	.tabs {
		display: flex;
		align-items: center;
		color: #666666;
		font-size: 14px;

		>article {
			margin-right: 23px;
			cursor: pointer;

			&:hover {
				color: var(--el-color-primary);
			}
		}

		.active {
			color: #000000;
			font-size: 16px;
		}
	}
}
</style>
