瀏覽代碼

页面调整

lipenghui 3 月之前
父節點
當前提交
72d329af9b

+ 12 - 0
src/router/modules/remaining.ts

@@ -159,6 +159,18 @@ const remainingRouter: AppRouteRecordRaw[] = [
           title: '设备台账详情',
           title: '设备台账详情',
           activeMenu: '/device/info'
           activeMenu: '/device/info'
         }
         }
+      },{
+        path: 'tddevice/detail/:id',
+        component: () => import('@/views/pms/device/monitor/TdDeviceInfo.vue'),
+        name: 'TdDeviceDetail',
+        meta: {
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:info',
+          title: '设备台账详情',
+          activeMenu: '/device/info'
+        }
       },{
       },{
         path: 'device/upload/:id',
         path: 'device/upload/:id',
         component: () => import('@/views/pms/device/DeviceUpload.vue'),
         component: () => import('@/views/pms/device/DeviceUpload.vue'),

+ 1 - 0
src/utils/dict.ts

@@ -107,6 +107,7 @@ export const getDictLabel = (dictType: string, value: any): string => {
 }
 }
 
 
 export enum DICT_TYPE {
 export enum DICT_TYPE {
+  IOT_DEVICE_STATUS = 'iot_device_status', // IOT 设备状态
   PMS_INSPECT_ORDER_STATUS = "pms_inspect_order_status",
   PMS_INSPECT_ORDER_STATUS = "pms_inspect_order_status",
   PMS_INSPECT_UNIT = "pms_inspect_unit",
   PMS_INSPECT_UNIT = "pms_inspect_unit",
   PMS_MAIN_STATUS_NO = 'pms_maintain_status_no',
   PMS_MAIN_STATUS_NO = 'pms_maintain_status_no',

+ 13 - 3
src/views/pms/device/index.vue

@@ -2,11 +2,12 @@
   <el-row :gutter="20">
   <el-row :gutter="20">
     <!-- 左侧部门树 -->
     <!-- 左侧部门树 -->
     <el-col :span="4" :xs="24">
     <el-col :span="4" :xs="24">
-      <ContentWrap class="h-1/1">
+<!--      <div><Icon icon="ep:edit" @click="shou(treeShow)"/> </div>-->
+      <ContentWrap class="h-1/1" v-if="treeShow">
         <DeptTree @node-click="handleDeptNodeClick" />
         <DeptTree @node-click="handleDeptNodeClick" />
       </ContentWrap>
       </ContentWrap>
     </el-col>
     </el-col>
-    <el-col :span="20" :xs="24">
+    <el-col :span="contentSpan" :xs="24">
       <ContentWrap>
       <ContentWrap>
         <!-- 搜索工作栏 -->
         <!-- 搜索工作栏 -->
         <el-form
         <el-form
@@ -245,7 +246,16 @@ const queryParams = reactive({
 })
 })
 const queryFormRef = ref() // 搜索的表单
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中
 const exportLoading = ref(false) // 导出的加载中
-
+const contentSpan = ref(20)
+const treeShow = ref(true)
+const shou = (tree) =>{
+  treeShow.value = !tree
+  if (tree) {
+    contentSpan.value = 20
+  } else {
+    contentSpan.value = 24
+  }
+}
 /** 查询列表 */
 /** 查询列表 */
 const getList = async () => {
 const getList = async () => {
   loading.value = true
   loading.value = true

+ 14 - 0
src/views/pms/device/monitor/TdDeviceInfo.vue

@@ -0,0 +1,14 @@
+<template>
+  <ContentWrap>
+    <div>
+      资产编号:
+    </div>
+  </ContentWrap>
+</template>
+
+<script setup lang="ts">
+
+</script>
+<style scoped lang="scss">
+
+</style>

+ 57 - 230
src/views/pms/device/monitor/index.vue

@@ -16,84 +16,24 @@
         :inline="true"
         :inline="true"
         label-width="68px"
         label-width="68px"
       >
       >
-        <el-form-item label="产品" prop="productId">
-          <el-select
-            v-model="queryParams.productId"
-            placeholder="请选择产品"
-            clearable
-            class="!w-240px"
-          >
-            <el-option
-              v-for="product in products"
-              :key="product.id"
-              :label="product.name"
-              :value="product.id"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="DeviceName" prop="deviceName">
+        <el-form-item label="设备名称" prop="deviceName">
           <el-input
           <el-input
             v-model="queryParams.deviceName"
             v-model="queryParams.deviceName"
-            placeholder="请输入 DeviceName"
+            placeholder="请输入设备名称"
             clearable
             clearable
             @keyup.enter="handleQuery"
             @keyup.enter="handleQuery"
             class="!w-240px"
             class="!w-240px"
           />
           />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="备注名称" prop="nickname">
+        <el-form-item label="设备编码" prop="deviceCode">
           <el-input
           <el-input
-            v-model="queryParams.nickname"
-            placeholder="请输入备注名称"
+            v-model="queryParams.deviceCode"
+            placeholder="请输入设备编码"
             clearable
             clearable
             @keyup.enter="handleQuery"
             @keyup.enter="handleQuery"
             class="!w-240px"
             class="!w-240px"
           />
           />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="设备类型" prop="deviceType">
-          <el-select
-            v-model="queryParams.deviceType"
-            placeholder="请选择设备类型"
-            clearable
-            class="!w-240px"
-          >
-            <el-option
-              v-for="dict in getIntDictOptions(DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE)"
-              :key="dict.value"
-              :label="dict.label"
-              :value="dict.value"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="设备状态" prop="status">
-          <el-select
-            v-model="queryParams.status"
-            placeholder="请选择设备状态"
-            clearable
-            class="!w-240px"
-          >
-            <el-option
-              v-for="dict in getIntDictOptions(DICT_TYPE.IOT_DEVICE_STATE)"
-              :key="dict.value"
-              :label="dict.label"
-              :value="dict.value"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="设备分组" prop="groupId">
-          <el-select
-            v-model="queryParams.groupId"
-            placeholder="请选择设备分组"
-            clearable
-            class="!w-240px"
-          >
-            <el-option
-              v-for="group in deviceGroups"
-              :key="group.id"
-              :label="group.name"
-              :value="group.id"
-            />
-          </el-select>
-        </el-form-item>
         <el-form-item class="float-right !mr-0 !mb-0">
         <el-form-item class="float-right !mr-0 !mb-0">
           <el-button-group>
           <el-button-group>
             <el-button :type="viewMode === 'card' ? 'primary' : 'default'" @click="viewMode = 'card'">
             <el-button :type="viewMode === 'card' ? 'primary' : 'default'" @click="viewMode = 'card'">
@@ -113,15 +53,6 @@
             <Icon icon="ep:refresh" class="mr-5px" />
             <Icon icon="ep:refresh" class="mr-5px" />
             重置
             重置
           </el-button>
           </el-button>
-          <el-button
-            type="primary"
-            plain
-            @click="openForm('create')"
-            v-hasPermi="['iot:device:create']"
-          >
-            <Icon icon="ep:plus" class="mr-5px" />
-            新增
-          </el-button>
           <el-button
           <el-button
             type="success"
             type="success"
             plain
             plain
@@ -131,27 +62,6 @@
           >
           >
             <Icon icon="ep:download" class="mr-5px" /> 导出
             <Icon icon="ep:download" class="mr-5px" /> 导出
           </el-button>
           </el-button>
-          <el-button type="warning" plain @click="handleImport" v-hasPermi="['iot:device:import']">
-            <Icon icon="ep:upload" /> 导入
-          </el-button>
-          <el-button
-            type="primary"
-            plain
-            @click="openGroupForm"
-            :disabled="selectedIds.length === 0"
-            v-hasPermi="['iot:device:update']"
-          >
-            <Icon icon="ep:folder-add" class="mr-5px" /> 添加到分组
-          </el-button>
-          <el-button
-            type="danger"
-            plain
-            @click="handleDeleteList"
-            :disabled="selectedIds.length === 0"
-            v-hasPermi="['iot:device:delete']"
-          >
-            <Icon icon="ep:delete" class="mr-5px" /> 批量删除
-          </el-button>
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>
     </ContentWrap>
     </ContentWrap>
@@ -169,7 +79,7 @@
               <div
               <div
                 class="absolute top-0 left-0 right-0 h-[50px] pointer-events-none"
                 class="absolute top-0 left-0 right-0 h-[50px] pointer-events-none"
                 :class="[
                 :class="[
-                  item.state === DeviceStateEnum.ONLINE
+                  item.ifInline
                     ? 'bg-gradient-to-b from-[#eefaff] to-transparent'
                     ? 'bg-gradient-to-b from-[#eefaff] to-transparent'
                     : 'bg-gradient-to-b from-[#fff1f1] to-transparent'
                     : 'bg-gradient-to-b from-[#fff1f1] to-transparent'
                 ]"
                 ]"
@@ -187,7 +97,7 @@
                     <div
                     <div
                       class="w-1 h-1 rounded-full mr-1.5"
                       class="w-1 h-1 rounded-full mr-1.5"
                       :class="
                       :class="
-                        item.state === DeviceStateEnum.ONLINE
+                        item.ifInline
                           ? 'bg-[var(--el-color-success)]'
                           ? 'bg-[var(--el-color-success)]'
                           : 'bg-[var(--el-color-danger)]'
                           : 'bg-[var(--el-color-danger)]'
                       "
                       "
@@ -195,9 +105,9 @@
                     </div>
                     </div>
                     <el-text
                     <el-text
                       class="!text-xs font-bold"
                       class="!text-xs font-bold"
-                      :type="item.state === DeviceStateEnum.ONLINE ? 'success' : 'danger'"
+                      :type="item.ifInline ? 'success' : 'danger'"
                     >
                     >
-                      {{ getDictLabel(DICT_TYPE.IOT_DEVICE_STATE, item.state) }}
+                      {{ getDictLabel(DICT_TYPE.IOT_DEVICE_STATUS, item.ifInline) }}
                     </el-text>
                     </el-text>
                   </div>
                   </div>
                 </div>
                 </div>
@@ -206,21 +116,21 @@
                 <div class="flex items-center text-[14px]">
                 <div class="flex items-center text-[14px]">
                   <div class="flex-1">
                   <div class="flex-1">
                     <div class="mb-2.5 last:mb-0">
                     <div class="mb-2.5 last:mb-0">
-                      <span class="text-[#717c8e] mr-2.5">所属产品</span>
+                      <span class="text-[#717c8e] mr-2.5">编号</span>
                       <span class="text-[#0070ff]">
                       <span class="text-[#0070ff]">
-                        {{ products.find((p) => p.id === item.productId)?.name }}
+                        {{ item.deviceCode }}
                       </span>
                       </span>
                     </div>
                     </div>
                     <div class="mb-2.5 last:mb-0">
                     <div class="mb-2.5 last:mb-0">
                       <span class="text-[#717c8e] mr-2.5">设备类型</span>
                       <span class="text-[#717c8e] mr-2.5">设备类型</span>
-                      <dict-tag :type="DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE" :value="item.deviceType" />
+                      <span class="text-[#0070ff]">
+                        {{ item.assetClassName }}
+                      </span>
                     </div>
                     </div>
                     <div class="mb-2.5 last:mb-0">
                     <div class="mb-2.5 last:mb-0">
-                      <span class="text-[#717c8e] mr-2.5">DeviceKey</span>
-                      <span
-                        class="text-[#0b1d30] inline-block align-middle overflow-hidden text-ellipsis whitespace-nowrap max-w-[130px]"
-                      >
-                        {{ item.deviceKey }}
+                      <span class="text-[#717c8e] mr-2.5">最新数据时间</span>
+                      <span class="text-[#0070ff]">
+                        {{ item.lastInlineTime }}
                       </span>
                       </span>
                     </div>
                     </div>
                   </div>
                   </div>
@@ -234,16 +144,6 @@
 
 
                 <!-- 按钮 -->
                 <!-- 按钮 -->
                 <div class="flex items-center px-0">
                 <div class="flex items-center px-0">
-                  <el-button
-                    class="flex-1 !px-2 !h-[32px] text-[13px]"
-                    type="primary"
-                    plain
-                    @click="openForm('update', item.id)"
-                    v-hasPermi="['iot:device:update']"
-                  >
-                    <Icon icon="ep:edit-pen" class="mr-1" />
-                    编辑
-                  </el-button>
                   <el-button
                   <el-button
                     class="flex-1 !px-2 !h-[32px] !ml-[10px] text-[13px]"
                     class="flex-1 !px-2 !h-[32px] !ml-[10px] text-[13px]"
                     type="warning"
                     type="warning"
@@ -253,25 +153,7 @@
                     <Icon icon="ep:view" class="mr-1" />
                     <Icon icon="ep:view" class="mr-1" />
                     详情
                     详情
                   </el-button>
                   </el-button>
-                  <el-button
-                    class="flex-1 !px-2 !h-[32px] !ml-[10px] text-[13px]"
-                    type="info"
-                    plain
-                    @click="openModel(item.id)"
-                  >
-                    <Icon icon="ep:tickets" class="mr-1" />
-                    数据
-                  </el-button>
                   <div class="mx-[10px] h-[20px] w-[1px] bg-[#dcdfe6]"></div>
                   <div class="mx-[10px] h-[20px] w-[1px] bg-[#dcdfe6]"></div>
-                  <el-button
-                    class="!px-2 !h-[32px] text-[13px]"
-                    type="danger"
-                    plain
-                    @click="handleDelete(item.id)"
-                    v-hasPermi="['iot:device:delete']"
-                  >
-                    <Icon icon="ep:delete" />
-                  </el-button>
                 </div>
                 </div>
               </div>
               </div>
             </el-card>
             </el-card>
@@ -289,34 +171,22 @@
         @selection-change="handleSelectionChange"
         @selection-change="handleSelectionChange"
       >
       >
         <el-table-column type="selection" width="55" />
         <el-table-column type="selection" width="55" />
-        <el-table-column label="DeviceName" align="center" prop="deviceName">
+        <el-table-column label="设备名称" align="center" prop="deviceName">
           <template #default="scope">
           <template #default="scope">
             <el-link @click="openDetail(scope.row.id)">{{ scope.row.deviceName }}</el-link>
             <el-link @click="openDetail(scope.row.id)">{{ scope.row.deviceName }}</el-link>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-        <el-table-column label="备注名称" align="center" prop="nickname" />
-        <el-table-column label="所属产品" align="center" prop="productId">
-          <template #default="scope">
-            {{ products.find((p) => p.id === scope.row.productId)?.name || '-' }}
-          </template>
-        </el-table-column>
-        <el-table-column label="设备类型" align="center" prop="deviceType">
-          <template #default="scope">
-            <dict-tag :type="DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE" :value="scope.row.deviceType" />
-          </template>
-        </el-table-column>
-        <el-table-column label="所属分组" align="center" prop="groupId">
+        <el-table-column label="资产编码" align="center" prop="deviceCode" />
+
+        <el-table-column label="设备类别" align="center" prop="assetClassName" />
+        <el-table-column label="设备状态" align="center" prop="deviceStatus" >
           <template #default="scope">
           <template #default="scope">
-            <template v-if="scope.row.groupIds?.length">
-              <el-tag v-for="id in scope.row.groupIds" :key="id" class="ml-5px" size="small">
-                {{ deviceGroups.find((g) => g.id === id)?.name }}
-              </el-tag>
-            </template>
+            <dict-tag :type="DICT_TYPE.PMS_DEVICE_STATUS" :value="scope.row.deviceStatus" />
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-        <el-table-column label="设备状态" align="center" prop="status">
+        <el-table-column label="在线状态" align="center" prop="ifInline" >
           <template #default="scope">
           <template #default="scope">
-            <dict-tag :type="DICT_TYPE.IOT_DEVICE_STATE" :value="scope.row.status" />
+            <dict-tag :type="DICT_TYPE.IOT_DEVICE_STATUS" :value="scope.row.ifInline" />
           </template>
           </template>
         </el-table-column>
         </el-table-column>
         <el-table-column
         <el-table-column
@@ -336,23 +206,6 @@
             >
             >
               查看
               查看
             </el-button>
             </el-button>
-            <el-button link type="primary" @click="openModel(scope.row.id)"> 日志 </el-button>
-            <el-button
-              link
-              type="primary"
-              @click="openForm('update', scope.row.id)"
-              v-hasPermi="['iot:device:update']"
-            >
-              编辑
-            </el-button>
-            <el-button
-              link
-              type="danger"
-              @click="handleDelete(scope.row.id)"
-              v-hasPermi="['iot:device:delete']"
-            >
-              删除
-            </el-button>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
       </el-table>
       </el-table>
@@ -368,24 +221,20 @@
     </el-col>
     </el-col>
   </el-row>
   </el-row>
 
 
-  <!-- 表单弹窗:添加/修改 -->
-  <DeviceForm ref="formRef" @success="getList" />
-  <!-- 分组表单组件 -->
-  <DeviceGroupForm ref="groupFormRef" @success="getList" />
-  <!-- 导入表单组件 -->
-  <DeviceImportForm ref="importFormRef" @success="getList" />
+<!--  &lt;!&ndash; 表单弹窗:添加/修改 &ndash;&gt;-->
+<!--  <DeviceForm ref="formRef" @success="getList" />-->
+<!--  &lt;!&ndash; 分组表单组件 &ndash;&gt;-->
+<!--  <DeviceGroupForm ref="groupFormRef" @success="getList" />-->
+<!--  &lt;!&ndash; 导入表单组件 &ndash;&gt;-->
+<!--  <DeviceImportForm ref="importFormRef" @success="getList" />-->
 </template>
 </template>
 
 
 <script setup lang="ts">
 <script setup lang="ts">
-import { DICT_TYPE, getIntDictOptions, getDictLabel } from '@/utils/dict'
+import { DICT_TYPE, getDictLabel } from '@/utils/dict'
 import { dateFormatter } from '@/utils/formatTime'
 import { dateFormatter } from '@/utils/formatTime'
 import { DeviceApi, DeviceVO, DeviceStateEnum } from '@/api/iot/device/device'
 import { DeviceApi, DeviceVO, DeviceStateEnum } from '@/api/iot/device/device'
-import DeviceForm from './DeviceForm.vue'
-import { ProductApi, ProductVO } from '@/api/iot/product/product'
-import { DeviceGroupApi, DeviceGroupVO } from '@/api/iot/device/group'
 import download from '@/utils/download'
 import download from '@/utils/download'
-import DeviceGroupForm from './DeviceGroupForm.vue'
-import DeviceImportForm from './DeviceImportForm.vue'
+
 import DeptTree from "@/views/system/user/DeptTree.vue";
 import DeptTree from "@/views/system/user/DeptTree.vue";
 import {IotDeviceApi} from "@/api/pms/device";
 import {IotDeviceApi} from "@/api/pms/device";
 
 
@@ -444,6 +293,7 @@ const getList = async () => {
   loading.value = true
   loading.value = true
   try {
   try {
     const data = await IotDeviceApi.getIotDeviceTdPage(queryParams)
     const data = await IotDeviceApi.getIotDeviceTdPage(queryParams)
+    debugger
     list.value = data.list
     list.value = data.list
     total.value = data.total
     total.value = data.total
   } finally {
   } finally {
@@ -464,30 +314,18 @@ const resetQuery = () => {
   handleQuery()
   handleQuery()
 }
 }
 
 
-/** 添加/修改操作 */
-const formRef = ref()
-const openForm = (type: string, id?: number) => {
-  formRef.value.open(type, id)
-}
+// /** 添加/修改操作 */
+// const formRef = ref()
+// const openForm = (type: string, id?: number) => {
+//   formRef.value.open(type, id)
+// }
 
 
 /** 打开详情 */
 /** 打开详情 */
 const { push } = useRouter()
 const { push } = useRouter()
 const openDetail = (id: number) => {
 const openDetail = (id: number) => {
-  push({ name: 'IoTDeviceDetail', params: { id } })
+  push({ name: 'TdDeviceDetail', params: { id } })
 }
 }
 
 
-/** 删除按钮操作 */
-const handleDelete = async (id: number) => {
-  try {
-    // 删除的二次确认
-    await message.delConfirm()
-    // 起删除
-    await DeviceApi.deleteDevice(id)
-    message.success(t('common.delSuccess'))
-    // 刷新列表
-    await getList()
-  } catch {}
-}
 
 
 /** 导出方法 */
 /** 导出方法 */
 const handleExport = async () => {
 const handleExport = async () => {
@@ -509,34 +347,23 @@ const handleSelectionChange = (selection: DeviceVO[]) => {
   selectedIds.value = selection.map((item) => item.id)
   selectedIds.value = selection.map((item) => item.id)
 }
 }
 
 
-/** 批量删除按钮操作 */
-const handleDeleteList = async () => {
-  try {
-    await message.delConfirm()
-    // 执行批量删除
-    await DeviceApi.deleteDeviceList(selectedIds.value)
-    message.success(t('common.delSuccess'))
-    // 刷新列表
-    await getList()
-  } catch {}
-}
-
-/** 添加到分组操作 */
-const groupFormRef = ref()
-const openGroupForm = () => {
-  groupFormRef.value.open(selectedIds.value)
-}
-
-/** 打开物模型数据 */
-const openModel = (id: number) => {
-  push({ name: 'IoTDeviceDetail', params: { id }, query: { tab: 'model' } })
-}
-
-/** 设备导入 */
-const importFormRef = ref()
-const handleImport = () => {
-  importFormRef.value.open()
-}
+//
+// /** 添加到分组操作 */
+// const groupFormRef = ref()
+// const openGroupForm = () => {
+//   groupFormRef.value.open(selectedIds.value)
+// }
+//
+// /** 打开物模型数据 */
+// const openModel = (id: number) => {
+//   push({ name: 'IoTDeviceDetail', params: { id }, query: { tab: 'model' } })
+// }
+//
+// /** 设备导入 */
+// const importFormRef = ref()
+// const handleImport = () => {
+//   importFormRef.value.open()
+// }
 
 
 /** 初始化 **/
 /** 初始化 **/
 onMounted(async () => {
 onMounted(async () => {

+ 2 - 2
src/views/system/user/DeptTree.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
-  <div class="head-container">
-    <el-input v-model="deptName" class="mb-20px" clearable placeholder="请输入部门名称">
+  <div class="head-container" style="display: flex;flex-direction: row;">
+    <el-input v-model="deptName" class="mb-18px" clearable placeholder="请输入部门名称">
       <template #prefix>
       <template #prefix>
         <Icon icon="ep:search" />
         <Icon icon="ep:search" />
       </template>
       </template>