工单标签打印
This commit is contained in:
@@ -5,11 +5,11 @@ import request from '@/utils/request'
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listProWorkorder(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -17,11 +17,11 @@ export function listProWorkorder(data) {
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listProWorkorderNoCheck(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/list_nocheck',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/list_nocheck',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,32 +29,32 @@ export function listProWorkorderNoCheck(data) {
|
||||
* @param data
|
||||
*/
|
||||
export function addProWorkorder(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 修改生产工单
|
||||
* @param data
|
||||
*/
|
||||
export function updateProWorkorder(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder',
|
||||
method: 'PUT',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder',
|
||||
method: 'PUT',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取生产工单详情
|
||||
* @param {Id}
|
||||
*/
|
||||
export function getProWorkorder(id) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,10 +62,10 @@ export function getProWorkorder(id) {
|
||||
* @param {主键} pid
|
||||
*/
|
||||
export function delProWorkorder(pid) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/' + pid,
|
||||
method: 'delete'
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/' + pid,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,11 +73,11 @@ export function delProWorkorder(pid) {
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function Generate_workorder(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/Generate_workorder',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/Generate_workorder',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,11 +85,11 @@ export function Generate_workorder(data) {
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function Insert_workOrder(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/insert_workorder',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/insert_workorder',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,11 +97,11 @@ export function Insert_workOrder(data) {
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function MoveWorkorder(params) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/move_workorder',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/move_workorder',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,11 +109,11 @@ export function MoveWorkorder(params) {
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function WorkOrderExport(params) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/export',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/export',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,11 +121,11 @@ export function WorkOrderExport(params) {
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function GetMaterialInfo(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_material',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_material',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,11 +133,11 @@ export function GetMaterialInfo(data) {
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function GetCustomInfo(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_custom',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_custom',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,11 +145,11 @@ export function GetCustomInfo(data) {
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function GetProcessRouteByDateTime(params) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_process_route',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_process_route',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,11 +157,11 @@ export function GetProcessRouteByDateTime(params) {
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function GetGroupListByRouteCode(params) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_groups',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_groups',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,11 +169,11 @@ export function GetGroupListByRouteCode(params) {
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function SearchBOMNum(params) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/search_BOM_num',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/search_BOM_num',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,10 +181,10 @@ export function SearchBOMNum(params) {
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function GetAllRoute() {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_all_route',
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_all_route',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,10 +192,10 @@ export function GetAllRoute() {
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function GetAllGroup() {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_groups',
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_groups',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,11 +203,11 @@ export function GetAllGroup() {
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function WorkOrderLog(params) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/workorder_log',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/workorder_log',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,9 +215,21 @@ export function WorkOrderLog(params) {
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function GetWorkorderTraceProgressList(data) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_workorder_trace_progress',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/get_workorder_trace_progress',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印工单标签
|
||||
* @param {查询条件} params
|
||||
*/
|
||||
export function getPrintPDF(params) {
|
||||
return request({
|
||||
url: 'mes/productManagement/ProWorkorder/print',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -65,16 +65,18 @@
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#626aef" v-hasPermi="['productManagement:proworkorder:list']"
|
||||
icon="Download" @click="handleImport(1)"> 工单导入(覆盖) </el-button>
|
||||
<el-button class="tool-box" color="#626aef" icon="Download" @click="handleImport(1)"> 工单导入(覆盖)
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#626bbb" v-hasPermi="['productManagement:proworkorder:list']"
|
||||
icon="Download" @click="handleImport(2)"> 工单导入(追加) </el-button>
|
||||
<el-button class="tool-box" color="#626bbb" icon="Download" @click="handleImport(2)"> 工单导入(追加)
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#00aa00" v-hasPermi="['productManagement:proworkorder:list']"
|
||||
icon="Upload" @click="handleExport"> 工单导出 </el-button>
|
||||
<el-button class="tool-box" color="#00aa00" icon="Upload" @click="handleExport"> 工单导出 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#E6A23C" icon="Printer" @click="handlePrint"> 工单打印 </el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#55557f" v-hasPermi="['productManagement:proworkorder:list']" icon="Printer" @click="handlePrint"> 打印 </el-button>
|
||||
@@ -1162,18 +1164,50 @@ const printObj = {
|
||||
function handlePrint() {
|
||||
PrintDialogShow.value = true
|
||||
printList.value = getPrintList()
|
||||
exportWorkorderPDF(getPrintList())
|
||||
|
||||
}
|
||||
function getPrintList() {
|
||||
const _list = allList.value
|
||||
const groupedData = _list.reduce((acc, item) => {
|
||||
const key = item.groupCode
|
||||
if (!acc[key]) {
|
||||
acc[key] = []
|
||||
}
|
||||
acc[key].push(item)
|
||||
return acc
|
||||
}, {})
|
||||
return Object.values(groupedData)
|
||||
const _list = allList.value.map(item => {
|
||||
return item.workorder
|
||||
})
|
||||
console.log(_list);
|
||||
return _list
|
||||
// const groupedData = _list.reduce((acc, item) => {
|
||||
// const key = item.groupCode
|
||||
// if (!acc[key]) {
|
||||
// acc[key] = []
|
||||
// }
|
||||
// acc[key].push(item)
|
||||
// return acc
|
||||
// }, {})
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
// 获取打印时间
|
||||
function getPrintTime() {
|
||||
|
||||
Reference in New Issue
Block a user