Commit 2baa873bac57514ce29286567de628a407829ec1
1 parent
b2712627
perf: camera manage split mode add pagination
Showing
1 changed file
with
26 additions
and
4 deletions
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | import { PageWrapper } from '/@/components/Page'; |
3 | 3 | import OrganizationIdTree from '../../common/organizationIdTree/src/OrganizationIdTree.vue'; |
4 | 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 | 6 | import { cameraPage } from '/@/api/camera/cameraManager'; |
7 | 7 | import { CameraRecord } from '/@/api/camera/model/cameraModel'; |
8 | 8 | import { videoPlay as VideoPlay } from 'vue3-video-play'; // 引入组件 |
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | page: 1, |
25 | 25 | pageSize: 4, |
26 | 26 | colNumber: 2, |
27 | + total: 0, | |
27 | 28 | }); |
28 | 29 | |
29 | 30 | const options = reactive({ |
... | ... | @@ -66,11 +67,12 @@ |
66 | 67 | const getCameraList = async () => { |
67 | 68 | try { |
68 | 69 | loading.value = true; |
69 | - const { items } = await cameraPage({ | |
70 | - page: 1, | |
70 | + const { items, total } = await cameraPage({ | |
71 | + page: pagination.page, | |
71 | 72 | pageSize: pagination.pageSize, |
72 | 73 | organizationId: unref(organizationId)!, |
73 | 74 | }); |
75 | + pagination.total = total; | |
74 | 76 | cameraList.value = items; |
75 | 77 | console.log({ url: cameraList.value.map((item) => item.videoUrl) }); |
76 | 78 | } catch (error) { |
... | ... | @@ -103,6 +105,10 @@ |
103 | 105 | } |
104 | 106 | }; |
105 | 107 | |
108 | + const handleVideoError = (event) => { | |
109 | + console.log('video happend error', event); | |
110 | + }; | |
111 | + | |
106 | 112 | const [registerDrawer, { openDrawer }] = useDrawer(); |
107 | 113 | |
108 | 114 | const handleAddCamera = () => { |
... | ... | @@ -144,6 +150,17 @@ |
144 | 150 | > |
145 | 151 | <SvgIcon class="text-2xl" prefix="iconfont" name="grid-nine" /> |
146 | 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 | 164 | </div> |
148 | 165 | <div class="flex items-center gap-4"> |
149 | 166 | <div class="flex"> |
... | ... | @@ -168,7 +185,12 @@ |
168 | 185 | > |
169 | 186 | <div class="box-border w-full h-full p-3"> |
170 | 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 | 194 | <div |
173 | 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 | > | ... | ... |