This commit is contained in:
@@ -56,20 +56,27 @@
|
||||
>
|
||||
<ElForm ref="createFormRef" :model="createForm" :rules="createRules">
|
||||
<ElFormItem label="CSV文件" prop="file">
|
||||
<VoucherUpload
|
||||
ref="csvUploadRef"
|
||||
v-model="csvFileKeys"
|
||||
voucher-name="CSV文件"
|
||||
:max-count="1"
|
||||
purpose="attachment"
|
||||
:max-size-mb="10"
|
||||
single-column-csv
|
||||
:max-csv-rows="1000"
|
||||
accept=".csv"
|
||||
tip="仅支持 UTF-8 单列 CSV,每行一个订单号,最多 1000 行,最大 10MB"
|
||||
@uploading-change="csvUploading = $event"
|
||||
@files-change="handleCsvFilesChange"
|
||||
/>
|
||||
<div class="csv-upload-field">
|
||||
<div class="template-download-row">
|
||||
<ElButton link type="primary" :icon="Download" @click="downloadTemplate">
|
||||
下载模板
|
||||
</ElButton>
|
||||
</div>
|
||||
<VoucherUpload
|
||||
ref="csvUploadRef"
|
||||
v-model="csvFileKeys"
|
||||
voucher-name="CSV文件"
|
||||
:max-count="1"
|
||||
purpose="attachment"
|
||||
:max-size-mb="10"
|
||||
single-column-csv
|
||||
:max-csv-rows="1000"
|
||||
accept=".csv"
|
||||
tip="仅支持 UTF-8 单列 CSV,每行一个订单号,最多 1000 行,最大 10MB"
|
||||
@uploading-change="csvUploading = $event"
|
||||
@files-change="handleCsvFilesChange"
|
||||
/>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="凭证附件">
|
||||
<VoucherUpload
|
||||
@@ -123,7 +130,7 @@
|
||||
ElMessage,
|
||||
ElTag
|
||||
} from 'element-plus'
|
||||
import { Upload } from '@element-plus/icons-vue'
|
||||
import { Download, Upload } from '@element-plus/icons-vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { OrderPackageInvalidateTaskService } from '@/api/modules'
|
||||
import type {
|
||||
@@ -390,6 +397,21 @@
|
||||
getTableData()
|
||||
}
|
||||
|
||||
const downloadTemplate = () => {
|
||||
try {
|
||||
const link = document.createElement('a')
|
||||
link.href = new URL('@/template/订单批量作废模板.csv', import.meta.url).href
|
||||
link.download = '订单批量作废模板.csv'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
ElMessage.success('模板下载成功')
|
||||
} catch (error) {
|
||||
console.error('下载作废任务模板失败:', error)
|
||||
ElMessage.error('模板下载失败')
|
||||
}
|
||||
}
|
||||
|
||||
const handleCsvFilesChange = (files: Array<{ file_name?: string }>) => {
|
||||
csvFileName.value = files[0]?.file_name || ''
|
||||
createForm.file = csvFileName.value
|
||||
@@ -449,6 +471,16 @@
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.csv-upload-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.template-download-row {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.drawer-footer {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
|
||||
Reference in New Issue
Block a user