cnhis-design-vue 3.2.9-beta.2 → 3.2.9-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +87 -87
  2. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  3. package/es/components/ai-chat/src/types/index.d.ts +8 -7
  4. package/es/components/base-search/index.d.ts +2 -0
  5. package/es/components/base-search/src/index.vue.d.ts +2 -0
  6. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  7. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  8. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  9. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  10. package/es/components/button-print/index.d.ts +7 -45
  11. package/es/components/button-print/src/ButtonPrint.vue.d.ts +7 -45
  12. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  13. package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +6 -35
  14. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
  15. package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +1 -5
  16. package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
  17. package/es/components/button-print/src/utils/print.d.ts +5 -4
  18. package/es/components/button-print/src/utils/print.js +1 -1
  19. package/es/components/expand-field/index.d.ts +1 -1
  20. package/es/components/expand-field/src/components/form.vue.d.ts +1 -1
  21. package/es/components/expand-field/src/index.vue.d.ts +1 -1
  22. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  23. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  24. package/es/components/field-set/src/FieldColor.vue.d.ts +29 -6
  25. package/es/components/field-set/src/FieldFilter.vue.d.ts +29 -6
  26. package/es/components/field-set/src/FieldSet.vue.d.ts +68 -28
  27. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  28. package/es/components/field-set/src/components/table-row.vue.d.ts +28 -1
  29. package/es/components/field-set/src/components/table-row.vue2.js +1 -1
  30. package/es/components/field-set/src/types/index.d.ts +3 -3
  31. package/es/components/field-set/src/utils/index.js +1 -1
  32. package/es/components/form-render/src/components/renderer/select.d.ts +2 -1
  33. package/es/components/form-render/src/components/renderer/select.js +1 -1
  34. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  35. package/es/components/iho-chat/index.d.ts +270 -2
  36. package/es/components/iho-chat/src/Index.vue.d.ts +270 -2
  37. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  38. package/es/components/iho-chat/src/api/index.js +1 -1
  39. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +5 -0
  40. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  41. package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +121 -1
  42. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  43. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +6 -0
  44. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  45. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +131 -2
  46. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +122 -0
  47. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  48. package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
  49. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +6 -1
  50. package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
  51. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  52. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +5 -0
  53. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  54. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  55. package/es/components/iho-chat/src/constants/index.d.ts +2 -1
  56. package/es/components/iho-chat/src/constants/index.js +1 -1
  57. package/es/components/iho-chat/src/hooks/useSearchUserList.js +1 -1
  58. package/es/components/iho-chat/src/hooks/useSession.js +1 -1
  59. package/es/components/iho-chat/src/hooks/useState.d.ts +5 -0
  60. package/es/components/iho-chat/src/hooks/useState.js +1 -1
  61. package/es/components/iho-chat/src/types/index.d.ts +1 -0
  62. package/es/components/iho-chat/src/utils/chatSock.js +1 -1
  63. package/es/components/iho-chat/style/index.css +1 -1
  64. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/index.js +1 -1
  65. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useRowHeight.d.ts +2 -0
  66. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useRowHeight.js +1 -0
  67. package/es/components/iho-table/src/types/index.d.ts +3 -0
  68. package/es/components/iho-table/style/index.css +1 -1
  69. package/es/components/index.css +1 -1
  70. package/es/components/quick-search/index.d.ts +3 -0
  71. package/es/components/quick-search/src/index.vue.d.ts +3 -0
  72. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  73. package/es/components/table-filter/src/hooks/useAdvanced.d.ts +1 -0
  74. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  75. package/es/components/table-filter/src/hooks/useRenderWidget.js +1 -1
  76. package/es/components/table-filter/src/types/index.d.ts +2 -0
  77. package/es/shared/assets/img/ai__avatar.png.js +1 -1
  78. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  79. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  80. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  81. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  82. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  83. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  84. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  85. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  86. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  87. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  88. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  89. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  90. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  91. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  92. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  93. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  94. package/es/shared/assets/img/failure.png.js +1 -1
  95. package/es/shared/assets/img/no-permission.png.js +1 -1
  96. package/es/shared/assets/img/nodata.png.js +1 -1
  97. package/es/shared/assets/img/notfound.png.js +1 -1
  98. package/es/shared/assets/img/qr.png.js +1 -1
  99. package/es/shared/assets/img/success.png.js +1 -1
  100. package/es/shared/assets/img/table_style_2.png.js +1 -1
  101. package/es/shared/assets/img/video.png.js +1 -1
  102. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  103. package/es/shared/assets/img/xb_big.png.js +1 -1
  104. package/es/shared/assets/img/xb_small.png.js +1 -1
  105. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  106. package/es/shared/package.json.js +1 -1
  107. package/es/shared/utils/fabricjs/index.d.ts +6823 -0
  108. package/es/shared/utils/index.d.ts +1 -0
  109. package/es/shared/utils/index.js +1 -1
  110. package/es/shared/utils/tapable/index.d.ts +139 -0
  111. package/package.json +2 -2
@@ -92,7 +92,6 @@ declare const _default: import("vue").DefineComponent<{
92
92
  };
93
93
  printCopies: {
94
94
  type: NumberConstructor;
95
- default: number;
96
95
  };
97
96
  resolution: {
98
97
  type: NumberConstructor;
@@ -209,7 +208,6 @@ declare const _default: import("vue").DefineComponent<{
209
208
  };
210
209
  printCopies: {
211
210
  type: NumberConstructor;
212
- default: number;
213
211
  };
214
212
  resolution: {
215
213
  type: NumberConstructor;
@@ -230,40 +228,15 @@ declare const _default: import("vue").DefineComponent<{
230
228
  emit: any;
231
229
  defaultFormatInfo: AnyObject;
232
230
  authorizationKey: import("vue").Ref<string>;
233
- state: {
234
- spinning: boolean;
235
- visible: boolean;
236
- formatList: never[];
237
- templateParams: never[];
238
- printParams: never[];
239
- originParams: {};
240
- currentFormatId: string;
241
- identityVerification: {
242
- visible: boolean;
243
- };
244
- isInited: boolean;
245
- watchPrintParamsReformatFn: null;
246
- spinTimer: null;
247
- isClickOuterPrint: boolean;
248
- curPrintParamList: never[];
249
- ireportExecuteMode: number;
250
- };
231
+ state: any;
251
232
  shortcutFn: any;
252
233
  options: import("vue").Ref<AnyObject[]>;
253
234
  operations: import("vue").Ref<AnyObject[]>;
254
- downlistOperation: {
255
- oneMouseType: string;
256
- oneClickType: string;
257
- twoMouseType: string;
258
- };
259
- downlistPopover: {
260
- oneShow: boolean;
261
- isOperation: boolean;
262
- isOutSetting: boolean;
263
- };
235
+ downlistOperation: any;
236
+ downlistPopover: any;
264
237
  innerPrintItems: import("vue").Ref<any[]>;
265
238
  outerPrintItems: import("vue").Ref<any[]>;
266
- currentFormatItem: import("vue").ComputedRef<{} | undefined>;
239
+ currentFormatItem: import("vue").ComputedRef<any>;
267
240
  formatTitle: import("vue").ComputedRef<any>;
268
241
  getTemplateIdByFormatId: import("vue").ComputedRef<any>;
269
242
  getTemplateCodeByFormatId: import("vue").ComputedRef<any>;
@@ -293,7 +266,7 @@ declare const _default: import("vue").DefineComponent<{
293
266
  getOnceParams: (curPrintParamList: any[] | undefined, templateCode: string) => string;
294
267
  handleClickPrintAll: () => void;
295
268
  toggleExpandLoading: (isLoading: boolean, formatId?: string) => void;
296
- getCurrentLoading: () => boolean;
269
+ getCurrentLoading: () => any;
297
270
  handleOneTypePrint: (templateCode: string, templateId: string, formatId: string, isOuterClick: boolean) => void;
298
271
  handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, printToParam?: never[], needContinuePrint?: boolean) => Promise<void>;
299
272
  handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
@@ -323,7 +296,7 @@ declare const _default: import("vue").DefineComponent<{
323
296
  handleClickBtn: (visible?: boolean) => Promise<false | undefined>;
324
297
  reformatPrintParams: () => void;
325
298
  verifiySuccess: (token: string) => void;
326
- isPrintDisabled: (outer: any, j: number) => false;
299
+ isPrintDisabled: (outer: any, j: number) => any;
327
300
  directPrint: () => Promise<void>;
328
301
  directDefaultFormatPrint: (defaultFormatId: string) => Promise<void>;
329
302
  NDropdown: any;
@@ -604,7 +577,6 @@ declare const _default: import("vue").DefineComponent<{
604
577
  };
605
578
  printCopies: {
606
579
  type: NumberConstructor;
607
- default: number;
608
580
  };
609
581
  resolution: {
610
582
  type: NumberConstructor;
@@ -643,7 +615,6 @@ declare const _default: import("vue").DefineComponent<{
643
615
  }>;
644
616
  showLoading: boolean;
645
617
  hideButtons: unknown[];
646
- printCopies: number;
647
618
  newPrintSetting: Record<string, any>;
648
619
  }>;
649
620
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,inject as t,ref as n,reactive as r,computed as i,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as f,renderList as y,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as O}from"vue";import{isObject as I}from"@vue/shared";import{useMessage as C,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as F,NCheckbox as E,NDivider as x}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as J}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as A}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as B}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{useShortcuts as K}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const R={class:"newprint-button-outer"},G={key:0,class:"newprint-button-outer__shortcut"},q=d("span",{class:"label bold"},"外显设置",-1),Y={class:"newprint-button-poperOver"},H={class:"print-lite"},$={class:"label bold"},Q={class:"print-li"},W={class:"print-lite"},X={key:0,class:"newprint-button-outer__shortcut"},Z={class:"newprint-button-poperOver"},ee=["onMouseenter","onClick"],te={class:"label bold"},ne={class:"newprint-button-poperOver"},re={class:"print-lite"},ie={class:"label bold"},ae={class:"print-li"},le={class:"print-lite"},oe=["onClick"],se={key:0,class:"newprint-button-outer__shortcut"},ue={class:"newprint-button-poperOver"},ce=["onMouseenter"],de={class:"print-lite"},pe=["onClick"];var me=e({__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},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})}},setup(e,{expose:me}){const ve=e,fe=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],ye=C();let ge;const he=t(z),ke=n(""),be=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],ireportExecuteMode:1}),Pe=n({});let we=n([]),Se=n([{label:ve.previewText,key:"previewText"},{label:ve.pdfLoadText,key:"downloadPdf"},{label:ve.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Oe=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),Ie=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),Ce=n([]),Le=n([]),Te=i((()=>{if(!be.currentFormatId)return{};let e=be.currentFormatId;return be.formatList.find((t=>t.id===e))}));i((()=>{var e;return(null==(e=Te.value)?void 0:e.name)||"格式选择"}));const je=i((()=>{let e=be.formatList.find((e=>e.id===be.currentFormatId));return null==e?void 0:e.templateId})),Me=i((()=>{let e=be.formatList.find((e=>e.id===be.currentFormatId));return null==e?void 0:e.number})),Fe=i((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.isShowPrintAll})),Ee=i((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.isShowOutSetting})),xe=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.customProps)||{}})),Ne=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.defaultFormatId)||""})),_e=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.printAllType)||1})),De=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.shortcut)||{}})),Je=i((()=>{var e,t;const n=Object.keys(De.value);if(n.length>0){if(Ne.value&&n.includes(Ne.value))return(null==(e=De.value[Ne.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=De.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=i((()=>{const e=fe.map((e=>e.key));return we.value.filter((t=>!e.includes(t.key)))})),Ae=i({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ue=async()=>{var e,t;(null==(t=null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await mt(),Ie.oneShow=!0},Ve=async e=>{if(ve.directPrint){if(be.spinning)return;return"button"===e?void(Fe.value?await yt():Ne.value?async function(e){await mt(!1);const t=Ce.value.find((t=>t.key==e));t&&et(t.templateCode,t.templateId,t.key,!1)}(Ne.value):Ue()):Ue()}return Ue()},Be=(e,t)=>{Oe[e]=t},Ke=()=>{Ce.value=we.value.filter((e=>!e.selected)),Le.value=ze.value.filter((e=>e.selected)),Ge("oneShow"),Ge("isOutSetting"),he("saveOuterPrint",Le.value)},Re=e=>{Ie[e]=!0},Ge=e=>{Oe.oneClickType="",Ie[e]=!1,"isOutSetting"==e&&(Ie.isOutSetting=!1)},qe=(e,t)=>{Xe(!1);let n={type:t,formatId:be.currentFormatId,templateId:(null==e?void 0:e.templateId)||je.value,templateCode:(null==e?void 0:e.templateCode)||Me.value};he("success",e,n)},Ye=e=>{Xe(!1),he("error",e),I(e)&&"notInstalledApp"===e.type&&ye.error(e.message)},He=e=>{Xe(!1),he("cancel",e)},$e=e=>{he("error",{message:"前置条件执行错误",type:e,preExecution:!0})},Qe=()=>JSON.stringify({...ve.token?{token:ve.token}:{}}),We=(e=[],t)=>{var n,r;let i={},a={};if((null==(n=be.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(r=Object.keys(e[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return i=Object.assign({},JSON.parse(Qe()),xe.value,a),JSON.stringify(i)},Xe=(e,t)=>{if(be.isClickOuterPrint){if(e&&t){const n=Le.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}Le.value.forEach((e=>{e.isLoading=!1}))}else be.spinning=e},Ze=()=>be.isClickOuterPrint?Le.value.some((e=>e.isLoading)):be.spinning,et=(e,t,n,r)=>{const i=be.printParams[e];if(!i)return;be.isClickOuterPrint=r,be.currentFormatId=n;const a=be.originParams[e]||[];tt(i,e,t,n,a)},tt=async(e=[],t,n,r,i=[],a)=>{let l=e.length;const o=async e=>{try{--l<=0&&qe(e,"print")}catch(e){console.log("error",e)}};ve.showLoading&&Ze()&&!a||(Xe(!0,r),ve.prevFn("print",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e;const a={formatId:r,ireportExecuteMode:be.ireportExecuteMode,templateId:n,authorizationKey:ke.value,printdlgshow:ve.printdlgshow,signature:ve.signature,copies:ve.printCopies};if("MULTI"===ve.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[t]));ge.printDirect({...a,params:n},o,Ye,He)}else ge.printDirect({...a,params:We(e,t)},(e=>{e.params=i,e.templateCode=t,e.templateId=n,qe(e,"print")}),Ye,He)})).catch((()=>{$e("print"),Xe(!1)})).finally((()=>{be.visible=!1})))},nt=async(e,{templateCode:t,templateId:n,key:r},i)=>{const a=be.printParams[t];if(a)switch(be.isClickOuterPrint=i,be.currentFormatId=r,e){case"previewText":(async(e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("preview",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[0])),a="MULTI"===ve.strategy?i:We(e,t),l={formatId:r,templateId:n,ireportExecuteMode:be.ireportExecuteMode,authorizationKey:ke.value,params:a,btnprint:ve.btnprint,signature:ve.signature};ge.preview(l,(e=>{qe(e,"preview")}),Ye)})).catch((()=>{$e("preview"),Xe(!1)})).finally((()=>{be.visible=!1})))})(a,t,n,r);break;case"formatEditText":((e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("edit",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e,be.currentFormatId=r,be.identityVerification.visible=!0})).catch((()=>{$e("edit")})).finally((()=>{Xe(!1)})))})(a,0,n,r);break;case"downloadPdf":(async(e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("download",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[0])),a="MULTI"===ve.strategy?i:We(e,t),l={formatId:r,templateId:n,ireportExecuteMode:be.ireportExecuteMode,authorizationKey:ke.value,print:{print:"1",type:"1",resolution:null==ve?void 0:ve.resolution},params:a,signature:ve.signature};ge.downloadPDF(l,(e=>qe(e,"preview")),Ye)})).catch((()=>{$e("download"),Xe(!1)})).finally((()=>{be.visible=!1})))})(a,t,n,r);break;case"resetPrinter":(async(e=[],t,n,r)=>{if(!ve.showLoading||!Ze()){Xe(!0,r);try{const e=await ge.resetPrinter(r);if(Xe(!1),"success"==(null==e?void 0:e.result))return void ye.success(e.message||"重置打印机成功");ye.warning("重置打印机失败")}catch(e){Xe(!1),ye.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,r)}},rt=()=>{},it=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},st(n,t,e))})),n},at=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ut(n,t,e))})),n},lt=(e,t,n)=>{const r={};return t.forEach((t=>{let i=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(r=B(t,n[e.type])),(null==e?void 0:e.defaultValue)||r})(t,e[t[n]]);e[t[n]]&&i&&(r[t[n]]=i)})),r},ot=({customizeDataset:e=[],param:t=[]},n={})=>{let r={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[e.name]=JSON.stringify(lt(n,t,"fieldName"))})),r=Object.assign({},r,lt(n,t,"key")),r},st=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r],a=n[i];if(!a)return ye.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(ot(a,t))}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return ye.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(ot(l,t))}return e},ut=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r];if(!n[i])return ye.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(t)}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return ye.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(t)}return e},ct=async e=>{var t;be.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],be.ireportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].ireportExecuteMode||1,(()=>{var e,t,n;const r=Object.keys(De.value),i=be.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(r.includes(e.id)){const n=De.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));we.value.unshift(...i),Ee.value&&we.value.push(...fe),(null==(t=null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(we.value.forEach((e=>{var t;(null==(t=ve.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),Le.value=we.value.filter((e=>e.selected))),Ce.value=we.value.filter((e=>!e.selected)),ve.hideButtons.length>0&&(Se.value=Se.value.filter((e=>!ve.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(t);r.includes("RY7.2.21.1.M2.G94181E")||(Se.value=Se.value.filter((e=>"downloadPdf"!=e.key))),r.includes("RY7.2.21.1.M2.G33633A")||(Se.value=Se.value.filter((e=>"formatEditText"!=e.key))),r.includes("RY7.2.21.1.M2.G99314S")||(Se.value=Se.value.filter((e=>"resetPrinter"!=e.key)))}})(),be.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),be.printParams=it(be.templateParams,ve.params),be.originParams=at(be.templateParams,ve.params),pt()},dt=async()=>{var e;if(be.isInited)return!0;be.isInited=!0,be.spinning=!0,(()=>{if(ge)return!1;ge=new A})();const t=await ve.queryPrintFormatByNumber();return await ct(t),(null==(e=t.obj)?void 0:e.length)>0&&(ke.value=t.obj[0].authorizationKey||""),be.spinning=!1,!0},pt=async()=>{const e=Object.keys(De.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],r=De.value[n],{stop:i,signature:a}=K().register({label:r.code,shortcutSignature:r.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=be.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=be.printParams[null==e?void 0:e.templateCode],r=t[null==e?void 0:e.templateCode]||[];tt(n,e.templateCode,e.templateId,e.key,r)}}}});Pe.value[n]=i}},mt=async(e=!0)=>{if(await ve.clickPrevFn()){if(!be.visible){if(!await dt())return!1}e&&(be.visible=!be.visible)}},vt=e=>{if(be.identityVerification.visible=!1,U(be.currentFormatId))return qe(null,"edit");const t=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,be.curPrintParamList[0])),n="MULTI"===ve.strategy?t:We(be.curPrintParamList,Me.value),r={formatId:be.currentFormatId,templateId:je.value,params:n,token:e};ge.editPrintFormat(r,(e=>{qe(e,"edit")}),Ye)},ft=(e,t)=>{const n=Le.value[t+1];return t<Le.value.length-1&&!be.printParams[e.templateCode]&&be.printParams[n.templateCode]};async function yt(){await mt(!1),(()=>{const e=Object.keys(be.printParams);be.isClickOuterPrint=!1;const t=be.originParams;if(1==_e.value)for(let n=0;n<e.length;n++){const r=e[n],i=be.printParams[r],a=t[r]||[],l=be.formatList.filter((e=>e.number==r));l&&l.length>0&&l.forEach((e=>{be.currentFormatId=e.id,tt(i,e.number,e.templateId,e.id,a,!0)}))}2==_e.value&&Le.value.forEach((e=>{const n=be.printParams[e.templateCode],r=t[e.templateCode]||[];be.currentFormatId=e.key,tt(n,e.templateCode,e.templateId,e.key,r,!0)}))})()}return a((()=>{be.isInited=!1,mt()})),l((()=>{const e=Object.keys(Pe.value);e.length>0&&e.forEach((e=>{Pe.value[e]&&Pe.value[e]()}))})),o((()=>ve.params),(e=>{Object.keys(be.templateParams).length>0&&(be.printParams=it(be.templateParams,ve.params),be.originParams=at(be.templateParams,ve.params))}),{deep:!0}),o((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await mt(!1)}),{deep:!0,immediate:!0}),me({directPrint:yt}),(t,n)=>(s(),u(c,null,[d("div",R,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(Le.value,((t,n)=>{return s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:rt,options:(r=v(Se),i=t,be.printParams[i.templateCode]?r:[]),onSelect:e=>nt(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!be.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>et(t.templateCode,t.templateId,t.key,!0),class:h(n==Le.value.length-1?"outerLastButton":ft(t,n)?"isPrintDisabled":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",G,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"]);var r,i})),128))])),_:1}),p(" 外显设置按钮 "),Le.value.length>0&&Le.value.length==v(ze).length&&v(Ee)&&2!=v(_e)?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,show:Ie.isOutSetting,onClickoutside:n[2]||(n[2]=e=>Ge("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(Le.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>Re("isOutSetting"))},{default:f((()=>[q,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:f((()=>[d("div",Y,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",H,[d("span",$,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",Q,[m(v(x)),d("div",W,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[1]||(n[1]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(F),{trigger:"click","show-arrow":!1,show:Ie.oneShow,onClickoutside:n[10]||(n[10]=e=>Ge("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:mt,printSpinning:be.spinning,printbtnText:e.btnText,printVisible:be.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ve("icon")),["stop"]))},{default:f((()=>[m(v(j),{loading:e.showLoading&&be.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(Le.value.length>0?"printAllLeftCls":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(v(Fe)?"打印全部":e.btnText)+" ",1),v(Je)?(s(),u("span",X,b(v(Je)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:f((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:f((()=>[d("div",Z,[(s(!0),u(c,null,y(Ce.value,(e=>(s(),u("div",{class:h(["print-li",Oe.oneMouseType==e.key||Oe.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Be("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Be("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!be.printParams[n.templateCode])return[];Be(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(x),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:Ie.isOutSetting,onClickoutside:n[7]||(n[7]=e=>Ge("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>Re("isOutSetting"))},[d("span",te,b(e.label),1),m(v(M),{color:Le.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",ne,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",re,[d("span",ie,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",ae,[m(v(x)),d("div",le,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[6]||(n[6]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",be.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>et(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",se,b(e.shortcutLabel),1)):p("v-if",!0)],8,oe),be.printParams[e.templateCode]?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Ie[e.key],onClickoutside:t=>Ge(e.key)},{trigger:f((()=>[m(v(M),{component:v(J),size:"18",onClick:t=>Re(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ue,[(s(!0),u(c,null,y(v(Se),(t=>(s(),u("div",{class:h(["print-li",Oe.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Be("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Be("twoMouseType",""))},[d("div",de,[d("span",{class:"label",onClick:n=>nt(t.key,e,!1)},b(t.label),9,pe)])],42,ce)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,ee)))),128))])])),_:3},8,["show"])],2112))]),m(V,O(t.$attrs,{modelValue:be.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>be.identityVerification.visible=e),formatId:be.currentFormatId,templateId:v(je),onSuccess:vt}),null,16,["modelValue","formatId","templateId"])],64))}});export{me as default};
1
+ import{defineComponent as e,inject as t,ref as n,reactive as r,computed as i,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as f,renderList as y,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as I}from"vue";import{isObject as O}from"@vue/shared";import{useMessage as C,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as x,NCheckbox as E,NDivider as F}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as R}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as J}from"../constants/index.js";import{Print as z}from"../utils/print.js";import{isIReport as K}from"../utils/browserPrint.js";import A from"./IdentityVerification.vue.js";import{format as U}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{encapBrowserLog as V}from"../../../../shared/utils/index.js";import{useShortcuts as B}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const q={class:"newprint-button-outer"},G={key:0,class:"newprint-button-outer__shortcut"},Y=d("span",{class:"label bold"},"外显设置",-1),H={class:"newprint-button-poperOver"},$={class:"print-lite"},Q={class:"label bold"},W={class:"print-li"},X={class:"print-lite"},Z={key:0,class:"newprint-button-outer__shortcut"},ee={class:"newprint-button-poperOver"},te=["onMouseenter","onClick"],ne={class:"label bold"},re={class:"newprint-button-poperOver"},ie={class:"print-lite"},ae={class:"label bold"},le={class:"print-li"},oe={class:"print-lite"},se=["onClick"],ue={key:0,class:"newprint-button-outer__shortcut"},ce={class:"newprint-button-poperOver"},de=["onMouseenter"],pe={class:"print-lite"},me=["onClick"];var ve=e({__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},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})}},setup(e,{expose:ve}){const fe=e,ye=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],ge=C();let he;const ke=t(J),be=n(""),Pe=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],iReportExecuteMode:1}),we=n({});let Se=n([]),Ie=n([{label:fe.previewText,key:"previewText"},{label:fe.pdfLoadText,key:"downloadPdf"},{label:fe.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Oe=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),Ce=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),Le=n([]),Te=n([]),je=i((()=>{if(!Pe.currentFormatId)return{};let e=Pe.currentFormatId;return Pe.formatList.find((t=>t.id===e))}));i((()=>{var e;return(null==(e=je.value)?void 0:e.name)||"格式选择"}));const Me=i((()=>{let e=Pe.formatList.find((e=>e.id===Pe.currentFormatId));return null==e?void 0:e.templateId})),xe=i((()=>{let e=Pe.formatList.find((e=>e.id===Pe.currentFormatId));return null==e?void 0:e.number})),Ee=i((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowPrintAll})),Fe=i((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowOutSetting})),Ne=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.customProps)||{}})),_e=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.defaultFormatId)||""})),De=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.printAllType)||1})),Re=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.shortcut)||{}})),Je=i((()=>{var e,t;const n=Object.keys(Re.value);if(n.length>0){if(_e.value&&n.includes(_e.value))return(null==(e=Re.value[_e.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=Re.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=i((()=>{const e=ye.map((e=>e.key));return Se.value.filter((t=>!e.includes(t.key)))})),Ke=i({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ae=async()=>{var e,t;(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await vt(),Ce.oneShow=!0},Ue=async e=>{if(fe.directPrint){if(Pe.spinning)return;return"button"===e?void(Ee.value?await gt():_e.value?async function(e){await vt(!1);const t=Le.value.find((t=>t.key==e));t&&tt(t.templateCode,t.templateId,t.key,!1)}(_e.value):Ae()):Ae()}return Ae()},Ve=(e,t)=>{Oe[e]=t},Be=()=>{Le.value=Se.value.filter((e=>!e.selected)),Te.value=ze.value.filter((e=>e.selected)),Ge("oneShow"),Ge("isOutSetting"),ke("saveOuterPrint",Te.value)},qe=e=>{Ce[e]=!0},Ge=e=>{Oe.oneClickType="",Ce[e]=!1,"isOutSetting"==e&&(Ce.isOutSetting=!1)},Ye=(e,t)=>{Ze(!1);let n={type:t,formatId:Pe.currentFormatId,templateId:(null==e?void 0:e.templateId)||Me.value,templateCode:(null==e?void 0:e.templateCode)||xe.value};V({type:"进入成功的回调",res:e,info:n},"PRINT-SDK"),ke("success",e,n)},He=e=>{Ze(!1),V({type:"进入失败的回调",res:e},"PRINT-SDK"),ke("error",e),O(e)&&"notInstalledApp"===e.type&&ge.error(e.message)},$e=e=>{Ze(!1),ke("cancel",e)},Qe=e=>{ke("error",{message:"前置条件执行错误",type:e,preExecution:!0})},We=()=>JSON.stringify({...fe.token?{token:fe.token}:{}}),Xe=(e=[],t)=>{var n,r;let i={},a={};if((null==(n=Pe.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(r=Object.keys(e[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return i=Object.assign({},JSON.parse(We()),Ne.value,a),JSON.stringify(i)},Ze=(e,t)=>{if(Pe.isClickOuterPrint){if(e&&t){const n=Te.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}Te.value.forEach((e=>{e.isLoading=!1}))}else Pe.spinning=e},et=()=>Pe.isClickOuterPrint?Te.value.some((e=>e.isLoading)):Pe.spinning,tt=(e,t,n,r)=>{const i=Pe.printParams[e];if(!i)return;Pe.isClickOuterPrint=r,Pe.currentFormatId=n;const a=Pe.originParams[e]||[];nt(i,e,t,n,a)},nt=async(e=[],t,n,r,i=[],a)=>{V({type:"点击打印的入参",templateCode:t,templateId:n,formatId:r,printToParam:i},"PRINT-SDK");let l=e.length;const o=async e=>{try{--l<=0&&Ye(e,"print")}catch(e){console.log("error",e)}};fe.showLoading&&et()&&!a||(Ze(!0,r),fe.prevFn("print",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const a={formatId:r,iReportExecuteMode:Pe.iReportExecuteMode,templateId:n,authorizationKey:be.value,printdlgshow:fe.printdlgshow,signature:fe.signature,copies:fe.printCopies};if(V({type:"准备开始打印",queryParams:a,printToParam:i},"PRINT-SDK"),"MULTI"===fe.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[t]));he.printDirect({...a,params:n},o,He,$e)}else he.printDirect({...a,params:Xe(e,t)},(e=>{e.params=i,e.templateCode=t,e.templateId=n,Ye(e,"print")}),He,$e)})).catch((()=>{Qe("print"),Ze(!1)})).finally((()=>{Pe.visible=!1})))},rt=async(e,{templateCode:t,templateId:n,key:r},i)=>{const a=Pe.printParams[t];if(a)switch(Pe.isClickOuterPrint=i,Pe.currentFormatId=r,e){case"previewText":(async(e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("preview",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[0])),a="MULTI"===fe.strategy?i:Xe(e,t),l={formatId:r,templateId:n,iReportExecuteMode:Pe.iReportExecuteMode,authorizationKey:be.value,params:a,btnprint:fe.btnprint,signature:fe.signature};he.preview(l,(e=>{Ye(e,"preview")}),He)})).catch((()=>{Qe("preview"),Ze(!1)})).finally((()=>{Pe.visible=!1})))})(a,t,n,r);break;case"formatEditText":((e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("edit",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e,Pe.currentFormatId=r,Pe.identityVerification.visible=!0})).catch((()=>{Qe("edit")})).finally((()=>{Ze(!1)})))})(a,0,n,r);break;case"downloadPdf":(async(e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("download",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[0])),a="MULTI"===fe.strategy?i:Xe(e,t),l={formatId:r,templateId:n,iReportExecuteMode:Pe.iReportExecuteMode,authorizationKey:be.value,print:{print:"1",type:"1",resolution:null==fe?void 0:fe.resolution},params:a,signature:fe.signature};he.downloadPDF(l,(e=>Ye(e,"preview")),He)})).catch((()=>{Qe("download"),Ze(!1)})).finally((()=>{Pe.visible=!1})))})(a,t,n,r);break;case"resetPrinter":(async(e=[],t,n,r)=>{if(!fe.showLoading||!et()){Ze(!0,r);try{const e=await he.resetPrinter(r,Pe.iReportExecuteMode);if(Ze(!1),"success"==(null==e?void 0:e.result))return void ge.success(e.message||"重置打印机成功");ge.warning("重置打印机失败")}catch(e){Ze(!1),ge.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,r)}},it=()=>{},at=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ut(n,t,e))})),n},lt=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ct(n,t,e))})),n},ot=(e,t,n)=>{const r={};return t.forEach((t=>{let i=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(r=U(t,n[e.type])),(null==e?void 0:e.defaultValue)||r})(t,e[t[n]]);e[t[n]]&&i&&(r[t[n]]=i)})),r},st=({customizeDataset:e=[],param:t=[]},n={})=>{let r={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[e.name]=JSON.stringify(ot(n,t,"fieldName"))})),r=Object.assign({},r,ot(n,t,"key")),r},ut=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r],a=n[i];if(!a)return ge.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(st(a,t))}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return ge.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(st(l,t))}return e},ct=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r];if(!n[i])return ge.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(t)}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return ge.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(t)}return e},dt=async e=>{var t;Pe.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],Pe.iReportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].iReportExecuteMode||1,(()=>{var e,t,n;const r=Object.keys(Re.value),i=Pe.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(r.includes(e.id)){const n=Re.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));Se.value.unshift(...i),Fe.value&&Se.value.push(...ye),(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(Se.value.forEach((e=>{var t;(null==(t=fe.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),Te.value=Se.value.filter((e=>e.selected))),Le.value=Se.value.filter((e=>!e.selected)),fe.hideButtons.length>0&&(Ie.value=Ie.value.filter((e=>!fe.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(t);r.includes("RY7.2.21.1.M2.G94181E")||(Ie.value=Ie.value.filter((e=>"downloadPdf"!=e.key))),r.includes("RY7.2.21.1.M2.G33633A")||(Ie.value=Ie.value.filter((e=>"formatEditText"!=e.key))),r.includes("RY7.2.21.1.M2.G99314S")||(Ie.value=Ie.value.filter((e=>"resetPrinter"!=e.key)))}})(),Pe.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),Pe.printParams=at(Pe.templateParams,fe.params),Pe.originParams=lt(Pe.templateParams,fe.params),mt()},pt=async()=>{var e;if(Pe.isInited)return!0;Pe.isInited=!0,Pe.spinning=!0,(()=>{if(he)return!1;he=new z})();const t=await fe.queryPrintFormatByNumber();return await dt(t),(null==(e=t.obj)?void 0:e.length)>0&&(be.value=t.obj[0].authorizationKey||""),Pe.spinning=!1,!0},mt=async()=>{const e=Object.keys(Re.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],r=Re.value[n],{stop:i,signature:a}=B().register({label:r.code,shortcutSignature:r.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ue("button");const e=ze.value.map((e=>e.key)),t=Pe.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=Pe.printParams[null==e?void 0:e.templateCode],r=t[null==e?void 0:e.templateCode]||[];nt(n,e.templateCode,e.templateId,e.key,r)}}}});we.value[n]=i}},vt=async(e=!0)=>{if(await fe.clickPrevFn()){if(!Pe.visible){if(!await pt())return!1}e&&(Pe.visible=!Pe.visible)}},ft=e=>{if(Pe.identityVerification.visible=!1,K(Pe.currentFormatId))return Ye({result:"success",message:""},"edit");const t=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,Pe.curPrintParamList[0])),n="MULTI"===fe.strategy?t:Xe(Pe.curPrintParamList,xe.value),r={formatId:Pe.currentFormatId,templateId:Me.value,params:n,token:e};he.editPrintFormat(r,(e=>{Ye(e,"edit")}),He)},yt=(e,t)=>{const n=Te.value[t+1];return t<Te.value.length-1&&!Pe.printParams[e.templateCode]&&Pe.printParams[n.templateCode]};async function gt(){await vt(!1),(()=>{const e=Object.keys(Pe.printParams);Pe.isClickOuterPrint=!1;const t=Pe.originParams;if(1==De.value)for(let n=0;n<e.length;n++){const r=e[n],i=Pe.printParams[r],a=t[r]||[],l=Pe.formatList.filter((e=>e.number==r));l&&l.length>0&&l.forEach((e=>{Pe.currentFormatId=e.id,nt(i,e.number,e.templateId,e.id,a,!0)}))}2==De.value&&Te.value.forEach((e=>{const n=Pe.printParams[e.templateCode],r=t[e.templateCode]||[];Pe.currentFormatId=e.key,nt(n,e.templateCode,e.templateId,e.key,r,!0)}))})()}return a((()=>{Pe.isInited=!1,vt()})),l((()=>{const e=Object.keys(we.value);e.length>0&&e.forEach((e=>{we.value[e]&&we.value[e]()}))})),o((()=>fe.params),(e=>{Object.keys(Pe.templateParams).length>0&&(Pe.printParams=at(Pe.templateParams,fe.params),Pe.originParams=lt(Pe.templateParams,fe.params))}),{deep:!0}),o((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await vt(!1)}),{deep:!0,immediate:!0}),ve({directPrint:gt}),(t,n)=>(s(),u(c,null,[d("div",q,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(Te.value,((t,n)=>{return s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:it,options:(r=v(Ie),i=t,Pe.printParams[i.templateCode]?r:[]),onSelect:e=>rt(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!Pe.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>tt(t.templateCode,t.templateId,t.key,!0),class:h(n==Te.value.length-1?"outerLastButton":yt(t,n)?"isPrintDisabled":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",G,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"]);var r,i})),128))])),_:1}),p(" 外显设置按钮 "),Te.value.length>0&&Te.value.length==v(ze).length&&v(Fe)&&2!=v(De)?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,show:Ce.isOutSetting,onClickoutside:n[2]||(n[2]=e=>Ge("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(Te.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>qe("isOutSetting"))},{default:f((()=>[Y,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:f((()=>[d("div",H,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",$,[d("span",Q,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",W,[m(v(F)),d("div",X,[m(v(j),{type:"primary",size:"small",onClick:Be},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ke),"onUpdate:checked":n[1]||(n[1]=e=>P(Ke)?Ke.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(x),{trigger:"click","show-arrow":!1,show:Ce.oneShow,onClickoutside:n[10]||(n[10]=e=>Ge("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:vt,printSpinning:Pe.spinning,printbtnText:e.btnText,printVisible:Pe.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ue("icon")),["stop"]))},{default:f((()=>[m(v(j),{loading:e.showLoading&&Pe.spinning,onClick:n[3]||(n[3]=S((()=>Ue("button")),["stop"])),class:h(Te.value.length>0?"printAllLeftCls":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(v(Ee)?"打印全部":e.btnText)+" ",1),v(Je)?(s(),u("span",Z,b(v(Je)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:f((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:f((()=>[d("div",ee,[(s(!0),u(c,null,y(Le.value,(e=>(s(),u("div",{class:h(["print-li",Oe.oneMouseType==e.key||Oe.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Ve("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Ve("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!Pe.printParams[n.templateCode])return[];Ve(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(F),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(x),{trigger:"click","show-arrow":!1,placement:"right-start",show:Ce.isOutSetting,onClickoutside:n[7]||(n[7]=e=>Ge("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>qe("isOutSetting"))},[d("span",ne,b(e.label),1),m(v(M),{color:Te.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",re,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",ie,[d("span",ae,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",le,[m(v(F)),d("div",oe,[m(v(j),{type:"primary",size:"small",onClick:Be},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ke),"onUpdate:checked":n[6]||(n[6]=e=>P(Ke)?Ke.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",Pe.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>tt(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",ue,b(e.shortcutLabel),1)):p("v-if",!0)],8,se),Pe.printParams[e.templateCode]?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Ce[e.key],onClickoutside:t=>Ge(e.key)},{trigger:f((()=>[m(v(M),{component:v(R),size:"18",onClick:t=>qe(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ce,[(s(!0),u(c,null,y(v(Ie),(t=>(s(),u("div",{class:h(["print-li",Oe.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Ve("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Ve("twoMouseType",""))},[d("div",pe,[d("span",{class:"label",onClick:n=>rt(t.key,e,!1)},b(t.label),9,me)])],42,de)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,te)))),128))])])),_:3},8,["show"])],2112))]),m(A,I(t.$attrs,{modelValue:Pe.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>Pe.identityVerification.visible=e),formatId:Pe.currentFormatId,templateId:v(Me),onSuccess:ft}),null,16,["modelValue","formatId","templateId"])],64))}});export{ve as default};
@@ -96,7 +96,6 @@ declare const _default: import("vue").DefineComponent<{
96
96
  };
97
97
  printCopies: {
98
98
  type: NumberConstructor;
99
- default: number;
100
99
  };
101
100
  resolution: {
102
101
  type: NumberConstructor;
@@ -210,7 +209,6 @@ declare const _default: import("vue").DefineComponent<{
210
209
  };
211
210
  printCopies: {
212
211
  type: NumberConstructor;
213
- default: number;
214
212
  };
215
213
  resolution: {
216
214
  type: NumberConstructor;
@@ -239,7 +237,7 @@ declare const _default: import("vue").DefineComponent<{
239
237
  isInited: boolean;
240
238
  watchPrintParamsReformatFn: null;
241
239
  spinTimer: null;
242
- ireportExecuteMode: number;
240
+ iReportExecuteMode: number;
243
241
  };
244
242
  options: import("vue").Ref<AnyObject[]>;
245
243
  currentFormatItem: import("vue").ComputedRef<{} | undefined>;
@@ -553,7 +551,6 @@ declare const _default: import("vue").DefineComponent<{
553
551
  };
554
552
  printCopies: {
555
553
  type: NumberConstructor;
556
- default: number;
557
554
  };
558
555
  resolution: {
559
556
  type: NumberConstructor;
@@ -588,7 +585,6 @@ declare const _default: import("vue").DefineComponent<{
588
585
  }>;
589
586
  showLoading: boolean;
590
587
  hideButtons: unknown[];
591
- printCopies: number;
592
588
  printCustomProps: Record<string, any>;
593
589
  }>;
594
590
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as t,useAttrs as e,inject as n,ref as r,reactive as i,computed as a,onMounted as o,watch as l,openBlock as s,createElementBlock as p,Fragment as d,createVNode as u,unref as m,withCtx as c,renderSlot as f,withModifiers as v,createTextVNode as y,toDisplayString as g,mergeProps as b}from"vue";import{isObject as I}from"@vue/shared";import{useMessage as h,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as x}from"../constants/index.js";import{Print as T}from"../utils/print.js";import{isIReport as S}from"../utils/browserPrint.js";import E from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as M,getPrivateFormatApi as O}from"../api.js";var L=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},resolution:{type:Number},printCustomProps:{type:Object,default:()=>({})},placement:{type:String}},setup(t,{expose:L}){var D;const C=t,N=e(),V=h();let B;const R=n(x),z={},A=r(""),J=i({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,ireportExecuteMode:1});let U=r([{label:C.printText,key:"printText"},{label:C.previewText,key:"previewText"},{label:C.pdfLoadText,key:"downloadPdf"},{label:C.formatEditText,key:"formatEditText"},...(null==(D=C.externalOptionConfig)?void 0:D.options)||[]]);const q=a((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=a((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=a((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(C.directPrint){if(J.spinning)return;return"button"===t?void await ut():st()}return st()},H=t=>u("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};R("success",t,n)},$=t=>{J.spinning=!1,R("error",t),I(t)&&"notInstalledApp"===t.type&&V.error(t.message)},Q=t=>{J.spinning=!1,R("cancel",t)},W=t=>{R("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=C.printParams)?void 0:e.length)?C.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...C.token?{token:C.token}:{},...C.printCustomProps||{}})},Z=()=>{var t,e;let n={},r={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));r={datasetData:{}},r.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{r[t]=[],J.printParams.forEach((e=>{r[t].includes(e[t])||r[t].push(e[t])})),r[t]=r[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),r),JSON.stringify(n)},tt=((t,e,n=!0)=>{let r=null;return function(...i){r&&clearTimeout(r),n&&!r&&t.apply(null,i),r=setTimeout((()=>{r=null,!n&&t.apply(null,i)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("print",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t={ireportExecuteMode:J.ireportExecuteMode,formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:C.printdlgshow,signature:C.signature,copies:C.printCopies};if("MULTI"===C.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),B.printDirect({...t,params:X(n)},e,$,Q);else B.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,r;switch(t){case"printText":tt();break;case"previewText":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("preview",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,ireportExecuteMode:J.ireportExecuteMode,templateId:_.value,authorizationKey:A.value,params:t,btnprint:C.btnprint,signature:C.signature};B.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("edit",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("download",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,ireportExecuteMode:J.ireportExecuteMode,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1",resolution:null==C?void 0:C.resolution},params:t,signature:C.signature};B.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const i=J.formatList.find((e=>e.id===t))||{};if(Object.keys(i).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==i?void 0:i.name)||e.label,await M({formatForms:[{...i}],name:z.name||i.templateName,number:z.number||i.number,templateId:z.templateId||i.templateId,...z.id?{id:z.id}:{}},{token:C.token})}else null==(r=null==(n=C.externalOptionConfig)?void 0:n.onSelect)||r.call(n,t,e);break}}},nt=()=>{J.visible=!1,R("clickoutside")},rt=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),it=(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=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||r})(e,t[e[n]]);t[e[n]]&&i&&(r[e[n]]=i)})),r},at=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let r={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;r.datasetData={[t.name]:JSON.stringify(it(n,e,"fieldName"))}})),r=Object.assign({},r,it(n,e,"key")),r})),ot=async t=>{var e,n;if(J.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):[],J.ireportExecuteMode=(null==(e=null==t?void 0:t.obj)?void 0:e.length)>0&&t.obj[0].ireportExecuteMode||1,J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!N.isDoc){const{data:e}=await O({templateId:t[0].templateId},{token:C.token});if("SUCCESS"===e.result){const{formatForms:r=[]}=e.map||{};Object.assign(z,e.map||{});const i=null==(n=null==r?void 0:r[0])?void 0:n.id;if(i&&t.map((t=>t.id)).includes(i))return i}}const r=t.find((t=>1==t[e]));return(null==r?void 0:r.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],V.error(C.noDefaultFormatMsg),rt();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),C.hideButtons.length>0&&(U.value=U.value.filter((t=>!C.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),r=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},i=Object.keys(r);i.includes("RY7.2.21.1.M2.G94181E")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let r=null==(n=await C.queryTemplateParams())?void 0:n.obj;if(!r||!_.value)return V.error("获取打印模板失败,请联系管理员!"),rt();J.templateParams=r,J.printParams=at(J.templateParams,C.params)},lt=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(B)return!1;B=new T})();const e=await C.queryPrintFormatByNumber();return await ot(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await C.clickPrevFn())if((null==(e=C.params)?void 0:e.length)||(null==(n=C.printParams)?void 0:n.length)){if(!J.visible){if(!await lt())return!1}t&&(J.visible=!J.visible)}else V.warning(C.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=at(J.templateParams,C.params):J.watchPrintParamsReformatFn=()=>l((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},dt=t=>{if(J.identityVerification.visible=!1,S(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};B.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function ut(){await st(!1),tt()}return o((()=>{J.isInited=!1})),l((()=>C.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),L({directPrint:ut}),(e,n)=>(s(),p(d,null,[u(m(P),{class:"c-dropdown",placement:t.placement,trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[u(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=v((()=>G("button")),["stop"]))},{default:c((()=>[y(g(t.btnText)+" ",1),u(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=v((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["placement","show","options"]),u(E,b(m(N),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:dt}),null,16,["modelValue","formatId","templateId"])],64))}});export{L as default};
1
+ import{defineComponent as t,useAttrs as e,inject as n,ref as i,reactive as r,computed as a,onMounted as o,watch as l,openBlock as s,createElementBlock as p,Fragment as d,createVNode as u,unref as m,withCtx as c,renderSlot as f,withModifiers as v,createTextVNode as y,toDisplayString as g,mergeProps as b}from"vue";import{isObject as I}from"@vue/shared";import{useMessage as h,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as x}from"../constants/index.js";import{Print as T}from"../utils/print.js";import{isIReport as S}from"../utils/browserPrint.js";import E from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as M,getPrivateFormatApi as O}from"../api.js";var L=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},resolution:{type:Number},printCustomProps:{type:Object,default:()=>({})},placement:{type:String}},setup(t,{expose:L}){var D;const R=t,C=e(),N=h();let V;const B=n(x),z={},A=i(""),J=r({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,iReportExecuteMode:1});let U=i([{label:R.printText,key:"printText"},{label:R.previewText,key:"previewText"},{label:R.pdfLoadText,key:"downloadPdf"},{label:R.formatEditText,key:"formatEditText"},...(null==(D=R.externalOptionConfig)?void 0:D.options)||[]]);const q=a((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=a((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=a((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(R.directPrint){if(J.spinning)return;return"button"===t?void await ut():st()}return st()},H=t=>u("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};B("success",t,n)},$=t=>{J.spinning=!1,B("error",t),I(t)&&"notInstalledApp"===t.type&&N.error(t.message)},Q=t=>{J.spinning=!1,B("cancel",t)},W=t=>{B("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=R.printParams)?void 0:e.length)?R.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...R.token?{token:R.token}:{},...R.printCustomProps||{}})},Z=()=>{var t,e;let n={},i={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{i[t]=[],J.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),i),JSON.stringify(n)},tt=((t,e,n=!0)=>{let i=null;return function(...r){i&&clearTimeout(i),n&&!i&&t.apply(null,r),i=setTimeout((()=>{i=null,!n&&t.apply(null,r)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("print",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t={iReportExecuteMode:J.iReportExecuteMode,formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:R.printdlgshow,signature:R.signature,copies:R.printCopies};if("MULTI"===R.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),V.printDirect({...t,params:X(n)},e,$,Q);else V.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,i;switch(t){case"printText":tt();break;case"previewText":(async()=>{R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("preview",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t="MULTI"===R.strategy?X():Z(),e={formatId:J.currentFormatId,iReportExecuteMode:J.iReportExecuteMode,templateId:_.value,authorizationKey:A.value,params:t,btnprint:R.btnprint,signature:R.signature};V.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("edit",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("download",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t="MULTI"===R.strategy?X():Z(),e={formatId:J.currentFormatId,iReportExecuteMode:J.iReportExecuteMode,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1",resolution:null==R?void 0:R.resolution},params:t,signature:R.signature};V.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const r=J.formatList.find((e=>e.id===t))||{};if(Object.keys(r).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==r?void 0:r.name)||e.label,await M({formatForms:[{...r}],name:z.name||r.templateName,number:z.number||r.number,templateId:z.templateId||r.templateId,...z.id?{id:z.id}:{}},{token:R.token})}else null==(i=null==(n=R.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},nt=()=>{J.visible=!1,B("clickoutside")},it=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),rt=(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=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&r&&(i[e[n]]=r)})),i},at=({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(rt(n,e,"fieldName"))}})),i=Object.assign({},i,rt(n,e,"key")),i})),ot=async t=>{var e,n;if(J.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):[],J.iReportExecuteMode=(null==(e=null==t?void 0:t.obj)?void 0:e.length)>0&&t.obj[0].iReportExecuteMode||1,J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!C.isDoc){const{data:e}=await O({templateId:t[0].templateId},{token:R.token});if("SUCCESS"===e.result){const{formatForms:i=[]}=e.map||{};Object.assign(z,e.map||{});const r=null==(n=null==i?void 0:i[0])?void 0:n.id;if(r&&t.map((t=>t.id)).includes(r))return r}}const i=t.find((t=>1==t[e]));return(null==i?void 0:i.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],N.error(R.noDefaultFormatMsg),it();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),R.hideButtons.length>0&&(U.value=U.value.filter((t=>!R.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")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),r.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let i=null==(n=await R.queryTemplateParams())?void 0:n.obj;if(!i||!_.value)return N.error("获取打印模板失败,请联系管理员!"),it();J.templateParams=i,J.printParams=at(J.templateParams,R.params)},lt=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(V)return!1;V=new T})();const e=await R.queryPrintFormatByNumber();return await ot(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await R.clickPrevFn())if((null==(e=R.params)?void 0:e.length)||(null==(n=R.printParams)?void 0:n.length)){if(!J.visible){if(!await lt())return!1}t&&(J.visible=!J.visible)}else N.warning(R.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=at(J.templateParams,R.params):J.watchPrintParamsReformatFn=()=>l((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},dt=t=>{if(J.identityVerification.visible=!1,S(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};V.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function ut(){await st(!1),tt()}return o((()=>{J.isInited=!1})),l((()=>R.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),L({directPrint:ut}),(e,n)=>(s(),p(d,null,[u(m(P),{class:"c-dropdown",placement:t.placement,trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[u(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=v((()=>G("button")),["stop"]))},{default:c((()=>[y(g(t.btnText)+" ",1),u(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=v((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["placement","show","options"]),u(E,b(m(C),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:dt}),null,16,["modelValue","formatId","templateId"])],64))}});export{L as default};
@@ -19,6 +19,7 @@ export declare class Print {
19
19
  private base64Fragment;
20
20
  private _successCallbackFn;
21
21
  private _errorCallbackFn;
22
+ private _cancelCallbackFn;
22
23
  constructor();
23
24
  private readonly messageHandlerQueue;
24
25
  private messageHandler;
@@ -35,7 +36,7 @@ export declare class Print {
35
36
  showPreview(...args: Parameters<PreviewDialog['show']>): Promise<string>;
36
37
  _testDomesticSystemConnection(): Promise<unknown>;
37
38
  _testConnection(): Promise<unknown>;
38
- resetPrinter(formatId: string): Promise<any>;
39
+ resetPrinter(formatId: string, iReportExecuteMode: number): Promise<any>;
39
40
  _queryServicesPrint(params: AnyObject): Promise<any>;
40
41
  _queryBase64ServicesPrint(params: AnyObject): Promise<any>;
41
42
  _callPrintWithFile(queryParams: AnyObject): Promise<any>;
@@ -64,10 +65,10 @@ export declare class Print {
64
65
  _queryPrintForPdf(templateId: string, formatId: string, params: string | undefined, authorizationKey: String): Promise<any>;
65
66
  _browserPrint(result: AnyObject, mode: string): Promise<string | void>;
66
67
  _base64ToBlob(fileBase64: string, fileType: string): Blob;
67
- preview({ ireportExecuteMode, templateId, formatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
68
+ preview({ iReportExecuteMode, templateId, formatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
68
69
  printSync(data: AnyObject[], successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<void>;
69
- printDirect({ ireportExecuteMode, templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<false | undefined>;
70
- printToHiPrint({ templateId, formatId, params, authorizationKey }: any, successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<any>;
70
+ printDirect({ iReportExecuteMode, templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<false | undefined>;
71
+ printToHiPrint({ templateId, formatId, params, authorizationKey }: any, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn): Promise<any>;
71
72
  private _downloadPDF;
72
73
  /**
73
74
  * 下载pdf
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const m=String(navigator.platform).toLowerCase().includes("linux"),p=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,u=`${d}/fdp-api/print/assembly/printIReport`,f=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,g=`${d}/bi-api/reprot/print/open/client/previewIReport`,w=`${d}/bi-api/reprot/print/open/client/getRemote`,y=`${d}/printService/file`;let P=null;class v{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this;const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void s({result:(null==i?void 0:i.res)?"success":"fail"});s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=h(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("hiprint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{p({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{p({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}resetPrinter(t){return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):p({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):p({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):p({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o=1,printdlgshow:l="0",nobillnode:h="1",btnprint:m="1",messageTimeout:p=0}){const d={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:m,copies:o,messageTimeout:p,...a?{signature:a}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await p({method:"get",url:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await p({method:"post",url:u,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await p({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await p({method:"post",url:g,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${y}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({ireportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:l,signature:c,btnprint:h,messageTimeout:p=0},d,u){const f=a(i);if(i=this.getIReportFormatId(f,i),f&&(m||2==t)){const t=await this._queryPrintForPdf(e,i,s,l);if(!t)return null==u?void 0:u("获取文件失败!");const r=n(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,r),null==d?void 0:d({file:t})}await this._queryProxyOrigin();const g=await this._testConnection();if(!this._handleResultTest(g,u))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),n=this._handleResult(t,u);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==d||d(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==u||u(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({ireportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p=1,isDownloadFile:d=!0,messageTimeout:u=0},f,g,w,y="printDirect"){const P=a(i);if(i=this.getIReportFormatId(P,i),P&&(m||2==t)){if(!await this._testDomesticSystemConnection())return void g({type:"notOpenedApp",result:"error",message:"请开启hiPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},f,g):g({type:"connectAppFail",result:"error",message:"连接hiPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},f,g))}await this._queryProxyOrigin();const v=await this._testConnection();if(!this._handleResultTest(v,g))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,messageTimeout:u}),n=this._handleResult(t,g,w);if(!n)return!1;d&&["downloadPDF"].includes(y)&&await this._browserPrint(n,y),null==f||f(n)}catch(t){const e="printDirect"===y?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==g||g(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:s},r,n){const a=await this._queryPrintForBase64(t,e,i,s);if(!a.success)return n({message:a.resultMsg});const{base64:o,formatId:l}=a.map;this.base64Fragment=o,this._successCallbackFn=r,this._errorCallbackFn=n,this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:l,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):p.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&(m||2==t.ireportExecuteMode)){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{isIReport as r,getFileUrl as n,useBrowserPrint as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),p=`${window.location.protocol}//${window.location.host}`,d=`${p}/fdp-api/print/assembly/printIReport`,g=`${p}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${p}/bi-api/reprot/print/open/client/previewIReport`,y=`${p}/bi-api/reprot/print/open/client/getRemote`,w=`${p}/printService/file`;let P=null;class v{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._cancelCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this;const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void s({result:(null==i?void 0:i.res)?"success":"fail"});s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=h(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="","cancel"==(null==t?void 0:t.result)?this._cancelCallbackFn&&this._cancelCallbackFn(t):this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("ihoPrint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}async resetPrinter(t,e){const i=r(t);if(t=this.getIReportFormatId(i,t),i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:t}}).then((({data:t})=>t.status?{type:"resetSuccess",result:"success",message:null==t?void 0:t.message}:{type:"resetError",result:"error",message:null==t?void 0:t.message})).catch((t=>({type:"resetError",result:"error",message:"重置打印机错误"}))):{type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:"error",errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件",result:"error"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({result:"error",type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o,printdlgshow:l="0",nobillnode:h="1",btnprint:u="1",messageTimeout:m=0}){const p={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:u,copies:o,messageTimeout:m,...a?{signature:a}:{}};if(s&&(p.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}p.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");p.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=p,await this._queryServicesPrint(p)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:y})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=p+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:d,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:g,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),r=s[s.length-2],o=s[s.length-1],l=await n(`${w}/${r}/${o}`),c=a(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:n,authorizationKey:l,signature:c,btnprint:h,messageTimeout:m=0},p,d){const g=r(i);if(i=this.getIReportFormatId(g,i),g&&(u||2==t)){const t=await this._queryPrintForPdf(e,i,s,l);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const r=a(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,r),null==p?void 0:p({result:"success",message:"",file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:n,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:m}),r=this._handleResult(t,d);if(!r)return!1;if(this.isRemote){const t=await this._browserPrint(r,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(r),null==p||p(r)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:"error",errinfo:t})}}catch(t){const e={error:t,result:"error",message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({iReportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:n,authorizationKey:a,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m,isDownloadFile:p=!0,messageTimeout:d=0},g,f,y,w="printDirect"){const P=r(i);if(i=this.getIReportFormatId(P,i),P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:a},g,f,y):f({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:a},g,f,y))}await this._queryProxyOrigin();const v=await this._testConnection();if(!this._handleResultTest(v,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:n,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m,messageTimeout:d}),r=this._handleResult(t,f,y);if(!r)return!1;p&&["downloadPDF"].includes(w)&&await this._browserPrint(r,w),null==g||g(r)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:s},r,n,a){const o=await this._queryPrintForBase64(t,e,i,s);if(!o.success)return n({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=r,this._errorCallbackFn=n,a&&(this._cancelCallbackFn=a),this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:c,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const n=r(t.formatId);if(t.formatId=this.getIReportFormatId(n,t.formatId),n&&(u||2==t.iReportExecuteMode)){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(a(e,"downloadPDF"),i({file:e,result:"success",message:""})):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(t,(async t=>{t||s({result:"error",message:""});const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v as Print};
@@ -1914,8 +1914,8 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1914
1914
  }>> & {
1915
1915
  onCancelModal?: ((...args: any[]) => any) | undefined;
1916
1916
  }, {
1917
- visible: boolean;
1918
1917
  id: string;
1918
+ visible: boolean;
1919
1919
  searchFieldList: unknown[];
1920
1920
  conditionList: unknown[];
1921
1921
  orgId: string;
@@ -1858,8 +1858,8 @@ declare const _default: import("vue").DefineComponent<{
1858
1858
  }>> & {
1859
1859
  onCancelModal?: ((...args: any[]) => any) | undefined;
1860
1860
  }, {
1861
- visible: boolean;
1862
1861
  id: string;
1862
+ visible: boolean;
1863
1863
  searchFieldList: unknown[];
1864
1864
  conditionList: unknown[];
1865
1865
  orgId: string;
@@ -1916,8 +1916,8 @@ declare const _default: import("vue").DefineComponent<{
1916
1916
  }>> & {
1917
1917
  onCancelModal?: ((...args: any[]) => any) | undefined;
1918
1918
  }, {
1919
- visible: boolean;
1920
1919
  id: string;
1920
+ visible: boolean;
1921
1921
  searchFieldList: unknown[];
1922
1922
  conditionList: unknown[];
1923
1923
  orgId: string;
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,C,P,R,A,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:W}=t(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:se}=$,re=new Set,ue=["xinmai","mai"],ae=new Map,ce=new Set,de=new Set,pe=new Set,fe=x(z.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(re.size&&E.value.remove(...re),re.clear(),ae.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ae.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ae)t.push(e[1]),e[0]===ue[0]&&e[1].forEach((e=>{(ae.get(ue[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ue[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...W(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),re.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),re.add(n)}))}E.value.add(...e)}re.add(l),E.value.add(l)}))}}function ge(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:C=!1}=j,R=[],I=[],X=[];let D=null;const W=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&xe(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const z=d(a)?L.find((e=>e.key===u.key)):e,F=be(W(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?be(W(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=z;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!F||!N||f(F[0],1)!==f(N[0],1))F&&D&&(F[0]=D),D=null;else{const e=F[0]-_/2;F[0]=e+_/4,N[0]=D=F[0]+_/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:W(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(F,u,z),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!xe(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,S,Y;if(t.noRise&&p.show){const i=M(p,t)?V(a,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&he.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(S=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(S)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+_/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(Y=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(Y))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:S,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:Y,top:(m?-q:0)-5}})}(F,u,z,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(F,u,z,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=ye(a,e.list[u].value),L=l&&ye(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:W(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||C)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:W(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:W(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w&&!ne[1]?n[1]-5:n[1],...V}));I.push(f),p&&(x===ue[1]?ce.add(p):W(s)||de.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=P(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),we(n,"change")}}))}(p),R.push(p),pe.add(p))}(F,N,u,j,z,K)})),"pulse"===a){const{key:t}=e;let i=null;ae.set(t,R.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-_/2;e.set("left",t+_/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+_/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const z=I.filter((e=>e));E.value.add(...z,...R,...X)}function ye(e,t){return"pain"===e&&0==t}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||C(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:P(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],A.show=!0}function xe(e){const[t]=F,i=j(F),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function be(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!xe(e.time))return;const n=T(e.time),o=V(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function je(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${C(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function we(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=fe.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ke()}function ke(){var e;pe.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...pe]))),pe.clear(),Le()}function Le(e){ae.clear(),pe.clear(),ce.clear(),he.clear(),de.clear(),fe.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||ge(e,i,t)}))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,z.overlap||{}),l=[];ce.size&&[...ce].forEach((e=>{[...de].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),l.push(o(r,{...i[e],...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-se.strokeWidth,height:ie-se.strokeWidth,fill:"transparent",...se});E.value.add(t)}(),Le((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...pe],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:R?R(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=je(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:C(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),we(r,"change")}else{const t={data:{time:C(e.pointer.x),value:P(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),we(t)}},setPopup:me,isAddPoint:je,updateData:we,redrawPoints:ke,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,C,P,R,A,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:W}=t(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:se}=$,re=new Set,ue=["xinmai","mai"],ae=new Map,ce=new Set,de=new Set,pe=new Set,fe=x(z.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(re.size&&E.value.remove(...re),re.clear(),ae.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ae.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ae)t.push(e[1]),e[0]===ue[0]&&e[1].forEach((e=>{(ae.get(ue[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ue[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...W(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),re.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),re.add(n)}))}E.value.add(...e)}re.add(l),E.value.add(l)}))}}function ge(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:C=!1}=j,R=[],I=[],X=[];let D=null;const W=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&xe(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const z=d(a)?L.find((e=>e.key===u.key)):e,F=be(W(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?be(W(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=z;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!F||!N||f(F[0],1)!==f(N[0],1))F&&D&&(F[0]=D),D=null;else{const e=F[0]-_/2;F[0]=e+_/4,N[0]=D=F[0]+_/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:W(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(F,u,z),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!xe(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,S,Y;if(t.noRise&&p.show){const i=M(p,t)?V(a,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&he.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(S=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(S)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+_/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(Y=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(Y))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:S,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:Y,top:(m?-q:0)-5}})}(F,u,z,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(F,u,z,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=ye(a,e.list[u].value),L=l&&ye(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:W(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||C)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:W(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:W(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w&&!ne[1]?n[1]-5:n[1],...V}));I.push(f),p&&(x===ue[1]?ce.add(p):W(s)||de.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=P(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),we(n,"change")}}))}(p),R.push(p),pe.add(p))}(F,N,u,j,z,K)})),"pulse"===a){const{key:t}=e;let i=null;ae.set(t,R.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-_/2;e.set("left",t+_/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+_/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const z=I.filter((e=>e));E.value.add(...z,...R,...X)}function ye(e,t){return"pain"===e&&0==t}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||C(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:P(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],A.show=!0}function xe(e){const[t]=F,i=j(F),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function be(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!xe(e.time))return;const n=T(e.time),o=V(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function je(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${C(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function we(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=fe.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ke()}function ke(){var e;pe.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...pe]))),pe.clear(),Le()}function Le(e){ae.clear(),pe.clear(),ce.clear(),he.clear(),de.clear(),fe.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||ge(e,i,t)})))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>e.show&&"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,z.overlap||{}),l=[];ce.size&&[...ce].forEach((e=>{[...de].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),l.push(o(r,{...i[e],...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-se.strokeWidth,height:ie-se.strokeWidth,fill:"transparent",...se});E.value.add(t)}(),Le((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...pe],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:R?R(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=je(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:C(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),we(r,"change")}else{const t={data:{time:C(e.pointer.x),value:P(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),we(t)}},setPopup:me,isAddPoint:je,updateData:we,redrawPoints:ke,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -1 +1 @@
1
- import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useRight as p}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,S,w,b,Y,D){const x=15,C=e({select:null,redrawPoints:null,clickMenu:null}),j=a((()=>{const{painSurplusCell:e=[0,0]}=S.data.grid||{};return~J.value?e:[0,0]})),V=a((()=>{var e,a;const t=(null==(a=null==(e=S.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===J.value?t[0]=t[0]+j.value[1]:J.value>0&&(t[2]=t[2]+j.value[0]),t})),H=a((()=>0===J.value?[j.value[0],V.value[1],V.value[2],V.value[3]]:J.value>0?[V.value[0],V.value[1],j.value[1],V.value[3]]:V.value)),X=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||x)||0})),L=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),P=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),M=a((()=>{var e,a,t;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),I=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||x)||0})),N=a((()=>{var e;const{bottom:a}=S.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+V.value[1]+V.value[3]})),O=a((()=>{const{grid:e}=S.data,a=J.value>0?j.value[1]:j.value[0];return e.mainYCell*e.subYCell+V.value[0]+V.value[2]+a})),R=a((()=>{var e;const{width:a,right:t=null,top:l}=S.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),W=a((()=>R.value-V.value[1]*G.value)),$=a((()=>{const{top:e,left:a}=S.data;return e.titleWidth+A.value})),q=a((()=>{const{bottom:e=null,height:a}=S.data;if(!e)return a;return a-(e.height||30)})),z=a((()=>{var e;const{top:a}=S.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return X.value+t+l+L.value+P.value+I.value})),G=a((()=>(R.value-$.value)/k.value)),T=a((()=>(q.value-z.value)/O.value)),A=a((()=>{var e,a;const{left:t}=S.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),B=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=$.value-G.value;const r=t.date.startDate||s(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(s(d(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=G.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+G.value/2,scaleCell:(l-t)/G.value}}))));return v(o)})),E=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),F=a((()=>{const{left:e}=S.data;return v(e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t}))))))})),J=a((()=>{var e,a;const{left:t}=S.data,l=t.yScaleValue.findIndex((e=>"pain"===e.type));return l>-1&&(null==(a=null==(e=t.yScaleValue[l].dataList)?void 0:e[0])?void 0:a.show)?l:-1})),K=a((()=>{const{grid:e}=S.data;return-1===J.value?0:T.value*e.subYCell})),Q=a((()=>{const{left:e}=S.data,a={originY:z.value+j.value[0]*T.value,endY:q.value-j.value[1]*T.value};return 0===J.value&&e.yScaleValue.length>1?a.endY=a.originY+K.value:J.value===e.yScaleValue.length-1&&(a.originY=a.endY-K.value),a})),U=a((()=>{const{left:e}=S.data,a={originY:z.value+V.value[0]*T.value,endY:q.value-V.value[2]*T.value};return 0===J.value&&e.yScaleValue.length>1?a.originY=Q.value.endY+V.value[0]*T.value:J.value===e.yScaleValue.length-1&&(a.endY=Q.value.originY-V.value[2]*T.value),a})),Z=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),_=a((()=>{var e;const{left:a,right:t}=S.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ee=e({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...u,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:L.value,operationDaysHeight:P.value,xScalevalueHeight:M.value,childbirthDaysHeight:I.value,topList:Z.value,breathingHeight:N.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:J.value,painHeight:K.value,painOriginY:Q.value,vitalSignsOriginY:U.value,gridXNumber:k.value,gridYNumber:O.value,iconsWidth:A.value,originX:$.value,originY:z.value,endX:R.value,endXLimit:W.value,endY:q.value,xCellWidth:G.value,yCellHeight:T.value,xScaleList:B.value,event:E.value,itemList:F.value,getRightInfo:_.value,config:S.data.config||{},surplusCell:V.value,painSurplusCell:j.value,mainSurplusCell:H.value}),{computedX:ae,computedY:te,getXValue:le,getYValue:ue}=i(ee);return t((()=>y.value),(e=>{e&&function(){c(y,ee);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=g(y,ee,w,ae,te,le,ue,S.addRenderItem,Y,D);C.redrawPoints=l,C.clickMenu=u;const{drawScaleValue:o}=h(y,ee,w,e,Y,ae,te,le,ue,a,t,i);p(y,ee,o),m(y,ee),f(y,ee,w,ae,te,r);const{select:v}=n(y,ee,w);C.select=v}()}),{immediate:!0}),{propItems:ee,...l(C)}}export{y as useTemperatureChart};
1
+ import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import{flatten as s}from"lodash-es";import{format as v,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useRight as p}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,S,w,b,Y,D){const x=15,C=e({select:null,redrawPoints:null,clickMenu:null}),j=a((()=>{const{painSurplusCell:e=[0,0]}=S.data.grid||{};return~J.value?e:[0,0]})),V=a((()=>{var e,a;const t=(null==(a=null==(e=S.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===J.value?t[0]=t[0]+j.value[1]:J.value>0&&(t[2]=t[2]+j.value[0]),t})),H=a((()=>0===J.value?[j.value[0],V.value[1],V.value[2],V.value[3]]:J.value>0?[V.value[0],V.value[1],j.value[1],V.value[3]]:V.value)),X=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||x)||0})),P=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),L=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),M=a((()=>{var e,a,t;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),I=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||x)||0})),N=a((()=>{var e;const{bottom:a}=S.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+V.value[1]+V.value[3]})),O=a((()=>{const{grid:e}=S.data,a=J.value>0?j.value[1]:j.value[0];return e.mainYCell*e.subYCell+V.value[0]+V.value[2]+a})),R=a((()=>{var e;const{width:a,right:t=null,top:l}=S.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),W=a((()=>R.value-V.value[1]*G.value)),$=a((()=>{const{top:e,left:a}=S.data;return e.titleWidth+A.value})),q=a((()=>{const{bottom:e=null,height:a}=S.data;if(!e)return a;return a-(e.height||30)})),z=a((()=>{var e;const{top:a}=S.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return X.value+t+l+P.value+L.value+I.value})),G=a((()=>(R.value-$.value)/k.value)),T=a((()=>(q.value-z.value)/O.value)),A=a((()=>{var e,a;const{left:t}=S.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),B=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=$.value-G.value;const r=t.date.startDate||v(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(v(d(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=G.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+G.value/2,scaleCell:(l-t)/G.value}}))));return s(o)})),E=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),F=a((()=>{const{left:e}=S.data;return s(e.yScaleValue.filter((e=>e.show)).map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t}))))))})),J=a((()=>{const{left:e}=S.data,a=e.yScaleValue.findIndex((e=>"pain"===e.type));return a>-1&&e.yScaleValue[a].show?a:-1})),K=a((()=>{const{grid:e}=S.data;return-1===J.value?0:T.value*e.subYCell})),Q=a((()=>{const{left:e}=S.data,a={originY:z.value+j.value[0]*T.value,endY:q.value-j.value[1]*T.value};return 0===J.value&&e.yScaleValue.length>1?a.endY=a.originY+K.value:J.value===e.yScaleValue.length-1&&(a.originY=a.endY-K.value),a})),U=a((()=>{const{left:e}=S.data,a={originY:z.value+V.value[0]*T.value,endY:q.value-V.value[2]*T.value};return 0===J.value&&e.yScaleValue.length>1?a.originY=Q.value.endY+V.value[0]*T.value:J.value===e.yScaleValue.length-1&&(a.endY=Q.value.originY-V.value[2]*T.value),a})),Z=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),_=a((()=>{var e;const{left:a,right:t}=S.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ee=e({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...u,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:P.value,operationDaysHeight:L.value,xScalevalueHeight:M.value,childbirthDaysHeight:I.value,topList:Z.value,breathingHeight:N.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:J.value,painHeight:K.value,painOriginY:Q.value,vitalSignsOriginY:U.value,gridXNumber:k.value,gridYNumber:O.value,iconsWidth:A.value,originX:$.value,originY:z.value,endX:R.value,endXLimit:W.value,endY:q.value,xCellWidth:G.value,yCellHeight:T.value,xScaleList:B.value,event:E.value,itemList:F.value,getRightInfo:_.value,config:S.data.config||{},surplusCell:V.value,painSurplusCell:j.value,mainSurplusCell:H.value}),{computedX:ae,computedY:te,getXValue:le,getYValue:ue}=i(ee);return t((()=>y.value),(e=>{e&&function(){c(y,ee);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=g(y,ee,w,ae,te,le,ue,S.addRenderItem,Y,D);C.redrawPoints=l,C.clickMenu=u;const{drawScaleValue:o}=h(y,ee,w,e,Y,ae,te,le,ue,a,t,i);p(y,ee,o),m(y,ee),f(y,ee,w,ae,te,r);const{select:s}=n(y,ee,w);C.select=s}()}),{immediate:!0}),{propItems:ee,...l(C)}}export{y as useTemperatureChart};