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

update:修改打印相关逻辑

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