update 批量打印
This commit is contained in:
parent
cdaa2c1f6c
commit
725fa19bd1
@ -193,6 +193,7 @@ export default {
|
|||||||
|
|
||||||
this.dataForm = res.data;
|
this.dataForm = res.data;
|
||||||
await this.printByLocalData(res.data);
|
await this.printByLocalData(res.data);
|
||||||
|
await this.getPrintStatus(id);
|
||||||
},
|
},
|
||||||
|
|
||||||
async printByLocalData(data) {
|
async printByLocalData(data) {
|
||||||
@ -201,7 +202,6 @@ export default {
|
|||||||
// 绘制HU号
|
// 绘制HU号
|
||||||
await this.paintQrCode(data.hu || "- 无HU数据 -");
|
await this.paintQrCode(data.hu || "- 无HU数据 -");
|
||||||
await this.handlePrint();
|
await this.handlePrint();
|
||||||
await this.getPrintStatus();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initPrintPlugin() {
|
initPrintPlugin() {
|
||||||
@ -267,7 +267,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getPrintStatus() {
|
getPrintStatus(id) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!this.jobId || !this.lodop) reject(-1);
|
if (!this.jobId || !this.lodop) reject(-1);
|
||||||
this.lodop.SET_PRINT_MODE("CATCH_PRINT_STATUS", true);
|
this.lodop.SET_PRINT_MODE("CATCH_PRINT_STATUS", true);
|
||||||
@ -278,7 +278,7 @@ export default {
|
|||||||
// 打印成功
|
// 打印成功
|
||||||
this.sendSuccess()
|
this.sendSuccess()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$message.success("打印成功");
|
this.$message.success(`打印 ${id} 成功`);
|
||||||
this.$emit("refresh-list");
|
this.$emit("refresh-list");
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
@ -287,7 +287,7 @@ export default {
|
|||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error("打印失败");
|
this.$message.error(`打印 ${id} 失败`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.lodop.GET_VALUE("PRINT_STATUS_OK", this.jobId);
|
this.lodop.GET_VALUE("PRINT_STATUS_OK", this.jobId);
|
||||||
|
@ -622,12 +622,7 @@ export default {
|
|||||||
cancelButtonText: "我再想想",
|
cancelButtonText: "我再想想",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(this.printOnce.bind(null, data))
|
||||||
this.printDOMmount = true;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs["print"].print(data);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
// console.log("cancel ", err);
|
// console.log("cancel ", err);
|
||||||
});
|
});
|
||||||
@ -719,9 +714,39 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "打印":
|
||||||
|
return this.$confirm("开始打印么", "提示", {
|
||||||
|
confirmButtonText: "确认",
|
||||||
|
cancelButtonText: "我再想想",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
console.log("打印如下这些 ids:", this.tableSelectedIds);
|
||||||
|
// this.tableSelectedIds.reduce(async (id, _) => {
|
||||||
|
// await this.printOnce(id);
|
||||||
|
// })
|
||||||
|
this.tableSelectedIds.forEach(async (id) => {
|
||||||
|
await this.printOnce(id);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.$message.error(`批量打印出错: ${err}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 打印一次 */
|
||||||
|
printOnce(id) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.printDOMmount = true;
|
||||||
|
this.$nextTick(async () => {
|
||||||
|
console.log("[Print] 打印项:", id);
|
||||||
|
await this.$refs["print"].print(id);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/** 导航器的操作 */
|
/** 导航器的操作 */
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
// val 是新值
|
// val 是新值
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import { timeFilter, dictFilter } from "@/utils/filters";
|
import { timeFilter, dictFilter } from "@/utils/filters";
|
||||||
import { getDictDataList } from '@/utils';
|
import { getDictDataList } from "@/utils";
|
||||||
|
|
||||||
|
|
||||||
// import StateSelect from '@/components/StateSelect.vue';
|
// import StateSelect from '@/components/StateSelect.vue';
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{ type: "index", label: "序号" },
|
{ type: "index", label: "序号" },
|
||||||
|
{ type: "selection" },
|
||||||
{ prop: "code", label: "流水号" },
|
{ prop: "code", label: "流水号" },
|
||||||
{ prop: "carCode", label: "窑车号" },
|
{ prop: "carCode", label: "窑车号" },
|
||||||
{ prop: "orderCode", label: "订单号" },
|
{ prop: "orderCode", label: "订单号" },
|
||||||
{ prop: "realQty", label: "数量" },
|
{ prop: "realQty", label: "数量" },
|
||||||
{ prop: "typeDictValue", label: "类型", filter: dictFilter('pallet_type') },
|
{ prop: "typeDictValue", label: "类型", filter: dictFilter("pallet_type") },
|
||||||
{ prop: "stifling", label: "熏蒸", filter: val => val != null ? ['非熏蒸', '熏蒸'][val] : '-' },
|
{ prop: "stifling", label: "熏蒸", filter: (val) => (val != null ? ["非熏蒸", "熏蒸"][val] : "-") },
|
||||||
{ prop: "printTime", label: "打印时间", filter: timeFilter },
|
{ prop: "printTime", label: "打印时间", filter: timeFilter },
|
||||||
{ prop: "createTime", label: "添加时间", filter: timeFilter },
|
{ prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ export default function () {
|
|||||||
subcomponent: TableOperaionComponent,
|
subcomponent: TableOperaionComponent,
|
||||||
options: [
|
options: [
|
||||||
{ name: "print", label: "打印", icon: "printer" },
|
{ name: "print", label: "打印", icon: "printer" },
|
||||||
{ name: "view-car-record", label: "窑车记录", emitField: 'hisId', icon: "shopping-cart-1" },
|
{ name: "view-car-record", label: "窑车记录", emitField: "hisId", icon: "shopping-cart-1" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -38,19 +38,19 @@ export default function () {
|
|||||||
fn: () => this.$http.get("/pms/car/page", { params: { page: 1, limit: 999 } }),
|
fn: () => this.$http.get("/pms/car/page", { params: { page: 1, limit: 999 } }),
|
||||||
bind: {
|
bind: {
|
||||||
placeholder: "请选择窑车号",
|
placeholder: "请选择窑车号",
|
||||||
filterable: true
|
filterable: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: "orderId",
|
prop: "orderId",
|
||||||
label: "订单号",
|
label: "订单号",
|
||||||
fieldOptionLabel: 'code',
|
fieldOptionLabel: "code",
|
||||||
// fieldOptionValue: 'id',
|
// fieldOptionValue: 'id',
|
||||||
select: [],
|
select: [],
|
||||||
fn: () => this.$http.post("/pms/order/pageView", { page: 1, limit: 999 }),
|
fn: () => this.$http.post("/pms/order/pageView", { page: 1, limit: 999 }),
|
||||||
bind: {
|
bind: {
|
||||||
placeholder: "请选择订单号",
|
placeholder: "请选择订单号",
|
||||||
filterable: true
|
filterable: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -59,6 +59,15 @@ export default function () {
|
|||||||
name: "查询",
|
name: "查询",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
button: {
|
||||||
|
type: "primary",
|
||||||
|
name: "打印",
|
||||||
|
},
|
||||||
|
bind: {
|
||||||
|
plain: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const dialogJustFormConfigs = {
|
const dialogJustFormConfigs = {
|
||||||
@ -74,17 +83,17 @@ export default function () {
|
|||||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||||
elparams: {
|
elparams: {
|
||||||
disabled: true,
|
disabled: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
select: true,
|
select: true,
|
||||||
label: "状态",
|
label: "状态",
|
||||||
prop: "stateDictValue",
|
prop: "stateDictValue",
|
||||||
options: getDictDataList('car_state').map(i => ({ label: i.dictLabel, value: i.dictValue })),
|
options: getDictDataList("car_state").map((i) => ({ label: i.dictLabel, value: i.dictValue })),
|
||||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||||
elparams: {
|
elparams: {
|
||||||
fliterable: true
|
fliterable: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -97,16 +106,16 @@ export default function () {
|
|||||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||||
elparams: {
|
elparams: {
|
||||||
// fliterable: true
|
// fliterable: true
|
||||||
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "查看载砖详情",
|
label: "查看载砖详情",
|
||||||
button: true,
|
button: true,
|
||||||
onClick: function (id) { // 必须用 function 形式
|
onClick: function (id) {
|
||||||
console.log(`查看载砖详情`, id)
|
// 必须用 function 形式
|
||||||
this.$emit('emit-data', { type: 'to-car-payload', data: id })
|
console.log(`查看载砖详情`, id);
|
||||||
}
|
this.$emit("emit-data", { type: "to-car-payload", data: id });
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -119,7 +128,7 @@ export default function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const carPayloadDialogConfigs = {
|
const carPayloadDialogConfigs = {
|
||||||
dialogWidth: '70%',
|
dialogWidth: "70%",
|
||||||
carPayloadDialog: true,
|
carPayloadDialog: true,
|
||||||
clickModalToClose: false,
|
clickModalToClose: false,
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
@ -142,8 +151,6 @@ export default function () {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
carPayloadDialogConfigs,
|
carPayloadDialogConfigs,
|
||||||
dialogConfigs: dialogJustFormConfigs,
|
dialogConfigs: dialogJustFormConfigs,
|
||||||
@ -156,11 +163,11 @@ export default function () {
|
|||||||
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
|
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
|
||||||
},
|
},
|
||||||
urls: {
|
urls: {
|
||||||
base: '/pms/carHistory',
|
base: "/pms/carHistory",
|
||||||
payload: '/pms/carHandle', // hisId 查询 载砖详情
|
payload: "/pms/carHandle", // hisId 查询 载砖详情
|
||||||
page: "/pms/pallet/pageView",
|
page: "/pms/pallet/pageView",
|
||||||
pageIsPostApi: true,
|
pageIsPostApi: true,
|
||||||
printLog: '/pms/pallet/print', // post
|
printLog: "/pms/pallet/print", // post
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user