微调
This commit is contained in:
@@ -4,6 +4,8 @@ export const requestResourceManageAutoplayFirst = () => {
|
||||
shouldAutoplayFirstVideo = true
|
||||
}
|
||||
|
||||
export const hasPendingResourceManageAutoplayFirst = () => shouldAutoplayFirstVideo
|
||||
|
||||
export const consumeResourceManageAutoplayFirst = () => {
|
||||
if (!shouldAutoplayFirstVideo) return false
|
||||
shouldAutoplayFirstVideo = false
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<span class="node-label">{{ node.label }}</span>
|
||||
<span class="node-actions">
|
||||
<PieChart
|
||||
v-if="isCompletedPlanNode(node.data)"
|
||||
v-if="!isCompareMode && isCompletedPlanNode(node.data)"
|
||||
class="node-action-icon"
|
||||
@click.stop="openStatistics(node.data)"
|
||||
style="margin-right: 8px"
|
||||
@@ -73,7 +73,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { type Plan } from '@/api/plan/interface'
|
||||
import { List, Menu, PieChart, Platform } from '@element-plus/icons-vue'
|
||||
import { nextTick, onMounted, ref, watch } from 'vue'
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useCheckStore } from '@/stores/modules/check'
|
||||
import { ElTooltip } from 'element-plus'
|
||||
@@ -91,6 +91,7 @@ const filterText = ref('')
|
||||
const treeRef = ref()
|
||||
const data: any = ref([])
|
||||
const modeStore = useModeStore()
|
||||
const isCompareMode = computed(() => modeStore.currentMode === '比对式')
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const defaultProps = {
|
||||
|
||||
@@ -464,9 +464,11 @@ const getPieData = async (id: string) => {
|
||||
planName.value = '所选计划:'
|
||||
}
|
||||
|
||||
pieRef1.value.init()
|
||||
pieRef2.value.init()
|
||||
pieRef3.value.init()
|
||||
if (pieRef1.value && pieRef2.value && pieRef3.value) {
|
||||
pieRef1.value.init()
|
||||
pieRef2.value.init()
|
||||
pieRef3.value.init()
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 初始化树组件数据
|
||||
|
||||
@@ -33,13 +33,16 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx" name="resourceManage">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { onActivated, reactive, ref } from 'vue'
|
||||
import { CirclePlus, EditPen, VideoPlay } from '@element-plus/icons-vue'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||
import type { ResourceManage } from '@/api/resourceManage/interface'
|
||||
import { getResourceManageList, getResourceManagePlayUrl } from '@/api/resourceManage'
|
||||
import { consumeResourceManageAutoplayFirst } from '@/utils/resourceManageAutoplay'
|
||||
import {
|
||||
consumeResourceManageAutoplayFirst,
|
||||
hasPendingResourceManageAutoplayFirst
|
||||
} from '@/utils/resourceManageAutoplay'
|
||||
import ResourceManagePopup from './components/resourceManagePopup.vue'
|
||||
import ResourcePlayerDialog from './components/resourcePlayerDialog.vue'
|
||||
|
||||
@@ -51,15 +54,17 @@ const proTable = ref<ProTableInstance>()
|
||||
const resourceManagePopup = ref()
|
||||
const resourcePlayerDialog = ref()
|
||||
|
||||
const tryAutoPlayFirstRecord = async (firstRecord?: ResourceManage.ResResourceManage) => {
|
||||
if (!consumeResourceManageAutoplayFirst()) return
|
||||
if (!firstRecord) return
|
||||
await handlePlay(firstRecord)
|
||||
}
|
||||
|
||||
const getTableList = async (params: ResourceManage.ReqResourceManageParams) => {
|
||||
const response = await getResourceManageList(params)
|
||||
const firstRecord = response.data.records?.[0]
|
||||
|
||||
if (consumeResourceManageAutoplayFirst()) {
|
||||
if (firstRecord) {
|
||||
await handlePlay(firstRecord)
|
||||
}
|
||||
}
|
||||
await tryAutoPlayFirstRecord(firstRecord)
|
||||
|
||||
return response
|
||||
}
|
||||
@@ -146,4 +151,16 @@ const handlePlay = async (row: ResourceManage.ResResourceManage) => {
|
||||
const { data } = await getResourceManagePlayUrl(row.id)
|
||||
resourcePlayerDialog.value?.open(normalizeStreamUrl(data.url))
|
||||
}
|
||||
|
||||
onActivated(async () => {
|
||||
if (!hasPendingResourceManageAutoplayFirst()) return
|
||||
|
||||
const currentFirstRecord = proTable.value?.tableData?.[0] as ResourceManage.ResResourceManage | undefined
|
||||
if (currentFirstRecord) {
|
||||
await tryAutoPlayFirstRecord(currentFirstRecord)
|
||||
return
|
||||
}
|
||||
|
||||
await proTable.value?.getTableList?.()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user