cnhis-design-vue 3.2.5-beta.4 → 3.2.5-beta.40
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/es/components/button-print/index.d.ts +6 -1
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +6 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +4 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +2 -0
- package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
- package/es/components/callback/src/components/render/popupMaps.d.ts +1607 -4
- package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
- package/es/components/card-reader-sdk/src/types/index.d.ts +1 -0
- package/es/components/default-page/src/index.vue2.js +1 -1
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
- package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
- package/es/components/field-set/src/components/edit-dialog.vue.d.ts +1 -1
- package/es/components/form-config/index.d.ts +157 -4
- package/es/components/form-config/src/FormConfig.vue.d.ts +157 -4
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +76 -2
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +81 -2
- package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
- package/es/components/form-config/src/types/index.d.ts +5 -0
- package/es/components/form-render/index.d.ts +76 -2
- package/es/components/form-render/src/FormRender.vue.d.ts +76 -2
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +76 -2
- package/es/components/form-render/src/components/renderer/levelSearchCascader/index.js +1 -1
- package/es/components/form-render/src/components/renderer/switch.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/switch.js +1 -1
- package/es/components/form-render/src/hooks/useAnchor.d.ts +1 -0
- package/es/components/form-render/src/hooks/useAnchor.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/components/iho-table/index.d.ts +1531 -2
- package/es/components/iho-table/src/IhoTable.vue.d.ts +1532 -3
- package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
- package/es/components/iho-table/src/constants/index.d.ts +1 -0
- package/es/components/iho-table/src/constants/index.js +1 -1
- package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +3 -2
- package/es/components/iho-table/src/hooks/tapHooks/index.js +1 -1
- package/es/components/iho-table/src/plugins/defaultConfigPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/utils.d.ts +0 -1
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/utils.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/seqRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rowDragPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/stickyFixedPlugin.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +2 -0
- package/es/components/iho-table/src/types/pluginType.d.ts +2 -1
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.js +1 -1
- package/es/components/info-header/index.d.ts +152 -4
- package/es/components/info-header/src/InfoHeader.vue.d.ts +152 -4
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +76 -2
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +76 -2
- package/es/components/scale-view/index.d.ts +4 -4
- package/es/components/scale-view/src/components/formitem/r-address.js +1 -1
- package/es/components/scale-view/src/components/formitem/r-input.js +1 -1
- package/es/components/scale-view/src/components/formitem/r-select.d.ts +4 -4
- package/es/components/scale-view/src/components/formitem/r-select.js +1 -1
- package/es/components/scale-view/src/hooks/scaleview-init.js +1 -1
- package/es/components/scale-view/src/hooks/use-component.d.ts +8 -8
- package/es/components/select-person/src/SearchOrgAndStaff.vue2.js +1 -1
- package/es/components/shortcut-setter/index.d.ts +77 -2
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +77 -2
- package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
- package/es/components/table-filter/src/types/enums.d.ts +4 -0
- package/es/components/table-filter/src/types/enums.js +1 -1
- package/es/components/table-filter/src/types/index.d.ts +1 -0
- package/es/shared/hooks/index.js +1 -1
- package/es/shared/hooks/selectHooks/index.d.ts +1 -0
- package/es/shared/hooks/selectHooks/index.js +1 -1
- package/es/shared/hooks/selectHooks/useMenuWidthAuto.d.ts +12 -0
- package/es/shared/hooks/selectHooks/useMenuWidthAuto.js +1 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/index.js +1 -1
- package/package.json +2 -2
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/pagerScroll.vue.d.ts +0 -26
|
@@ -422,6 +422,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
422
422
|
formatList: never[];
|
|
423
423
|
templateParams: never[];
|
|
424
424
|
printParams: never[];
|
|
425
|
+
originParams: {};
|
|
425
426
|
currentFormatId: string;
|
|
426
427
|
identityVerification: {
|
|
427
428
|
visible: boolean;
|
|
@@ -475,7 +476,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
475
476
|
toggleExpandLoading: (isLoading: boolean, formatId?: string | undefined) => void;
|
|
476
477
|
getCurrentLoading: () => boolean;
|
|
477
478
|
handleOneTypePrint: (templateCode: string, templateId: string, formatId: string, isOuterClick: boolean) => void;
|
|
478
|
-
handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, needContinuePrint?: boolean | undefined) => Promise<void>;
|
|
479
|
+
handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, printToParam?: never[], needContinuePrint?: boolean | undefined) => Promise<void>;
|
|
479
480
|
handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
|
480
481
|
handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
|
481
482
|
handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
|
|
@@ -488,12 +489,14 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
488
489
|
formatFormatList: (list: any[]) => any;
|
|
489
490
|
formatDefaultVal: (i: any, tableVal?: any) => any;
|
|
490
491
|
formatSomeTypeParams: (templateParams: any[], params?: any[]) => any;
|
|
492
|
+
formatSomeOriginParams: (templateParams: any[], params?: any[]) => any;
|
|
491
493
|
formatPrintParams: (paramObj: any, fieldList: any[], keyName: string) => any;
|
|
492
494
|
formatItemParam: ({ customizeDataset, param }: {
|
|
493
495
|
customizeDataset?: never[] | undefined;
|
|
494
496
|
param?: never[] | undefined;
|
|
495
497
|
}, paramObj?: any) => any;
|
|
496
498
|
findTemplateAndInsertData: (mergeData: any, paramItem: any, templateParams: any) => any;
|
|
499
|
+
findTemplateAndInsertParams: (mergeData: any, paramItem: any, templateParams: any) => any;
|
|
497
500
|
mergeTemplateList: (list: any[]) => any;
|
|
498
501
|
initCRM: (formatListResult: any) => Promise<void>;
|
|
499
502
|
init: () => Promise<boolean>;
|
|
@@ -2480,6 +2483,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
2480
2483
|
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
|
2481
2484
|
buttonClick: (origin: string) => Promise<false | undefined>;
|
|
2482
2485
|
renderLabel: (option: import("../../shared/types").AnyObject) => JSX.Element;
|
|
2486
|
+
debounce: (fn: any, delay: number, immediate?: boolean) => (...args: any) => void;
|
|
2483
2487
|
callLocalServicesSuccessCb: (res: any, type: any) => void;
|
|
2484
2488
|
callLocalServicesErrorCb: (res: unknown) => void;
|
|
2485
2489
|
callLocalServicesCancelCb: (res: unknown) => void;
|
|
@@ -2487,6 +2491,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
2487
2491
|
getPrintParams: (index?: number) => string;
|
|
2488
2492
|
getOnceParams: () => string;
|
|
2489
2493
|
handleClickPrint: () => void;
|
|
2494
|
+
handleDebounceClickPrint: (...args: any) => void;
|
|
2490
2495
|
handleClickPreview: () => Promise<void>;
|
|
2491
2496
|
handleClickPdf: () => Promise<void>;
|
|
2492
2497
|
handleClickEdit: () => void;
|
|
@@ -428,6 +428,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
428
428
|
formatList: never[];
|
|
429
429
|
templateParams: never[];
|
|
430
430
|
printParams: never[];
|
|
431
|
+
originParams: {};
|
|
431
432
|
currentFormatId: string;
|
|
432
433
|
identityVerification: {
|
|
433
434
|
visible: boolean;
|
|
@@ -481,7 +482,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
481
482
|
toggleExpandLoading: (isLoading: boolean, formatId?: string | undefined) => void;
|
|
482
483
|
getCurrentLoading: () => boolean;
|
|
483
484
|
handleOneTypePrint: (templateCode: string, templateId: string, formatId: string, isOuterClick: boolean) => void;
|
|
484
|
-
handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, needContinuePrint?: boolean | undefined) => Promise<void>;
|
|
485
|
+
handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, printToParam?: never[], needContinuePrint?: boolean | undefined) => Promise<void>;
|
|
485
486
|
handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
|
486
487
|
handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
|
487
488
|
handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
|
|
@@ -494,12 +495,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
494
495
|
formatFormatList: (list: any[]) => any;
|
|
495
496
|
formatDefaultVal: (i: any, tableVal?: any) => any;
|
|
496
497
|
formatSomeTypeParams: (templateParams: any[], params?: any[]) => any;
|
|
498
|
+
formatSomeOriginParams: (templateParams: any[], params?: any[]) => any;
|
|
497
499
|
formatPrintParams: (paramObj: any, fieldList: any[], keyName: string) => any;
|
|
498
500
|
formatItemParam: ({ customizeDataset, param }: {
|
|
499
501
|
customizeDataset?: never[] | undefined;
|
|
500
502
|
param?: never[] | undefined;
|
|
501
503
|
}, paramObj?: any) => any;
|
|
502
504
|
findTemplateAndInsertData: (mergeData: any, paramItem: any, templateParams: any) => any;
|
|
505
|
+
findTemplateAndInsertParams: (mergeData: any, paramItem: any, templateParams: any) => any;
|
|
503
506
|
mergeTemplateList: (list: any[]) => any;
|
|
504
507
|
initCRM: (formatListResult: any) => Promise<void>;
|
|
505
508
|
init: () => Promise<boolean>;
|
|
@@ -2486,6 +2489,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2486
2489
|
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
|
2487
2490
|
buttonClick: (origin: string) => Promise<false | undefined>;
|
|
2488
2491
|
renderLabel: (option: AnyObject) => JSX.Element;
|
|
2492
|
+
debounce: (fn: any, delay: number, immediate?: boolean) => (...args: any) => void;
|
|
2489
2493
|
callLocalServicesSuccessCb: (res: any, type: any) => void;
|
|
2490
2494
|
callLocalServicesErrorCb: (res: unknown) => void;
|
|
2491
2495
|
callLocalServicesCancelCb: (res: unknown) => void;
|
|
@@ -2493,6 +2497,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2493
2497
|
getPrintParams: (index?: number) => string;
|
|
2494
2498
|
getOnceParams: () => string;
|
|
2495
2499
|
handleClickPrint: () => void;
|
|
2500
|
+
handleDebounceClickPrint: (...args: any) => void;
|
|
2496
2501
|
handleClickPreview: () => Promise<void>;
|
|
2497
2502
|
handleClickPdf: () => Promise<void>;
|
|
2498
2503
|
handleClickEdit: () => void;
|
|
@@ -225,6 +225,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
225
225
|
formatList: never[];
|
|
226
226
|
templateParams: never[];
|
|
227
227
|
printParams: never[];
|
|
228
|
+
originParams: {};
|
|
228
229
|
currentFormatId: string;
|
|
229
230
|
identityVerification: {
|
|
230
231
|
visible: boolean;
|
|
@@ -278,7 +279,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
278
279
|
toggleExpandLoading: (isLoading: boolean, formatId?: string) => void;
|
|
279
280
|
getCurrentLoading: () => boolean;
|
|
280
281
|
handleOneTypePrint: (templateCode: string, templateId: string, formatId: string, isOuterClick: boolean) => void;
|
|
281
|
-
handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, needContinuePrint?: boolean) => Promise<void>;
|
|
282
|
+
handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, printToParam?: never[], needContinuePrint?: boolean) => Promise<void>;
|
|
282
283
|
handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
|
283
284
|
handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
|
284
285
|
handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
|
|
@@ -291,12 +292,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
291
292
|
formatFormatList: (list: any[]) => any;
|
|
292
293
|
formatDefaultVal: (i: any, tableVal?: any) => any;
|
|
293
294
|
formatSomeTypeParams: (templateParams: any[], params?: any[]) => any;
|
|
295
|
+
formatSomeOriginParams: (templateParams: any[], params?: any[]) => any;
|
|
294
296
|
formatPrintParams: (paramObj: any, fieldList: any[], keyName: string) => any;
|
|
295
297
|
formatItemParam: ({ customizeDataset, param }: {
|
|
296
298
|
customizeDataset?: never[] | undefined;
|
|
297
299
|
param?: never[] | undefined;
|
|
298
300
|
}, paramObj?: any) => any;
|
|
299
301
|
findTemplateAndInsertData: (mergeData: any, paramItem: any, templateParams: any) => any;
|
|
302
|
+
findTemplateAndInsertParams: (mergeData: any, paramItem: any, templateParams: any) => any;
|
|
300
303
|
mergeTemplateList: (list: any[]) => any;
|
|
301
304
|
initCRM: (formatListResult: any) => Promise<void>;
|
|
302
305
|
init: () => Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as t,inject as e,ref as n,reactive as i,computed as r,onMounted as a,watch as l,openBlock as o,createElementBlock as s,Fragment as u,createElementVNode as c,createCommentVNode as d,createVNode as p,unref as m,withCtx as y,renderList as v,createBlock as f,createTextVNode as g,toDisplayString as k,isRef as h,renderSlot as b,withModifiers as w,normalizeClass as P,mergeProps as O}from"vue";import{isObject as S}from"@vue/shared";import{useMessage as C,NButtonGroup as I,NDropdown as T,NButton as L,NIcon as F,NPopover as M,NCheckbox as j,NDivider as N}from"naive-ui";import{PrintOutline as x,SettingsOutline as E,ChevronDownSharp as _,ArrowForwardOutline as D}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as J}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as A}from"date-fns";import"../api.js";const K={class:"newprint-button-outer"},B=c("span",{class:"label bold"},"外显设置",-1),R={class:"newprint-button-poperOver"},H={class:"print-lite"},q={class:"label bold"},G={class:"print-li"},Y={class:"print-lite"},$={class:"newprint-button-poperOver"},Q=["onMouseenter","onClick"],W={class:"label bold"},X={class:"newprint-button-poperOver"},Z={class:"print-lite"},tt={class:"label bold"},et={class:"print-li"},nt={class:"print-lite"},it=["onClick"],rt={class:"newprint-button-poperOver"},at=["onMouseenter"],lt={class:"print-lite"},ot=["onClick"];var st=t({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:""})}},setup(t,{expose:st}){const ut=t,ct=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],dt=C();let pt;const mt=e(z),yt=n(""),vt=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[]});let ft=n([]),gt=n([{label:ut.pdfLoadText,key:"downloadPdf"},{label:ut.previewText,key:"previewText"},{label:ut.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const kt=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),ht=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),bt=n([]),wt=n([]),Pt=r((()=>{if(!vt.currentFormatId)return{};let t=vt.currentFormatId;return vt.formatList.find((e=>e.id===t))}));r((()=>{var t;return(null==(t=Pt.value)?void 0:t.name)||"格式选择"}));const Ot=r((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.templateId})),St=r((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.number})),Ct=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowPrintAll})),It=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=r((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.customProps)||{}})),Lt=r((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.defaultFormatId)||""})),Ft=r((()=>{const t=ct.map((t=>t.key));return ft.value.filter((e=>!t.includes(e.key)))})),Mt=r({get:()=>Ft.value.every((t=>t.selected)),set(t){Ft.value.forEach((e=>{e.selected=t}))}}),jt=async()=>{var t,e;(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)||await ee(),ht.oneShow=!0},Nt=async t=>{if(ut.directPrint){if(vt.spinning)return;return"button"===t?void(Ct.value?await ie():Lt.value?async function(t){await ee(!1);const e=bt.value.find((e=>e.key==t));e&&Ht(e.templateCode,e.templateId,e.key,!1)}(Lt.value):jt()):jt()}return jt()},xt=(t,e)=>{kt[t]=e},Et=()=>{bt.value=ft.value.filter((t=>!t.selected)),wt.value=Ft.value.filter((t=>t.selected)),Dt("oneShow"),Dt("isOutSetting"),mt("saveOuterPrint",wt.value)},_t=t=>{ht[t]=!0},Dt=t=>{kt.oneClickType="",ht[t]=!1,"isOutSetting"==t&&(ht.isOutSetting=!1)},zt=(t,e)=>{Bt(!1);let n={type:e,formatId:vt.currentFormatId,templateId:Ot.value};mt("success",t,n)},Jt=t=>{Bt(!1),mt("error",t),S(t)&&"notInstalledApp"===t.type&&dt.error(t.message)},Ut=t=>{Bt(!1),mt("cancel",t)},Vt=t=>{mt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},At=()=>JSON.stringify({...ut.token?{token:ut.token}:{}}),Kt=(t=[],e)=>{var n,i;let r={},a={};if((null==(n=vt.templateParams[e].customizeDataset)?void 0:n.length)>0){const e=(null==(i=Object.keys(t[0].datasetData||{}))?void 0:i[0])||"",n=JSON.stringify(t.map((t=>JSON.parse(t.datasetData[e]))));a={datasetData:{}},a.datasetData[e]=n}else Object.keys(t[0]).forEach((e=>{a[e]=[],t.forEach((t=>{a[e].includes(t[e])||a[e].push(t[e])})),a[e]=a[e].join(",")}));return r=Object.assign({},JSON.parse(At()),Tt.value,a),JSON.stringify(r)},Bt=(t,e)=>{if(vt.isClickOuterPrint){if(t&&e){const n=wt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}wt.value.forEach((t=>{t.isLoading=!1}))}else vt.spinning=t},Rt=()=>vt.isClickOuterPrint?wt.value.some((t=>t.isLoading)):vt.spinning,Ht=(t,e,n,i)=>{const r=vt.printParams[t];r&&(vt.isClickOuterPrint=i,vt.currentFormatId=n,qt(r,t,e,n))},qt=async(t=[],e,n,i,r)=>{let a=t.length;const l=async t=>{try{--a<=0&&zt(t,"print")}catch(t){console.log("error",t)}};ut.showLoading&&Rt()&&!r||(Bt(!0,i),ut.prevFn("print").then((()=>{vt.curPrintParamList=t;const r={formatId:i,templateId:n,authorizationKey:yt.value,printdlgshow:ut.printdlgshow,signature:ut.signature,copies:ut.printCopies};if("MULTI"===ut.strategy)for(let e=0;e<t.length;e++){e>0&&(r.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[e]));pt.printDirect({...r,params:n},l,Jt,Ut)}else pt.printDirect({...r,params:Kt(t,e)},(n=>{n.params=Kt(t,e),zt(n,"print")}),Jt,Ut)})).catch((()=>{Vt("print"),Bt(!1)})).finally((()=>{vt.visible=!1})))},Gt=async(t,{templateCode:e,templateId:n,key:i},r)=>{const a=vt.printParams[e];if(a)switch(vt.isClickOuterPrint=r,vt.currentFormatId=i,t){case"previewText":(async(t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("preview").then((()=>{vt.curPrintParamList=t;const r=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?r:Kt(t,e),l={formatId:i,templateId:n,authorizationKey:yt.value,params:a,btnprint:ut.btnprint,signature:ut.signature};pt.preview(l,(t=>{zt(t,"preview")}),Jt)})).catch((()=>{Vt("preview"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,i);break;case"formatEditText":((t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("edit").then((()=>{vt.curPrintParamList=t,vt.currentFormatId=i,vt.identityVerification.visible=!0})).catch((()=>{Vt("edit")})).finally((()=>{Bt(!1)})))})(a,0,0,i);break;case"downloadPdf":(async(t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("download").then((()=>{vt.curPrintParamList=t;const r=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?r:Kt(t,e),l={formatId:i,templateId:n,authorizationKey:yt.value,print:{print:"1",type:"1"},params:a,signature:ut.signature};pt.downloadPDF(l,(t=>zt(t,"preview")),Jt)})).catch((()=>{Vt("download"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,i);break;case"resetPrinter":(async(t=[],e,n,i)=>{if(ut.showLoading&&Rt())return;Bt(!0,i);const r=await pt.resetPrinter(i);Bt(!1),"success"!=(null==r?void 0:r.result)?dt.warning("重置打印机失败"):dt.success(r.message||"重置打印机成功")})(a,0,0,i)}},Yt=()=>{},$t=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},Xt(n,e,t))})),n},Qt=(t,e,n)=>{const i={};return e.forEach((e=>{let r=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=A(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&r&&(i[e[n]]=r)})),i},Wt=({customizeDataset:t=[],param:e=[]},n={})=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[t.name]=JSON.stringify(Qt(n,e,"fieldName"))})),i=Object.assign({},i,Qt(n,e,"key")),i},Xt=(t,e,n)=>{if(e.templateNumbers){for(let i=0;i<e.templateNumbers.length;i++){const r=e.templateNumbers[i],a=n[r];if(!a)return dt.error("当前勾选的数据没有匹配的模板"),t;t[r]||(t[r]=[]),t[r].push(Wt(a,e))}return t}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return dt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(Wt(l,e))}return t},Zt=async t=>{vt.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],(()=>{var t,e,n;const i=vt.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1,isLoading:!1})));ft.value.unshift(...i),It.value&&ft.value.push(...ct),(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)>0&&(ft.value.forEach((t=>{var e;(null==(e=ut.newPrintSetting)?void 0:e.outerPrintKeys.includes(t.key))&&(t.selected=!0)})),wt.value=ft.value.filter((t=>t.selected))),bt.value=ft.value.filter((t=>!t.selected)),ut.hideButtons.length>0&&(gt.value=gt.value.filter((t=>!ut.hideButtons.includes(t.key))));const r=sessionStorage.getItem("portal");if(r){const t=JSON.parse(r),e=(null==(n=null==t?void 0:t.user)?void 0:n.currentRoleResourceObj)||{},i=Object.keys(e);i.includes("RY7.2.21.1.M2.G94181E")||(gt.value=gt.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(gt.value=gt.value.filter((t=>"formatEditText"!=t.key)))}})(),vt.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),vt.printParams=$t(vt.templateParams,ut.params)},te=async()=>{var t;if(vt.isInited)return!0;vt.isInited=!0,vt.spinning=!0,(()=>{if(pt)return!1;pt=new J})();const e=await ut.queryPrintFormatByNumber();return await Zt(e),(null==(t=e.obj)?void 0:t.length)>0&&(yt.value=e.obj[0].authorizationKey||""),vt.spinning=!1,!0},ee=async(t=!0)=>{if(await ut.clickPrevFn()){if(!vt.visible){if(!await te())return!1}t&&(vt.visible=!vt.visible)}},ne=t=>{if(vt.identityVerification.visible=!1,U(vt.currentFormatId))return zt(null,"edit");const e=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,vt.curPrintParamList[0])),n="MULTI"===ut.strategy?e:Kt(vt.curPrintParamList,St.value),i={formatId:vt.currentFormatId,templateId:Ot.value,params:n,token:t};pt.editPrintFormat(i,(t=>{zt(t,"edit")}),Jt)};async function ie(){await ee(!1),(()=>{const t=Object.keys(vt.printParams);vt.isClickOuterPrint=!1;for(let e=0;e<t.length;e++){const n=t[e],i=vt.printParams[n],r=vt.formatList.filter((t=>t.number==n));r&&r.length>0&&r.forEach((t=>{vt.currentFormatId=t.id,qt(i,t.number,t.templateId,t.id,!0)}))}})()}return a((()=>{vt.isInited=!1})),l((()=>ut.params),(t=>{Object.keys(vt.templateParams).length>0&&(vt.printParams=$t(vt.templateParams,ut.params))}),{deep:!0}),l((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys}),(async t=>{(null==t?void 0:t.length)>0&&await ee(!1)}),{deep:!0,immediate:!0}),st({directPrint:ie}),(e,n)=>(o(),s(u,null,[c("div",K,[d(" 外显按钮集合 "),p(m(I),null,{default:y((()=>[(o(!0),s(u,null,v(wt.value,(e=>{return o(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Yt,options:(n=m(gt),i=e,vt.printParams[i.templateCode]?n:[]),onSelect:t=>Gt(t,e,!0)},{default:y((()=>[p(m(L),{disabled:!vt.printParams[e.templateCode],loading:t.showLoading&&e.isLoading,onClick:t=>Ht(e.templateCode,e.templateId,e.key,!0)},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(e.label),1)])),_:2},1032,["disabled","loading","onClick"])])),_:2},1032,["options","onSelect"]);var n,i})),128))])),_:1}),d(' <n-button-group>\r\n\t\t\t<n-popover\r\n\t\t\t\tv-for="outer in outerPrintItems"\r\n :key="outer.key"\r\n\t\t\t\ttrigger="hover"\r\n\t\t\t\t:show-arrow="false"\r\n\t\t\t\t:show="downlistPopover.isOperation"\r\n\t\t\t\t@clickoutside="handleClickOutHide(\'isOperation\')"\r\n\t\t\t>\r\n\t\t\t\t<template #trigger>\r\n\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t@mouseenter="delayShowPopover(\'isOperation\')"\r\n\t\t\t\t\t\t@mouseleave="handleClickOutHide(\'isOperation\')"\r\n\t\t\t\t\t\t@click="console.log(33)"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t<n-icon :component="PrintOutline" size="18"></n-icon>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t<span class="label bold">{{ outer.label }}</span>\r\n\t\t\t\t\t</n-button>\r\n\t\t\t\t</template>\r\n\t\t\t\t<div class="newprint-button-poperOver">\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass="print-li"\r\n\t\t\t\t\t\tv-for="operation in operations"\r\n\t\t\t\t\t\t:key="operation.key"\r\n\t\t\t\t\t\t:class="downlistOperation.twoMouseType==operation.key ? \'active\' : \'\' "\r\n\t\t\t\t\t\t@mouseenter="handleTypeChange(\'twoMouseType\', operation.key)"\r\n\t\t\t\t\t\t@mouseleave="handleTypeChange(\'twoMouseType\', \'\')"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<div class="print-lite">\r\n\t\t\t\t\t\t\t<span class="label"> {{ operation.label }} </span>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</n-popover>\r\n\t\t</n-button-group> '),d(" 外显设置按钮 "),wt.value.length>0&&wt.value.length==m(Ft).length&&m(It)?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,show:ht.isOutSetting,onClickoutside:n[2]||(n[2]=t=>Dt("isOutSetting"))},{trigger:y((()=>[p(m(L),{onClick:n[0]||(n[0]=t=>_t("isOutSetting"))},{default:y((()=>[B,p(m(F),{style:{"margin-left":"8px"},component:m(E),size:"18"},null,8,["component"])])),_:1})])),default:y((()=>[c("div",R,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",H,[c("span",q,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[p(m(N)),c("div",Y,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Mt),"onUpdate:checked":n[1]||(n[1]=t=>h(Mt)?Mt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:1},8,["show"])):(o(),s(u,{key:1},[d(" 打印全部按钮 "),p(m(M),{trigger:"click","show-arrow":!1,show:ht.oneShow,onClickoutside:n[10]||(n[10]=t=>Dt("oneShow"))},{trigger:y((()=>[b(e.$slots,"button",{handleClickPrintBtn:ee,printSpinning:vt.spinning,printbtnText:t.btnText,printVisible:vt.visible},(()=>[p(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>Nt("icon")),["stop"]))},{default:y((()=>[p(m(L),{loading:t.showLoading&&vt.spinning,onClick:n[3]||(n[3]=w((()=>Nt("button")),["stop"]))},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),p(m(L),{class:"icon-select"},{icon:y((()=>[p(m(F),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:y((()=>[c("div",$,[(o(!0),s(u,null,v(bt.value,(t=>(o(),s("div",{class:P(["print-li",kt.oneMouseType==t.key||kt.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>((t,e,n)=>{if(!vt.printParams[n.templateCode])return[];xt(t,e)})("oneClickType",t.key,t)},["divider"==t.key?(o(),f(m(N),{key:0})):"outSetting"==t.key?(o(),s(u,{key:1},[d(" 第二层外显设置 "),p(m(M),{trigger:"click","show-arrow":!1,placement:"right-start",show:ht.isOutSetting,onClickoutside:n[7]||(n[7]=t=>Dt("isOutSetting"))},{trigger:y((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>_t("isOutSetting"))},[c("span",W,k(t.label),1),p(m(F),{style:{background:"transparent"},component:m(E),size:"18"},null,8,["component"])])])),default:y((()=>[c("div",X,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[p(m(N)),c("div",nt,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Mt),"onUpdate:checked":n[6]||(n[6]=t=>h(Mt)?Mt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:2},1032,["show"])],2112)):(o(),s(u,{key:2},[d(" 第二层功能操作 "),c("div",{class:P(["print-lite",vt.printParams[t.templateCode]?"":"isDisabled"])},[c("span",{class:"label bold",onClick:e=>Ht(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,it),vt.printParams[t.templateCode]?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:ht[t.key],onClickoutside:e=>Dt(t.key)},{trigger:y((()=>[p(m(F),{component:m(D),size:"18",onClick:e=>_t(t.key)},null,8,["component","onClick"])])),default:y((()=>[c("div",rt,[(o(!0),s(u,null,v(m(gt),(e=>(o(),s("div",{class:P(["print-li",kt.twoMouseType==e.key?"active":""]),key:e.key,onMouseenter:t=>xt("twoMouseType",e.key),onMouseleave:n[8]||(n[8]=t=>xt("twoMouseType",""))},[c("div",lt,[c("span",{class:"label",onClick:n=>Gt(e.key,t,!1)},k(e.label),9,ot)])],42,at)))),128))])])),_:2},1032,["show","onClickoutside"])):d("v-if",!0)],2)],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),p(V,O(e.$attrs,{modelValue:vt.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>vt.identityVerification.visible=t),formatId:vt.currentFormatId,templateId:m(Ot),onSuccess:ne}),null,16,["modelValue","formatId","templateId"])],64))}});export{st as default};
|
|
1
|
+
import{defineComponent as t,inject as e,ref as n,reactive as r,computed as i,onMounted as a,watch as l,openBlock as o,createElementBlock as s,Fragment as u,createElementVNode as c,createCommentVNode as d,createVNode as p,unref as m,withCtx as y,renderList as v,createBlock as f,createTextVNode as g,toDisplayString as k,isRef as h,renderSlot as b,withModifiers as w,normalizeClass as P,mergeProps as O}from"vue";import{isObject as S}from"@vue/shared";import{useMessage as C,NButtonGroup as I,NDropdown as T,NButton as L,NIcon as F,NPopover as j,NCheckbox as M,NDivider as N}from"naive-ui";import{PrintOutline as x,SettingsOutline as E,ChevronDownSharp as _,ArrowForwardOutline as D}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as J}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as A}from"date-fns";import"../api.js";const K={class:"newprint-button-outer"},B=c("span",{class:"label bold"},"外显设置",-1),R={class:"newprint-button-poperOver"},H={class:"print-lite"},q={class:"label bold"},G={class:"print-li"},Y={class:"print-lite"},$={class:"newprint-button-poperOver"},Q=["onMouseenter","onClick"],W={class:"label bold"},X={class:"newprint-button-poperOver"},Z={class:"print-lite"},tt={class:"label bold"},et={class:"print-li"},nt={class:"print-lite"},rt=["onClick"],it={class:"newprint-button-poperOver"},at=["onMouseenter"],lt={class:"print-lite"},ot=["onClick"];var st=t({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:""})}},setup(t,{expose:st}){const ut=t,ct=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],dt=C();let pt;const mt=e(z),yt=n(""),vt=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[]});let ft=n([]),gt=n([{label:ut.pdfLoadText,key:"downloadPdf"},{label:ut.previewText,key:"previewText"},{label:ut.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const kt=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),ht=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),bt=n([]),wt=n([]),Pt=i((()=>{if(!vt.currentFormatId)return{};let t=vt.currentFormatId;return vt.formatList.find((e=>e.id===t))}));i((()=>{var t;return(null==(t=Pt.value)?void 0:t.name)||"格式选择"}));const Ot=i((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.templateId})),St=i((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.number})),Ct=i((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowPrintAll})),It=i((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=i((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.customProps)||{}})),Lt=i((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.defaultFormatId)||""})),Ft=i((()=>{const t=ct.map((t=>t.key));return ft.value.filter((e=>!t.includes(e.key)))})),jt=i({get:()=>Ft.value.every((t=>t.selected)),set(t){Ft.value.forEach((e=>{e.selected=t}))}}),Mt=async()=>{var t,e;(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)||await re(),ht.oneShow=!0},Nt=async t=>{if(ut.directPrint){if(vt.spinning)return;return"button"===t?void(Ct.value?await ae():Lt.value?async function(t){await re(!1);const e=bt.value.find((e=>e.key==t));e&&Ht(e.templateCode,e.templateId,e.key,!1)}(Lt.value):Mt()):Mt()}return Mt()},xt=(t,e)=>{kt[t]=e},Et=()=>{bt.value=ft.value.filter((t=>!t.selected)),wt.value=Ft.value.filter((t=>t.selected)),Dt("oneShow"),Dt("isOutSetting"),mt("saveOuterPrint",wt.value)},_t=t=>{ht[t]=!0},Dt=t=>{kt.oneClickType="",ht[t]=!1,"isOutSetting"==t&&(ht.isOutSetting=!1)},zt=(t,e)=>{Bt(!1);let n={type:e,formatId:vt.currentFormatId,templateId:(null==t?void 0:t.templateId)||Ot.value,templateCode:(null==t?void 0:t.templateCode)||St.value};mt("success",t,n)},Jt=t=>{Bt(!1),mt("error",t),S(t)&&"notInstalledApp"===t.type&&dt.error(t.message)},Ut=t=>{Bt(!1),mt("cancel",t)},Vt=t=>{mt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},At=()=>JSON.stringify({...ut.token?{token:ut.token}:{}}),Kt=(t=[],e)=>{var n,r;let i={},a={};if((null==(n=vt.templateParams[e].customizeDataset)?void 0:n.length)>0){const e=(null==(r=Object.keys(t[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(t.map((t=>JSON.parse(t.datasetData[e]))));a={datasetData:{}},a.datasetData[e]=n}else Object.keys(t[0]).forEach((e=>{a[e]=[],t.forEach((t=>{a[e].includes(t[e])||a[e].push(t[e])})),a[e]=a[e].join(",")}));return i=Object.assign({},JSON.parse(At()),Tt.value,a),JSON.stringify(i)},Bt=(t,e)=>{if(vt.isClickOuterPrint){if(t&&e){const n=wt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}wt.value.forEach((t=>{t.isLoading=!1}))}else vt.spinning=t},Rt=()=>vt.isClickOuterPrint?wt.value.some((t=>t.isLoading)):vt.spinning,Ht=(t,e,n,r)=>{const i=vt.printParams[t];if(!i)return;vt.isClickOuterPrint=r,vt.currentFormatId=n;const a=vt.originParams[t]||[];qt(i,t,e,n,a)},qt=async(t=[],e,n,r,i=[],a)=>{let l=t.length;const o=async t=>{try{--l<=0&&zt(t,"print")}catch(t){console.log("error",t)}};ut.showLoading&&Rt()&&!a||(Bt(!0,r),ut.prevFn("print").then((()=>{vt.curPrintParamList=t;const a={formatId:r,templateId:n,authorizationKey:yt.value,printdlgshow:ut.printdlgshow,signature:ut.signature,copies:ut.printCopies};if("MULTI"===ut.strategy)for(let e=0;e<t.length;e++){e>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[e]));pt.printDirect({...a,params:n},o,Jt,Ut)}else pt.printDirect({...a,params:Kt(t,e)},(t=>{t.params=i,t.templateCode=e,t.templateId=n,zt(t,"print")}),Jt,Ut)})).catch((()=>{Vt("print"),Bt(!1)})).finally((()=>{vt.visible=!1})))},Gt=async(t,{templateCode:e,templateId:n,key:r},i)=>{const a=vt.printParams[e];if(a)switch(vt.isClickOuterPrint=i,vt.currentFormatId=r,t){case"previewText":(async(t=[],e,n,r)=>{ut.showLoading&&Rt()||(Bt(!0,r),ut.prevFn("preview").then((()=>{vt.curPrintParamList=t;const i=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?i:Kt(t,e),l={formatId:r,templateId:n,authorizationKey:yt.value,params:a,btnprint:ut.btnprint,signature:ut.signature};pt.preview(l,(t=>{zt(t,"preview")}),Jt)})).catch((()=>{Vt("preview"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,r);break;case"formatEditText":((t=[],e,n,r)=>{ut.showLoading&&Rt()||(Bt(!0,r),ut.prevFn("edit").then((()=>{vt.curPrintParamList=t,vt.currentFormatId=r,vt.identityVerification.visible=!0})).catch((()=>{Vt("edit")})).finally((()=>{Bt(!1)})))})(a,0,0,r);break;case"downloadPdf":(async(t=[],e,n,r)=>{ut.showLoading&&Rt()||(Bt(!0,r),ut.prevFn("download").then((()=>{vt.curPrintParamList=t;const i=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?i:Kt(t,e),l={formatId:r,templateId:n,authorizationKey:yt.value,print:{print:"1",type:"1"},params:a,signature:ut.signature};pt.downloadPDF(l,(t=>zt(t,"preview")),Jt)})).catch((()=>{Vt("download"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,r);break;case"resetPrinter":(async(t=[],e,n,r)=>{if(ut.showLoading&&Rt())return;Bt(!0,r);const i=await pt.resetPrinter(r);Bt(!1),"success"!=(null==i?void 0:i.result)?dt.warning("重置打印机失败"):dt.success(i.message||"重置打印机成功")})(a,0,0,r)}},Yt=()=>{},$t=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},Zt(n,e,t))})),n},Qt=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},te(n,e,t))})),n},Wt=(t,e,n)=>{const r={};return e.forEach((e=>{let i=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(r=A(e,n[t.type])),(null==t?void 0:t.defaultValue)||r})(e,t[e[n]]);t[e[n]]&&i&&(r[e[n]]=i)})),r},Xt=({customizeDataset:t=[],param:e=[]},n={})=>{let r={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[t.name]=JSON.stringify(Wt(n,e,"fieldName"))})),r=Object.assign({},r,Wt(n,e,"key")),r},Zt=(t,e,n)=>{if(e.templateNumbers){for(let r=0;r<e.templateNumbers.length;r++){const i=e.templateNumbers[r],a=n[i];if(!a)return dt.error("当前勾选的数据没有匹配的模板"),t;t[i]||(t[i]=[]),t[i].push(Xt(a,e))}return t}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return dt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(Xt(l,e))}return t},te=(t,e,n)=>{if(e.templateNumbers){for(let r=0;r<e.templateNumbers.length;r++){const i=e.templateNumbers[r];if(!n[i])return dt.error("当前勾选的数据没有匹配的模板"),t;t[i]||(t[i]=[]),t[i].push(e)}return t}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return dt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(e)}return t},ee=async t=>{vt.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],(()=>{var t,e,n;const r=vt.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1,isLoading:!1})));ft.value.unshift(...r),It.value&&ft.value.push(...ct),(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)>0&&(ft.value.forEach((t=>{var e;(null==(e=ut.newPrintSetting)?void 0:e.outerPrintKeys.includes(t.key))&&(t.selected=!0)})),wt.value=ft.value.filter((t=>t.selected))),bt.value=ft.value.filter((t=>!t.selected)),ut.hideButtons.length>0&&(gt.value=gt.value.filter((t=>!ut.hideButtons.includes(t.key))));const i=sessionStorage.getItem("portal");if(i){const t=JSON.parse(i),e=(null==(n=null==t?void 0:t.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(e);r.includes("RY7.2.21.1.M2.G94181E")||(gt.value=gt.value.filter((t=>"downloadPdf"!=t.key))),r.includes("RY7.2.21.1.M2.G33633A")||(gt.value=gt.value.filter((t=>"formatEditText"!=t.key)))}})(),vt.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),vt.printParams=$t(vt.templateParams,ut.params),vt.originParams=Qt(vt.templateParams,ut.params)},ne=async()=>{var t;if(vt.isInited)return!0;vt.isInited=!0,vt.spinning=!0,(()=>{if(pt)return!1;pt=new J})();const e=await ut.queryPrintFormatByNumber();return await ee(e),(null==(t=e.obj)?void 0:t.length)>0&&(yt.value=e.obj[0].authorizationKey||""),vt.spinning=!1,!0},re=async(t=!0)=>{if(await ut.clickPrevFn()){if(!vt.visible){if(!await ne())return!1}t&&(vt.visible=!vt.visible)}},ie=t=>{if(vt.identityVerification.visible=!1,U(vt.currentFormatId))return zt(null,"edit");const e=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,vt.curPrintParamList[0])),n="MULTI"===ut.strategy?e:Kt(vt.curPrintParamList,St.value),r={formatId:vt.currentFormatId,templateId:Ot.value,params:n,token:t};pt.editPrintFormat(r,(t=>{zt(t,"edit")}),Jt)};async function ae(){await re(!1),(()=>{const t=Object.keys(vt.printParams);vt.isClickOuterPrint=!1;const e=vt.originParams;for(let n=0;n<t.length;n++){const r=t[n],i=vt.printParams[r],a=e[r]||[],l=vt.formatList.filter((t=>t.number==r));l&&l.length>0&&l.forEach((t=>{vt.currentFormatId=t.id,qt(i,t.number,t.templateId,t.id,a,!0)}))}})()}return a((()=>{vt.isInited=!1})),l((()=>ut.params),(t=>{Object.keys(vt.templateParams).length>0&&(vt.printParams=$t(vt.templateParams,ut.params),vt.originParams=Qt(vt.templateParams,ut.params))}),{deep:!0}),l((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys}),(async t=>{(null==t?void 0:t.length)>0&&await re(!1)}),{deep:!0,immediate:!0}),st({directPrint:ae}),(e,n)=>(o(),s(u,null,[c("div",K,[d(" 外显按钮集合 "),p(m(I),null,{default:y((()=>[(o(!0),s(u,null,v(wt.value,(e=>{return o(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Yt,options:(n=m(gt),r=e,vt.printParams[r.templateCode]?n:[]),onSelect:t=>Gt(t,e,!0)},{default:y((()=>[p(m(L),{disabled:!vt.printParams[e.templateCode],loading:t.showLoading&&e.isLoading,onClick:t=>Ht(e.templateCode,e.templateId,e.key,!0)},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(e.label),1)])),_:2},1032,["disabled","loading","onClick"])])),_:2},1032,["options","onSelect"]);var n,r})),128))])),_:1}),d(' <n-button-group>\r\n\t\t\t<n-popover\r\n\t\t\t\tv-for="outer in outerPrintItems"\r\n :key="outer.key"\r\n\t\t\t\ttrigger="hover"\r\n\t\t\t\t:show-arrow="false"\r\n\t\t\t\t:show="downlistPopover.isOperation"\r\n\t\t\t\t@clickoutside="handleClickOutHide(\'isOperation\')"\r\n\t\t\t>\r\n\t\t\t\t<template #trigger>\r\n\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t@mouseenter="delayShowPopover(\'isOperation\')"\r\n\t\t\t\t\t\t@mouseleave="handleClickOutHide(\'isOperation\')"\r\n\t\t\t\t\t\t@click="console.log(33)"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t<n-icon :component="PrintOutline" size="18"></n-icon>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t<span class="label bold">{{ outer.label }}</span>\r\n\t\t\t\t\t</n-button>\r\n\t\t\t\t</template>\r\n\t\t\t\t<div class="newprint-button-poperOver">\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass="print-li"\r\n\t\t\t\t\t\tv-for="operation in operations"\r\n\t\t\t\t\t\t:key="operation.key"\r\n\t\t\t\t\t\t:class="downlistOperation.twoMouseType==operation.key ? \'active\' : \'\' "\r\n\t\t\t\t\t\t@mouseenter="handleTypeChange(\'twoMouseType\', operation.key)"\r\n\t\t\t\t\t\t@mouseleave="handleTypeChange(\'twoMouseType\', \'\')"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<div class="print-lite">\r\n\t\t\t\t\t\t\t<span class="label"> {{ operation.label }} </span>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</n-popover>\r\n\t\t</n-button-group> '),d(" 外显设置按钮 "),wt.value.length>0&&wt.value.length==m(Ft).length&&m(It)?(o(),f(m(j),{key:0,trigger:"click","show-arrow":!1,show:ht.isOutSetting,onClickoutside:n[2]||(n[2]=t=>Dt("isOutSetting"))},{trigger:y((()=>[p(m(L),{onClick:n[0]||(n[0]=t=>_t("isOutSetting"))},{default:y((()=>[B,p(m(F),{style:{"margin-left":"8px"},component:m(E),size:"18"},null,8,["component"])])),_:1})])),default:y((()=>[c("div",R,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",H,[c("span",q,k(t.label),1),p(m(M),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[p(m(N)),c("div",Y,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),m(Ft)&&m(Ft).length>1?(o(),f(m(M),{key:0,checked:m(jt),"onUpdate:checked":n[1]||(n[1]=t=>h(jt)?jt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])):d("v-if",!0)])])])])),_:1},8,["show"])):(o(),s(u,{key:1},[d(" 打印全部按钮 "),p(m(j),{trigger:"click","show-arrow":!1,show:ht.oneShow,onClickoutside:n[10]||(n[10]=t=>Dt("oneShow"))},{trigger:y((()=>[b(e.$slots,"button",{handleClickPrintBtn:re,printSpinning:vt.spinning,printbtnText:t.btnText,printVisible:vt.visible},(()=>[p(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>Nt("icon")),["stop"]))},{default:y((()=>[p(m(L),{loading:t.showLoading&&vt.spinning,onClick:n[3]||(n[3]=w((()=>Nt("button")),["stop"]))},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),p(m(L),{class:"icon-select"},{icon:y((()=>[p(m(F),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:y((()=>[c("div",$,[(o(!0),s(u,null,v(bt.value,(t=>(o(),s("div",{class:P(["print-li",kt.oneMouseType==t.key||kt.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>((t,e,n)=>{if(!vt.printParams[n.templateCode])return[];xt(t,e)})("oneClickType",t.key,t)},["divider"==t.key?(o(),f(m(N),{key:0})):"outSetting"==t.key?(o(),s(u,{key:1},[d(" 第二层外显设置 "),p(m(j),{trigger:"click","show-arrow":!1,placement:"right-start",show:ht.isOutSetting,onClickoutside:n[7]||(n[7]=t=>Dt("isOutSetting"))},{trigger:y((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>_t("isOutSetting"))},[c("span",W,k(t.label),1),p(m(F),{style:{background:"transparent"},component:m(E),size:"18"},null,8,["component"])])])),default:y((()=>[c("div",X,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),p(m(M),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[p(m(N)),c("div",nt,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),m(Ft)&&m(Ft).length>1?(o(),f(m(M),{key:0,checked:m(jt),"onUpdate:checked":n[6]||(n[6]=t=>h(jt)?jt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])):d("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(o(),s(u,{key:2},[d(" 第二层功能操作 "),c("div",{class:P(["print-lite",vt.printParams[t.templateCode]?"":"isDisabled"])},[c("span",{class:"label bold",onClick:e=>Ht(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,rt),vt.printParams[t.templateCode]?(o(),f(m(j),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:ht[t.key],onClickoutside:e=>Dt(t.key)},{trigger:y((()=>[p(m(F),{component:m(D),size:"18",onClick:e=>_t(t.key)},null,8,["component","onClick"])])),default:y((()=>[c("div",it,[(o(!0),s(u,null,v(m(gt),(e=>(o(),s("div",{class:P(["print-li",kt.twoMouseType==e.key?"active":""]),key:e.key,onMouseenter:t=>xt("twoMouseType",e.key),onMouseleave:n[8]||(n[8]=t=>xt("twoMouseType",""))},[c("div",lt,[c("span",{class:"label",onClick:n=>Gt(e.key,t,!1)},k(e.label),9,ot)])],42,at)))),128))])])),_:2},1032,["show","onClickoutside"])):d("v-if",!0)],2)],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),p(V,O(e.$attrs,{modelValue:vt.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>vt.identityVerification.visible=t),formatId:vt.currentFormatId,templateId:m(Ot),onSuccess:ie}),null,16,["modelValue","formatId","templateId"])],64))}});export{st as default};
|
|
@@ -223,6 +223,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
223
223
|
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
|
224
224
|
buttonClick: (origin: string) => Promise<false | undefined>;
|
|
225
225
|
renderLabel: (option: AnyObject) => JSX.Element;
|
|
226
|
+
debounce: (fn: any, delay: number, immediate?: boolean) => (...args: any) => void;
|
|
226
227
|
callLocalServicesSuccessCb: (res: any, type: any) => void;
|
|
227
228
|
callLocalServicesErrorCb: (res: unknown) => void;
|
|
228
229
|
callLocalServicesCancelCb: (res: unknown) => void;
|
|
@@ -230,6 +231,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
230
231
|
getPrintParams: (index?: number) => string;
|
|
231
232
|
getOnceParams: () => string;
|
|
232
233
|
handleClickPrint: () => void;
|
|
234
|
+
handleDebounceClickPrint: (...args: any) => void;
|
|
233
235
|
handleClickPreview: () => Promise<void>;
|
|
234
236
|
handleClickPdf: () => Promise<void>;
|
|
235
237
|
handleClickEdit: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as t,inject as e,ref as n,reactive as i,computed as a,onMounted as r,watch as
|
|
1
|
+
import{defineComponent as t,inject as e,ref as n,reactive as i,computed as a,onMounted as r,watch as l,openBlock as o,createElementBlock as s,Fragment as p,createVNode as d,unref as u,withCtx as m,renderSlot as c,withModifiers as f,createTextVNode as y,toDisplayString as v,mergeProps as g}from"vue";import{isObject as b}from"@vue/shared";import{useMessage as h,NDropdown as I,NButton as P,NIcon as w}from"naive-ui";import{ChevronDown as F}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as k}from"../constants/index.js";import{Print as T}from"../utils/print.js";import{isIReport as S}from"../utils/browserPrint.js";import x from"./IdentityVerification.vue.js";import{format as O}from"date-fns";import{savePrivateFormatApi as j,getPrivateFormatApi as L}from"../api.js";var D=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1}},setup(t,{expose:D}){var E;const M=t,N=h();let C;const V=e(k),B={},R=n(""),z=i({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let A=n([{label:M.printText,key:"printText"},{label:M.previewText,key:"previewText"},{label:M.pdfLoadText,key:"downloadPdf"},{label:M.formatEditText,key:"formatEditText"},...(null==(E=M.externalOptionConfig)?void 0:E.options)||[]]);const J=a((()=>{if(!z.currentFormatId)return{};let t=z.currentFormatId;return z.formatList.find((e=>e.id===t))})),U=a((()=>{var t;return(null==(t=J.value)?void 0:t.name)||"格式选择"})),q=a((()=>{let t=z.formatList.find((t=>t.id===z.currentFormatId));return null==t?void 0:t.templateId})),K=async t=>{if(M.directPrint){if(z.spinning)return;return"button"===t?void await pt():lt()}return lt()},_=t=>d("span",{class:{active:t.key===z.currentFormatId}},[t.label]),G=(t,e)=>{z.spinning=!1;let n={type:e,formatId:z.currentFormatId,templateId:q.value};V("success",t,n)},H=t=>{z.spinning=!1,V("error",t),b(t)&&"notInstalledApp"===t.type&&N.error(t.message)},Y=t=>{z.spinning=!1,V("cancel",t)},$=t=>{V("error",{message:"前置条件执行错误",type:t,preExecution:!0})},Q=(t=0)=>{var e;const n=(null==(e=M.printParams)?void 0:e.length)?M.printParams[t]:z.printParams[t];return JSON.stringify({...n||{},...M.token?{token:M.token}:{}})},W=()=>{var t,e;let n={},i={};if(null==(t=z.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(z.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(z.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(z.printParams[0]).forEach((t=>{i[t]=[],z.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(Q(0)),i),JSON.stringify(n)},X=((t,e,n=!0)=>{let i=null;return function(...a){i&&clearTimeout(i),n&&!i&&t.apply(null,a),i=setTimeout((()=>{i=null,!n&&t.apply(null,a)}),e)}})((()=>{let t=z.printParams.length;const e=async e=>{try{--t<=0&&G(e,"print")}catch(t){console.log("error",t)}};M.showLoading&&z.spinning||(z.spinning=!0,M.prevFn("print").then((()=>{const t={formatId:z.currentFormatId,templateId:q.value,authorizationKey:R.value,printdlgshow:M.printdlgshow,signature:M.signature,copies:M.printCopies};if("MULTI"===M.strategy)for(let n=0;n<z.printParams.length;n++)n>0&&(t.printdlgshow="0"),C.printDirect({...t,params:Q(n)},e,H,Y);else C.printDirect({...t,params:W()},(t=>{G(t,"print")}),H,Y)})).catch((()=>{$("print"),z.spinning=!1})).finally((()=>{z.visible=!1})))}),800,!0),Z=async(t,e)=>{var n,i;switch(t){case"printText":X();break;case"previewText":(async()=>{M.showLoading&&z.spinning||(z.spinning=!0,M.prevFn("preview").then((()=>{const t="MULTI"===M.strategy?Q():W(),e={formatId:z.currentFormatId,templateId:q.value,authorizationKey:R.value,params:t,btnprint:M.btnprint,signature:M.signature};C.preview(e,(t=>{G(t,"preview")}),H)})).catch((()=>{$("preview"),z.spinning=!1})).finally((()=>{z.visible=!1})))})();break;case"formatEditText":M.showLoading&&z.spinning||(z.spinning=!0,M.prevFn("edit").then((()=>{z.identityVerification.visible=!0})).catch((()=>{$("edit")})).finally((()=>{z.visible=!1,z.spinning=!1})));break;case"downloadPdf":(async()=>{M.showLoading&&z.spinning||(z.spinning=!0,M.prevFn("download").then((()=>{const t="MULTI"===M.strategy?Q():W(),e={formatId:z.currentFormatId,templateId:q.value,authorizationKey:R.value,print:{print:"1",type:"1"},params:t,signature:M.signature};C.downloadPDF(e,(t=>G(t,"preview")),H)})).catch((()=>{$("download"),z.spinning=!1})).finally((()=>{z.visible=!1})))})();break;default:{z.visible=!1;const a=z.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){z.currentFormatId=t;const[e]=A.value;e.label=(null==a?void 0:a.name)||e.label,await j({formatForms:[{...a}],name:B.name||a.templateName,number:B.number||a.number,templateId:B.templateId||a.templateId,...B.id?{id:B.id}:{}},{token:M.token})}else null==(i=null==(n=M.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},tt=()=>{z.visible=!1,V("clickoutside")},et=()=>(z.isInited=!1,z.spinning=!1,setTimeout((()=>{z.visible=!1}),0),!1),nt=(t,e,n)=>{const i={};return e.forEach((e=>{let a=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=O(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},it=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(nt(n,e,"fieldName"))}})),i=Object.assign({},i,nt(n,e,"key")),i})),at=async t=>{var e;if(z.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],z.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";const{data:i}=await L({templateId:t[0].templateId},{token:M.token});if("SUCCESS"===i.result){const{formatForms:e=[]}=i.map||{};Object.assign(B,i.map||{});const a=null==(n=null==e?void 0:e[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}const a=t.find((t=>1==t[e]));return(null==a?void 0:a.id)||t[0].id})(z.formatList,"defaultFlag"),!z.currentFormatId)return N.error(M.noDefaultFormatMsg),et();(()=>{var t;const e=z.formatList.map((t=>({label:t.name,key:t.id})));A.value.unshift({label:U.value,key:"format",children:e}),M.hideButtons.length>0&&(A.value=A.value.filter((t=>!M.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),i=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},a=Object.keys(i);a.includes("RY7.2.21.1.M2.G94181E")||(A.value=A.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(A.value=A.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await M.queryTemplateParams())?void 0:e.obj;if(!n||!q.value)return N.error("获取打印模板失败,请联系管理员!"),et();z.templateParams=n,z.printParams=it(z.templateParams,M.params)},rt=async()=>{var t;if(z.isInited)return!0;z.isInited=!0,z.spinning=!0,(()=>{if(C)return!1;C=new T})();const e=await M.queryPrintFormatByNumber();return await at(e),(null==(t=e.obj)?void 0:t.length)>0&&(R.value=e.obj[0].authorizationKey||""),z.spinning=!1,!0},lt=async(t=!0)=>{var e,n;if(await M.clickPrevFn())if((null==(e=M.params)?void 0:e.length)||(null==(n=M.printParams)?void 0:n.length)){if(!z.visible){if(!await rt())return!1}t&&(z.visible=!z.visible)}else N.warning(M.noDataMsg)},ot=()=>{z.watchPrintParamsReformatFn&&z.watchPrintParamsReformatFn(),z.isInited?z.printParams=it(z.templateParams,M.params):z.watchPrintParamsReformatFn=()=>l((()=>z.isInited),(t=>{if(!t)return!1;ot()}))},st=t=>{if(z.identityVerification.visible=!1,S(z.currentFormatId))return G(null,"edit");const e={formatId:z.currentFormatId,templateId:q.value,params:Q(),token:t};C.editPrintFormat(e,(t=>{G(t,"edit")}),H)};async function pt(){await lt(!1),X()}return r((()=>{z.isInited=!1})),l((()=>M.params),(t=>{if(!(null==t?void 0:t.length))return!1;ot()}),{deep:!0}),D({directPrint:pt}),(e,n)=>(o(),s(p,null,[d(u(I),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:z.visible,onClickoutside:tt,options:u(A),onSelect:Z,"render-label":_},{default:m((()=>[c(e.$slots,"button",{handleClickPrintBtn:lt,printSpinning:z.spinning,printbtnText:t.btnText,printVisible:z.visible},(()=>[d(u(P),{class:"dropdown-button",loading:t.showLoading&&z.spinning,onClick:n[1]||(n[1]=f((()=>K("button")),["stop"]))},{default:m((()=>[y(v(t.btnText)+" ",1),d(u(w),{component:u(F),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=f((()=>K("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),d(x,g(e.$attrs,{modelValue:z.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>z.identityVerification.visible=t),formatId:z.currentFormatId,templateId:u(q),onSuccess:st}),null,16,["modelValue","formatId","templateId"])],64))}});export{D as default};
|