cnhis-design-vue 3.2.4-beta.29 → 3.2.4-beta.30
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/button-print/index.d.ts +10 -4
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +10 -4
- package/es/components/button-print/src/ButtonPrint.vue2.js +1 -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/shared/package.json.js +1 -1
- package/package.json +2 -2
@@ -193,8 +193,9 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
193
193
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
194
194
|
onCancel?: ((...args: any[]) => any) | undefined;
|
195
195
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
196
|
+
onSaveOuterPrint?: ((...args: any[]) => any) | undefined;
|
196
197
|
}>>;
|
197
|
-
__emits: (event: "success" | "error" | "cancel" | "clickoutside", ...args: any[]) => void;
|
198
|
+
__emits: (event: "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", ...args: any[]) => void;
|
198
199
|
printComponentRef: import("vue").Ref<any>;
|
199
200
|
isComponent: import("vue").ComputedRef<import("vue").DefineComponent<{
|
200
201
|
printParams: {
|
@@ -291,6 +292,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
291
292
|
isShowPrintAll: boolean;
|
292
293
|
isShowOutSetting: boolean;
|
293
294
|
customProps: {};
|
295
|
+
outerPrintKeys: never[];
|
294
296
|
};
|
295
297
|
};
|
296
298
|
}, {
|
@@ -397,6 +399,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
397
399
|
isShowPrintAll: boolean;
|
398
400
|
isShowOutSetting: boolean;
|
399
401
|
customProps: {};
|
402
|
+
outerPrintKeys: never[];
|
400
403
|
};
|
401
404
|
};
|
402
405
|
}>> & {}>>;
|
@@ -431,7 +434,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
431
434
|
isOutSetting: boolean;
|
432
435
|
};
|
433
436
|
innerPrintItems: import("vue").Ref<never[]>;
|
434
|
-
|
437
|
+
outerPrintItems: import("vue").Ref<never[]>;
|
435
438
|
currentFormatItem: import("vue").ComputedRef<{} | undefined>;
|
436
439
|
formatTitle: import("vue").ComputedRef<any>;
|
437
440
|
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
@@ -2220,6 +2223,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
2220
2223
|
isShowPrintAll: boolean;
|
2221
2224
|
isShowOutSetting: boolean;
|
2222
2225
|
customProps: {};
|
2226
|
+
outerPrintKeys: never[];
|
2223
2227
|
};
|
2224
2228
|
};
|
2225
2229
|
}>>, {
|
@@ -4326,10 +4330,11 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
4326
4330
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
4327
4331
|
onCancel?: ((...args: any[]) => any) | undefined;
|
4328
4332
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
4333
|
+
onSaveOuterPrint?: ((...args: any[]) => any) | undefined;
|
4329
4334
|
}>>>;
|
4330
|
-
emits: (event: "success" | "error" | "cancel" | "clickoutside", ...args: any[]) => void;
|
4335
|
+
emits: (event: "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", ...args: any[]) => void;
|
4331
4336
|
directPrint: () => Promise<void>;
|
4332
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside")[], "success" | "error" | "cancel" | "clickoutside", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
4337
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint")[], "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
4333
4338
|
printParams: {
|
4334
4339
|
type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
|
4335
4340
|
};
|
@@ -4427,6 +4432,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
4427
4432
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
4428
4433
|
onCancel?: ((...args: any[]) => any) | undefined;
|
4429
4434
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
4435
|
+
onSaveOuterPrint?: ((...args: any[]) => any) | undefined;
|
4430
4436
|
}, {
|
4431
4437
|
params: import("../../shared/types").AnyObject[];
|
4432
4438
|
btnText: string;
|
@@ -199,8 +199,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
199
199
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
200
200
|
onCancel?: ((...args: any[]) => any) | undefined;
|
201
201
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
202
|
+
onSaveOuterPrint?: ((...args: any[]) => any) | undefined;
|
202
203
|
}>>;
|
203
|
-
__emits: (event: "success" | "error" | "cancel" | "clickoutside", ...args: any[]) => void;
|
204
|
+
__emits: (event: "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", ...args: any[]) => void;
|
204
205
|
printComponentRef: import("vue").Ref<any>;
|
205
206
|
isComponent: import("vue").ComputedRef<import("vue").DefineComponent<{
|
206
207
|
printParams: {
|
@@ -297,6 +298,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
297
298
|
isShowPrintAll: boolean;
|
298
299
|
isShowOutSetting: boolean;
|
299
300
|
customProps: {};
|
301
|
+
outerPrintKeys: never[];
|
300
302
|
};
|
301
303
|
};
|
302
304
|
}, {
|
@@ -403,6 +405,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
403
405
|
isShowPrintAll: boolean;
|
404
406
|
isShowOutSetting: boolean;
|
405
407
|
customProps: {};
|
408
|
+
outerPrintKeys: never[];
|
406
409
|
};
|
407
410
|
};
|
408
411
|
}>> & {}>>;
|
@@ -437,7 +440,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
437
440
|
isOutSetting: boolean;
|
438
441
|
};
|
439
442
|
innerPrintItems: import("vue").Ref<never[]>;
|
440
|
-
|
443
|
+
outerPrintItems: import("vue").Ref<never[]>;
|
441
444
|
currentFormatItem: import("vue").ComputedRef<{} | undefined>;
|
442
445
|
formatTitle: import("vue").ComputedRef<any>;
|
443
446
|
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
@@ -2226,6 +2229,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
2226
2229
|
isShowPrintAll: boolean;
|
2227
2230
|
isShowOutSetting: boolean;
|
2228
2231
|
customProps: {};
|
2232
|
+
outerPrintKeys: never[];
|
2229
2233
|
};
|
2230
2234
|
};
|
2231
2235
|
}>>, {
|
@@ -4335,10 +4339,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
4335
4339
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
4336
4340
|
onCancel?: ((...args: any[]) => any) | undefined;
|
4337
4341
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
4342
|
+
onSaveOuterPrint?: ((...args: any[]) => any) | undefined;
|
4338
4343
|
}>>>;
|
4339
|
-
emits: (event: "success" | "error" | "cancel" | "clickoutside", ...args: any[]) => void;
|
4344
|
+
emits: (event: "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", ...args: any[]) => void;
|
4340
4345
|
directPrint: () => Promise<void>;
|
4341
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside")[], "success" | "error" | "cancel" | "clickoutside", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
4346
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint")[], "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
4342
4347
|
printParams: {
|
4343
4348
|
type: PropType<AnyObject[]>;
|
4344
4349
|
};
|
@@ -4439,6 +4444,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
4439
4444
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
4440
4445
|
onCancel?: ((...args: any[]) => any) | undefined;
|
4441
4446
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
4447
|
+
onSaveOuterPrint?: ((...args: any[]) => any) | undefined;
|
4442
4448
|
}, {
|
4443
4449
|
params: AnyObject[];
|
4444
4450
|
btnText: string;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,ref as e,computed as r,provide as n,openBlock as i,createBlock as o,resolveDynamicComponent as a,unref as p,mergeProps as u,withCtx as l,createCommentVNode as s,renderSlot as d,normalizeProps as f,guardReactiveProps as y}from"vue";import{InjectionButtonPrintEmits as m}from"./constants/index.js";import c from"./components/NewPrintComponent.vue.js";import g from"./components/OldPrintComponent.vue.js";var P=t({__name:"ButtonPrint",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:()=>({})}},emits:["success","error","cancel","clickoutside"],setup(t,{expose:P,emit:v}){const S=t,b=e(),x=r((()=>{var t;return(null==(t=Object.keys(S.newPrintSetting))?void 0:t.length)>0?c:g})),F=r((()=>S));n(m,(function(t,...e){v(t,...e)}));return P({directPrint:async()=>{var t;null==(t=b.value)||t.directPrint()}}),(t,e)=>(i(),o(a(p(x)),u({ref_key:"printComponentRef",ref:b},p(F)),{button:l((e=>[s(" 自定义按钮样式 "),d(t.$slots,"button",f(y(e)))])),_:3},16))}});export{P as default};
|
1
|
+
import{defineComponent as t,ref as e,computed as r,provide as n,openBlock as i,createBlock as o,resolveDynamicComponent as a,unref as p,mergeProps as u,withCtx as l,createCommentVNode as s,renderSlot as d,normalizeProps as f,guardReactiveProps as y}from"vue";import{InjectionButtonPrintEmits as m}from"./constants/index.js";import c from"./components/NewPrintComponent.vue.js";import g from"./components/OldPrintComponent.vue.js";var P=t({__name:"ButtonPrint",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:()=>({})}},emits:["success","error","cancel","clickoutside","saveOuterPrint"],setup(t,{expose:P,emit:v}){const S=t,b=e(),x=r((()=>{var t;return(null==(t=Object.keys(S.newPrintSetting))?void 0:t.length)>0?c:g})),F=r((()=>S));n(m,(function(t,...e){v(t,...e)}));return P({directPrint:async()=>{var t;null==(t=b.value)||t.directPrint()}}),(t,e)=>(i(),o(a(p(x)),u({ref_key:"printComponentRef",ref:b},p(F)),{button:l((e=>[s(" 自定义按钮样式 "),d(t.$slots,"button",f(y(e)))])),_:3},16))}});export{P as default};
|
@@ -100,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
100
100
|
isShowPrintAll: boolean;
|
101
101
|
isShowOutSetting: boolean;
|
102
102
|
customProps: {};
|
103
|
+
outerPrintKeys: never[];
|
103
104
|
};
|
104
105
|
};
|
105
106
|
}, {
|
@@ -209,6 +210,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
209
210
|
isShowPrintAll: boolean;
|
210
211
|
isShowOutSetting: boolean;
|
211
212
|
customProps: {};
|
213
|
+
outerPrintKeys: never[];
|
212
214
|
};
|
213
215
|
};
|
214
216
|
}>> & {}>>;
|
@@ -243,7 +245,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
243
245
|
isOutSetting: boolean;
|
244
246
|
};
|
245
247
|
innerPrintItems: import("vue").Ref<never[]>;
|
246
|
-
|
248
|
+
outerPrintItems: import("vue").Ref<never[]>;
|
247
249
|
currentFormatItem: import("vue").ComputedRef<{} | undefined>;
|
248
250
|
formatTitle: import("vue").ComputedRef<any>;
|
249
251
|
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
@@ -2035,6 +2037,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
2035
2037
|
isShowPrintAll: boolean;
|
2036
2038
|
isShowOutSetting: boolean;
|
2037
2039
|
customProps: {};
|
2040
|
+
outerPrintKeys: never[];
|
2038
2041
|
};
|
2039
2042
|
};
|
2040
2043
|
}>>, {
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,inject as e,ref as n,reactive as i,computed as r,onMounted as a,watch as o,openBlock as l,createElementBlock as s,Fragment as u,createElementVNode as c,createCommentVNode as p,createVNode as d,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 M,NPopover as F,NCheckbox as j,NDivider as x}from"naive-ui";import{PrintOutline as E,SettingsOutline as N,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 B={class:"newprint-button-outer"},R=c("span",{class:"label bold"},"外显设置",-1),H={class:"newprint-button-poperOver"},K={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={class:"print-lite"},rt=["onClick"],at={class:"newprint-button-poperOver"},ot=["onMouseenter"],lt={class:"print-lite"},st=["onClick"];var ut=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:{}})}},setup(t,{expose:ut}){const ct=t,pt=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],dt=C();let mt;const yt=e(z),vt=n(""),ft=i({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1});let gt=n([]),kt=n([{label:ct.pdfLoadText,key:"downloadPdf"},{label:ct.previewText,key:"previewText"},{label:ct.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const ht=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),bt=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),wt=n([]),Pt=n([]),Ot=r((()=>{if(!ft.currentFormatId)return{};let t=ft.currentFormatId;return ft.formatList.find((e=>e.id===t))}));r((()=>{var t;return(null==(t=Ot.value)?void 0:t.name)||"格式选择"}));const St=r((()=>{let t=ft.formatList.find((t=>t.id===ft.currentFormatId));return null==t?void 0:t.templateId})),Ct=r((()=>{var t;return null==(t=ct.newPrintSetting)?void 0:t.isShowPrintAll})),It=r((()=>{var t;return null==(t=ct.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=r((()=>{var t;return(null==(t=ct.newPrintSetting)?void 0:t.customProps)||{}})),Lt=r((()=>{const t=pt.map((t=>t.key));return gt.value.filter((e=>!t.includes(e.key)))})),Mt=r({get:()=>Lt.value.every((t=>t.selected)),set(t){Lt.value.forEach((e=>{e.selected=t}))}}),Ft=async()=>{await te(),bt.oneShow=!0},jt=async t=>{if(ct.directPrint){if(ft.spinning)return;return"button"===t?void(Ct.value?await ie():Ft()):Ft()}return Ft()},xt=(t,e)=>{ht[t]=e},Et=()=>{wt.value=gt.value.filter((t=>!t.selected)),Pt.value=Lt.value.filter((t=>t.selected)).map((t=>({...t,isLoading:!1}))),_t("oneShow"),_t("isOutSetting")},Nt=t=>{bt[t]=!0},_t=t=>{ht.oneClickType="",bt[t]=!1,"isOutSetting"==t&&(bt.isOutSetting=!1)},Dt=(t,e)=>{Bt(!1);let n={type:e,formatId:ft.currentFormatId,templateId:St.value};yt("success",t,n)},zt=t=>{Bt(!1),yt("error",t),S(t)&&"notInstalledApp"===t.type&&dt.error(t.message)},Jt=t=>{Bt(!1),yt("cancel",t)},Ut=t=>{yt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},Vt=()=>JSON.stringify({...ct.token?{token:ct.token}:{}}),At=(t=[],e)=>{var n,i;let r={},a={};if((null==(n=ft.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(Vt()),Tt.value,a),JSON.stringify(r)},Bt=(t,e)=>{if(ft.isClickOuterPrint){if(t&&e){const n=Pt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}Pt.value.forEach((t=>{t.isLoading=!1}))}else ft.spinning=t},Rt=()=>ft.isClickOuterPrint?Pt.value.some((t=>t.isLoading)):ft.spinning,Ht=(t,e,n,i)=>{const r=ft.printParams[t];ft.isClickOuterPrint=i,Kt(r,t,e,n)},Kt=async(t=[],e,n,i,r)=>{let a=t.length;const o=async t=>{try{--a<=0&&Dt(t,"print")}catch(t){console.log("error",t)}};ct.showLoading&&Rt()&&!r||(Bt(!0,i),ct.prevFn("print").then((()=>{ft.curPrintParamList=t;const r={formatId:i,templateId:n,authorizationKey:vt.value,printdlgshow:ct.printdlgshow,signature:ct.signature,copies:ct.printCopies};if("MULTI"===ct.strategy)for(let e=0;e<t.length;e++)e>0&&(r.printdlgshow="0"),mt.printDirect({...r,params:Object.assign({},JSON.parse(Vt()),Tt.value,t[e])},o,zt,Jt);else mt.printDirect({...r,params:At(t,e)},(t=>{Dt(t,"print")}),zt,Jt)})).catch((()=>{Ut("print"),Bt(!1)})).finally((()=>{ft.visible=!1})))},qt=async(t,{templateCode:e,templateId:n,key:i},r)=>{const a=ft.printParams[e];switch(ft.isClickOuterPrint=r,t){case"previewText":(async(t=[],e,n,i)=>{ct.showLoading&&Rt()||(Bt(!0,i),ct.prevFn("preview").then((()=>{ft.curPrintParamList=t;const r="MULTI"===ct.strategy?Object.assign({},JSON.parse(Vt()),Tt.value,t[0]):At(t,e),a={formatId:i,templateId:n,authorizationKey:vt.value,params:r,btnprint:ct.btnprint,signature:ct.signature};mt.preview(a,(t=>{Dt(t,"preview")}),zt)})).catch((()=>{Ut("preview"),Bt(!1)})).finally((()=>{ft.visible=!1})))})(a,e,n,i);break;case"formatEditText":((t=[],e,n,i)=>{ct.showLoading&&Rt()||(Bt(!0,i),ct.prevFn("edit").then((()=>{ft.curPrintParamList=t,ft.currentFormatId=i,ft.identityVerification.visible=!0})).catch((()=>{Ut("edit")})).finally((()=>{Bt(!1)})))})(a,0,0,i);break;case"downloadPdf":(async(t=[],e,n,i)=>{ct.showLoading&&Rt()||(Bt(!0,i),ct.prevFn("download").then((()=>{ft.curPrintParamList=t;const r="MULTI"===ct.strategy?Object.assign({},JSON.parse(Vt()),Tt.value,t[0]):At(t,e),a={formatId:i,templateId:n,authorizationKey:vt.value,print:{print:"1",type:"1"},params:r,signature:ct.signature};mt.downloadPDF(a,(t=>Dt(t,"preview")),zt)})).catch((()=>{Ut("download"),Bt(!1)})).finally((()=>{ft.visible=!1})))})(a,e,n,i)}},Gt=()=>{},Yt=(t,e=[])=>{let n={};return e.forEach((e=>{n=Object.assign({},Wt(n,e,t))})),n},$t=(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},Qt=({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($t(n,e,"fieldName"))})),i=Object.assign({},i,$t(n,e,"key")),i},Wt=(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(Qt(a,e))}return t}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],o=n[a];if(!o)return dt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(Qt(o,e))}return t},Xt=async t=>{ft.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;const e=ft.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1})));gt.value.unshift(...e),It.value&>.value.push(...pt),wt.value=gt.value.filter((t=>!t.selected)),ct.hideButtons.length>0&&(kt.value=kt.value.filter((t=>!ct.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)||{},r=Object.keys(i);r.includes("RY7.2.21.1.M2.G94181E")||(kt.value=kt.value.filter((t=>"downloadPdf"!=t.key))),r.includes("RY7.2.21.1.M2.G33633A")||(kt.value=kt.value.filter((t=>"formatEditText"!=t.key)))}})(),ft.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),ft.printParams=Yt(ft.templateParams,ct.params)},Zt=async()=>{var t;if(ft.isInited)return!0;ft.isInited=!0,ft.spinning=!0,(()=>{if(mt)return!1;mt=new J})();const e=await ct.queryPrintFormatByNumber();return await Xt(e),(null==(t=e.obj)?void 0:t.length)>0&&(vt.value=e.obj[0].authorizationKey||""),ft.spinning=!1,!0},te=async(t=!0)=>{var e,n;if(await ct.clickPrevFn())if((null==(e=ct.params)?void 0:e.length)||(null==(n=ct.printParams)?void 0:n.length)){if(!ft.visible){if(!await Zt())return!1}t&&(ft.visible=!ft.visible)}else dt.warning(ct.noDataMsg)},ee=()=>{ft.watchPrintParamsReformatFn&&ft.watchPrintParamsReformatFn(),ft.isInited?ft.printParams=Yt(ft.templateParams,ct.params):ft.watchPrintParamsReformatFn=()=>o((()=>ft.isInited),(t=>{if(!t)return!1;ee()}))},ne=t=>{if(ft.identityVerification.visible=!1,U(ft.currentFormatId))return Dt(null,"edit");const e={formatId:ft.currentFormatId,templateId:St.value,params:Object.assign({},JSON.parse(Vt()),Tt.value,ft.curPrintParamList[0]),token:t};mt.editPrintFormat(e,(t=>{Dt(t,"edit")}),zt)};async function ie(){await te(!1),(()=>{const t=Object.keys(ft.printParams);ft.isClickOuterPrint=!1;for(let e=0;e<t.length;e++){const n=t[e],i=ft.printParams[n],r=ft.formatList.filter((t=>t.number==n));r&&r.length>0&&r.forEach((t=>{Kt(i,t.number,t.templateId,t.id,!0)}))}})()}return a((()=>{ft.isInited=!1})),o((()=>ct.params),(t=>{if(!(null==t?void 0:t.length))return!1;ee()}),{deep:!0}),ut({directPrint:ie}),(e,n)=>(l(),s(u,null,[c("div",B,[p(" 外显按钮集合 "),d(m(I),null,{default:y((()=>[(l(!0),s(u,null,v(Pt.value,(e=>(l(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Gt,options:m(kt),onSelect:t=>qt(t,e,!0)},{default:y((()=>[d(m(L),{loading:t.showLoading&&e.isLoading,onClick:t=>Ht(e.templateCode,e.templateId,e.key,!0)},{icon:y((()=>[d(m(M),{component:m(E),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(e.label),1)])),_:2},1032,["loading","onClick"])])),_:2},1032,["options","onSelect"])))),128))])),_:1}),p(' <n-button-group>\r\n\t\t\t<n-popover\r\n\t\t\t\tv-for="outer in outterPrintItems"\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> '),p(" 外显设置按钮 "),ft.isInited&&Pt.value.length>0&&Pt.value.length==m(Lt).length&&m(It)?(l(),f(m(F),{key:0,trigger:"click","show-arrow":!1,show:bt.isOutSetting,onClickoutside:n[2]||(n[2]=t=>_t("isOutSetting"))},{trigger:y((()=>[d(m(L),{onClick:n[0]||(n[0]=t=>Nt("isOutSetting"))},{default:y((()=>[R,d(m(M),{style:{"margin-left":"8px"},component:m(N),size:"18"},null,8,["component"])])),_:1})])),default:y((()=>[c("div",H,[(l(!0),s(u,null,v(m(Lt),(t=>(l(),s("div",{class:"print-li",key:t.key},[c("div",K,[c("span",q,k(t.label),1),d(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[d(m(x)),c("div",Y,[d(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),d(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"])):(l(),s(u,{key:1},[p(" 打印全部按钮 "),d(m(F),{trigger:"click","show-arrow":!1,show:bt.oneShow,onClickoutside:n[10]||(n[10]=t=>_t("oneShow"))},{trigger:y((()=>[b(e.$slots,"button",{handleClickPrintBtn:te,printSpinning:ft.spinning,printbtnText:t.btnText,printVisible:ft.visible},(()=>[d(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>jt("icon")),["stop"]))},{default:y((()=>[d(m(L),{loading:t.showLoading&&ft.spinning,onClick:n[3]||(n[3]=w((()=>jt("button")),["stop"]))},{icon:y((()=>[d(m(M),{component:m(E),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),d(m(L),{class:"icon-select"},{icon:y((()=>[d(m(M),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:y((()=>[c("div",$,[(l(!0),s(u,null,v(wt.value,(t=>(l(),s("div",{class:P(["print-li",ht.oneMouseType==t.key||ht.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>{return n="oneClickType",i=t.key,void xt(n,i);var n,i}},["divider"==t.key?(l(),f(m(x),{key:0})):"outSetting"==t.key?(l(),s(u,{key:1},[p(" 第二层外显设置 "),d(m(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:bt.isOutSetting,onClickoutside:n[7]||(n[7]=t=>_t("isOutSetting"))},{trigger:y((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>Nt("isOutSetting"))},[c("span",W,k(t.label),1),d(m(M),{style:{background:"transparent"},component:m(N),size:"18"},null,8,["component"])])])),default:y((()=>[c("div",X,[(l(!0),s(u,null,v(m(Lt),(t=>(l(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),d(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[d(m(x)),c("div",nt,[d(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),d(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)):(l(),s(u,{key:2},[p(" 第二层功能操作 "),c("div",it,[c("span",{class:"label bold",onClick:e=>Ht(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,rt),d(m(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:bt[t.key],onClickoutside:e=>_t(t.key)},{trigger:y((()=>[d(m(M),{component:m(D),size:"18",onClick:e=>Nt(t.key)},null,8,["component","onClick"])])),default:y((()=>[c("div",at,[(l(!0),s(u,null,v(m(kt),(e=>(l(),s("div",{class:P(["print-li",ht.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=>qt(e.key,t,!1)},k(e.label),9,st)])],42,ot)))),128))])])),_:2},1032,["show","onClickoutside"])])],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),d(V,O(e.$attrs,{modelValue:ft.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>ft.identityVerification.visible=t),formatId:ft.currentFormatId,templateId:m(St),onSuccess:ne}),null,16,["modelValue","formatId","templateId"])],64))}});export{ut as default};
|
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 p,createVNode as d,unref as m,withCtx as v,renderList as y,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 M,NPopover as F,NCheckbox as j,NDivider as x}from"naive-ui";import{PrintOutline as E,SettingsOutline as N,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={class:"print-lite"},rt=["onClick"],at={class:"newprint-button-poperOver"},lt=["onMouseenter"],ot={class:"print-lite"},st=["onClick"];var ut=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:[]})}},setup(t,{expose:ut}){const ct=t,pt=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],dt=C();let mt;const vt=e(z),yt=n(""),ft=i({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1});let gt=n([]),kt=n([{label:ct.pdfLoadText,key:"downloadPdf"},{label:ct.previewText,key:"previewText"},{label:ct.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const ht=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),bt=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),wt=n([]),Pt=n([]),Ot=r((()=>{if(!ft.currentFormatId)return{};let t=ft.currentFormatId;return ft.formatList.find((e=>e.id===t))}));r((()=>{var t;return(null==(t=Ot.value)?void 0:t.name)||"格式选择"}));const St=r((()=>{let t=ft.formatList.find((t=>t.id===ft.currentFormatId));return null==t?void 0:t.templateId})),Ct=r((()=>{var t;return null==(t=ct.newPrintSetting)?void 0:t.isShowPrintAll})),It=r((()=>{var t;return null==(t=ct.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=r((()=>{var t;return(null==(t=ct.newPrintSetting)?void 0:t.customProps)||{}})),Lt=r((()=>{const t=pt.map((t=>t.key));return gt.value.filter((e=>!t.includes(e.key)))})),Mt=r({get:()=>Lt.value.every((t=>t.selected)),set(t){Lt.value.forEach((e=>{e.selected=t}))}}),Ft=async()=>{var t,e;(null==(e=null==(t=ct.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)||await te(),bt.oneShow=!0},jt=async t=>{if(ct.directPrint){if(ft.spinning)return;return"button"===t?void(Ct.value?await ie():Ft()):Ft()}return Ft()},xt=(t,e)=>{ht[t]=e},Et=()=>{wt.value=gt.value.filter((t=>!t.selected)),Pt.value=Lt.value.filter((t=>t.selected)),_t("oneShow"),_t("isOutSetting"),vt("saveOuterPrint",Pt.value)},Nt=t=>{bt[t]=!0},_t=t=>{ht.oneClickType="",bt[t]=!1,"isOutSetting"==t&&(bt.isOutSetting=!1)},Dt=(t,e)=>{Kt(!1);let n={type:e,formatId:ft.currentFormatId,templateId:St.value};vt("success",t,n)},zt=t=>{Kt(!1),vt("error",t),S(t)&&"notInstalledApp"===t.type&&dt.error(t.message)},Jt=t=>{Kt(!1),vt("cancel",t)},Ut=t=>{vt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},Vt=()=>JSON.stringify({...ct.token?{token:ct.token}:{}}),At=(t=[],e)=>{var n,i;let r={},a={};if((null==(n=ft.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(Vt()),Tt.value,a),JSON.stringify(r)},Kt=(t,e)=>{if(ft.isClickOuterPrint){if(t&&e){const n=Pt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}Pt.value.forEach((t=>{t.isLoading=!1}))}else ft.spinning=t},Bt=()=>ft.isClickOuterPrint?Pt.value.some((t=>t.isLoading)):ft.spinning,Rt=(t,e,n,i)=>{const r=ft.printParams[t];ft.isClickOuterPrint=i,Ht(r,t,e,n)},Ht=async(t=[],e,n,i,r)=>{let a=t.length;const l=async t=>{try{--a<=0&&Dt(t,"print")}catch(t){console.log("error",t)}};ct.showLoading&&Bt()&&!r||(Kt(!0,i),ct.prevFn("print").then((()=>{ft.curPrintParamList=t;const r={formatId:i,templateId:n,authorizationKey:yt.value,printdlgshow:ct.printdlgshow,signature:ct.signature,copies:ct.printCopies};if("MULTI"===ct.strategy)for(let e=0;e<t.length;e++)e>0&&(r.printdlgshow="0"),mt.printDirect({...r,params:Object.assign({},JSON.parse(Vt()),Tt.value,t[e])},l,zt,Jt);else mt.printDirect({...r,params:At(t,e)},(t=>{Dt(t,"print")}),zt,Jt)})).catch((()=>{Ut("print"),Kt(!1)})).finally((()=>{ft.visible=!1})))},qt=async(t,{templateCode:e,templateId:n,key:i},r)=>{const a=ft.printParams[e];switch(ft.isClickOuterPrint=r,t){case"previewText":(async(t=[],e,n,i)=>{ct.showLoading&&Bt()||(Kt(!0,i),ct.prevFn("preview").then((()=>{ft.curPrintParamList=t;const r="MULTI"===ct.strategy?Object.assign({},JSON.parse(Vt()),Tt.value,t[0]):At(t,e),a={formatId:i,templateId:n,authorizationKey:yt.value,params:r,btnprint:ct.btnprint,signature:ct.signature};mt.preview(a,(t=>{Dt(t,"preview")}),zt)})).catch((()=>{Ut("preview"),Kt(!1)})).finally((()=>{ft.visible=!1})))})(a,e,n,i);break;case"formatEditText":((t=[],e,n,i)=>{ct.showLoading&&Bt()||(Kt(!0,i),ct.prevFn("edit").then((()=>{ft.curPrintParamList=t,ft.currentFormatId=i,ft.identityVerification.visible=!0})).catch((()=>{Ut("edit")})).finally((()=>{Kt(!1)})))})(a,0,0,i);break;case"downloadPdf":(async(t=[],e,n,i)=>{ct.showLoading&&Bt()||(Kt(!0,i),ct.prevFn("download").then((()=>{ft.curPrintParamList=t;const r="MULTI"===ct.strategy?Object.assign({},JSON.parse(Vt()),Tt.value,t[0]):At(t,e),a={formatId:i,templateId:n,authorizationKey:yt.value,print:{print:"1",type:"1"},params:r,signature:ct.signature};mt.downloadPDF(a,(t=>Dt(t,"preview")),zt)})).catch((()=>{Ut("download"),Kt(!1)})).finally((()=>{ft.visible=!1})))})(a,e,n,i)}},Gt=()=>{},Yt=(t,e=[])=>{let n={};return e.forEach((e=>{n=Object.assign({},Wt(n,e,t))})),n},$t=(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},Qt=({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($t(n,e,"fieldName"))})),i=Object.assign({},i,$t(n,e,"key")),i},Wt=(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(Qt(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(Qt(l,e))}return t},Xt=async t=>{ft.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=ft.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1,isLoading:!1})));gt.value.unshift(...i),It.value&>.value.push(...pt),(null==(e=null==(t=ct.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)>0&&(gt.value.forEach((t=>{var e;(null==(e=ct.newPrintSetting)?void 0:e.outerPrintKeys.includes(t.key))&&(t.selected=!0)})),Pt.value=gt.value.filter((t=>t.selected))),wt.value=gt.value.filter((t=>!t.selected)),ct.hideButtons.length>0&&(kt.value=kt.value.filter((t=>!ct.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")||(kt.value=kt.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(kt.value=kt.value.filter((t=>"formatEditText"!=t.key)))}})(),ft.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),ft.printParams=Yt(ft.templateParams,ct.params)},Zt=async()=>{var t;if(ft.isInited)return!0;ft.isInited=!0,ft.spinning=!0,(()=>{if(mt)return!1;mt=new J})();const e=await ct.queryPrintFormatByNumber();return await Xt(e),(null==(t=e.obj)?void 0:t.length)>0&&(yt.value=e.obj[0].authorizationKey||""),ft.spinning=!1,!0},te=async(t=!0)=>{var e,n;if(await ct.clickPrevFn())if((null==(e=ct.params)?void 0:e.length)||(null==(n=ct.printParams)?void 0:n.length)){if(!ft.visible){if(!await Zt())return!1}t&&(ft.visible=!ft.visible)}else dt.warning(ct.noDataMsg)},ee=()=>{ft.watchPrintParamsReformatFn&&ft.watchPrintParamsReformatFn(),ft.isInited?ft.printParams=Yt(ft.templateParams,ct.params):ft.watchPrintParamsReformatFn=()=>l((()=>ft.isInited),(t=>{if(!t)return!1;ee()}))},ne=t=>{if(ft.identityVerification.visible=!1,U(ft.currentFormatId))return Dt(null,"edit");const e={formatId:ft.currentFormatId,templateId:St.value,params:Object.assign({},JSON.parse(Vt()),Tt.value,ft.curPrintParamList[0]),token:t};mt.editPrintFormat(e,(t=>{Dt(t,"edit")}),zt)};async function ie(){await te(!1),(()=>{const t=Object.keys(ft.printParams);ft.isClickOuterPrint=!1;for(let e=0;e<t.length;e++){const n=t[e],i=ft.printParams[n],r=ft.formatList.filter((t=>t.number==n));r&&r.length>0&&r.forEach((t=>{Ht(i,t.number,t.templateId,t.id,!0)}))}})()}return a((()=>{ft.isInited=!1})),l((()=>ct.params),(t=>{if(!(null==t?void 0:t.length))return!1;ee()}),{deep:!0}),l((()=>{var t;return null==(t=ct.newPrintSetting)?void 0:t.outerPrintKeys}),(async t=>{(null==t?void 0:t.length)>0&&await te(!1)}),{deep:!0,immediate:!0}),ut({directPrint:ie}),(e,n)=>(o(),s(u,null,[c("div",K,[p(" 外显按钮集合 "),d(m(I),null,{default:v((()=>[(o(!0),s(u,null,y(Pt.value,(e=>(o(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Gt,options:m(kt),onSelect:t=>qt(t,e,!0)},{default:v((()=>[d(m(L),{loading:t.showLoading&&e.isLoading,onClick:t=>Rt(e.templateCode,e.templateId,e.key,!0)},{icon:v((()=>[d(m(M),{component:m(E),size:"18"},null,8,["component"])])),default:v((()=>[g(" "+k(e.label),1)])),_:2},1032,["loading","onClick"])])),_:2},1032,["options","onSelect"])))),128))])),_:1}),p(' <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> '),p(" 外显设置按钮 "),ft.isInited&&Pt.value.length>0&&Pt.value.length==m(Lt).length&&m(It)?(o(),f(m(F),{key:0,trigger:"click","show-arrow":!1,show:bt.isOutSetting,onClickoutside:n[2]||(n[2]=t=>_t("isOutSetting"))},{trigger:v((()=>[d(m(L),{onClick:n[0]||(n[0]=t=>Nt("isOutSetting"))},{default:v((()=>[B,d(m(M),{style:{"margin-left":"8px"},component:m(N),size:"18"},null,8,["component"])])),_:1})])),default:v((()=>[c("div",R,[(o(!0),s(u,null,y(m(Lt),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",H,[c("span",q,k(t.label),1),d(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:v((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[d(m(x)),c("div",Y,[d(m(L),{type:"primary",size:"small",onClick:Et},{default:v((()=>[g("保存")])),_:1}),d(m(j),{checked:m(Mt),"onUpdate:checked":n[1]||(n[1]=t=>h(Mt)?Mt.value=t:null)},{default:v((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:1},8,["show"])):(o(),s(u,{key:1},[p(" 打印全部按钮 "),d(m(F),{trigger:"click","show-arrow":!1,show:bt.oneShow,onClickoutside:n[10]||(n[10]=t=>_t("oneShow"))},{trigger:v((()=>[b(e.$slots,"button",{handleClickPrintBtn:te,printSpinning:ft.spinning,printbtnText:t.btnText,printVisible:ft.visible},(()=>[d(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>jt("icon")),["stop"]))},{default:v((()=>[d(m(L),{loading:t.showLoading&&ft.spinning,onClick:n[3]||(n[3]=w((()=>jt("button")),["stop"]))},{icon:v((()=>[d(m(M),{component:m(E),size:"18"},null,8,["component"])])),default:v((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),d(m(L),{class:"icon-select"},{icon:v((()=>[d(m(M),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:v((()=>[c("div",$,[(o(!0),s(u,null,y(wt.value,(t=>(o(),s("div",{class:P(["print-li",ht.oneMouseType==t.key||ht.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>{return n="oneClickType",i=t.key,void xt(n,i);var n,i}},["divider"==t.key?(o(),f(m(x),{key:0})):"outSetting"==t.key?(o(),s(u,{key:1},[p(" 第二层外显设置 "),d(m(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:bt.isOutSetting,onClickoutside:n[7]||(n[7]=t=>_t("isOutSetting"))},{trigger:v((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>Nt("isOutSetting"))},[c("span",W,k(t.label),1),d(m(M),{style:{background:"transparent"},component:m(N),size:"18"},null,8,["component"])])])),default:v((()=>[c("div",X,[(o(!0),s(u,null,y(m(Lt),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),d(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:v((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[d(m(x)),c("div",nt,[d(m(L),{type:"primary",size:"small",onClick:Et},{default:v((()=>[g("保存")])),_:1}),d(m(j),{checked:m(Mt),"onUpdate:checked":n[6]||(n[6]=t=>h(Mt)?Mt.value=t:null)},{default:v((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:2},1032,["show"])],2112)):(o(),s(u,{key:2},[p(" 第二层功能操作 "),c("div",it,[c("span",{class:"label bold",onClick:e=>Rt(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,rt),d(m(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:bt[t.key],onClickoutside:e=>_t(t.key)},{trigger:v((()=>[d(m(M),{component:m(D),size:"18",onClick:e=>Nt(t.key)},null,8,["component","onClick"])])),default:v((()=>[c("div",at,[(o(!0),s(u,null,y(m(kt),(e=>(o(),s("div",{class:P(["print-li",ht.twoMouseType==e.key?"active":""]),key:e.key,onMouseenter:t=>xt("twoMouseType",e.key),onMouseleave:n[8]||(n[8]=t=>xt("twoMouseType",""))},[c("div",ot,[c("span",{class:"label",onClick:n=>qt(e.key,t,!1)},k(e.label),9,st)])],42,lt)))),128))])])),_:2},1032,["show","onClickoutside"])])],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),d(V,O(e.$attrs,{modelValue:ft.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>ft.identityVerification.visible=t),formatId:ft.currentFormatId,templateId:m(St),onSuccess:ne}),null,16,["modelValue","formatId","templateId"])],64))}});export{ut as default};
|
@@ -1 +1 @@
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.2.4-beta.
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.2.4-beta.30",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.4-beta.30",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cnhis-design-vue",
|
3
|
-
"version": "3.2.4-beta.
|
3
|
+
"version": "3.2.4-beta.30",
|
4
4
|
"license": "ISC",
|
5
5
|
"module": "./es/components/index.js",
|
6
6
|
"main": "./es/components/index.js",
|
@@ -71,5 +71,5 @@
|
|
71
71
|
"iOS 7",
|
72
72
|
"last 3 iOS versions"
|
73
73
|
],
|
74
|
-
"gitHead": "
|
74
|
+
"gitHead": "d4e3dca50f67b165cfaf1092cd8969480bb55f72"
|
75
75
|
}
|