2024-08-26 20:05:04 +08:00
|
|
|
|
<template>
|
2024-10-29 11:17:04 +08:00
|
|
|
|
<div class='table-box' ref='popupBaseView'>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
<ProTable
|
|
|
|
|
|
ref='proTable'
|
|
|
|
|
|
:columns='columns'
|
2024-12-11 19:39:09 +08:00
|
|
|
|
:request-api='getTableList'
|
2024-11-13 15:24:42 +08:00
|
|
|
|
>
|
|
|
|
|
|
<!-- 表格 header 按钮 -->
|
|
|
|
|
|
<template #tableHeader='scope'>
|
2025-07-09 20:12:40 +08:00
|
|
|
|
<el-button type='primary' v-auth.plan="'import'" :icon='Download' @click='importClick' v-if="modeStore.currentMode != '比对式'">导入</el-button>
|
|
|
|
|
|
<el-button type='primary' v-auth.plan="'export'" :icon='Upload' @click='exportClick' v-if="modeStore.currentMode != '比对式'">导出</el-button>
|
2025-02-13 15:40:13 +08:00
|
|
|
|
<el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
合并
|
|
|
|
|
|
</el-button>
|
2025-02-13 15:40:13 +08:00
|
|
|
|
<el-button type='primary' v-auth.plan="'add'" :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
2025-02-21 14:57:52 +08:00
|
|
|
|
<el-button type='primary' v-auth.plan="'analysis'" :icon='List' :disabled='!scope.isSelected' @click='statisticalAnalysisMore(scope.selectedListIds,scope.selectedList)'>统计分析</el-button>
|
2025-02-13 15:40:13 +08:00
|
|
|
|
<el-button type='danger' v-auth.plan="'delete'" :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
|
2024-12-04 21:36:12 +08:00
|
|
|
|
删除
|
2024-11-13 15:24:42 +08:00
|
|
|
|
</el-button>
|
2025-02-17 16:32:02 +08:00
|
|
|
|
|
2024-11-13 15:24:42 +08:00
|
|
|
|
</template>
|
2024-08-26 20:05:04 +08:00
|
|
|
|
<!-- 表格操作 -->
|
2024-10-29 11:17:04 +08:00
|
|
|
|
<template #operation='scope'>
|
2025-02-13 15:40:13 +08:00
|
|
|
|
<el-button type='primary' v-auth.plan="'edit'" link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
|
|
|
|
|
<el-button type='primary' v-auth.plan="'delete'" link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
2025-07-09 20:12:40 +08:00
|
|
|
|
<el-button type='primary' link :icon='List' @click="openTestSource(scope.row)">子计划</el-button>
|
2024-12-13 16:35:27 +08:00
|
|
|
|
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
|
2025-02-24 08:54:22 +08:00
|
|
|
|
<el-button type='primary' v-auth.plan="'analysis'" link :icon='List' v-if="scope.row.testState == '2'" @click='statisticalAnalysis(scope.row)'>统计分析</el-button>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</ProTable>
|
2024-12-11 19:39:09 +08:00
|
|
|
|
</div>
|
2024-08-27 16:06:16 +08:00
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
<!-- 向计划导入/导出设备对话框 -->
|
|
|
|
|
|
<PlanPopup :refresh-table='proTable?.getTableList' ref='planPopup'/>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
<!-- 查看误差体系详细信息 -->
|
2024-12-12 11:38:42 +08:00
|
|
|
|
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref="errorStandardPopup"/>
|
|
|
|
|
|
<!-- 查看检测源 -->
|
|
|
|
|
|
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
|
2024-12-13 16:35:27 +08:00
|
|
|
|
<!-- 查看设备绑定
|
|
|
|
|
|
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
|
2025-02-18 15:58:38 +08:00
|
|
|
|
<ImportExcel ref='planImportExcel' />
|
2025-07-09 20:12:40 +08:00
|
|
|
|
<SourceOpen :refresh-table='proTable?.getTableList' ref='openSourceView' :width='viewWidth' :height='viewHeight'></SourceOpen>
|
2025-02-13 15:40:13 +08:00
|
|
|
|
|
2024-10-29 11:17:04 +08:00
|
|
|
|
</template>
|
2024-08-26 20:05:04 +08:00
|
|
|
|
|
2024-11-13 15:24:42 +08:00
|
|
|
|
<script setup lang='tsx' name='useProTable'>
|
2024-10-29 11:17:04 +08:00
|
|
|
|
import ProTable from '@/components/ProTable/index.vue'
|
2024-11-13 15:24:42 +08:00
|
|
|
|
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
2024-11-18 22:04:59 +08:00
|
|
|
|
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
2025-03-25 15:08:25 +08:00
|
|
|
|
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } from '@/api/plan/plan.ts'
|
2024-12-11 19:39:09 +08:00
|
|
|
|
import { computed, onMounted, reactive, ref } from 'vue'
|
2024-10-29 11:17:04 +08:00
|
|
|
|
import type { Plan } from '@/api/plan/interface'
|
2024-12-11 19:39:09 +08:00
|
|
|
|
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
2024-11-07 13:22:51 +08:00
|
|
|
|
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
|
2025-07-09 20:12:40 +08:00
|
|
|
|
import SourceOpen from '@/views/plan/planList/components/chidrenPlan.vue'
|
2024-12-11 19:39:09 +08:00
|
|
|
|
import DevTransfer from './components/devTransfer.vue'
|
2024-10-29 11:17:04 +08:00
|
|
|
|
import { useViewSize } from '@/hooks/useViewSize'
|
2024-11-13 15:24:42 +08:00
|
|
|
|
import { useRouter } from 'vue-router'
|
2024-10-30 19:07:41 +08:00
|
|
|
|
import { useDictStore } from '@/stores/modules/dict'
|
2024-11-07 13:22:51 +08:00
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
import type { Action } from 'element-plus'
|
2024-11-12 20:35:12 +08:00
|
|
|
|
import type { ErrorSystem } from '@/api/error/interface'
|
2024-12-12 11:38:42 +08:00
|
|
|
|
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
2024-12-06 09:11:44 +08:00
|
|
|
|
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
2024-12-11 19:39:09 +08:00
|
|
|
|
import { type TestSource } from '@/api/device/interface/testSource'
|
2025-07-09 20:12:40 +08:00
|
|
|
|
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
2024-12-11 19:39:09 +08:00
|
|
|
|
import { useHandleData } from '@/hooks/useHandleData'
|
2024-12-12 11:38:42 +08:00
|
|
|
|
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
|
|
|
|
|
import {getTestSourceById} from '@/api/device/testSource/index'
|
2025-02-18 15:58:38 +08:00
|
|
|
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
2024-12-17 11:12:21 +08:00
|
|
|
|
import {useDownload} from "@/hooks/useDownload";
|
2025-02-13 15:40:13 +08:00
|
|
|
|
import {getTestConfig } from '@/api/system/base/index'
|
|
|
|
|
|
import {type Base } from '@/api/system/base/interface'
|
2025-02-14 11:44:19 +08:00
|
|
|
|
import { getBoundPqDevList ,staticsAnalyse} from '@/api/plan/plan.ts'
|
2025-05-26 15:36:06 +08:00
|
|
|
|
import { kMaxLength } from 'buffer'
|
2025-01-15 09:35:36 +08:00
|
|
|
|
|
2025-01-17 14:57:17 +08:00
|
|
|
|
// defineOptions({
|
|
|
|
|
|
// name: 'planList'
|
|
|
|
|
|
// })
|
2024-10-30 19:07:41 +08:00
|
|
|
|
const dictStore = useDictStore()
|
2024-11-07 13:22:51 +08:00
|
|
|
|
const openDeviceView = ref()
|
|
|
|
|
|
const openSourceView = ref()
|
2024-11-08 13:09:06 +08:00
|
|
|
|
const devTransferVisible = ref(false)
|
2024-11-12 20:35:12 +08:00
|
|
|
|
const sourceTransferVisible = ref(false)
|
2024-11-07 13:22:51 +08:00
|
|
|
|
// ProTable 实例
|
|
|
|
|
|
const proTable = ref<ProTableInstance>()
|
2024-12-11 19:39:09 +08:00
|
|
|
|
const errorStandardPopup = ref()
|
2024-12-12 11:38:42 +08:00
|
|
|
|
const testSourcePopup = ref()
|
2024-12-11 19:39:09 +08:00
|
|
|
|
const planPopup = ref()
|
|
|
|
|
|
const devTransferPopup = ref()
|
|
|
|
|
|
const modeStore = useModeStore();
|
2024-12-17 11:12:21 +08:00
|
|
|
|
|
2025-02-18 15:58:38 +08:00
|
|
|
|
const planImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
|
2025-02-21 14:57:52 +08:00
|
|
|
|
const planList = ref<Plan.ResPlan[]>([]);
|
2024-12-11 19:39:09 +08:00
|
|
|
|
const getTableList = async(params: any) => {
|
|
|
|
|
|
let newParams = JSON.parse(JSON.stringify(params))
|
|
|
|
|
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
2025-04-08 09:43:12 +08:00
|
|
|
|
newParams.patternId = patternId
|
2024-12-11 19:39:09 +08:00
|
|
|
|
|
2025-02-21 14:57:52 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const result = await getPlanList(newParams);
|
|
|
|
|
|
planList.value = result.data as Plan.ResPlan[];
|
|
|
|
|
|
return result;
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
return { data: [] }; // 返回空数据或处理错误
|
|
|
|
|
|
}
|
2024-12-11 19:39:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-09 20:12:40 +08:00
|
|
|
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
2024-12-11 19:39:09 +08:00
|
|
|
|
|
|
|
|
|
|
const dataSourceType = computed(() => {
|
2025-03-25 15:08:25 +08:00
|
|
|
|
// switch (modeStore.currentMode) {
|
|
|
|
|
|
// case '模拟式':
|
|
|
|
|
|
// return 'Datasource_Simulate'
|
|
|
|
|
|
// case '数字式':
|
|
|
|
|
|
// return 'Datasource_Digital'
|
|
|
|
|
|
// default:
|
|
|
|
|
|
// return 'Datasource_Contrast'
|
|
|
|
|
|
// }
|
|
|
|
|
|
return 'Datasource'
|
2024-12-12 11:38:42 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2024-11-14 11:45:25 +08:00
|
|
|
|
|
2024-08-26 20:05:04 +08:00
|
|
|
|
// 表格配置项
|
2024-12-11 19:39:09 +08:00
|
|
|
|
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
2025-05-14 08:58:21 +08:00
|
|
|
|
{ type: 'selection', fixed: 'left', minWidth: 70 },
|
|
|
|
|
|
{ type: 'index', fixed: 'left', minWidth: 70, label: '序号' },
|
2024-11-13 15:24:42 +08:00
|
|
|
|
{
|
|
|
|
|
|
prop: 'name',
|
2024-11-18 22:04:59 +08:00
|
|
|
|
label: '名称',
|
2025-05-14 08:58:21 +08:00
|
|
|
|
minWidth: 220,
|
2024-11-13 15:24:42 +08:00
|
|
|
|
search: { el: 'input' },
|
|
|
|
|
|
},
|
2025-01-17 14:57:17 +08:00
|
|
|
|
{
|
|
|
|
|
|
prop: 'testState',
|
|
|
|
|
|
label: '检测状态',
|
2025-05-14 08:58:21 +08:00
|
|
|
|
minWidth: 120,
|
2025-01-17 14:57:17 +08:00
|
|
|
|
enum:dictTestState,
|
|
|
|
|
|
search: { el:'select',props: { filterable: true }},
|
|
|
|
|
|
fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
2025-07-09 20:12:40 +08:00
|
|
|
|
scope.row.testState === 0 ? <el-tag type='warning' effect="dark">未检</el-tag> :
|
|
|
|
|
|
scope.row.testState === 1 ? <el-tag type='danger' effect="dark">检测中</el-tag> :
|
|
|
|
|
|
<el-tag type='success' effect="dark">检测完成</el-tag>
|
2025-01-17 14:57:17 +08:00
|
|
|
|
)
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2025-07-09 20:12:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
prop: 'progress',
|
|
|
|
|
|
label: '检测进度',
|
|
|
|
|
|
minWidth: 180,
|
|
|
|
|
|
render: (scope) => {
|
|
|
|
|
|
const randomPercentage = Math.floor(Math.random() * 101); // 生成 0 到 100 的随机整数
|
|
|
|
|
|
return (
|
|
|
|
|
|
<el-progress
|
|
|
|
|
|
text-inside={true}
|
|
|
|
|
|
stroke-width={20}
|
|
|
|
|
|
percentage={randomPercentage}
|
|
|
|
|
|
status='success'
|
|
|
|
|
|
/>
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2025-01-17 14:57:17 +08:00
|
|
|
|
{
|
|
|
|
|
|
prop: 'reportState',
|
|
|
|
|
|
label: '检测报告状态',
|
2025-05-14 08:58:21 +08:00
|
|
|
|
minWidth: 120,
|
2025-01-17 14:57:17 +08:00
|
|
|
|
enum:dictReportState,
|
|
|
|
|
|
search: { el: 'select', props: { filterable: true } },
|
|
|
|
|
|
fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
scope.row.reportState === 0 ? '未生成' : scope.row.reportState === 1 ? '部分生成' : '全部生成'
|
|
|
|
|
|
)
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
prop: 'result',
|
|
|
|
|
|
label: '检测结果',
|
2025-05-14 08:58:21 +08:00
|
|
|
|
minWidth: 120,
|
2025-01-17 14:57:17 +08:00
|
|
|
|
enum:dictResult,
|
|
|
|
|
|
search: { el: 'select', props: { filterable: true } },
|
|
|
|
|
|
fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
render: scope => {
|
|
|
|
|
|
console.log('检测结果',scope.row.result)
|
|
|
|
|
|
return (
|
|
|
|
|
|
scope.row.result === 0 ? '不符合' : scope.row.result === 1 ? '符合' : '/'
|
|
|
|
|
|
)
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
prop: 'createTime',
|
|
|
|
|
|
label: '创建时间',
|
2025-05-14 08:58:21 +08:00
|
|
|
|
minWidth: 200,
|
2025-01-22 12:09:32 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
if (scope.row.createTime) {
|
|
|
|
|
|
const date = new Date(scope.row.createTime);
|
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
|
|
const hours = String(date.getHours()).padStart(2, '0');
|
|
|
|
|
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
|
|
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
|
}
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
2025-01-17 14:57:17 +08:00
|
|
|
|
},
|
2024-11-13 15:24:42 +08:00
|
|
|
|
{
|
2024-12-11 19:39:09 +08:00
|
|
|
|
prop: 'sourceName',
|
2024-11-18 22:04:59 +08:00
|
|
|
|
label: '检测源',
|
2024-12-12 11:38:42 +08:00
|
|
|
|
minWidth: 400,
|
2024-11-13 15:24:42 +08:00
|
|
|
|
render: scope => {
|
2024-12-12 11:38:42 +08:00
|
|
|
|
const sourceNames = Array.isArray(scope.row.sourceName) ? scope.row.sourceName : [];
|
|
|
|
|
|
const sourceIds = Array.isArray(scope.row.sourceIds) ? scope.row.sourceIds : [];
|
|
|
|
|
|
const firstSourceName = sourceNames[0];
|
|
|
|
|
|
const firstSourceId = sourceIds[0];
|
|
|
|
|
|
const remainingSourceNames = sourceNames.slice(1);
|
|
|
|
|
|
const remainingSourceIds = sourceIds.slice(1);
|
|
|
|
|
|
|
2024-11-13 15:24:42 +08:00
|
|
|
|
return (
|
2024-12-12 11:38:42 +08:00
|
|
|
|
<div class='flx-flex-start'>
|
|
|
|
|
|
{firstSourceName && (
|
|
|
|
|
|
<el-link type='primary' link onClick={() => showTestSource(firstSourceId)}>
|
|
|
|
|
|
{firstSourceName}
|
2024-12-11 19:39:09 +08:00
|
|
|
|
</el-link>
|
2024-12-12 11:38:42 +08:00
|
|
|
|
)}
|
|
|
|
|
|
<moreButtons isShow={isVisible(scope.row)}
|
|
|
|
|
|
sourceNames={remainingSourceNames}//长度>1时,传给更多子组件从第二位开始的名字
|
|
|
|
|
|
sourceIds={remainingSourceIds} //长度>1时,传给更多子组件从第二位开始的id
|
|
|
|
|
|
onSource-clicked={showTestSource}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
)
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-11 19:39:09 +08:00
|
|
|
|
prop: 'scriptId',
|
2024-11-13 15:24:42 +08:00
|
|
|
|
label: '检测脚本',
|
2025-05-14 08:58:21 +08:00
|
|
|
|
minWidth: 360,
|
2024-11-13 15:24:42 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
2025-03-24 19:56:11 +08:00
|
|
|
|
<span>{scope.row.scriptName}</span>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
)
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-11 19:39:09 +08:00
|
|
|
|
prop: 'errorSysId',
|
2024-11-13 15:24:42 +08:00
|
|
|
|
label: '误差体系',
|
2025-05-14 08:58:21 +08:00
|
|
|
|
minWidth: 240,
|
2024-11-13 15:24:42 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
2025-03-24 19:56:11 +08:00
|
|
|
|
<el-link type='primary' link onClick={() => showData(scope.row)}>
|
2024-12-11 19:39:09 +08:00
|
|
|
|
{scope.row.errorSysName}
|
|
|
|
|
|
</el-link>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
)
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-11 19:39:09 +08:00
|
|
|
|
prop: 'datasourceIds',
|
2024-11-18 22:04:59 +08:00
|
|
|
|
label: '数据源',
|
2024-12-11 19:39:09 +08:00
|
|
|
|
enum: dictStore.getDictData(dataSourceType.value),
|
|
|
|
|
|
fieldNames: { label: 'name', value: 'value' },
|
|
|
|
|
|
minWidth: 250,
|
|
|
|
|
|
render: (scope) => {
|
|
|
|
|
|
const codes = scope.row.datasourceIds // 获取当前行的 datasourceIds 字段
|
|
|
|
|
|
if (!codes) {
|
|
|
|
|
|
return '/'
|
|
|
|
|
|
}
|
2025-05-12 15:57:19 +08:00
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
// 确保 codes 是一个字符串
|
|
|
|
|
|
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
|
|
|
|
|
const codeArray = codeString.split(',')
|
|
|
|
|
|
if (codeArray.length > 1) {
|
2025-05-12 15:57:19 +08:00
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
|
|
|
|
|
const names = codeArray.map(code => {
|
2025-05-12 15:57:19 +08:00
|
|
|
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === code)
|
|
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
|
|
|
|
|
})
|
|
|
|
|
|
return names.join(', ') // 用逗号连接所有的 name
|
|
|
|
|
|
}
|
|
|
|
|
|
// 查找单个 code 对应的 name
|
2025-05-12 15:57:19 +08:00
|
|
|
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.code === codeArray[0])
|
2024-12-11 19:39:09 +08:00
|
|
|
|
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
|
|
|
|
|
},
|
2024-11-13 15:24:42 +08:00
|
|
|
|
},
|
2025-05-14 08:58:21 +08:00
|
|
|
|
{
|
|
|
|
|
|
prop: 'dataRule',
|
|
|
|
|
|
label: '数据处理原则',
|
|
|
|
|
|
enum: dictStore.getDictData('Data_Rule'),
|
|
|
|
|
|
fieldNames: { label: 'name', value: 'id' },
|
|
|
|
|
|
minWidth: 120,
|
|
|
|
|
|
},
|
2025-01-17 14:57:17 +08:00
|
|
|
|
|
2025-05-14 08:58:21 +08:00
|
|
|
|
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 300 },
|
2024-10-29 11:17:04 +08:00
|
|
|
|
])
|
2024-08-26 20:05:04 +08:00
|
|
|
|
|
2024-11-14 18:40:58 +08:00
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
function isVisible(row: Plan.ReqPlan) {
|
|
|
|
|
|
if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){
|
2024-11-14 18:40:58 +08:00
|
|
|
|
return false
|
2024-12-11 19:39:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if(row.sourceName.length <= 1){
|
2024-11-14 18:40:58 +08:00
|
|
|
|
return false
|
2024-12-11 19:39:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
else{
|
2024-11-14 18:40:58 +08:00
|
|
|
|
return true
|
2024-12-11 19:39:09 +08:00
|
|
|
|
}
|
2024-11-14 18:40:58 +08:00
|
|
|
|
}
|
2024-11-12 20:35:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-03-24 19:56:11 +08:00
|
|
|
|
function showData(row: any) {
|
|
|
|
|
|
let split = row.errorSysName.split('-')
|
|
|
|
|
|
errorStandardPopup.value?.open(row.errorSysName, {id:row.errorSysId,devLevel:split[split.length-1]})
|
2024-12-05 20:29:28 +08:00
|
|
|
|
}
|
2024-12-11 19:39:09 +08:00
|
|
|
|
|
2024-12-12 11:38:42 +08:00
|
|
|
|
async function showTestSource(row:string) {
|
|
|
|
|
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
|
|
|
|
|
const params: TestSource.ResTestSource = {
|
|
|
|
|
|
id: row, // 根据实际情况设
|
|
|
|
|
|
pattern: patternId,
|
|
|
|
|
|
type: '',
|
|
|
|
|
|
devType: '',
|
|
|
|
|
|
state: 0
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const result = await getTestSourceById(params);
|
|
|
|
|
|
testSourcePopup.value?.open('view', result.data, modeStore.currentMode);
|
|
|
|
|
|
|
2024-12-05 20:29:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function showTestScript(row: string) {
|
2024-12-11 19:39:09 +08:00
|
|
|
|
|
2024-11-12 20:35:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-07 13:22:51 +08:00
|
|
|
|
function handleFiles(event: Event) {
|
2024-11-13 15:24:42 +08:00
|
|
|
|
const target = event.target as HTMLInputElement
|
|
|
|
|
|
const files = target.files
|
2024-11-07 13:22:51 +08:00
|
|
|
|
if (files && files.length > 0) {
|
|
|
|
|
|
// 处理文件
|
2024-11-14 18:26:34 +08:00
|
|
|
|
// console.log(files)
|
2024-11-07 13:22:51 +08:00
|
|
|
|
ElMessageBox.confirm(
|
2024-11-13 15:24:42 +08:00
|
|
|
|
'导入的数据与当前数据有冲突,请选择以哪个数据为主进行覆盖',
|
|
|
|
|
|
'数据冲突',
|
|
|
|
|
|
{
|
|
|
|
|
|
distinguishCancelAndClose: true,
|
|
|
|
|
|
confirmButtonText: '以导入数据为主覆盖',
|
|
|
|
|
|
cancelButtonText: '以当前数据为主覆盖',
|
|
|
|
|
|
type: 'warning',
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
.then(() => {
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
type: 'info',
|
|
|
|
|
|
message: '以导入数据为主完成数据覆盖',
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((action: Action) => {
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
type: 'info',
|
|
|
|
|
|
message:
|
|
|
|
|
|
action === 'cancel'
|
|
|
|
|
|
? '以当前数据为主完成数据覆盖'
|
|
|
|
|
|
: '取消本次导入操作',
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2024-11-07 13:22:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-13 15:24:42 +08:00
|
|
|
|
|
2024-11-07 13:22:51 +08:00
|
|
|
|
// 点击导入按钮
|
|
|
|
|
|
const importClick = () => {
|
2024-12-17 11:12:21 +08:00
|
|
|
|
const params = {
|
2025-02-18 15:58:38 +08:00
|
|
|
|
title: '检测计划',
|
2024-12-17 11:12:21 +08:00
|
|
|
|
showCover: false,
|
|
|
|
|
|
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
|
2025-03-25 15:08:25 +08:00
|
|
|
|
tempApi: downloadTemplate,
|
|
|
|
|
|
importApi: importPlan,
|
2024-12-17 11:12:21 +08:00
|
|
|
|
getTableList: proTable.value?.getTableList,
|
|
|
|
|
|
}
|
2025-02-18 15:58:38 +08:00
|
|
|
|
planImportExcel.value?.acceptParams(params)
|
2024-11-07 13:22:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 点击导出按钮
|
|
|
|
|
|
const exportClick = () => {
|
2024-12-17 11:12:21 +08:00
|
|
|
|
|
|
|
|
|
|
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
|
|
|
|
|
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
2025-04-08 09:43:12 +08:00
|
|
|
|
useDownload(exportPlan,'检测计划导出数据', {...proTable.value?.searchParam,patternId:patternId}, false,'.xlsx')
|
2024-12-17 11:12:21 +08:00
|
|
|
|
})
|
2024-11-07 13:22:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 点击合并按钮
|
|
|
|
|
|
const combineClick = () => {
|
|
|
|
|
|
ElMessageBox.prompt(
|
2024-11-13 15:24:42 +08:00
|
|
|
|
'请输入合并后的计划名称',
|
|
|
|
|
|
'检测计划合并',
|
|
|
|
|
|
{
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
},
|
2024-11-07 13:22:51 +08:00
|
|
|
|
)
|
2024-11-13 15:24:42 +08:00
|
|
|
|
.then(({ value }) => {
|
2024-11-14 18:26:34 +08:00
|
|
|
|
// console.log(`合并后的计划名为:`, value)
|
2024-11-13 15:24:42 +08:00
|
|
|
|
proTable.value?.clearSelection()
|
|
|
|
|
|
proTable.value?.getTableList()
|
|
|
|
|
|
})
|
2024-11-07 13:22:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
// 打开 drawer(新增、编辑)
|
|
|
|
|
|
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
|
|
|
|
|
|
planPopup.value?.open(titleType, row,modeStore.currentMode)
|
2024-08-27 14:01:26 +08:00
|
|
|
|
}
|
2024-10-09 20:03:07 +08:00
|
|
|
|
|
2024-12-12 11:38:42 +08:00
|
|
|
|
|
|
|
|
|
|
// 批量删除设备
|
|
|
|
|
|
const batchDelete = async (id: string[]) => {
|
|
|
|
|
|
await useHandleData(deletePlan, id, '删除所选检测计划')
|
|
|
|
|
|
proTable.value?.clearSelection()
|
|
|
|
|
|
proTable.value?.getTableList()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
// 删除检测计划
|
|
|
|
|
|
const handleDelete = async (params: Plan.ReqPlanParams) => {
|
|
|
|
|
|
await useHandleData(deletePlan, [params.id], `删除【${params.name}】检测计划`)
|
|
|
|
|
|
proTable.value?.getTableList()
|
2024-08-26 20:05:04 +08:00
|
|
|
|
}
|
2024-10-30 15:19:47 +08:00
|
|
|
|
|
2025-07-09 20:12:40 +08:00
|
|
|
|
const openTestSource = (row: Partial<Plan.ReqPlan> = {}) => {
|
|
|
|
|
|
openSourceView.value.open("检测计划详情",row.name)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
|
|
|
|
|
|
devTransferPopup.value.open(row)
|
2024-10-30 15:19:47 +08:00
|
|
|
|
}
|
2024-12-11 19:39:09 +08:00
|
|
|
|
|
2025-02-13 15:40:13 +08:00
|
|
|
|
const myDict = new Map<string, any[]>();
|
|
|
|
|
|
|
2025-02-21 14:57:52 +08:00
|
|
|
|
const statisticalAnalysisMore = async (ids: string[], rows: Plan.ReqPlan[]) => {
|
|
|
|
|
|
const hasInvalidState = rows.some(row => row.testState != 2);
|
|
|
|
|
|
if (hasInvalidState) {
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
message: '存在检测状态不为检测完成的计划,无法进行统计分析。',
|
|
|
|
|
|
});
|
2025-02-24 08:54:22 +08:00
|
|
|
|
proTable.value?.clearSelection()
|
2025-02-21 14:57:52 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
useDownload(staticsAnalyse,'分析结果', ids, false,'.xlsx')
|
2025-02-17 16:28:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-13 15:40:13 +08:00
|
|
|
|
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
|
2025-02-17 16:26:23 +08:00
|
|
|
|
useDownload(staticsAnalyse,'分析结果', [row.id], false,'.xlsx')
|
2025-02-14 11:44:19 +08:00
|
|
|
|
|
2025-02-13 15:40:13 +08:00
|
|
|
|
// const response = await getTestConfig() as unknown as Base.ResTestConfig
|
|
|
|
|
|
// const maxTime= response.data.maxTime//检测最大次数
|
|
|
|
|
|
// const dev = await getBoundPqDevList({ 'planId': row.id })
|
|
|
|
|
|
// for (let i = 0; i <= maxTime; i++) {
|
|
|
|
|
|
// dev.data.forEach((item: any) => {
|
|
|
|
|
|
// if(item.reCheckNum === i){
|
|
|
|
|
|
// // 向已有的数组中添加元素
|
|
|
|
|
|
// if (myDict.has(i.toString())) {
|
|
|
|
|
|
// myDict.get(i.toString())?.push(item.name);
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
// myDict.set(i.toString(), [item.name]);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// for (let i = 0; i <= maxTime; i++) {
|
|
|
|
|
|
// if (myDict.has(i.toString())) {
|
|
|
|
|
|
// const array = myDict.get(i.toString());
|
|
|
|
|
|
// if (array) {
|
|
|
|
|
|
// for (const value of array) {
|
|
|
|
|
|
// console.log(i + '---'+value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-29 11:17:04 +08:00
|
|
|
|
</script>
|
2024-08-26 20:05:04 +08:00
|
|
|
|
|
2024-10-29 11:17:04 +08:00
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|