sun-biz 0.0.3-beta.22 → 0.0.3-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +192 -101
- package/dist/components/print/print.d.ts +3 -3
- package/dist/components/print/template.d.ts +1 -1
- package/dist/index.js +192 -101
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -4010,6 +4010,7 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4010
4010
|
const templateModel = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)({
|
|
4011
4011
|
templateId: ""
|
|
4012
4012
|
});
|
|
4013
|
+
const operation = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)("");
|
|
4013
4014
|
const rules = (0, __WEBPACK_EXTERNAL_MODULE_vue__.reactive)({
|
|
4014
4015
|
templateId: [
|
|
4015
4016
|
{
|
|
@@ -4034,9 +4035,11 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4034
4035
|
};
|
|
4035
4036
|
// 提交
|
|
4036
4037
|
const handleConfirmSubmit = async ()=>{
|
|
4038
|
+
operation.value = "";
|
|
4037
4039
|
await formRef.value?.validate();
|
|
4038
4040
|
const printTemplate = printTemplateList.value.find((item)=>item.receiptTemplateRuleId === templateModel.value.templateId);
|
|
4039
4041
|
await props.onTemplateConfirm(printTemplate);
|
|
4042
|
+
operation.value = "confirm";
|
|
4040
4043
|
return [];
|
|
4041
4044
|
};
|
|
4042
4045
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
|
|
@@ -4054,11 +4057,10 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4054
4057
|
"destroy-on-close": true,
|
|
4055
4058
|
"confirm-fn": ()=>handleConfirmSubmit(),
|
|
4056
4059
|
"align-center": true,
|
|
4057
|
-
|
|
4058
|
-
(
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
}
|
|
4060
|
+
onClose: _cache[1] || (_cache[1] = async ()=>{
|
|
4061
|
+
if (!operation.value || 'cancel' === operation.value) await props.onTemplateConfirm(void 0, 'cancel');
|
|
4062
|
+
}),
|
|
4063
|
+
onCancel: _cache[2] || (_cache[2] = ($event)=>operation.value = 'cancel')
|
|
4062
4064
|
}, {
|
|
4063
4065
|
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
4064
4066
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElForm), {
|
|
@@ -4107,8 +4109,7 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4107
4109
|
]),
|
|
4108
4110
|
_: 1
|
|
4109
4111
|
}, 8, [
|
|
4110
|
-
"confirm-fn"
|
|
4111
|
-
"before-close"
|
|
4112
|
+
"confirm-fn"
|
|
4112
4113
|
]));
|
|
4113
4114
|
}
|
|
4114
4115
|
});
|
|
@@ -4542,110 +4543,184 @@ const createPrint = ()=>{
|
|
|
4542
4543
|
});
|
|
4543
4544
|
let defaultContext = initData();
|
|
4544
4545
|
let isLocalPrint = false;
|
|
4546
|
+
let breakPrint = false;
|
|
4545
4547
|
/** 获取当前是否是本地打印 */ const getIsLocalPrint = ()=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_micro_app__.getAppData)("isLocalPrint");
|
|
4548
|
+
/** 校验方法提取 */ const validateRequired = (value, errorMessage)=>{
|
|
4549
|
+
if (null == value) {
|
|
4550
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error(errorMessage);
|
|
4551
|
+
breakPrint = true;
|
|
4552
|
+
return false;
|
|
4553
|
+
}
|
|
4554
|
+
return true;
|
|
4555
|
+
};
|
|
4556
|
+
/** 校验参数是否都传了 */ const validateParams = (params)=>{
|
|
4557
|
+
if (!validateRequired(params?.designFlag, "设计时标志不能为空")) return;
|
|
4558
|
+
if (!validateRequired(params?.sysMenuId, "系统菜单标识不能为空")) return;
|
|
4559
|
+
if (!validateRequired(params?.receiptId, "单据标识不能为空")) return;
|
|
4560
|
+
if (!validateRequired(params?.bizIdTypeCode, "业务标识类型代码不能为空")) return;
|
|
4561
|
+
if (!validateRequired(params?.bizIds, "业务标识集合不能为空")) return;
|
|
4562
|
+
if (params?.bizIds?.length === 0) {
|
|
4563
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error("业务标识集合不能为空");
|
|
4564
|
+
breakPrint = true;
|
|
4565
|
+
return;
|
|
4566
|
+
}
|
|
4567
|
+
if (!validateRequired(params?.printType, "打印类型不能为空")) return;
|
|
4568
|
+
if (!validateRequired(params?.formOperationType, "打印类别不能为空")) return;
|
|
4569
|
+
if (params?.invoiceInfo) {
|
|
4570
|
+
if (!validateRequired(params?.invoiceInfo?.invOperateTypeCode, "票据操作类型代码不能为空")) return;
|
|
4571
|
+
if (!validateRequired(params?.invoiceInfo?.invoiceAllotId, "票据分配标识不能为空")) return;
|
|
4572
|
+
if (!validateRequired(params?.invoiceInfo?.invoiceUsageCode, "票据用途代码不能为空")) return;
|
|
4573
|
+
}
|
|
4574
|
+
};
|
|
4546
4575
|
// 打印
|
|
4547
4576
|
const printStart = async (params)=>{
|
|
4548
|
-
/** 初始化 */
|
|
4577
|
+
/** 初始化 */ breakPrint = false;
|
|
4578
|
+
validateParams(params);
|
|
4579
|
+
if (breakPrint) return;
|
|
4580
|
+
defaultContext = initData();
|
|
4549
4581
|
isLocalPrint = getIsLocalPrint();
|
|
4550
4582
|
defaultContext.printParams = params;
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
await
|
|
4556
|
-
if (
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4583
|
+
/** 1.查询单据信息 */ await fetchReceiptInfo();
|
|
4584
|
+
if (breakPrint) return;
|
|
4585
|
+
/** 2.弹窗询问 */ if (defaultContext?.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) await dialogAsk();
|
|
4586
|
+
if (breakPrint) return;
|
|
4587
|
+
/** 3.模版选择 */ await selectPrintTemplateFn();
|
|
4588
|
+
if (breakPrint) return;
|
|
4589
|
+
/** 5.单据重新组织分单 */ await splitReceiptFn();
|
|
4590
|
+
if (breakPrint) return;
|
|
4591
|
+
/** 6.票据组织分单 */ await splitInvoiceFn();
|
|
4592
|
+
if (breakPrint) return;
|
|
4593
|
+
return await printLoop();
|
|
4561
4594
|
};
|
|
4562
4595
|
/**
|
|
4563
|
-
*
|
|
4596
|
+
* 1.获取单据信息
|
|
4564
4597
|
*/ const fetchReceiptInfo = async ()=>{
|
|
4565
|
-
const [, res] = await queryReceiptByExample({
|
|
4598
|
+
const [err, res] = await queryReceiptByExample({
|
|
4566
4599
|
receiptIds: [
|
|
4567
4600
|
defaultContext.printParams?.receiptId
|
|
4568
4601
|
]
|
|
4569
4602
|
});
|
|
4570
|
-
if (
|
|
4603
|
+
if (err) {
|
|
4604
|
+
breakPrint = true;
|
|
4605
|
+
return;
|
|
4606
|
+
}
|
|
4607
|
+
if (!res?.data || res?.data?.length === 0) {
|
|
4608
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error("单据不存在");
|
|
4609
|
+
breakPrint = true;
|
|
4610
|
+
return;
|
|
4611
|
+
}
|
|
4612
|
+
// 更新 defaultContext
|
|
4613
|
+
defaultContext = {
|
|
4571
4614
|
...defaultContext,
|
|
4572
4615
|
receiptInfo: res.data[0]
|
|
4573
4616
|
};
|
|
4574
4617
|
};
|
|
4575
4618
|
/**
|
|
4576
|
-
*
|
|
4619
|
+
* 2.弹窗询问
|
|
4577
4620
|
*/ const dialogAsk = async ()=>{
|
|
4578
|
-
if (defaultContext?.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) return nextAction();
|
|
4579
4621
|
const { receiptPrintRuleCode, receiptPrintCategCode, receiptNameDisplay, menuXReceiptList } = defaultContext.receiptInfo || {};
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
// 按菜单
|
|
4622
|
+
if (!receiptPrintRuleCode) return;
|
|
4623
|
+
let code = receiptPrintCategCode;
|
|
4583
4624
|
if (receiptPrintRuleCode === constant_RECEIPT_PRINT_RULE_CODE.MENU) {
|
|
4584
|
-
//获取菜单打印配置信息
|
|
4585
4625
|
const menuReceiptInfo = menuXReceiptList?.find((item)=>item.sysXMenuId === defaultContext.printParams?.sysMenuId);
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4626
|
+
code = menuReceiptInfo?.receiptPrintCategCode || receiptPrintCategCode;
|
|
4627
|
+
}
|
|
4628
|
+
const isConfirmed = await messageBoxAskJudge(code, receiptNameDisplay);
|
|
4629
|
+
if (!isConfirmed) {
|
|
4630
|
+
breakPrint = true; // 如果用户取消操作,设置 breakPrint 为 true
|
|
4631
|
+
return;
|
|
4589
4632
|
}
|
|
4590
4633
|
};
|
|
4591
4634
|
/**
|
|
4592
|
-
*
|
|
4635
|
+
* 2.弹窗询问判断方法
|
|
4593
4636
|
*/ const messageBoxAskJudge = async (receiptPrintCategCode, receiptNameDisplay)=>{
|
|
4594
4637
|
if (receiptPrintCategCode === constant_RECEIPT_PRINT_CATEG_CODE.ASK_PRINT || receiptPrintCategCode === constant_RECEIPT_PRINT_CATEG_CODE.ASK_ISSUE_NO_PRINT) return await messageBoxAsk(receiptPrintCategCode, receiptNameDisplay);
|
|
4595
|
-
return
|
|
4638
|
+
return true;
|
|
4596
4639
|
};
|
|
4597
4640
|
/**
|
|
4598
|
-
* ElMessageBox询问
|
|
4641
|
+
* 2.弹窗询问ElMessageBox询问
|
|
4599
4642
|
*/ const messageBoxAsk = async (code, receiptNameDisplay)=>{
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
return data;
|
|
4643
|
+
try {
|
|
4644
|
+
await __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessageBox.confirm(`是否${code === constant_RECEIPT_PRINT_CATEG_CODE.ASK_PRINT ? "打印" : "开具"} ${receiptNameDisplay}`, "提示", {
|
|
4645
|
+
confirmButtonText: "确定",
|
|
4646
|
+
cancelButtonText: "取消",
|
|
4647
|
+
type: "warning"
|
|
4648
|
+
});
|
|
4649
|
+
// 如果用户点击了“确定”,返回 true
|
|
4650
|
+
return true;
|
|
4651
|
+
} catch (error) {
|
|
4652
|
+
// 如果用户点击了“取消”、关闭按钮、遮罩层或按 ESC 键,返回 false
|
|
4653
|
+
return false;
|
|
4654
|
+
}
|
|
4613
4655
|
};
|
|
4614
|
-
/**
|
|
4615
|
-
* 打印模板选择
|
|
4616
|
-
*/ const printTemplateFn = async ()=>{
|
|
4656
|
+
/** 3.模板选择 */ const selectPrintTemplateFn = async ()=>{
|
|
4617
4657
|
const { chooseReceiptTemplateRuleList, receiptNameDisplay } = defaultContext?.receiptInfo || {};
|
|
4618
|
-
//
|
|
4658
|
+
// 过滤出启用的模板
|
|
4619
4659
|
defaultContext.printTemplateList = chooseReceiptTemplateRuleList?.filter((item)=>item.enabledFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) ?? [];
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
onTemplateConfirm: templateConfirm
|
|
4623
|
-
});
|
|
4624
|
-
else if (defaultContext?.printTemplateList.length === 1) {
|
|
4625
|
-
defaultContext.printTemplate = defaultContext?.printTemplateList[0];
|
|
4626
|
-
await splitReceiptFn();
|
|
4627
|
-
return await printLoop();
|
|
4628
|
-
} else {
|
|
4660
|
+
// 如果没有有效的模板,报错并返回 false
|
|
4661
|
+
if (0 === defaultContext.printTemplateList.length) {
|
|
4629
4662
|
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error(`${receiptNameDisplay} 没有有效的模板`);
|
|
4630
|
-
|
|
4663
|
+
breakPrint = true;
|
|
4664
|
+
return;
|
|
4631
4665
|
}
|
|
4666
|
+
// 如果只有一条模板,直接选中
|
|
4667
|
+
if (1 === defaultContext.printTemplateList.length) {
|
|
4668
|
+
defaultContext.printTemplate = defaultContext.printTemplateList[0];
|
|
4669
|
+
return;
|
|
4670
|
+
}
|
|
4671
|
+
// 如果有多条模板,弹出选择框
|
|
4672
|
+
if (defaultContext.printTemplateList.length > 1) return new Promise((resolve)=>{
|
|
4673
|
+
createPrintTemplate({
|
|
4674
|
+
printTemplateList: defaultContext.printTemplateList,
|
|
4675
|
+
onTemplateConfirm: async (template, operation)=>{
|
|
4676
|
+
await templateConfirm(template, operation);
|
|
4677
|
+
resolve(); // 用户选择完成后解析Promise
|
|
4678
|
+
}
|
|
4679
|
+
});
|
|
4680
|
+
});
|
|
4632
4681
|
};
|
|
4633
4682
|
/**
|
|
4634
|
-
*
|
|
4635
|
-
*/ const templateConfirm = async (template)=>{
|
|
4636
|
-
defaultContext.printTemplate = template;
|
|
4637
|
-
|
|
4638
|
-
|
|
4683
|
+
* 3.模板选择
|
|
4684
|
+
*/ const templateConfirm = async (template, operation)=>{
|
|
4685
|
+
if (template) defaultContext.printTemplate = template;
|
|
4686
|
+
if ("cancel" === operation) {
|
|
4687
|
+
breakPrint = true;
|
|
4688
|
+
return;
|
|
4689
|
+
}
|
|
4639
4690
|
};
|
|
4640
|
-
/**
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
if (defaultContext.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) {
|
|
4644
|
-
//5
|
|
4691
|
+
/** 5.组织单据分单 */ const splitReceiptFn = async ()=>{
|
|
4692
|
+
if (defaultContext.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) //5
|
|
4693
|
+
{
|
|
4645
4694
|
if (!defaultContext?.printParams?.dataSourceContent && (defaultContext?.receiptInfo?.invoiceFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO || defaultContext?.receiptInfo?.invoiceFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.ISSUE)) await receiptSplitResultFn();
|
|
4646
|
-
|
|
4695
|
+
}
|
|
4696
|
+
};
|
|
4697
|
+
/**
|
|
4698
|
+
* 5.单据分单接口
|
|
4699
|
+
*/ const receiptSplitResultFn = async ()=>{
|
|
4700
|
+
const [err, res] = await splitReceipt({
|
|
4701
|
+
receiptId: defaultContext?.printParams?.receiptId,
|
|
4702
|
+
bizIdTypeCode: defaultContext?.printParams?.bizIdTypeCode,
|
|
4703
|
+
bizIds: defaultContext?.printParams?.bizIds
|
|
4704
|
+
});
|
|
4705
|
+
if (err) {
|
|
4706
|
+
breakPrint = true;
|
|
4707
|
+
return;
|
|
4708
|
+
}
|
|
4709
|
+
if (res?.success) {
|
|
4710
|
+
if (res.data?.receiptDataSourceList && res.data?.receiptDataSourceList.length > 0) defaultContext.splitResult = res.data?.receiptDataSourceList;
|
|
4711
|
+
}
|
|
4712
|
+
};
|
|
4713
|
+
/** 6.组织票据分单 */ const splitInvoiceFn = async ()=>{
|
|
4714
|
+
if (defaultContext.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) //6
|
|
4715
|
+
{
|
|
4647
4716
|
if (defaultContext?.printParams?.invoiceInfo?.invoiceAllotId && defaultContext?.receiptInfo?.invoiceFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && defaultContext?.receiptInfo?.receiptPrintCategCode !== constant_RECEIPT_PRINT_CATEG_CODE.NO_PRINT) {
|
|
4648
|
-
const
|
|
4717
|
+
const interfaceId = defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId;
|
|
4718
|
+
if (!interfaceId) {
|
|
4719
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error("单据未配置票据接口,无法开票!");
|
|
4720
|
+
breakPrint = true;
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4649
4724
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
4650
4725
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
4651
4726
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV001,
|
|
@@ -4654,6 +4729,10 @@ const createPrint = ()=>{
|
|
|
4654
4729
|
invoiceAllotId: defaultContext?.printParams?.invoiceInfo?.invoiceAllotId
|
|
4655
4730
|
}
|
|
4656
4731
|
});
|
|
4732
|
+
if (err) {
|
|
4733
|
+
breakPrint = true;
|
|
4734
|
+
return;
|
|
4735
|
+
}
|
|
4657
4736
|
if (res?.success) {
|
|
4658
4737
|
defaultContext.receiptAllotInfo = res?.data?.bizOutputParam ?? [];
|
|
4659
4738
|
await invoiceSplitResultFn();
|
|
@@ -4662,44 +4741,44 @@ const createPrint = ()=>{
|
|
|
4662
4741
|
}
|
|
4663
4742
|
};
|
|
4664
4743
|
/**
|
|
4665
|
-
*
|
|
4666
|
-
*/ const receiptSplitResultFn = async ()=>{
|
|
4667
|
-
const [, res] = await splitReceipt({
|
|
4668
|
-
receiptId: defaultContext?.printParams?.receiptId,
|
|
4669
|
-
bizIdTypeCode: defaultContext?.printParams?.bizIdTypeCode,
|
|
4670
|
-
bizIds: defaultContext?.printParams?.bizIds
|
|
4671
|
-
});
|
|
4672
|
-
if (res?.success) defaultContext.splitResult = res.data?.receiptDataSourceList ?? [];
|
|
4673
|
-
};
|
|
4674
|
-
/**
|
|
4675
|
-
* 票据分单
|
|
4744
|
+
* 6.票据分单
|
|
4676
4745
|
*/ const invoiceSplitResultFn = async ()=>{
|
|
4677
4746
|
// 票据操作类型代码---1开具
|
|
4678
4747
|
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.ISSUE) {
|
|
4679
4748
|
const invoiceInfo = (defaultContext?.receiptAllotInfo ?? [])[0];
|
|
4680
4749
|
if (invoiceInfo?.invoiceMediaTypeCode === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_MEDIA_TYPE_CODE.ELECTRONIC && (defaultContext?.splitResult?.length ?? 0) < (invoiceInfo?.residueCount ?? 0)) {
|
|
4681
4750
|
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error(`当前票据数量不足,所需票据张数[${defaultContext?.splitResult?.length}],剩余张数[${invoiceInfo?.residueCount}]!`);
|
|
4682
|
-
|
|
4751
|
+
breakPrint = true;
|
|
4752
|
+
return;
|
|
4683
4753
|
}
|
|
4684
|
-
const
|
|
4754
|
+
const invoiceList = (defaultContext?.splitResult ?? []).map((item)=>({
|
|
4755
|
+
receiptSort: item.receiptSort,
|
|
4756
|
+
receiptSplitResultId: item.receiptSplitResultId,
|
|
4757
|
+
invoiceAmt: defaultContext?.printParams?.invoiceInfo?.invoiceAmt
|
|
4758
|
+
}));
|
|
4759
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4685
4760
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
4686
4761
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
4687
4762
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV101,
|
|
4688
4763
|
params: {
|
|
4689
|
-
invoiceAllotId: defaultContext?.printParams?.invoiceInfo?.invoiceAllotId,
|
|
4690
|
-
invoiceUsageCode: defaultContext?.printParams?.invoiceInfo?.invoiceUsageCode,
|
|
4691
|
-
orgIssueFlag: defaultContext?.printParams?.invoiceInfo?.orgIssueFlag,
|
|
4764
|
+
invoiceAllotId: defaultContext?.printParams?.invoiceInfo?.invoiceAllotId ?? void 0,
|
|
4765
|
+
invoiceUsageCode: defaultContext?.printParams?.invoiceInfo?.invoiceUsageCode ?? void 0,
|
|
4766
|
+
orgIssueFlag: defaultContext?.printParams?.invoiceInfo?.orgIssueFlag ?? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO,
|
|
4692
4767
|
issueOrgName: defaultContext?.printParams?.invoiceInfo?.issueOrgName,
|
|
4693
4768
|
socialCreditNo: defaultContext?.printParams?.invoiceInfo?.socialCreditNo,
|
|
4694
4769
|
invoiceMemo: defaultContext?.printParams?.invoiceInfo?.invoiceMemo,
|
|
4695
|
-
invoiceList:
|
|
4770
|
+
invoiceList: invoiceList ?? []
|
|
4696
4771
|
}
|
|
4697
4772
|
});
|
|
4698
|
-
if (
|
|
4773
|
+
if (err) {
|
|
4774
|
+
breakPrint = true;
|
|
4775
|
+
return;
|
|
4776
|
+
}
|
|
4777
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
4699
4778
|
}
|
|
4700
4779
|
// 票据操作类型代码---6重开
|
|
4701
4780
|
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.REOPEN) {
|
|
4702
|
-
const [, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4781
|
+
const [error, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4703
4782
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
4704
4783
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
4705
4784
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV104,
|
|
@@ -4708,11 +4787,15 @@ const createPrint = ()=>{
|
|
|
4708
4787
|
invoiceIds: defaultContext?.printParams?.invoiceInfo?.invoiceIds
|
|
4709
4788
|
}
|
|
4710
4789
|
});
|
|
4711
|
-
if (
|
|
4790
|
+
if (error) {
|
|
4791
|
+
breakPrint = true;
|
|
4792
|
+
return;
|
|
4793
|
+
}
|
|
4794
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
4712
4795
|
}
|
|
4713
4796
|
// 票据操作类型代码---5换开
|
|
4714
4797
|
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.CHANGE) {
|
|
4715
|
-
const [, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4798
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4716
4799
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
4717
4800
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
4718
4801
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV103,
|
|
@@ -4721,11 +4804,15 @@ const createPrint = ()=>{
|
|
|
4721
4804
|
invoiceIds: defaultContext?.printParams?.invoiceInfo?.invoiceIds
|
|
4722
4805
|
}
|
|
4723
4806
|
});
|
|
4724
|
-
if (
|
|
4807
|
+
if (err) {
|
|
4808
|
+
breakPrint = true;
|
|
4809
|
+
return;
|
|
4810
|
+
}
|
|
4811
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
4725
4812
|
}
|
|
4726
4813
|
// 票据操作类型代码---3红冲
|
|
4727
|
-
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.
|
|
4728
|
-
const [, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4814
|
+
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.RED) {
|
|
4815
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
4729
4816
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
4730
4817
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
4731
4818
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV102,
|
|
@@ -4734,14 +4821,18 @@ const createPrint = ()=>{
|
|
|
4734
4821
|
invoiceUsageCode: defaultContext?.printParams?.invoiceInfo?.invoiceUsageCode,
|
|
4735
4822
|
bizIdTypeCode: defaultContext?.printParams?.bizIdTypeCode,
|
|
4736
4823
|
oldBizId: defaultContext?.printParams?.invoiceInfo?.oldBizId,
|
|
4737
|
-
redBizId: defaultContext?.printParams?.bizIds,
|
|
4824
|
+
redBizId: defaultContext?.printParams?.bizIds ?? defaultContext?.printParams?.bizIds[0],
|
|
4738
4825
|
onlyRedFlag: defaultContext?.printParams?.invoiceInfo?.onlyRedFlag
|
|
4739
4826
|
}
|
|
4740
4827
|
});
|
|
4741
|
-
if (
|
|
4828
|
+
if (err) {
|
|
4829
|
+
breakPrint = true;
|
|
4830
|
+
return;
|
|
4831
|
+
}
|
|
4832
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
4742
4833
|
}
|
|
4743
4834
|
};
|
|
4744
|
-
/**
|
|
4835
|
+
/** 7.循环打印 */ const printLoop = async ()=>{
|
|
4745
4836
|
// 修改这里:使用 Promise.all 等待所有异步操作完成
|
|
4746
4837
|
const results = await Promise.all((defaultContext?.splitResult || []).map(async (item)=>await printReceiptFn(item)));
|
|
4747
4838
|
// 检查结果数组中是否所有项都是 undefined
|
|
@@ -6615,8 +6706,8 @@ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo_hoisted_3 =
|
|
|
6615
6706
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>__props.bannerConfig?.bizId, ()=>{});
|
|
6616
6707
|
__expose({
|
|
6617
6708
|
searchRef: searchRef,
|
|
6618
|
-
invoiceRef:
|
|
6619
|
-
bannerRef:
|
|
6709
|
+
invoiceRef: invoiceRef,
|
|
6710
|
+
bannerRef: bannerRef
|
|
6620
6711
|
});
|
|
6621
6712
|
return (_ctx, _cache)=>{
|
|
6622
6713
|
const _component_el_button = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-button");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropsTypes, ReceiptTemplateList } from "./types";
|
|
2
2
|
export declare const createPrint: () => {
|
|
3
|
-
printFn: (params: PropsTypes) => Promise<
|
|
4
|
-
templateConfirm: (template: ReceiptTemplateList | undefined) => Promise<
|
|
3
|
+
printFn: (params: PropsTypes) => Promise<any[] | undefined>;
|
|
4
|
+
templateConfirm: (template: ReceiptTemplateList | undefined, operation?: string) => Promise<void>;
|
|
5
5
|
};
|
|
6
|
-
declare const print: (params: PropsTypes) => Promise<
|
|
6
|
+
declare const print: (params: PropsTypes) => Promise<any[] | undefined>;
|
|
7
7
|
export { print };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReceiptTemplateList } from "./types";
|
|
2
2
|
export declare const createPrintTemplate: (options: {
|
|
3
3
|
printTemplateList: ReceiptTemplateList[];
|
|
4
|
-
onTemplateConfirm: (template: ReceiptTemplateList | undefined) => Promise<void>;
|
|
4
|
+
onTemplateConfirm: (template: ReceiptTemplateList | undefined, operation?: string) => Promise<void>;
|
|
5
5
|
}) => void;
|
package/dist/index.js
CHANGED
|
@@ -4408,6 +4408,7 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4408
4408
|
const templateModel = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)({
|
|
4409
4409
|
templateId: ""
|
|
4410
4410
|
});
|
|
4411
|
+
const operation = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)("");
|
|
4411
4412
|
const rules = (0, __WEBPACK_EXTERNAL_MODULE_vue__.reactive)({
|
|
4412
4413
|
templateId: [
|
|
4413
4414
|
{
|
|
@@ -4432,9 +4433,11 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4432
4433
|
};
|
|
4433
4434
|
// 提交
|
|
4434
4435
|
const handleConfirmSubmit = async ()=>{
|
|
4436
|
+
operation.value = "";
|
|
4435
4437
|
await formRef.value?.validate();
|
|
4436
4438
|
const printTemplate = printTemplateList.value.find((item)=>item.receiptTemplateRuleId === templateModel.value.templateId);
|
|
4437
4439
|
await props.onTemplateConfirm(printTemplate);
|
|
4440
|
+
operation.value = "confirm";
|
|
4438
4441
|
return [];
|
|
4439
4442
|
};
|
|
4440
4443
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
|
|
@@ -4452,11 +4455,10 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4452
4455
|
"destroy-on-close": true,
|
|
4453
4456
|
"confirm-fn": ()=>handleConfirmSubmit(),
|
|
4454
4457
|
"align-center": true,
|
|
4455
|
-
|
|
4456
|
-
(
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
}
|
|
4458
|
+
onClose: _cache[1] || (_cache[1] = async ()=>{
|
|
4459
|
+
if (!operation.value || 'cancel' === operation.value) await props.onTemplateConfirm(void 0, 'cancel');
|
|
4460
|
+
}),
|
|
4461
|
+
onCancel: _cache[2] || (_cache[2] = ($event)=>operation.value = 'cancel')
|
|
4460
4462
|
}, {
|
|
4461
4463
|
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
4462
4464
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElForm), {
|
|
@@ -4505,8 +4507,7 @@ const BannerInfo_exports_ = BannerInfovue_type_script_setup_true_lang_ts_name_ba
|
|
|
4505
4507
|
]),
|
|
4506
4508
|
_: 1
|
|
4507
4509
|
}, 8, [
|
|
4508
|
-
"confirm-fn"
|
|
4509
|
-
"before-close"
|
|
4510
|
+
"confirm-fn"
|
|
4510
4511
|
]));
|
|
4511
4512
|
}
|
|
4512
4513
|
});
|
|
@@ -4940,110 +4941,184 @@ const createPrint = ()=>{
|
|
|
4940
4941
|
});
|
|
4941
4942
|
let defaultContext = initData();
|
|
4942
4943
|
let isLocalPrint = false;
|
|
4944
|
+
let breakPrint = false;
|
|
4943
4945
|
/** 获取当前是否是本地打印 */ const getIsLocalPrint = ()=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_micro_app__.getAppData)("isLocalPrint");
|
|
4946
|
+
/** 校验方法提取 */ const validateRequired = (value, errorMessage)=>{
|
|
4947
|
+
if (null == value) {
|
|
4948
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error(errorMessage);
|
|
4949
|
+
breakPrint = true;
|
|
4950
|
+
return false;
|
|
4951
|
+
}
|
|
4952
|
+
return true;
|
|
4953
|
+
};
|
|
4954
|
+
/** 校验参数是否都传了 */ const validateParams = (params)=>{
|
|
4955
|
+
if (!validateRequired(params?.designFlag, "设计时标志不能为空")) return;
|
|
4956
|
+
if (!validateRequired(params?.sysMenuId, "系统菜单标识不能为空")) return;
|
|
4957
|
+
if (!validateRequired(params?.receiptId, "单据标识不能为空")) return;
|
|
4958
|
+
if (!validateRequired(params?.bizIdTypeCode, "业务标识类型代码不能为空")) return;
|
|
4959
|
+
if (!validateRequired(params?.bizIds, "业务标识集合不能为空")) return;
|
|
4960
|
+
if (params?.bizIds?.length === 0) {
|
|
4961
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error("业务标识集合不能为空");
|
|
4962
|
+
breakPrint = true;
|
|
4963
|
+
return;
|
|
4964
|
+
}
|
|
4965
|
+
if (!validateRequired(params?.printType, "打印类型不能为空")) return;
|
|
4966
|
+
if (!validateRequired(params?.formOperationType, "打印类别不能为空")) return;
|
|
4967
|
+
if (params?.invoiceInfo) {
|
|
4968
|
+
if (!validateRequired(params?.invoiceInfo?.invOperateTypeCode, "票据操作类型代码不能为空")) return;
|
|
4969
|
+
if (!validateRequired(params?.invoiceInfo?.invoiceAllotId, "票据分配标识不能为空")) return;
|
|
4970
|
+
if (!validateRequired(params?.invoiceInfo?.invoiceUsageCode, "票据用途代码不能为空")) return;
|
|
4971
|
+
}
|
|
4972
|
+
};
|
|
4944
4973
|
// 打印
|
|
4945
4974
|
const printStart = async (params)=>{
|
|
4946
|
-
/** 初始化 */
|
|
4975
|
+
/** 初始化 */ breakPrint = false;
|
|
4976
|
+
validateParams(params);
|
|
4977
|
+
if (breakPrint) return;
|
|
4978
|
+
defaultContext = initData();
|
|
4947
4979
|
isLocalPrint = getIsLocalPrint();
|
|
4948
4980
|
defaultContext.printParams = params;
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
await
|
|
4954
|
-
if (
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4981
|
+
/** 1.查询单据信息 */ await fetchReceiptInfo();
|
|
4982
|
+
if (breakPrint) return;
|
|
4983
|
+
/** 2.弹窗询问 */ if (defaultContext?.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) await dialogAsk();
|
|
4984
|
+
if (breakPrint) return;
|
|
4985
|
+
/** 3.模版选择 */ await selectPrintTemplateFn();
|
|
4986
|
+
if (breakPrint) return;
|
|
4987
|
+
/** 5.单据重新组织分单 */ await splitReceiptFn();
|
|
4988
|
+
if (breakPrint) return;
|
|
4989
|
+
/** 6.票据组织分单 */ await splitInvoiceFn();
|
|
4990
|
+
if (breakPrint) return;
|
|
4991
|
+
return await printLoop();
|
|
4959
4992
|
};
|
|
4960
4993
|
/**
|
|
4961
|
-
*
|
|
4994
|
+
* 1.获取单据信息
|
|
4962
4995
|
*/ const fetchReceiptInfo = async ()=>{
|
|
4963
|
-
const [, res] = await queryReceiptByExample({
|
|
4996
|
+
const [err, res] = await queryReceiptByExample({
|
|
4964
4997
|
receiptIds: [
|
|
4965
4998
|
defaultContext.printParams?.receiptId
|
|
4966
4999
|
]
|
|
4967
5000
|
});
|
|
4968
|
-
if (
|
|
5001
|
+
if (err) {
|
|
5002
|
+
breakPrint = true;
|
|
5003
|
+
return;
|
|
5004
|
+
}
|
|
5005
|
+
if (!res?.data || res?.data?.length === 0) {
|
|
5006
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error("单据不存在");
|
|
5007
|
+
breakPrint = true;
|
|
5008
|
+
return;
|
|
5009
|
+
}
|
|
5010
|
+
// 更新 defaultContext
|
|
5011
|
+
defaultContext = {
|
|
4969
5012
|
...defaultContext,
|
|
4970
5013
|
receiptInfo: res.data[0]
|
|
4971
5014
|
};
|
|
4972
5015
|
};
|
|
4973
5016
|
/**
|
|
4974
|
-
*
|
|
5017
|
+
* 2.弹窗询问
|
|
4975
5018
|
*/ const dialogAsk = async ()=>{
|
|
4976
|
-
if (defaultContext?.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) return nextAction();
|
|
4977
5019
|
const { receiptPrintRuleCode, receiptPrintCategCode, receiptNameDisplay, menuXReceiptList } = defaultContext.receiptInfo || {};
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
// 按菜单
|
|
5020
|
+
if (!receiptPrintRuleCode) return;
|
|
5021
|
+
let code = receiptPrintCategCode;
|
|
4981
5022
|
if (receiptPrintRuleCode === constant_RECEIPT_PRINT_RULE_CODE.MENU) {
|
|
4982
|
-
//获取菜单打印配置信息
|
|
4983
5023
|
const menuReceiptInfo = menuXReceiptList?.find((item)=>item.sysXMenuId === defaultContext.printParams?.sysMenuId);
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
5024
|
+
code = menuReceiptInfo?.receiptPrintCategCode || receiptPrintCategCode;
|
|
5025
|
+
}
|
|
5026
|
+
const isConfirmed = await messageBoxAskJudge(code, receiptNameDisplay);
|
|
5027
|
+
if (!isConfirmed) {
|
|
5028
|
+
breakPrint = true; // 如果用户取消操作,设置 breakPrint 为 true
|
|
5029
|
+
return;
|
|
4987
5030
|
}
|
|
4988
5031
|
};
|
|
4989
5032
|
/**
|
|
4990
|
-
*
|
|
5033
|
+
* 2.弹窗询问判断方法
|
|
4991
5034
|
*/ const messageBoxAskJudge = async (receiptPrintCategCode, receiptNameDisplay)=>{
|
|
4992
5035
|
if (receiptPrintCategCode === constant_RECEIPT_PRINT_CATEG_CODE.ASK_PRINT || receiptPrintCategCode === constant_RECEIPT_PRINT_CATEG_CODE.ASK_ISSUE_NO_PRINT) return await messageBoxAsk(receiptPrintCategCode, receiptNameDisplay);
|
|
4993
|
-
return
|
|
5036
|
+
return true;
|
|
4994
5037
|
};
|
|
4995
5038
|
/**
|
|
4996
|
-
* ElMessageBox询问
|
|
5039
|
+
* 2.弹窗询问ElMessageBox询问
|
|
4997
5040
|
*/ const messageBoxAsk = async (code, receiptNameDisplay)=>{
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
return data;
|
|
5041
|
+
try {
|
|
5042
|
+
await __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessageBox.confirm(`是否${code === constant_RECEIPT_PRINT_CATEG_CODE.ASK_PRINT ? "打印" : "开具"} ${receiptNameDisplay}`, "提示", {
|
|
5043
|
+
confirmButtonText: "确定",
|
|
5044
|
+
cancelButtonText: "取消",
|
|
5045
|
+
type: "warning"
|
|
5046
|
+
});
|
|
5047
|
+
// 如果用户点击了“确定”,返回 true
|
|
5048
|
+
return true;
|
|
5049
|
+
} catch (error) {
|
|
5050
|
+
// 如果用户点击了“取消”、关闭按钮、遮罩层或按 ESC 键,返回 false
|
|
5051
|
+
return false;
|
|
5052
|
+
}
|
|
5011
5053
|
};
|
|
5012
|
-
/**
|
|
5013
|
-
* 打印模板选择
|
|
5014
|
-
*/ const printTemplateFn = async ()=>{
|
|
5054
|
+
/** 3.模板选择 */ const selectPrintTemplateFn = async ()=>{
|
|
5015
5055
|
const { chooseReceiptTemplateRuleList, receiptNameDisplay } = defaultContext?.receiptInfo || {};
|
|
5016
|
-
//
|
|
5056
|
+
// 过滤出启用的模板
|
|
5017
5057
|
defaultContext.printTemplateList = chooseReceiptTemplateRuleList?.filter((item)=>item.enabledFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) ?? [];
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
onTemplateConfirm: templateConfirm
|
|
5021
|
-
});
|
|
5022
|
-
else if (defaultContext?.printTemplateList.length === 1) {
|
|
5023
|
-
defaultContext.printTemplate = defaultContext?.printTemplateList[0];
|
|
5024
|
-
await splitReceiptFn();
|
|
5025
|
-
return await printLoop();
|
|
5026
|
-
} else {
|
|
5058
|
+
// 如果没有有效的模板,报错并返回 false
|
|
5059
|
+
if (0 === defaultContext.printTemplateList.length) {
|
|
5027
5060
|
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error(`${receiptNameDisplay} 没有有效的模板`);
|
|
5028
|
-
|
|
5061
|
+
breakPrint = true;
|
|
5062
|
+
return;
|
|
5063
|
+
}
|
|
5064
|
+
// 如果只有一条模板,直接选中
|
|
5065
|
+
if (1 === defaultContext.printTemplateList.length) {
|
|
5066
|
+
defaultContext.printTemplate = defaultContext.printTemplateList[0];
|
|
5067
|
+
return;
|
|
5029
5068
|
}
|
|
5069
|
+
// 如果有多条模板,弹出选择框
|
|
5070
|
+
if (defaultContext.printTemplateList.length > 1) return new Promise((resolve)=>{
|
|
5071
|
+
createPrintTemplate({
|
|
5072
|
+
printTemplateList: defaultContext.printTemplateList,
|
|
5073
|
+
onTemplateConfirm: async (template, operation)=>{
|
|
5074
|
+
await templateConfirm(template, operation);
|
|
5075
|
+
resolve(); // 用户选择完成后解析Promise
|
|
5076
|
+
}
|
|
5077
|
+
});
|
|
5078
|
+
});
|
|
5030
5079
|
};
|
|
5031
5080
|
/**
|
|
5032
|
-
*
|
|
5033
|
-
*/ const templateConfirm = async (template)=>{
|
|
5034
|
-
defaultContext.printTemplate = template;
|
|
5035
|
-
|
|
5036
|
-
|
|
5081
|
+
* 3.模板选择
|
|
5082
|
+
*/ const templateConfirm = async (template, operation)=>{
|
|
5083
|
+
if (template) defaultContext.printTemplate = template;
|
|
5084
|
+
if ("cancel" === operation) {
|
|
5085
|
+
breakPrint = true;
|
|
5086
|
+
return;
|
|
5087
|
+
}
|
|
5037
5088
|
};
|
|
5038
|
-
/**
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
if (defaultContext.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) {
|
|
5042
|
-
//5
|
|
5089
|
+
/** 5.组织单据分单 */ const splitReceiptFn = async ()=>{
|
|
5090
|
+
if (defaultContext.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) //5
|
|
5091
|
+
{
|
|
5043
5092
|
if (!defaultContext?.printParams?.dataSourceContent && (defaultContext?.receiptInfo?.invoiceFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO || defaultContext?.receiptInfo?.invoiceFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.ISSUE)) await receiptSplitResultFn();
|
|
5044
|
-
|
|
5093
|
+
}
|
|
5094
|
+
};
|
|
5095
|
+
/**
|
|
5096
|
+
* 5.单据分单接口
|
|
5097
|
+
*/ const receiptSplitResultFn = async ()=>{
|
|
5098
|
+
const [err, res] = await splitReceipt({
|
|
5099
|
+
receiptId: defaultContext?.printParams?.receiptId,
|
|
5100
|
+
bizIdTypeCode: defaultContext?.printParams?.bizIdTypeCode,
|
|
5101
|
+
bizIds: defaultContext?.printParams?.bizIds
|
|
5102
|
+
});
|
|
5103
|
+
if (err) {
|
|
5104
|
+
breakPrint = true;
|
|
5105
|
+
return;
|
|
5106
|
+
}
|
|
5107
|
+
if (res?.success) {
|
|
5108
|
+
if (res.data?.receiptDataSourceList && res.data?.receiptDataSourceList.length > 0) defaultContext.splitResult = res.data?.receiptDataSourceList;
|
|
5109
|
+
}
|
|
5110
|
+
};
|
|
5111
|
+
/** 6.组织票据分单 */ const splitInvoiceFn = async ()=>{
|
|
5112
|
+
if (defaultContext.printParams?.designFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO) //6
|
|
5113
|
+
{
|
|
5045
5114
|
if (defaultContext?.printParams?.invoiceInfo?.invoiceAllotId && defaultContext?.receiptInfo?.invoiceFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && defaultContext?.receiptInfo?.receiptPrintCategCode !== constant_RECEIPT_PRINT_CATEG_CODE.NO_PRINT) {
|
|
5046
|
-
const
|
|
5115
|
+
const interfaceId = defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId;
|
|
5116
|
+
if (!interfaceId) {
|
|
5117
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error("单据未配置票据接口,无法开票!");
|
|
5118
|
+
breakPrint = true;
|
|
5119
|
+
return;
|
|
5120
|
+
}
|
|
5121
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5047
5122
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
5048
5123
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
5049
5124
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV001,
|
|
@@ -5052,6 +5127,10 @@ const createPrint = ()=>{
|
|
|
5052
5127
|
invoiceAllotId: defaultContext?.printParams?.invoiceInfo?.invoiceAllotId
|
|
5053
5128
|
}
|
|
5054
5129
|
});
|
|
5130
|
+
if (err) {
|
|
5131
|
+
breakPrint = true;
|
|
5132
|
+
return;
|
|
5133
|
+
}
|
|
5055
5134
|
if (res?.success) {
|
|
5056
5135
|
defaultContext.receiptAllotInfo = res?.data?.bizOutputParam ?? [];
|
|
5057
5136
|
await invoiceSplitResultFn();
|
|
@@ -5060,44 +5139,44 @@ const createPrint = ()=>{
|
|
|
5060
5139
|
}
|
|
5061
5140
|
};
|
|
5062
5141
|
/**
|
|
5063
|
-
*
|
|
5064
|
-
*/ const receiptSplitResultFn = async ()=>{
|
|
5065
|
-
const [, res] = await splitReceipt({
|
|
5066
|
-
receiptId: defaultContext?.printParams?.receiptId,
|
|
5067
|
-
bizIdTypeCode: defaultContext?.printParams?.bizIdTypeCode,
|
|
5068
|
-
bizIds: defaultContext?.printParams?.bizIds
|
|
5069
|
-
});
|
|
5070
|
-
if (res?.success) defaultContext.splitResult = res.data?.receiptDataSourceList ?? [];
|
|
5071
|
-
};
|
|
5072
|
-
/**
|
|
5073
|
-
* 票据分单
|
|
5142
|
+
* 6.票据分单
|
|
5074
5143
|
*/ const invoiceSplitResultFn = async ()=>{
|
|
5075
5144
|
// 票据操作类型代码---1开具
|
|
5076
5145
|
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.ISSUE) {
|
|
5077
5146
|
const invoiceInfo = (defaultContext?.receiptAllotInfo ?? [])[0];
|
|
5078
5147
|
if (invoiceInfo?.invoiceMediaTypeCode === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_MEDIA_TYPE_CODE.ELECTRONIC && (defaultContext?.splitResult?.length ?? 0) < (invoiceInfo?.residueCount ?? 0)) {
|
|
5079
5148
|
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.error(`当前票据数量不足,所需票据张数[${defaultContext?.splitResult?.length}],剩余张数[${invoiceInfo?.residueCount}]!`);
|
|
5080
|
-
|
|
5149
|
+
breakPrint = true;
|
|
5150
|
+
return;
|
|
5081
5151
|
}
|
|
5082
|
-
const
|
|
5152
|
+
const invoiceList = (defaultContext?.splitResult ?? []).map((item)=>({
|
|
5153
|
+
receiptSort: item.receiptSort,
|
|
5154
|
+
receiptSplitResultId: item.receiptSplitResultId,
|
|
5155
|
+
invoiceAmt: defaultContext?.printParams?.invoiceInfo?.invoiceAmt
|
|
5156
|
+
}));
|
|
5157
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5083
5158
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
5084
5159
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
5085
5160
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV101,
|
|
5086
5161
|
params: {
|
|
5087
|
-
invoiceAllotId: defaultContext?.printParams?.invoiceInfo?.invoiceAllotId,
|
|
5088
|
-
invoiceUsageCode: defaultContext?.printParams?.invoiceInfo?.invoiceUsageCode,
|
|
5089
|
-
orgIssueFlag: defaultContext?.printParams?.invoiceInfo?.orgIssueFlag,
|
|
5162
|
+
invoiceAllotId: defaultContext?.printParams?.invoiceInfo?.invoiceAllotId ?? void 0,
|
|
5163
|
+
invoiceUsageCode: defaultContext?.printParams?.invoiceInfo?.invoiceUsageCode ?? void 0,
|
|
5164
|
+
orgIssueFlag: defaultContext?.printParams?.invoiceInfo?.orgIssueFlag ?? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO,
|
|
5090
5165
|
issueOrgName: defaultContext?.printParams?.invoiceInfo?.issueOrgName,
|
|
5091
5166
|
socialCreditNo: defaultContext?.printParams?.invoiceInfo?.socialCreditNo,
|
|
5092
5167
|
invoiceMemo: defaultContext?.printParams?.invoiceInfo?.invoiceMemo,
|
|
5093
|
-
invoiceList:
|
|
5168
|
+
invoiceList: invoiceList ?? []
|
|
5094
5169
|
}
|
|
5095
5170
|
});
|
|
5096
|
-
if (
|
|
5171
|
+
if (err) {
|
|
5172
|
+
breakPrint = true;
|
|
5173
|
+
return;
|
|
5174
|
+
}
|
|
5175
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
5097
5176
|
}
|
|
5098
5177
|
// 票据操作类型代码---6重开
|
|
5099
5178
|
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.REOPEN) {
|
|
5100
|
-
const [, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5179
|
+
const [error, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5101
5180
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
5102
5181
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
5103
5182
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV104,
|
|
@@ -5106,11 +5185,15 @@ const createPrint = ()=>{
|
|
|
5106
5185
|
invoiceIds: defaultContext?.printParams?.invoiceInfo?.invoiceIds
|
|
5107
5186
|
}
|
|
5108
5187
|
});
|
|
5109
|
-
if (
|
|
5188
|
+
if (error) {
|
|
5189
|
+
breakPrint = true;
|
|
5190
|
+
return;
|
|
5191
|
+
}
|
|
5192
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
5110
5193
|
}
|
|
5111
5194
|
// 票据操作类型代码---5换开
|
|
5112
5195
|
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.CHANGE) {
|
|
5113
|
-
const [, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5196
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5114
5197
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
5115
5198
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
5116
5199
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV103,
|
|
@@ -5119,11 +5202,15 @@ const createPrint = ()=>{
|
|
|
5119
5202
|
invoiceIds: defaultContext?.printParams?.invoiceInfo?.invoiceIds
|
|
5120
5203
|
}
|
|
5121
5204
|
});
|
|
5122
|
-
if (
|
|
5205
|
+
if (err) {
|
|
5206
|
+
breakPrint = true;
|
|
5207
|
+
return;
|
|
5208
|
+
}
|
|
5209
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
5123
5210
|
}
|
|
5124
5211
|
// 票据操作类型代码---3红冲
|
|
5125
|
-
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.
|
|
5126
|
-
const [, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5212
|
+
if (defaultContext?.printParams?.invoiceInfo?.invOperateTypeCode === constant_INV_OPERATE_TYPE_CODE.RED) {
|
|
5213
|
+
const [err, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
5127
5214
|
interfaceId: defaultContext?.printParams?.invoiceInfo?.invoiceInterfaceId ?? defaultContext?.receiptInfo?.invoiceInterfaceId,
|
|
5128
5215
|
menuId: defaultContext?.printParams?.sysMenuId,
|
|
5129
5216
|
tradeCode: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INVOICE_CODE.INV102,
|
|
@@ -5132,14 +5219,18 @@ const createPrint = ()=>{
|
|
|
5132
5219
|
invoiceUsageCode: defaultContext?.printParams?.invoiceInfo?.invoiceUsageCode,
|
|
5133
5220
|
bizIdTypeCode: defaultContext?.printParams?.bizIdTypeCode,
|
|
5134
5221
|
oldBizId: defaultContext?.printParams?.invoiceInfo?.oldBizId,
|
|
5135
|
-
redBizId: defaultContext?.printParams?.bizIds,
|
|
5222
|
+
redBizId: defaultContext?.printParams?.bizIds ?? defaultContext?.printParams?.bizIds[0],
|
|
5136
5223
|
onlyRedFlag: defaultContext?.printParams?.invoiceInfo?.onlyRedFlag
|
|
5137
5224
|
}
|
|
5138
5225
|
});
|
|
5139
|
-
if (
|
|
5226
|
+
if (err) {
|
|
5227
|
+
breakPrint = true;
|
|
5228
|
+
return;
|
|
5229
|
+
}
|
|
5230
|
+
if (res?.success) defaultContext.splitResult = res.data?.bizOutputParam ?? [];
|
|
5140
5231
|
}
|
|
5141
5232
|
};
|
|
5142
|
-
/**
|
|
5233
|
+
/** 7.循环打印 */ const printLoop = async ()=>{
|
|
5143
5234
|
// 修改这里:使用 Promise.all 等待所有异步操作完成
|
|
5144
5235
|
const results = await Promise.all((defaultContext?.splitResult || []).map(async (item)=>await printReceiptFn(item)));
|
|
5145
5236
|
// 检查结果数组中是否所有项都是 undefined
|
|
@@ -6494,8 +6585,8 @@ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo_hoisted_3 =
|
|
|
6494
6585
|
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>__props.bannerConfig?.bizId, ()=>{});
|
|
6495
6586
|
__expose({
|
|
6496
6587
|
searchRef: searchRef,
|
|
6497
|
-
invoiceRef:
|
|
6498
|
-
bannerRef:
|
|
6588
|
+
invoiceRef: invoiceRef,
|
|
6589
|
+
bannerRef: bannerRef
|
|
6499
6590
|
});
|
|
6500
6591
|
return (_ctx, _cache)=>{
|
|
6501
6592
|
const _component_el_button = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-button");
|