Merge branch 'master' of https://git.evo-techina.com/sgc/mes-vue
This commit is contained in:
commit
433eae9153
@ -5,12 +5,8 @@ VITE_APP_TITLE = 伊特机械MES
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
<<<<<<< HEAD
|
|
||||||
VITE_APP_BASE_API = 'http://192.168.5.232:8888/api'
|
|
||||||
=======
|
|
||||||
|
|
||||||
#VITE_APP_BASE_API = 'http://192.168.12.4:8888/api'
|
#VITE_APP_BASE_API = 'http://192.168.12.4:8888/api'
|
||||||
>>>>>>> f1e25f58a96a8b7737687ce50afef4b34cda2541
|
|
||||||
#VITE_APP_BASE_API = 'http://192.168.5.14:9100/gateway'
|
#VITE_APP_BASE_API = 'http://192.168.5.14:9100/gateway'
|
||||||
|
|
||||||
VITE_APP_BASE_API = 'http://localhost/api'
|
VITE_APP_BASE_API = 'http://localhost/api'
|
||||||
|
|||||||
@ -24,9 +24,10 @@
|
|||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"jspdf": "^4.2.1",
|
"jspdf": "^4.2.1",
|
||||||
"naive-ui":"^2.37.3",
|
"naive-ui": "^2.37.3",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
|
"seemly": "^0.3.10",
|
||||||
"three": "^0.184.0",
|
"three": "^0.184.0",
|
||||||
"vue": "^3.4.15",
|
"vue": "^3.4.15",
|
||||||
"vue-draggable-plus": "^0.6.1",
|
"vue-draggable-plus": "^0.6.1",
|
||||||
|
|||||||
@ -50,6 +50,9 @@ importers:
|
|||||||
pinia-plugin-persistedstate:
|
pinia-plugin-persistedstate:
|
||||||
specifier: ^3.2.1
|
specifier: ^3.2.1
|
||||||
version: 3.2.3(pinia@2.3.1(typescript@5.9.3)(vue@3.5.31(typescript@5.9.3)))
|
version: 3.2.3(pinia@2.3.1(typescript@5.9.3)(vue@3.5.31(typescript@5.9.3)))
|
||||||
|
seemly:
|
||||||
|
specifier: ^0.3.10
|
||||||
|
version: 0.3.10
|
||||||
three:
|
three:
|
||||||
specifier: ^0.184.0
|
specifier: ^0.184.0
|
||||||
version: 0.184.0
|
version: 0.184.0
|
||||||
|
|||||||
@ -20,7 +20,9 @@ export interface Device{
|
|||||||
synEquipId?: number | null,
|
synEquipId?: number | null,
|
||||||
createTime:string,
|
createTime:string,
|
||||||
updateTime:string
|
updateTime:string
|
||||||
abnormalRecordList:[]
|
abnormalRecordList:[],
|
||||||
|
deviceManagers:[]
|
||||||
|
deviceManager:string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeviceRealtimeVO {
|
export interface DeviceRealtimeVO {
|
||||||
@ -103,11 +105,14 @@ export const deviceApi = {
|
|||||||
export(
|
export(
|
||||||
params?:{
|
params?:{
|
||||||
ids?:string[],
|
ids?:string[],
|
||||||
deviceCode:any
|
deviceCode:any,
|
||||||
|
deviceFlag?:string
|
||||||
}){
|
}){
|
||||||
const p:Record<string,any> = {}
|
const p:Record<string,any> = {}
|
||||||
|
console.log( params)
|
||||||
if(params?.ids?.length) p.ids = params.ids.join(',')
|
if(params?.ids?.length) p.ids = params.ids.join(',')
|
||||||
if(params?.deviceCode != undefined && params?.deviceCode !== null) p.sectionCode = params.deviceCode
|
if(params?.deviceCode != undefined && params?.deviceCode !== null) p.sectionCode = params.deviceCode
|
||||||
|
if(params?.deviceFlag != undefined && params?.deviceFlag !== null) p.deviceFlag = params.deviceFlag
|
||||||
return request({
|
return request({
|
||||||
url:`/biz/device/report`,
|
url:`/biz/device/report`,
|
||||||
method:"get",
|
method:"get",
|
||||||
@ -122,5 +127,11 @@ export const deviceApi = {
|
|||||||
method:"get",
|
method:"get",
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
deviceList() {
|
||||||
|
return request({
|
||||||
|
url:"/biz/device/list",
|
||||||
|
method:"get"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ export interface DeviceAbnormalRecord {
|
|||||||
|
|
||||||
stationName?: string
|
stationName?: string
|
||||||
|
|
||||||
abnormalType?: string
|
abnormalType?: number
|
||||||
|
|
||||||
abnormalTypeName?: string
|
abnormalTypeName?: string
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ export interface DeviceAbnormalRecord {
|
|||||||
// 设备异常记录表 API
|
// 设备异常记录表 API
|
||||||
export const deviceAbnormalRecordApi = {
|
export const deviceAbnormalRecordApi = {
|
||||||
// 分页查询
|
// 分页查询
|
||||||
page(params: { page: number; pageSize: number; id?: number; status?: string }) {
|
page(params: { page: number; pageSize: number; deviceId?: number; abnormalCode?: string,abnormalType?:number }) {
|
||||||
return request({ url: '/biz/deviceAbnormalRecord/page', method: 'get', params })
|
return request({ url: '/biz/deviceAbnormalRecord/page', method: 'get', params })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
72
src/api/deviceOperationLog.ts
Normal file
72
src/api/deviceOperationLog.ts
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
import { request } from '@/utils/request'
|
||||||
|
|
||||||
|
// 设备操作日志 类型定义
|
||||||
|
export interface DeviceOperationLog {
|
||||||
|
id?: number
|
||||||
|
|
||||||
|
assingWorkId?: number
|
||||||
|
|
||||||
|
userId?: number
|
||||||
|
|
||||||
|
deviceId?: number
|
||||||
|
|
||||||
|
source?: number
|
||||||
|
|
||||||
|
operationType?: number
|
||||||
|
|
||||||
|
createTime?: string
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设备操作日志 API
|
||||||
|
export const deviceOperationLogApi = {
|
||||||
|
// 分页查询
|
||||||
|
page(params: { page: number; pageSize: number; deviceId?: number; operationType?: number;userId?: number }) {
|
||||||
|
return request({ url: '/terminal/operation/page', method: 'get', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取详情
|
||||||
|
detail(id: string) {
|
||||||
|
return request({ url: `/biz/deviceOperationLog/${id}`, method: 'get' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
create(data: DeviceOperationLog) {
|
||||||
|
return request({ url: '/biz/deviceOperationLog', method: 'post', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
update(data: DeviceOperationLog) {
|
||||||
|
return request({ url: '/biz/deviceOperationLog', method: 'put', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
delete(ids: string[]) {
|
||||||
|
return request({ url: `/biz/deviceOperationLog/${ids.join(',')}`, method: 'delete' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
export(params?: { ids?: string[]; id?: number }) {
|
||||||
|
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
|
||||||
|
return request({ url: `/biz/deviceOperationLog/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/deviceOperationLog/import`,
|
||||||
|
method: 'post',
|
||||||
|
data: formData,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 下载导入模板
|
||||||
|
downloadTemplate() {
|
||||||
|
return request({ url: `/biz/deviceOperationLog/template`, method: 'get', responseType: 'blob' })
|
||||||
|
}
|
||||||
|
}
|
||||||
83
src/api/errorNotification.ts
Normal file
83
src/api/errorNotification.ts
Normal 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' })
|
||||||
|
}
|
||||||
|
}
|
||||||
102
src/api/issuerecord.ts
Normal file
102
src/api/issuerecord.ts
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
import { request } from '@/utils/request'
|
||||||
|
|
||||||
|
// 下发记录表 类型定义
|
||||||
|
export interface IssueRecord {
|
||||||
|
id?: number
|
||||||
|
|
||||||
|
issueCode?: string
|
||||||
|
|
||||||
|
issueType?: string
|
||||||
|
|
||||||
|
issueTypeName?: string
|
||||||
|
|
||||||
|
sourceId?: number
|
||||||
|
|
||||||
|
sourceCode?: string
|
||||||
|
|
||||||
|
sourceName?: string
|
||||||
|
|
||||||
|
deviceId?: number
|
||||||
|
|
||||||
|
status?: number
|
||||||
|
|
||||||
|
statusName?: string
|
||||||
|
|
||||||
|
issueTime?: string
|
||||||
|
|
||||||
|
issueBy?: number
|
||||||
|
|
||||||
|
completeTime?: string
|
||||||
|
|
||||||
|
result?: string
|
||||||
|
|
||||||
|
remark?: string
|
||||||
|
|
||||||
|
createTime?: string
|
||||||
|
|
||||||
|
createBy?: number
|
||||||
|
|
||||||
|
assingId?: number
|
||||||
|
|
||||||
|
processId?: number
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下发记录表 API
|
||||||
|
export const issueRecordApi = {
|
||||||
|
// 分页查询
|
||||||
|
page(params: { page: number; pageSize: number; issueCode?: string; status?: number;deviceId?:number }) {
|
||||||
|
return request({ url: '/biz/issueRecord/page', method: 'get', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取详情
|
||||||
|
detail(id: number) {
|
||||||
|
return request({ url: `/biz/issueRecord/${id}`, method: 'get' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
create(data: IssueRecord) {
|
||||||
|
return request({ url: '/biz/issueRecord', method: 'post', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
update(data: IssueRecord) {
|
||||||
|
return request({ url: '/biz/issueRecord', method: 'put', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
delete(ids: number[]) {
|
||||||
|
return request({ url: `/biz/issueRecord/${ids.join(',')}`, method: 'delete' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
export(params?: { ids?: number[]; id?: number; status?: number }) {
|
||||||
|
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/issueRecord/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/issueRecord/import`,
|
||||||
|
method: 'post',
|
||||||
|
data: formData,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 下载导入模板
|
||||||
|
downloadTemplate() {
|
||||||
|
return request({ url: `/biz/issueRecord/template`, method: 'get', responseType: 'blob' })
|
||||||
|
},
|
||||||
|
|
||||||
|
//设备下发记录
|
||||||
|
getDeviceDispatchLogList(deviceId: number) {
|
||||||
|
return request({ url: `/biz/issueRecord/deviceIssueRecords/${deviceId}`, method: 'get' })
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -44,7 +44,7 @@ export function nccodelist(params:any) {
|
|||||||
//下发
|
//下发
|
||||||
export function batchIssue(data:any) {
|
export function batchIssue(data:any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/biz/ncCode/issue',
|
url: '/biz/ncCode/issue',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@ -53,7 +53,7 @@ export function batchIssue(data:any) {
|
|||||||
//删除
|
//删除
|
||||||
export function deleteIssue(ids:any) {
|
export function deleteIssue(ids:any) {
|
||||||
return request({
|
return request({
|
||||||
url: `api/biz/ncCode/${ids}`,
|
url: `/biz/ncCode/${ids}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -66,3 +66,37 @@ export function issuecopy(data:any) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
export function exportIssue(params?: { ids?: number[]; id?: number; status?: number }) {
|
||||||
|
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/ncCode/export`, method: 'get', params: p, responseType: 'blob' })
|
||||||
|
}
|
||||||
|
|
||||||
|
//任务树
|
||||||
|
export function opertree() {
|
||||||
|
return request({
|
||||||
|
url: `biz/ncCode/operationTree`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//生产NC编码
|
||||||
|
export function generateNccode() {
|
||||||
|
return request({
|
||||||
|
url: `biz/ncCode/generateNcCode`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出
|
||||||
|
export function exportNccode(params:any) {
|
||||||
|
return request({
|
||||||
|
url: `biz/ncCode/export`,
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -43,3 +43,13 @@ export function reportingwork(data:any) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//登出设备
|
||||||
|
export function terlogout(data:any) {
|
||||||
|
return request({
|
||||||
|
url: '/terminal/logout',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -136,13 +136,6 @@ export const userApi = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//获取设备负责人
|
|
||||||
getEquipmentManager() {
|
|
||||||
return request({
|
|
||||||
url:"/sys/user/getEquipmentManager",
|
|
||||||
method:"get"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
0
src/api/test01.ts
Normal file
0
src/api/test01.ts
Normal file
9
src/components/DetailPage.vue
Normal file
9
src/components/DetailPage.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -301,6 +301,12 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('@/views/biz/tool/usage.vue'),
|
component: () => import('@/views/biz/tool/usage.vue'),
|
||||||
meta: { title: '刀具使用记录', icon: 'ToolOutline', activeMenu: '/biz/tool' }
|
meta: { title: '刀具使用记录', icon: 'ToolOutline', activeMenu: '/biz/tool' }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'biz/errorNotification',
|
||||||
|
name: 'errorNotification',
|
||||||
|
component: () => import('@/views/biz/errorNotification/index.vue'),
|
||||||
|
meta: { title: 'ErrorNotification', icon: 'ListOutline' }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// 开发工具
|
// 开发工具
|
||||||
path: 'tool/gen',
|
path: 'tool/gen',
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<n-space style="margin-bottom: 15px;">
|
<n-space style="margin-bottom: 15px;">
|
||||||
<n-button type="primary" @click="addhand(1)" size="small">
|
<n-button v-if="hasPermission('biz:ncCode:add')" type="primary" @click="addhand(1)" size="small">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<AddOutline />
|
<AddOutline />
|
||||||
@ -51,7 +51,7 @@
|
|||||||
</template>
|
</template>
|
||||||
删除
|
删除
|
||||||
</n-button> -->
|
</n-button> -->
|
||||||
<n-button type="success" @click="issuehand" size="small">
|
<n-button v-if="hasPermission('biz:ncCode:export')" type="success" @click="handleExport" size="small">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<ArrowDownCircleOutline />
|
<ArrowDownCircleOutline />
|
||||||
@ -111,7 +111,7 @@
|
|||||||
<n-grid :cols="1" :x-gap="24">
|
<n-grid :cols="1" :x-gap="24">
|
||||||
<n-gi>
|
<n-gi>
|
||||||
<n-form-item path="ncCode" label="NC代码编号">
|
<n-form-item path="ncCode" label="NC代码编号">
|
||||||
<n-input v-model:value="formData.ncCode" placeholder="请输入NC代码编号" />
|
<n-input v-model:value="formData.ncCode" placeholder="自动生成" disabled />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
<n-gi>
|
<n-gi>
|
||||||
@ -214,51 +214,22 @@
|
|||||||
v-model:show="issueModel"
|
v-model:show="issueModel"
|
||||||
title="下发"
|
title="下发"
|
||||||
preset="card"
|
preset="card"
|
||||||
style="width: 500px"
|
style="width: 600px"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
>
|
>
|
||||||
|
<n-transfer
|
||||||
<n-form
|
v-model:value="value"
|
||||||
ref="issformRef"
|
style="height:500px;"
|
||||||
:model="issformData"
|
:options="options"
|
||||||
:rules="issaddrules"
|
:render-source-list="renderSourceList"
|
||||||
label-placement="top"
|
source-filterable
|
||||||
label-width="100"
|
@update:value="tranupdate"
|
||||||
>
|
/>
|
||||||
<n-grid :cols="1" :x-gap="24">
|
|
||||||
<n-gi>
|
|
||||||
<n-form-item path="taskid" label="下发任务">
|
|
||||||
<n-select
|
|
||||||
:disabled="false"
|
|
||||||
:render-label="renderlabe"
|
|
||||||
v-model:value="issformData.taskid"
|
|
||||||
placeholder="请选择下发任务"
|
|
||||||
:options="isstasklist"
|
|
||||||
/>
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item path="equis" label="下发设备">
|
|
||||||
<n-select
|
|
||||||
:disabled="false"
|
|
||||||
:render-label="renderlabe"
|
|
||||||
v-model:value="issformData.equis"
|
|
||||||
placeholder="请选择下发设备"
|
|
||||||
:options="issequiplist"
|
|
||||||
/>
|
|
||||||
</n-form-item>
|
|
||||||
</n-gi>
|
|
||||||
<!-- <n-gi>
|
|
||||||
<n-form-item path="ncName" label="下发代码">
|
|
||||||
<n-input v-model:value="formData.ncName" placeholder="请输入NC代码名称" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-gi> -->
|
|
||||||
</n-grid>
|
|
||||||
</n-form>
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<n-space justify="end">
|
<n-space justify="end">
|
||||||
<n-button @click="issueModel = false">取消</n-button>
|
<n-button @click="issueModel = false">取消</n-button>
|
||||||
<n-button
|
<n-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
||||||
@click="isssavehand"
|
@click="isssavehand"
|
||||||
>确认</n-button>
|
>确认</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
@ -280,6 +251,7 @@ import {
|
|||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
NTree,
|
||||||
NButton,
|
NButton,
|
||||||
NIcon,
|
NIcon,
|
||||||
NSpace,
|
NSpace,
|
||||||
@ -306,12 +278,11 @@ import {
|
|||||||
batchIssue,
|
batchIssue,
|
||||||
editccode,
|
editccode,
|
||||||
issuecopy,
|
issuecopy,
|
||||||
ncCode
|
generateNccode,
|
||||||
|
opertree,
|
||||||
|
exportNccode
|
||||||
} from '@/api/nccode'
|
} from '@/api/nccode'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
@ -321,7 +292,7 @@ const userStore = useUserStore()
|
|||||||
// 权限检查
|
// 权限检查
|
||||||
const hasPermission = (permission: string) => userStore.hasPermission(permission)
|
const hasPermission = (permission: string) => userStore.hasPermission(permission)
|
||||||
|
|
||||||
const ncDispatchRecords = ref<ncCode[]>([])
|
//const ncDispatchRecords = ref<ncCode[]>([])
|
||||||
|
|
||||||
//派工状态字典
|
//派工状态字典
|
||||||
//const qcAssingStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
|
//const qcAssingStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
|
||||||
@ -408,6 +379,31 @@ const columns = [
|
|||||||
return '禁用'
|
return '禁用'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align:"center",
|
||||||
|
title:"是否下发",
|
||||||
|
key:"isIssued",
|
||||||
|
minWidth:150,
|
||||||
|
render(row:any) {
|
||||||
|
if(row.isIssued == 1){
|
||||||
|
return '已下发'
|
||||||
|
}
|
||||||
|
return '未下发'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align:"center",
|
||||||
|
title:"下发时间",
|
||||||
|
key:"issueTime",
|
||||||
|
minWidth:150
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
align:"center",
|
||||||
|
title:"下发人",
|
||||||
|
key:"issueBy",
|
||||||
|
minWidth:150
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align:"center",
|
align:"center",
|
||||||
title:"备注",
|
title:"备注",
|
||||||
@ -458,29 +454,36 @@ const columns = [
|
|||||||
{ default: () => '编辑'}
|
{ default: () => '编辑'}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
if(hasPermission('biz:ncCode:remove')){
|
||||||
|
buttons.push(h(NButton, {
|
||||||
|
size: 'small',
|
||||||
|
type:'error',
|
||||||
|
ghost:true,
|
||||||
|
onClick: () => {
|
||||||
|
dialog.warning({
|
||||||
|
title: '警告',
|
||||||
|
content: `你确定删除NC代码编号为:${row.ncCode}的数据`,
|
||||||
|
positiveText: '确定',
|
||||||
|
negativeText: '取消',
|
||||||
|
//draggable: true,
|
||||||
|
onPositiveClick: () => {
|
||||||
|
deleteIssue(row.id).then(() => {
|
||||||
|
message.success('操作成功')
|
||||||
|
setTimeout(() => {
|
||||||
|
search()
|
||||||
|
},1000)
|
||||||
|
})
|
||||||
|
|
||||||
buttons.push(
|
},
|
||||||
h(NDropdown,{
|
onNegativeClick: () => {
|
||||||
trigger:'click',
|
|
||||||
options:[
|
|
||||||
{label:"下发记录",key:"dispatchRecord"},
|
|
||||||
{type: 'divider' },
|
|
||||||
],
|
|
||||||
onSelect:(key:string)=>{
|
|
||||||
switch(key) {
|
|
||||||
case "dispatchRecord":
|
|
||||||
handleDispatchRecord(row)
|
|
||||||
break
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
},{
|
|
||||||
// 下拉触发按钮:三点图标 / 更多文字
|
} },
|
||||||
default: () => h(NButton, { size: 'small', quaternary: true }, {
|
{ default: () => '删除'}
|
||||||
default: () => [h(NIcon, null, { default: () => h(EllipsisHorizontalOutline) })]
|
))
|
||||||
})
|
}
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
|
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
|
||||||
@ -593,9 +596,14 @@ function addhand(type:any,row?:any) {
|
|||||||
addModel.value = true
|
addModel.value = true
|
||||||
formData.value?.restoreValidation()
|
formData.value?.restoreValidation()
|
||||||
isstype.value = type
|
isstype.value = type
|
||||||
|
if(type == 1 || type == 3){
|
||||||
|
generateNccode().then(rps => {
|
||||||
|
formData.ncCode = rps
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if(row){
|
if(row){
|
||||||
formData.id = row.id
|
formData.id = row.id
|
||||||
formData.ncCode = row.ncCode
|
|
||||||
formData.ncName = row.ncName
|
formData.ncName = row.ncName
|
||||||
formData.ncContent = row.ncContent
|
formData.ncContent = row.ncContent
|
||||||
formData.workCenter = row.workCenter
|
formData.workCenter = row.workCenter
|
||||||
@ -606,6 +614,11 @@ function addhand(type:any,row?:any) {
|
|||||||
// formData.issueTime = row.issueTime
|
// formData.issueTime = row.issueTime
|
||||||
// formData.issueBy = row.issueBy
|
// formData.issueBy = row.issueBy
|
||||||
formData.remark = row.remark
|
formData.remark = row.remark
|
||||||
|
if(type == 2){
|
||||||
|
formData.ncCode = row.ncCode
|
||||||
|
}else{
|
||||||
|
formData.ncCode = ''
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
formData.id = ''
|
formData.id = ''
|
||||||
formData.ncCode = ''
|
formData.ncCode = ''
|
||||||
@ -639,7 +652,7 @@ function savehand() {
|
|||||||
if (!e) {
|
if (!e) {
|
||||||
|
|
||||||
addEdi().then(() => {
|
addEdi().then(() => {
|
||||||
message.success(cztype[isstype.value])
|
message.success(`${cztype[isstype.value]}成功`)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getlist()
|
getlist()
|
||||||
addModel.value = false
|
addModel.value = false
|
||||||
@ -675,38 +688,63 @@ function delhand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//下发任务列表
|
//下发任务列表
|
||||||
let isstasklist = ref<any>([])
|
//let isstasklist = ref<any>([])
|
||||||
|
|
||||||
//下发设备列表
|
//下发设备列表
|
||||||
let issequiplist = ref<any>([])
|
//let issequiplist = ref<any>([])
|
||||||
|
|
||||||
//下发
|
let treeData:any = []
|
||||||
let issueModel = ref(false)
|
let value = ref<Array<string | number>>([])
|
||||||
let issformData = reactive<any>({
|
let renderSourceList:any = ''
|
||||||
taskid:'',
|
|
||||||
equis:''
|
|
||||||
})
|
|
||||||
const issaddrules = {
|
|
||||||
taskid:[
|
|
||||||
{ required: true, message: '请选择下发任务', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
equis:[
|
|
||||||
{ required: true, message: '请选择下发设备', trigger: 'blur' }
|
|
||||||
]
|
|
||||||
|
|
||||||
|
let options = ref<any>([]) //flattenTree(createData())
|
||||||
|
|
||||||
|
function flattenTree(list: undefined | any[]) {
|
||||||
|
const result: any[] = []
|
||||||
|
function flatten(_list: any[] = []) {
|
||||||
|
_list.forEach((item) => {
|
||||||
|
//result.push(item)
|
||||||
|
if(item.childList){
|
||||||
|
flatten(item.childList)
|
||||||
|
}else{
|
||||||
|
result.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
flatten(list)
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function tranupdate(v:any) {
|
||||||
|
console.log(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
//下发
|
||||||
|
let issueModel = ref(false)
|
||||||
|
// let issformData = reactive<any>({
|
||||||
|
// taskid:'',
|
||||||
|
// equis:''
|
||||||
|
// })
|
||||||
|
// const issaddrules = {
|
||||||
|
// taskid:[
|
||||||
|
// { required: true, message: '请选择下发任务', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
|
// equis:[
|
||||||
|
// { required: true, message: '请选择下发设备', trigger: 'blur' }
|
||||||
|
// ]
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function renderlabe() {}
|
function renderlabe() {}
|
||||||
|
|
||||||
function issuehand() {
|
function issuehand() {
|
||||||
|
|
||||||
issueModel.value = true
|
issueModel.value = true
|
||||||
// if(chearr.value.length > 0){
|
|
||||||
// batchIssue(chearr.value).then(() => {
|
|
||||||
// message.success('操作成功')
|
|
||||||
// })
|
|
||||||
// }else{
|
|
||||||
// message.error('请勾选设备')
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,14 +753,32 @@ const issformRef = ref()
|
|||||||
function isssavehand() {
|
function isssavehand() {
|
||||||
issformRef.value?.validate((e:any) => {
|
issformRef.value?.validate((e:any) => {
|
||||||
if (!e) {
|
if (!e) {
|
||||||
message.success('操作成功')
|
batchIssue('').then(() => {
|
||||||
setTimeout(() => {
|
message.success('操作成功')
|
||||||
getlist()
|
setTimeout(() => {
|
||||||
issueModel.value = false
|
getlist()
|
||||||
},1500)
|
issueModel.value = false
|
||||||
|
},1500)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//导出
|
||||||
|
//let selectedIds = ref<any>([])
|
||||||
|
function handleExport() {
|
||||||
|
|
||||||
|
|
||||||
|
exportNccode({}).then(rps => {
|
||||||
|
const url = window.URL.createObjectURL(rps)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = 'NC代码数据.xlsx'
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getlist()
|
getlist()
|
||||||
|
|
||||||
@ -735,6 +791,33 @@ async function handleDispatchRecord(row:ncCode){
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
||||||
|
//加载任务树
|
||||||
|
opertree().then(rps => {
|
||||||
|
treeData = rps
|
||||||
|
options.value = flattenTree(treeData)
|
||||||
|
console.log(rps,'112')
|
||||||
|
renderSourceList = function (obj:any) {
|
||||||
|
return h(NTree, {
|
||||||
|
style: 'margin: 0 4px;',
|
||||||
|
keyField: 'value',
|
||||||
|
checkable: true,
|
||||||
|
selectable: false,
|
||||||
|
blockLine: true,
|
||||||
|
checkOnClick: true,
|
||||||
|
childrenField:'childList',
|
||||||
|
data: treeData,
|
||||||
|
cascade:true,
|
||||||
|
defaultExpandAll:true,
|
||||||
|
pattern:obj.pattern,
|
||||||
|
checkedKeys: value.value,
|
||||||
|
onUpdateCheckedKeys: (checkedKeys: Array<string | number>) => {
|
||||||
|
obj.onCheck(checkedKeys)
|
||||||
|
console.log(value.value,'tree')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
//loadDictOptions()
|
//loadDictOptions()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@ -47,6 +47,7 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:row-key="(row) => row.id"
|
:row-key="(row) => row.id"
|
||||||
:scroll-x="1200"
|
:scroll-x="1200"
|
||||||
|
v-model:checked-row-keys="selectedIds"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
|||||||
@ -1,21 +1,78 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {DeviceAbnormalRecord} from "@/api/deviceAbnormalRecord.ts";
|
import {DeviceAbnormalRecord} from "@/api/deviceAbnormalRecord.ts";
|
||||||
import {DataTableColumns, NDataTable, NTag} from "naive-ui";
|
import {DataTableColumns, NButton, NDataTable, NIcon, NSpace, NTag} from "naive-ui";
|
||||||
import {h, onMounted, ref} from "vue";
|
import {h, onMounted, reactive, ref} from "vue";
|
||||||
import {dictDataApi} from "@/api/org.ts";
|
import {dictDataApi} from "@/api/org.ts";
|
||||||
|
import {ArrowDown, ArrowUp, RefreshOutline, SearchOutline} from "@vicons/ionicons5";
|
||||||
|
import {deviceAbnormalRecordApi} from "@/api/deviceAbnormalRecord.ts";
|
||||||
|
|
||||||
|
|
||||||
const deviceNormalRecordOptions = ref<{ label: string; value: any;class:any }[]>([])
|
const deviceNormalRecordOptions = ref<{ label: string; value: any;class:any }[]>([])
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps({
|
||||||
deviceAbnormalRecordList: DeviceAbnormalRecord[]
|
deviceId:Number
|
||||||
}>()
|
})
|
||||||
|
|
||||||
|
const showSearchInput = ref<Boolean>(false)
|
||||||
|
|
||||||
|
|
||||||
|
const searchForm = ref({
|
||||||
|
abnormalCode: undefined,
|
||||||
|
abnormalType: undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
const abnormalTypes = [
|
||||||
|
{
|
||||||
|
label: '机械异常',
|
||||||
|
value: '0'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '电气异常',
|
||||||
|
value: '1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '软件异常',
|
||||||
|
value: '2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '其他异常',
|
||||||
|
value: '3'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
//报警异常字典
|
||||||
|
const deviceAbnormalTypeOptions = ref<{ label: string; value: any;class:any }[]>( [])
|
||||||
|
|
||||||
|
//异常级别字典
|
||||||
|
const deviceAbnormalLevelOptions = ref<{ label: string; value: any;class:any }[]>( [])
|
||||||
|
|
||||||
//汇报信息表格
|
//汇报信息表格
|
||||||
const deviceAbnormalRecordColums:DataTableColumns<DeviceAbnormalRecord> = [
|
const columns:DataTableColumns<DeviceAbnormalRecord> = [
|
||||||
|
|
||||||
{ title: '异常编号', key: 'abnormalCode',align: 'center' },
|
{ title: '报警异常', key: 'abnormalType',align: 'center',
|
||||||
{ title: '异常类型', key: 'abnormalType',align: 'center' },
|
render(row) {
|
||||||
{ title: '异常级别', key: 'abnormalLevel',align: 'center'},
|
const val = row.abnormalType
|
||||||
|
const opt = deviceAbnormalTypeOptions.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: 'abnormalLevel',align: 'center',
|
||||||
|
render(row) {
|
||||||
|
const val = row.abnormalLevel
|
||||||
|
const opt = deviceAbnormalLevelOptions.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: 'abnormalDesc',align: 'center' },
|
{ title: '异常描述', key: 'abnormalDesc',align: 'center' },
|
||||||
{ title: '异常时间', key: 'abnormalTime',align: 'center' },
|
{ title: '异常时间', key: 'abnormalTime',align: 'center' },
|
||||||
{ title: '处理状态', key: 'status',align: 'center',
|
{ title: '处理状态', key: 'status',align: 'center',
|
||||||
@ -34,23 +91,159 @@
|
|||||||
const data = await dictDataApi.listByType('device_abnormal_status')
|
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 }))
|
deviceNormalRecordOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
|
||||||
}catch {}
|
}catch {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = await dictDataApi.listByType('abnormal_type')
|
||||||
|
deviceAbnormalTypeOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
|
||||||
|
}catch {}
|
||||||
|
try {
|
||||||
|
const data = await dictDataApi.listByType('abnormal_level')
|
||||||
|
deviceAbnormalLevelOptions.value = data.map(d => ({ label: d.dictLabel, value: (Number(d.dictValue) || d.dictValue),class: d.listClass }))
|
||||||
|
}catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const data = ref([])
|
||||||
|
const load = async() => {
|
||||||
|
try {
|
||||||
|
const res = await deviceAbnormalRecordApi.page({
|
||||||
|
page: pagination.page,
|
||||||
|
pageSize: pagination.pageSize,
|
||||||
|
deviceId: props.deviceId,
|
||||||
|
abnormalCode: searchForm.value.abnormalCode,
|
||||||
|
abnormalType: searchForm.value.abnormalType,
|
||||||
|
})
|
||||||
|
data.value = res.list
|
||||||
|
pagination.itemCount = res.total
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
const doShowInner = () => {
|
||||||
|
if (showSearchInput.value) {
|
||||||
|
showSearchInput.value = false
|
||||||
|
}else {
|
||||||
|
showSearchInput.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
searchForm.value.abnormalType = null
|
||||||
|
searchForm.value.abnormalCode = null
|
||||||
|
pagination.page = 1
|
||||||
|
pagination.pageSize = 10
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
load()
|
||||||
loadDictOptions()
|
loadDictOptions()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-card>
|
<div>
|
||||||
<n-data-table
|
<n-button @click="doShowInner" v-if="showSearchInput">
|
||||||
:columns="deviceAbnormalRecordColums"
|
<n-icon size="20" :depth="3">
|
||||||
size="small"
|
<ArrowDown/>
|
||||||
:data="props.deviceAbnormalRecordList"
|
</n-icon>
|
||||||
remote
|
展开
|
||||||
:scroll-x="600"
|
</n-button>
|
||||||
/>
|
<n-card v-if="!showSearchInput">
|
||||||
</n-card>
|
<n-form inline :model="searchForm" label-placement="left">
|
||||||
|
<n-grid :x-gap="8" :cols="4">
|
||||||
|
<n-gi>
|
||||||
|
<n-form-item label="异常编号">
|
||||||
|
<n-input v-model:value="searchForm.abnormalCode" placeholder="请输入异常编号" clearable style="width: 200px"/>
|
||||||
|
</n-form-item>
|
||||||
|
</n-gi>
|
||||||
|
<n-gi>
|
||||||
|
<n-form-item label="操作人员">
|
||||||
|
<n-select
|
||||||
|
v-model:value="searchForm.abnormalType"
|
||||||
|
:options="abnormalTypes"
|
||||||
|
placeholder="请选择异常类型"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
</n-gi>
|
||||||
|
<n-gi>
|
||||||
|
<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-gi>
|
||||||
|
</n-grid>
|
||||||
|
|
||||||
|
|
||||||
|
</n-form>
|
||||||
|
<n-button @click="doShowInner" v-if="!showSearchInput" style="float: right;margin: 10px">
|
||||||
|
<n-icon size="20" :depth="3">
|
||||||
|
<ArrowUp/>
|
||||||
|
</n-icon>
|
||||||
|
闭合
|
||||||
|
</n-button>
|
||||||
|
</n-card>
|
||||||
|
<n-card style="margin: 20px 0">
|
||||||
|
<n-data-table
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
:bordered="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:item-count="pagination.itemCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ pagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
219
src/views/biz/device/DeviceDispatchLog.vue
Normal file
219
src/views/biz/device/DeviceDispatchLog.vue
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
import {ArrowDown, ArrowUp, RefreshOutline, SearchOutline} from "@vicons/ionicons5";
|
||||||
|
import {NButton, NIcon, NSpace} from "naive-ui";
|
||||||
|
import {onMounted, reactive, ref} from "vue";
|
||||||
|
import { issueRecordApi,IssueRecord } from '@/api/issuerecord.ts'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
deviceId:Number
|
||||||
|
})
|
||||||
|
|
||||||
|
const showSearchInput = ref<Boolean>(false)
|
||||||
|
|
||||||
|
const searchForm = ref({
|
||||||
|
issueCode: undefined,
|
||||||
|
status: undefined,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 2,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
const doShowInner = () => {
|
||||||
|
if (showSearchInput.value) {
|
||||||
|
showSearchInput.value = false
|
||||||
|
}else {
|
||||||
|
showSearchInput.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//状态
|
||||||
|
const statusList = [
|
||||||
|
{
|
||||||
|
label: '下发失败',
|
||||||
|
value: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '下发成功',
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
//查询下发日志
|
||||||
|
const data = ref([])
|
||||||
|
const load = async()=>{
|
||||||
|
const res = await issueRecordApi.page({
|
||||||
|
pageSize: pagination.pageSize,
|
||||||
|
page: pagination.page,
|
||||||
|
deviceId: props.deviceId,
|
||||||
|
issueCode: searchForm.value.issueCode,
|
||||||
|
status: searchForm.value.status
|
||||||
|
});
|
||||||
|
data.value = res.list
|
||||||
|
pagination.itemCount = res.total
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '下发编号',
|
||||||
|
key: 'issueCode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '下发类型',
|
||||||
|
key: 'issueType',
|
||||||
|
render(row) {
|
||||||
|
var opt = row.issueType
|
||||||
|
if(opt == 0) return '图纸'
|
||||||
|
if(opt == 1) return '文件'
|
||||||
|
if(opt == 2) return '代码'
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '下发状态',
|
||||||
|
key: 'status',
|
||||||
|
render(row) {
|
||||||
|
var opt = row.status
|
||||||
|
if(opt == 0) return '下发失败'
|
||||||
|
if(opt == 1) return '下发成功'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '下发时间',
|
||||||
|
key: 'issueTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
key: 'remark'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
searchForm.value.issueCode = null
|
||||||
|
searchForm.value.status = null
|
||||||
|
pagination.page = 1
|
||||||
|
pagination.pageSize = 10
|
||||||
|
handleSearch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
load()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<n-button @click="doShowInner" v-if="showSearchInput">
|
||||||
|
<n-icon size="20" :depth="3">
|
||||||
|
<ArrowDown/>
|
||||||
|
</n-icon>
|
||||||
|
展开
|
||||||
|
</n-button>
|
||||||
|
<n-card v-if="!showSearchInput">
|
||||||
|
<n-form inline :model="searchForm" label-placement="left">
|
||||||
|
<n-grid :x-gap="8" :cols="4">
|
||||||
|
<n-gi>
|
||||||
|
<n-form-item label="下发编号">
|
||||||
|
<n-input v-model:value="searchForm.issueCode" placeholder="请输入设备下发编号" clearable style="width: 200px"/>
|
||||||
|
</n-form-item>
|
||||||
|
</n-gi>
|
||||||
|
<n-gi>
|
||||||
|
<n-form-item label="下发状态">
|
||||||
|
<n-select
|
||||||
|
v-model:value="searchForm.status"
|
||||||
|
:options="statusList"
|
||||||
|
placeholder="请选择设备类型"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
</n-gi>
|
||||||
|
<n-gi>
|
||||||
|
<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-gi>
|
||||||
|
</n-grid>
|
||||||
|
|
||||||
|
|
||||||
|
</n-form>
|
||||||
|
<n-button @click="doShowInner" v-if="!showSearchInput" style="float: right;margin: 10px">
|
||||||
|
<n-icon size="20" :depth="3">
|
||||||
|
<ArrowUp/>
|
||||||
|
</n-icon>
|
||||||
|
闭合
|
||||||
|
</n-button>
|
||||||
|
</n-card>
|
||||||
|
<n-card style="margin: 20px 0">
|
||||||
|
<n-data-table
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
:bordered="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:item-count="pagination.itemCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ pagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
273
src/views/biz/device/DeviceOperationLog.vue
Normal file
273
src/views/biz/device/DeviceOperationLog.vue
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
import {NButton, NIcon, NSpace} from "naive-ui";
|
||||||
|
import {ArrowDown, ArrowUp, RefreshOutline, SearchOutline} from "@vicons/ionicons5";
|
||||||
|
import {onMounted, reactive, ref} from "vue";
|
||||||
|
import { deviceApi, Device} from '@/api/device.ts'
|
||||||
|
import {dictDataApi} from "@/api/org.ts";
|
||||||
|
import {userApi,SysUser} from "@/api/system.ts";
|
||||||
|
import { deviceOperationLogApi,type DeviceOperationLog } from '@/api/deviceOperationLog.ts'
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
deviceId:Number
|
||||||
|
})
|
||||||
|
const showSearchInput = ref<Boolean>(false)
|
||||||
|
|
||||||
|
const searchForm = ref({
|
||||||
|
createTime: undefined,
|
||||||
|
operationType: undefined,
|
||||||
|
userId: undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const doShowInner = () => {
|
||||||
|
if (showSearchInput.value) {
|
||||||
|
showSearchInput.value = false
|
||||||
|
}else {
|
||||||
|
showSearchInput.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//设备集合
|
||||||
|
const deviceList = ref<Device[]>([])
|
||||||
|
|
||||||
|
const getDeviceList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await deviceApi.deviceList()
|
||||||
|
deviceList.value = res.map((n:any)=>{
|
||||||
|
return {
|
||||||
|
label:n.deviceName,
|
||||||
|
value:n.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//操作类型
|
||||||
|
const optionTypeList = ref([])
|
||||||
|
const loadDictOptions = async ()=>{
|
||||||
|
try {
|
||||||
|
const data = await dictDataApi.listByType("option_type")
|
||||||
|
optionTypeList.value = data.map(d => ({
|
||||||
|
label: d.dictLabel,
|
||||||
|
value: (Number(d.dictValue) || d.dictValue),
|
||||||
|
class: d.listClass
|
||||||
|
}))
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//人员集合
|
||||||
|
const optionUserList = ref<SysUser[]>([])
|
||||||
|
const loadUserList = async ()=>{
|
||||||
|
try {
|
||||||
|
const data = await userApi.getPathList()
|
||||||
|
optionUserList.value = data.map(d => ({
|
||||||
|
label: d.nickname,
|
||||||
|
value: d.id
|
||||||
|
}))
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//查询操作日志
|
||||||
|
const data = ref([])
|
||||||
|
const load = async()=>{
|
||||||
|
const res = await deviceOperationLogApi.page({
|
||||||
|
page: pagination.page,
|
||||||
|
pageSize: pagination.pageSize,
|
||||||
|
deviceId: props.deviceId,
|
||||||
|
createTime: searchForm.value.createTime,
|
||||||
|
operationType: searchForm.value.operationType,
|
||||||
|
userId: searchForm.value.userId
|
||||||
|
});
|
||||||
|
data.value = res.list
|
||||||
|
pagination.itemCount = res.total
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//表格
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '设备名称',
|
||||||
|
key: 'deviceName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作类型',
|
||||||
|
key: 'operationTypeName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作人员',
|
||||||
|
key: 'userName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作时间',
|
||||||
|
key: 'createTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据来源',
|
||||||
|
key: 'source',
|
||||||
|
render(row) {
|
||||||
|
var opt = row.source
|
||||||
|
if(opt == 1) return '终端'
|
||||||
|
if(opt == 2) return '后台'
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
searchForm.value.createTime = null
|
||||||
|
searchForm.value.operationType = null
|
||||||
|
searchForm.value.userId = null
|
||||||
|
pagination.page = 1
|
||||||
|
pagination.pageSize = 10
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(()=>{
|
||||||
|
getDeviceList()
|
||||||
|
loadDictOptions()
|
||||||
|
loadUserList()
|
||||||
|
load()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<n-button @click="doShowInner" v-if="showSearchInput">
|
||||||
|
<n-icon size="20" :depth="3">
|
||||||
|
<ArrowDown/>
|
||||||
|
</n-icon>
|
||||||
|
展开
|
||||||
|
</n-button>
|
||||||
|
<n-card v-if="!showSearchInput">
|
||||||
|
<n-form inline :model="searchForm" label-placement="left">
|
||||||
|
<n-grid :x-gap="8" :cols="4">
|
||||||
|
<n-gi>
|
||||||
|
<n-form-item label="日期">
|
||||||
|
<n-date-picker
|
||||||
|
v-model:value="searchForm.createTime"
|
||||||
|
type="date" />
|
||||||
|
</n-form-item>
|
||||||
|
</n-gi>
|
||||||
|
<!-- <n-gi>-->
|
||||||
|
<!-- <n-form-item label="操作类型">-->
|
||||||
|
<!-- <n-select-->
|
||||||
|
<!-- v-model:value="searchForm.operationType"-->
|
||||||
|
<!-- :options="optionTypeList"-->
|
||||||
|
<!-- placeholder="请选择设备类型"-->
|
||||||
|
<!-- clearable-->
|
||||||
|
<!-- style="width: 200px"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </n-form-item>-->
|
||||||
|
<!-- </n-gi>-->
|
||||||
|
<n-gi>
|
||||||
|
<n-form-item label="操作人员">
|
||||||
|
<n-select
|
||||||
|
v-model:value="searchForm.userId"
|
||||||
|
:options="optionUserList"
|
||||||
|
placeholder="请选择设备类型"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
</n-gi>
|
||||||
|
<n-gi>
|
||||||
|
<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-gi>
|
||||||
|
</n-grid>
|
||||||
|
|
||||||
|
|
||||||
|
</n-form>
|
||||||
|
<n-button @click="doShowInner" v-if="!showSearchInput" style="float: right;margin: 10px">
|
||||||
|
<n-icon size="20" :depth="3">
|
||||||
|
<ArrowUp/>
|
||||||
|
</n-icon>
|
||||||
|
闭合
|
||||||
|
</n-button>
|
||||||
|
</n-card>
|
||||||
|
<n-card style="margin: 20px 0">
|
||||||
|
<n-data-table
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
:bordered="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:item-count="pagination.itemCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ pagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
|
</n-card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -74,6 +74,7 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:row-key="(row) => row.id"
|
:row-key="(row) => row.id"
|
||||||
:scroll-x="1200"
|
:scroll-x="1200"
|
||||||
|
v-model:checked-row-keys="selectedIds"
|
||||||
/>
|
/>
|
||||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
<n-pagination
|
<n-pagination
|
||||||
@ -130,10 +131,10 @@
|
|||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="设备负责人" path="deviceManager">
|
<n-form-item label="设备负责人" path="deviceManager">
|
||||||
<n-select
|
<n-select
|
||||||
v-model:value="formData.deviceManagerList"
|
v-model:value="formData.deviceManagers"
|
||||||
:options="deviceManagerList"
|
:options="deviceManagerList"
|
||||||
multiple
|
multiple
|
||||||
placeholder="请选择设备类型"
|
placeholder="请选择设备负责人"
|
||||||
clearable
|
clearable
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
/>
|
/>
|
||||||
@ -201,10 +202,10 @@
|
|||||||
</n-modal>
|
</n-modal>
|
||||||
|
|
||||||
<!--异常记录抽屉-->
|
<!--异常记录抽屉-->
|
||||||
<n-drawer v-model:show="deviceAbnormalRecordDrawerVisible" :title="title" width="800">
|
<n-drawer v-model:show="deviceAbnormalRecordDrawerVisible" :title="title" width="1800">
|
||||||
<n-drawer-content :title="title">
|
<n-drawer-content :title="title">
|
||||||
<DeviceAbnormalRecordPage
|
<DeviceAbnormalRecordPage
|
||||||
:deviceAbnormalRecordList="deviceAbnormalRecordList"
|
:deviceId="deviceId"
|
||||||
/>
|
/>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<n-button @click="doShowInner">
|
<n-button @click="doShowInner">
|
||||||
@ -213,6 +214,36 @@
|
|||||||
</template>
|
</template>
|
||||||
</n-drawer-content>
|
</n-drawer-content>
|
||||||
</n-drawer>
|
</n-drawer>
|
||||||
|
|
||||||
|
<!--操作日志抽屉-->
|
||||||
|
<n-drawer v-model:show="deviceOperationLogDrawerVisible" width="1800">
|
||||||
|
<n-drawer-content :title="title">
|
||||||
|
<DeviceOperationLogPage
|
||||||
|
:deviceId = deviceId
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="doShowInner">
|
||||||
|
取消
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
</n-drawer-content>
|
||||||
|
</n-drawer>
|
||||||
|
|
||||||
|
<!--下发记录抽屉-->
|
||||||
|
<n-drawer v-model:show="deviceDispatchLogDrawerVisible" width="1800">
|
||||||
|
<n-drawer-content :title="title">
|
||||||
|
<DeviceDispatchLogPage
|
||||||
|
:deviceId = deviceId
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="doShowInner">
|
||||||
|
取消
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
</n-drawer-content>
|
||||||
|
</n-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -239,10 +270,16 @@ import {sectionApi} from '@/api/section'
|
|||||||
import {SysUser, userApi} from '@/api/system'
|
import {SysUser, userApi} from '@/api/system'
|
||||||
import {DeviceAbnormalRecord, deviceAbnormalRecordApi} from "@/api/deviceAbnormalRecord.ts";
|
import {DeviceAbnormalRecord, deviceAbnormalRecordApi} from "@/api/deviceAbnormalRecord.ts";
|
||||||
import DeviceAbnormalRecordPage from '@/views/biz/device/DeviceAbnomarlRecord.vue'
|
import DeviceAbnormalRecordPage from '@/views/biz/device/DeviceAbnomarlRecord.vue'
|
||||||
|
import DeviceOperationLogPage from "@/views/biz/device/DeviceOperationLog.vue";
|
||||||
|
|
||||||
|
import DeviceDispatchLogPage from "@/views/biz/device/DeviceDispatchLog.vue";
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
//设备Id
|
||||||
|
const deviceId = ref<number>(undefined)
|
||||||
|
|
||||||
//设备负责人列表
|
//设备负责人列表
|
||||||
const deviceManagerList = ref<{ label: string, value: any }[]>([])
|
const deviceManagerList = ref<{ label: string, value: any }[]>([])
|
||||||
|
|
||||||
@ -255,9 +292,10 @@ const title = ref('')
|
|||||||
|
|
||||||
//设备下发记录
|
//设备下发记录
|
||||||
const deviceIssueRecordList = ref<[]>([])
|
const deviceIssueRecordList = ref<[]>([])
|
||||||
|
const deviceDispatchLogDrawerVisible = ref<Boolean>(false)
|
||||||
|
|
||||||
|
//操作日志抽屉
|
||||||
|
const deviceOperationLogDrawerVisible = ref<Boolean>(false)
|
||||||
|
|
||||||
// 搜索表单
|
// 搜索表单
|
||||||
const searchForm = reactive({
|
const searchForm = reactive({
|
||||||
@ -297,7 +335,9 @@ const defaultFormData: Device = {
|
|||||||
status: 0,
|
status: 0,
|
||||||
deviceFlag: 'mes_equipment',
|
deviceFlag: 'mes_equipment',
|
||||||
synEquipId: null as number | null,
|
synEquipId: null as number | null,
|
||||||
deviceManagerList: null as any | null
|
deviceManagerList: null as any | null,
|
||||||
|
deviceManagers: null as [string] | null,
|
||||||
|
deviceManager: null as String | null
|
||||||
}
|
}
|
||||||
const formData = reactive<Device>({...defaultFormData})
|
const formData = reactive<Device>({...defaultFormData})
|
||||||
|
|
||||||
@ -365,12 +405,14 @@ const columns: DataTableColumns<Device> = [
|
|||||||
{
|
{
|
||||||
label: '设备异常记录',
|
label: '设备异常记录',
|
||||||
key: 'deviceErrorLog',
|
key: 'deviceErrorLog',
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '设备下发记录',
|
label: '设备下发记录',
|
||||||
key: 'deviceDispatchLog',
|
key: 'deviceDispatchLog',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备操作日志',
|
||||||
|
key: 'deviceOperationLog',
|
||||||
}
|
}
|
||||||
], onSelect: (key: string) => {
|
], onSelect: (key: string) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
@ -380,6 +422,9 @@ const columns: DataTableColumns<Device> = [
|
|||||||
case "deviceDispatchLog":
|
case "deviceDispatchLog":
|
||||||
handleDeviceDispatchLog(row)
|
handleDeviceDispatchLog(row)
|
||||||
break
|
break
|
||||||
|
case "deviceOperationLog":
|
||||||
|
deviceOperationLog(row)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -455,16 +500,23 @@ function goRealtimeBoard() {
|
|||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
function handleEdit(row: Device) {
|
function handleEdit(row: Device) {
|
||||||
|
Object.assign(formData, defaultFormData)
|
||||||
modalTitle.value = '编辑设备表'
|
modalTitle.value = '编辑设备表'
|
||||||
Object.assign(formData, row)
|
Object.assign(formData, row)
|
||||||
console.log(formData);
|
const userIdList = []
|
||||||
|
if (row.deviceManager) {
|
||||||
|
let manager = row.deviceManager.split(',');
|
||||||
|
manager.forEach(item => {
|
||||||
|
userIdList.push(Number(item))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
formData.deviceManagers = userIdList
|
||||||
modalVisible.value = true
|
modalVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
|
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate()
|
||||||
try {
|
try {
|
||||||
const submitData = {...formData} as Device
|
const submitData = {...formData} as Device
|
||||||
@ -531,6 +583,7 @@ async function handleExport() {
|
|||||||
const params: Record<string, any> = {}
|
const params: Record<string, any> = {}
|
||||||
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||||
if (searchForm.deviceCode != null) params.deviceCode = searchForm.deviceCode
|
if (searchForm.deviceCode != null) params.deviceCode = searchForm.deviceCode
|
||||||
|
params.deviceFlag = "mes_equipment"
|
||||||
const blob = await deviceApi.export(params)
|
const blob = await deviceApi.export(params)
|
||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
@ -620,26 +673,42 @@ async function loadSection() {
|
|||||||
|
|
||||||
//加载人员
|
//加载人员
|
||||||
async function handleUser() {
|
async function handleUser() {
|
||||||
const res = await userApi.getEquipmentManager()
|
const res = await userApi.getPathList()
|
||||||
deviceManagerList.value = res
|
deviceManagerList.value = res.map((n:any)=>{
|
||||||
|
return {
|
||||||
|
label:n.username,
|
||||||
|
value:n.id
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//查看设备异常记录
|
//查看设备异常记录
|
||||||
async function handleDeviceErrorLog(row: Device) {
|
async function handleDeviceErrorLog(row: Device) {
|
||||||
|
deviceId.value = row.id
|
||||||
deviceAbnormalRecordDrawerVisible.value = true
|
deviceAbnormalRecordDrawerVisible.value = true
|
||||||
title.value = row.deviceName+"异常记录"
|
title.value = row.deviceName+"异常记录"
|
||||||
|
|
||||||
deviceErrorLogList.value = row.abnormalRecordList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function handleDeviceDispatchLog(row: Device) {
|
async function handleDeviceDispatchLog(row: Device) {
|
||||||
const deviceId = row.id
|
deviceId.value = row.id
|
||||||
//deviceIssueRecordList.value = await deviceIssueRecordApi.getDeviceDispatchLogList(deviceId)
|
deviceDispatchLogDrawerVisible.value = true
|
||||||
|
title.value = row.deviceName+"设备下发记录"
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deviceOperationLog(row: Device) {
|
||||||
|
deviceId.value = row.id
|
||||||
|
deviceOperationLogDrawerVisible.value = true
|
||||||
|
title.value = row.deviceName + "操作记录";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doShowInner() {
|
function doShowInner() {
|
||||||
deviceAbnormalRecordDrawerVisible.value = false
|
deviceAbnormalRecordDrawerVisible.value = false
|
||||||
|
deviceOperationLogDrawerVisible.value = false
|
||||||
|
deviceDispatchLogDrawerVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
449
src/views/biz/errorNotification/index.vue
Normal file
449
src/views/biz/errorNotification/index.vue
Normal 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>
|
||||||
@ -664,8 +664,8 @@ const submitLogModalVisible = ref<Boolean>(false)
|
|||||||
//汇报详情
|
//汇报详情
|
||||||
function openDetailModel(order:ProcessPlanItemVO,procces?:OrderProcessPlanVO) {
|
function openDetailModel(order:ProcessPlanItemVO,procces?:OrderProcessPlanVO) {
|
||||||
|
|
||||||
submitLogModalVisible.value = true
|
// submitLogModalVisible.value = true
|
||||||
const processId = procces.planId
|
// const processId = procces.planId
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,15 +82,13 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref,reactive, watch } from 'vue'
|
import { ref,reactive } from 'vue'
|
||||||
import { userApi } from '@/api/system'
|
import { userApi } from '@/api/system'
|
||||||
import {deviceApi} from '@/api/device'
|
|
||||||
import {sectionApi, type Section} from '@/api/section'
|
import {sectionApi, type Section} from '@/api/section'
|
||||||
import {
|
import {
|
||||||
AddOutline,
|
AddOutline,
|
||||||
TrashOutline,
|
TrashOutline,
|
||||||
} from '@vicons/ionicons5'
|
} from '@vicons/ionicons5'
|
||||||
import { label } from 'three/tsl'
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
listname:any
|
listname:any
|
||||||
|
|||||||
@ -51,6 +51,7 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:row-key="(row) => row.id"
|
:row-key="(row) => row.id"
|
||||||
:scroll-x="1200"
|
:scroll-x="1200"
|
||||||
|
v-model:checked-row-keys="selectedIds"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
|||||||
@ -51,6 +51,7 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:row-key="(row) => row.id"
|
:row-key="(row) => row.id"
|
||||||
:scroll-x="1200"
|
:scroll-x="1200"
|
||||||
|
v-model:checked-row-keys="selectedIds"
|
||||||
/>
|
/>
|
||||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
<n-pagination
|
<n-pagination
|
||||||
@ -361,6 +362,7 @@ async function handleExport() {
|
|||||||
const params: Record<string, any> = {}
|
const params: Record<string, any> = {}
|
||||||
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||||
if (searchForm.deviceCode != null) params.deviceCode = searchForm.deviceCode
|
if (searchForm.deviceCode != null) params.deviceCode = searchForm.deviceCode
|
||||||
|
params.deviceFlag = "mes_station"
|
||||||
const blob = await deviceApi.export(params)
|
const blob = await deviceApi.export(params)
|
||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
|
|||||||
@ -248,7 +248,6 @@ import {
|
|||||||
reactive,
|
reactive,
|
||||||
h,
|
h,
|
||||||
onMounted,
|
onMounted,
|
||||||
watch,
|
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
|
|
||||||
@ -259,11 +258,8 @@ import {
|
|||||||
NImage,
|
NImage,
|
||||||
NPagination,
|
NPagination,
|
||||||
NGrid,
|
NGrid,
|
||||||
// NGi,
|
|
||||||
NTag,
|
|
||||||
useMessage,
|
useMessage,
|
||||||
useDialog,
|
useDialog,
|
||||||
//type FormInst,
|
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -279,7 +275,6 @@ import {
|
|||||||
addDrawing,
|
addDrawing,
|
||||||
editDrawing,
|
editDrawing,
|
||||||
drawinglist,
|
drawinglist,
|
||||||
drawingIssue,
|
|
||||||
deleteDrawing
|
deleteDrawing
|
||||||
} from '@/api/illustrated'
|
} from '@/api/illustrated'
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
</template>
|
</template>
|
||||||
全屏
|
全屏
|
||||||
</n-button> -->
|
</n-button> -->
|
||||||
<!-- <n-button @click="refresh" ghost style="margin-right: 20px;color: #fff;">
|
<n-button @click="refresh" ghost style="margin-right: 20px;color: #fff;">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<Sync />
|
<Sync />
|
||||||
@ -48,9 +48,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
刷新
|
刷新
|
||||||
</n-button> -->
|
</n-button>
|
||||||
<!--switchworks-->
|
<!--switchworks-->
|
||||||
<n-button ghost style="color: #fff;" @click="handover">
|
<n-button ghost style="margin-right: 20px;color: #fff;" @click="handover">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<SwapHorizontalOutline />
|
<SwapHorizontalOutline />
|
||||||
@ -58,6 +58,14 @@
|
|||||||
</template>
|
</template>
|
||||||
工位交接
|
工位交接
|
||||||
</n-button>
|
</n-button>
|
||||||
|
<n-button ghost style="color: #fff;" @click="handover">
|
||||||
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<LogOutOutline />
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
|
退出登录
|
||||||
|
</n-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="total" style="display: none;">
|
<div class="total" style="display: none;">
|
||||||
@ -422,10 +430,10 @@
|
|||||||
<template v-if="loglist.length > 0">
|
<template v-if="loglist.length > 0">
|
||||||
<div v-for="n in loglist" style="margin-bottom: 18px;padding: 12px;border:1px solid #afafaf;border-radius:10px;background:#2d475c;">
|
<div v-for="n in loglist" style="margin-bottom: 18px;padding: 12px;border:1px solid #afafaf;border-radius:10px;background:#2d475c;">
|
||||||
<div style="display: flex;align-items: center;justify-content: space-between;font-size: 16px;">
|
<div style="display: flex;align-items: center;justify-content: space-between;font-size: 16px;">
|
||||||
<div>张三三</div>
|
<div>{{n.userName}}</div>
|
||||||
<div>{{n.createTime}}</div>
|
<div>{{n.createTime}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 20px;">{{operationType[n.operationType]}}</div>
|
<div style="font-size: 20px;">{{operationType[n.operationType+'']}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@ -571,7 +579,7 @@
|
|||||||
</n-form>
|
</n-form>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<div style="position: absolute;top: 50%;left: 50%;width: 400px;height: 580px;padding: 20px;transform: translate(-50%,-50%);border-radius: 20px;border: 1px #b7b7b7 solid;background: #1e2a40;">
|
<div style="position: absolute;top: 50%;left: 50%;width: 400px;height: 500px;padding: 20px;transform: translate(-50%,-50%);border-radius: 20px;border: 1px #b7b7b7 solid;background: #1e2a40;">
|
||||||
<div style="width: 100%;padding:10px 20px;text-align: center;">
|
<div style="width: 100%;padding:10px 20px;text-align: center;">
|
||||||
<n-icon size="40" color="#00a2ff">
|
<n-icon size="40" color="#00a2ff">
|
||||||
<EarthOutline />
|
<EarthOutline />
|
||||||
@ -718,7 +726,8 @@ import {
|
|||||||
StopCircleOutline,
|
StopCircleOutline,
|
||||||
ShapesOutline,
|
ShapesOutline,
|
||||||
LogoWebComponent,
|
LogoWebComponent,
|
||||||
TimerSharp
|
TimerSharp,
|
||||||
|
LogOutOutline
|
||||||
} from '@vicons/ionicons5'
|
} from '@vicons/ionicons5'
|
||||||
|
|
||||||
import Circlebom from './circle.vue'
|
import Circlebom from './circle.vue'
|
||||||
@ -730,10 +739,10 @@ import {
|
|||||||
workstation,
|
workstation,
|
||||||
taskdetail,
|
taskdetail,
|
||||||
operationlist,
|
operationlist,
|
||||||
reportingwork
|
reportingwork,
|
||||||
|
terlogout
|
||||||
} from '@/api/proterminal'
|
} from '@/api/proterminal'
|
||||||
import { element, label } from 'three/tsl'
|
|
||||||
import { Value } from 'three/examples/jsm/inspector/ui/Values.js'
|
|
||||||
|
|
||||||
//import { dictDataApi } from '@/api/org'
|
//import { dictDataApi } from '@/api/org'
|
||||||
|
|
||||||
@ -800,10 +809,16 @@ const ticketStatus :any = {
|
|||||||
|
|
||||||
//日志类型
|
//日志类型
|
||||||
const operationType :any = {
|
const operationType :any = {
|
||||||
1:'开始',
|
'-1':'登出',
|
||||||
2:'暂停',
|
'0':'登入',
|
||||||
3:'报工',
|
'1':'开始',
|
||||||
4:'撤回'
|
'2':'暂停',
|
||||||
|
'3':'报工',
|
||||||
|
'4':'撤回',
|
||||||
|
'5':'叫料',
|
||||||
|
'6':'调车',
|
||||||
|
'7':'工位交接',
|
||||||
|
'8':'工位交接确认'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,8 @@ export default defineConfig({
|
|||||||
port: 3000,
|
port: 3000,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target:'http://192.168.12.4:8888/', //'http://192.168.5.230:8888',
|
target:'http://192.168.12.4:8888/',
|
||||||
|
//target:'http://192.168.12.230:8888',
|
||||||
//target:'http://192.168.5.230:8888',
|
//target:'http://192.168.5.230:8888',
|
||||||
//target:'http://192.168.5.232:8888/',
|
//target:'http://192.168.5.232:8888/',
|
||||||
//target:'http://localhost:8888',
|
//target:'http://localhost:8888',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user