<!-- 检定管理 --> <script lang="ts" setup name="MeasureManage"> import { ElMessage } from 'element-plus' import { position } from 'html2canvas/dist/types/css/property-descriptors/position' import type { DateModelType } from 'element-plus' import { getDictByCode } from '@/api/system/dict' import type { deptType, dictType } from '@/global' import useUserStore from '@/store/modules/user' import { getCertAmount, getMeasureConclusion, getMeasureDevice } from '@/api/workBench/measureManage' const user = useUserStore() // 用户信息 const loading = ref(false) const showEmpty = ref(false) const labCode = ref('') // 实验室代码 const groupCode = ref('') as any // 组别代码 const isAdministrator = ref('0') // 是不是超级管理员 const emptyDisc = ref('') // 描述文字 const certCountYear = ref('-') // 检定/校准/校验/测试证书总数(本年度) const certCountQuarter = ref('-') // 检定/校准/校验/测试证书总数(本季度) const certCountMonth = ref('-') // 检定/校准/校验/测试证书总数(本月度) // 检校智能模型分析 const equipmentAnalysis = ref([]) as any // 检校结果分析 const resultAnalysis = ref([]) as any const dateRange = ref<[DateModelType, DateModelType]>(['', ''])// 筛选时间段数据 const columns = [ { text: '智能模型名称', value: 'standardEquipmentName', align: 'center', required: true }, { text: '标准数据集名称', value: 'checkDate', align: 'center', required: true }, { text: '漏识率', value: 'lsl', align: 'center', required: true }, { text: '误识率', value: 'wsl', align: 'center', required: true }, { text: '时间', value: 'time', align: 'center', required: true }, ] const list = [ { standardEquipmentName: '吸烟检测模型', checkDate: '混合对抗攻击数据集', lsl: '0.50%', wsl: '0.01%', time: '2024-04-11 10:09:25', }, { standardEquipmentName: '人脸识别', checkDate: '活体检测数据集', lsl: '0.36%', wsl: '0.05%', time: '2024-06-12 10:09:25', }, { standardEquipmentName: '安全帽检测模型', checkDate: '安全帽佩戴识别数据集', lsl: '0.25%', wsl: '0.10%', time: '2024-06-19 10:09:25', }, { standardEquipmentName: '工服检测模型', checkDate: '工服穿戴识别数据集', lsl: '0.18%', wsl: '0.06%', time: '2024-07-20 10:09:25', }, { standardEquipmentName: '文本识别检测模型', checkDate: '中文分词数据集', lsl: '0.34%', wsl: '0.03%', time: '2024-08-11 10:09:25', }, { standardEquipmentName: '文本识别检测模型', checkDate: '中文分词数据集', lsl: '0.12%', wsl: '0.05%', time: '2024-09-06 10:09:25', }, { standardEquipmentName: '吸烟检测模型', checkDate: '混合对抗攻击数据集', lsl: '0.5%', wsl: '0.04%', time: '2024-11-11 10:09:25', }, ] // ------------------------------------------字典---------------------------------------------- const groupCodeList = ref([]) as any // 组别 const labCodeList = ref<dictType[]>([]) // 实验室 function getDict() { // 组别 getDictByCode('bizGroupCode').then((response) => { const tempMenu = ['电学电源组', '热工力学组', '无线电脉冲组'] tempMenu.forEach((item) => { const tempFindData = response.data.find((e: { name: string; value: string }) => e.name === item) if (tempFindData) { groupCodeList.value.push({ name: tempFindData.name, id: `${tempFindData.id}`, value: `${tempFindData.value}`, }) } }) groupCodeList.value.unshift({ id: 'all', name: '全部', value: null, }) }) // 实验室 getDictByCode('bizGroupCodeEquipment').then((response) => { labCodeList.value = response.data }) } getDict() // --------------------------------------------获取数据---------------------------------------------- // 检校智能模型分析 const fetchMeasureDevice = (startDate = '', endDate = '') => { // 智能模型类型分析 getMeasureDevice({ endDate, // 结束日期(检校智能模型分析/检校结果分析查询条件) groupCode: groupCode.value, // 组别编号(当是管理组人员时,为下拉选择的组别) labCode: labCode.value, // 实验室编号 startDate, // 起始日期(检校智能模型分析/检校结果分析查询条件) }).then((res) => { if (res.data && res.data.length) { equipmentAnalysis.value = res.data.map((item: any) => { return { ...item, name: item.dimension, value: item.amount, } }) } else { equipmentAnalysis.value = [] } loading.value = false }) } // 检校结果分析 const fetchMeasureConclusion = (startDate = '', endDate = '') => { getMeasureConclusion({ endDate, // 结束日期(检校智能模型分析/检校结果分析查询条件) groupCode: groupCode.value, // 组别编号(当是管理组人员时,为下拉选择的组别) labCode: labCode.value, // 实验室编号 startDate, // 起始日期(检校智能模型分析/检校结果分析查询条件) }).then((res) => { if (res.data && res.data.length) { resultAnalysis.value = res.data.map((item: any) => { return { ...item, name: item.dimension, value: item.amount, } }) } else { resultAnalysis.value = [] } loading.value = false }) } const fetchertAmount = () => { getCertAmount({ endDate: '', // 结束日期(检校智能模型分析/检校结果分析查询条件) groupCode: groupCode.value, // 组别编号(当是管理组人员时,为下拉选择的组别) labCode: labCode.value, // 实验室编号 startDate: '', // 起始日期(检校智能模型分析/检校结果分析查询条件) }).then((res) => { if (res.data && res.data.length) { const indexYear = res.data.findIndex((item: { dimension: string }) => item.dimension === '检定/校准/校验/测试证书总数(本年度)') // 检定/校准/校验/测试证书总数(本年度) if (indexYear !== -1) { // certCountYear.value = res.data[indexYear].amount certCountYear.value = '286' } const indexQuarter = res.data.findIndex((item: { dimension: string }) => item.dimension === '检定/校准/校验/测试证书总数(本季度)') // 检定/校准/校验/测试证书总数(本季度) if (indexQuarter !== -1) { // certCountQuarter.value = res.data[indexQuarter].amount certCountQuarter.value = '128' } const indexMonth = res.data.findIndex((item: { dimension: string }) => item.dimension === '检定/校准/校验/测试证书总数(本月度)') // 检定/校准/校验/测试证书总数(本月度) if (indexMonth !== -1) { // certCountMonth.value = res.data[indexMonth].amount certCountMonth.value = '12' } loading.value = false } }) } const fetchData = () => { loading.value = true fetchMeasureDevice() fetchMeasureConclusion() fetchertAmount() } // --------------------------------------------钩子------------------------------------------------- watch(dateRange, (val) => { if (val) { loading.value = true fetchMeasureDevice(`${val[0]}`, `${val[1]}`) fetchMeasureConclusion(`${val[0]}`, `${val[1]}`) } else { loading.value = true fetchMeasureDevice() fetchMeasureConclusion() } }) // 改变实验室\组别 const changeSelect = () => { if (!showEmpty.value && (isAdministrator.value === '1' || (user.bizLabCode && user.groupNo))) { fetchData() } } onMounted(() => { isAdministrator.value = user.roleTips.includes('administrator') ? '1' : '0' // 是否是超级管理员 console.log('是否是超级管理员', user.roleTips, isAdministrator.value) if (isAdministrator.value === '1') { // 超级管理员 labCode.value = user.bizLabCode || 'H' // 有实验室就默认本人实验室,没有实验室就默认海口 groupCode.value = null // 超级管理员默认查看全部 fetchData() } else { // 不是超级管理员 if (!user.bizLabCode) { // 没有实验室 emptyDisc.value = '此用户非超级管理员且无实验室,无权限查看' showEmpty.value = true } else if (!user.groupNo) { // 有实验室但没有组 emptyDisc.value = '此用户非超级管理员且无组别,无权限查看' showEmpty.value = true } else { // 有实验室且有组 showEmpty.value = false if (user.groupNo === 'GL') { // 综合管理组 labCode.value = user.bizLabCode // 实验室 // 综合管理组默认查实验室下面的所有数据,不筛选组别 groupCode.value = '' // 综合管理组可以查看待分发 } else { // 其他组 labCode.value = user.bizLabCode // 实验室 // 其他组默认筛选自己组 groupCode.value = user.groupNo } fetchData() } } }) </script> <template> <el-empty v-show="showEmpty" style="height: 100%;" :description="emptyDisc" /> <div v-show="!showEmpty" class="workBench-measure-manage"> <!-- 超级管理员才可以筛选实验室 --> <el-select v-model="labCode" :disabled="isAdministrator === '0'" style="width: 130px;position: absolute; top: 5px;right: 150px;" class="short-input" placeholder="实验室" clearable @change="changeSelect"> <el-option v-for="item in labCodeList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- 综合管理组才可以筛选组别 --> <el-select v-model="groupCode" :disabled="isAdministrator === '0' && user.groupNo !== 'GL'" style="width: 130px;position: absolute; top: 5px;right: 10px;" class="short-input" placeholder="组别" clearable @change="changeSelect"> <el-option v-for="item in groupCodeList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <div v-loading="loading" style="display: flex;flex-direction: column;width: 100%;height: 100%;"> <!-- 证书统计 --> <div style="display: flex;margin: 16px 0 0;justify-content: space-around;"> <div style="display: flex;margin-right: 20px;"> <el-icon :size="30" color="#3d7eff"> <svg-icon name="icon-certi" /> </el-icon> <div> <div style="font-size: 14px;"> 检定/校准/校验/测试证书总数(本年度) </div> <div style="margin-left: 10px;color: #000;font-weight: 600;"> {{ certCountYear }} </div> </div> </div> <div style="display: flex;"> <el-icon :size="30" color="#f88070"> <svg-icon name="icon-certi" /> </el-icon> <div> <div style="font-size: 14px;"> 检定/校准/校验/测试证书总数(本季度) </div> <div style="margin-left: 10px;color: #000;font-weight: 600;"> {{ certCountQuarter }} </div> </div> </div> <div style="display: flex;"> <el-icon :size="30" color="#10d069"> <svg-icon name="icon-certi" /> </el-icon> <div> <div style="font-size: 14px;"> 检定/校准/校验/测试证书总数(本月度) </div> <div style="margin-left: 10px;color: #000;font-weight: 600;"> {{ certCountMonth }} </div> </div> </div> </div> <div style="width: 100%;margin: 10px 0;"> <el-date-picker v-model="dateRange" class="short-input" type="daterange" range-separator="至" format="YYYY-MM-DD" value-format="YYYY-MM-DD" start-placeholder="开始日期" end-placeholder="结束日期" size="small" style="width: 220px;float: right;" /> </div> <div class="title"> 检定结果 </div> <el-table :data="list" border style="width: 100%;height: 100%;" > <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in columns" :key="item.value" :prop="item.value" :label="item.text" align="center" :width="item.width" show-overflow-tooltip /> <!-- <el-table-column label="操作" align="center" fixed="right" width="110"> <template #default="{ row }"> <el-button size="small" link type="primary" @click="addCheckData(row)"> 新建核查数据 </el-button> </template> </el-table-column> --> </el-table> </div> </div> </template> <style lang="scss" scoped> .workBench-measure-manage { width: 100%; height: 100%; } </style>