增加检测计划功能

This commit is contained in:
GYYM
2024-11-07 13:22:51 +08:00
parent 4fc0781e05
commit 1ec486a42d
9 changed files with 939 additions and 214 deletions

View File

@@ -7,7 +7,7 @@
:title='title'
:width='width'
:modal='false'>
<div class='table-box'>
<div class='table-box'>
<ProTable
ref='proTable'
:columns='columns'
@@ -16,20 +16,29 @@
@selection-change="handleSelectionChange"
>
<!-- 表格 header 按钮 -->
<template #tableHeader>
<el-button type='primary' :icon='Download' >导入设备</el-button>
<el-button type='primary' :icon='Download' >下载报告</el-button>
<el-button type='danger' :icon='Delete' plain :disabled='!multipleSelection.length'>
批量删除
<template #tableHeader="scope">
<el-tooltip content="通过文件导入设备" placement="top">
<el-button type='primary' :icon='Download' tooltip >导入设备</el-button>
</el-tooltip>
<el-tooltip content="通过设备列表导入设备" placement="top">
<el-button type='primary' :icon='Download' tooltip @click="showDeviceSelectOpen">筛选设备</el-button>
</el-tooltip>
<el-tooltip content="把设备列表导出成文件" placement="top" :disabled='!scope.isSelected'>
<el-button type='primary' :icon='Download' tooltip >导出设备</el-button>
</el-tooltip>
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
批量移除
</el-button>
</template>
<!-- <el-button type='primary' :icon='Download' >下载报告</el-button> -->
<!-- 表格操作 -->
<template #operation>
<el-button type='primary' link :icon='View'>查看</el-button>
<el-button type='primary' link :icon='Delete' ></el-button>
<template #operation='scope'>
<el-button type='primary' link :icon='View' >查看</el-button>
<el-button type='primary' link :icon='Delete' ></el-button>
</template>
</ProTable>
</div>
</div>
<DeviceSelectOpen :width='width' :height='height' ref='openDeviceSelectView' />
</el-dialog>
</template>
<script setup lang='tsx'>
@@ -39,13 +48,17 @@
import ProTable from '@/components/ProTable/index.vue'
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
import deviceDataList from '@/api/device/deviceData'
import DeviceSelectOpen from '@/views/plan/planList/components/devSelectPopup.vue'
import { useViewSize } from '@/hooks/useViewSize'
//const { popupBaseView, viewWidth, viewHeight } = useViewSize()
const deviceData = deviceDataList.plan_devicedata
const dialogVisible = ref(false)
const title = ref('')
const openDeviceSelectView = ref()
let multipleSelection = ref<string[]>([])
//
const columns = reactive<ColumnProps<Device.DeviceList>[]>([
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{
prop: 'name',
@@ -108,9 +121,13 @@
},
})
//
const showDeviceSelectOpen = () => {
openDeviceSelectView.value.open('设备筛选列表')
}
//
const handleSelectionChange = (selection:Device.DeviceList[]) => {
const handleSelectionChange = (selection:Device.ResPqDev[]) => {
multipleSelection.value = selection.map(row => row.id); //
};

View File

@@ -0,0 +1,142 @@
<template>
<el-dialog class='table-box'
v-model='dialogVisible'
top='114px'
:style="{height:height,maxHeight:height,overflow:'hidden'}"
:title='title'
:width='width'
:modal='false'>
<div class='table-box'>
<ProTable
ref='proTable'
:columns='columns'
:data='deviceData'
type='selection'
>
<!-- :requestApi="getRoleList" -->
<!-- 表格 header 按钮 -->
<template #tableHeader='scope'>
<el-button type='primary' :icon='Download' plain :disabled='!scope.isSelected' @click="exportClick">移入检测计划</el-button>
</template>
</ProTable>
</div>
</el-dialog>
</template>
<script setup lang='tsx' name='useRole'>
import { Device } from '@/api/device/interface'
import { useHandleData } from '@/hooks/useHandleData'
import { useDownload } from '@/hooks/useDownload'
import { useAuthButtons } from '@/hooks/useAuthButtons'
import ProTable from '@/components/ProTable/index.vue'
import ImportExcel from '@/components/ImportExcel/index.vue'
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
import deviceDataList from '@/api/device/deviceData'
import { useDictStore } from '@/stores/modules/dict'
import {
getPqDevList,
} from '@/api/device/device'
const dictStore = useDictStore()
const deviceData = deviceDataList.data
const dialogVisible = ref(false)
const title = ref('')
// ProTable 实例
const proTable = ref<ProTableInstance>()
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
const initParam = reactive({ type: 1 })
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
const dataCallback = (data: any) => {
return {
list: data.list,
total: data.total,
}
}
// 如果你想在请求之前对当前请求参数做一些操作可以自定义如下函数params 为当前所有的请求参数(包括分页),最后返回请求列表接口
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
newParams.createTime && (newParams.startTime = newParams.createTime[0])
newParams.createTime && (newParams.endTime = newParams.createTime[1])
delete newParams.createTime
return getPqDevList(newParams)
}
// 页面按钮权限(按钮权限既可以使用 hooks也可以直接使用 v-auth 指令指令适合直接绑定在按钮上hooks 适合根据按钮权限显示不同的内容)
const { BUTTONS } = useAuthButtons()
// 表格配置项
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{
prop: 'deviceName',
label: '名称',
search: { el: 'input' },
minWidth: 120,
},
{
prop: 'deviceType',
label: '类型',
search: { el: 'input' },
minWidth: 280,
},
{
prop: 'deviceChannels',
label: '设备通道数',
minWidth: 120,
},
{
prop: 'PlanName',
label: '所属计划',
search: { el: 'input' },
minWidth: 280,
},
{
prop: 'deviceUn',
label: '额定电压V',
minWidth: 130,
},
{
prop: 'deviceIn',
label: '额定电流A',
minWidth: 130,
},
{
prop: 'deviceCompany',
label: '制作厂商',
minWidth: 280,
},
])
const exportClick = () => {
dialogVisible.value = false
}
const open = (textTitle: string) => {
dialogVisible.value = true
title.value = textTitle
}
defineExpose({ open })
const props = defineProps({
width: {
type: String,
default: '800px',
},
height: {
type: String,
default: '744px',
},
})
</script>

View File

@@ -1,11 +1,13 @@
<template>
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall">
<!-- 基础信息弹出框 -->
<el-dialog :model-value="visible" :title="dialogTitle" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
<div>
<el-form :model="formData" ref='formRuleRef' :rules='rules'>
<el-form-item label="名称" prop="name">
<el-input v-model="formData.name" :disabled="isReadOnly"/>
<el-form-item label="名称" prop="name" :label-width="100">
<el-input v-model="formData.name" placeholder="请输入名称" autocomplete="off" :disabled="isReadOnly"/>
</el-form-item>
<el-form-item label="父计划" prop="type">
<el-select v-model="formData.father_Plan_Id" placeholder="请选择父计划" :disabled="isReadOnly">
<el-form-item label="父计划" prop="father_Plan_Id" :label-width="100">
<el-select v-model="formData.father_Plan_Id" placeholder="请选择父计划" autocomplete="off" :disabled="isReadOnly" @change="fatherPlanChange">
<el-option
v-for="plan in fatherPlanList"
:key="plan.value"
@@ -13,37 +15,40 @@
:value="plan.value">
</el-option>
</el-select>
</el-form-item> <el-form-item label="数据源" prop="type">
<el-select v-model="formData.dataSource_Id" placeholder="请选择数据源" :disabled="isReadOnly">
</el-form-item>
<el-form-item label="数据源" prop="dataSource_Id" :label-width="100">
<el-select v-model="formData.dataSource_Id" placeholder="请选择数据源" autocomplete="off" :disabled="isReadOnly">
<el-option
v-for="plan in sourceList"
:key="plan.value"
v-for="plan in testSoureDataList"
:key="plan.id"
:label="plan.label"
:value="plan.value">
</el-option>
</el-select>
</el-form-item> <el-form-item label="检测脚本" prop="type">
<el-select v-model="formData.script_Id" placeholder="请选择检测脚本" :disabled="isReadOnly">
<el-option
v-for="plan in scriptList"
:key="plan.value"
:label="plan.label"
:value="plan.value">
:value="plan.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="误差体系" prop="type" >
<el-select v-model="formData.error_Sys_Id" placeholder="请选择误差体系" :disabled="isReadOnly">
<el-form-item label="检测脚本" prop="script_Id" :label-width="100">
<el-select v-model="formData.script_Id" placeholder="请选择检测脚本" autocomplete="off" :disabled="isReadOnly">
<el-option
v-for="plan in errorList"
:key="plan.value"
v-for="plan in testScriptDataList"
:key="plan.id"
:label="plan.label"
:value="plan.value">
:value="plan.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="误差体系" prop="error_Sys_Id" :label-width="100">
<el-select v-model="formData.error_Sys_Id" placeholder="请选择误差体系" autocomplete="off" :disabled="isReadOnly">
<el-option
v-for="plan in testErrSystDataList"
:key="plan.id"
:label="plan.label"
:value="plan.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
@@ -57,6 +62,8 @@
import{ElMessage, FormInstance,FormItemRule}from'element-plus'
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
import { dialogSmall} from '@/utils/elementBind'
import {dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,testSoureDataList,testScriptDataList,testErrSystDataList,planData} from '@/api/plan/planData'
const props = defineProps<{
visible: boolean;
dialogTitle: string;
@@ -112,7 +119,11 @@ const emit = defineEmits<{
const formRuleRef = ref<FormInstance>()
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
father_Plan_Id: [{ required: true, message: '参照标准名称必填', trigger: 'change' }],
dataSource_Id: [{ required: true, message: '数据源必选', trigger: 'blur' }],
script_Id: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
error_Sys_Id: [{ required: true, message: '误差体系必选!', trigger: 'blur' }],
// name: [{ required: true, message: '', trigger: 'blur' }],
// father_Plan_Id: [{ required: true, message: '', trigger: 'change' }],
});
@@ -137,7 +148,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
}
else
{
ElMessage.error('表单验证失败')
ElMessage.error('请填选必填项')
}
})
} catch (error) {

View File

@@ -0,0 +1,107 @@
<!--单列-->
<template>
<el-dialog class='table-box'
v-model='dialogVisible'
top='114px'
:style="{height:height,maxHeight:height,overflow:'hidden'}"
:title='title'
:width='width'
:modal='false'>
<div class='table-box'>
<ProTable
ref='proTable'
:columns='columns'
:data='SourceData'
type='selection'
>
<!-- 表格 header 按钮 -->
<template #tableHeader="scope">
<el-tooltip content="通过检测源列表导入检测源" placement="top">
<el-button type='primary' :icon='Download' tooltip @click="showSourceSelectOpen">筛选检测源</el-button>
</el-tooltip>
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
批量移除
</el-button>
</template>
<!-- <el-button type='primary' :icon='Download' >下载报告</el-button> -->
<!-- 表格操作 -->
<template #operation='scope'>
<el-button type='primary' link :icon='View' >查看</el-button>
<el-button type='primary' link :icon='Delete' >移除</el-button>
</template>
</ProTable>
</div>
<SourceSelectOpen :width='width' :height='height' ref='openSourceSelectView' />
</el-dialog>
</template>
<script setup lang='tsx'>
import { Delete, View ,Upload,Download} from '@element-plus/icons-vue'
import { reactive,ref } from 'vue'
import type { TestSource } from '@/api/testSource/interface'
import ProTable from '@/components/ProTable/index.vue'
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
import sourceDataList from '@/api/testSource/testSourceData'
import SourceSelectOpen from '@/views/plan/planList/components/sourceSelectPopup.vue'
import { useDictStore } from '@/stores/modules/dict'
const SourceData = sourceDataList
const dialogVisible = ref(false)
const title = ref('')
const openSourceSelectView = ref()
const dictStore = useDictStore()
// 表格配置项
const columns = reactive<ColumnProps<TestSource.TestSourceBO>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{
prop: 'testSourceName',
label: '名称',
search: { el: 'input' },
minWidth: 180,
},
{
prop: 'testSourceType',
label: '设备类型',
// enum: dictStore.getDictData('testSourceDevType'),
// fieldNames: { label: 'label', value: 'id' },
search: { el: 'select' },
minWidth: 220,
},
{
prop: 'testSourceModel',
label: '源类型',
// enum: dictStore.getDictData('testSourceType'),
// fieldNames: { label: 'label', value: 'id' },
search: { el: 'select' },
minWidth: 150,
},
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
])
const open = (textTitle: string) => {
dialogVisible.value = true
title.value = textTitle
}
defineExpose({ open })
const props = defineProps({
width: {
type: String,
default: '800px',
},
height: {
type: String,
default: '744px',
},
})
const showSourceSelectOpen = () => {
openSourceSelectView.value.open('检测源筛选列表')
}
</script>
<style>
</style>

View File

@@ -0,0 +1,126 @@
<template>
<el-dialog class='table-box'
v-model='dialogVisible'
top='114px'
:style="{height:height,maxHeight:height,overflow:'hidden'}"
:title='title'
:width='width'
:modal='false'>
<div class='table-box'>
<ProTable
ref='proTable'
:columns='columns'
:data='testSourceData'
type='selection'
>
<!-- :request-api="getTableList" 如果要显示静态数据就切换该配置-->
<!-- 表格 header 按钮 -->
<template #tableHeader='scope'>
<el-button type='primary' :icon='Download' plain :disabled='!scope.isSelected' @click="exportClick">移入检测计划</el-button>
</template>
</ProTable>
</div>
</el-dialog>
</template>
<script setup lang='tsx' name='useRole'>
import { TestSource } from '@/api/testSource/interface'
import { useHandleData } from '@/hooks/useHandleData'
import { useDownload } from '@/hooks/useDownload'
import { useAuthButtons } from '@/hooks/useAuthButtons'
import ProTable from '@/components/ProTable/index.vue'
import ImportExcel from '@/components/ImportExcel/index.vue'
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
import testSourceDataList from '@/api/testSource/testSourceData'
import { useDictStore } from '@/stores/modules/dict'
import {
getTestSourceList,
} from '@/api/testSource/testSource'
const dictStore = useDictStore()
const dialogVisible = ref(false)
const title = ref('')
const testSourceData = testSourceDataList
// ProTable 实例
const proTable = ref<ProTableInstance>()
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
const initParam = reactive({ pattern: 1 })//表示当前用户选择的是模拟式测试后期要读取pinia中的数据 TODO...
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
const dataCallback = (data: any) => {
return {
list: data.list,
total: data.total,
pageNum: data.pageNum,
pageSize: data.pageSize,
}
}
// 如果你想在请求之前对当前请求参数做一些操作可以自定义如下函数params 为当前所有的请求参数(包括分页),最后返回请求列表接口
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
newParams.createTime && (newParams.startTime = newParams.createTime[0])
newParams.createTime && (newParams.endTime = newParams.createTime[1])
delete newParams.createTime
return getTestSourceList(newParams)
}
// 页面按钮权限(按钮权限既可以使用 hooks也可以直接使用 v-auth 指令指令适合直接绑定在按钮上hooks 适合根据按钮权限显示不同的内容)
const { BUTTONS } = useAuthButtons()
// 表格配置项
const columns = reactive<ColumnProps<TestSource.TestSourceBO>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{
prop: 'testSourceName',
label: '名称',
search: { el: 'input' },
minWidth: 180,
},
{
prop: 'testSourceType',
label: '设备类型',
// enum: dictStore.getDictData('testSourceDevType'),
// fieldNames: { label: 'label', value: 'id' },
search: { el: 'select' },
minWidth: 220,
},
{
prop: 'testSourceModel',
label: '源类型',
// enum: dictStore.getDictData('testSourceType'),
// fieldNames: { label: 'label', value: 'id' },
search: { el: 'select' },
minWidth: 150,
},
])
const exportClick = () => {
dialogVisible.value = false
}
const open = (textTitle: string) => {
dialogVisible.value = true
title.value = textTitle
}
defineExpose({ open })
const props = defineProps({
width: {
type: String,
default: '800px',
},
height: {
type: String,
default: '744px',
},
})
</script>

View File

@@ -7,26 +7,27 @@
>
<!-- 表格 header 按钮 -->
<template #tableHeader='scope'>
<el-button type='primary' :icon='Download' >导入</el-button>
<el-button type='primary' :icon='CirclePlus' >合并</el-button>
<el-button type='primary' :icon='Download' @click="importClick">导入</el-button>
<el-button type='primary' :icon='CirclePlus' :disabled='!(scope.selectedList.length > 1)' @click="combineClick">合并</el-button>
<el-button type='primary' :icon='CirclePlus' @click="openAddDialog">新增</el-button>
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
批量删除
</el-button>
<input type="file" style="display: none" ref="fileInput" @change="handleFiles">
</template>
<!-- 表格操作 -->
<template #operation='scope'>
<el-button type='primary' link :icon='View' @click="handleRowClick(scope.row)">查看</el-button>
<el-button type='primary' link :icon='Upload'>导出</el-button>
<!-- <el-button type='primary' link :icon='View' @click="handleRowClick(scope.row)">查看</el-button> -->
<el-button type='primary' link :icon='Upload' @click="exportClick">导出</el-button>
<el-button type='primary' link :icon='EditPen' @click="openEditDialog(scope.row)">编辑</el-button>
<el-button type='primary' link :icon='Delete' >删除</el-button>
<el-button type='primary' link :icon='List' @click="showDeviceOpen(scope.row)">设备</el-button>
<el-button type='primary' link :icon='List' @click="showtestSourceOpen(scope.row)">检测源</el-button>
<el-button type='primary' link :icon='List' @click="showDeviceOpen(scope.row)">所属设备</el-button>
<el-button type='primary' link :icon='List' @click="showtestSourceOpen(scope.row)">所属检测源</el-button>
</template>
</ProTable>
<!-- 新增/编辑误差体系对话框 -->
<PlanDialog
<!-- 向计划导入/导出设备对话框 -->
<planPopup
:visible="dialogFormVisible"
:formData="dialogForm"
:dialogTitle="dialogTitle"
@@ -35,31 +36,44 @@
/>
</div>
<open :width='viewWidth' :height='viewHeight' ref='openView' />
<DeviceOpen :width='viewWidth' :height='viewHeight' ref='openDeviceView' />
<SourceOpen :width='viewWidth' :height='viewHeight' ref='openSourceView' />
</template>
<script setup lang="ts" name='useProTable'>
import ProTable from '@/components/ProTable/index.vue'
import type { ColumnProps } from '@/components/ProTable/interface'
import TimeControl from '@/components/TimeControl/index.vue'
import type { ProTableInstance,ColumnProps } from '@/components/ProTable/interface'
import { CirclePlus, Delete,EditPen,View,Upload,Download,List} from '@element-plus/icons-vue'
import planDataList from '@/api/plan/planData'
import {dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,testSoureDataList,testScriptDataList,testErrSystDataList,planData} from '@/api/plan/planData'
import { reactive,ref } from 'vue'
import type { Plan } from '@/api/plan/interface'
import PlanDialog from "@/views/plan/planList/components/PlanDialog.vue"; // 导入子组件
import Open from '@/views/plan/planList/components/PlanOpen.vue'
import planPopup from "@/views/plan/planList/components/planPopup.vue"; // 导入子组件
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
import SourceOpen from '@/views/plan/planList/components/sourcePopup.vue'
import { useViewSize } from '@/hooks/useViewSize'
import { useRouter } from "vue-router";
import { useDictStore } from '@/stores/modules/dict'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { Action } from 'element-plus'
const dictStore = useDictStore()
// 定义包含和排除的单位
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
const excludedUnits = ['季度','年']; // 要排除的单位
const defaultUnits = '日'; // 默认的单位
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
const openView = ref()
const planData = planDataList
const openDeviceView = ref()
const openSourceView = ref()
// ProTable 实例
const proTable = ref<ProTableInstance>()
// const planData = planData
const dialogFormVisible = ref(false)
const dialogTitle = ref('')
const isReadOnly = ref(false)
const router = useRouter();
const dialogForm = ref<Plan.PlanList>({
id: '',
const dialogForm = ref<Plan.PlanBO>({
id: '' ,
name: '',
pattern:'',
father_Plan_Id:'',
@@ -68,7 +82,6 @@ const dialogForm = ref<Plan.PlanList>({
error_Sys_Id:'',
test_State: '',
report_State: '',
state:0,
result:'',
@@ -76,7 +89,7 @@ const dialogForm = ref<Plan.PlanList>({
// 表格配置项
const columns = reactive<ColumnProps<Plan.PlanList>[]>([
const columns = reactive<ColumnProps<Plan.PlanBO>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{
prop: 'name',
@@ -87,16 +100,22 @@ const columns = reactive<ColumnProps<Plan.PlanList>[]>([
prop: 'dataSource_Id',
label: '数据源名称',
width: 200,
enum: testSoureDataList,
fieldNames: { label: 'label', value: 'id' },
},
{
prop: 'script_Id',
label: '检测脚本',
width: 300,
enum: testScriptDataList,
fieldNames: { label: 'label', value: 'id' },
},
{
prop: 'error_Sys_Id',
label: '误差体系',
width: 200,
enum: testErrSystDataList,
fieldNames: { label: 'label', value: 'id' },
},
{
prop: 'test_State',
@@ -130,8 +149,77 @@ const columns = reactive<ColumnProps<Plan.PlanList>[]>([
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 500, },
])
const fileInput = ref<HTMLInputElement | null>(null); // 声明 fileInput
function openFileDialog() {
if (fileInput.value) {
fileInput.value.click();
}
}
function handleFiles(event: Event) {
const target = event.target as HTMLInputElement;
const files = target.files;
if (files && files.length > 0) {
// 处理文件
console.log(files);
ElMessageBox.confirm(
'导入的数据与当前数据有冲突,请选择以哪个数据为主进行覆盖',
'数据冲突',
{
distinguishCancelAndClose: true,
confirmButtonText: '以导入数据为主覆盖',
cancelButtonText: '以当前数据为主覆盖',
type: 'warning',
}
)
.then(() => {
ElMessage({
type: 'info',
message: '以导入数据为主完成数据覆盖',
})
})
.catch((action: Action) => {
ElMessage({
type: 'info',
message:
action === 'cancel'
? '以当前数据为主完成数据覆盖'
: '取消本次导入操作',
})
})
}
}
// 点击导入按钮
const importClick = () => {
openFileDialog()
}
// 点击导出按钮
const exportClick = () => {
openFileDialog()
}
// 点击合并按钮
const combineClick = () => {
ElMessageBox.prompt(
'请输入合并后的计划名称',
'检测计划合并',
{
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
}
)
.then(({ value }) => {
console.log(`合并后的计划名为:`,value)
proTable.value?.clearSelection()
proTable.value?.getTableList()
})
}
// 打开编辑对话框
const openEditDialog = (planSystem: Plan.PlanList) => {
const openEditDialog = (planSystem: Plan.PlanBO) => {
dialogForm.value = {...planSystem};
dialogTitle.value = '编辑检测计划';
isReadOnly.value = false;
@@ -150,7 +238,6 @@ const openAddDialog = () => {
error_Sys_Id:'',
test_State: '',
report_State: '',
state:0,
result:'',
};
dialogTitle.value = '新增检测计划';
@@ -158,21 +245,22 @@ const openAddDialog = () => {
dialogFormVisible.value = true; // 打开对话框
};
const handleRowClick = (planSystem: Plan.PlanList) =>{
const handleRowClick = (planSystem: Plan.PlanBO) =>{
dialogForm.value = {...planSystem};
dialogTitle.value = '查看检测计划';
isReadOnly.value = true;
dialogFormVisible.value = true; // 打开对话框
}
const showDeviceOpen = (planSystem: Plan.PlanList) => {
openView.value.open('设备列表')
const showDeviceOpen = (planSystem: Plan.PlanBO) => {
openDeviceView.value.open('计划设备列表')
}
const showtestSourceOpen=(planSystem: Plan.PlanList)=>{
router.push({
path: "/machine/testSource",
});
const showtestSourceOpen=(planSystem: Plan.PlanBO)=>{
openSourceView.value.open('计划检测源列表')
// router.push({
// path: "/machine/testSource",
// });
}
</script>