diff --git a/src/api/device.ts b/src/api/device.ts index 0439cee..7324e36 100644 --- a/src/api/device.ts +++ b/src/api/device.ts @@ -20,7 +20,9 @@ export interface Device{ synEquipId?: number | null, createTime:string, updateTime:string - abnormalRecordList:[] + abnormalRecordList:[], + deviceManagers:[] + deviceManager:string } export interface DeviceRealtimeVO { diff --git a/src/api/deviceAbnormalRecord.ts b/src/api/deviceAbnormalRecord.ts index f0b1aef..1b545f8 100644 --- a/src/api/deviceAbnormalRecord.ts +++ b/src/api/deviceAbnormalRecord.ts @@ -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 }) }, diff --git a/src/api/issuerecord.ts b/src/api/issuerecord.ts index f45ed9c..ec6e12d 100644 --- a/src/api/issuerecord.ts +++ b/src/api/issuerecord.ts @@ -45,7 +45,7 @@ export interface IssueRecord { // 下发记录表 API export const issueRecordApi = { // 分页查询 - page(params: { page: number; pageSize: number; id?: number; status?: number }) { + page(params: { page: number; pageSize: number; issueCode?: string; status?: number;deviceId?:number }) { return request({ url: '/biz/issueRecord/page', method: 'get', params }) }, diff --git a/src/api/system.ts b/src/api/system.ts index be64535..b193d3b 100644 --- a/src/api/system.ts +++ b/src/api/system.ts @@ -136,13 +136,6 @@ export const userApi = { }) }, - //获取设备负责人 - getEquipmentManager() { - return request({ - url:"/sys/user/getEquipmentManager", - method:"get" - }) - } } diff --git a/src/api/test01.ts b/src/api/test01.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/views/biz/device/DeviceAbnomarlRecord.vue b/src/views/biz/device/DeviceAbnomarlRecord.vue index 895ef06..206b6c0 100644 --- a/src/views/biz/device/DeviceAbnomarlRecord.vue +++ b/src/views/biz/device/DeviceAbnomarlRecord.vue @@ -1,21 +1,78 @@ \ No newline at end of file diff --git a/src/views/biz/device/DeviceOperationLog.vue b/src/views/biz/device/DeviceOperationLog.vue index 262cf66..0f05717 100644 --- a/src/views/biz/device/DeviceOperationLog.vue +++ b/src/views/biz/device/DeviceOperationLog.vue @@ -108,18 +108,54 @@ const columns = [ }, { title: '操作类型', - key: 'operationType' + key: 'operationTypeName' }, { title: '操作人员', - key: 'nickname' + 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() @@ -149,17 +185,17 @@ onMounted(()=>{ type="date" /> - - - - - + + + + + + + + + + + { + +
+ + + +
diff --git a/src/views/biz/device/index.vue b/src/views/biz/device/index.vue index 1d4dda1..99bf58c 100644 --- a/src/views/biz/device/index.vue +++ b/src/views/biz/device/index.vue @@ -131,10 +131,10 @@
@@ -202,10 +202,10 @@ - + + + + + + + + + + @@ -256,7 +271,8 @@ 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 { issueRecordApi } from '@/api/issuerecord' + +import DeviceDispatchLogPage from "@/views/biz/device/DeviceDispatchLog.vue"; const message = useMessage() const dialog = useDialog() const router = useRouter() @@ -276,6 +292,7 @@ const title = ref('') //设备下发记录 const deviceIssueRecordList = ref<[]>([]) +const deviceDispatchLogDrawerVisible = ref(false) //操作日志抽屉 const deviceOperationLogDrawerVisible = ref(false) @@ -318,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({...defaultFormData}) @@ -481,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 @@ -647,23 +673,29 @@ 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 issueRecordApi.getDeviceDispatchLogList(deviceId) + deviceId.value = row.id + deviceDispatchLogDrawerVisible.value = true + title.value = row.deviceName+"设备下发记录" } async function deviceOperationLog(row: Device) { @@ -676,6 +708,7 @@ async function deviceOperationLog(row: Device) { function doShowInner() { deviceAbnormalRecordDrawerVisible.value = false deviceOperationLogDrawerVisible.value = false + deviceDispatchLogDrawerVisible.value = false } onMounted(() => {