Commit 85c7afad authored by 张海景's avatar 张海景

update:修改打印相关逻辑

parent 0aed97ae
......@@ -43,7 +43,10 @@ export function packagePrintRecordInfo(data) {
return request({
url: "/pro/packagePrintRecord/recordPackagePrintInfo",
method: "post",
data: data,
data,
headersheaders: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
}
......@@ -283,15 +283,37 @@ function printPdf(res) {
* responseType: 'blob',
* 接口请求加上responseType
*/
export function postPrintPdf(data) {
export function postPrintPdf(name, value) {
request({
url: "/common/print",
method: "post",
responseType: 'blob',
data
}).then(res => {
printPdf(res)
})
responseType: "blob",
data: {
reportName: "mysql:" + name,
values: value,
},
}).then((res) => {
printPdf(res);
});
}
/**
* 批量打印pdf方法
* responseType: 'blob',
* 接口请求加上responseType
*/
export function postBatchPrintPdf(name, values) {
request({
url: "/common/printBatch",
method: "post",
responseType: "blob",
data: {
reportName: "mysql:" + name,
valueList: values
},
}).then((res) => {
printPdf(res);
});
}
......@@ -228,7 +228,7 @@
<!-- 添加或修改生产BOM对话框 -->
<el-dialog title="选择打印模版" :visible.sync="visible" width="960px" append-to-body>
<templatePrint ref="templatePrintRef" v-if="visible" type="single" :operation="false"></templatePrint>
<templatePrint ref="templatePrintRef" v-if="visible" type="single" reportType='package_label' :operation="false"></templatePrint>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmitPrint">确 定</el-button>
<el-button @click="visible = false">取 消</el-button>
......@@ -240,6 +240,7 @@
<script>
import { workorderList, buildPackagePrint, workorderPackageList, updatePackagePrintRecord, packagePrintRecordInfo } from "@/api/mes/pro/packageLablePrint";
import templatePrint from '@/views/mes/report/index'
import { postBatchPrintPdf } from '@/utils/ruoyi'
export default {
name: 'packageLablePrint',
components: { templatePrint },
......@@ -343,10 +344,15 @@ export default {
return
}
const params = {
workorderId : this.produceForm.workorderId,
recordIds: this.selectPackageTable
}
packagePrintRecordInfo(params).then((response) => {
workorderId : this.produceForm.workorderId,
recordIds: this.selectPackageTable
}
const forms = new FormData()
forms.append('workorderId', this.produceForm.workorderId)
this.selectPackageTable.forEach(item => {
forms.append('recordIds', item.recordId)
})
packagePrintRecordInfo(forms).then((response) => {
console.log(response, 'response')
if (response.code === 200) {
const valueList = response.data.packagePrintList.map(item => {
......@@ -354,10 +360,10 @@ export default {
packagePrint: item
}
})
postPrintPdf({
reportName:"mysql:"+ this.$refs.templatePrintRef.currentData.name,
postBatchPrintPdf(
this.$refs.templatePrintRef.currentData.name,
valueList
}).then(()=> {
).then(()=> {
this.visible = false
this.getPackageList()
})
......
......@@ -165,6 +165,10 @@ export default {
type: String,
default: 'multiple'
},
reportType: {
type: String,
default: ''
},
operation: {
type: Boolean,
default: true
......@@ -218,6 +222,7 @@ export default {
/** 查询模版管理列表 */
getList() {
this.loading = true;
if(this.reportType) this.queryParams.reportType = this.reportType
listReport({...this.queryParams, isPrintTemplate:1}).then(response => {
this.listData = response.rows;
this.total = response.total;
......
......@@ -587,19 +587,26 @@ export default {
printQrCode() {
const qrArr = [];
const qrGp = [];
this.selectRow.forEach(s=>{
postPrintPdf({
"reportName":"mysql:qrcode-50*50-2",
"values":{
"detail": [{
"barcode": s.itemCode +'-'+ s.toolCode,
"gp" : s.itemName+'-'+s.toolCode
}
]
}
});
let detail = []
this.selectRow.forEach((s,i)=>{
detail.push({
"barcode": s.itemCode +'-'+ s.toolCode,
"showText" : s.itemName+'-'+s.toolCode,
"gp": i+1
})
detail.push({
"barcode": s.itemCode +'-'+ s.toolCode,
"showText" : s.itemName+'-'+s.toolCode,
"gp":i+1
})
});
postPrintPdf(
"qrcode-50*50-2",
{
detail
}
);
},
// //自动生成编码
// handleAutoGenChange(autoGenFlag){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment