689 lines
20 KiB
Vue
689 lines
20 KiB
Vue
<template>
|
|
<div class="page-container">
|
|
<n-card>
|
|
<!-- 搜索表单 -->
|
|
<div class="search-form">
|
|
<n-form inline :model="searchForm" label-placement="left">
|
|
<n-form-item label="订阅的异常">
|
|
<n-input v-model:value="searchForm.subscriptionKey" placeholder="请输入订阅的异常" />
|
|
</n-form-item>
|
|
<n-form-item>
|
|
<n-space>
|
|
<n-button type="primary" @click="handleSearch">
|
|
<template #icon><n-icon><SearchOutline /></n-icon></template>
|
|
搜索
|
|
</n-button>
|
|
<n-button @click="handleReset">
|
|
<template #icon><n-icon><RefreshOutline /></n-icon></template>
|
|
重置
|
|
</n-button>
|
|
</n-space>
|
|
</n-form-item>
|
|
</n-form>
|
|
</div>
|
|
|
|
<!-- 工具栏 -->
|
|
<div class="table-toolbar">
|
|
<n-space>
|
|
<n-button type="primary" @click="handleAdd">
|
|
<template #icon><n-icon><AddOutline /></n-icon></template>
|
|
新增
|
|
</n-button>
|
|
<!-- <n-button @click="importModalVisible = true">
|
|
<template #icon><n-icon><CloudUploadOutline /></n-icon></template>
|
|
导入
|
|
</n-button>
|
|
<n-button @click="handleExport">
|
|
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
|
导出{{ selectedIds.length > 0 ? `(${selectedIds.length})` : '' }}
|
|
</n-button>
|
|
<n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
|
|
<template #icon><n-icon><TrashOutline /></n-icon></template>
|
|
删除
|
|
</n-button> -->
|
|
</n-space>
|
|
</div>
|
|
|
|
<!-- 表格 -->
|
|
<n-data-table
|
|
:columns="columns"
|
|
:data="tableData"
|
|
:loading="loading"
|
|
:bordere="false"
|
|
striped
|
|
remote
|
|
:pagination="pagination"
|
|
:row-key="(row:any) => row.id"
|
|
@update:page="handlePageChange"
|
|
@update:page-size="handlePageSizeChange"
|
|
@update:checked-row-keys="handleCheck"
|
|
/>
|
|
</n-card>
|
|
|
|
<!-- 新增/编辑弹窗 -->
|
|
<n-modal
|
|
v-model:show="modalVisible"
|
|
preset="card"
|
|
:title="modalTitle"
|
|
style="width: 900px"
|
|
>
|
|
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="120px">
|
|
<n-grid :cols="2" :x-gap="24">
|
|
<n-gi>
|
|
<n-form-item label="订阅的异常" path="subscriptionKey">
|
|
<n-select
|
|
remote
|
|
v-model:value="formData.subscriptionKey"
|
|
placeholder="请选择订阅的异常"
|
|
:options="keyopt"
|
|
@update:value="keyupdate"
|
|
/>
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="订阅的异常字段" path="subscriptionDiscoverField">
|
|
<n-select v-model:value="formData.subscriptionDiscoverField" placeholder="请选择订阅的异常字段" :options="yiczdopt" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="异常名称" path="title">
|
|
<n-input v-model:value="formData.title" placeholder="请输入异常名称" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="订阅的设备" path="subscriptionDeviceIds">
|
|
<!-- <n-input v-model:value="formData.subscriptionDeviceIds" placeholder="请输入订阅的设备集合" /> -->
|
|
<n-select
|
|
remote
|
|
multiple
|
|
v-model:value="formData.subscriptionDeviceIds"
|
|
placeholder="请选择订阅的设备"
|
|
:options="deviclist"
|
|
/>
|
|
</n-form-item>
|
|
</n-gi>
|
|
|
|
<n-gi>
|
|
<n-form-item label="发送方式" path="sendingMethod"> <!--, 多选 1站内信 2终端推送 3APP 4第三方-->
|
|
<n-checkbox-group v-model:value="formData.sendingMethod">
|
|
<n-space>
|
|
<n-checkbox v-for="opt in sendingMethodOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-checkbox>
|
|
</n-space>
|
|
</n-checkbox-group>
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="检验值" path="discoverValue">
|
|
<n-input v-model:value="formData.discoverValue" placeholder="请输入检验值" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="检测方法" path="detectionMethod"> <!--1大于 2大于等于 3小于 4小于等于 5不等-->
|
|
<n-select v-model:value="formData.detectionMethod" placeholder="请选择检测方法" :options="detectionMethodOptions" /> <!--1大于 2大于等于 3小于 4小于等于 5不等-->
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="是否异常填报" path="abnormalReporting">
|
|
<n-radio-group v-model:value="formData.abnormalReporting">
|
|
<n-space>
|
|
<n-radio v-for="opt in abnormalReportingOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
|
|
</n-space>
|
|
</n-radio-group>
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="通知人方式" path="notifierMethod">
|
|
<n-radio-group v-model:value="formData.notifierMethod">
|
|
<n-space>
|
|
<n-radio :key="1" :value="1">操作人</n-radio>
|
|
<n-radio :key="2" :value="2">设备负责人</n-radio>
|
|
<n-radio :key="3" :value="3">指定人员</n-radio>
|
|
</n-space>
|
|
</n-radio-group>
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi>
|
|
<n-form-item label="通知人" path="notifier">
|
|
<n-select
|
|
:disabled="formData.notifierMethod != 3"
|
|
remote
|
|
multiple
|
|
v-model:value="formData.notifier"
|
|
placeholder="请选择通知人"
|
|
:options="userlist"
|
|
/>
|
|
</n-form-item>
|
|
</n-gi>
|
|
<n-gi span="24">
|
|
<n-form-item label="通知内容" path="notifierContent">
|
|
<n-input v-model:value="formData.notifierContent" type="textarea" placeholder="请输入通知内容" />
|
|
</n-form-item>
|
|
</n-gi>
|
|
</n-grid>
|
|
</n-form>
|
|
<template #footer>
|
|
<n-space justify="end">
|
|
<n-button @click="modalVisible = false">取消</n-button>
|
|
<n-button type="primary" @click="handleSubmit">确定</n-button>
|
|
</n-space>
|
|
</template>
|
|
</n-modal>
|
|
|
|
<!-- 导入弹窗 -->
|
|
<n-modal v-model:show="importModalVisible" preset="card" title="导入ErrorNotification" style="width: 500px">
|
|
<n-space vertical>
|
|
<n-alert type="info">
|
|
<template #header>导入说明</template>
|
|
<ul style="margin: 0; padding-left: 16px; line-height: 1.8">
|
|
<li>请先下载导入模板,按模板格式填写数据</li>
|
|
<li>支持 .xlsx 或 .xls 格式</li>
|
|
</ul>
|
|
</n-alert>
|
|
<n-space>
|
|
<n-button type="primary" @click="handleDownloadTemplate">
|
|
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
|
下载模板
|
|
</n-button>
|
|
</n-space>
|
|
<n-upload :max="1" accept=".xlsx,.xls" :show-file-list="true" :custom-request="handleImportUpload">
|
|
<n-upload-dragger>
|
|
<div style="margin-bottom: 12px">
|
|
<n-icon size="48" :depth="3"><CloudUploadOutline /></n-icon>
|
|
</div>
|
|
<n-text style="font-size: 16px">点击或拖拽文件到此处上传</n-text>
|
|
<n-p depth="3" style="margin: 8px 0 0 0">支持 .xlsx 或 .xls 格式</n-p>
|
|
</n-upload-dragger>
|
|
</n-upload>
|
|
</n-space>
|
|
<template #footer>
|
|
<n-button @click="importModalVisible = false">关闭</n-button>
|
|
</template>
|
|
</n-modal>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, reactive, h, onMounted } from 'vue'
|
|
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
|
|
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
|
|
import { errorNotificationApi, type ErrorNotification } from '@/api/errorNotification'
|
|
import { dictDataApi } from '@/api/org'
|
|
|
|
import { deviceApi } from '@/api/device'
|
|
|
|
import { userApi } from '@/api/system'
|
|
|
|
const message = useMessage()
|
|
const dialog = useDialog()
|
|
|
|
// 搜索表单
|
|
const searchForm = reactive({
|
|
subscriptionKey:''
|
|
})
|
|
|
|
|
|
// 表格数据
|
|
const tableData = ref<ErrorNotification[]>([])
|
|
const loading = ref(false)
|
|
const selectedIds = ref<number[]>([])
|
|
const pagination = reactive({
|
|
page: 1,
|
|
pageSize: 10,
|
|
itemCount: 0,
|
|
showSizePicker: true,
|
|
pageSizes: [10, 20, 50]
|
|
})
|
|
|
|
// 弹窗
|
|
const modalVisible = ref(false)
|
|
const modalTitle = ref('')
|
|
const importModalVisible = ref(false)
|
|
const formRef = ref()
|
|
const defaultFormData = {
|
|
subscriptionKey: '',
|
|
title: '',
|
|
subscriptionDeviceIds: '',
|
|
subscriptionDiscoverField: '',
|
|
notifierMethod:1,
|
|
sendingMethod: [],
|
|
discoverValue: '',
|
|
detectionMethod: '',
|
|
notifier: '',
|
|
notifierContent: '',
|
|
abnormalReporting: undefined,
|
|
}
|
|
let formData = reactive<any>({ ...defaultFormData })
|
|
|
|
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
|
const sendingMethodOptions = ref<{ label: string; value: any }[]>([])
|
|
const detectionMethodOptions = ref<{ label: string; value: any }[]>([])
|
|
const abnormalReportingOptions = ref<{ label: string; value: any }[]>([])
|
|
|
|
//查询异常项
|
|
let keyopt = ref<any>([])
|
|
//异常子项
|
|
let yclist = ref<any>([])
|
|
//选中异常子项
|
|
let yiczdopt = ref<any>({})
|
|
errorNotificationApi.getopt().then(rps => {
|
|
keyopt.value = rps
|
|
rps.forEach((n:any) => {
|
|
yclist.value[n.value] = n.childList
|
|
})
|
|
// keyopt.value = rps.map((n:any) => ({
|
|
// label: n.label,
|
|
// value: n.value
|
|
// }))
|
|
})
|
|
|
|
//获取设备列表
|
|
let deviclist = ref<any>([])
|
|
deviceApi.page({
|
|
page: 1,
|
|
pageSize: 100,
|
|
deviceCode:'',
|
|
deviceFlag: 'mes_equipment'
|
|
}).then(rps => {
|
|
if(rps.list && rps.list.length > 0){
|
|
deviclist.value = rps.list.map((n:any) => ({
|
|
label:n.deviceName,
|
|
value:n.id
|
|
}))
|
|
}
|
|
})
|
|
|
|
//获取员工列表
|
|
let userlist = ref<any>([])
|
|
|
|
userApi.getPathList().then(rps => {
|
|
userlist.value = rps.map((n:any) =>{
|
|
return {
|
|
label: n.username,
|
|
value: n.id
|
|
}
|
|
}
|
|
)
|
|
})
|
|
|
|
|
|
|
|
function keyupdate(v:any,n:any) {
|
|
formData.subscriptionDiscoverField = ''
|
|
yiczdopt.value = n.childList
|
|
console.log(v)
|
|
console.log(n)
|
|
}
|
|
|
|
// 表单校验规则
|
|
const formRules = {
|
|
}
|
|
|
|
// 表格列
|
|
const columns: DataTableColumns<ErrorNotification> = [
|
|
// {
|
|
// type: 'selection'
|
|
// },
|
|
{
|
|
align:"center",
|
|
title: '订阅的异常',
|
|
key: 'subscriptionName',
|
|
minWidth:200,
|
|
},
|
|
{
|
|
align:"center",
|
|
title: '订阅的异常字段',
|
|
key: 'subscriptionDiscoverFieldNames',
|
|
minWidth:150
|
|
},
|
|
{
|
|
align:"center",
|
|
title: '异常名称',
|
|
key: 'title',
|
|
minWidth:150
|
|
},
|
|
{
|
|
align:"center",
|
|
title: '订阅的设备',
|
|
key: 'subscriptionDeviceIds' ,
|
|
minWidth:150,
|
|
render(row) {
|
|
const vals = Array.isArray(row.subscriptionDeviceIds) ? row.subscriptionDeviceIds : (row.subscriptionDeviceIds ? String(row.subscriptionDeviceIds).split(',') : [])
|
|
return vals.map(v => deviclist.value.find(o => String(o.value) === String(v))?.label ?? v).filter(Boolean).join(', ') || '-'
|
|
},
|
|
},
|
|
|
|
{
|
|
align:"center",
|
|
title: '发送方式', // 1站内信 2终端推送 3APP 4第三方
|
|
key: 'sendingMethod',
|
|
render(row) {
|
|
const vals = Array.isArray(row.sendingMethod) ? row.sendingMethod : (row.sendingMethod ? String(row.sendingMethod).split(',') : [])
|
|
return vals.map(v => sendingMethodOptions.value.find(o => String(o.value) === String(v))?.label ?? v).filter(Boolean).join(', ') || '-'
|
|
},
|
|
minWidth:150
|
|
},
|
|
{
|
|
title: '检验值',
|
|
key: 'discoverValue',
|
|
align:"center",
|
|
minWidth:150,
|
|
},
|
|
{
|
|
align:"center",
|
|
title: '检测方法', //, 1大于 2大于等于 3小于 4小于等于 5不等
|
|
key: 'detectionMethod',
|
|
minWidth:150,
|
|
render(row) {
|
|
const val = row.detectionMethod
|
|
const opt = detectionMethodOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
|
return opt ? opt.label : (val ?? '-')
|
|
}
|
|
},
|
|
{
|
|
title: '通知人',
|
|
key: 'notifier',
|
|
align:"center",
|
|
minWidth:150,
|
|
render(row) {
|
|
const vals = Array.isArray(row.notifier) ? row.notifier : (row.notifier ? String(row.notifier).split(',') : [])
|
|
return vals.map(v => userlist.value.find(o => String(o.value) === String(v))?.label ?? v).filter(Boolean).join(', ') || '-'
|
|
},
|
|
},
|
|
{
|
|
title: '创建人',
|
|
key: 'createBy',
|
|
minWidth:150
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
key: 'crateTime',
|
|
minWidth:150
|
|
},
|
|
{
|
|
title: '通知内容',
|
|
key: 'notifierContent',
|
|
minWidth:150,
|
|
align:"center",
|
|
},
|
|
{
|
|
title: '是否需要异常填报',
|
|
key: 'abnormalReporting',
|
|
minWidth:150,
|
|
align:"center",
|
|
render(row) {
|
|
const val = row.abnormalReporting
|
|
const opt = abnormalReportingOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
|
return opt ? opt.label : (val ?? '-')
|
|
}
|
|
},
|
|
{
|
|
title: '操作',
|
|
key: 'actions',
|
|
width: 140,
|
|
fixed: 'right',
|
|
align:"center",
|
|
render(row) {
|
|
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
|
|
h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
|
|
default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑']
|
|
}),
|
|
h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
|
|
default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' 删除']
|
|
})
|
|
])
|
|
}
|
|
}
|
|
]
|
|
|
|
// 加载数据
|
|
async function loadData() {
|
|
loading.value = true
|
|
try {
|
|
const res = await errorNotificationApi.page({
|
|
...searchForm,
|
|
page: pagination.page,
|
|
pageSize: pagination.pageSize,
|
|
})
|
|
tableData.value = res.list
|
|
pagination.itemCount = res.total
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
// 搜索
|
|
|
|
function handleSearch() {
|
|
pagination.page = 1
|
|
loadData()
|
|
}
|
|
|
|
// 重置
|
|
function handleReset() {
|
|
searchForm.subscriptionKey = ''
|
|
handleSearch()
|
|
}
|
|
|
|
// 分页
|
|
function handlePageChange(page: number) {
|
|
pagination.page = page
|
|
loadData()
|
|
}
|
|
|
|
function handlePageSizeChange(pageSize: number) {
|
|
pagination.pageSize = pageSize
|
|
pagination.page = 1
|
|
loadData()
|
|
}
|
|
|
|
// 选择
|
|
function handleCheck(keys: Array<string | number>) {
|
|
selectedIds.value = keys as number[]
|
|
}
|
|
|
|
// 新增
|
|
function handleAdd() {
|
|
modalTitle.value = '新增'
|
|
Object.assign(formData, defaultFormData)
|
|
yiczdopt.value = []
|
|
modalVisible.value = true
|
|
formData.abnormalReporting = 1
|
|
}
|
|
|
|
// 编辑
|
|
function handleEdit(row: ErrorNotification) {
|
|
modalTitle.value = '编辑'
|
|
Object.assign(formData, row)
|
|
if (formData.crateTime && typeof formData.crateTime === 'string') {
|
|
formData.crateTime = new Date(formData.crateTime.replace(' ', 'T')).getTime()
|
|
}
|
|
|
|
//异常字段回显
|
|
if(row.subscriptionKey){
|
|
yiczdopt.value = yclist.value[row.subscriptionKey]
|
|
}
|
|
|
|
//发送方式
|
|
if(row.sendingMethod){
|
|
formData.sendingMethod = formData.sendingMethod.split(',')
|
|
//formData.sendingMethod = formData.sendingMethod.map((n:any) => n*1)
|
|
}
|
|
|
|
|
|
//设备回显
|
|
if(row.subscriptionDeviceIds){
|
|
formData.subscriptionDeviceIds = formData.subscriptionDeviceIds.split(',')
|
|
formData.subscriptionDeviceIds = formData.subscriptionDeviceIds.map((n:any) => n*1)
|
|
}
|
|
|
|
//通知人回显
|
|
if(formData.notifierMethod == 3 && row.notifier){
|
|
formData.notifier = formData.notifier.split(',')
|
|
formData.notifier = formData.notifier.map((n:any) => n*1)
|
|
}
|
|
|
|
|
|
modalVisible.value = true
|
|
}
|
|
|
|
// 提交
|
|
async function handleSubmit() {
|
|
await formRef.value?.validate()
|
|
try {
|
|
const submitData = { ...formData } as ErrorNotification
|
|
if (typeof submitData.crateTime === 'number') {
|
|
submitData.crateTime = new Date(submitData.crateTime).toISOString().slice(0, 19).replace('T', ' ')
|
|
}
|
|
|
|
if(Array.isArray(submitData.sendingMethod)){
|
|
submitData.sendingMethod = submitData.sendingMethod.join(',')
|
|
}
|
|
|
|
if(Array.isArray(submitData.subscriptionDeviceIds)){
|
|
submitData.subscriptionDeviceIds = submitData.subscriptionDeviceIds.join(',')
|
|
}
|
|
|
|
if(Array.isArray(submitData.notifier)){
|
|
submitData.notifier = submitData.notifier.join(',')
|
|
}
|
|
|
|
|
|
if (submitData.id) {
|
|
await errorNotificationApi.update(submitData)
|
|
message.success('修改成功')
|
|
} else {
|
|
await errorNotificationApi.create(submitData)
|
|
message.success('新增成功')
|
|
}
|
|
modalVisible.value = false
|
|
loadData()
|
|
} catch (error) {
|
|
// 错误已在拦截器处理
|
|
}
|
|
}
|
|
|
|
// 删除
|
|
function handleDelete(row: ErrorNotification) {
|
|
dialog.warning({
|
|
title: '提示',
|
|
content: '确定要删除该记录吗?',
|
|
positiveText: '确定',
|
|
negativeText: '取消',
|
|
onPositiveClick: async () => {
|
|
try {
|
|
await errorNotificationApi.delete([row.id!])
|
|
message.success('删除成功')
|
|
loadData()
|
|
} catch (error) {
|
|
// 错误已在拦截器处理
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 批量删除
|
|
function handleBatchDelete() {
|
|
dialog.warning({
|
|
title: '提示',
|
|
content: `确定要删除选中的 ${selectedIds.value.length} 条记录吗?`,
|
|
positiveText: '确定',
|
|
negativeText: '取消',
|
|
onPositiveClick: async () => {
|
|
try {
|
|
await errorNotificationApi.delete(selectedIds.value)
|
|
message.success('删除成功')
|
|
selectedIds.value = []
|
|
loadData()
|
|
} catch (error) {
|
|
// 错误已在拦截器处理
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 导出
|
|
async function handleExport() {
|
|
try {
|
|
const params: Record<string, any> = {}
|
|
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
|
const blob = await errorNotificationApi.export(params)
|
|
const url = window.URL.createObjectURL(blob)
|
|
const link = document.createElement('a')
|
|
link.href = url
|
|
link.download = 'ErrorNotification数据.xlsx'
|
|
link.click()
|
|
window.URL.revokeObjectURL(url)
|
|
} catch (error) {
|
|
// 错误已在拦截器处理
|
|
}
|
|
}
|
|
|
|
// 下载导入模板
|
|
async function handleDownloadTemplate() {
|
|
try {
|
|
const blob = await errorNotificationApi.downloadTemplate()
|
|
const url = window.URL.createObjectURL(blob)
|
|
const link = document.createElement('a')
|
|
link.href = url
|
|
link.download = 'ErrorNotification导入模板.xlsx'
|
|
link.click()
|
|
window.URL.revokeObjectURL(url)
|
|
} catch (error) {
|
|
// 错误已在拦截器处理
|
|
}
|
|
}
|
|
|
|
// 导入上传
|
|
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
|
|
if (!file.file) return
|
|
try {
|
|
const result = await errorNotificationApi.importData(file.file)
|
|
if (result.fail > 0) {
|
|
dialog.warning({
|
|
title: '导入结果',
|
|
content: `成功: ${result.success} 条,失败: ${result.fail} 条\n错误信息: ${(result.errors || []).join('\n') || '无'}`,
|
|
positiveText: '确定'
|
|
})
|
|
} else {
|
|
message.success(`导入成功,共 ${result.success} 条数据`)
|
|
importModalVisible.value = false
|
|
}
|
|
loadData()
|
|
} catch (error) {
|
|
// 错误已在拦截器处理
|
|
}
|
|
}
|
|
|
|
// 加载字典选项
|
|
async function loadDictOptions() {
|
|
try {
|
|
const data = await dictDataApi.listByType('sending_method')
|
|
sendingMethodOptions.value = data.map(d => ({ label: d.dictLabel, value: d.dictValue }))
|
|
} catch {}
|
|
try {
|
|
const data = await dictDataApi.listByType('detection_method')
|
|
detectionMethodOptions.value = data.map(d => ({ label: d.dictLabel, value: d.dictValue }))
|
|
} catch {}
|
|
try {
|
|
const data = await dictDataApi.listByType('sys_yes_no')
|
|
abnormalReportingOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue) }))
|
|
} catch {}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
loadData()
|
|
loadDictOptions()
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
.search-form {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.table-toolbar {
|
|
margin-bottom: 16px;
|
|
}
|
|
</style>
|