diff --git a/src/views/productManagement/ProWorkorder/index.vue b/src/views/productManagement/ProWorkorder/index.vue
index 70541d8..8829428 100644
--- a/src/views/productManagement/ProWorkorder/index.vue
+++ b/src/views/productManagement/ProWorkorder/index.vue
@@ -76,7 +76,8 @@
工单导出
- 工单打印
+ 打印所勾选标签
+
+ @selection-change="handleSelectionChange" header-row-class-name="table-header"
+ :cell-class-name="tableCellClassName" @sort-change="sortChange">
+
+
@@ -1163,15 +1167,18 @@ const printObj = {
}
function handlePrint() {
PrintDialogShow.value = true
- printList.value = getPrintList()
+ printList.value = allList.value
exportWorkorderPDF(getPrintList())
}
+const selectList = ref([])
+function handleSelectionChange(val) {
+ selectList.value = val
+}
function getPrintList() {
- const _list = allList.value.map(item => {
+ const _list = selectList.value.map(item => {
return item.workorder
})
- console.log(_list);
return _list
// const groupedData = _list.reduce((acc, item) => {
// const key = item.groupCode
@@ -1183,31 +1190,18 @@ function getPrintList() {
// }, {})
// return Object.values(groupedData)
}
-import axios from 'axios';
-
// 打印pdf
async function exportWorkorderPDF(workorderArray) {
- const url = '/mes/productManagement/ProWorkorder/print'
- try {
- const response = await axios.get(url, {
- params: {
- workorderArray
- }
- });
-
- // 下面是处理后端返回的数据
- const filename = '工单打印';
- const fileBlob = new Blob([response.data], { type: 'application/pdf' });
- console.log(fileBlob);
- // 创建一个隐藏的 a 标签来触发 PDF 下载
- const link = document.createElement('a');
- link.href = URL.createObjectURL(fileBlob);
- link.download = filename;
- link.click();
- URL.revokeObjectURL(link.href); // 清除对象 URL
- } catch (error) {
- console.error('打印异常:', error);
+ let url = '/mes/productManagement/ProWorkorder/print?'
+ if (workorderArray.length === 0) {
+ proxy.$modal.msgError('无勾选工单打印')
+ return
}
+ for (let index = 0; index < workorderArray.length; index++) {
+ url += 'workorderArray=' + workorderArray[index] + '&'
+ }
+ proxy.download(url, '工单标签打印模板')
+ return
}
// 获取打印时间
function getPrintTime() {