<template>
	<!-- <div class="synthesis-conf-container"> -->
	<el-dialog v-model="dialogVisible" title="配置" width="85vw" :before-close="close">
		<div class="synthesis-conf-content">
			<el-table :data="tableData" height="calc(100vh - 250px)" border @selection-change="selectionChange"
				:span-method="arraySpanMethod">
				<el-table-column type="index" width="55" />
				<el-table-column prop="warningProject" label="预警项目"></el-table-column>
				<el-table-column prop="warningElement" label="预警要素"></el-table-column>
				<el-table-column prop="warningThreshold" label="预警阈值"></el-table-column>
				<el-table-column prop="warningLevel" label="预警等级"></el-table-column>
				<el-table-column prop="businessModule" label="业务模块"></el-table-column>
				<el-table-column prop="indicatorName" label="指标名称"></el-table-column>
				<el-table-column prop="displayForm" label="显示形式"></el-table-column>
			</el-table>
		</div>
		<template #footer>
			<!-- <el-button type="primary" @click="ok">保存</el-button> -->
			<el-button @click="close">关闭</el-button>
		</template>
	</el-dialog>
	<!-- </div> -->
</template>

<script setup>
import { ref } from 'vue';

const dialogVisible = ref(true);

const emit = defineEmits(['ok', 'close']);
const tableData = [
	{
		warningProject: "风险单元预警",
		warningElement: "风险单元",
		warningThreshold: "出现红区风险单元（固有风险除外）",
		warningLevel: "红",
		businessModule: "（14）风险分级管控",
		indicatorName: "不同级别现状风险单元数量",
		displayForm: "风险单元"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "风险单元",
		warningThreshold: "出现橙区风险单元（固有风险除外）",
		warningLevel: "橙",
		businessModule: "（14）风险分级管控",
		indicatorName: "不同级别现状风险单元数量",
		displayForm: "风险单元"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "重大隐患数量",
		warningThreshold: "重大隐患数量≧2",
		warningLevel: "红",
		businessModule: "（15）隐患排查治理",
		indicatorName: "重大隐患数量",
		displayForm: "重大隐患数量"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "重大隐患数量",
		warningThreshold: "出现重大隐患",
		warningLevel: "橙",
		businessModule: "（15）隐患排查治理",
		indicatorName: "重大隐患数量",
		displayForm: "重大隐患数量"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "同类别隐患占隐患总数",
		warningThreshold: "同类别隐患占隐患总数超过70%",
		warningLevel: "红",
		businessModule: "（15）隐患排查治理",
		indicatorName: "各隐患类别数量占比",
		displayForm: "同类隐患占比"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "同类别隐患占隐患总数",
		warningThreshold: "同类别隐患占隐患总数超过60%",
		warningLevel: "橙",
		businessModule: "（15）隐患排查治理",
		indicatorName: "各隐患类别数量占比",
		displayForm: "同类隐患占比"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "同类别隐患占隐患总数",
		warningThreshold: "同类别隐患占隐患总数超过50%",
		warningLevel: "黄",
		businessModule: "（15）隐患排查治理",
		indicatorName: "各隐患类别数量占比",
		displayForm: "同类隐患占比"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "隐患整改",
		warningThreshold: "隐患按期整改率低于60%",
		warningLevel: "红",
		businessModule: "（15）隐患排查治理",
		indicatorName: "隐患按期整改率",
		displayForm: "隐患按期整改率"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "隐患整改",
		warningThreshold: "隐患按期整改率低于70%",
		warningLevel: "橙",
		businessModule: "（15）隐患排查治理",
		indicatorName: "隐患按期整改率",
		displayForm: "隐患按期整改率"
	},
	{
		warningProject: "风险单元预警",
		warningElement: "隐患整改",
		warningThreshold: "隐患按期整改率低于80%",
		warningLevel: "黄",
		businessModule: "（15）隐患排查治理",
		indicatorName: "隐患按期整改率",
		displayForm: "隐患按期整改率"
	},
	{
		warningProject: "事故预警",
		warningElement: "事故事件",
		warningThreshold: "发生死亡1人以上或重伤3人以上或直接经济损失100万以上的安全事故",
		warningLevel: "红",
		businessModule: "（17）事故事件",
		indicatorName: "一般事故-3数量、一般事故-2数量、一般事故-1数量",
		displayForm: "事故事件"
	},
	{
		warningProject: "事故预警",
		warningElement: "事故事件",
		warningThreshold: "发生重伤1-2人或直接经济损失50万-100万的安全事故",
		warningLevel: "橙",
		businessModule: "（17）事故事件",
		indicatorName: "一般事故-3数量、一般事故-2数量、一般事故-1数量",
		displayForm: "事故事件"
	},
	{
		warningProject: "事故预警",
		warningElement: "事故事件",
		warningThreshold: "发生轻伤3人及以上或直接经济损失10万-50万的安全事故",
		warningLevel: "黄",
		businessModule: "（17）事故事件",
		indicatorName: "一般事故-3数量、一般事故-2数量、一般事故-1数量",
		displayForm: "事故事件"
	},
	{
		warningProject: "其他预警",
		warningElement: "安全管理机构人员配置率",
		warningThreshold: "配置率低于50%",
		warningLevel: "红",
		businessModule: "（1）综合管理",
		indicatorName: "安全管理机构人员配置率",
		displayForm: "安全管理机构人员配置率"
	},
	{
		warningProject: "其他预警",
		warningElement: "安全管理机构人员配置率",
		warningThreshold: "配置率低于60%",
		warningLevel: "橙",
		businessModule: "（1）综合管理",
		indicatorName: "安全管理机构人员配置率",
		displayForm: "安全管理机构人员配置率"
	},
	{
		warningProject: "其他预警",
		warningElement: "安全管理机构人员配置率",
		warningThreshold: "配置率低于70%",
		warningLevel: "黄",
		businessModule: "（1）综合管理",
		indicatorName: "安全管理机构人员配置率",
		displayForm: "安全管理机构人员配置率"
	},
	{
		warningProject: "其他预警",
		warningElement: "安全工程师评聘比例",
		warningThreshold: "评聘比例低于5%",
		warningLevel: "红",
		businessModule: "（2）安全管理队伍",
		indicatorName: "安全管理队伍安全工程师聘任率",
		displayForm: "安全工程师评聘"
	},
	{
		warningProject: "其他预警",
		warningElement: "安全工程师评聘比例",
		warningThreshold: "评聘比例低于10%",
		warningLevel: "橙",
		businessModule: "（2）安全管理队伍",
		indicatorName: "安全管理队伍安全工程师聘任率",
		displayForm: "安全工程师评聘"
	},
	{
		warningProject: "其他预警",
		warningElement: "安全工程师评聘比例",
		warningThreshold: "评聘比例低于15%",
		warningLevel: "黄",
		businessModule: "（2）安全管理队伍",
		indicatorName: "安全管理队伍安全工程师聘任率",
		displayForm: "安全工程师评聘"
	},
	{
		warningProject: "其他预警",
		warningElement: "主要负责人安全培训符合学时要求（≥12学时）占比",
		warningThreshold: "符合学时要求（≥12学时）的企业主要负责人占比低于60%",
		warningLevel: "红",
		businessModule: "（3）安全教育培训",
		indicatorName: "主要负责人安全培训学时达标率",
		displayForm: "主要负责人安全培训"
	},
	{
		warningProject: "其他预警",
		warningElement: "主要负责人安全培训符合学时要求（≥12学时）占比",
		warningThreshold: "符合学时要求（≥12学时）的企业主要负责人占比低于80%",
		warningLevel: "橙",
		businessModule: "（3）安全教育培训",
		indicatorName: "主要负责人安全培训学时达标率",
		displayForm: "主要负责人安全培训"
	},
	{
		warningProject: "其他预警",
		warningElement: "主要负责人安全培训符合学时要求（≥12学时）占比",
		warningThreshold: "符合学时要求（≥12学时）的企业主要负责人占比低于100%",
		warningLevel: "黄",
		businessModule: "（3）安全教育培训",
		indicatorName: "主要负责人安全培训学时达标率",
		displayForm: "主要负责人安全培训"
	}
];
const form = ref({});
const ok = () => {
	emit('ok');
};
/** 是否可选 */
const selectable = () => {
	return true;
}
const selectionChange = (selection) => {
	console.log('selectionChange', selection);
}

const arraySpanMethod = ({ row, column, rowIndex, columnIndex }) => {
	// 第一列，第二列相同项，向下合并
	if (columnIndex === 1) {
		// 安全责任（年度）对比excel序号少2个(因为列表序号从0开始，而excel序号从2开始)
		if (rowIndex === 0) return [2, 1]
		if (rowIndex === 1) return [0, 0]
		// 未知？
		if (rowIndex === 2) return [8, 1]
		if (rowIndex > 2 && rowIndex < 10) return [0, 0]
		// 事故预警
		if (rowIndex === 10) return [3, 1]
		if (rowIndex > 10 && rowIndex < 13) return [0, 0]
		// 其他预警
		if (rowIndex === 13) return [9, 1]
		if (rowIndex > 13 && rowIndex < 22) return [0, 0]
	}
	if (columnIndex === 2) {
		// 风险单元
		if (rowIndex === 0) return [2, 1]
		if (rowIndex > 0 && rowIndex < 2) return [0, 0]
		// 重大隐患 合并2个
		if (rowIndex === 2) return [2, 1]
		if (rowIndex > 2 && rowIndex < 4) return [0, 0]
		// 同类别隐患占隐患总数 合并3个
		if (rowIndex === 4) return [3, 1]
		if (rowIndex > 4 && rowIndex < 7) return [0, 0]
		// 隐患整改 合并3个
		if (rowIndex === 7) return [3, 1]
		if (rowIndex > 7 && rowIndex < 10) return [0, 0]
		// 事故事件 合并3个
		if (rowIndex === 10) return [3, 1]
		if (rowIndex > 10 && rowIndex < 13) return [0, 0]
		// 安全管理机构人员配置率 合并3个
		if (rowIndex === 13) return [3, 1]
		if (rowIndex > 13 && rowIndex < 16) return [0, 0]
		// 安全工程师评聘比例 合并3个
		if (rowIndex === 16) return [3, 1]
		if (rowIndex > 16 && rowIndex < 19) return [0, 0]
		// 主要负责人安全培训符合学时要求（≥12学时）占比 合并3个
		if (rowIndex === 19) return [3, 1]
		if (rowIndex > 19 && rowIndex < 22) return [0, 0]


	}
	return [1, 1]
}
const close = () => {
	emit('close');
};
// /** 设置table数据 */
// const setTable = ()=>{
// 	tableData.value = []
// }

</script>

<style lang="scss" scoped>
// .synthesis-conf-container {
// 	width: 100%;
// 	height: 100%;
// }</style>