|
|
@ -2,11 +2,11 @@ |
|
|
|
<SearchBar @search="onSearch" /> |
|
|
|
|
|
|
|
<div class="my-3"> |
|
|
|
<el-button type="primary" @click="$router.push({ name: 'device-create' })">添加设备</el-button> |
|
|
|
<el-button type="primary" @click="openPage(null, 'device-create')">添加设备</el-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<template v-if="devicesAll && devicesAll.data"> |
|
|
|
<el-table :data="devicesAll.data" style="width: 100%" border stripe :style="{ 'max-height': contentHeight + 'px' }"> |
|
|
|
<el-table :data="devicesAll.data" :style="{ 'max-height': contentHeight + 'px' }" border stripe style="width: 100%"> |
|
|
|
<el-table-column type="expand"> |
|
|
|
<template #default="props"> |
|
|
|
<el-row :gutter="20" class="px-6 text-gray-400"> |
|
|
@ -21,55 +21,55 @@ |
|
|
|
</el-row> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="ID" prop="deviceId" min-min-width="100" align="center" /> |
|
|
|
<el-table-column label="完整ID" prop="deviceFullId" min-width="150" align="center" /> |
|
|
|
<el-table-column label="地点" prop="address" min-width="150" align="left" header-align="center" /> |
|
|
|
<el-table-column label="地区" prop="area" min-width="120" align="left" header-align="center" /> |
|
|
|
<el-table-column label="联系人" prop="contact" min-width="100" align="center" /> |
|
|
|
<el-table-column label="联系电话" prop="phone" min-width="150" align="center" /> |
|
|
|
<el-table-column label="安装时间" prop="installTime" min-width="200" align="center" /> |
|
|
|
<el-table-column label="正式运行时间" prop="runTime" min-width="200" align="center" /> |
|
|
|
<el-table-column fixed="right" label="操作" min-width="200" align="center"> |
|
|
|
<el-table-column align="center" label="ID" min-min-width="100" prop="deviceId" /> |
|
|
|
<el-table-column align="center" label="完整ID" min-width="150" prop="deviceFullId" /> |
|
|
|
<el-table-column align="left" header-align="center" label="地点" min-width="150" prop="address" /> |
|
|
|
<el-table-column align="left" header-align="center" label="地区" min-width="120" prop="area" /> |
|
|
|
<el-table-column align="center" label="联系人" min-width="100" prop="contact" /> |
|
|
|
<el-table-column align="center" label="联系电话" min-width="150" prop="phone" /> |
|
|
|
<el-table-column align="center" label="安装时间" min-width="200" prop="installTime" /> |
|
|
|
<el-table-column align="center" label="正式运行时间" min-width="200" prop="runTime" /> |
|
|
|
<el-table-column align="center" fixed="right" label="操作" min-width="200"> |
|
|
|
<template #default="props"> |
|
|
|
<el-tooltip class="item" effect="dark" content="网络参数配置" placement="top"> |
|
|
|
<el-tooltip class="item" content="网络参数配置" effect="dark" placement="top"> |
|
|
|
<i class="el-icon-setting text-base text-yellow-600 mx-1" @click="openPage(props.row, 'network-config')"></i> |
|
|
|
</el-tooltip> |
|
|
|
<el-tooltip class="item" effect="dark" content="功能参数配置" placement="top"> |
|
|
|
<el-tooltip class="item" content="功能参数配置" effect="dark" placement="top"> |
|
|
|
<i class="el-icon-set-up text-base text-yellow-600 mx-1" @click="openPage(props.row, 'function-config')"></i> |
|
|
|
</el-tooltip> |
|
|
|
<el-tooltip class="item" effect="dark" content="实时数据统计" placement="top"> |
|
|
|
<el-tooltip class="item" content="实时数据统计" effect="dark" placement="top"> |
|
|
|
<i class="el-icon-stopwatch text-base text-green-600 mx-1" @click="openPage(props.row, 'statistical-realtime')"></i> |
|
|
|
</el-tooltip> |
|
|
|
<el-tooltip class="item" effect="dark" content="数据查看及导出" placement="top"> |
|
|
|
<el-tooltip class="item" content="数据查看及导出" effect="dark" placement="top"> |
|
|
|
<i class="el-icon-tickets text-base text-green-600 mx-1" @click="openPage(props.row, 'data-history')"></i> |
|
|
|
</el-tooltip> |
|
|
|
<el-tooltip class="item" effect="dark" content="数据统计" placement="top"> |
|
|
|
<el-tooltip class="item" content="数据统计" effect="dark" placement="top"> |
|
|
|
<i class="el-icon-data-line text-base text-green-600 mx-1" @click="openPage(props.row, 'statistical-history')"></i> |
|
|
|
</el-tooltip> |
|
|
|
<el-popconfirm title="确定要删除此设备吗?" @confirm="handleDelete(props.row.deviceId)"> |
|
|
|
<el-popconfirm title="确定要删除此设备吗?" @confirm="handleDelete(props.ro.deviceId)"> |
|
|
|
<template #reference> |
|
|
|
<i class="el-icon-delete text-base text-red-600 mx-1"></i> |
|
|
|
<!-- <el-button type="text" plain size="mini" icon="el-icon-delete"></el-button> --> |
|
|
|
</template> |
|
|
|
</el-popconfirm> |
|
|
|
|
|
|
|
<el-tooltip class="item" effect="dark" content="编辑设备信息" placement="top"> |
|
|
|
<i class="el-icon-edit text-base text-blue-600 mx-1" @click="handleEdit(props.row)"></i> |
|
|
|
<el-tooltip class="item" content="编辑设备信息" effect="dark" placement="top"> |
|
|
|
<i class="el-icon-edit text-base text-blue-600 mx-1" @click="handleEdit(rops.row)"></i> |
|
|
|
</el-tooltip> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-pagination |
|
|
|
background |
|
|
|
:current-page="devicesAll.page.page" |
|
|
|
:page-size="devicesAll.page.size" |
|
|
|
:default-page-size="50" |
|
|
|
:page-count="devicesAll.page.count" |
|
|
|
:page-size="devicesAll.page.size" |
|
|
|
:page-sizes="[1, 10, 20, 50, 100]" |
|
|
|
:total="devicesAll.page.total" |
|
|
|
background |
|
|
|
class="my-3 float-right" |
|
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
|
:page-sizes="[1, 10, 20, 50, 100]" |
|
|
|
@size-change="onSizeChange" |
|
|
|
@current-change="onCurrentPageChange" |
|
|
|
></el-pagination> |
|
|
@ -82,7 +82,7 @@ |
|
|
|
<script setup> |
|
|
|
import { computed, onMounted, ref } from 'vue'; |
|
|
|
import { useStore } from 'vuex'; |
|
|
|
import { useRouter } from 'vue-router'; |
|
|
|
import { useRoute, useRouter } from 'vue-router'; |
|
|
|
import SearchBar from 'components/search-bar.vue'; |
|
|
|
import DeviceEdit from 'components/device-edit.vue'; |
|
|
|
import { deleteDevice } from 'apis/index'; |
|
|
@ -91,6 +91,7 @@ import { ElMessage } from 'element-plus'; |
|
|
|
let timer = null; |
|
|
|
const store = useStore(); |
|
|
|
const router = useRouter(); |
|
|
|
const route = useRoute(); |
|
|
|
const token = computed(() => store.getters['user/token']); |
|
|
|
const devicesAll = computed(() => { |
|
|
|
return store.state.device.devicesAll; |
|
|
@ -102,7 +103,7 @@ const editting = ref(false); |
|
|
|
// 获取设备完整信息列表 |
|
|
|
const getDevicesAllData = () => { |
|
|
|
try { |
|
|
|
if (token) { |
|
|
|
if (token && token.value) { |
|
|
|
store.dispatch('device/getDevicesAll'); |
|
|
|
timer && clearTimeout(timer); |
|
|
|
timer = null; |
|
|
@ -177,7 +178,10 @@ const handleEdit = item => { |
|
|
|
* @param {string} pageName 页面name |
|
|
|
*/ |
|
|
|
const openPage = (item, pageName) => { |
|
|
|
store.commit('device/setCurrentDeviceId', item.deviceId); |
|
|
|
router.push({ name: pageName }); |
|
|
|
item && store.commit('device/setCurrentDeviceId', item.deviceId); |
|
|
|
router.push({ |
|
|
|
path: `/corrosion/${pageName}`, |
|
|
|
query: route.query, |
|
|
|
}); |
|
|
|
}; |
|
|
|
</script> |
|
|
|