diff --git a/src/views/EquipmentSharedLease/order/index.vue b/src/views/EquipmentSharedLease/order/index.vue index 5e205a66..08cdf8a2 100644 --- a/src/views/EquipmentSharedLease/order/index.vue +++ b/src/views/EquipmentSharedLease/order/index.vue @@ -1107,7 +1107,7 @@ export default { } .el-row:first-child { - margin-bottom: 16px; + margin-bottom: 6px; flex-shrink: 0; .el-col { diff --git a/src/views/EquipmentSharedOrder/order/index.vue b/src/views/EquipmentSharedOrder/order/index.vue index ebb25eeb..2d7eaad0 100644 --- a/src/views/EquipmentSharedOrder/order/index.vue +++ b/src/views/EquipmentSharedOrder/order/index.vue @@ -793,7 +793,7 @@ export default { } .el-row:first-child { - margin-bottom: 16px; + margin-bottom: 6px; flex-shrink: 0; .el-col { diff --git a/src/views/business/apply/addApply.vue b/src/views/business/apply/addApply.vue index 63158cf8..fd8da66c 100644 --- a/src/views/business/apply/addApply.vue +++ b/src/views/business/apply/addApply.vue @@ -130,6 +130,8 @@ + + 编码工具台账列表 - + 导出数据 @@ -140,7 +134,6 @@ - + + 选取文件 - + 请上传大小不超过5MB格式为 doc、xls、pdf、jpg、jpeg、png 的文件 - + - + - + --> + + + + + + + + + + + + + + + + + + @@ -375,10 +404,12 @@ import { getListCodeApi, getToolSelectApi, updateByIdApi } from '@/api/toolsManage' import { getManufacturerSelectApi } from '@/api/EquipmentLedger' import { getToken } from '@/utils/auth' +import FileUpload from '@/components/FileImageUpload' export default { name: 'CodeToolsLedger', dicts: ['dev_unit_type'], + components: { FileUpload }, data() { return { isLoading: false, @@ -462,13 +493,16 @@ export default { nextCheckDate: '', statusName: '', propertyVoList: [], - fileList: [], // 初始化文件列表为数组 + // fileList: [], // 初始化文件列表为数组 + certificateList: '', + inspectionList: '', + purchaseInvoicesList: '', }, manufacturerSelect: [], // 上传相关配置(从FileUpload组件迁移) uploadFileUrl: process.env.VUE_APP_BASE_API + '/file/upload', // 上传文件服务器地址 headers: { - Authorization: 'Bearer ' + getToken() + Authorization: 'Bearer ' + getToken(), }, fileSize: 5, // 文件大小限制(MB) fileType: ['doc', 'docx', 'xls', 'xlsx', 'pdf', 'jpg', 'jpeg', 'png'], // 允许上传的文件类型 @@ -481,7 +515,6 @@ export default { this.getSelectList() }, methods: { - // 处理图片上传变化 handleImageChange(files) { this.form.mainFileList = files @@ -581,12 +614,15 @@ export default { * 导出数据 */ handleExport() { - this.download('/material-mall/toolLedger/export', { - ...this.queryParams - }, `编码工具台账_${new Date().getTime()}.xlsx`) + this.download( + '/material-mall/toolLedger/export', + { + ...this.queryParams, + }, + `编码工具台账_${new Date().getTime()}.xlsx`, + ) }, - // 获取厂家 async getManufacturerSelect() { try { @@ -623,19 +659,30 @@ export default { propertyValue: '', }) } + + if (this.dialogForm.certificates && this.dialogForm.certificates.length > 0) { + this.dialogForm.certificateList = this.dialogForm.certificates.map((item) => item.fileUrl).join(',') + } + if (this.dialogForm.inspectionReports && this.dialogForm.inspectionReports.length > 0) { + this.dialogForm.inspectionReportList = this.dialogForm.inspectionReports.map((item) => item.fileUrl).join(',') + } + if (this.dialogForm.purchaseInvoices && this.dialogForm.purchaseInvoices.length > 0) { + this.dialogForm.purchaseInvoicesList = this.dialogForm.purchaseInvoices.map((item) => item.fileUrl).join(',') + } // 确保fileList是数组格式 if (!Array.isArray(this.dialogForm.fileList)) { - this.dialogForm.fileList = this.dialogForm.fileList ? - this.dialogForm.fileList.split(',').map(url => ({ - name: url.split('/').pop(), - url: url, - uid: new Date().getTime() + Math.random() - })) : [] + this.dialogForm.fileList = this.dialogForm.fileList + ? this.dialogForm.fileList.split(',').map((url) => ({ + name: url.split('/').pop(), + url: url, + uid: new Date().getTime() + Math.random(), + })) + : [] } else { // 为数组中的文件添加uid - this.dialogForm.fileList = this.dialogForm.fileList.map(file => ({ + this.dialogForm.fileList = this.dialogForm.fileList.map((file) => ({ ...file, - uid: file.uid || new Date().getTime() + Math.random() + uid: file.uid || new Date().getTime() + Math.random(), })) } console.log('🚀 ~ this.dialogForm:', this.dialogForm) @@ -679,7 +726,7 @@ export default { const newFile = { name: res.data.url.split('/').pop(), url: res.data.url, - uid: file.uid + uid: file.uid, } this.dialogForm.fileList.push(newFile) this.$message.success('文件上传成功') @@ -693,13 +740,15 @@ export default { this.$confirm('确定要删除该文件吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this.dialogForm.fileList.splice(index, 1) - this.$message.success('文件删除成功') - }).catch(() => { - // 取消删除 + type: 'warning', }) + .then(() => { + this.dialogForm.fileList.splice(index, 1) + this.$message.success('文件删除成功') + }) + .catch(() => { + // 取消删除 + }) }, // 获取文件名称(从FileUpload组件迁移) getFileName(name) { @@ -734,11 +783,59 @@ export default { console.log('🚀 ~ methods.submit:', this.dialogForm) this.isLoading = true try { + let certificates = [] // 合格证 + let inspectionReports = [] // 验收报告 + let purchaseInvoices = [] // 采购发票 + if (this.dialogForm.certificateList) { + const arr = this.dialogForm.certificateList.split(',') + certificates = arr.map((item) => { + const parts = item.split('/') + return { + fileName: parts[parts.length - 1], + fileUrl: item, + } + }) + console.log('🚀 ~ handleSubmit ~ certificates:', certificates) + } else { + // 提示 + // this.$message.error('请上传合格证') + // return + } + if (this.dialogForm.inspectionList) { + const arr = this.dialogForm.inspectionList.split(',') + inspectionReports = arr.map((item) => { + const parts = item.split('/') + return { + fileName: parts[parts.length - 1], + fileUrl: item, + } + }) + console.log('🚀 ~ handleSubmit ~ inspectionReports:', inspectionReports) + } else { + // 提示 + // this.$message.error('请上传检测证书') + // return + } + if (this.dialogForm.purchaseInvoicesList) { + const arr = this.dialogForm.purchaseInvoicesList.split(',') + purchaseInvoices = arr.map((item) => { + const parts = item.split('/') + return { + fileName: parts[parts.length - 1], + fileUrl: item, + } + }) + console.log('🚀 ~ handleSubmit ~ purchaseInvoices:', purchaseInvoices) + } // 处理文件列表为字符串格式(如果接口需要) const submitForm = { ...this.dialogForm, - fileList: this.dialogForm.fileList.map(file => file.url).join(',') + certificates, + inspectionReports, + purchaseInvoices, + // fileList: this.dialogForm.fileList.map(file => file.url).join(',') } + console.log('🚀 ~ submitForm:', submitForm) await updateByIdApi(submitForm) this.$message({ type: 'success', @@ -810,7 +907,6 @@ export default { // 文件名链接样式 .file-name-link { - color: #606266; overflow: hidden; text-overflow: ellipsis;