瀏覽代碼

Merge branch 'develop' of gitadmin/tuoheng_pilot_web into release

tags/v1.0.0
zhangtao 2 年之前
父節點
當前提交
16742f5fbf
共有 3 個檔案被更改,包括 73 行新增19 行删除
  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 查看文件

@@ -7,6 +7,7 @@
class="upload"
@before-upload="beforeUpload"
@change="handleChange"
@remove="handleRemove"
>
<n-button>
<n-icon>
@@ -108,6 +109,14 @@ const handleChange = ({ fileList }) => {
handleUploadReady() // 准备上传文件
}

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

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

+ 54
- 15
src/views/task-manage/components/DrawComp.vue 查看文件

@@ -100,7 +100,7 @@
<div v-if="current === 4" 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 :label="it.label">
<n-descriptions-item v-if="it?.isLive !== data.isLive" :label="it.label">
{{ it.value }}
</n-descriptions-item>
</template>
@@ -108,22 +108,35 @@
<n-button v-if="roleId === data.flightHandId" type="Error" class="btn" @click="endFly">结束飞行</n-button>
</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 class="title">飞行文件</div>

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

@@ -135,6 +148,7 @@
:btn-name="'轨迹'"
:limit="1"
:default-list="data.srtUrl"
class="upload"
/>
<fileOss
v-if="data.photographyWay === 2"
@@ -144,6 +158,7 @@
:show-upload-btn="true"
:limit="9"
:default-list="data.orthoUrl"
class="upload"
@upload-status="statusfile"
/>
<fileOss
@@ -154,6 +169,7 @@
:btn-name="'倾斜影像'"
:limit="9"
:default-list="data.inclinedUrl"
class="upload"
@upload-status="statusfile"
/>

@@ -168,7 +184,7 @@
</template>

<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 { distributionPilot, pilotOrder, pilotStart, pilotEnd, uploadFlightUrl } from '@/api/task/index.js'
import { form, getPilotList, getEquipment, getEquipmentMount, getCloudMount } from '../tools/drawForm'
@@ -197,7 +213,9 @@ form.userForm = data

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 formRefOrder = ref() // 表格refs - 飞手接单
@@ -313,23 +331,37 @@ const statusfile = async(status, list) => {
}
}

// 视频和文件上传
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
const params = {
id: data.id,
...res,
...srt
...videoVal.value,
...srtVal.value
}
console.log(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>
@@ -399,4 +431,11 @@ const submitFile = async() => {
text-indent: 2em;
}
}

.upload {

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

+ 8
- 2
src/views/task-manage/tools/table.js 查看文件

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

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

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

Loading…
取消
儲存