Browse Source

Merge branch 'develop' of gitadmin/tuoheng_pilot_web into release

tags/v1.0.0
zhangtao 2 years ago
parent
commit
16742f5fbf
3 changed files with 73 additions and 19 deletions
  1. +11
    -2
      src/components/UploadVod/index.vue
  2. +54
    -15
      src/views/task-manage/components/DrawComp.vue
  3. +8
    -2
      src/views/task-manage/tools/table.js

+ 11
- 2
src/components/UploadVod/index.vue View File

class="upload" class="upload"
@before-upload="beforeUpload" @before-upload="beforeUpload"
@change="handleChange" @change="handleChange"
@remove="handleRemove"
> >
<n-button> <n-button>
<n-icon> <n-icon>
handleUploadReady() // 准备上传文件 handleUploadReady() // 准备上传文件
} }


// 删除文件时
const handleRemove = ({ fileList }) => {
const list = data.uploader.listFiles()
for (var i = 0; i < list.length; i++) {
data.uploader.cancelFile(i)
}
}

/** /**
* @description: 创建上传的实例化对象 * @description: 创建上传的实例化对象
* @param {*} * @param {*}
const fileName = uploadInfo.file.name const fileName = uploadInfo.file.name
data.fileList.forEach((item) => { data.fileList.forEach((item) => {
if (item.name === fileName) { if (item.name === fileName) {
data.readyFile.url = '/' + uploadInfo.object
data.readyFile.videoUrl = '/' + uploadInfo.object
data.readyFile.videoId = uploadInfo.videoId data.readyFile.videoId = uploadInfo.videoId
} }
}) })
if (!Object.keys(data.readyFile).includes(item.uid)) { if (!Object.keys(data.readyFile).includes(item.uid)) {
const obj = { const obj = {
name: item.name, name: item.name,
url: '',
videoUrl: '',
videoId: '' videoId: ''
} }
data.readyFile = obj data.readyFile = obj

+ 54
- 15
src/views/task-manage/components/DrawComp.vue View File

<div v-if="current === 4" class="cont"> <div v-if="current === 4" class="cont">
<n-descriptions label-placement="left" label-align="right" :column="4" title="设备/影像基本信息"> <n-descriptions label-placement="left" label-align="right" :column="4" title="设备/影像基本信息">
<template v-for="(it, i) in executionInfo" :key="i + it.label"> <template v-for="(it, i) in executionInfo" :key="i + it.label">
<n-descriptions-item :label="it.label">
<n-descriptions-item v-if="it?.isLive !== data.isLive" :label="it.label">
{{ it.value }} {{ it.value }}
</n-descriptions-item> </n-descriptions-item>
</template> </template>
<n-button v-if="roleId === data.flightHandId" type="Error" class="btn" @click="endFly">结束飞行</n-button> <n-button v-if="roleId === data.flightHandId" type="Error" class="btn" @click="endFly">结束飞行</n-button>
</div> </div>


<!-- 设备/影响基本信息 - 执行中: 管理员 -->
<div v-if="current === 5" class="cont">
<n-descriptions label-placement="left" label-align="right" :column="4" title="设备/影像基本信息">
<template v-for="(it, i) in executionInfo" :key="i + it.label">
<n-descriptions-item v-if="it?.isLive !== data.isLive" :label="it.label">
{{ it.value }}
</n-descriptions-item>
</template>
</n-descriptions>
</div>

<div v-if="current === 5" class="cont"> <div v-if="current === 5" class="cont">
<div class="title">飞行文件</div> <div class="title">飞行文件</div>


<UploadVod <UploadVod
v-if="data.photographyWay === 1 && roleId === data.flightHandId"
v-if="data.photographyWay === 1 && !data.videoUrl"
ref="videoRefs" ref="videoRefs"
:upload-name="'视频'" :upload-name="'视频'"
:limit="1" :limit="1"
class="upload"
@upload-status="vodStatusVideo" @upload-status="vodStatusVideo"
/> />
<fileOss <fileOss
v-if="data.photographyWay === 1 && roleId !== data.flightHandId"
v-if="data.photographyWay === 1 && data.videoUrl"
:file-type="'video'" :file-type="'video'"
:btn-name="'视频'" :btn-name="'视频'"
:limit="1" :limit="1"
:default-list="data.videoUrl" :default-list="data.videoUrl"
class="upload"
@upload-status="vodStatusVideo" @upload-status="vodStatusVideo"
/> />


:btn-name="'轨迹'" :btn-name="'轨迹'"
:limit="1" :limit="1"
:default-list="data.srtUrl" :default-list="data.srtUrl"
class="upload"
/> />
<fileOss <fileOss
v-if="data.photographyWay === 2" v-if="data.photographyWay === 2"
:show-upload-btn="true" :show-upload-btn="true"
:limit="9" :limit="9"
:default-list="data.orthoUrl" :default-list="data.orthoUrl"
class="upload"
@upload-status="statusfile" @upload-status="statusfile"
/> />
<fileOss <fileOss
:btn-name="'倾斜影像'" :btn-name="'倾斜影像'"
:limit="9" :limit="9"
:default-list="data.inclinedUrl" :default-list="data.inclinedUrl"
class="upload"
@upload-status="statusfile" @upload-status="statusfile"
/> />


</template> </template>


<script setup name="DrawComp"> <script setup name="DrawComp">
import { ref, defineProps, reactive, defineEmits, watchEffect } from 'vue'
import { ref, defineProps, reactive, defineEmits, watch } from 'vue'
import { TASK_STATUS } from '@/utils/dictionary' import { TASK_STATUS } from '@/utils/dictionary'
import { distributionPilot, pilotOrder, pilotStart, pilotEnd, uploadFlightUrl } from '@/api/task/index.js' import { distributionPilot, pilotOrder, pilotStart, pilotEnd, uploadFlightUrl } from '@/api/task/index.js'
import { form, getPilotList, getEquipment, getEquipmentMount, getCloudMount } from '../tools/drawForm' import { form, getPilotList, getEquipment, getEquipmentMount, getCloudMount } from '../tools/drawForm'


const current = data.pilotStatus / 5 // 当前状态 const current = data.pilotStatus / 5 // 当前状态


const roleId = useUserStore().userInfo.id || '管理员id:00a5a13322fc088cc1c4ba4c40d22fcs'
const roleId = useUserStore().userInfo.id || '00a5a13322fc088cc1c4ba4c40d22fcs' // 默认为管理员id
// const roleId = '00a5a13322fc088cc1c4ba4c40d22fcs' // 调试id
console.log(roleId, data.flightHandId) // 调试id


const formRef = ref() // 表格refs - 分配飞手 const formRef = ref() // 表格refs - 分配飞手
const formRefOrder = ref() // 表格refs - 飞手接单 const formRefOrder = ref() // 表格refs - 飞手接单
} }
} }


// 视频和文件上传
const submitFile = async() => {
loading.value = true
const res = videoRefs.value.handleUploadStart()
const srt = await srtRefs.value?.startUpload()
if (res?.videoId && srt?.srtUrl) {
// watch(() => [videoRefs.value?.data?.fileList, srtRefs.value?.fileList], ([val1, val2]) => {
// if (data.flightHandId === roleId) {
// if (Object.keys(val1).length === 0 && Object.keys(val2).length === 0) {
// loading.value = false
// }
// }
// })
const videoVal = ref({})
const srtVal = ref({})

watch(() => [videoVal.value.videoId, srtVal.value], async([val1, val2]) => {
if (val1 && Object.keys(val2).length !== 0) {
loading.value = false loading.value = false
const params = { const params = {
id: data.id, id: data.id,
...res,
...srt
...videoVal.value,
...srtVal.value
} }
console.log(params) console.log(params)
await uploadFlightUrl(params) await uploadFlightUrl(params)
} else {
loading.value = false
} }
})

// 视频和文件上传
const submitFile = async() => {
if (Object.keys(videoRefs.value.data.fileList).length === 0 ||
Object.keys(srtRefs.value.fileList).length === 0) return

loading.value = true
videoVal.value = videoRefs.value.handleUploadStart()
srtVal.value = await srtRefs.value?.startUpload()
} }


</script> </script>
text-indent: 2em; text-indent: 2em;
} }
} }

.upload {

:deep(.n-button__icon) {
display: none; // 隐藏删除按钮
}
}
</style> </style>

+ 8
- 2
src/views/task-manage/tools/table.js View File

import { h, ref, reactive } from 'vue' import { h, ref, reactive } from 'vue'
import TableAction from '@/components/DataTable/tools/Action.vue' import TableAction from '@/components/DataTable/tools/Action.vue'
import { getTaskInfo, taskDel } from '@/api/task' import { getTaskInfo, taskDel } from '@/api/task'
import { useUserStore } from '@/store/modules/user'

const roleType = ref(null)
setTimeout(() => {
roleType.value = useUserStore().userInfo.type
})


/* 注册table */ /* 注册table */
const tableRef = ref() const tableRef = ref()
text: true, text: true,
onClick: editHandle.bind(null, row, 'update'), onClick: editHandle.bind(null, row, 'update'),
style: { style: {
display: row.status > 10 || row.inspectionType !== 1 ? 'none' : ''
display: row.status > 10 || row.inspectionType !== 1 || roleType.value !== 1 ? 'none' : ''
} }
}, },
auth: 'basic_list' auth: 'basic_list'
text: true, text: true,
type: 'primary', type: 'primary',
style: { style: {
display: row.status > 10 || row.inspectionType !== 1 ? 'none' : ''
display: row.status > 15 || row.inspectionType !== 1 || roleType.value !== 1 ? 'none' : ''
} }
} }
} }

Loading…
Cancel
Save