Commit 2baa873bac57514ce29286567de628a407829ec1

Authored by ww
1 parent b2712627

perf: camera manage split mode add pagination

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 import { PageWrapper } from '/@/components/Page'; 2 import { PageWrapper } from '/@/components/Page';
3 import OrganizationIdTree from '../../common/organizationIdTree/src/OrganizationIdTree.vue'; 3 import OrganizationIdTree from '../../common/organizationIdTree/src/OrganizationIdTree.vue';
4 import { computed, onMounted, reactive, ref, unref, watch } from 'vue'; 4 import { computed, onMounted, reactive, ref, unref, watch } from 'vue';
5 - import { Tabs, Row, Col, Spin, Button } from 'ant-design-vue'; 5 + import { Tabs, Row, Col, Spin, Button, Pagination } from 'ant-design-vue';
6 import { cameraPage } from '/@/api/camera/cameraManager'; 6 import { cameraPage } from '/@/api/camera/cameraManager';
7 import { CameraRecord } from '/@/api/camera/model/cameraModel'; 7 import { CameraRecord } from '/@/api/camera/model/cameraModel';
8 import { videoPlay as VideoPlay } from 'vue3-video-play'; // 引入组件 8 import { videoPlay as VideoPlay } from 'vue3-video-play'; // 引入组件
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 page: 1, 24 page: 1,
25 pageSize: 4, 25 pageSize: 4,
26 colNumber: 2, 26 colNumber: 2,
  27 + total: 0,
27 }); 28 });
28 29
29 const options = reactive({ 30 const options = reactive({
@@ -66,11 +67,12 @@ @@ -66,11 +67,12 @@
66 const getCameraList = async () => { 67 const getCameraList = async () => {
67 try { 68 try {
68 loading.value = true; 69 loading.value = true;
69 - const { items } = await cameraPage({  
70 - page: 1, 70 + const { items, total } = await cameraPage({
  71 + page: pagination.page,
71 pageSize: pagination.pageSize, 72 pageSize: pagination.pageSize,
72 organizationId: unref(organizationId)!, 73 organizationId: unref(organizationId)!,
73 }); 74 });
  75 + pagination.total = total;
74 cameraList.value = items; 76 cameraList.value = items;
75 console.log({ url: cameraList.value.map((item) => item.videoUrl) }); 77 console.log({ url: cameraList.value.map((item) => item.videoUrl) });
76 } catch (error) { 78 } catch (error) {
@@ -103,6 +105,10 @@ @@ -103,6 +105,10 @@
103 } 105 }
104 }; 106 };
105 107
  108 + const handleVideoError = (event) => {
  109 + console.log('video happend error', event);
  110 + };
  111 +
106 const [registerDrawer, { openDrawer }] = useDrawer(); 112 const [registerDrawer, { openDrawer }] = useDrawer();
107 113
108 const handleAddCamera = () => { 114 const handleAddCamera = () => {
@@ -144,6 +150,17 @@ @@ -144,6 +150,17 @@
144 > 150 >
145 <SvgIcon class="text-2xl" prefix="iconfont" name="grid-nine" /> 151 <SvgIcon class="text-2xl" prefix="iconfont" name="grid-nine" />
146 </div> 152 </div>
  153 + <div>
  154 + <Pagination
  155 + v-model:current="pagination.page"
  156 + :total="pagination.total"
  157 + :page-size="pagination.pageSize"
  158 + :show-size-changer="false"
  159 + @change="getCameraList"
  160 + size="small"
  161 + :show-total="(total) => `共 ${total} 条`"
  162 + />
  163 + </div>
147 </div> 164 </div>
148 <div class="flex items-center gap-4"> 165 <div class="flex items-center gap-4">
149 <div class="flex"> 166 <div class="flex">
@@ -168,7 +185,12 @@ @@ -168,7 +185,12 @@
168 > 185 >
169 <div class="box-border w-full h-full p-3"> 186 <div class="box-border w-full h-full p-3">
170 <div class="bg-yellow-50 w-full h-full overflow-hidden relative"> 187 <div class="bg-yellow-50 w-full h-full overflow-hidden relative">
171 - <VideoPlay v-bind="options" :src="item.videoUrl" :title="item.name" /> 188 + <VideoPlay
  189 + @error="handleVideoError"
  190 + v-bind="options"
  191 + :src="item.videoUrl"
  192 + :title="item.name"
  193 + />
172 <div 194 <div
173 class="absolute hidden top-0 left-0 z-50 bg-gray-200 text-lg w-full h-full flex justify-center items-center" 195 class="absolute hidden top-0 left-0 z-50 bg-gray-200 text-lg w-full h-full flex justify-center items-center"
174 > 196 >