This commit is contained in:
andy 2026-07-27 16:42:20 +08:00
commit 77aae7a280
25 changed files with 2382 additions and 317 deletions

View File

@ -28,6 +28,8 @@ export interface BasicProcessPlan {
createTime?: string
status?:number
}
// 基础主数据--工序表 API

View File

@ -0,0 +1,69 @@
import { request } from '@/utils/request'
// 叫料记录 类型定义
export interface CallingMaterials {
id?: number
userId?: number
deviceId?: number
status?: number
createTime?: string
}
// 叫料记录 API
export const callingMaterialsApi = {
// 分页查询
page(params: { page: number; pageSize: number; deviceId?: number; status?: number }) {
return request({ url: '/biz/callingMaterials/page', method: 'get', params })
},
// 获取详情
detail(id: string) {
return request({ url: `/biz/callingMaterials/${id}`, method: 'get' })
},
// 新增
create(data: CallingMaterials) {
return request({ url: '/biz/callingMaterials', method: 'post', data })
},
// 修改
update(data: CallingMaterials) {
return request({ url: '/biz/callingMaterials', method: 'put', data })
},
// 删除
delete(ids: string[]) {
return request({ url: `/biz/callingMaterials/${ids.join(',')}`, method: 'delete' })
},
// 导出
export(params?: { ids?: string[]; deviceId?: number; status?: number }) {
const p: Record<string, any> = {}
if (params?.ids?.length) p.ids = params.ids.join(',')
if (params?.deviceId !== undefined && params?.deviceId !== null) p.deviceId = params.deviceId
if (params?.status !== undefined && params?.status !== null) p.status = params.status
return request({ url: `/biz/callingMaterials/export`, method: 'get', params: p, responseType: 'blob' })
},
// 导入
importData(file: File) {
const formData = new FormData()
formData.append('file', file)
return request<{ success: number; fail: number; errors: string[] }>({
url: `/biz/callingMaterials/import`,
method: 'post',
data: formData,
headers: { 'Content-Type': 'multipart/form-data' }
})
},
// 下载导入模板
downloadTemplate() {
return request({ url: `/biz/callingMaterials/template`, method: 'get', responseType: 'blob' })
}
}

View File

@ -20,6 +20,7 @@ export interface Device{
synEquipId?: number | null,
createTime:string,
updateTime:string
abnormalRecordList:[]
}
export interface DeviceRealtimeVO {

View File

@ -0,0 +1,112 @@
import { request } from '@/utils/request'
// 设备异常记录表 类型定义
export interface DeviceAbnormalRecord {
id?: number
abnormalCode?: string
deviceId?: number
deviceCode?: string
deviceName?: string
stationId?: number
stationName?: string
abnormalType?: string
abnormalTypeName?: string
abnormalLevel?: string
abnormalLevelName?: string
abnormalDesc?: string
abnormalTime?: string
status?: string
statusName?: string
handler?: string
handleTime?: string
handleResult?: string
affectDuration?: number
abnormalFrequency?: string
remark?: string
createTime?: string
createBy?: string
}
// 设备异常记录表 API
export const deviceAbnormalRecordApi = {
// 分页查询
page(params: { page: number; pageSize: number; id?: number; status?: string }) {
return request({ url: '/biz/deviceAbnormalRecord/page', method: 'get', params })
},
// 获取详情
detail(id: number) {
return request({ url: `/biz/deviceAbnormalRecord/${id}`, method: 'get' })
},
// 新增
create(data: DeviceAbnormalRecord) {
return request({ url: '/biz/deviceAbnormalRecord', method: 'post', data })
},
// 修改
update(data: DeviceAbnormalRecord) {
return request({ url: '/biz/deviceAbnormalRecord', method: 'put', data })
},
// 删除
delete(ids: number[]) {
return request({ url: `/biz/deviceAbnormalRecord/${ids.join(',')}`, method: 'delete' })
},
// 导出
export(params?: { ids?: number[]; id?: number; status?: string }) {
const p: Record<string, any> = {}
if (params?.ids?.length) p.ids = params.ids.join(',')
if (params?.id !== undefined && params?.id !== null) p.id = params.id
if (params?.status !== undefined && params?.status !== null) p.status = params.status
return request({ url: `/biz/deviceAbnormalRecord/export`, method: 'get', params: p, responseType: 'blob' })
},
// 导入
importData(file: File) {
const formData = new FormData()
formData.append('file', file)
return request<{ success: number; fail: number; errors: string[] }>({
url: `/biz/deviceAbnormalRecord/import`,
method: 'post',
data: formData,
headers: { 'Content-Type': 'multipart/form-data' }
})
},
// 下载导入模板
downloadTemplate() {
return request({ url: `/biz/deviceAbnormalRecord/template`, method: 'get', responseType: 'blob' })
},
//根据设备Id获取异常记录列表
getDeviceErrorLogList(deviceId: number) {
return request({
url: `/biz/deviceAbnormalRecord/getDeviceErrorLogList/${deviceId}`,
method: 'get'
})
}
}

69
src/api/deviceGather.ts Normal file
View File

@ -0,0 +1,69 @@
import { request } from '@/utils/request'
// 设备采集 类型定义
export interface DeviceGather {
id?: number
deviceId?: number
assingWorkId?: number
userId?: number
gatherNum?: number
gatherTime?: string
}
// 设备采集 API
export const deviceGatherApi = {
// 分页查询
page(params: { page: number; pageSize: number }) {
return request({ url: '/biz/deviceGather/page', method: 'get', params })
},
// 获取详情
detail(id: string) {
return request({ url: `/biz/deviceGather/${id}`, method: 'get' })
},
// 新增
create(data: DeviceGather) {
return request({ url: '/biz/deviceGather', method: 'post', data })
},
// 修改
update(data: DeviceGather) {
return request({ url: '/biz/deviceGather', method: 'put', data })
},
// 删除
delete(ids: string[]) {
return request({ url: `/biz/deviceGather/${ids.join(',')}`, method: 'delete' })
},
// 导出
export(params?: { ids?: string[] }) {
const p: Record<string, any> = {}
if (params?.ids?.length) p.ids = params.ids.join(',')
return request({ url: `/biz/deviceGather/export`, method: 'get', params: p, responseType: 'blob' })
},
// 导入
importData(file: File) {
const formData = new FormData()
formData.append('file', file)
return request<{ success: number; fail: number; errors: string[] }>({
url: `/biz/deviceGather/import`,
method: 'post',
data: formData,
headers: { 'Content-Type': 'multipart/form-data' }
})
},
// 下载导入模板
downloadTemplate() {
return request({ url: `/biz/deviceGather/template`, method: 'get', responseType: 'blob' })
}
}

View File

@ -0,0 +1,83 @@
import { request } from '@/utils/request'
// ErrorNotification 类型定义
export interface ErrorNotification {
id?: number
subscriptionKey?: string
title?: string
subscriptionDeviceIds?: string
subscriptionDiscoverField?: string
sendingMethod?: string
discoverValue?: string
detectionMethod?: string
notifier?: string
createBy?: number
crateTime?: string
notifierContent?: string
abnormalReporting?: number
}
// ErrorNotification API
export const errorNotificationApi = {
// 分页查询
page(params: { page: number; pageSize: number }) {
return request({ url: '/biz/errorNotification/page', method: 'get', params })
},
// 获取详情
detail(id: string) {
return request({ url: `/biz/errorNotification/${id}`, method: 'get' })
},
// 新增
create(data: ErrorNotification) {
return request({ url: '/biz/errorNotification', method: 'post', data })
},
// 修改
update(data: ErrorNotification) {
return request({ url: '/biz/errorNotification', method: 'put', data })
},
// 删除
delete(ids: string[]) {
return request({ url: `/biz/errorNotification/${ids.join(',')}`, method: 'delete' })
},
// 导出
export(params?: { ids?: string[] }) {
const p: Record<string, any> = {}
if (params?.ids?.length) p.ids = params.ids.join(',')
return request({ url: `/biz/errorNotification/export`, method: 'get', params: p, responseType: 'blob' })
},
// 导入
importData(file: File) {
const formData = new FormData()
formData.append('file', file)
return request<{ success: number; fail: number; errors: string[] }>({
url: `/biz/errorNotification/import`,
method: 'post',
data: formData,
headers: { 'Content-Type': 'multipart/form-data' }
})
},
// 下载导入模板
downloadTemplate() {
return request({ url: `/biz/errorNotification/template`, method: 'get', responseType: 'blob' })
}
}

View File

@ -1,5 +1,19 @@
import { request } from '@/utils/request'
export interface ncCode {
id?: number,
ncCode?: string,
ncName?: string,
ncContent?: string,
ncDesc?: string,
status?: number,
createTime?: string,
updateTime?: string,
remark?: string,
createBy?: string,
}
//新增代码库
export function addnccode(data:any) {
return request({

View File

@ -1,5 +1,5 @@
import { request } from '@/utils/request'
import { any } from 'three/tsl'
// 质检项表 类型定义
export interface QcItem {
@ -11,7 +11,9 @@ export interface QcItem {
plans?: string
desc?: string
description?: string
status?: number
createby?: number

View File

@ -8,6 +8,9 @@ export interface QcitemProcess {
processId?: number
page?:number
pageSize?:number
}
// 质检项和工序关联表 API

View File

@ -1,5 +1,5 @@
import { request } from '@/utils/request'
import { st } from 'vue-router/dist/router-CWoNjPRp.mjs'
export interface Section{
id?: number,
@ -70,10 +70,16 @@ export const sectionApi = {
list(params:{sectionName:string}) {
return request({
url:"/biz/section/list",
url:"/biz/section/listBySectionName",
method:"get",
params
})
},
listNoParam(){
return request({
url:"/biz/section/list",
method:"get"
})
}
}

View File

@ -289,6 +289,24 @@ const routes: RouteRecordRaw[] = [
component: () => import('@/views/biz/outsourcing/index.vue'),
meta: { title: '工序委外', icon: 'ListOutline' }
},
{
path: 'biz/deviceGather',
name: 'deviceGather',
component: () => import('@/views/biz/deviceGather/index.vue'),
meta: { title: '设备采集', icon: 'ListOutline' }
},
{
path: 'biz/callingMaterials',
name: 'callingMaterials',
component: () => import('@/views/biz/callingMaterials/index.vue'),
meta: { title: '叫料记录', icon: 'ListOutline' }
},
{
path: 'biz/errorNotification',
name: 'errorNotification',
component: () => import('@/views/biz/errorNotification/index.vue'),
meta: { title: 'ErrorNotification', icon: 'ListOutline' }
},
{
// 开发工具
path: 'tool/gen',

View File

@ -247,7 +247,6 @@ import {
reactive,
h,
onMounted,
watch,
} from 'vue'
@ -258,27 +257,25 @@ import {
NSpace,
NPagination,
NGrid,
// NGi,
NTag,
useMessage,
useDialog,
//type FormInst,
NDropdown,
} from 'naive-ui'
import {
SearchOutline,
RefreshOutline,
AddOutline,
ArrowDownCircleOutline
ArrowDownCircleOutline,
EllipsisHorizontalOutline
} from '@vicons/ionicons5'
import { useUserStore } from '@/stores/user'
//import { dictDataApi } from '@/api/org'
import {
addnccode,
nccodelist,
batchIssue,
deleteIssue,
editccode,
issuecopy,
generateNccode,
@ -295,6 +292,7 @@ const userStore = useUserStore()
//
const hasPermission = (permission: string) => userStore.hasPermission(permission)
//const ncDispatchRecords = ref<ncCode[]>([])
//
//const qcAssingStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
@ -784,6 +782,13 @@ function handleExport() {
getlist()
//
async function handleDispatchRecord(row:ncCode){
const ncId = row.id
// ncDispatchRecords.value = await
}
onMounted(() => {
//

View File

@ -33,10 +33,10 @@
<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">
<!-- <n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
<template #icon><n-icon><TrashOutline /></n-icon></template>
删除
</n-button>
</n-button> -->
</n-space>
</div>
@ -287,6 +287,7 @@ const defaultFormData: BasicProcessPlan = {
workCenterName: '',
departmentName: '',
operDescription: '',
status:undefined
}
const formData = reactive<BasicProcessPlan>({ ...defaultFormData })
@ -328,6 +329,30 @@ const columns: DataTableColumns<BasicProcessPlan> = [
{ title: '工作中心', key: 'workCenterName' },
{ title: '生产车间', key: 'departmentName' },
{ title: '工序说明', key: 'operDescription' },
{ title: '状态', key: 'status',
render(row){
if(row.status == 0){
return h(NTag, {
type:'error',
size: 'small'
},
{
default: () => '禁用'
}
)
}
if(row.status == 1){
return h(NTag, {
type:'success',
size: 'small'
},
{
default: () => '启用'
}
)
}
}
},
{ title: '创建人', key: 'createBy' },
{ title: '创建时间', key: 'createTime', width: 180 },
{
@ -340,9 +365,9 @@ const columns: DataTableColumns<BasicProcessPlan> = [
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) }), ' 删除']
}),
// h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
// default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' ']
// }),
h(NButton, { size: 'small', quaternary: true, onClick: () => handleOpenRelateModel(row) }, {
default: () => ['关联质检项']
})

View File

@ -0,0 +1,388 @@
<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.deviceId" placeholder="请输入叫料设备" clearable />
</n-form-item>
<n-form-item label="叫料状态 1叫料中 2调度确认">
<n-select v-model:value="searchForm.status" placeholder="请选择叫料状态 1叫料中 2调度确认" clearable style="width: 150px" :options="statusOptions" />
</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"
:pagination="pagination"
:row-key="(row) => row.id"
:scroll-x="1200"
@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: 600px">
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
</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="导入叫料记录" 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 { callingMaterialsApi, type CallingMaterials } from '@/api/callingMaterials'
import { dictDataApi } from '@/api/org'
const message = useMessage()
const dialog = useDialog()
//
const searchForm = reactive({
deviceId: null as number | null,
status: null as number | null,
})
//
const tableData = ref<CallingMaterials[]>([])
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: CallingMaterials = {
}
const formData = reactive<CallingMaterials>({ ...defaultFormData })
// //使
const statusOptions = ref<{ label: string; value: any }[]>([])
//
const formRules = {
}
//
const columns: DataTableColumns<CallingMaterials> = [
{ type: 'selection' },
{ title: '叫料人', key: 'userId' },
{ title: '叫料设备', key: 'deviceId' },
{ title: '叫料状态 1叫料中 2调度确认', key: 'status',
render(row) {
const val = row.status
const opt = statusOptions.value.find(o => o.value === val || String(o.value) === String(val))
return opt ? opt.label : (val ?? '-')
}
},
{ title: '叫料时间', key: 'createTime', width: 180 },
{
title: '操作',
key: 'actions',
width: 140,
fixed: 'right',
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 callingMaterialsApi.page({
page: pagination.page,
pageSize: pagination.pageSize,
deviceId: searchForm.deviceId || undefined,
status: searchForm.status || undefined,
})
tableData.value = res.list
pagination.itemCount = res.total
} finally {
loading.value = false
}
}
//
function handleSearch() {
pagination.page = 1
loadData()
}
//
function handleReset() {
searchForm.deviceId = null
searchForm.status = null
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)
modalVisible.value = true
}
//
function handleEdit(row: CallingMaterials) {
modalTitle.value = '编辑叫料记录'
Object.assign(formData, row)
if (formData.createTime && typeof formData.createTime === 'string') {
formData.createTime = new Date(formData.createTime.replace(' ', 'T')).getTime()
}
modalVisible.value = true
}
//
async function handleSubmit() {
await formRef.value?.validate()
try {
const submitData = { ...formData } as CallingMaterials
if (typeof submitData.createTime === 'number') {
submitData.createTime = new Date(submitData.createTime).toISOString().slice(0, 19).replace('T', ' ')
}
if (submitData.id) {
await callingMaterialsApi.update(submitData)
message.success('修改成功')
} else {
await callingMaterialsApi.create(submitData)
message.success('新增成功')
}
modalVisible.value = false
loadData()
} catch (error) {
//
}
}
//
function handleDelete(row: CallingMaterials) {
dialog.warning({
title: '提示',
content: '确定要删除该记录吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await callingMaterialsApi.delete([row.id!])
message.success('删除成功')
loadData()
} catch (error) {
//
}
}
})
}
//
function handleBatchDelete() {
dialog.warning({
title: '提示',
content: `确定要删除选中的 ${selectedIds.value.length} 条记录吗?`,
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await callingMaterialsApi.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
if (searchForm.deviceId != null) params.deviceId = searchForm.deviceId
if (searchForm.status != null) params.status = searchForm.status
const blob = await callingMaterialsApi.export(params)
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '叫料记录数据.xlsx'
link.click()
window.URL.revokeObjectURL(url)
} catch (error) {
//
}
}
//
async function handleDownloadTemplate() {
try {
const blob = await callingMaterialsApi.downloadTemplate()
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '叫料记录导入模板.xlsx'
link.click()
window.URL.revokeObjectURL(url)
} catch (error) {
//
}
}
//
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
if (!file.file) return
try {
const result = await callingMaterialsApi.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('sys_status')
statusOptions.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>

View File

@ -0,0 +1,58 @@
<script setup lang="ts">
import {DeviceAbnormalRecord} from "@/api/deviceAbnormalRecord.ts";
import {DataTableColumns, NDataTable, NTag} from "naive-ui";
import {h, onMounted, ref} from "vue";
import {dictDataApi} from "@/api/org.ts";
const deviceNormalRecordOptions = ref<{ label: string; value: any;class:any }[]>([])
const props = defineProps<{
deviceAbnormalRecordList: DeviceAbnormalRecord[]
}>()
//
const deviceAbnormalRecordColums:DataTableColumns<DeviceAbnormalRecord> = [
{ title: '异常编号', key: 'abnormalCode',align: 'center' },
{ title: '异常类型', key: 'abnormalType',align: 'center' },
{ title: '异常级别', key: 'abnormalLevel',align: 'center'},
{ title: '异常描述', key: 'abnormalDesc',align: 'center' },
{ title: '异常时间', key: 'abnormalTime',align: 'center' },
{ title: '处理状态', key: 'status',align: 'center',
render(row) {
const val = row.status
const opt = deviceNormalRecordOptions.value.find(o => o.value === val || String(o.value) === String(val))
if (!opt) return val ?? '-'
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
}
},
{ title: '检验完成时间', key: 'inspectTime',align: 'center' },
]
async function loadDictOptions() {
try {
const data = await dictDataApi.listByType('device_abnormal_status')
deviceNormalRecordOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
}catch {}
}
onMounted(()=>{
loadDictOptions()
})
</script>
<template>
<n-card>
<n-data-table
:columns="deviceAbnormalRecordColums"
size="small"
:data="props.deviceAbnormalRecordList"
remote
:scroll-x="600"
/>
</n-card>
</template>
<style scoped>
</style>

View File

@ -10,11 +10,19 @@
<n-form-item>
<n-space>
<n-button type="primary" @click="handleSearch">
<template #icon><n-icon><SearchOutline /></n-icon></template>
<template #icon>
<n-icon>
<SearchOutline/>
</n-icon>
</template>
搜索
</n-button>
<n-button @click="handleReset">
<template #icon><n-icon><RefreshOutline /></n-icon></template>
<template #icon>
<n-icon>
<RefreshOutline/>
</n-icon>
</template>
重置
</n-button>
</n-space>
@ -26,7 +34,11 @@
<div class="table-toolbar">
<n-space>
<n-button type="primary" @click="handleAdd">
<template #icon><n-icon><AddOutline /></n-icon></template>
<template #icon>
<n-icon>
<AddOutline/>
</n-icon>
</template>
新增设备
</n-button>
<n-button @click="goRealtimeBoard">
@ -37,11 +49,19 @@
导入
</n-button> -->
<n-button @click="handleExport">
<template #icon><n-icon><DownloadOutline /></n-icon></template>
<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>
<template #icon>
<n-icon>
<TrashOutline/>
</n-icon>
</template>
删除
</n-button>
</n-space>
@ -155,14 +175,20 @@
</n-alert>
<n-space>
<n-button type="primary" @click="handleDownloadTemplate">
<template #icon><n-icon><DownloadOutline /></n-icon></template>
<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>
<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>
@ -173,20 +199,46 @@
<n-button @click="importModalVisible = false">关闭</n-button>
</template>
</n-modal>
<!--异常记录抽屉-->
<n-drawer v-model:show="deviceAbnormalRecordDrawerVisible" :title="title" width="800">
<n-drawer-content :title="title">
<DeviceAbnormalRecordPage
:deviceAbnormalRecordList="deviceAbnormalRecordList"
/>
<template #footer>
<n-button @click="doShowInner">
取消
</n-button>
</template>
</n-drawer-content>
</n-drawer>
</div>
</template>
<script setup lang="ts">
import {ref, reactive, h, onMounted} from 'vue'
import {useRouter} from 'vue-router'
import { NButton, NSpace,NTag, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
import {
NButton, NSpace, NTag, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions,
NDropdown
} from 'naive-ui'
import {
SearchOutline,
RefreshOutline,
AddOutline,
TrashOutline,
CreateOutline,
CloudUploadOutline,
DownloadOutline, EllipsisHorizontalOutline
} from '@vicons/ionicons5'
import {deviceApi, type Device} from '@/api/device'
import {dictDataApi} from '@/api/org'
import {sectionApi, type Section} from '@/api/section'
import {sectionApi} from '@/api/section'
import {SysUser, userApi} from '@/api/system'
import {DeviceAbnormalRecord, deviceAbnormalRecordApi} from "@/api/deviceAbnormalRecord.ts";
import DeviceAbnormalRecordPage from '@/views/biz/device/DeviceAbnomarlRecord.vue'
const message = useMessage()
const dialog = useDialog()
const router = useRouter()
@ -196,6 +248,17 @@ const deviceManagerList = ref<{label:string,value:any}[]>([])
let sectionList = reactive<{ label: string, value: any }[]>([])
//
const deviceErrorLogList = ref<DeviceAbnormalRecord[]>([])
const deviceAbnormalRecordDrawerVisible = ref<Boolean>(false) //
const title = ref('')
//
const deviceIssueRecordList = ref<[]>([])
//
const searchForm = reactive({
deviceCode: null as number | null,
@ -264,7 +327,8 @@ const columns: DataTableColumns<Device> = [
{type: 'selection'},
{title: '设备编码', key: 'deviceCode'},
{title: '设备名称', key: 'deviceName'},
{ title: '新代ID', key: 'synEquipId', width: 90,
{
title: '新代ID', key: 'synEquipId', width: 90,
render: (row) => row.synEquipId ?? '-'
},
{title: '设备类型', key: 'deviceType'},
@ -273,7 +337,8 @@ const columns: DataTableColumns<Device> = [
{title: '设备型号', key: 'spec'},
{title: '生产厂家', key: 'manufacturer'},
{title: '出厂日期', key: 'manufactureDate'},
{ title: '状态', key: 'status',
{
title: '状态', key: 'status',
render: (row) => {
const val = row.status
const opt = statusList.value.find(o => o.value === val || String(o.value) === String(val))
@ -293,8 +358,39 @@ const columns: DataTableColumns<Device> = [
}),
h(NButton, {size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row)}, {
default: () => [h(NIcon, null, {default: () => h(TrashOutline)}), ' 删除']
}),
h(NDropdown, {
trigger: 'hover',
options: [
{
label: '设备异常记录',
key: 'deviceErrorLog',
},
{
label: '设备下发记录',
key: 'deviceDispatchLog',
}
], onSelect: (key: string) => {
switch (key) {
case "deviceErrorLog":
handleDeviceErrorLog(row)
break
case "deviceDispatchLog":
handleDeviceDispatchLog(row)
break
}
}
}, {
// /
default: () => h(NButton, {size: 'small', quaternary: true}, {
default: () => [h(NIcon, null, {default: () => h(EllipsisHorizontalOutline)})]
})
])
})
]
)
}
}
]
@ -487,17 +583,32 @@ async function handleImportUpload({ file }: UploadCustomRequestOptions) {
async function loadDictOptions() {
try {
const data = await dictDataApi.listByType("device_type")
deviceTypeList.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass }))
}catch {}
deviceTypeList.value = data.map(d => ({
label: d.dictLabel,
value: (Number(d.dictValue) || d.dictValue),
class: d.listClass
}))
} catch {
}
try {
const data = await dictDataApi.listByType("sys_status")
statusList.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass }))
}catch {}
statusList.value = data.map(d => ({
label: d.dictLabel,
value: (Number(d.dictValue) || d.dictValue),
class: d.listClass
}))
} catch {
}
try {
const data = await dictDataApi.listByType("mes_device_flag")
deviceFlagList.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass }))
}catch {}
deviceFlagList.value = data.map(d => ({
label: d.dictLabel,
value: (Number(d.dictValue) || d.dictValue),
class: d.listClass
}))
} catch {
}
}
@ -513,6 +624,24 @@ async function handleUser() {
deviceManagerList.value = res
}
//
async function handleDeviceErrorLog(row: Device) {
deviceAbnormalRecordDrawerVisible.value = true
title.value = row.deviceName+"异常记录"
deviceErrorLogList.value = row.abnormalRecordList
}
async function handleDeviceDispatchLog(row: Device) {
const deviceId = row.id
//deviceIssueRecordList.value = await deviceIssueRecordApi.getDeviceDispatchLogList(deviceId)
}
function doShowInner() {
deviceAbnormalRecordDrawerVisible.value = false
}
onMounted(() => {
loadData()
handleUser()

View File

@ -0,0 +1,361 @@
<template>
<div class="page-container">
<n-card>
<!-- 搜索表单 -->
<div class="search-form">
<n-form inline :model="searchForm" label-placement="left">
<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"
:pagination="pagination"
:row-key="(row) => row.id"
:scroll-x="1200"
@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: 600px">
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
</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="导入设备采集" 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 { deviceGatherApi, type DeviceGather } from '@/api/deviceGather'
const message = useMessage()
const dialog = useDialog()
//
const searchForm = reactive({
})
//
const tableData = ref<DeviceGather[]>([])
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: DeviceGather = {
}
const formData = reactive<DeviceGather>({ ...defaultFormData })
// //使
//
const formRules = {
}
//
const columns: DataTableColumns<DeviceGather> = [
{ type: 'selection' },
{ title: '设备ID', key: 'deviceId' },
{ title: '任务ID', key: 'assingWorkId' },
{ title: '设备当前生产人员id', key: 'userId' },
{ title: '采集数量.,默认1', key: 'gatherNum' },
{ title: '采集时间', key: 'gatherTime' },
{
title: '操作',
key: 'actions',
width: 140,
fixed: 'right',
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 deviceGatherApi.page({
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() {
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)
modalVisible.value = true
}
//
function handleEdit(row: DeviceGather) {
modalTitle.value = '编辑设备采集'
Object.assign(formData, row)
if (formData.gatherTime && typeof formData.gatherTime === 'string') {
formData.gatherTime = new Date(formData.gatherTime.replace(' ', 'T')).getTime()
}
modalVisible.value = true
}
//
async function handleSubmit() {
await formRef.value?.validate()
try {
const submitData = { ...formData } as DeviceGather
if (typeof submitData.gatherTime === 'number') {
submitData.gatherTime = new Date(submitData.gatherTime).toISOString().slice(0, 19).replace('T', ' ')
}
if (submitData.id) {
await deviceGatherApi.update(submitData)
message.success('修改成功')
} else {
await deviceGatherApi.create(submitData)
message.success('新增成功')
}
modalVisible.value = false
loadData()
} catch (error) {
//
}
}
//
function handleDelete(row: DeviceGather) {
dialog.warning({
title: '提示',
content: '确定要删除该记录吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await deviceGatherApi.delete([row.id!])
message.success('删除成功')
loadData()
} catch (error) {
//
}
}
})
}
//
function handleBatchDelete() {
dialog.warning({
title: '提示',
content: `确定要删除选中的 ${selectedIds.value.length} 条记录吗?`,
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await deviceGatherApi.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 deviceGatherApi.export(params)
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '设备采集数据.xlsx'
link.click()
window.URL.revokeObjectURL(url)
} catch (error) {
//
}
}
//
async function handleDownloadTemplate() {
try {
const blob = await deviceGatherApi.downloadTemplate()
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '设备采集导入模板.xlsx'
link.click()
window.URL.revokeObjectURL(url)
} catch (error) {
//
}
}
//
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
if (!file.file) return
try {
const result = await deviceGatherApi.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() {
}
onMounted(() => {
loadData()
loadDictOptions()
})
</script>
<style scoped>
.search-form {
margin-bottom: 16px;
}
.table-toolbar {
margin-bottom: 16px;
}
</style>

View File

@ -0,0 +1,449 @@
<template>
<div class="page-container">
<n-card>
<!-- 搜索表单 -->
<div class="search-form">
<n-form inline :model="searchForm" label-placement="left">
<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"
:pagination="pagination"
:row-key="(row) => row.id"
:scroll-x="1200"
@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: 600px">
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
<n-form-item label="订阅的异常key" path="subscriptionKey">
<n-select v-model:value="formData.subscriptionKey" placeholder="请选择订阅的异常key" :options="[]" />
</n-form-item>
<n-form-item label="异常名称" path="title">
<n-input v-model:value="formData.title" placeholder="请输入异常名称" />
</n-form-item>
<n-form-item label="订阅的设备集合" path="subscriptionDeviceIds">
<n-input v-model:value="formData.subscriptionDeviceIds" placeholder="请输入订阅的设备集合" />
</n-form-item>
<n-form-item label="订阅的异常字段" path="subscriptionDiscoverField">
<n-select v-model:value="formData.subscriptionDiscoverField" placeholder="请选择订阅的异常字段" :options="[]" />
</n-form-item>
<n-form-item label="发送方式, 多选 1站内信 2终端推送 3APP 4第三方" path="sendingMethod">
<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-form-item label="检验值" path="discoverValue">
<n-input v-model:value="formData.discoverValue" placeholder="请输入检验值" />
</n-form-item>
<n-form-item label="检测方法, 1大于 2大于等于 3小于 4小于等于 5不等" path="detectionMethod">
<n-select v-model:value="formData.detectionMethod" placeholder="请选择检测方法, 1大于 2大于等于 3小于 4小于等于 5不等" :options="detectionMethodOptions" />
</n-form-item>
<n-form-item label="通知人集合" path="notifier">
<n-input v-model:value="formData.notifier" placeholder="请输入通知人集合" />
</n-form-item>
<n-form-item label="通知内容" path="notifierContent">
<n-input v-model:value="formData.notifierContent" type="textarea" placeholder="请输入通知内容" />
</n-form-item>
<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-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'
const message = useMessage()
const dialog = useDialog()
//
const searchForm = reactive({
})
//
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: ErrorNotification = {
subscriptionKey: '',
title: '',
subscriptionDeviceIds: '',
subscriptionDiscoverField: '',
sendingMethod: [],
discoverValue: '',
detectionMethod: '',
notifier: '',
notifierContent: '',
abnormalReporting: undefined,
}
const formData = reactive<ErrorNotification>({ ...defaultFormData })
// //使
const sendingMethodOptions = ref<{ label: string; value: any }[]>([])
const detectionMethodOptions = ref<{ label: string; value: any }[]>([])
const abnormalReportingOptions = ref<{ label: string; value: any }[]>([])
//
const formRules = {
}
//
const columns: DataTableColumns<ErrorNotification> = [
{ type: 'selection' },
{ title: '订阅的异常key', key: 'subscriptionKey' },
{ title: '异常名称', key: 'title' },
{ title: '订阅的设备集合', key: 'subscriptionDeviceIds' },
{ title: '订阅的异常字段', key: 'subscriptionDiscoverField' },
{ 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(', ') || '-'
}
},
{ title: '检验值', key: 'discoverValue' },
{ title: '检测方法, 1大于 2大于等于 3小于 4小于等于 5不等', key: 'detectionMethod',
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' },
{ title: '创建人', key: 'createBy' },
{ title: '创建时间', key: 'crateTime' },
{ title: '通知内容', key: 'notifierContent' },
{ title: '是否需要异常填报', key: 'abnormalReporting',
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',
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({
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() {
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 = '新增ErrorNotification'
Object.assign(formData, defaultFormData)
modalVisible.value = true
}
//
function handleEdit(row: ErrorNotification) {
modalTitle.value = '编辑ErrorNotification'
Object.assign(formData, row)
if (formData.crateTime && typeof formData.crateTime === 'string') {
formData.crateTime = new Date(formData.crateTime.replace(' ', 'T')).getTime()
}
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 (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>

View File

@ -438,23 +438,6 @@ const confirmResultOptions = computed<any[]>(() => {
})
// const directionOptions = computed<any[]>(() => {
// const baseOptions: any[] = [
// { label: t('account.'), value: '' },
// { label: t('account.'), value: '' },
// ]
// // accountType === 'currency'
// // if (formRegulationData.accountType === 'currency') {
// // baseOptions.push({ label: t('account.'), value: '' })
// // baseOptions.push({ label: t('account.'), value: '' })
// // }
// return baseOptions
// })
//
async function loadDictOptions() {
try {

View File

@ -37,10 +37,10 @@
<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">
<!-- <n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
<template #icon><n-icon><TrashOutline /></n-icon></template>
删除
</n-button>
</n-button> -->
</n-space>
</div>
@ -110,6 +110,12 @@
<n-form-item label="质检描述" path="description">
<n-input v-model:value="formData.description" type="textarea" placeholder="请输入质检描述" />
</n-form-item>
<n-form-item label="状态" path="status">
<n-switch v-model:value="formData.status" :checked-value="1" :unchecked-value="0">
<template #checked>检查</template>
<template #unchecked>不检查</template>
</n-switch>
</n-form-item>
</n-form>
<template #footer>
<n-space justify="end">
@ -232,16 +238,16 @@
<script setup lang="ts">
import { ref, reactive, h, onMounted,computed } from 'vue'
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns,
type UploadCustomRequestOptions,UploadFileInfo, DataTableRowKey, NTag } from 'naive-ui'
import { SearchOutline, RefreshOutline, AddOutline,
TrashOutline, CreateOutline, CloudUploadOutline,NewspaperOutline,DocumentOutline,
type UploadCustomRequestOptions,UploadFileInfo, NTag } from 'naive-ui'
import { SearchOutline, RefreshOutline, AddOutline
, CreateOutline, CloudUploadOutline,NewspaperOutline,DocumentOutline,
DownloadOutline,ArchiveOutline as ArchiveIcon } from '@vicons/ionicons5'
import { qcItemApi, type QcItem } from '@/api/qcItem'
import { fileApi,SysFile } from '@/api/system'
import Button from 'naive-ui/es/button/src/Button'
import { basicProcessPlanApi,BasicProcessPlan } from '@/api/basicProcessPlan'
import {qcitemProcessApi,QcitemProcess} from '@/api/qcitemProcess'
import { number } from 'echarts'
const message = useMessage()
const dialog = useDialog()
@ -298,11 +304,13 @@ const modalTitle = ref('')
const importModalVisible = ref(false)
const formRef = ref()
const defaultFormData: QcItem = {
id:undefined,
name: '',
spec: '',
plans: '',
desc: '',
description: '',
createby: undefined,
status:undefined
}
const formData = reactive<QcItem>({ ...defaultFormData })
@ -325,6 +333,30 @@ const columns: DataTableColumns<QcItem> = [
}
},
{ title: '质检描述', key: 'description' },
{ title: '状态', key: 'status',
render(row){
if(row.status == 0){
return h(NTag, {
type:'error',
size: 'small'
},
{
default: () => '不检查'
}
)
}
if(row.status == 1){
return h(NTag, {
type:'success',
size: 'small'
},
{
default: () => '检查'
}
)
}
}
},
{ title: '创建人', key: 'userName' },
{ title: '创建时间', key: 'createTime', width: 180 },
{ title: '修改时间', key: 'updateTime', width: 180 },
@ -338,9 +370,9 @@ const columns: DataTableColumns<QcItem> = [
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) }), ' 删除']
}),
// h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
// default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' ']
// }),
h(NButton, { size: 'small', quaternary: true, onClick: () => handleProccess(row) }, {
default: () => [' 关联工序']
})
@ -397,6 +429,7 @@ function handleCheck(keys: Array<string | number>) {
//
function handleAdd() {
fileList.value = []
modalTitle.value = '新增质检项表'
Object.assign(formData, defaultFormData)
modalVisible.value = true
@ -404,7 +437,7 @@ function handleAdd() {
//
async function handleEdit(row: QcItem) {
fileList.value = []
modalTitle.value = '编辑质检项表'
const res = await qcItemApi.getPlansFiles({ plans: row.plans })
@ -427,6 +460,7 @@ async function handleEdit(row: QcItem) {
Object.assign(formData, row)
formData.status = Number(row.status)
if (formData.createTime && typeof formData.createTime === 'string') {
formData.createTime = new Date(formData.createTime.replace(' ', 'T')).getTime()
}
@ -476,44 +510,7 @@ async function handleSubmit() {
}
}
//
function handleDelete(row: QcItem) {
dialog.warning({
title: '提示',
content: '确定要删除该记录吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await qcItemApi.delete([row.id!])
message.success('删除成功')
loadData()
} catch (error) {
//
}
}
})
}
//
function handleBatchDelete() {
dialog.warning({
title: '提示',
content: `确定要删除选中的 ${selectedIds.value.length} 条记录吗?`,
positiveText: '确定',
negativeText: '取消',
onPositiveClick: async () => {
try {
await qcItemApi.delete(selectedIds.value)
message.success('删除成功')
selectedIds.value = []
loadData()
} catch (error) {
//
}
}
})
}
//
async function handleExport() {

View File

@ -429,7 +429,7 @@ async function loadDictOptions() {
//
async function loadSection() {
const data = await sectionApi.list()
const data = await sectionApi.listNoParam()
sectionList = data.map((d:any)=> ({ label: d.sectionName, value: (Number(d.id) || d.id) }))
}

View File

@ -38,6 +38,29 @@
</template>
</n-pagination>
</div>
<!--完工汇报弹窗-->
<n-modal v-model:show="showQcReport" :title="reportTitle" style="width: 1000px" >
<div>
<SubmitLogInfoPage
v-if="baseInfo.logOrQuality === 'log'"
:submitLogList="submitLogList"
:baseInfo="baseInfo"
/>
<QualityInfoPage
v-if="baseInfo.logOrQuality === 'Quality'"
:qualityTestingList="qualityList"
:baseInfo="baseInfo"
/>
</div>
<template #footer>
<n-space justify="end">
<n-button @click="showQcReport = false">取消</n-button>
</n-space>
</template>
</n-modal>
</div>
</template>
@ -48,22 +71,43 @@ import {
h,
reactive,
onMounted,
watch,
} from 'vue'
import { mytasks,type AssingWork } from '@/api/production';
import { NButton, NSpace, NIcon, NTag, NDatePicker, NDataTable, useMessage, useDialog, DataTableColumn, DataTableColumns } from 'naive-ui'
import {
NButton, NSpace, NTag, NDataTable, DataTableColumns
} from 'naive-ui'
import { dictDataApi } from '@/api/org'
import { assingWorkDetailApi,AssingWorkDetail } from '@/api/AssingWorkDetail'
import { SubmitLog } from '@/api/submitLog'
import SubmitLogInfoPage from "@/views/production/componets/SubmitLogInfoPage.vue";
import {QualityTesting} from "@/api/qualityTesting.ts";
import QualityInfoPage from "@/views/production/componets/QualityInfoPage.vue";
const defaultBaseInfo = ref({
materialName:undefined,
materialCode:undefined,
processName:undefined,
processCode:undefined,
assingCode:undefined,
logOrQuality:undefined
})
const baseInfo = ref({...defaultBaseInfo})
const qcAssingStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
//
const tableLoading = ref<Boolean>(false)
const AssingWorkTableData = ref<AssingWork[]>([])
const AssingWorkExpandedKeys = ref<Array<string |number>>([])
const processName = ref<string>()
const AssingWorkColumns :DataTableColumns<AssingWork> = [
{
@ -108,7 +152,7 @@ const AssingWorkColumns :DataTableColumns<AssingWork> = [
},
{
align:'center',
title: '工序名称',
title: '工序编号',
key: 'processCode',
minWidth: 200
},
@ -145,12 +189,6 @@ const AssingWorkColumns :DataTableColumns<AssingWork> = [
key: 'deviceName',
minWidth: 200
},
{
align:'center',
title: '工人名称',
key: 'userName',
minWidth: 200
},
{
align:'center',
title: '数量',
@ -185,12 +223,6 @@ const AssingWorkColumns :DataTableColumns<AssingWork> = [
key: 'completedTime',
minWidth: 180
},
{
align:'center',
title: '创建人',
key: 'createBy',
minWidth: 150
},
{
align:'center',
title: '是否质检打回',
@ -258,9 +290,54 @@ const AssingWorkColumns :DataTableColumns<AssingWork> = [
key: 'reason',
minWidth: 150
},
{
align:'center',
title: '操作',
key: 'action',
width: 250,
fixed: 'right',
render(row:any) {
const buttons:any = []
buttons.push(
h(
NButton,
{
size: 'small',
type: 'primary',
ghost:true,
onClick: () => {
handleReportRecords(row)
}
},
{ default: () => '汇报信息' }
)
)
buttons.push(
h(
NButton,
{
size: 'small',
type: 'primary',
ghost:true,
onClick: () => {
handleQualityRecords(row)
}
},
{ default: () => '质检信息' }
)
)
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
}
}
]
const showQcReport = ref<boolean>(false)
const reportTitle = ref<string>()
const submitLogList = ref<SubmitLog[]>([])
const qualityList = ref<QualityTesting[]>([])
//
const loadingRowIds = ref<Set<number>>(new Set())
@ -276,12 +353,6 @@ const AssingWorkDetailColums:DataTableColumns<AssingWorkDetail> = [
return '-'
}
},
{
align:"center",
title:"操作人",
key:"userName",
width:150
},
{
align:"center",
title:"数量",
@ -301,6 +372,12 @@ const AssingWorkDetailColums:DataTableColumns<AssingWorkDetail> = [
return '-'
}
},
{
align:"center",
title:"操作人",
key:"userName",
width:150
},
{
align:"center",
title:"创建时间",
@ -425,8 +502,33 @@ async function loadDictOptions() {
const data = await dictDataApi.listByType('assing_status')
qcAssingStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass }))
}catch {}
}
//
function handleReportRecords(row:any) {
showQcReport.value = true
reportTitle.value = "汇报信息"
submitLogList.value = row.submitLogList
baseInfo.value = {...row}
baseInfo.value.logOrQuality = "log"
}
//
function handleQualityRecords(row:any) {
showQcReport.value = true
reportTitle.value = "质检信息"
qualityList.value = row.qualityTestingList
console.log(qualityList.value)
baseInfo.value = {...row}
baseInfo.value.logOrQuality = "Quality"
}
onMounted(()=>{
getlist()
loadDictOptions()
@ -444,5 +546,7 @@ defineExpose({
.toolbar {
margin-bottom: 12px;
}
.pgClass {
font-weight: bold;
}
</style>

View File

@ -0,0 +1,101 @@
<template>
<n-card>
<n-card style="margin: 12px 0px">
<n-grid :cols="2" style="margin: 10px">
<n-gi>
<span class="pgClass">物料名称</span>
<span>{{props.baseInfo.materialName}}</span>
</n-gi>
<n-gi>
<span class="pgClass">物料编号</span>
<span>{{props.baseInfo.materialCode}}</span>
</n-gi>
</n-grid>
<n-grid :cols="2" style="margin: 10px">
<n-gi>
<span class="pgClass">工序名称</span>
<span>{{props.baseInfo.processName}}</span>
</n-gi>
<n-gi>
<span class="pgClass">派工编号</span>
<span>{{props.baseInfo.assingCode}}</span>
</n-gi>
</n-grid>
</n-card>
<n-data-table
:columns="reportRecordsColums"
size="small"
:data="props.qualityTestingList"
remote
:scroll-x="600"
/>
</n-card>
</template>
<script setup lang="ts">
import { NCard, NDataTable, NGi,NTag, NGrid,DataTableColumns} from "naive-ui";
import {onMounted, ref,h} from "vue";
import { dictDataApi } from '@/api/org'
import {QualityTesting} from "@/api/qualityTesting.ts";
const props =defineProps(
{
qualityTestingList:Object,
baseInfo:Object
}
)
//
const qcSourceTypeOptions = ref<{ label: string; value: any;class:any }[]>([])
const qcStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
//
const reportRecordsColums:DataTableColumns<QualityTesting> = [
{ title: '质检编号', key: 'qcNo',align: 'center' },
{ title: '来源类型', key: 'sourceType',align: 'center',
render(row) {
const val = row.sourceType
const opt = qcSourceTypeOptions.value.find(o => o.value === val || String(o.value) === String(val))
if (!opt) return val ?? '-'
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
}
},
{ title: '报检总数', key: 'totalQty',align: 'center' },
{ title: '已检验数量', key: 'inspectQty',align: 'center' },
{ title: '质检状态', key: 'status',align: 'center',
render(row) {
const val = row.status
const opt = qcStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
if (!opt) return val ?? '-'
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
}
},
{ title: '检验完成时间', key: 'inspectTime',align: 'center' },
]
//
async function loadDictOptions() {
try {
const data = await dictDataApi.listByType('source_type')
qcSourceTypeOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
}catch {}
try {
const data = await dictDataApi.listByType('qc_status')
qcStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
}catch {}
}
onMounted(()=>{
loadDictOptions()
})
</script>
<style scoped>
</style>

View File

@ -0,0 +1,86 @@
<template>
<n-card>
<n-card style="margin: 12px 0px">
<n-grid :cols="2" style="margin: 10px">
<n-gi>
<span class="pgClass">物料名称</span>
<span>{{props.baseInfo.materialName}}</span>
</n-gi>
<n-gi>
<span class="pgClass">物料编号</span>
<span>{{props.baseInfo.materialCode}}</span>
</n-gi>
</n-grid>
<n-grid :cols="2" style="margin: 10px">
<n-gi>
<span class="pgClass">工序名称</span>
<span>{{props.baseInfo.processName}}</span>
</n-gi>
<n-gi>
<span class="pgClass">派工编号</span>
<span>{{props.baseInfo.assingCode}}</span>
</n-gi>
</n-grid>
</n-card>
<n-data-table
:columns="reportRecordsColums"
size="small"
:data="props.submitLogList"
remote
:scroll-x="600"
/>
</n-card>
</template>
<script setup lang="ts">
import { NCard, NDataTable, NGi,NTag, NGrid,DataTableColumns} from "naive-ui";
import {onMounted, ref,h} from "vue";
import { dictDataApi } from '@/api/org'
import { SubmitLog } from '@/api/submitLog'
const props =defineProps(
{
submitLogList:Object,
baseInfo:Object
}
)
//
const submitStatusOptions = ref<{ label: string; value: any ;class:any}[]>([])
//
const reportRecordsColums:DataTableColumns<SubmitLog> = [
{ title: '汇报数量', key: 'quantity',align: 'center'},
{ title: '汇报人', key: 'userName',align: 'center' },
{ title: '派工状态', key: 'submitStatus',align: 'center',
render: (row) => {
const val = row.submitStatus
const opt = submitStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
if (!opt) return val ?? '-'
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
}
}
]
//
async function loadDictOptions() {
try {
const data = await dictDataApi.listByType('submit_status')
submitStatusOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class:d.listClass }))
}catch {}
}
onMounted(()=>{
loadDictOptions()
})
</script>
<style scoped>
</style>

View File

@ -198,7 +198,7 @@ import {
reactive,
h,
onMounted,
watch,
watch, Component,
} from 'vue'