|
@@ -103,8 +103,8 @@
|
|
|
|
|
|
<!-- 内容区域 -->
|
|
|
<template>
|
|
|
- <!-- 卡片视图 -->
|
|
|
- <el-row :gutter="20" class="camera-cards" v-show="isImgType || tabActive === 0">
|
|
|
+ <!-- 协作设备特殊显示 -->
|
|
|
+ <el-row :gutter="20" class="camera-cards" v-show="tabActive === 0">
|
|
|
<template v-if="!loading">
|
|
|
<el-col
|
|
|
:span="8"
|
|
@@ -120,7 +120,6 @@
|
|
|
/>
|
|
|
<camera-item
|
|
|
:item="item"
|
|
|
- :tabActive="tabActive"
|
|
|
@handleCooperation="handleCooperation"
|
|
|
@unbind="unbind"
|
|
|
@renew="handleRenew"
|
|
@@ -130,9 +129,9 @@
|
|
|
</template>
|
|
|
</el-row>
|
|
|
|
|
|
- <!-- 列表视图 -->
|
|
|
+ <!-- TableList组件 - 支持列表和卡片视图 -->
|
|
|
<table-list
|
|
|
- v-show="!(isImgType || tabActive === 0)"
|
|
|
+ v-show="tabActive !== 0"
|
|
|
ref="tableRef"
|
|
|
@selection-change="selectHandle"
|
|
|
@unbind="unbind"
|
|
@@ -141,7 +140,8 @@
|
|
|
:header="tabHeader"
|
|
|
:selection="cameraList.length > 0"
|
|
|
:data="cameraList"
|
|
|
- :show-view-toggle="false"
|
|
|
+ :show-card-view="isImgType"
|
|
|
+ :show-line="true"
|
|
|
class="table-list"
|
|
|
>
|
|
|
<template #item="{ data, type, canclick, item }">
|
|
@@ -245,29 +245,35 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, computed, onMounted, watch, nextTick } from 'vue'
|
|
|
+import { ref, computed, onMounted, watch } from 'vue'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import TableList from '@/components/tableList/index.vue'
|
|
|
+import CameraItem from '@/components/CameraItem.vue'
|
|
|
+
|
|
|
+defineOptions({
|
|
|
+ name: 'DeviceIndex'
|
|
|
+})
|
|
|
|
|
|
// 静态数据
|
|
|
const tabList = ref([
|
|
|
- { id: 0, name: '协作设备' },
|
|
|
- { id: 4, name: '我的设备' },
|
|
|
- { id: 10, name: '共享设备' },
|
|
|
- { id: 11, name: '租赁设备' }
|
|
|
+ { id: 0, name: '四维看看' },
|
|
|
+ { id: 4, name: '四维看见' },
|
|
|
+ { id: 10, name: '四维深时' },
|
|
|
+ { id: 11, name: '四维深光' },
|
|
|
+ { id: 12, name: '四维深巡' }
|
|
|
])
|
|
|
|
|
|
const searchTypeList = ref([
|
|
|
- { name: '设备编号', value: 2 },
|
|
|
- { name: '用户名', value: 1 }
|
|
|
+ { name: 'S/N码', value: 2 },
|
|
|
+ { name: '协作者', value: 1 }
|
|
|
])
|
|
|
|
|
|
// 表格头部配置
|
|
|
const tabHeader = ref([
|
|
|
- { key: 'snCode', name: '设备编号', type: 'image', width: 200 },
|
|
|
- { key: 'status', name: '状态', width: 100 },
|
|
|
- { key: 'qingkuang', name: '使用情况', type: 'qingkuang', width: 150 },
|
|
|
+ { key: 'snCode', name: 'S/N码', type: 'image', width: 200 },
|
|
|
+ { key: 'status', name: '云容量', width: 100 },
|
|
|
{ key: 'spaceEndStr', name: '到期时间', type: 'spaceEndStr', width: 150 },
|
|
|
+ { key: 'qingkuang', name: '协作者', type: 'qingkuang', width: 150 },
|
|
|
{ key: 'operation', name: '操作', canclick: true, width: 200 }
|
|
|
])
|
|
|
|
|
@@ -284,7 +290,12 @@ const mockCameraData = ref([
|
|
|
userIncrementId: 'inc_001',
|
|
|
sceneNum: 5,
|
|
|
lastTime: '2024-01-15 10:30:00',
|
|
|
- selected: false
|
|
|
+ selected: false,
|
|
|
+ cameraType: 4,
|
|
|
+ cooperationUserName: '张三',
|
|
|
+ goodsId: 0,
|
|
|
+ usedSpace: 2684354560, // 2.5GB in bytes
|
|
|
+ totalSpace: 10737418240 // 10GB in bytes
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
@@ -297,7 +308,12 @@ const mockCameraData = ref([
|
|
|
userIncrementId: 'inc_002',
|
|
|
sceneNum: 8,
|
|
|
lastTime: '2024-01-14 15:20:00',
|
|
|
- selected: false
|
|
|
+ selected: false,
|
|
|
+ cameraType: 9,
|
|
|
+ cooperationUserName: '李四',
|
|
|
+ goodsId: 0,
|
|
|
+ usedSpace: 5583457484, // 5.2GB in bytes
|
|
|
+ totalSpace: 21474836480 // 20GB in bytes
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
@@ -310,7 +326,88 @@ const mockCameraData = ref([
|
|
|
userIncrementId: null,
|
|
|
sceneNum: 3,
|
|
|
lastTime: '2024-01-13 09:15:00',
|
|
|
- selected: false
|
|
|
+ selected: false,
|
|
|
+ cameraType: 10,
|
|
|
+ cooperationUserName: '',
|
|
|
+ goodsId: 0,
|
|
|
+ usedSpace: 1932735283, // 1.8GB in bytes
|
|
|
+ totalSpace: 5368709120 // 5GB in bytes
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ snCode: 'CAM004',
|
|
|
+ status: 1,
|
|
|
+ usedSpaceStr: '8.5GB',
|
|
|
+ totalSpaceStr: '50GB',
|
|
|
+ spaceEndStr: '2025-03-15',
|
|
|
+ spaceEndTime: '2025-03-15',
|
|
|
+ userIncrementId: 'inc_004',
|
|
|
+ sceneNum: 12,
|
|
|
+ lastTime: '2024-01-16 14:22:00',
|
|
|
+ selected: false,
|
|
|
+ cameraType: 11,
|
|
|
+ cooperationUserName: '王五',
|
|
|
+ goodsId: 0,
|
|
|
+ usedSpace: 9126805504, // 8.5GB in bytes
|
|
|
+ totalSpace: 53687091200 // 50GB in bytes
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 5,
|
|
|
+ snCode: 'CAM005',
|
|
|
+ status: 1,
|
|
|
+ usedSpaceStr: '15.2GB',
|
|
|
+ totalSpaceStr: '100GB',
|
|
|
+ spaceEndStr: '2024-09-20',
|
|
|
+ spaceEndTime: '2024-09-20',
|
|
|
+ userIncrementId: 'inc_005',
|
|
|
+ sceneNum: 20,
|
|
|
+ lastTime: '2024-01-16 16:45:00',
|
|
|
+ selected: false,
|
|
|
+ cameraType: 12,
|
|
|
+ cooperationUserName: '赵六',
|
|
|
+ goodsId: 0,
|
|
|
+ usedSpace: 16321863680, // 15.2GB in bytes
|
|
|
+ totalSpace: 107374182400 // 100GB in bytes
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 6,
|
|
|
+ snCode: 'CAM006',
|
|
|
+ status: 1,
|
|
|
+ usedSpaceStr: '3.8GB',
|
|
|
+ totalSpaceStr: '15GB',
|
|
|
+ spaceEndStr: '2024-08-30',
|
|
|
+ spaceEndTime: '2024-08-30',
|
|
|
+ userIncrementId: null,
|
|
|
+ sceneNum: 6,
|
|
|
+ lastTime: '2024-01-12 11:30:00',
|
|
|
+ selected: false,
|
|
|
+ cameraType: 4,
|
|
|
+ cooperationUserName: '',
|
|
|
+ goodsId: 0,
|
|
|
+ usedSpace: 4080218931, // 3.8GB in bytes
|
|
|
+ totalSpace: 16106127360 // 15GB in bytes
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 7,
|
|
|
+ snCode: 'TOW_001',
|
|
|
+ status: 1,
|
|
|
+ balance: '¥128.50',
|
|
|
+ childName: 'TOW_001',
|
|
|
+ selected: false,
|
|
|
+ cameraType: 4,
|
|
|
+ goodsId: 1,
|
|
|
+ lastTime: '2024-01-16 09:20:00'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 8,
|
|
|
+ snCode: 'TOW_002',
|
|
|
+ status: 1,
|
|
|
+ balance: '¥256.80',
|
|
|
+ childName: 'TOW_002',
|
|
|
+ selected: false,
|
|
|
+ cameraType: 9,
|
|
|
+ goodsId: 8,
|
|
|
+ lastTime: '2024-01-15 17:35:00'
|
|
|
}
|
|
|
])
|
|
|
|
|
@@ -322,62 +419,72 @@ const total = ref(0)
|
|
|
const isImgType = ref(localStorage.getItem("isImgTypeForDevice") !== "false")
|
|
|
const searchKey = ref("")
|
|
|
const loading = ref(false)
|
|
|
-const selectedArr = ref([])
|
|
|
+const selectedArr = ref<any[]>([])
|
|
|
const selectAll = ref(false)
|
|
|
const showBinding = ref(false)
|
|
|
const showRenew = ref(false)
|
|
|
-const reNewItem = ref({})
|
|
|
-const showCtrls = ref(null)
|
|
|
-const showInfo = ref(null)
|
|
|
+const reNewItem = ref<any>({})
|
|
|
+const showCtrls = ref<number | null>(null)
|
|
|
+const showInfo = ref<number | null>(null)
|
|
|
const selectedType = ref({ name: '设备编号', value: 2 })
|
|
|
|
|
|
// 计算属性
|
|
|
-const totalObj = ref({
|
|
|
+const totalObj = ref<Record<number, number>>({
|
|
|
0: 0,
|
|
|
4: 0,
|
|
|
10: 0,
|
|
|
11: 0
|
|
|
})
|
|
|
|
|
|
-const oldTotalObj = ref({
|
|
|
+const oldTotalObj = ref<Record<number, number>>({
|
|
|
0: 0,
|
|
|
4: 0,
|
|
|
10: 0,
|
|
|
11: 0
|
|
|
})
|
|
|
|
|
|
-const cameraList = computed(() => {
|
|
|
- let filteredData = mockCameraData.value
|
|
|
+const filteredData = computed(() => {
|
|
|
+ let data = mockCameraData.value
|
|
|
|
|
|
// 根据当前标签页过滤
|
|
|
- if (tabActive.value !== 4) {
|
|
|
- // 这里可以根据不同的标签页显示不同的数据
|
|
|
- filteredData = mockCameraData.value.filter(item => {
|
|
|
- if (tabActive.value === 0) return item.status === 0 // 协作设备
|
|
|
- if (tabActive.value === 10) return item.id % 2 === 0 // 共享设备
|
|
|
- if (tabActive.value === 11) return item.id % 3 === 0 // 租赁设备
|
|
|
- return true
|
|
|
- })
|
|
|
- }
|
|
|
+ data = mockCameraData.value.filter(item => {
|
|
|
+ if (tabActive.value === 0) return item.status === 0 // 协作设备
|
|
|
+ if (tabActive.value === 4) return item.goodsId === 0 // 我的设备(排除充值设备)
|
|
|
+ if (tabActive.value === 10) return item.cooperationUserName && item.goodsId === 0 // 共享设备(有协作用户)
|
|
|
+ if (tabActive.value === 11) return item.goodsId === 1 || item.goodsId === 8 // 租赁设备(充值设备)
|
|
|
+ return true
|
|
|
+ })
|
|
|
|
|
|
// 搜索过滤
|
|
|
if (searchKey.value) {
|
|
|
- filteredData = filteredData.filter(item => {
|
|
|
+ data = data.filter(item => {
|
|
|
if (selectedType.value.value === 2) {
|
|
|
- return item.snCode.toLowerCase().includes(searchKey.value.toLowerCase())
|
|
|
+ return item.snCode && item.snCode.toLowerCase().includes(searchKey.value.toLowerCase())
|
|
|
+ } else if (selectedType.value.value === 1) {
|
|
|
+ return item.cooperationUserName && item.cooperationUserName.toLowerCase().includes(searchKey.value.toLowerCase())
|
|
|
}
|
|
|
return true
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ return data
|
|
|
+})
|
|
|
+
|
|
|
+const cameraList = computed(() => {
|
|
|
+ const data = filteredData.value
|
|
|
+ console.log(data, 888)
|
|
|
// 分页
|
|
|
const start = (currentPage.value - 1) * pageSize.value
|
|
|
const end = start + pageSize.value
|
|
|
- total.value = filteredData.length
|
|
|
|
|
|
- return filteredData.slice(start, end)
|
|
|
+ return data.slice(start, end)
|
|
|
})
|
|
|
|
|
|
+// 监听过滤数据变化更新总数
|
|
|
+watch(filteredData, (newData) => {
|
|
|
+ total.value = newData.length
|
|
|
+}, { immediate: true })
|
|
|
+
|
|
|
// 组件引用
|
|
|
const tableRef = ref()
|
|
|
|
|
@@ -390,10 +497,10 @@ const handleTabClick = (tab: any) => {
|
|
|
|
|
|
const updateTotalCount = () => {
|
|
|
// 更新各个标签的数量
|
|
|
- totalObj.value[0] = mockCameraData.value.filter(item => item.status === 0).length
|
|
|
- totalObj.value[4] = mockCameraData.value.length
|
|
|
- totalObj.value[10] = mockCameraData.value.filter(item => item.id % 2 === 0).length
|
|
|
- totalObj.value[11] = mockCameraData.value.filter(item => item.id % 3 === 0).length
|
|
|
+ totalObj.value[0] = mockCameraData.value.filter(item => item.status === 0).length // 协作设备
|
|
|
+ totalObj.value[4] = mockCameraData.value.filter(item => item.goodsId === 0).length // 我的设备(排除充值设备)
|
|
|
+ totalObj.value[10] = mockCameraData.value.filter(item => item.cooperationUserName && item.goodsId === 0).length // 共享设备(有协作用户)
|
|
|
+ totalObj.value[11] = mockCameraData.value.filter(item => item.goodsId === 1 || item.goodsId === 8).length // 租赁设备(充值设备)
|
|
|
|
|
|
oldTotalObj.value = { ...totalObj.value }
|
|
|
}
|
|
@@ -414,7 +521,7 @@ const handleSelectAll = (val: boolean) => {
|
|
|
updateSelectedArr()
|
|
|
}
|
|
|
|
|
|
-const handleItemSelect = (item: any) => {
|
|
|
+const handleItemSelect = (_item: any) => {
|
|
|
updateSelectedArr()
|
|
|
|
|
|
// 更新全选状态
|