This commit is contained in:
parent
b478676799
commit
cd1b564b91
|
|
@ -1107,7 +1107,7 @@ export default {
|
|||
}
|
||||
|
||||
.el-row:first-child {
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
|
||||
.el-col {
|
||||
|
|
|
|||
|
|
@ -793,7 +793,7 @@ export default {
|
|||
}
|
||||
|
||||
.el-row:first-child {
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
|
||||
.el-col {
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@
|
|||
</el-date-picker>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下次维保日期" align="center" prop="nextMaintenanceDate" width="160px" />
|
||||
<el-table-column label="剩余使用年限" align="center" prop="remainingYears" width="160px" />
|
||||
<el-table-column label="操作" align="center" v-if="!routerParams.isView">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(row)" style="color: red"
|
||||
|
|
|
|||
|
|
@ -86,13 +86,7 @@
|
|||
<div style="font-size: 20px; font-weight: 800">编码工具台账列表</div>
|
||||
</el-col>
|
||||
|
||||
<el-button
|
||||
icon="el-icon-download"
|
||||
style="margin-left: 1250px"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>
|
||||
<el-button icon="el-icon-download" style="margin-left: 1250px" type="primary" size="mini" @click="handleExport">
|
||||
导出数据
|
||||
</el-button>
|
||||
|
||||
|
|
@ -140,7 +134,6 @@
|
|||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
|
|
@ -279,7 +272,7 @@
|
|||
</div>
|
||||
|
||||
<!-- 附件区域(仅修改这里的图标显示) -->
|
||||
<el-form-item label="附件" prop="fileList">
|
||||
<!-- <el-form-item label="附件" prop="fileList">
|
||||
<div class="custom-file-upload">
|
||||
<el-upload
|
||||
multiple
|
||||
|
|
@ -295,15 +288,15 @@
|
|||
ref="fileUpload"
|
||||
:disabled="isView"
|
||||
>
|
||||
<!-- 上传按钮 -->
|
||||
|
||||
<el-button size="mini" type="primary">选取文件</el-button>
|
||||
<!-- 上传提示 -->
|
||||
|
||||
<div class="el-upload__tip" slot="tip" v-if="showTip">
|
||||
请上传大小不超过5MB格式为 doc、xls、pdf、jpg、jpeg、png 的文件
|
||||
</div>
|
||||
</el-upload>
|
||||
|
||||
<!-- 文件列表(图标统一靠左) -->
|
||||
|
||||
<transition-group name="el-fade-in-linear" tag="ul">
|
||||
<li
|
||||
:key="file.uid"
|
||||
|
|
@ -317,7 +310,7 @@
|
|||
target="_blank"
|
||||
class="file-name-link"
|
||||
>
|
||||
<!-- 图标统一靠左 -->
|
||||
|
||||
<div class="file-icon-container">
|
||||
<img
|
||||
v-if="isPdfFile(file)"
|
||||
|
|
@ -360,7 +353,43 @@
|
|||
</li>
|
||||
</transition-group>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24" :offset="0">
|
||||
<el-form-item label="合格证" prop="certificateList">
|
||||
<FileUpload
|
||||
v-model="dialogForm.certificateList"
|
||||
:value="dialogForm.certificateList"
|
||||
:limit="3"
|
||||
:fileSize="10"
|
||||
:fileType="['jpg', 'png', 'pdf']"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" :offset="0">
|
||||
<el-form-item label="检测证书" prop="inspectionList">
|
||||
<FileUpload
|
||||
v-model="dialogForm.inspectionList"
|
||||
:value="dialogForm.inspectionList"
|
||||
:limit="3"
|
||||
:fileSize="10"
|
||||
:fileType="['jpg', 'png', 'pdf']"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" :offset="0">
|
||||
<el-form-item label="采购发票" prop="purchaseInvoicesList">
|
||||
<FileUpload
|
||||
v-model="dialogForm.purchaseInvoicesList"
|
||||
:value="dialogForm.purchaseInvoicesList"
|
||||
:limit="3"
|
||||
:fileSize="10"
|
||||
:fileType="['jpg', 'png', 'pdf']"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue