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'>
|
|
|
|
|
|
<el-button type='primary' :icon='Download' @click='importClick'>导入</el-button>
|
2024-11-18 22:04:59 +08:00
|
|
|
|
<el-button type='primary' :icon='Upload' @click='exportClick'>导出</el-button>
|
|
|
|
|
|
<el-button type='primary' :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
合并
|
|
|
|
|
|
</el-button>
|
2024-12-11 19:39:09 +08:00
|
|
|
|
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
2024-11-13 15:24:42 +08:00
|
|
|
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
2024-12-04 21:36:12 +08:00
|
|
|
|
删除
|
2024-11-13 15:24:42 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
</template>
|
2024-08-26 20:05:04 +08:00
|
|
|
|
<!-- 表格操作 -->
|
2024-10-29 11:17:04 +08:00
|
|
|
|
<template #operation='scope'>
|
2024-12-11 19:39:09 +08:00
|
|
|
|
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
|
|
|
|
|
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
2024-11-18 22:04:59 +08:00
|
|
|
|
<el-button type='primary' link :icon='List' @click='showDeviceOpen(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-11 19:39:09 +08:00
|
|
|
|
<ErrorStandardDialog :refresh-table='proTable?.getTableList' ref="errorStandardPopup"/>
|
|
|
|
|
|
|
|
|
|
|
|
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/>
|
|
|
|
|
|
|
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'
|
2024-12-11 19:39:09 +08:00
|
|
|
|
import {getPlanList,deletePlan } from '@/api/plan/plan.ts'
|
|
|
|
|
|
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'
|
|
|
|
|
|
import SourceOpen from '@/views/plan/planList/components/sourcePopup.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-11-26 15:41:20 +08:00
|
|
|
|
import ErrorStandardDialog 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'
|
|
|
|
|
|
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
|
|
|
|
|
import { useHandleData } from '@/hooks/useHandleData'
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
const planPopup = ref()
|
|
|
|
|
|
const devTransferPopup = ref()
|
|
|
|
|
|
const modeStore = useModeStore();
|
|
|
|
|
|
const fileInput = ref<HTMLInputElement | null>(null) // 声明 fileInput
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
newParams.pattern = patternId
|
|
|
|
|
|
|
|
|
|
|
|
return getPlanList(newParams)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dataSourceType = computed(() => {
|
|
|
|
|
|
switch (modeStore.currentMode) {
|
|
|
|
|
|
case '模拟式':
|
|
|
|
|
|
return 'Datasource_Simulate'
|
|
|
|
|
|
case '数字式':
|
|
|
|
|
|
return 'Datasource_Digital'
|
|
|
|
|
|
default:
|
|
|
|
|
|
return 'Datasource_Contrast'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
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>[]>([
|
2024-11-13 15:24:42 +08:00
|
|
|
|
{ type: 'selection', fixed: 'left', width: 70 },
|
|
|
|
|
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
|
|
|
|
{
|
|
|
|
|
|
prop: 'name',
|
2024-11-18 22:04:59 +08:00
|
|
|
|
label: '名称',
|
2024-12-05 15:25:49 +08:00
|
|
|
|
width: 220,
|
2024-11-13 15:24:42 +08:00
|
|
|
|
search: { el: 'input' },
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-11 19:39:09 +08:00
|
|
|
|
prop: 'sourceName',
|
2024-11-18 22:04:59 +08:00
|
|
|
|
label: '检测源',
|
2024-12-11 19:39:09 +08:00
|
|
|
|
minWidth: 480,
|
2024-11-13 15:24:42 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div class='flx-flex-start'>
|
2024-12-11 19:39:09 +08:00
|
|
|
|
<el-link type='primary' link onClick={() => showTestSource(scope.row.sourceName)}>
|
|
|
|
|
|
{scope.row.sourceName}
|
|
|
|
|
|
</el-link>
|
2024-12-11 20:24:00 +08:00
|
|
|
|
<moreButtons isShow={isVisible(scope.row)} ></moreButtons>
|
2024-11-14 11:45:25 +08:00
|
|
|
|
</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: '检测脚本',
|
2024-12-05 15:25:49 +08:00
|
|
|
|
width: 360,
|
2024-11-13 15:24:42 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
2024-12-11 19:39:09 +08:00
|
|
|
|
<el-link type='primary' link onClick={() => showTestScript(scope.row.scriptId)}>
|
|
|
|
|
|
{scope.row.scriptName}
|
|
|
|
|
|
</el-link>
|
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: '误差体系',
|
|
|
|
|
|
width: 200,
|
|
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
2024-12-11 19:39:09 +08:00
|
|
|
|
<el-link type='primary' link onClick={() => showData(scope.row.errorSysId || '')}>
|
|
|
|
|
|
{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 '/'
|
|
|
|
|
|
}
|
|
|
|
|
|
// 确保 codes 是一个字符串
|
|
|
|
|
|
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
|
|
|
|
|
const codeArray = codeString.split(',')
|
|
|
|
|
|
if (codeArray.length > 1) {
|
|
|
|
|
|
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
|
|
|
|
|
const names = codeArray.map(code => {
|
|
|
|
|
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.value === code)
|
|
|
|
|
|
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
|
|
|
|
|
})
|
|
|
|
|
|
return names.join(', ') // 用逗号连接所有的 name
|
|
|
|
|
|
}
|
|
|
|
|
|
// 查找单个 code 对应的 name
|
|
|
|
|
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.value === codeArray[0])
|
|
|
|
|
|
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
|
|
|
|
|
},
|
2024-11-13 15:24:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-11 19:39:09 +08:00
|
|
|
|
prop: 'testState',
|
2024-11-13 15:24:42 +08:00
|
|
|
|
label: '检测状态',
|
2024-12-05 15:25:49 +08:00
|
|
|
|
width: 120,
|
2024-10-30 19:07:41 +08:00
|
|
|
|
search: { el: 'select', props: { filterable: true } },
|
2024-11-07 20:41:32 +08:00
|
|
|
|
fieldNames: { label: 'label', value: 'id' },
|
2024-12-11 19:39:09 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
scope.row.testState === 0 ? '未检' : scope.row.testState === 1 ? '检测中' : '检测完成'
|
|
|
|
|
|
)
|
|
|
|
|
|
},
|
2024-11-13 15:24:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-11 19:39:09 +08:00
|
|
|
|
prop: 'reportState',
|
2024-11-13 15:24:42 +08:00
|
|
|
|
label: '检测报告状态',
|
2024-12-05 15:25:49 +08:00
|
|
|
|
width: 120,
|
2024-10-30 19:07:41 +08:00
|
|
|
|
search: { el: 'select', props: { filterable: true } },
|
2024-11-07 20:41:32 +08:00
|
|
|
|
fieldNames: { label: 'label', value: 'id' },
|
2024-12-11 19:39:09 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
scope.row.testState === 0 ? '未生成' : scope.row.testState === 1 ? '部分生成' : '全部生成'
|
|
|
|
|
|
)
|
|
|
|
|
|
},
|
2024-11-13 15:24:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
prop: 'result',
|
|
|
|
|
|
label: '检测结果',
|
2024-12-05 15:25:49 +08:00
|
|
|
|
width: 120,
|
2024-10-30 19:07:41 +08:00
|
|
|
|
search: { el: 'select', props: { filterable: true } },
|
2024-11-07 20:41:32 +08:00
|
|
|
|
fieldNames: { label: 'label', value: 'id' },
|
2024-12-11 19:39:09 +08:00
|
|
|
|
render: scope => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
scope.row.testState === 0 ? '不符合' : scope.row.testState === 1 ? '符合' : '/'
|
|
|
|
|
|
)
|
|
|
|
|
|
},
|
2024-11-13 15:24:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
2024-10-29 11:17:04 +08:00
|
|
|
|
])
|
2024-08-26 20:05:04 +08:00
|
|
|
|
|
2024-11-13 15:24:42 +08:00
|
|
|
|
|
2024-11-07 13:22:51 +08:00
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
// // 表格配置项
|
|
|
|
|
|
// const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
|
|
|
|
|
|
// { type: 'selection', fixed: 'left', width: 70 },
|
|
|
|
|
|
// { type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'name',
|
|
|
|
|
|
// label: '名称',
|
|
|
|
|
|
// width: 220,
|
|
|
|
|
|
// search: { el: 'input' },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'testSourceName',
|
|
|
|
|
|
// label: '检测源',
|
|
|
|
|
|
// width: 375,
|
|
|
|
|
|
// render: scope => {
|
|
|
|
|
|
// return (
|
|
|
|
|
|
// <div class='flx-flex-start'>
|
|
|
|
|
|
// <el-link type='primary' link onClick={() => showTestSource(scope.row.testSourceName)}>
|
|
|
|
|
|
// {scope.row.testSourceName}
|
|
|
|
|
|
// </el-link>
|
|
|
|
|
|
// <moreButtons isShow={isVisible(scope.row)} ></moreButtons>
|
|
|
|
|
|
// </div>
|
|
|
|
|
|
// )
|
|
|
|
|
|
// },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'script_Id',
|
|
|
|
|
|
// label: '检测脚本',
|
|
|
|
|
|
// width: 360,
|
|
|
|
|
|
// enum: testScriptDataList,
|
|
|
|
|
|
// fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
// render: scope => {
|
|
|
|
|
|
// return (
|
|
|
|
|
|
// <el-link type='primary' link onClick={() => showTestScript(scope.row.script_Id)}>
|
|
|
|
|
|
// {getScriptName(scope.row.script_Id)}
|
|
|
|
|
|
// </el-link>
|
|
|
|
|
|
// )
|
|
|
|
|
|
// },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'error_Sys_Id',
|
|
|
|
|
|
// label: '误差体系',
|
|
|
|
|
|
// width: 200,
|
|
|
|
|
|
// enum: testErrSystDataList,
|
|
|
|
|
|
// fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
// render: scope => {
|
|
|
|
|
|
// const errSysName = getErrSysName(scope.row.error_Sys_Id)
|
|
|
|
|
|
// return (
|
|
|
|
|
|
// <el-link type='primary' link onClick={() => showData(errSysName || '')}>
|
|
|
|
|
|
// {errSysName}
|
|
|
|
|
|
// </el-link>
|
|
|
|
|
|
// )
|
|
|
|
|
|
// },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'dataSource_Ids',
|
|
|
|
|
|
// label: '数据源',
|
|
|
|
|
|
// width: 120,
|
|
|
|
|
|
// // enum: testSoureDataList,
|
|
|
|
|
|
// // fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'test_State',
|
|
|
|
|
|
// label: '检测状态',
|
|
|
|
|
|
// width: 120,
|
|
|
|
|
|
// enum: dictTestState,
|
|
|
|
|
|
// // enum: dictStore.getDictData('planTestState'),
|
|
|
|
|
|
// search: { el: 'select', props: { filterable: true } },
|
|
|
|
|
|
// fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'report_State',
|
|
|
|
|
|
// label: '检测报告状态',
|
|
|
|
|
|
// width: 120,
|
|
|
|
|
|
// enum: dictReportState,
|
|
|
|
|
|
// // enum: dictStore.getDictData('planReportState'),
|
|
|
|
|
|
// search: { el: 'select', props: { filterable: true } },
|
|
|
|
|
|
// fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// prop: 'result',
|
|
|
|
|
|
// label: '检测结果',
|
|
|
|
|
|
// width: 120,
|
|
|
|
|
|
// enum: dictResult,
|
|
|
|
|
|
// // enum: dictStore.getDictData('planResult'),
|
|
|
|
|
|
// search: { el: 'select', props: { filterable: true } },
|
|
|
|
|
|
// fieldNames: { label: 'label', value: 'id' },
|
|
|
|
|
|
// },
|
|
|
|
|
|
// { prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
|
|
|
|
|
// ])
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-13 15:24:42 +08:00
|
|
|
|
function openFileDialog() {
|
2024-11-07 13:22:51 +08:00
|
|
|
|
if (fileInput.value) {
|
2024-11-13 15:24:42 +08:00
|
|
|
|
fileInput.value.click()
|
2024-11-07 13:22:51 +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
|
|
|
|
|
|
|
|
|
|
|
2024-12-11 19:39:09 +08:00
|
|
|
|
function showData(row: string) {
|
2024-12-05 20:29:28 +08:00
|
|
|
|
errorStandardPopup.value?.open(row, row)
|
|
|
|
|
|
}
|
2024-12-11 19:39:09 +08:00
|
|
|
|
|
2024-12-05 20:29:28 +08:00
|
|
|
|
function showTestSource(row: string) {
|
2024-12-11 19:39:09 +08:00
|
|
|
|
|
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-12-11 19:39:09 +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 = () => {
|
|
|
|
|
|
openFileDialog()
|
|
|
|
|
|
}
|
|
|
|
|
|
// 点击导出按钮
|
|
|
|
|
|
const exportClick = () => {
|
|
|
|
|
|
openFileDialog()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 点击合并按钮
|
|
|
|
|
|
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-08-26 20:05:04 +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-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
|
|
|
|
|
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
|
|
|
|
|
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>
|