This commit is contained in:
bb_pan 2025-12-15 17:51:13 +08:00
parent b478676799
commit cd1b564b91
4 changed files with 138 additions and 40 deletions

View File

@ -1107,7 +1107,7 @@ export default {
}
.el-row:first-child {
margin-bottom: 16px;
margin-bottom: 6px;
flex-shrink: 0;
.el-col {

View File

@ -793,7 +793,7 @@ export default {
}
.el-row:first-child {
margin-bottom: 16px;
margin-bottom: 6px;
flex-shrink: 0;
.el-col {

View File

@ -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"

View File

@ -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格式为 docxlspdfjpgjpegpng 的文件
</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;