业务联单取值有误,项目部材料站站长暂时要,项目部技术员是业务联系单创建人
This commit is contained in:
parent
3c7c64462e
commit
12a65812af
|
|
@ -24,12 +24,12 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="taskStatus">
|
||||
<el-select v-model="queryParams.taskStatus" placeholder="请选择审核状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.lease_apply_task_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option
|
||||
v-for="dict in dict.type.lease_apply_task_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
>
|
||||
<!-- 插槽 -->
|
||||
<template v-slot="scope" v-if="column.prop == 'taskStatus'">
|
||||
<dict-tag :options="dict.type.lease_apply_task_status" :value="scope.row.taskStatus"/>
|
||||
<dict-tag :options="dict.type.lease_apply_task_status" :value="scope.row.taskStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作 -->
|
||||
|
|
@ -167,7 +167,8 @@
|
|||
<div>说明:</div>
|
||||
<div>{{ '第一项目管理部(合肥肥东)' }}:</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>
|
||||
|
||||
|
|
@ -263,9 +264,9 @@
|
|||
<script>
|
||||
import printJS from 'print-js'
|
||||
import { getLeaseTaskList, deleteLeaseTask, getLeaseTask, getCodePDF } from '@/api/business/index'
|
||||
import html2canvas from 'html2canvas';
|
||||
import jsPDF from 'jspdf';
|
||||
import request from "@/utils/request";
|
||||
import html2canvas from 'html2canvas'
|
||||
import jsPDF from 'jspdf'
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
name: 'Index',
|
||||
|
|
@ -286,7 +287,7 @@ export default {
|
|||
{ label: '待审核', value: '0' },
|
||||
{ label: '审核中', value: '6' },
|
||||
{ label: '已完成', value: '2' },
|
||||
{ label: '已驳回', value: '3' },
|
||||
{ label: '已驳回', value: '3' }
|
||||
],
|
||||
total: 0, // 总条数
|
||||
// 表头
|
||||
|
|
@ -403,34 +404,34 @@ export default {
|
|||
}
|
||||
},*/
|
||||
handleExport() {
|
||||
const formatTime = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
|
||||
};
|
||||
const formatTime = date => {
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
const hours = String(date.getHours()).padStart(2, '0')
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0')
|
||||
return `${year}${month}${day}_${hours}${minutes}${seconds}`
|
||||
}
|
||||
|
||||
const currentTime = formatTime(new Date());
|
||||
const currentTime = formatTime(new Date())
|
||||
this.download(
|
||||
"/material/leaseTask/exportLeaseRecord",
|
||||
'/material/leaseTask/exportLeaseRecord',
|
||||
{ ...this.queryParams },
|
||||
`领用记录数据_${currentTime}.xlsx`
|
||||
);
|
||||
)
|
||||
},
|
||||
// 打印
|
||||
print() {
|
||||
const element = document.getElementById('print-content');
|
||||
const element = document.getElementById('print-content')
|
||||
|
||||
// 确保元素存在
|
||||
if (!element) {
|
||||
this.$message.error('未找到要打印的元素');
|
||||
return;
|
||||
this.$message.error('未找到要打印的元素')
|
||||
return
|
||||
}
|
||||
|
||||
this.$modal.loading('正在生成单据,请稍候...');
|
||||
this.$modal.loading('正在生成单据,请稍候...')
|
||||
|
||||
// 使用html2canvas将DOM元素转换为canvas
|
||||
html2canvas(element, {
|
||||
|
|
@ -438,70 +439,75 @@ export default {
|
|||
useCORS: true, // 允许加载跨域图片
|
||||
allowTaint: true,
|
||||
backgroundColor: '#ffffff'
|
||||
}).then(canvas => {
|
||||
// 创建PDF文档
|
||||
const pdf = new jsPDF('p', 'mm', 'a4');
|
||||
})
|
||||
.then(canvas => {
|
||||
// 创建PDF文档
|
||||
const pdf = new jsPDF('p', 'mm', 'a4')
|
||||
|
||||
// 获取canvas的宽度和高度
|
||||
const imgWidth = 210; // A4纸的宽度(mm)
|
||||
const pageHeight = 297; // A4纸的高度(mm)
|
||||
const imgHeight = canvas.height * imgWidth / canvas.width;
|
||||
// 获取canvas的宽度和高度
|
||||
const imgWidth = 210 // A4纸的宽度(mm)
|
||||
const pageHeight = 297 // A4纸的高度(mm)
|
||||
const imgHeight = (canvas.height * imgWidth) / canvas.width
|
||||
|
||||
// 将canvas转换为图片
|
||||
const imgData = canvas.toDataURL('image/jpeg', 1.0);
|
||||
// 将canvas转换为图片
|
||||
const imgData = canvas.toDataURL('image/jpeg', 1.0)
|
||||
|
||||
// 添加图片到PDF
|
||||
pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight);
|
||||
// 添加图片到PDF
|
||||
pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight)
|
||||
|
||||
// 生成PDF文件名
|
||||
const fileName = `业务联系单_${this.dialogForm.code || '未命名'}_${new Date().getTime()}.pdf`;
|
||||
// 生成PDF文件名
|
||||
const fileName = `业务联系单_${this.dialogForm.code || '未命名'}_${new Date().getTime()}.pdf`
|
||||
|
||||
// 将PDF转换为Blob对象
|
||||
const pdfBlob = pdf.output('blob');
|
||||
// 将PDF转换为Blob对象
|
||||
const pdfBlob = pdf.output('blob')
|
||||
|
||||
// 创建FormData对象用于上传
|
||||
const formData = new FormData();
|
||||
formData.append('file', pdfBlob, fileName);
|
||||
formData.append('id', this.dialogForm.leaseProjectId);
|
||||
// 创建FormData对象用于上传
|
||||
const formData = new FormData()
|
||||
formData.append('file', pdfBlob, fileName)
|
||||
formData.append('id', this.dialogForm.leaseProjectId)
|
||||
|
||||
// 上传到服务器
|
||||
this.$modal.closeLoading();
|
||||
// 上传到服务器
|
||||
this.$modal.closeLoading()
|
||||
|
||||
// 调用上传API - 使用request
|
||||
request.post('/material/leaseTask/uploadPdf', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.$modal.msgSuccess('单据文件已保存到服务器');
|
||||
// 调用上传API - 使用request
|
||||
request
|
||||
.post('/material/leaseTask/uploadPdf', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
if (response.code === 200) {
|
||||
this.$modal.msgSuccess('单据文件已保存到服务器')
|
||||
|
||||
// 上传成功后执行打印
|
||||
printJS({
|
||||
printable: 'print-content',
|
||||
type: 'html',
|
||||
scanStyles: false,
|
||||
maxWidth: '1400'
|
||||
});
|
||||
} else {
|
||||
this.$modal.msgError('保存单据文件失败');
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('上传单据文件时发生错误');
|
||||
// 上传成功后执行打印
|
||||
printJS({
|
||||
printable: 'print-content',
|
||||
type: 'html',
|
||||
scanStyles: false,
|
||||
maxWidth: '1400'
|
||||
})
|
||||
} else {
|
||||
this.$modal.msgError('保存单据文件失败')
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$modal.msgError('上传单据文件时发生错误')
|
||||
|
||||
// 即使上传失败也执行打印
|
||||
printJS({
|
||||
printable: 'print-content',
|
||||
type: 'html',
|
||||
scanStyles: false,
|
||||
maxWidth: '1400'
|
||||
});
|
||||
});
|
||||
}).catch(error => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgError('生成单据时发生错误');
|
||||
console.error('生成单据错误:', error);
|
||||
});
|
||||
// 即使上传失败也执行打印
|
||||
printJS({
|
||||
printable: 'print-content',
|
||||
type: 'html',
|
||||
scanStyles: false,
|
||||
maxWidth: '1400'
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
this.$modal.closeLoading()
|
||||
this.$modal.msgError('生成单据时发生错误')
|
||||
console.error('生成单据错误:', error)
|
||||
})
|
||||
},
|
||||
// 获取弹框内容
|
||||
async getDialogContent(row) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue