|
@@ -1,342 +1,114 @@
|
|
|
-<template>
|
|
|
|
|
- <el-row :gutter="20">
|
|
|
|
|
- <!-- 左侧部门树 -->
|
|
|
|
|
- <DeptTree @node-click="handleDeptNodeClick" v-model:collapsed="isLeftContentCollapsed" />
|
|
|
|
|
- <el-col :xs="24" :span="isLeftContentCollapsed ? 24 : 20">
|
|
|
|
|
- <ContentWrap>
|
|
|
|
|
- <!-- 搜索工作栏 -->
|
|
|
|
|
- <el-form
|
|
|
|
|
- class="-mb-15px"
|
|
|
|
|
- :model="queryParams"
|
|
|
|
|
- ref="queryFormRef"
|
|
|
|
|
- :inline="true"
|
|
|
|
|
- label-width="68px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-form-item
|
|
|
|
|
- :label="t('devicePerson.deviceCode')"
|
|
|
|
|
- prop="deviceCode"
|
|
|
|
|
- style="margin-left: 25px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="queryParams.deviceCode"
|
|
|
|
|
- :placeholder="t('devicePerson.codeHolder')"
|
|
|
|
|
- clearable
|
|
|
|
|
- @keyup.enter="handleQuery"
|
|
|
|
|
- class="!w-200px"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item :label="t('devicePerson.deviceName')" prop="deviceName">
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="queryParams.deviceName"
|
|
|
|
|
- :placeholder="t('devicePerson.nameHolder')"
|
|
|
|
|
- clearable
|
|
|
|
|
- @keyup.enter="handleQuery"
|
|
|
|
|
- class="!w-200px"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item :label="t('deviceStatus.statusAdjust')" prop="setFlag" label-width="90px">
|
|
|
|
|
- <el-select
|
|
|
|
|
- v-model="queryParams.setFlag"
|
|
|
|
|
- :label="t('deviceStatus.statusAdjust')"
|
|
|
|
|
- clearable
|
|
|
|
|
- class="!w-240px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="dict in resultOptions"
|
|
|
|
|
- :key="dict.value"
|
|
|
|
|
- :label="dict.label"
|
|
|
|
|
- :value="dict.value"
|
|
|
|
|
- />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item
|
|
|
|
|
- v-show="ifShow"
|
|
|
|
|
- :label="t('devicePerson.status')"
|
|
|
|
|
- label-width="85px"
|
|
|
|
|
- prop="deviceStatus"
|
|
|
|
|
- >
|
|
|
|
|
- <el-select
|
|
|
|
|
- v-model="queryParams.deviceStatus"
|
|
|
|
|
- :label="t('devicePerson.status')"
|
|
|
|
|
- clearable
|
|
|
|
|
- class="!w-240px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_DEVICE_STATUS)"
|
|
|
|
|
- :key="dict.value"
|
|
|
|
|
- :label="dict.label"
|
|
|
|
|
- :value="dict.value"
|
|
|
|
|
- />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
-
|
|
|
|
|
- <el-form-item v-show="ifShow" :label="t('devicePerson.assets')" prop="assetProperty">
|
|
|
|
|
- <el-select
|
|
|
|
|
- v-model="queryParams.assetProperty"
|
|
|
|
|
- :placeholder="t('devicePerson.assetsHolder')"
|
|
|
|
|
- clearable
|
|
|
|
|
- class="!w-240px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_ASSET_PROPERTY)"
|
|
|
|
|
- :key="dict.value"
|
|
|
|
|
- :label="dict.label"
|
|
|
|
|
- :value="dict.value"
|
|
|
|
|
- />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="创建时间">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="queryParams.createTime"
|
|
|
|
|
- value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
- type="daterange"
|
|
|
|
|
- start-placeholder="开始日期"
|
|
|
|
|
- end-placeholder="结束日期"
|
|
|
|
|
- :shortcuts="rangeShortcuts"
|
|
|
|
|
- :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
|
|
- class="!w-220px"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
-
|
|
|
|
|
- <el-form-item v-show="ifShow" :label="t('devicePerson.brand')" prop="brand">
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="queryParams.brand"
|
|
|
|
|
- :placeholder="t('devicePerson.brandHolder')"
|
|
|
|
|
- clearable
|
|
|
|
|
- @keyup.enter="handleQuery"
|
|
|
|
|
- class="!w-200px"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
-
|
|
|
|
|
- <el-form-item>
|
|
|
|
|
- <el-button v-if="!ifShow" @click="moreQuery(true)" type="warning"
|
|
|
|
|
- ><Icon icon="ep:search" class="mr-5px" />
|
|
|
|
|
- {{ t('devicePerson.moreSearch') }}</el-button
|
|
|
|
|
- >
|
|
|
|
|
- <el-button v-if="ifShow" @click="moreQuery(false)" type="danger"
|
|
|
|
|
- ><Icon icon="ep:search" class="mr-5px" />
|
|
|
|
|
- {{ t('devicePerson.closeSearch') }}</el-button
|
|
|
|
|
- >
|
|
|
|
|
- <el-button @click="handleQuery"
|
|
|
|
|
- ><Icon icon="ep:search" class="mr-5px" /> {{ t('devicePerson.search') }}</el-button
|
|
|
|
|
- >
|
|
|
|
|
- <el-button @click="resetQuery"
|
|
|
|
|
- ><Icon icon="ep:refresh" class="mr-5px" /> {{ t('devicePerson.reset') }}</el-button
|
|
|
|
|
- >
|
|
|
|
|
- <el-button
|
|
|
|
|
- type="primary"
|
|
|
|
|
- plain
|
|
|
|
|
- @click="openForm('create', undefined, queryParams.deptId)"
|
|
|
|
|
- v-hasPermi="['pms:iot-device-status-log:create']"
|
|
|
|
|
- >
|
|
|
|
|
- <Icon icon="ep:plus" class="mr-5px" /> {{ t('deviceStatus.setUp') }}
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <!-- v-hasPermi="['rq:iot-device:export']" -->
|
|
|
|
|
- <el-button type="success" plain @click="handleExport" :loading="exportLoading">
|
|
|
|
|
- <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- </ContentWrap>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 列表 -->
|
|
|
|
|
- <ContentWrap>
|
|
|
|
|
- <el-table
|
|
|
|
|
- height="calc(85vh - 175px)"
|
|
|
|
|
- v-loading="loading"
|
|
|
|
|
- :data="list"
|
|
|
|
|
- :stripe="true"
|
|
|
|
|
- :show-overflow-tooltip="true"
|
|
|
|
|
- >
|
|
|
|
|
- <el-table-column :label="t('monitor.serial')" width="70" align="center">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- {{ scope.$index + 1 }}
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column :label="t('monitor.deviceCode')" align="center" prop="deviceCode" />
|
|
|
|
|
- <el-table-column :label="t('monitor.deviceName')" align="center" prop="deviceName">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- <el-link :underline="false" type="primary" @click="handleDetail(scope.row.id)">
|
|
|
|
|
- {{ scope.row.deviceName }}
|
|
|
|
|
- </el-link>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column :label="t('devicePerson.dept')" align="center" prop="deptName" />
|
|
|
|
|
- <el-table-column :label="t('deviceStatus.status')" align="center" prop="deviceStatus">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- <dict-tag :type="DICT_TYPE.PMS_DEVICE_STATUS" :value="scope.row.deviceStatus" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <!--
|
|
|
|
|
- <el-table-column
|
|
|
|
|
- label="创建时间"
|
|
|
|
|
- align="center"
|
|
|
|
|
- prop="createTime"
|
|
|
|
|
- :formatter="dateFormatter"
|
|
|
|
|
- width="180px"
|
|
|
|
|
- /> -->
|
|
|
|
|
- <el-table-column :label="t('deviceStatus.operation')" align="center" min-width="120px">
|
|
|
|
|
- <template #default="scope">
|
|
|
|
|
- <el-button
|
|
|
|
|
- link
|
|
|
|
|
- type="primary"
|
|
|
|
|
- @click="handleView(scope.row.id)"
|
|
|
|
|
- v-hasPermi="['rq:iot-device:query']"
|
|
|
|
|
- >
|
|
|
|
|
- {{ t('deviceStatus.adjustmentRecords') }}
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </el-table>
|
|
|
|
|
- <!-- 分页 -->
|
|
|
|
|
- <Pagination
|
|
|
|
|
- :total="total"
|
|
|
|
|
- v-model:page="queryParams.pageNo"
|
|
|
|
|
- v-model:limit="queryParams.pageSize"
|
|
|
|
|
- @pagination="getList"
|
|
|
|
|
- />
|
|
|
|
|
- </ContentWrap>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- <DeviceStatusLogDrawer
|
|
|
|
|
- :model-value="drawerVisible"
|
|
|
|
|
- @update:model-value="(val) => (drawerVisible = val)"
|
|
|
|
|
- :device-id="currentDeviceId"
|
|
|
|
|
- ref="showDrawer"
|
|
|
|
|
- />
|
|
|
|
|
-</template>
|
|
|
|
|
-
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import download from '@/utils/download'
|
|
|
|
|
|
|
+import { useTableComponents } from '@/components/ZmTable/useTableComponents'
|
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
|
|
|
+import { useUserStore } from '@/store/modules/user'
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
-import DeptTree from '@/views/system/user/DeptTree2.vue'
|
|
|
|
|
-import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
|
|
|
|
-import DeviceStatusLogDrawer from '@/views/pms/device/statuslog/DeviceStatusLogDrawer.vue'
|
|
|
|
|
|
|
+import download from '@/utils/download'
|
|
|
import { rangeShortcuts } from '@/utils/formatTime'
|
|
import { rangeShortcuts } from '@/utils/formatTime'
|
|
|
|
|
+import DeviceStatusLogDrawer from '@/views/pms/device/statuslog/DeviceStatusLogDrawer.vue'
|
|
|
|
|
|
|
|
-/** 设备台账 列表 */
|
|
|
|
|
defineOptions({ name: 'IotDeviceStatus' })
|
|
defineOptions({ name: 'IotDeviceStatus' })
|
|
|
|
|
|
|
|
-const message = useMessage() // 消息弹窗
|
|
|
|
|
-const { t } = useI18n() // 国际化
|
|
|
|
|
-const { push } = useRouter() // 路由跳转
|
|
|
|
|
-const drawerVisible = ref<boolean>(false)
|
|
|
|
|
-const loading = ref(true) // 列表的加载中
|
|
|
|
|
-const ifShow = ref(false)
|
|
|
|
|
-const list = ref<IotDeviceVO[]>([]) // 列表的数据
|
|
|
|
|
-const total = ref(0) // 列表的总页数
|
|
|
|
|
-const currentDeviceId = ref() // 设备id
|
|
|
|
|
-let isLeftContentCollapsed = ref(false)
|
|
|
|
|
-const queryParams = reactive({
|
|
|
|
|
|
|
+interface QueryParams extends PageParam {
|
|
|
|
|
+ deptId?: number
|
|
|
|
|
+ deviceCode?: string
|
|
|
|
|
+ deviceName?: string
|
|
|
|
|
+ brand?: string
|
|
|
|
|
+ setFlag?: string
|
|
|
|
|
+ deviceStatus?: string
|
|
|
|
|
+ assetProperty?: string
|
|
|
|
|
+ createTime?: string[]
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const { t } = useI18n()
|
|
|
|
|
+const { push } = useRouter()
|
|
|
|
|
+const { ZmTable, ZmTableColumn } = useTableComponents<IotDeviceVO>()
|
|
|
|
|
+
|
|
|
|
|
+const rootDeptId = 156
|
|
|
|
|
+const deptId = useUserStore().getUser.deptId || rootDeptId
|
|
|
|
|
+
|
|
|
|
|
+const initQuery: QueryParams = {
|
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
|
|
+ deptId: undefined,
|
|
|
deviceCode: undefined,
|
|
deviceCode: undefined,
|
|
|
deviceName: undefined,
|
|
deviceName: undefined,
|
|
|
brand: undefined,
|
|
brand: undefined,
|
|
|
- model: undefined,
|
|
|
|
|
- deptId: undefined,
|
|
|
|
|
|
|
+ setFlag: '',
|
|
|
deviceStatus: undefined,
|
|
deviceStatus: undefined,
|
|
|
assetProperty: undefined,
|
|
assetProperty: undefined,
|
|
|
- picUrl: undefined,
|
|
|
|
|
- remark: undefined,
|
|
|
|
|
- manufacturerId: undefined,
|
|
|
|
|
- supplierId: undefined,
|
|
|
|
|
- manDate: [],
|
|
|
|
|
- nameplate: undefined,
|
|
|
|
|
- expires: undefined,
|
|
|
|
|
- plPrice: undefined,
|
|
|
|
|
- plDate: [],
|
|
|
|
|
- plYear: undefined,
|
|
|
|
|
- plStartDate: [],
|
|
|
|
|
- plMonthed: undefined,
|
|
|
|
|
- plAmounted: undefined,
|
|
|
|
|
- remainAmount: undefined,
|
|
|
|
|
- infoId: undefined,
|
|
|
|
|
- infoType: undefined,
|
|
|
|
|
- infoName: undefined,
|
|
|
|
|
- infoRemark: undefined,
|
|
|
|
|
- infoUrl: undefined,
|
|
|
|
|
- templateJson: undefined,
|
|
|
|
|
- creator: undefined,
|
|
|
|
|
- setFlag: '',
|
|
|
|
|
createTime: []
|
|
createTime: []
|
|
|
-})
|
|
|
|
|
-const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
-const exportLoading = ref(false) // 导出的加载中
|
|
|
|
|
-const contentSpan = ref(20)
|
|
|
|
|
-const treeShow = ref(true)
|
|
|
|
|
-
|
|
|
|
|
-/** 查询列表 */
|
|
|
|
|
-const getList = async () => {
|
|
|
|
|
- loading.value = true
|
|
|
|
|
- try {
|
|
|
|
|
- const data = await IotDeviceApi.statusRelationDevices(queryParams)
|
|
|
|
|
- list.value = data.list
|
|
|
|
|
- total.value = data.total
|
|
|
|
|
- } finally {
|
|
|
|
|
- loading.value = false
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 是否设置过责任人 下拉列表 模拟字典项
|
|
|
|
|
|
|
+const queryParams = reactive<QueryParams>({ ...initQuery })
|
|
|
|
|
+const queryFormRef = ref()
|
|
|
|
|
+const loading = ref(false)
|
|
|
|
|
+const exportLoading = ref(false)
|
|
|
|
|
+const ifShow = ref(false)
|
|
|
|
|
+const list = ref<IotDeviceVO[]>([])
|
|
|
|
|
+const total = ref(0)
|
|
|
|
|
+const currentDeviceId = ref<number>()
|
|
|
|
|
+const drawerVisible = ref(false)
|
|
|
|
|
+const showDrawer = ref()
|
|
|
|
|
+
|
|
|
const resultOptions = computed(() => [
|
|
const resultOptions = computed(() => [
|
|
|
{
|
|
{
|
|
|
label: '全部',
|
|
label: '全部',
|
|
|
- value: 'A' // 空值会触发 clearable 效果
|
|
|
|
|
|
|
+ value: 'A'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '是',
|
|
label: '是',
|
|
|
- value: 'Y' // 空值会触发 clearable 效果
|
|
|
|
|
|
|
+ value: 'Y'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '否',
|
|
label: '否',
|
|
|
- value: 'N' // 空值会触发 clearable 效果
|
|
|
|
|
|
|
+ value: 'N'
|
|
|
}
|
|
}
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
-const showDrawer = ref()
|
|
|
|
|
-
|
|
|
|
|
-/** 查看设备状态调整详情 */
|
|
|
|
|
-const handleView = async (deviceId: number) => {
|
|
|
|
|
- currentDeviceId.value = deviceId
|
|
|
|
|
- drawerVisible.value = true
|
|
|
|
|
- // 强制重新加载数据
|
|
|
|
|
- nextTick(() => {
|
|
|
|
|
- showDrawer.value?.loadDeviceStatuses(deviceId)
|
|
|
|
|
- })
|
|
|
|
|
- showDrawer.value.openDrawer()
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-/** 处理部门被点击 */
|
|
|
|
|
-const handleDeptNodeClick = async (row) => {
|
|
|
|
|
- queryParams.deptId = row.id
|
|
|
|
|
- await getList()
|
|
|
|
|
|
|
+const getList = async () => {
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const data = await IotDeviceApi.statusRelationDevices(queryParams)
|
|
|
|
|
+ list.value = data.list
|
|
|
|
|
+ total.value = data.total
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
const handleQuery = () => {
|
|
|
queryParams.pageNo = 1
|
|
queryParams.pageNo = 1
|
|
|
getList()
|
|
getList()
|
|
|
}
|
|
}
|
|
|
-const moreQuery = (show) => {
|
|
|
|
|
- ifShow.value = show
|
|
|
|
|
-}
|
|
|
|
|
-/** 重置按钮操作 */
|
|
|
|
|
|
|
+
|
|
|
const resetQuery = () => {
|
|
const resetQuery = () => {
|
|
|
- queryFormRef.value.resetFields()
|
|
|
|
|
|
|
+ Object.assign(queryParams, { ...initQuery })
|
|
|
|
|
+ queryFormRef.value?.resetFields()
|
|
|
handleQuery()
|
|
handleQuery()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** 添加/修改操作 */
|
|
|
|
|
-const formRef = ref()
|
|
|
|
|
-const openForm = (type: string, id?: number) => {
|
|
|
|
|
- //修改
|
|
|
|
|
- if (typeof id === 'number') {
|
|
|
|
|
- push({ name: 'DeviceDetailEdit', params: { id } })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- // 新增
|
|
|
|
|
|
|
+const handleSizeChange = (val: number) => {
|
|
|
|
|
+ queryParams.pageSize = val
|
|
|
|
|
+ handleQuery()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleCurrentChange = (val: number) => {
|
|
|
|
|
+ queryParams.pageNo = val
|
|
|
|
|
+ getList()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleDeptNodeClick = async (row: Tree) => {
|
|
|
|
|
+ queryParams.deptId = row.id
|
|
|
|
|
+ queryParams.pageNo = 1
|
|
|
|
|
+ await getList()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const moreQuery = (show: boolean) => {
|
|
|
|
|
+ ifShow.value = show
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const openForm = () => {
|
|
|
push({
|
|
push({
|
|
|
name: 'ConfigDeviceStatus',
|
|
name: 'ConfigDeviceStatus',
|
|
|
query: {
|
|
query: {
|
|
@@ -345,43 +117,375 @@ const openForm = (type: string, id?: number) => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** 删除按钮操作 */
|
|
|
|
|
-const handleDelete = async (id: number) => {
|
|
|
|
|
- try {
|
|
|
|
|
- // 删除的二次确认
|
|
|
|
|
- await message.delConfirm()
|
|
|
|
|
- // 发起删除
|
|
|
|
|
- await IotDeviceApi.deleteIotDevice(id)
|
|
|
|
|
- message.success(t('common.delSuccess'))
|
|
|
|
|
- // 刷新列表
|
|
|
|
|
- await getList()
|
|
|
|
|
- } catch {}
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
const handleDetail = (id: number) => {
|
|
const handleDetail = (id: number) => {
|
|
|
push({ name: 'DeviceDetailInfo', params: { id } })
|
|
push({ name: 'DeviceDetailInfo', params: { id } })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/** 导出按钮操作 */
|
|
|
|
|
|
|
+const handleView = async (deviceId: number) => {
|
|
|
|
|
+ currentDeviceId.value = deviceId
|
|
|
|
|
+ drawerVisible.value = true
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ showDrawer.value?.loadDeviceStatuses(deviceId)
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const handleExport = async () => {
|
|
const handleExport = async () => {
|
|
|
|
|
+ exportLoading.value = true
|
|
|
try {
|
|
try {
|
|
|
- // // 导出的二次确认
|
|
|
|
|
- // await message.exportConfirm()
|
|
|
|
|
- // // 发起导出
|
|
|
|
|
- exportLoading.value = true
|
|
|
|
|
const data = await IotDeviceApi.exportIotDeviceAdjust(queryParams)
|
|
const data = await IotDeviceApi.exportIotDeviceAdjust(queryParams)
|
|
|
download.excel(data, '设备状态调整.xls')
|
|
download.excel(data, '设备状态调整.xls')
|
|
|
- } catch {
|
|
|
|
|
} finally {
|
|
} finally {
|
|
|
exportLoading.value = false
|
|
exportLoading.value = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-const { wsCache } = useCache()
|
|
|
|
|
-/** 初始化 **/
|
|
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- const user = wsCache.get(CACHE_KEY.USER)
|
|
|
|
|
- // queryParams.deptId = user.user.deptId
|
|
|
|
|
getList()
|
|
getList()
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|
|
|
-<style scoped></style>
|
|
|
|
|
|
|
+
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="device-status-page grid grid-cols-[auto_1fr] grid-rows-[auto_1fr] gap-4 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <DeptTreeSelect
|
|
|
|
|
+ :top-id="rootDeptId"
|
|
|
|
|
+ :deptId="deptId"
|
|
|
|
|
+ v-model="queryParams.deptId"
|
|
|
|
|
+ :init-select="false"
|
|
|
|
|
+ :show-title="false"
|
|
|
|
|
+ request-api="getSimpleDeptList"
|
|
|
|
|
+ class="device-status-tree row-span-2"
|
|
|
|
|
+ @node-click="handleDeptNodeClick"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ ref="queryFormRef"
|
|
|
|
|
+ :model="queryParams"
|
|
|
|
|
+ size="default"
|
|
|
|
|
+ label-width="68px"
|
|
|
|
|
+ class="device-status-query bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-6 py-3 min-w-0"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="query-row">
|
|
|
|
|
+ <el-form-item :label="t('devicePerson.deviceCode')" prop="deviceCode">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.deviceCode"
|
|
|
|
|
+ :placeholder="t('devicePerson.codeHolder')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ class="query-control"
|
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item :label="t('devicePerson.deviceName')" prop="deviceName">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.deviceName"
|
|
|
|
|
+ :placeholder="t('devicePerson.nameHolder')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ class="query-control"
|
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item :label="t('deviceStatus.statusAdjust')" prop="setFlag" label-width="100px">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.setFlag"
|
|
|
|
|
+ :placeholder="t('deviceStatus.choose')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ class="query-control query-control--small"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="dict in resultOptions"
|
|
|
|
|
+ :key="dict.value"
|
|
|
|
|
+ :label="dict.label"
|
|
|
|
|
+ :value="dict.value"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="创建时间" prop="createTime">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="queryParams.createTime"
|
|
|
|
|
+ value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ :shortcuts="rangeShortcuts"
|
|
|
|
|
+ :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
|
|
+ class="query-control query-control--date"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-show="ifShow"
|
|
|
|
|
+ :label="t('devicePerson.status')"
|
|
|
|
|
+ prop="deviceStatus"
|
|
|
|
|
+ label-width="85px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.deviceStatus"
|
|
|
|
|
+ :placeholder="t('devicePerson.status')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ class="query-control query-control--small"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.PMS_DEVICE_STATUS)"
|
|
|
|
|
+ :key="dict.value"
|
|
|
|
|
+ :label="dict.label"
|
|
|
|
|
+ :value="dict.value"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item v-show="ifShow" :label="t('devicePerson.assets')" prop="assetProperty">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.assetProperty"
|
|
|
|
|
+ :placeholder="t('devicePerson.assetsHolder')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ class="query-control query-control--small"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.PMS_ASSET_PROPERTY)"
|
|
|
|
|
+ :key="dict.value"
|
|
|
|
|
+ :label="dict.label"
|
|
|
|
|
+ :value="dict.value"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item v-show="ifShow" :label="t('devicePerson.brand')" prop="brand">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.brand"
|
|
|
|
|
+ :placeholder="t('devicePerson.brandHolder')"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ class="query-control"
|
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item class="query-actions">
|
|
|
|
|
+ <el-button v-if="!ifShow" type="warning" @click="moreQuery(true)">
|
|
|
|
|
+ <Icon icon="ep:search" class="mr-5px" />{{ t('devicePerson.moreSearch') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button v-else type="danger" @click="moreQuery(false)">
|
|
|
|
|
+ <Icon icon="ep:search" class="mr-5px" />{{ t('devicePerson.closeSearch') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button type="primary" @click="handleQuery">
|
|
|
|
|
+ <Icon icon="ep:search" class="mr-5px" />{{ t('devicePerson.search') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button @click="resetQuery">
|
|
|
|
|
+ <Icon icon="ep:refresh" class="mr-5px" />{{ t('devicePerson.reset') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ plain
|
|
|
|
|
+ @click="openForm"
|
|
|
|
|
+ v-hasPermi="['pms:iot-device-status-log:create']"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Icon icon="ep:plus" class="mr-5px" />{{ t('deviceStatus.setUp') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button type="success" plain :loading="exportLoading" @click="handleExport">
|
|
|
|
|
+ <Icon icon="ep:download" class="mr-5px" />导出
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="bg-white dark:bg-[#1d1e1f] shadow rounded-lg flex flex-col p-4 min-w-0 min-h-0">
|
|
|
|
|
+ <div class="flex-1 relative min-h-0">
|
|
|
|
|
+ <el-auto-resizer class="absolute">
|
|
|
|
|
+ <template #default="{ width, height }">
|
|
|
|
|
+ <ZmTable
|
|
|
|
|
+ :data="list"
|
|
|
|
|
+ :loading="loading"
|
|
|
|
|
+ :width="width"
|
|
|
|
|
+ :height="height"
|
|
|
|
|
+ :max-height="height"
|
|
|
|
|
+ show-border
|
|
|
|
|
+ >
|
|
|
|
|
+ <ZmTableColumn
|
|
|
|
|
+ type="index"
|
|
|
|
|
+ :label="t('monitor.serial')"
|
|
|
|
|
+ :width="70"
|
|
|
|
|
+ fixed="left"
|
|
|
|
|
+ hide-in-column-settings
|
|
|
|
|
+ />
|
|
|
|
|
+ <ZmTableColumn prop="deviceCode" :label="t('monitor.deviceCode')" fixed="left" />
|
|
|
|
|
+ <ZmTableColumn prop="deviceName" :label="t('monitor.deviceName')" fixed="left">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <el-link :underline="false" type="primary" @click="handleDetail(row.id)">
|
|
|
|
|
+ {{ row.deviceName }}
|
|
|
|
|
+ </el-link>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+ <ZmTableColumn prop="deptName" :label="t('devicePerson.dept')" />
|
|
|
|
|
+ <ZmTableColumn prop="deviceStatus" :label="t('deviceStatus.status')">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <dict-tag :type="DICT_TYPE.PMS_DEVICE_STATUS" :value="row.deviceStatus" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+ <ZmTableColumn :label="t('deviceStatus.operation')" width="150" fixed="right" action>
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ link
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="handleView(row.id)"
|
|
|
|
|
+ v-hasPermi="['rq:iot-device:query']"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ t('deviceStatus.adjustmentRecords') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+ </ZmTable>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-auto-resizer>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="h-8 mt-2 flex items-center justify-end">
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ v-show="total > 0"
|
|
|
|
|
+ size="default"
|
|
|
|
|
+ :current-page="queryParams.pageNo"
|
|
|
|
|
+ :page-size="queryParams.pageSize"
|
|
|
|
|
+ :background="true"
|
|
|
|
|
+ :page-sizes="[10, 20, 30, 50, 100]"
|
|
|
|
|
+ :total="total"
|
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <DeviceStatusLogDrawer
|
|
|
|
|
+ ref="showDrawer"
|
|
|
|
|
+ :model-value="drawerVisible"
|
|
|
|
|
+ :device-id="currentDeviceId"
|
|
|
|
|
+ @update:model-value="(val) => (drawerVisible = val)"
|
|
|
|
|
+ />
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.device-status-query {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ gap: 12px 24px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.query-row {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex: 1 1 auto;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 12px 24px;
|
|
|
|
|
+ min-width: 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.query-actions {
|
|
|
|
|
+ flex: 0 0 auto;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.query-actions :deep(.el-form-item__content) {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ gap: 8px 10px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.query-actions :deep(.el-button) {
|
|
|
|
|
+ margin-left: 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.query-control {
|
|
|
|
|
+ width: 180px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.query-control--small {
|
|
|
|
|
+ width: 140px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.query-control--date {
|
|
|
|
|
+ width: 220px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+:deep(.el-form-item) {
|
|
|
|
|
+ margin-bottom: 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+@media (width >= 2200px) {
|
|
|
|
|
+ .device-status-query,
|
|
|
|
|
+ .query-row {
|
|
|
|
|
+ flex-wrap: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+@media (width <= 1500px) {
|
|
|
|
|
+ .device-status-query {
|
|
|
|
|
+ gap: 12px 18px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-row {
|
|
|
|
|
+ gap: 12px 18px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-control {
|
|
|
|
|
+ width: 168px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-control--small {
|
|
|
|
|
+ width: 132px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-control--date {
|
|
|
|
|
+ width: 210px;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+@media (width <= 1200px) {
|
|
|
|
|
+ .device-status-page {
|
|
|
|
|
+ grid-template-columns: minmax(0, 1fr);
|
|
|
|
|
+ grid-template-rows: auto auto minmax(480px, 1fr);
|
|
|
|
|
+ height: auto;
|
|
|
|
|
+ min-height: calc(
|
|
|
|
|
+ 100vh - 20px - var(--top-tool-height) - var(--tags-view-height) - var(--app-footer-height)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.device-status-tree) {
|
|
|
|
|
+ grid-row: auto !important;
|
|
|
|
|
+ width: 100% !important;
|
|
|
|
|
+ height: 320px !important;
|
|
|
|
|
+ min-width: 0 !important;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-actions {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+@media (width <= 768px) {
|
|
|
|
|
+ .device-status-query {
|
|
|
|
|
+ padding: 12px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-row,
|
|
|
|
|
+ .query-row :deep(.el-form-item),
|
|
|
|
|
+ .query-actions {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-control,
|
|
|
|
|
+ .query-control--small,
|
|
|
|
|
+ .query-control--date {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-actions :deep(.el-form-item__content) {
|
|
|
|
|
+ display: grid;
|
|
|
|
|
+ grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
|
|
|
+ gap: 8px;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .query-actions :deep(.el-button) {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ margin-left: 0;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|