:file-list="fileList" | :file-list="fileList" | ||||
:default-upload="false" | :default-upload="false" | ||||
list-type="image-card" | list-type="image-card" | ||||
:show-remove-button="remBtn" | |||||
@change="handleChange" | @change="handleChange" | ||||
@before-upload="beforeUpload" | @before-upload="beforeUpload" | ||||
> | > | ||||
defaultList: { | defaultList: { | ||||
type: String, | type: String, | ||||
default: '' | default: '' | ||||
}, | |||||
remBtn: { | |||||
type: Boolean, | |||||
default: false | |||||
} | } | ||||
}, | }, | ||||
emits: ['uploadStatus'], | emits: ['uploadStatus'], |
require-mark-placement="left" | require-mark-placement="left" | ||||
> | > | ||||
<n-form-item label="横幅图片" path="cover"> | <n-form-item label="横幅图片" path="cover"> | ||||
<UploadOss ref="ossRefs" :default-list="initUpload" @upload-status="handleUploadStatus" /> | |||||
<UploadOss ref="ossRefs" :rem-btn="type !== 'preview'" :default-list="initUpload" @upload-status="handleUploadStatus" /> | |||||
</n-form-item> | </n-form-item> | ||||
<!-- <n-form-item label="排序" path="sort"> | <!-- <n-form-item label="排序" path="sort"> | ||||
<n-input-number v-model:value="form.sort" clearable /> | <n-input-number v-model:value="form.sort" clearable /> | ||||
} else { | } else { | ||||
data.initUpload = '' | data.initUpload = '' | ||||
} | } | ||||
}) | |||||
}, { immediate: true }) | |||||
const getModalOptions = computed(() => { | const getModalOptions = computed(() => { | ||||
return { | return { | ||||
}) | }) | ||||
function handleUploadStatus(status) { | function handleUploadStatus(status) { | ||||
console.log(status) | |||||
data.form.cover = status | data.form.cover = status | ||||
} | } | ||||
const formRef = ref() | const formRef = ref() | ||||
const ossRefs = ref() | const ossRefs = ref() | ||||
function handleConfirm() { | function handleConfirm() { | ||||
console.log(ossRefs.value) | |||||
if (props.type !== 'preview') { | if (props.type !== 'preview') { | ||||
formRef.value?.validate((errors) => { | formRef.value?.validate((errors) => { | ||||
if (!errors) { | if (!errors) { | ||||
const imageStr = response.join() | const imageStr = response.join() | ||||
const params = { | const params = { | ||||
...data.form, | ...data.form, | ||||
cover: imageStr[0] | |||||
conver: imageStr[0] | |||||
} | } | ||||
if (params.id) { | if (params.id) { | ||||
/* 编辑 */ | /* 编辑 */ |
{ | { | ||||
title: '序号', | title: '序号', | ||||
key: 'key', | key: 'key', | ||||
width: 180, | |||||
render: (_, index) => { | render: (_, index) => { | ||||
return `${index + 1}` | return `${index + 1}` | ||||
}, | }, | ||||
render(row) { | render(row) { | ||||
return h(TableImage, { | return h(TableImage, { | ||||
images: { | images: { | ||||
width: 36, | |||||
height: 36, | |||||
width: 119, | |||||
height: 51, | |||||
src: row.cover | src: row.cover | ||||
// previewDisabled: true // 禁止点击预览 | |||||
} | } | ||||
}) | }) | ||||
} | } | ||||
title: '上传人', | title: '上传人', | ||||
key: 'updateUser', | key: 'updateUser', | ||||
align: 'center', | align: 'center', | ||||
width: 160 | |||||
width: 200 | |||||
}, | }, | ||||
{ | { | ||||
title: '上传时间', | title: '上传时间', | ||||
key: 'updateTime', | key: 'updateTime', | ||||
align: 'center', | align: 'center', | ||||
width: 160 | |||||
width: 220 | |||||
}, | }, | ||||
{ | { | ||||
title: '操作', | title: '操作', | ||||
align: 'center', | align: 'center', | ||||
width: 150, | |||||
width: 220, | |||||
fixed: 'right', | fixed: 'right', | ||||
render(row) { | render(row) { | ||||
return h(TableAction, { | return h(TableAction, { |
<div v-if="current !== 1" class="cont"> | <div v-if="current !== 1" 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 flyInfo" :key="i + it.label"> | <template v-for="(it, i) in flyInfo" :key="i + it.label"> | ||||
<n-descriptions-item v-if="current !== it?.current" :label="it.label"> | |||||
<n-descriptions-item v-if="!it?.current || current >= it?.current" :label="it.label"> | |||||
{{ it.value }} | {{ it.value }} | ||||
</n-descriptions-item> | </n-descriptions-item> | ||||
</template> | </template> |
<!-- 详情 - 抽屉 --> | <!-- 详情 - 抽屉 --> | ||||
<n-drawer v-model:show="showDraw" :width="'calc(100vw - 210px)'" :placement="'right'" resizable> | <n-drawer v-model:show="showDraw" :width="'calc(100vw - 210px)'" :placement="'right'" resizable> | ||||
<n-drawer-content closable> | <n-drawer-content closable> | ||||
<draw-comp :detail="detail" @close="showDraw = false" /> | |||||
<draw-comp :detail="detail" @close="showDraw = false;handleSearch()" /> | |||||
</n-drawer-content> | </n-drawer-content> | ||||
</n-drawer> | </n-drawer> | ||||
...toRefs(table), | ...toRefs(table), | ||||
...toRefs(search) | ...toRefs(search) | ||||
}) | }) | ||||
const status = ['任务待分配', '任务已分配', '飞手已接单', '任务飞行中', '任务已完成'] | |||||
const loadDataTable = async(res) => { | const loadDataTable = async(res) => { | ||||
const _params = { | const _params = { | ||||
...unref(data.searchParams), | ...unref(data.searchParams), | ||||
...res | ...res | ||||
} | } | ||||
return await getTaskList(_params) | |||||
const temp = await getTaskList(_params) | |||||
// 将状态由数字改成文字 | |||||
temp.data.records = temp.data.records.map(it => ({ | |||||
...it, | |||||
statusName: status[(it.status / 5) - 1] | |||||
})) | |||||
return temp | |||||
} | } | ||||
// 新增 | // 新增 | ||||
function handleModal() { | function handleModal() { |
}, | }, | ||||
{ | { | ||||
title: '任务状态', | title: '任务状态', | ||||
key: 'status', | |||||
key: 'statusName', | |||||
align: 'center' | align: 'center' | ||||
}, | }, | ||||
{ | { | ||||
props: { | props: { | ||||
type: 'primary', | type: 'primary', | ||||
text: true, | text: true, | ||||
onClick: editHandle.bind(null, row, 'update') | |||||
onClick: editHandle.bind(null, row, 'update'), | |||||
style: { | |||||
display: row.status > 10 ? 'none' : '' | |||||
} | |||||
}, | }, | ||||
auth: 'basic_list' | auth: 'basic_list' | ||||
}, | }, | ||||
}, | }, | ||||
ButtonProps: { | ButtonProps: { | ||||
text: true, | text: true, | ||||
type: 'primary' | |||||
type: 'primary', | |||||
style: { | |||||
display: row.status > 10 ? 'none' : '' | |||||
} | |||||
} | } | ||||
} | } | ||||
], | ], |