diff --git a/src/api/storeManage/deviceManage/device.js b/src/api/storeManage/deviceManage/device.js index 251ad51..27f17d3 100644 --- a/src/api/storeManage/deviceManage/device.js +++ b/src/api/storeManage/deviceManage/device.js @@ -1,147 +1,156 @@ -import request from '@/utils/request' - -export function getSupplier() { - return request({ - url: 'api/supplier/dropdown-list', - method: 'get' - }) -} - -export function add(data) { - const url = getUrl(data, 'add') - return request({ - url: url, - method: 'post', - data - }) -} - -export function del(data) { - return request({ - url: '/api/device/delete', - method: 'delete', - data - }) -} - -export function edit(data) { - const url = getUrl(data, 'edit') - return request({ - url: url, - method: 'put', - data - }) -} - -export function getDeviceType() { - return request({ - url: 'api/device/type', - method: 'get' - }) -} - -export function getDeviceById(params) { - return request({ - url: 'api/device/state', - method: 'get', - params - }) -} -export function getDesecabinetById(params) { - return request({ - url: 'api/desecabinet/query', - method: 'get', - params - }) -} - -export function getRotarycabinetById(params) { - return request({ - url: 'api/rotarycabinet/query', - method: 'get', - params - }) -} - -function getUrl(data, optTYpe) { - let url = 'api/desecabinet/' - if (data.deviceTypeId.name === '密集架') { - url = 'api/desecabinet/' - } else if (data.deviceTypeId.name === '回转柜') { - url = 'api/rotarycabinet/' - } else if (data.deviceTypeId.name === '摄像头') { - url = 'api/camera/' - } else if (data.deviceTypeId.name === '空调' || data.deviceTypeId.name === '桌面式RFID读写器' || data.deviceTypeId.name === '盘点机' || data.deviceTypeId.name === '恒湿机' || data.deviceTypeId.name === '漏水传感器' || data.deviceTypeId.name === '温湿度感应器' || data.deviceTypeId.name === '空气质量检测设备' || data.deviceTypeId.name === '漏水传感器') { - url = 'api/insidedevices/' - } else if (data.deviceTypeId.name === '通道门' || data.deviceTypeId.name === '手持式RFID读写器') { - url = 'api/outsidedevices/' - } - if (optTYpe === 'add') { - url += 'create' - } else if (optTYpe === 'edit') { - url += 'update' - } - return url -} -export function getDeviceList(params) { - return request({ - url: 'api/device/list', - method: 'get', - params - }) -} - -// 根据区列获取在库已借数 -export function FetchInBorrowByQuCol(params) { - return request({ - url: 'api/tag/getInBorrowByQuCol', - method: 'get', - params - }) -} - -export function unbind(data) { - return request({ - url: 'api/displayconfig/unbind', - method: 'post', - data - }) -} - -// 打开架体具体某一列 -export function FetchCallExternalOpenCol(params) { - return request({ - url: 'api/callExternal/openCol', - method: 'get', - params - }) -} - -// 密集架合架 -export function FetchCallExternalResetCol(params) { - return request({ - url: 'api/callExternal/reset', - method: 'get', - params - }) -} - -// 密集架通风 -export function FetchCallExternalVent(params) { - return request({ - url: 'api/callExternal/vent', - method: 'get', - params - }) -} - -// 停止移动 -export function FetchCallExternalStopMove(params) { - return request({ - url: 'api/callExternal/stopMove', - method: 'get', - params - }) -} - -export default { add, edit, del, getSupplier, getDeviceType, getDeviceById, getDesecabinetById, getRotarycabinetById, getDeviceList, FetchInBorrowByQuCol, unbind, FetchCallExternalOpenCol, FetchCallExternalResetCol, FetchCallExternalVent, FetchCallExternalStopMove } +import request from '@/utils/request' +import qs from 'qs' + +export function getSupplier() { + return request({ + url: 'api/supplier/dropdown-list', + method: 'get' + }) +} + +export function add(data) { + const url = getUrl(data, 'add') + return request({ + url: url, + method: 'post', + data + }) +} + +export function del(data) { + return request({ + url: '/api/device/delete', + method: 'delete', + data + }) +} + +export function edit(data) { + const url = getUrl(data, 'edit') + return request({ + url: url, + method: 'put', + data + }) +} + +export function getDeviceType() { + return request({ + url: 'api/device/type', + method: 'get' + }) +} + +export function getDeviceById(params) { + return request({ + url: 'api/device/state', + method: 'get', + params + }) +} +export function getDesecabinetById(params) { + return request({ + url: 'api/desecabinet/query', + method: 'get', + params + }) +} + +export function getRotarycabinetById(params) { + return request({ + url: 'api/rotarycabinet/query', + method: 'get', + params + }) +} + +function getUrl(data, optTYpe) { + let url = 'api/desecabinet/' + if (data.deviceTypeId.name === '密集架') { + url = 'api/desecabinet/' + } else if (data.deviceTypeId.name === '回转柜') { + url = 'api/rotarycabinet/' + } else if (data.deviceTypeId.name === '摄像头') { + url = 'api/camera/' + } else if (data.deviceTypeId.name === '空调' || data.deviceTypeId.name === '桌面式RFID读写器' || data.deviceTypeId.name === '盘点机' || data.deviceTypeId.name === '恒湿机' || data.deviceTypeId.name === '漏水传感器' || data.deviceTypeId.name === '温湿度感应器' || data.deviceTypeId.name === '空气质量检测设备' || data.deviceTypeId.name === '漏水传感器') { + url = 'api/insidedevices/' + } else if (data.deviceTypeId.name === '通道门' || data.deviceTypeId.name === '手持式RFID读写器') { + url = 'api/outsidedevices/' + } + if (optTYpe === 'add') { + url += 'create' + } else if (optTYpe === 'edit') { + url += 'update' + } + return url +} +export function getDeviceList(params) { + return request({ + url: 'api/device/list', + method: 'get', + params + }) +} + +// 根据设备id查看设备是否在线 +export function FetchIsOnline(params) { + return request({ + url: 'api/device/isOnline' + '?' + qs.stringify(params, { indices: false }), + method: 'get' + }) +} + +// 根据区列获取在库已借数 +export function FetchInBorrowByQuCol(params) { + return request({ + url: 'api/tag/getInBorrowByQuCol', + method: 'get', + params + }) +} + +export function unbind(data) { + return request({ + url: 'api/displayconfig/unbind', + method: 'post', + data + }) +} + +// 打开架体具体某一列 +export function FetchCallExternalOpenCol(params) { + return request({ + url: 'api/callExternal/openCol', + method: 'get', + params + }) +} + +// 密集架合架 +export function FetchCallExternalResetCol(params) { + return request({ + url: 'api/callExternal/reset', + method: 'get', + params + }) +} + +// 密集架通风 +export function FetchCallExternalVent(params) { + return request({ + url: 'api/callExternal/vent', + method: 'get', + params + }) +} + +// 停止移动 +export function FetchCallExternalStopMove(params) { + return request({ + url: 'api/callExternal/stopMove', + method: 'get', + params + }) +} + +export default { add, edit, del, getSupplier, getDeviceType, getDeviceById, getDesecabinetById, getRotarycabinetById, getDeviceList, FetchIsOnline, FetchInBorrowByQuCol, unbind, FetchCallExternalOpenCol, FetchCallExternalResetCol, FetchCallExternalVent, FetchCallExternalStopMove } diff --git a/src/api/storeManage/displayConfig/index.js b/src/api/storeManage/displayConfig/index.js index 6ea08ff..276cbe6 100644 --- a/src/api/storeManage/displayConfig/index.js +++ b/src/api/storeManage/displayConfig/index.js @@ -1,19 +1,19 @@ -import request from '@/utils/request' - -export function list(params) { - return request({ - url: 'api/displayconfig/list', - method: 'get', - params - }) -} - -export function bind(data) { - return request({ - url: 'api/displayconfig/bind', - method: 'post', - data - }) -} - -export default { list, bind } +import request from '@/utils/request' +import qs from 'qs' + +export function list(params) { + return request({ + url: 'api/displayconfig/list' + '?' + qs.stringify(params, { indices: false }), + method: 'get' + }) +} + +export function bind(data) { + return request({ + url: 'api/displayconfig/bind', + method: 'post', + data + }) +} + +export default { list, bind } diff --git a/src/views/dashboard/PanelGroup.vue b/src/views/dashboard/PanelGroup.vue index 6faf234..dacee2f 100644 --- a/src/views/dashboard/PanelGroup.vue +++ b/src/views/dashboard/PanelGroup.vue @@ -122,6 +122,8 @@ export default { totalDeviceNum: 0, onlineDeviceNum: 0, offlineDeviceNum: 0, + onlineDevice: [], + offDevice: [], deviveTitle: '在线设备', deviceVisible: false, tableLoading: false, @@ -136,7 +138,8 @@ export default { mounted() { this.handleArchivesNum() this.handleCaseNum() - this.handleTotalDeviceNum() + this.getDevice() + // this.handleTotalDeviceNum() }, methods: { handleSetLineChartData(type) { @@ -176,23 +179,27 @@ export default { } } }, - getDeviceDetail(type) { - this.tableLoading = true - this.deviceVisible = true + getDevice() { getDeviceOnoff().then(data => { - if (type === 'on') { - this.deviveTitle = '在线设备' - this.tableDeviceData = this.data.online - } else { - this.deviveTitle = '离线设备' - this.tableDeviceData = this.data.offline - } - - setTimeout(() => { - this.tableLoading = false - }, 1000) + this.getDeviceFlag = true + this.totalDeviceNum = data.deviceall.length + this.onlineDeviceNum = data.online.length + this.offlineDeviceNum = data.offline.length + this.onlineDevice = data.online + this.offDevice = data.offline }) }, + getDeviceDetail(type) { + this.deviceVisible = true + this.tableDeviceData = [] + if (type === 'on') { + this.deviveTitle = '在线设备' + this.tableDeviceData = this.onlineDevice + } else { + this.deviveTitle = '离线设备' + this.tableDeviceData = this.offDevice + } + }, // 档案总数 handleArchivesNum() { FetchGetArchivesNum().then(data => { diff --git a/src/views/environmentalScreen/index.vue b/src/views/environmentalScreen/index.vue index 24e4a9c..4702f0f 100644 --- a/src/views/environmentalScreen/index.vue +++ b/src/views/environmentalScreen/index.vue @@ -154,33 +154,33 @@ -
  • +
  • - {{ topDisplayData.ZLS_MO_OAO_001.curValue }} -

    温度 {{ topDisplayData.ZLS_MO_OAO_001.unit }}

    + {{ topOAODisplayData.ZLS_MO_OAO_001.wendu }} +

    温度

  • -
  • +
  • - {{ topDisplayData.ZLS_MO_OAO_001.curValue }} -

    湿度 {{ topDisplayData.ZLS_MO_OAO_001.unit }}

    + {{ topOAODisplayData.ZLS_MO_OAO_001.sidu }} +

    湿度

  • -
  • +
  • - {{ topDisplayData.YLS_MO_OAO_001.curValue }} -

    温度 {{ topDisplayData.YLS_MO_OAO_001.unit }}

    + {{ topOAODisplayData.YLS_MO_OAO_001.wendu }} +

    温度

  • -
  • +
  • - {{ topDisplayData.YLS_MO_OAO_001.curValue }} -

    湿度 {{ topDisplayData.YLS_MO_OAO_001.unit }}

    + {{ topOAODisplayData.YLS_MO_OAO_001.sidu }} +

    湿度

  • @@ -386,6 +386,20 @@ export default { url: '', allDeviceIds: [], oaoMessage: [], + topOAODisplayData: { + ZLS_MO_OAO_001: { + show: false, + wendu: '', + sidu: '', + alarmState: 0 + }, + YLS_MO_OAO_001: { + show: false, + wendu: '', + sidu: '', + alarmState: 0 + } + }, topDisplayData: { DAK_DIV_TOP_001: { show: false, @@ -460,18 +474,6 @@ export default { unit: '', curstatus: 0 }, - ZLS_MO_OAO_001: { - show: false, - curValue: '', - unit: '', - curstatus: 0 - }, - YLS_MO_OAO_001: { - show: false, - curValue: '', - unit: '', - curstatus: 0 - }, // 7F 待销文件室 XXW_DIV_TOP_001: { show: false, @@ -601,10 +603,12 @@ export default { this.roomId = 'D6490DA3D4261E8C26D0E3' } else if (index === 2) { this.bannerRoomName = '5F 整理室' - this.roomId = 'D6490DA3D4261E8C26D0E3' + this.roomId = 'D5C48B49DF66183CF24974' + await this.changeRoomGetDeivce() } else if (index === 3) { this.bannerRoomName = '5F 阅览室' - this.roomId = 'D6490DA3D4261E8C26D0E3' + this.roomId = '9E0A527462BB8A060EB165' + await this.changeRoomGetDeivce() } else if (index === 4) { this.bannerRoomName = '7F 全景图' this.roomId = '1B2DADD8499058954C0CAC' @@ -755,6 +759,12 @@ export default { sidu: (sidu?.curvalue) ? (Math.round(sidu?.curvalue)) : '-', alarmState: (wendu && wendu.curstatus > 0) || (sidu && sidu.curstatus > 0) }) + this.$set(this.topOAODisplayData, element.divPosition, { + show: true, + wendu: (wendu?.curvalue) ? (Math.round(wendu?.curvalue)) : '-', + sidu: (sidu?.curvalue) ? (Math.round(sidu?.curvalue)) : '-', + alarmState: (wendu && wendu.curstatus > 0) || (sidu && sidu.curstatus > 0) + }) } else { // LS 漏水感应器 const waterLeakageParamId1 = element.deviceSpecParams.find((item) => { return item.paramName === '维护报警' })?.paramId diff --git a/src/views/home.vue b/src/views/home.vue index d1aeb81..beec7eb 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -8,9 +8,15 @@ --> -
    + +
    +

    +

    + 档案检索 +

    +

    @@ -63,26 +69,26 @@

    整理室

      -
    • +
    • 温度

      - {{ topDisplayData.ZLS_MO_OAO_001.curValue }} + {{ oaoMessage.ZLS_MO_OAO_001.wendu }}
    • -
    • +
    • 湿度

      - {{ topDisplayData.ZLS_MO_OAO_001.curValue }} + {{ oaoMessage.ZLS_MO_OAO_001.sidu }}

    阅览室

      -
    • +
    • 温度

      - {{ topDisplayData.YLS_MO_OAO_001.curValue }} + {{ oaoMessage.YLS_MO_OAO_001.wendu }}
    • -
    • +
    • 湿度

      - {{ topDisplayData.YLS_MO_OAO_001.curValue }} + {{ oaoMessage.YLS_MO_OAO_001.sidu }}
    @@ -131,17 +137,17 @@

    湿度

    {{ topDisplayData.DXW_DIV_TOP_002.curValue }} -
  • +
  • CO2

    - {{ topDisplayData.XXW_DIV_TOP_003.curValue }} + {{ topDisplayData.DXW_DIV_TOP_003.curValue }}
  • -
  • +
  • PM2.5

    - {{ topDisplayData.XXW_DIV_TOP_005.curValue }} + {{ topDisplayData.DXW_DIV_TOP_005.curValue }}
  • -
  • +
  • PM10

    - {{ topDisplayData.XXW_DIV_TOP_006.curValue }} + {{ topDisplayData.DXW_DIV_TOP_006.curValue }}
  • VOC

    @@ -330,11 +336,25 @@ export default { floorIndex: 0, floorEnvIndex: 0, isHomeSearch: false, + roomId: null, allDisplayConfigData: [], displayConfigData: [], url: '', allDeviceIds: [], - oaoMessage: [], + oaoMessage: { + ZLS_MO_OAO_001: { + show: false, + wendu: '', + sidu: '', + alarmState: 0 + }, + YLS_MO_OAO_001: { + show: false, + wendu: '', + sidu: '', + alarmState: 0 + } + }, topDisplayData: { DAK_DIV_TOP_001: { show: false, @@ -372,18 +392,6 @@ export default { unit: '', curstatus: 0 }, - ZLS_MO_OAO_001: { - show: false, - curValue: '', - unit: '', - curstatus: 0 - }, - YLS_MO_OAO_001: { - show: false, - curValue: '', - unit: '', - curstatus: 0 - }, // 7F 待销文件室 DXW_DIV_TOP_001: { show: false, @@ -468,7 +476,12 @@ export default { }, async created() { this.getWaitBorrower() - this.allDisplayConfigData = await displayConfigApi.list({ storeroomId: this.roomId }) + this.roomId = null + const params = { + storeroomId: null, + isQueryAll: 1 + } + this.allDisplayConfigData = await displayConfigApi.list(params) this.allDisplayConfigData.forEach(element => { if (element.isDisplay && element.bindState && element.deviceInfo && (element.divPosition.includes('OAO') || element.divPosition.includes('TOP') || element.divPosition.includes('LS'))) { this.allDeviceIds.push(element.deviceInfo.deviceId) @@ -556,8 +569,10 @@ export default { }, getRealTimeData() { if (this.allDeviceIds.length > 0) { + console.log('this.allDeviceIds', this.allDeviceIds) + console.log('this.displayConfigData', this.displayConfigData) thirdApi.getRealTimeData({ ids: this.allDeviceIds, url: this.url }).then((data) => { - this.oaoMessage.splice(0, this.oaoMessage.length) + // this.oaoMessage.splice(0, this.oaoMessage.length) this.displayConfigData.forEach(element => { if (element.divPosition.includes('TOP') && element.deviceSpecParams[0]) { // 获取页面div显示的数据 @@ -576,6 +591,27 @@ export default { show: false }) } + } else if (element.divPosition.includes('OAO')) { + const wenduParamId = element.deviceSpecParams.find((item) => { return item.paramName === '温度' })?.paramId + const siduParamId = element.deviceSpecParams.find((item) => { return item.paramName === '湿度' })?.paramId + let wendu = {} + let sidu = {} + if (wenduParamId) { + wendu = data.find((item) => { + return item.property_id === wenduParamId && item.device_id === element.deviceInfo.deviceId + }) + } + if (siduParamId) { + sidu = data.find((item) => { + return item.property_id === siduParamId && item.device_id === element.deviceInfo.deviceId + }) + } + this.$set(this.oaoMessage, element.divPosition, { + show: true, + wendu: (wendu?.curvalue) ? (Math.round(wendu?.curvalue)) : '-', + sidu: (sidu?.curvalue) ? (Math.round(sidu?.curvalue)) : '-', + alarmState: (wendu && wendu.curstatus > 0) || (sidu && sidu.curstatus > 0) + }) } }) }) diff --git a/src/views/storeManage/deviceManage/module/deviceDetail.vue b/src/views/storeManage/deviceManage/module/deviceDetail.vue index 3c48979..511fb58 100644 --- a/src/views/storeManage/deviceManage/module/deviceDetail.vue +++ b/src/views/storeManage/deviceManage/module/deviceDetail.vue @@ -164,7 +164,8 @@ @@ -434,11 +435,60 @@ export default { }, // 防止编辑时,isLinkage是null,isLinkage.lend报错 [CRUD.HOOK.afterRefresh](crud) { + console.log('crud.data', crud.data) + let selectedElementId = null crud.data.forEach(element => { element.isLinkage = { stateType: 1, lend: null, borrow: null, inBound: null, outBound: null } element.isCallback = { stateType: 2, lend: null, borrow: null, inBound: null, outBound: null } + element.deviceState = null + + // 常在线: + // 1.摄像头 7305DE3D273B0CAC079538 + // 2.通道门 65D1886B0F864291766421 + // 常离线: + // 1.手持式RFID读写器 3B85FA21FDAFBB618B5D40 + // deviceTypeId.id 接口请求拿状态 + // 1.密集架 DD656054BE3D1DF1E2F1FC + // 2.桌面式RFID读写器 E2767FEACA9CE0E3B16B89 + // 3.环控相关(空气质量检测设备E58C8D7C896BCB9A408A78、温湿度感应设备 7882487E0C15304A3758AF、漏水传感器 250AE644EC43E4EC954A81) + if (element.deviceTypeId.id === '7305DE3D273B0CAC079538' || element.deviceTypeId.id === '65D1886B0F864291766421') { + // 摄像头 + 通道门 + element.deviceState = 1 + } else if (element.deviceTypeId.id === '3B85FA21FDAFBB618B5D40') { + // 手持式RFID读写器 + element.deviceState = 0 + } else if (element.deviceTypeId.id === 'DD656054BE3D1DF1E2F1FC') { + // 密集架 + this.getDeviceState(element) + } else if (element.deviceTypeId.id === 'E2767FEACA9CE0E3B16B89') { + // 桌面式RFID读写器 + this.getDeviceState(element) + } else if (element.deviceTypeId.id === 'E58C8D7C896BCB9A408A78' || element.deviceTypeId.id === '7882487E0C15304A3758AF' || element.deviceTypeId.id === '250AE644EC43E4EC954A81') { + selectedElementId = element.id + } + }) + if (selectedElementId) { + crudDevice.FetchIsOnline({ deviceId: selectedElementId }) + .then((data) => { + crud.data.forEach(element => { + if (element.deviceTypeId.id === 'E58C8D7C896BCB9A408A78' || element.deviceTypeId.id === '7882487E0C15304A3758AF' || element.deviceTypeId.id === '250AE644EC43E4EC954A81') { + element.deviceState = data === true ? 1 : 0 + } + }) + }) + .catch((error) => { + console.error(error) + }) + } + }, + getDeviceState(element) { + crudDevice.FetchIsOnline({ deviceId: element.id }).then((data) => { + element.deviceState = data === true ? 1 : 0 + }).catch((error) => { + console.error(error) }) }, + // 提交前的验证 [CRUD.HOOK.afterValidateCU](crud) { if (crud.status.edit === 1) { diff --git a/src/views/storeManage/levelManage/index.vue b/src/views/storeManage/levelManage/index.vue index a755ce4..575c51b 100644 --- a/src/views/storeManage/levelManage/index.vue +++ b/src/views/storeManage/levelManage/index.vue @@ -8,24 +8,7 @@

    - - - - - + 绑定标签
    @@ -97,7 +80,7 @@ export default { del: false, download: true }, - sort: ['areaNo,asc', 'columnRowNo,asc', 'direction,desc', 'partNo,asc', 'rowNo,asc'] + sort: ['area_no,asc', 'column_row_no,asc', 'direction,desc', 'part_no,asc', 'row_no,asc'] }) ] }, @@ -105,12 +88,7 @@ export default { return { deviceInfo: {}, storeroomName: '', - keyWord: '', - optionVal: 'positionName', - options: [ - { value: 'positionName', label: '层位名称' }, - { value: 'position', label: '层位编号' } - ] + query: null } }, created() { @@ -118,13 +96,7 @@ export default { methods: { [CRUD.HOOK.beforeRefresh]() { this.crud.query.deviceInfoId = this.deviceInfo.id - this.crud.query.positionName = null - this.crud.query.position = null - if (this.optionVal === 'position') { - this.crud.query.position = this.keyWord - } else if (this.optionVal === 'positionName') { - this.crud.query.positionName = this.keyWord - } + this.crud.query.query = this.query }, handleNodeClick(data) { this.deviceInfo = data