格式化代码

This commit is contained in:
guoyue 2022-09-26 16:55:51 +08:00
parent cecba03c6e
commit 653559e727
1 changed files with 93 additions and 80 deletions

View File

@ -315,7 +315,8 @@
openVideo( openVideo(
record.channelCode || record.channelCode ||
record.channelId || record.channelId ||
record.channelCode.channelId, record record.channelCode.channelId,
record
) )
"> ">
预览 预览
@ -344,9 +345,7 @@
<a-button @click="goToApply(record)" type="link" :disabled="record.state != 1"> <a-button @click="goToApply(record)" type="link" :disabled="record.state != 1">
申请 申请
</a-button> </a-button>
<a-button @click="showWrj(record)" type="link"> <a-button @click="showWrj(record)" type="link">详情</a-button>
详情
</a-button>
</template> </template>
</template> </template>
</a-table> </a-table>
@ -355,7 +354,7 @@
<a-modal wrapClassName="single-preview-modal" v-model:visible="visible" title="视频预览" :width="960" destroyOnClose> <a-modal wrapClassName="single-preview-modal" v-model:visible="visible" title="视频预览" :width="960" destroyOnClose>
<template #footer></template> <template #footer></template>
<div style="width: 100%; display: flex; justify-content: center"> <div style="width: 100%; display: flex; justify-content: center">
<div style="width: 100%; height: 100%;position:relative"> <div style="width: 100%; height: 100%; position: relative">
<!-- 预览视频--遮罩 --> <!-- 预览视频--遮罩 -->
<div class="video-cover" @click="videoShowMsg"></div> <div class="video-cover" @click="videoShowMsg"></div>
<vue3VideoPlay v-bind="options" /> <vue3VideoPlay v-bind="options" />
@ -389,7 +388,7 @@
destroyOnClose @cancel="videoClean"> destroyOnClose @cancel="videoClean">
<template #footer></template> <template #footer></template>
<div class="batch-video"> <div class="batch-video">
<div v-for="(item, index) in videoList" :key="item.id" style="width: 100%; height: 100%;position:relative"> <div v-for="(item, index) in videoList" :key="item.id" style="width: 100%; height: 100%; position: relative">
<!-- 批量预览视频--遮罩 --> <!-- 批量预览视频--遮罩 -->
<div class="batch-video-cover" @click="videoShowMsg(index)"></div> <div class="batch-video-cover" @click="videoShowMsg(index)"></div>
<p></p> <p></p>
@ -404,11 +403,11 @@
<div v-for="(db, key) in wrjData" :key="key"> <div v-for="(db, key) in wrjData" :key="key">
<template v-if="typeof db == 'object'"> <template v-if="typeof db == 'object'">
<div style=" <div style="
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
margin: 10px 0; margin: 10px 0;
text-align: center; text-align: center;
"> ">
{{ db.attrType || '--' }} {{ db.attrType || '--' }}
</div> </div>
<template v-if="db.attrValue"> <template v-if="db.attrValue">
@ -436,7 +435,6 @@ import {
nextTick, nextTick,
defineExpose, defineExpose,
computed, computed,
} from 'vue' } from 'vue'
import { import {
getCameraByParentId, getCameraByParentId,
@ -465,7 +463,7 @@ const current = ref(1)
const videoTotal = ref(0) const videoTotal = ref(0)
const router = useRouter() const router = useRouter()
const whoShow1 = ref(whoShow) const whoShow1 = ref(whoShow)
const isXiHaiAn = whoShow1.value.itShowXiHaiAn || true; const isXiHaiAn = whoShow1.value.itShowXiHaiAn || true
const options = reactive({ const options = reactive({
width: '912px', // width: '912px', //
height: '513px', // height: '513px', //
@ -482,16 +480,18 @@ const options = reactive({
ligthOff: false, // ligthOff: false, //
volume: 0.3, // volume: 0.3, //
control: isXiHaiAn ? false : true, // control: isXiHaiAn ? false : true, //
controlBtns: isXiHaiAn ? [] : [ controlBtns: isXiHaiAn
'audioTrack', ? []
'quality', : [
'speedRate', 'audioTrack',
'volume', 'quality',
'setting', 'speedRate',
'pip', 'volume',
'pageFullScreen', 'setting',
'fullScreen', 'pip',
], //, 'pageFullScreen',
'fullScreen',
], //,
}) })
const videoList = ref([]) const videoList = ref([])
let visible = ref(false) // let visible = ref(false) //
@ -635,7 +635,9 @@ const selectedRowKeys = ref([])
const tabList = ref([ const tabList = ref([
{ {
title: '设施类型', title: '设施类型',
content: isXiHaiAn ? ['视频资源'] : ['视频资源', '云资源', '感知资源', '城市云脑会客厅'], content: isXiHaiAn
? ['视频资源']
: ['视频资源', '云资源', '感知资源', '城市云脑会客厅'],
}, },
]) ])
if (!isXiHaiAn) { if (!isXiHaiAn) {
@ -692,7 +694,7 @@ if (whoShow1.value.itShowXiHaiAn) {
const rowClickData = ref(null) const rowClickData = ref(null)
// //
const openVideo = (id, record) => { const openVideo = (id, record) => {
rowClickData.value = record; rowClickData.value = record
console.log('打开视频', id) console.log('打开视频', id)
const param = { const param = {
key: id, key: id,
@ -1075,7 +1077,6 @@ const tabClick = (indexFather, name) => {
if (tabList.value[1]) { if (tabList.value[1]) {
tabList.value[1].title = '视频标签' tabList.value[1].title = '视频标签'
} }
} else if (name == '云资源') { } else if (name == '云资源') {
room.value = true room.value = true
tableHeight.value = 600 tableHeight.value = 600
@ -1188,10 +1189,10 @@ const tabClick = (indexFather, name) => {
wrjFlag.value = false wrjFlag.value = false
emits('add', 3) emits('add', 3)
} else if (name == '无人机') { } else if (name == '无人机') {
pagination.value.current = 1; pagination.value.current = 1
getSoldierData(indexFather, name) getSoldierData(indexFather, name)
} else if (name == '单兵设备') { } else if (name == '单兵设备') {
pagination.value.current = 1; pagination.value.current = 1
getSoldierData(indexFather, name) getSoldierData(indexFather, name)
} else if (name == '城市云脑会客厅') { } else if (name == '城市云脑会客厅') {
showMap.value = false showMap.value = false
@ -1244,7 +1245,7 @@ const wrjStateObj = {
0: '待审批', 0: '待审批',
1: '未申请', 1: '未申请',
2: '通过', 2: '通过',
3: '未通过' 3: '未通过',
} }
// //
const getSoldierData = (indexFather, name) => { const getSoldierData = (indexFather, name) => {
@ -1268,40 +1269,41 @@ const getSoldierData = (indexFather, name) => {
page: pagination.value.current, page: pagination.value.current,
limit: pagination.value.pageSize, limit: pagination.value.pageSize,
} }
getSoldierList(_params).then(res => { getSoldierList(_params)
console.log('res---获取无人机、单兵设备--------->', res); .then((res) => {
if (res.data.code !== 0) { console.log('res---获取无人机、单兵设备--------->', res)
return message.error(res.data.msg) if (res.data.code !== 0) {
} return message.error(res.data.msg)
let { list = [], total = 0 } = res.data.data; }
pagination.value.total = total let { list = [], total = 0 } = res.data.data
if (name == '无人机') { pagination.value.total = total
list.map((wrj) => { if (name == '无人机') {
dataSource2.value.push({ list.map((wrj) => {
wrjName: wrj.name, dataSource2.value.push({
wrjState: wrjStateObj[wrj.state], wrjName: wrj.name,
url: wrj.url, wrjState: wrjStateObj[wrj.state],
details: wrj.details, url: wrj.url,
...wrj details: wrj.details,
...wrj,
})
}) })
}) }
}
if (name == '单兵设备') { if (name == '单兵设备') {
list.map((db) => { list.map((db) => {
dataSource2.value.push({ dataSource2.value.push({
wrjName: db.name, wrjName: db.name,
wrjState: wrjStateObj[db.state], wrjState: wrjStateObj[db.state],
details: db.details, details: db.details,
type: db.type, type: db.type,
...db ...db,
})
}) })
}) }
} })
.catch((err) => {
}).catch(err => { message.error(err)
message.error(err) })
})
} }
// //
const batchPreview = async function (page) { const batchPreview = async function (page) {
@ -1337,16 +1339,18 @@ const batchPreview = async function (page) {
ligthOff: false, // ligthOff: false, //
volume: 0.3, // volume: 0.3, //
control: isXiHaiAn ? false : true, // control: isXiHaiAn ? false : true, //
controlBtns: isXiHaiAn ? [] : [ controlBtns: isXiHaiAn
'audioTrack', ? []
'quality', : [
'speedRate', 'audioTrack',
'volume', 'quality',
'setting', 'speedRate',
'pip', 'volume',
'pageFullScreen', 'setting',
'fullScreen', 'pip',
], //, 'pageFullScreen',
'fullScreen',
], //,
}, },
} }
await getStreamByChannelCode(param).then((res) => { await getStreamByChannelCode(param).then((res) => {
@ -1428,7 +1432,7 @@ const changePage = (page) => { }
const dept = reactive({}) const dept = reactive({})
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
if (infrastructure) { if (infrastructure) {
console.log('infrastructure------------>', infrastructure); console.log('infrastructure------------>', infrastructure)
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
dept.deptId = infrastructure.deptId || '' dept.deptId = infrastructure.deptId || ''
@ -1467,7 +1471,10 @@ const apply = () => {
// } // }
const wrjFlag = ref(false) const wrjFlag = ref(false)
const getCamera = (flag, str) => { const getCamera = (flag, str) => {
console.log('mapSearchParam.value.cameraName------------>', mapSearchParam.value.cameraName); console.log(
'mapSearchParam.value.cameraName------------>',
mapSearchParam.value.cameraName
)
if (flag) { if (flag) {
mapSearchParam.value.cameraName = str mapSearchParam.value.cameraName = str
console.log('赋值===============》', str, mapSearchParam.value) console.log('赋值===============》', str, mapSearchParam.value)
@ -1481,7 +1488,7 @@ const getCamera = (flag, str) => {
pagination.value.total = res.data.count pagination.value.total = res.data.count
}) })
} else { } else {
console.log('mapSearchParam------------>', mapSearchParam); console.log('mapSearchParam------------>', mapSearchParam)
let params = { let params = {
regionId: regionId:
mapSearchParam.value.parentId || '70be8c5b664f4bcf869d82f2e8335051', mapSearchParam.value.parentId || '70be8c5b664f4bcf869d82f2e8335051',
@ -1491,7 +1498,7 @@ const getCamera = (flag, str) => {
longitude: mapSearchParam.value.gpsX || '', longitude: mapSearchParam.value.gpsX || '',
latitude: mapSearchParam.value.gpsY || '', latitude: mapSearchParam.value.gpsY || '',
radius: mapSearchParam.value.radius || '', radius: mapSearchParam.value.radius || '',
name: mapSearchParam.value.cameraName name: mapSearchParam.value.cameraName,
} }
// todo- // todo-
// if ( // if (
@ -1570,21 +1577,21 @@ const columns2 = ref([
title: '名称', title: '名称',
dataIndex: 'wrjName', dataIndex: 'wrjName',
key: 'wrjName', key: 'wrjName',
align: 'center' align: 'center',
}, },
{ {
title: '申请状态', title: '申请状态',
dataIndex: 'wrjState', dataIndex: 'wrjState',
width: '60%', width: '60%',
key: 'wrjState', key: 'wrjState',
align: 'center' align: 'center',
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'operation', dataIndex: 'operation',
width: '20%', width: '20%',
key: 'wrjName', key: 'wrjName',
align: 'center' align: 'center',
}, },
]) ])
// const allClick = ref([]) // const allClick = ref([])
@ -1649,7 +1656,10 @@ const handleTableChange = (val) => {
mapSearchParam.value.pageNum = val.current mapSearchParam.value.pageNum = val.current
mapSearchParam.value.pageSize = val.pageSize mapSearchParam.value.pageSize = val.pageSize
let _arr = clickList.value.filter(v => v.content.includes('单兵设备') || v.content.includes('无人机')) || [] let _arr =
clickList.value.filter(
(v) => v.content.includes('单兵设备') || v.content.includes('无人机')
) || []
let _tab_name = _arr[0] && _arr[0].content && _arr[0].content[0] let _tab_name = _arr[0] && _arr[0].content && _arr[0].content[0]
// //
if (_tab_name) { if (_tab_name) {
@ -1661,12 +1671,15 @@ const handleTableChange = (val) => {
// //
const videoShowMsg = (index) => { const videoShowMsg = (index) => {
let itemData = null; let itemData = null
if (index) { if (index) {
itemData = selectedList.value[index] itemData = selectedList.value[index]
} }
let msg = '请申请后在我的申请中预览视频!' let msg = '请申请后在我的申请中预览视频!'
if ((itemData && itemData.status != 1) || (rowClickData.value && rowClickData.value.status != 1)) { if (
(itemData && itemData.status != 1) ||
(rowClickData.value && rowClickData.value.status != 1)
) {
msg = '当前视频离线不可预览!' msg = '当前视频离线不可预览!'
} else { } else {
msg = '请申请后在我的申请中预览视频!' msg = '请申请后在我的申请中预览视频!'