Showing
2 changed files
with
26 additions
and
10 deletions
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | import VideoModal from './videoModal.vue'; | 36 | import VideoModal from './videoModal.vue'; |
| 37 | import { useModal } from '/@/components/Modal'; | 37 | import { useModal } from '/@/components/Modal'; |
| 38 | import { onMounted } from 'vue'; | 38 | import { onMounted } from 'vue'; |
| 39 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 39 | 40 | ||
| 40 | const props = defineProps({ | 41 | const props = defineProps({ |
| 41 | fromId: { | 42 | fromId: { |
| @@ -57,7 +58,7 @@ | @@ -57,7 +58,7 @@ | ||
| 57 | 58 | ||
| 58 | const [registerModal, { openModal }] = useModal(); | 59 | const [registerModal, { openModal }] = useModal(); |
| 59 | 60 | ||
| 60 | - const [registerTable, { setTableData }] = useTable({ | 61 | + const [registerTable, { setTableData, setProps, setSelectedRowKeys, reload }] = useTable({ |
| 61 | // api: deviceCommandRecordGetQuery, | 62 | // api: deviceCommandRecordGetQuery, |
| 62 | columns: configColumns, | 63 | columns: configColumns, |
| 63 | showTableSetting: true, | 64 | showTableSetting: true, |
| @@ -73,8 +74,23 @@ | @@ -73,8 +74,23 @@ | ||
| 73 | useSearchForm: true, | 74 | useSearchForm: true, |
| 74 | }); | 75 | }); |
| 75 | 76 | ||
| 76 | - const handleTurnVideo = (checked: Boolean, record: Recordable) => { | 77 | + const handleTurnVideo = async (checked: Boolean, record: Recordable) => { |
| 77 | console.log(checked, record, 'record'); | 78 | console.log(checked, record, 'record'); |
| 79 | + setProps({ | ||
| 80 | + loading: true, | ||
| 81 | + }); | ||
| 82 | + setSelectedRowKeys([]); | ||
| 83 | + const newStatus = checked ? 1 : 0; | ||
| 84 | + const { createMessage } = useMessage(); | ||
| 85 | + try { | ||
| 86 | + if (newStatus) createMessage.success('开启成功'); | ||
| 87 | + else createMessage.success('关闭成功'); | ||
| 88 | + } finally { | ||
| 89 | + setProps({ | ||
| 90 | + loading: false, | ||
| 91 | + }); | ||
| 92 | + reload(); | ||
| 93 | + } | ||
| 78 | }; | 94 | }; |
| 79 | 95 | ||
| 80 | const tableList = [ | 96 | const tableList = [ |
| @@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
| 104 | 104 | ||
| 105 | // type 1:放大 2:缩小 | 105 | // type 1:放大 2:缩小 |
| 106 | const handleScale = (type: number) => { | 106 | const handleScale = (type: number) => { |
| 107 | - console, log(type); | 107 | + console.log(type); |
| 108 | }; | 108 | }; |
| 109 | 109 | ||
| 110 | const isPlay = ref<Boolean | null | undefined>(true); | 110 | const isPlay = ref<Boolean | null | undefined>(true); |
| @@ -113,26 +113,26 @@ | @@ -113,26 +113,26 @@ | ||
| 113 | init(); | 113 | init(); |
| 114 | await nextTick(); | 114 | await nextTick(); |
| 115 | // isPlay.value = unref(videoPlayInstance)?.paused(); | 115 | // isPlay.value = unref(videoPlayInstance)?.paused(); |
| 116 | - videoPlayInstance.value.on('loadedmetadata', () => { | 116 | + videoPlayInstance.value?.on('loadedmetadata', () => { |
| 117 | console.log('视频长度'); | 117 | console.log('视频长度'); |
| 118 | }); | 118 | }); |
| 119 | - videoPlayInstance.value.on('waiting', () => { | 119 | + videoPlayInstance.value?.on('waiting', () => { |
| 120 | isPlay.value = false; | 120 | isPlay.value = false; |
| 121 | console.log('视频加载中'); | 121 | console.log('视频加载中'); |
| 122 | }); | 122 | }); |
| 123 | - videoPlayInstance.value.on('play', () => { | 123 | + videoPlayInstance.value?.on('play', () => { |
| 124 | isPlay.value = true; | 124 | isPlay.value = true; |
| 125 | console.log('视频开始播放'); | 125 | console.log('视频开始播放'); |
| 126 | }); | 126 | }); |
| 127 | - videoPlayInstance.value.on('playing', () => { | 127 | + videoPlayInstance.value?.on('playing', () => { |
| 128 | isPlay.value = true; | 128 | isPlay.value = true; |
| 129 | console.log('正在播放'); | 129 | console.log('正在播放'); |
| 130 | }); | 130 | }); |
| 131 | - videoPlayInstance.value.on('pause', () => { | 131 | + videoPlayInstance.value?.on('pause', () => { |
| 132 | isPlay.value = false; | 132 | isPlay.value = false; |
| 133 | console.log('暂停播放'); | 133 | console.log('暂停播放'); |
| 134 | }); | 134 | }); |
| 135 | - videoPlayInstance.value.on('ended', () => { | 135 | + videoPlayInstance.value?.on('ended', () => { |
| 136 | isPlay.value = false; | 136 | isPlay.value = false; |
| 137 | console.log('结束播放'); | 137 | console.log('结束播放'); |
| 138 | }); | 138 | }); |
| @@ -162,7 +162,7 @@ | @@ -162,7 +162,7 @@ | ||
| 162 | <h1>云台控制</h1> | 162 | <h1>云台控制</h1> |
| 163 | 163 | ||
| 164 | <div class="home mt-5"> | 164 | <div class="home mt-5"> |
| 165 | - <Button class="front-sty-center child center" shape="circle" @click="handleClick(5)"> | 165 | + <Button class="front-sty-center child center" shape="circle" @click="handleClick()"> |
| 166 | <PauseOutlined v-if="isPlay" class="child-icon" style="color: #fffbfb" /> | 166 | <PauseOutlined v-if="isPlay" class="child-icon" style="color: #fffbfb" /> |
| 167 | <CaretRightOutlined v-else class="child-icon" style="color: #fffbfb" /> | 167 | <CaretRightOutlined v-else class="child-icon" style="color: #fffbfb" /> |
| 168 | </Button> | 168 | </Button> |