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'
|
||||
|
||||
# 开发环境
|
||||
<<<<<<< HEAD
|
||||
VITE_APP_BASE_API = 'http://192.168.5.232: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://localhost/api'
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
"naive-ui": "^2.37.3",
|
||||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"seemly": "^0.3.10",
|
||||
"three": "^0.184.0",
|
||||
"vue": "^3.4.15",
|
||||
"vue-draggable-plus": "^0.6.1",
|
||||
|
||||
@ -50,6 +50,9 @@ importers:
|
||||
pinia-plugin-persistedstate:
|
||||
specifier: ^3.2.1
|
||||
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:
|
||||
specifier: ^0.184.0
|
||||
version: 0.184.0
|
||||
|
||||
@ -20,7 +20,9 @@ export interface Device{
|
||||
synEquipId?: number | null,
|
||||
createTime:string,
|
||||
updateTime:string
|
||||
abnormalRecordList:[]
|
||||
abnormalRecordList:[],
|
||||
deviceManagers:[]
|
||||
deviceManager:string
|
||||
}
|
||||
|
||||
export interface DeviceRealtimeVO {
|
||||
@ -103,11 +105,14 @@ export const deviceApi = {
|
||||
export(
|
||||
params?:{
|
||||
ids?:string[],
|
||||
deviceCode:any
|
||||
deviceCode:any,
|
||||
deviceFlag?:string
|
||||
}){
|
||||
const p:Record<string,any> = {}
|
||||
console.log( params)
|
||||
if(params?.ids?.length) p.ids = params.ids.join(',')
|
||||
if(params?.deviceCode != undefined && params?.deviceCode !== null) p.sectionCode = params.deviceCode
|
||||
if(params?.deviceFlag != undefined && params?.deviceFlag !== null) p.deviceFlag = params.deviceFlag
|
||||
return request({
|
||||
url:`/biz/device/report`,
|
||||
method:"get",
|
||||
@ -122,5 +127,11 @@ export const deviceApi = {
|
||||
method:"get",
|
||||
params
|
||||
})
|
||||
},
|
||||
deviceList() {
|
||||
return request({
|
||||
url:"/biz/device/list",
|
||||
method:"get"
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@ export interface DeviceAbnormalRecord {
|
||||
|
||||
stationName?: string
|
||||
|
||||
abnormalType?: string
|
||||
abnormalType?: number
|
||||
|
||||
abnormalTypeName?: string
|
||||
|
||||
@ -53,7 +53,7 @@ export interface DeviceAbnormalRecord {
|
||||
// 设备异常记录表 API
|
||||
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 })
|
||||
},
|
||||
|
||||
|
||||
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) {
|
||||
return request({
|
||||
url: '/api/biz/ncCode/issue',
|
||||
url: '/biz/ncCode/issue',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@ -53,7 +53,7 @@ export function batchIssue(data:any) {
|
||||
//删除
|
||||
export function deleteIssue(ids:any) {
|
||||
return request({
|
||||
url: `api/biz/ncCode/${ids}`,
|
||||
url: `/biz/ncCode/${ids}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@ -66,3 +66,37 @@ export function issuecopy(data:any) {
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//登出设备
|
||||
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'),
|
||||
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',
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<n-icon>
|
||||
<AddOutline />
|
||||
@ -51,7 +51,7 @@
|
||||
</template>
|
||||
删除
|
||||
</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>
|
||||
<n-icon>
|
||||
<ArrowDownCircleOutline />
|
||||
@ -111,7 +111,7 @@
|
||||
<n-grid :cols="1" :x-gap="24">
|
||||
<n-gi>
|
||||
<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-gi>
|
||||
<n-gi>
|
||||
@ -214,51 +214,22 @@
|
||||
v-model:show="issueModel"
|
||||
title="下发"
|
||||
preset="card"
|
||||
style="width: 500px"
|
||||
style="width: 600px"
|
||||
:mask-closable="false"
|
||||
>
|
||||
|
||||
<n-form
|
||||
ref="issformRef"
|
||||
:model="issformData"
|
||||
:rules="issaddrules"
|
||||
label-placement="top"
|
||||
label-width="100"
|
||||
>
|
||||
<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-transfer
|
||||
v-model:value="value"
|
||||
style="height:500px;"
|
||||
:options="options"
|
||||
:render-source-list="renderSourceList"
|
||||
source-filterable
|
||||
@update:value="tranupdate"
|
||||
/>
|
||||
</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>
|
||||
<n-space justify="end">
|
||||
<n-button @click="issueModel = false">取消</n-button>
|
||||
<n-button
|
||||
type="primary"
|
||||
|
||||
@click="isssavehand"
|
||||
>确认</n-button>
|
||||
</n-space>
|
||||
@ -280,6 +251,7 @@ import {
|
||||
|
||||
|
||||
import {
|
||||
NTree,
|
||||
NButton,
|
||||
NIcon,
|
||||
NSpace,
|
||||
@ -306,12 +278,11 @@ import {
|
||||
batchIssue,
|
||||
editccode,
|
||||
issuecopy,
|
||||
ncCode
|
||||
generateNccode,
|
||||
opertree,
|
||||
exportNccode
|
||||
} from '@/api/nccode'
|
||||
|
||||
|
||||
|
||||
|
||||
const dialog = useDialog()
|
||||
|
||||
const message = useMessage()
|
||||
@ -321,7 +292,7 @@ const userStore = useUserStore()
|
||||
// 权限检查
|
||||
const hasPermission = (permission: string) => userStore.hasPermission(permission)
|
||||
|
||||
const ncDispatchRecords = ref<ncCode[]>([])
|
||||
//const ncDispatchRecords = ref<ncCode[]>([])
|
||||
|
||||
//派工状态字典
|
||||
//const qcAssingStatusOptions = ref<{ label: string; value: any;class:any }[]>([])
|
||||
@ -408,6 +379,31 @@ const columns = [
|
||||
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",
|
||||
title:"备注",
|
||||
@ -458,29 +454,36 @@ const columns = [
|
||||
{ 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,{
|
||||
trigger:'click',
|
||||
options:[
|
||||
{label:"下发记录",key:"dispatchRecord"},
|
||||
{type: 'divider' },
|
||||
],
|
||||
onSelect:(key:string)=>{
|
||||
switch(key) {
|
||||
case "dispatchRecord":
|
||||
handleDispatchRecord(row)
|
||||
break
|
||||
},
|
||||
onNegativeClick: () => {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
} },
|
||||
{ default: () => '删除'}
|
||||
))
|
||||
}
|
||||
},{
|
||||
// 下拉触发按钮:三点图标 / 更多文字
|
||||
default: () => h(NButton, { size: 'small', quaternary: true }, {
|
||||
default: () => [h(NIcon, null, { default: () => h(EllipsisHorizontalOutline) })]
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
|
||||
@ -593,9 +596,14 @@ function addhand(type:any,row?:any) {
|
||||
addModel.value = true
|
||||
formData.value?.restoreValidation()
|
||||
isstype.value = type
|
||||
if(type == 1 || type == 3){
|
||||
generateNccode().then(rps => {
|
||||
formData.ncCode = rps
|
||||
})
|
||||
}
|
||||
|
||||
if(row){
|
||||
formData.id = row.id
|
||||
formData.ncCode = row.ncCode
|
||||
formData.ncName = row.ncName
|
||||
formData.ncContent = row.ncContent
|
||||
formData.workCenter = row.workCenter
|
||||
@ -606,6 +614,11 @@ function addhand(type:any,row?:any) {
|
||||
// formData.issueTime = row.issueTime
|
||||
// formData.issueBy = row.issueBy
|
||||
formData.remark = row.remark
|
||||
if(type == 2){
|
||||
formData.ncCode = row.ncCode
|
||||
}else{
|
||||
formData.ncCode = ''
|
||||
}
|
||||
}else{
|
||||
formData.id = ''
|
||||
formData.ncCode = ''
|
||||
@ -639,7 +652,7 @@ function savehand() {
|
||||
if (!e) {
|
||||
|
||||
addEdi().then(() => {
|
||||
message.success(cztype[isstype.value])
|
||||
message.success(`${cztype[isstype.value]}成功`)
|
||||
setTimeout(() => {
|
||||
getlist()
|
||||
addModel.value = false
|
||||
@ -675,39 +688,64 @@ function delhand() {
|
||||
}
|
||||
|
||||
//下发任务列表
|
||||
let isstasklist = ref<any>([])
|
||||
//let isstasklist = ref<any>([])
|
||||
|
||||
//下发设备列表
|
||||
let issequiplist = ref<any>([])
|
||||
//let issequiplist = ref<any>([])
|
||||
|
||||
//下发
|
||||
let issueModel = ref(false)
|
||||
let issformData = reactive<any>({
|
||||
taskid:'',
|
||||
equis:''
|
||||
let treeData:any = []
|
||||
let value = ref<Array<string | number>>([])
|
||||
let renderSourceList:any = ''
|
||||
|
||||
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)
|
||||
}
|
||||
})
|
||||
const issaddrules = {
|
||||
taskid:[
|
||||
{ required: true, message: '请选择下发任务', trigger: 'blur' }
|
||||
],
|
||||
equis:[
|
||||
{ required: true, message: '请选择下发设备', trigger: 'blur' }
|
||||
]
|
||||
|
||||
}
|
||||
flatten(list)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
function renderlabe() {}
|
||||
function issuehand() {
|
||||
issueModel.value = true
|
||||
// if(chearr.value.length > 0){
|
||||
// batchIssue(chearr.value).then(() => {
|
||||
// message.success('操作成功')
|
||||
function tranupdate(v:any) {
|
||||
console.log(v)
|
||||
}
|
||||
|
||||
//下发
|
||||
let issueModel = ref(false)
|
||||
// let issformData = reactive<any>({
|
||||
// taskid:'',
|
||||
// equis:''
|
||||
// })
|
||||
// }else{
|
||||
// message.error('请勾选设备')
|
||||
// const issaddrules = {
|
||||
// taskid:[
|
||||
// { required: true, message: '请选择下发任务', trigger: 'blur' }
|
||||
// ],
|
||||
// equis:[
|
||||
// { required: true, message: '请选择下发设备', trigger: 'blur' }
|
||||
// ]
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
function renderlabe() {}
|
||||
|
||||
function issuehand() {
|
||||
|
||||
issueModel.value = true
|
||||
|
||||
|
||||
}
|
||||
|
||||
const issformRef = ref()
|
||||
@ -715,14 +753,32 @@ const issformRef = ref()
|
||||
function isssavehand() {
|
||||
issformRef.value?.validate((e:any) => {
|
||||
if (!e) {
|
||||
batchIssue('').then(() => {
|
||||
message.success('操作成功')
|
||||
setTimeout(() => {
|
||||
getlist()
|
||||
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()
|
||||
|
||||
@ -735,6 +791,33 @@ async function handleDispatchRecord(row:ncCode){
|
||||
|
||||
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()
|
||||
|
||||
})
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
:loading="loading"
|
||||
:row-key="(row) => row.id"
|
||||
:scroll-x="1200"
|
||||
v-model:checked-row-keys="selectedIds"
|
||||
/>
|
||||
|
||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||
|
||||
@ -1,21 +1,78 @@
|
||||
<script setup lang="ts">
|
||||
import {DeviceAbnormalRecord} from "@/api/deviceAbnormalRecord.ts";
|
||||
import {DataTableColumns, NDataTable, NTag} from "naive-ui";
|
||||
import {h, onMounted, ref} from "vue";
|
||||
import {DataTableColumns, NButton, NDataTable, NIcon, NSpace, NTag} from "naive-ui";
|
||||
import {h, onMounted, reactive, ref} from "vue";
|
||||
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 props = defineProps<{
|
||||
deviceAbnormalRecordList: DeviceAbnormalRecord[]
|
||||
}>()
|
||||
const props = defineProps({
|
||||
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: 'abnormalLevel',align: 'center'},
|
||||
{ title: '报警异常', key: 'abnormalType',align: 'center',
|
||||
render(row) {
|
||||
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: 'abnormalTime',align: 'center' },
|
||||
{ title: '处理状态', key: 'status',align: 'center',
|
||||
@ -34,23 +91,159 @@
|
||||
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 {}
|
||||
|
||||
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(()=>{
|
||||
load()
|
||||
loadDictOptions()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-card>
|
||||
<n-data-table
|
||||
:columns="deviceAbnormalRecordColums"
|
||||
size="small"
|
||||
:data="props.deviceAbnormalRecordList"
|
||||
remote
|
||||
:scroll-x="600"
|
||||
<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.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>
|
||||
|
||||
<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"
|
||||
:row-key="(row) => row.id"
|
||||
:scroll-x="1200"
|
||||
v-model:checked-row-keys="selectedIds"
|
||||
/>
|
||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||
<n-pagination
|
||||
@ -130,10 +131,10 @@
|
||||
</n-form-item>
|
||||
<n-form-item label="设备负责人" path="deviceManager">
|
||||
<n-select
|
||||
v-model:value="formData.deviceManagerList"
|
||||
v-model:value="formData.deviceManagers"
|
||||
:options="deviceManagerList"
|
||||
multiple
|
||||
placeholder="请选择设备类型"
|
||||
placeholder="请选择设备负责人"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
/>
|
||||
@ -201,10 +202,10 @@
|
||||
</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">
|
||||
<DeviceAbnormalRecordPage
|
||||
:deviceAbnormalRecordList="deviceAbnormalRecordList"
|
||||
:deviceId="deviceId"
|
||||
/>
|
||||
<template #footer>
|
||||
<n-button @click="doShowInner">
|
||||
@ -213,6 +214,36 @@
|
||||
</template>
|
||||
</n-drawer-content>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@ -239,10 +270,16 @@ 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'
|
||||
import DeviceOperationLogPage from "@/views/biz/device/DeviceOperationLog.vue";
|
||||
|
||||
import DeviceDispatchLogPage from "@/views/biz/device/DeviceDispatchLog.vue";
|
||||
const message = useMessage()
|
||||
const dialog = useDialog()
|
||||
const router = useRouter()
|
||||
|
||||
//设备Id
|
||||
const deviceId = ref<number>(undefined)
|
||||
|
||||
//设备负责人列表
|
||||
const deviceManagerList = ref<{ label: string, value: any }[]>([])
|
||||
|
||||
@ -255,9 +292,10 @@ const title = ref('')
|
||||
|
||||
//设备下发记录
|
||||
const deviceIssueRecordList = ref<[]>([])
|
||||
const deviceDispatchLogDrawerVisible = ref<Boolean>(false)
|
||||
|
||||
|
||||
|
||||
//操作日志抽屉
|
||||
const deviceOperationLogDrawerVisible = ref<Boolean>(false)
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
@ -297,7 +335,9 @@ const defaultFormData: Device = {
|
||||
status: 0,
|
||||
deviceFlag: 'mes_equipment',
|
||||
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})
|
||||
|
||||
@ -365,12 +405,14 @@ const columns: DataTableColumns<Device> = [
|
||||
{
|
||||
label: '设备异常记录',
|
||||
key: 'deviceErrorLog',
|
||||
|
||||
},
|
||||
{
|
||||
label: '设备下发记录',
|
||||
key: 'deviceDispatchLog',
|
||||
|
||||
},
|
||||
{
|
||||
label: '设备操作日志',
|
||||
key: 'deviceOperationLog',
|
||||
}
|
||||
], onSelect: (key: string) => {
|
||||
switch (key) {
|
||||
@ -380,6 +422,9 @@ const columns: DataTableColumns<Device> = [
|
||||
case "deviceDispatchLog":
|
||||
handleDeviceDispatchLog(row)
|
||||
break
|
||||
case "deviceOperationLog":
|
||||
deviceOperationLog(row)
|
||||
break
|
||||
}
|
||||
}
|
||||
}, {
|
||||
@ -455,16 +500,23 @@ function goRealtimeBoard() {
|
||||
|
||||
// 编辑
|
||||
function handleEdit(row: Device) {
|
||||
|
||||
Object.assign(formData, defaultFormData)
|
||||
modalTitle.value = '编辑设备表'
|
||||
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
|
||||
}
|
||||
|
||||
// 提交
|
||||
async function handleSubmit() {
|
||||
|
||||
await formRef.value?.validate()
|
||||
try {
|
||||
const submitData = {...formData} as Device
|
||||
@ -531,6 +583,7 @@ async function handleExport() {
|
||||
const params: Record<string, any> = {}
|
||||
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||
if (searchForm.deviceCode != null) params.deviceCode = searchForm.deviceCode
|
||||
params.deviceFlag = "mes_equipment"
|
||||
const blob = await deviceApi.export(params)
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
@ -620,26 +673,42 @@ async function loadSection() {
|
||||
|
||||
//加载人员
|
||||
async function handleUser() {
|
||||
const res = await userApi.getEquipmentManager()
|
||||
deviceManagerList.value = res
|
||||
const res = await userApi.getPathList()
|
||||
deviceManagerList.value = res.map((n:any)=>{
|
||||
return {
|
||||
label:n.username,
|
||||
value:n.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//查看设备异常记录
|
||||
async function handleDeviceErrorLog(row: Device) {
|
||||
deviceId.value = row.id
|
||||
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)
|
||||
deviceId.value = row.id
|
||||
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() {
|
||||
deviceAbnormalRecordDrawerVisible.value = false
|
||||
deviceOperationLogDrawerVisible.value = false
|
||||
deviceDispatchLogDrawerVisible.value = false
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
submitLogModalVisible.value = true
|
||||
const processId = procces.planId
|
||||
// submitLogModalVisible.value = true
|
||||
// const processId = procces.planId
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -82,15 +82,13 @@
|
||||
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref,reactive, watch } from 'vue'
|
||||
import { ref,reactive } from 'vue'
|
||||
import { userApi } from '@/api/system'
|
||||
import {deviceApi} from '@/api/device'
|
||||
import {sectionApi, type Section} from '@/api/section'
|
||||
import {
|
||||
AddOutline,
|
||||
TrashOutline,
|
||||
} from '@vicons/ionicons5'
|
||||
import { label } from 'three/tsl'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
listname:any
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
:loading="loading"
|
||||
:row-key="(row) => row.id"
|
||||
:scroll-x="1200"
|
||||
v-model:checked-row-keys="selectedIds"
|
||||
/>
|
||||
|
||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
:loading="loading"
|
||||
:row-key="(row) => row.id"
|
||||
:scroll-x="1200"
|
||||
v-model:checked-row-keys="selectedIds"
|
||||
/>
|
||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||
<n-pagination
|
||||
@ -361,6 +362,7 @@ async function handleExport() {
|
||||
const params: Record<string, any> = {}
|
||||
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||
if (searchForm.deviceCode != null) params.deviceCode = searchForm.deviceCode
|
||||
params.deviceFlag = "mes_station"
|
||||
const blob = await deviceApi.export(params)
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
|
||||
@ -248,7 +248,6 @@ import {
|
||||
reactive,
|
||||
h,
|
||||
onMounted,
|
||||
watch,
|
||||
} from 'vue'
|
||||
|
||||
|
||||
@ -259,11 +258,8 @@ import {
|
||||
NImage,
|
||||
NPagination,
|
||||
NGrid,
|
||||
// NGi,
|
||||
NTag,
|
||||
useMessage,
|
||||
useDialog,
|
||||
//type FormInst,
|
||||
} from 'naive-ui'
|
||||
|
||||
import {
|
||||
@ -279,7 +275,6 @@ import {
|
||||
addDrawing,
|
||||
editDrawing,
|
||||
drawinglist,
|
||||
drawingIssue,
|
||||
deleteDrawing
|
||||
} from '@/api/illustrated'
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
</template>
|
||||
全屏
|
||||
</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>
|
||||
<n-icon>
|
||||
<Sync />
|
||||
@ -48,9 +48,9 @@
|
||||
</template>
|
||||
|
||||
刷新
|
||||
</n-button> -->
|
||||
</n-button>
|
||||
<!--switchworks-->
|
||||
<n-button ghost style="color: #fff;" @click="handover">
|
||||
<n-button ghost style="margin-right: 20px;color: #fff;" @click="handover">
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<SwapHorizontalOutline />
|
||||
@ -58,6 +58,14 @@
|
||||
</template>
|
||||
工位交接
|
||||
</n-button>
|
||||
<n-button ghost style="color: #fff;" @click="handover">
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<LogOutOutline />
|
||||
</n-icon>
|
||||
</template>
|
||||
退出登录
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="total" style="display: none;">
|
||||
@ -422,10 +430,10 @@
|
||||
<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 style="display: flex;align-items: center;justify-content: space-between;font-size: 16px;">
|
||||
<div>张三三</div>
|
||||
<div>{{n.userName}}</div>
|
||||
<div>{{n.createTime}}</div>
|
||||
</div>
|
||||
<div style="font-size: 20px;">{{operationType[n.operationType]}}</div>
|
||||
<div style="font-size: 20px;">{{operationType[n.operationType+'']}}</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
@ -571,7 +579,7 @@
|
||||
</n-form>
|
||||
</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;">
|
||||
<n-icon size="40" color="#00a2ff">
|
||||
<EarthOutline />
|
||||
@ -718,7 +726,8 @@ import {
|
||||
StopCircleOutline,
|
||||
ShapesOutline,
|
||||
LogoWebComponent,
|
||||
TimerSharp
|
||||
TimerSharp,
|
||||
LogOutOutline
|
||||
} from '@vicons/ionicons5'
|
||||
|
||||
import Circlebom from './circle.vue'
|
||||
@ -730,10 +739,10 @@ import {
|
||||
workstation,
|
||||
taskdetail,
|
||||
operationlist,
|
||||
reportingwork
|
||||
reportingwork,
|
||||
terlogout
|
||||
} from '@/api/proterminal'
|
||||
import { element, label } from 'three/tsl'
|
||||
import { Value } from 'three/examples/jsm/inspector/ui/Values.js'
|
||||
|
||||
|
||||
//import { dictDataApi } from '@/api/org'
|
||||
|
||||
@ -800,10 +809,16 @@ const ticketStatus :any = {
|
||||
|
||||
//日志类型
|
||||
const operationType :any = {
|
||||
1:'开始',
|
||||
2:'暂停',
|
||||
3:'报工',
|
||||
4:'撤回'
|
||||
'-1':'登出',
|
||||
'0':'登入',
|
||||
'1':'开始',
|
||||
'2':'暂停',
|
||||
'3':'报工',
|
||||
'4':'撤回',
|
||||
'5':'叫料',
|
||||
'6':'调车',
|
||||
'7':'工位交接',
|
||||
'8':'工位交接确认'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -20,7 +20,8 @@ export default defineConfig({
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/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.232:8888/',
|
||||
//target:'http://localhost:8888',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user