优化直转申请时附件上传问题

This commit is contained in:
BianLzhaoMin 2025-03-24 15:33:19 +08:00
parent be71adf543
commit 95df0be1cc
1 changed files with 959 additions and 903 deletions

View File

@ -133,6 +133,7 @@
:file-list="maForm.dirUrls"
:show-file-list="true"
:auto-upload="true"
:headers="headers"
:key="uploadKey"
:limit="3"
list-type="picture-card"
@ -145,13 +146,22 @@
>
<!-- 文件格式下载图片格式预览 -->
<div slot="file" slot-scope="{ file }">
<img v-if="isImage(file)" class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
<img
v-if="isImage(file)"
class="el-upload-list__item-thumbnail"
:src="file.url"
alt=""
/>
<div v-else class="picture-card-container">
<img class="picture-card" :src="urlTemp" alt="" />
<p class="file-name">{{ file.name }}</p>
</div>
<span class="el-upload-list__item-actions">
<span v-if="updataIf(file)" class="el-upload-list__item-delete" @click="handleDownload(file)">
<span
v-if="updataIf(file)"
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download" />
</span>
<span v-else class="el-upload-list__item-preview" @click="picturePreviewFbs(file)">
@ -193,7 +203,12 @@
<el-form-item label="规格型号" prop="typeId">
<el-select v-model="queryParams.typeId" placeholder="请选择规格型号" clearable filterable>
<el-option v-for="item in typeModelNameOpts" :key="item.typeId" :label="item.name" :value="item.typeId" />
<el-option
v-for="item in typeModelNameOpts"
:key="item.typeId"
:label="item.name"
:value="item.typeId"
/>
</el-select>
</el-form-item>
<el-form-item label="关键字" prop="keyWord">
@ -209,10 +224,23 @@
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleSave" v-if="!isDetail">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleSave"
v-if="!isDetail"
>
{{ isEdit ? '保存' : '发起申请' }}
</el-button>
<el-button type="primary" plain icon="el-icon-arrow-left" size="mini" @click="handleApplyRecord">
<el-button
type="primary"
plain
icon="el-icon-arrow-left"
size="mini"
@click="handleApplyRecord"
>
直转记录查看
</el-button>
</el-form-item>
@ -220,7 +248,12 @@
</el-row>
</el-form>
<el-table v-loading="loading" ref="equipmentList" :data="equipmentList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
ref="equipmentList"
:data="equipmentList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" label="序号" type="index" width="55" />
<el-table-column
@ -260,6 +293,7 @@ import { getListProject, getListUnite, getAgreement } from '@/api/lease/apply'
import { getUseringData, receiveSubmit, receiveEdit, receiveDetail, getEquipmentThreeTypes } from '@/api/business/index'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getToken } from '@/utils/auth'
export default {
dicts: ['purchase_task_status'],
@ -421,7 +455,8 @@ export default {
dialogImageUrl: '',
dialogVisible: false,
uploadKey: Date.now(),
uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload' //
uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload', //
headers: { Authorization: 'Bearer ' + getToken() }
}
},
computed: {
@ -702,6 +737,23 @@ export default {
directApplyInfo: this.maForm,
directApplyInfoDetails: this.multipleSelection
}
let fileList = []
if (params.directApplyInfo.dirUrls.length > 0) {
fileList = params.directApplyInfo.dirUrls.map(e => {
if (e.response.code === 200) {
return {
name: e.response.data.name,
url: e.response.data.url,
type: e.response.data.url.substring(
e.response.data.url.lastIndexOf('.') + 1
)
}
}
})
}
params.directApplyInfo.dirUrls = fileList
if (this.isEdit) {
delete params.directApplyInfo.directApplyDetails
console.log('🚀 ~ this.$modal.confirm ~ params:', params)
@ -829,7 +881,11 @@ export default {
handleDownload(file) {
console.log(file)
if (file.status === 'ready') {
downloadFile({ fileName: file.name, fileData: file.raw, fileType: 'application/vnd.ms-excel;charset=utf-8' })
downloadFile({
fileName: file.name,
fileData: file.raw,
fileType: 'application/vnd.ms-excel;charset=utf-8'
})
} else if (file.status === 'success') {
downloadFileData({ fileName: file.name, fileUrl: file.url })
}