业务联单取值有误,项目部材料站站长暂时要,项目部技术员是业务联系单创建人

This commit is contained in:
BianLzhaoMin 2025-07-04 13:36:19 +08:00
parent 3c7c64462e
commit 12a65812af
1 changed files with 88 additions and 82 deletions

View File

@ -167,7 +167,8 @@
<div>说明</div> <div>说明</div>
<div>{{ '第一项目管理部(合肥肥东)' }}</div> <div>{{ '第一项目管理部(合肥肥东)' }}</div>
<div>项目部材料站站长联系人{{ '徐青松' }} {{ '15234213324' }}</div> <div>项目部材料站站长联系人{{ '徐青松' }} {{ '15234213324' }}</div>
<div>项目部技术联系人{{ '杨金勇' }} {{ '17832421245' }}</div> <!-- <div>项目部技术联系人{{ '杨金勇' }} {{ '17832421245' }}</div> -->
<div>项目部技术联系人{{ dialogForm.createBy }} {{ dialogForm.phone }}</div>
<div>领取人员{{ dialogForm.leaseUnit }} {{ dialogForm.leasePerson }}{{ dialogForm.phone }}</div> <div>领取人员{{ dialogForm.leaseUnit }} {{ dialogForm.leasePerson }}{{ dialogForm.phone }}</div>
</div> </div>
@ -263,9 +264,9 @@
<script> <script>
import printJS from 'print-js' import printJS from 'print-js'
import { getLeaseTaskList, deleteLeaseTask, getLeaseTask, getCodePDF } from '@/api/business/index' import { getLeaseTaskList, deleteLeaseTask, getLeaseTask, getCodePDF } from '@/api/business/index'
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas'
import jsPDF from 'jspdf'; import jsPDF from 'jspdf'
import request from "@/utils/request"; import request from '@/utils/request'
export default { export default {
name: 'Index', name: 'Index',
@ -286,7 +287,7 @@ export default {
{ label: '待审核', value: '0' }, { label: '待审核', value: '0' },
{ label: '审核中', value: '6' }, { label: '审核中', value: '6' },
{ label: '已完成', value: '2' }, { label: '已完成', value: '2' },
{ label: '已驳回', value: '3' }, { label: '已驳回', value: '3' }
], ],
total: 0, // total: 0, //
// //
@ -403,34 +404,34 @@ export default {
} }
},*/ },*/
handleExport() { handleExport() {
const formatTime = (date) => { const formatTime = date => {
const year = date.getFullYear(); const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0'); const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0'); const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0'); const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}${month}${day}_${hours}${minutes}${seconds}`; return `${year}${month}${day}_${hours}${minutes}${seconds}`
}; }
const currentTime = formatTime(new Date()); const currentTime = formatTime(new Date())
this.download( this.download(
"/material/leaseTask/exportLeaseRecord", '/material/leaseTask/exportLeaseRecord',
{ ...this.queryParams }, { ...this.queryParams },
`领用记录数据_${currentTime}.xlsx` `领用记录数据_${currentTime}.xlsx`
); )
}, },
// //
print() { print() {
const element = document.getElementById('print-content'); const element = document.getElementById('print-content')
// //
if (!element) { if (!element) {
this.$message.error('未找到要打印的元素'); this.$message.error('未找到要打印的元素')
return; return
} }
this.$modal.loading('正在生成单据,请稍候...'); this.$modal.loading('正在生成单据,请稍候...')
// 使html2canvasDOMcanvas // 使html2canvasDOMcanvas
html2canvas(element, { html2canvas(element, {
@ -438,43 +439,46 @@ export default {
useCORS: true, // useCORS: true, //
allowTaint: true, allowTaint: true,
backgroundColor: '#ffffff' backgroundColor: '#ffffff'
}).then(canvas => { })
.then(canvas => {
// PDF // PDF
const pdf = new jsPDF('p', 'mm', 'a4'); const pdf = new jsPDF('p', 'mm', 'a4')
// canvas // canvas
const imgWidth = 210; // A4(mm) const imgWidth = 210 // A4(mm)
const pageHeight = 297; // A4(mm) const pageHeight = 297 // A4(mm)
const imgHeight = canvas.height * imgWidth / canvas.width; const imgHeight = (canvas.height * imgWidth) / canvas.width
// canvas // canvas
const imgData = canvas.toDataURL('image/jpeg', 1.0); const imgData = canvas.toDataURL('image/jpeg', 1.0)
// PDF // PDF
pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight); pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight)
// PDF // PDF
const fileName = `业务联系单_${this.dialogForm.code || '未命名'}_${new Date().getTime()}.pdf`; const fileName = `业务联系单_${this.dialogForm.code || '未命名'}_${new Date().getTime()}.pdf`
// PDFBlob // PDFBlob
const pdfBlob = pdf.output('blob'); const pdfBlob = pdf.output('blob')
// FormData // FormData
const formData = new FormData(); const formData = new FormData()
formData.append('file', pdfBlob, fileName); formData.append('file', pdfBlob, fileName)
formData.append('id', this.dialogForm.leaseProjectId); formData.append('id', this.dialogForm.leaseProjectId)
// //
this.$modal.closeLoading(); this.$modal.closeLoading()
// API - 使request // API - 使request
request.post('/material/leaseTask/uploadPdf', formData, { request
.post('/material/leaseTask/uploadPdf', formData, {
headers: { headers: {
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
} }
}).then(response => { })
.then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$modal.msgSuccess('单据文件已保存到服务器'); this.$modal.msgSuccess('单据文件已保存到服务器')
// //
printJS({ printJS({
@ -482,12 +486,13 @@ export default {
type: 'html', type: 'html',
scanStyles: false, scanStyles: false,
maxWidth: '1400' maxWidth: '1400'
}); })
} else { } else {
this.$modal.msgError('保存单据文件失败'); this.$modal.msgError('保存单据文件失败')
} }
}).catch(() => { })
this.$modal.msgError('上传单据文件时发生错误'); .catch(() => {
this.$modal.msgError('上传单据文件时发生错误')
// 使 // 使
printJS({ printJS({
@ -495,13 +500,14 @@ export default {
type: 'html', type: 'html',
scanStyles: false, scanStyles: false,
maxWidth: '1400' maxWidth: '1400'
}); })
}); })
}).catch(error => { })
this.$modal.closeLoading(); .catch(error => {
this.$modal.msgError('生成单据时发生错误'); this.$modal.closeLoading()
console.error('生成单据错误:', error); this.$modal.msgError('生成单据时发生错误')
}); console.error('生成单据错误:', error)
})
}, },
// //
async getDialogContent(row) { async getDialogContent(row) {