cnhis-design-vue 3.2.12-release.1 → 3.2.13-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -87
- package/es/components/ai-chat/index.d.ts +83 -0
- package/es/components/ai-chat/src/Index.vue.d.ts +84 -1
- package/es/components/ai-chat/src/Index.vue2.js +1 -1
- package/es/components/ai-chat/src/components/ChatCard.d.ts +6 -0
- package/es/components/ai-chat/src/components/ChatCard.js +1 -1
- package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +59 -0
- package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/ai-chat/src/components/ChatMain.js +1 -1
- package/es/components/ai-chat/src/components/ChatPatient.vue.d.ts +58 -0
- package/es/components/ai-chat/src/components/ChatPatient.vue.js +1 -0
- package/es/components/ai-chat/src/components/ChatPatient.vue2.js +1 -0
- package/es/components/ai-chat/src/types/index.d.ts +6 -3
- package/es/components/ai-chat/style/index.css +1 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/callback/src/components/render/popupMaps.d.ts +31 -0
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCommon.js +1 -1
- package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
- package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/iho-table/index.d.ts +31 -0
- package/es/components/iho-table/src/IhoTable.vue.d.ts +32 -0
- package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
- package/es/components/iho-table/src/plugins/crossHeaderPlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/crossHeaderPlugin.js +1 -0
- package/es/components/iho-table/src/plugins/headerPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue2.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/src/utils.d.ts +5 -5
- package/es/components/iho-table/src/plugins/verticalTablePlugin/src/utils.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +15 -0
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/template-render/index.d.ts +60 -0
- package/es/components/template-render/index.js +1 -0
- package/es/components/template-render/src/TemplateRender.vue.d.ts +62 -0
- package/es/components/template-render/src/TemplateRender.vue.js +1 -0
- package/es/components/template-render/src/TemplateRender.vue2.js +1 -0
- package/es/components/template-render/src/components/Box.vue.d.ts +44 -0
- package/es/components/template-render/src/components/Box.vue.js +1 -0
- package/es/components/template-render/src/components/Box.vue2.js +1 -0
- package/es/components/template-render/src/components/Button.vue.d.ts +50 -0
- package/es/components/template-render/src/components/Button.vue.js +1 -0
- package/es/components/template-render/src/components/Button.vue2.js +1 -0
- package/es/components/template-render/src/components/Divider.vue.d.ts +26 -0
- package/es/components/template-render/src/components/Divider.vue.js +1 -0
- package/es/components/template-render/src/components/Divider.vue2.js +1 -0
- package/es/components/template-render/src/components/Field.vue.d.ts +56 -0
- package/es/components/template-render/src/components/Field.vue.js +1 -0
- package/es/components/template-render/src/components/Field.vue2.js +1 -0
- package/es/components/template-render/src/components/FieldGroup.vue.d.ts +50 -0
- package/es/components/template-render/src/components/FieldGroup.vue.js +1 -0
- package/es/components/template-render/src/components/FieldGroup.vue2.js +1 -0
- package/es/components/template-render/src/components/Image.vue.d.ts +52 -0
- package/es/components/template-render/src/components/Image.vue.js +1 -0
- package/es/components/template-render/src/components/Image.vue2.js +1 -0
- package/es/components/template-render/src/components/Label.vue.d.ts +42 -0
- package/es/components/template-render/src/components/Label.vue.js +1 -0
- package/es/components/template-render/src/components/Label.vue2.js +1 -0
- package/es/components/template-render/src/components/Row.vue.d.ts +47 -0
- package/es/components/template-render/src/components/Row.vue.js +1 -0
- package/es/components/template-render/src/components/Row.vue2.js +1 -0
- package/es/components/template-render/src/components/Slot.d.ts +27 -0
- package/es/components/template-render/src/components/Slot.js +1 -0
- package/es/components/template-render/src/components/Text.vue.d.ts +40 -0
- package/es/components/template-render/src/components/Text.vue.js +1 -0
- package/es/components/template-render/src/components/Text.vue2.js +1 -0
- package/es/components/template-render/src/components/index.d.ts +530 -0
- package/es/components/template-render/src/components/index.js +1 -0
- package/es/components/template-render/src/constants/index.d.ts +16 -0
- package/es/components/template-render/src/constants/index.js +1 -0
- package/es/components/template-render/src/hooks/useCommon.d.ts +10 -0
- package/es/components/template-render/src/hooks/useCommon.js +1 -0
- package/es/components/template-render/src/utils/index.d.ts +6 -0
- package/es/components/template-render/src/utils/index.js +1 -0
- package/es/components/template-render/style/index.css +1 -0
- package/es/env.d.ts +25 -25
- package/es/shared/assets/img/ai__avatar.png.js +1 -1
- package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
- package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
- package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
- package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
- package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
- package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
- package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
- package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
- package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
- package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
- package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/logo.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- package/es/shared/utils/fabricjs/index.d.ts +0 -6823
- package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,inject as t,ref as n,computed as l,watch as o,nextTick as a,createVNode as s,createTextVNode as r,
|
1
|
+
import{defineComponent as e,inject as t,ref as n,computed as l,watch as o,nextTick as a,createVNode as s,createTextVNode as r,isVNode as u}from"vue";import{NAvatar as i,NSpin as c,NSpace as d,NButton as m}from"naive-ui";import{InjectionAIChatEmits as v,InjectionAIChat as p}from"../types/index.js";import f from"../../../../shared/assets/img/ai__avatar.png.js";import g from"../../../../shared/assets/img/logo.png.js";import{isArray as h,isFunction as b}from"lodash-es";import"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as y}from"../../../../shared/hooks/useScrollLoading.js";import x from"./ChatCard.js";function C(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!u(e)}var j=e({name:"ChatMain",inheritAttrs:!1,props:{},emits:[],setup(e,{attrs:u,slots:j,emit:k}){const T=t(v),{userAvatar:E,queryData:I,state:w,queryRecord:z,defaultShortcutList:S,hideInput:M=!1,isSmall:A}=t(p),D=n(null),q=n([]),H=n(!1),L=l((()=>A.value?g:f)),O={page:0,hasMore:!0};async function _(e=!1){if(!O.hasMore)return;O.page++,1==O.page&&(q.value=[]);const{records:t,rows:n}=await z.value({page:O.page});h(n)&&q.value.length<=+t&&(q.value=O.page>1?[...q.value,...n]:n,B(),q.value.length>=+t&&(e&&(H.value=!0),O.hasMore=!1,console.log("没有更多消息了")))}function B(){q.value.forEach((e=>{e.buttonType&&(e.disabled=!0),e.contents.forEach((e=>e.disabled=!0))}))}function P(e,t){const{contentType:n,content:l}=t;return"json"===n&&l?s(x,{instructionId:e.instructionId,msgItem:t,"onButton-click":(n={})=>function(e){const{item:t,msgItem:n}=e;if(n)return T("button-click",e),void q.value.forEach((e=>e.contents.forEach((e=>e.disabled=!0))));q.value.forEach((e=>e.buttonType&&(e.disabled=!0))),t.link||(w.sendContent="确定",w.sending=!0,w.loading=!0)}({item:e,msgItem:t,...n})},null):null}function R(e,t){const{contents:n=[],buttonType:l=""}=e,o=P(e,n[t]);if(o)return o;return[n[t].content.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,t,n)=>[e,t===n.length-1?null:s("br",null,null)]))]}function F({role:e=""}){return"user"===e}function G(){let e;return s("div",{class:"message-item"},[s(i,{round:!0,size:A.value?64:40,src:L.value},null),s("div",{class:"content-box"},[s("div",{class:"content fillet-10 default"},[s("h2",null,[r("Hi,我是你的AI助理")]),s("p",null,[r("我汇集了医生站/护士站各项智能服务,可以向我进行提问哦 ~ "),s("br",null,null),r("你的反馈助我成长,期待我们一起探索未来!下次可以在首页和应用页找到我~")]),h(S.value)&&S.value.length>0?[s("p",{style:"margin: 5px 0 5px"},[r("你可以试着问我:")]),s(d,{"wrap-item":!1},C(e=S.value.map((e=>s(m,{size:"large",secondary:!0,onClick:()=>w.sendContent=e,disabled:w.loading},C(e)?e:{default:()=>[e]}))))?e:{default:()=>[e]})]:null])])])}return y(D,(()=>{_()}),M.value?"bottom":"top"),_(!0),o((()=>w.externalData),(e=>{var t,n;e&&(t=e,q.value.unshift(t),null==(n=D.value)||n.scrollTo({top:0,behavior:"auto"}),B(),w.loading=!1,w.externalData=null)})),o((()=>w.sending),(async e=>{var t,n;if(e){q.value.unshift({contents:[{role:"user",content:w.sendContent}]}),null==(t=D.value)||t.scrollTo({top:0,behavior:"auto"}),B();const e=w.selectedCommand,l=w.selectedPrompt;w.selectedCommand=null;const o=await I.value({content:w.sendContent,contentType:"text",command:e,prompt:l});h(null==o?void 0:o.contents)&&(q.value.unshift(o),await a(),null==(n=D.value)||n.scrollTo({top:0,behavior:"auto"})),w.sending=!1,w.loading=!1,w.sendContent=""}})),()=>s("section",{class:"chat-main",ref:D,style:{"flex-direction":M.value?"column":"column-reverse"}},[[w.loading?s("div",{class:"message-item"},[[A.value?null:s(i,{round:!0,size:40,src:L.value},null),s("div",{class:"content-box"},[s("div",{class:"content loading"},[s(c,{size:22,stroke:"#4170EE"},null),s("span",null,[r("正在加载中,请稍等...")])])])]]):null,q.value.map((e=>e.contents.map(((t,n)=>s("div",{class:"message-item"},[[A.value?null:s(i,{round:!0,size:40,src:F(t)?E.value:L.value},null),s("div",{class:["content-box",F(t)?"mine":""]},[s("div",{class:"content"},[b(t.render)?t.render():R(e,n)])])]]))))),H.value?G():null]])}});export{j as default};
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { SelectOption } from 'naive-ui';
|
2
|
+
import { AnyObject } from '../../../../shared/types';
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
4
|
+
show: {
|
5
|
+
type: BooleanConstructor;
|
6
|
+
};
|
7
|
+
}, {
|
8
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
9
|
+
show: {
|
10
|
+
type: BooleanConstructor;
|
11
|
+
};
|
12
|
+
}>> & {
|
13
|
+
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
14
|
+
}>>;
|
15
|
+
emit: (event: "update:show", ...args: any[]) => void;
|
16
|
+
patientInfo: any;
|
17
|
+
state: any;
|
18
|
+
formValue: {
|
19
|
+
businessType: null;
|
20
|
+
vaa01: null;
|
21
|
+
vaa07: string;
|
22
|
+
};
|
23
|
+
rules: {
|
24
|
+
businessType: {
|
25
|
+
required: boolean;
|
26
|
+
trigger: string;
|
27
|
+
message: string;
|
28
|
+
};
|
29
|
+
vaa01: {
|
30
|
+
required: boolean;
|
31
|
+
trigger: string[];
|
32
|
+
message: string;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
options: import("vue").Ref<AnyObject[]>;
|
36
|
+
formRef: import("vue").Ref<any>;
|
37
|
+
renderLabel: (option: AnyObject) => string;
|
38
|
+
handleUpdateValue: (value: string, option: SelectOption) => void;
|
39
|
+
handleSearch: (keyword: string) => Promise<void>;
|
40
|
+
handleValidateClick: (e: MouseEvent) => void;
|
41
|
+
NDrawer: any;
|
42
|
+
NDrawerContent: any;
|
43
|
+
NForm: any;
|
44
|
+
NFormItem: any;
|
45
|
+
NButton: any;
|
46
|
+
NRadioGroup: any;
|
47
|
+
NRadio: any;
|
48
|
+
NSelect: any;
|
49
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:show"[], "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
50
|
+
show: {
|
51
|
+
type: BooleanConstructor;
|
52
|
+
};
|
53
|
+
}>> & {
|
54
|
+
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
55
|
+
}, {
|
56
|
+
show: boolean;
|
57
|
+
}>;
|
58
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
import t from"./ChatPatient.vue2.js";import e from"../../../../_virtual/_plugin-vue_export-helper.js";var r=e(t,[["__file","ChatPatient.vue"]]);export{r as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{defineComponent as e,inject as a,reactive as t,ref as l,openBlock as u,createBlock as n,unref as o,withCtx as r,createVNode as i,createTextVNode as s,toDisplayString as v}from"vue";import{NDrawer as d,NDrawerContent as f,NForm as p,NFormItem as c,NRadioGroup as m,NRadio as h,NSelect as b,NButton as y}from"naive-ui";import{isFunction as _,isArray as g}from"lodash-es";import{InjectionAIChat as w}from"../types/index.js";var k=e({__name:"ChatPatient",props:{show:{type:Boolean}},emits:["update:show"],setup(e,{emit:k}){const{patientInfo:q,state:T}=a(w),C=t({businessType:null,vaa01:null,vaa07:""}),I={businessType:{required:!0,trigger:"change",message:"请选择类型"},vaa01:{required:!0,trigger:["blur","change"],message:"请选择患者"}},P=l([]),$=l();function x(e){const{bcq04b:a,vaa05:t,vae96:l,vae87:u,bck02a:n}=e;return`${a}床/${t}/${1==l?"男":2==l?"女":"未知"}/${u}/${n}`}function A(e,a){C.vaa07=a.vaa07}async function L(e){var a;if(_(null==(a=q.value)?void 0:a.queryPatient))try{const a=await q.value.queryPatient(e);if(g(a))return void(P.value=a);P.value=[]}catch(e){P.value=[]}}function N(e){var a;e.preventDefault(),null==(a=$.value)||a.validate((e=>{e||(T.selectedPatient={...C,...P.value.find((e=>e.vaa01===C.vaa01))},k("update:show",!1))}))}return L(""),(a,t)=>(u(),n(o(d),{placement:"bottom",height:"300","trap-focus":!1,to:"#"+o(T).id,show:e.show,onMaskClick:t[2]||(t[2]=()=>k("update:show",!1))},{default:r((()=>[i(o(f),null,{default:r((()=>[i(o(p),{ref_key:"formRef",ref:$,"label-placement":"left","label-width":"auto",size:"large",model:C,"require-mark-placement":"right-hanging",rules:I},{default:r((()=>[i(o(c),{label:"业务",path:"businessType"},{default:r((()=>[i(o(m),{value:C.businessType,"onUpdate:value":t[0]||(t[0]=e=>C.businessType=e),name:"业务"},{default:r((()=>[i(o(h),{value:"CLINICIAN"},{default:r((()=>[s("门诊")])),_:1}),i(o(h),{value:"HOSPITAL"},{default:r((()=>[s("住院")])),_:1})])),_:1},8,["value"])])),_:1}),i(o(c),{label:"患者",path:"vaa01"},{default:r((()=>[i(o(b),{remote:"",value:C.vaa01,"onUpdate:value":[t[1]||(t[1]=e=>C.vaa01=e),A],placeholder:"请选择患者",filterable:"",options:P.value,"render-label":x,"value-field":"vaa01",onSearch:L},null,8,["value","options"])])),_:1}),i(o(c),{label:"科室"},{default:r((()=>[s(v(C.vaa07),1)])),_:1}),i(o(c),null,{default:r((()=>[i(o(y),{block:"",type:"primary",onClick:N},{default:r((()=>[s("确定")])),_:1})])),_:1})])),_:1},8,["model"])])),_:1})])),_:1},8,["to","show"]))}});export{k as default};
|
@@ -4,7 +4,8 @@ export declare const InjectionAIChat: InjectionKey<AnyObject>;
|
|
4
4
|
export declare const InjectionAIChatEmits: InjectionKey<(event: string, ...args: any[]) => void>;
|
5
5
|
export type MessageItem = {
|
6
6
|
role: string;
|
7
|
-
|
7
|
+
contentType: 'json' | 'text';
|
8
|
+
content: AnyObject | string;
|
8
9
|
render?: () => VNodeChild;
|
9
10
|
[key: string]: any;
|
10
11
|
};
|
@@ -16,11 +17,13 @@ export type MessageList = Array<{
|
|
16
17
|
export type QueryData = (props: {
|
17
18
|
content: string;
|
18
19
|
contentType: string;
|
19
|
-
|
20
|
+
command: any;
|
21
|
+
prompt: any;
|
22
|
+
}) => Promise<{
|
20
23
|
contents: MessageItem[];
|
21
24
|
buttonType?: string;
|
22
25
|
[key: string]: any;
|
23
|
-
}
|
26
|
+
}>;
|
24
27
|
export type QueryRecord = (props: {
|
25
28
|
page: number;
|
26
29
|
}) => Promise<{
|
@@ -1 +1 @@
|
|
1
|
-
.c-recording-wrapper{align-items:center;background-color:#fff;border-radius:10px;bottom:100px;display:flex;height:350px;justify-content:center;left:calc(50% - 250px);position:fixed;width:500px}@keyframes toScale{0%{transform:translateX(-50%) translateY(-50%) scale(1)}to{transform:translateX(-50%) translateY(-50%) scale(1.5)}}.c-recording-wrapper .content{font-size:18px;position:absolute;text-align:center;top:20px}.c-recording-wrapper .animation{animation:toScale 1s infinite;background-color:#5585f54d;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%) scale(1);z-index:-1}.c-recording-wrapper .animation,.c-recording-wrapper .icon-box{align-items:center;border-radius:50%;display:flex;height:90px;justify-content:center;width:90px}.c-recording-wrapper .icon-box{background-color:#5585f5;cursor:pointer}.c-recording-wrapper .tip{bottom:20px;position:absolute}.ai-chat{background:linear-gradient(135deg,#c9dbfb,#c9dbfb 20%,rgba(237,237,253,.5) 70%,rgba(151,97,251,.2));display:flex;flex-flow:column nowrap;font-size:14px;height:100%;padding:45px 0 60px;position:relative;width:100%}.ai-chat,.ai-chat *{box-sizing:border-box}.ai-chat .fillet-10{border-radius:10px}.ai-chat .fillet-8{border-radius:8px}.ai-chat .n-avatar{background-color:var(--c-primary-color)}.ai-chat .gradient{background:linear-gradient(178deg,#8f66f7,#4170ee);color:#fff}.ai-chat .gradient:active,.ai-chat .gradient:focus,.ai-chat .gradient:hover{color:#fff}.ai-chat .chat-main{display:flex;flex:1;flex-flow:column-reverse nowrap;overflow-y:auto;padding:0 130px 0 82px;row-gap:16px}.ai-chat .chat-main::-webkit-scrollbar{width:5px}.ai-chat .chat-main::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-main::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .chat-main .message-item{column-gap:8px;display:flex;flex-flow:row nowrap}.ai-chat .chat-main .message-item:first-child{margin-bottom:auto}.ai-chat .chat-main .message-item .n-avatar{flex-shrink:0}.ai-chat .chat-main .message-item .content-box .content{background:#fff;border-radius:10px;flex:unset;padding:10px 12px}.ai-chat .chat-main .message-item .content-box .content .card{width:236px}.ai-chat .chat-main .message-item .content-box .content .card>p{font-size:14px;line-height:19px}.ai-chat .chat-main .message-item .content-box .content .card .link-btn{display:flex;flex-flow:row wrap;font-size:14px;justify-content:space-between;margin-top:10px;width:100%}.ai-chat .chat-main .message-item .content-box .content .card .link-btn .n-button__content{display:unset;flex:1;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ai-chat .chat-main .message-item .content-box .content .card .card-body{border:1px solid #d5d5d5;border-radius:8px;margin-top:5px;overflow:hidden}.ai-chat .chat-main .message-item .content-box .content .card .card-body__head{background:rgba(65,112,238,.14);line-height:36px;padding:0 15px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content{padding:10px 6px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div{display:flex;font-size:12px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div .label{flex:0 0 60px;text-align:right}.ai-chat .chat-main .message-item .content-box .content .card .patient-info{border-top:1px solid #e5e5e5;margin-top:5px}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item{margin:5px 0 0 5px}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item:last-child{margin-bottom:0}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item p:first-child{font-weight:700}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item p:last-child{color:#888}.ai-chat .chat-main .message-item .content-box .content.default h2{font-size:22px;font-weight:500;margin:10px 0}.ai-chat .chat-main .message-item .content-box .content.loading{align-items:center;color:#999;column-gap:10px;display:flex}.ai-chat .chat-main .message-item .content-box.mine .content{background:hsla(0,0%,100%,.48);border-radius:8px}.ai-chat .chat-footer{padding:30px 130px 0}.ai-chat .chat-footer.disabled{cursor:not-allowed}.ai-chat .chat-footer .menu-box{background:#fff;column-gap:8px;display:flex;margin-bottom:8px;overflow-x:auto;padding:10px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{width:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{height:5px}.ai-chat .chat-footer .input-wrapper{background:#fff;box-shadow:0 3px 4px 0 rgba(0,0,0,.1);padding:15px 20px}.ai-chat .chat-footer .input-wrapper .n-input__border,.ai-chat .chat-footer .input-wrapper .n-input__state-border{border:none}.ai-chat .chat-footer .input-wrapper .n-input:not(.n-input--disabled).n-input--focus .n-input__state-border{box-shadow:unset}.ai-chat .chat-footer .input-wrapper .btn-box{display:flex;justify-content:flex-end}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send{align-items:center;cursor:pointer;display:flex;height:46px;justify-content:center;width:58px}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send.disabled{cursor:not-allowed;opacity:.5}.ai-chat .chat-footer .command-box{display:flex;flex-flow:column nowrap;height:100%}.ai-chat .chat-footer .command-box__header{display:flex}.ai-chat .chat-footer .command-box__header .title{color:#999}.ai-chat .chat-footer .command-box__menu{flex:1;overflow-y:auto}.ai-chat .chat-footer .command-box__menu .menu-item{align-items:center;display:flex;padding:8px 0 8px 5px}.ai-chat .chat-footer .command-box__menu .menu-item .remark{color:#999;flex:1;font-size:12px;margin-left:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-chat .chat-footer .command-box__menu .menu-item .n-icon{margin-left:auto}.ai-chat .chat-footer .command-box__menu .menu-item:hover{background:#e5e5e5;border-radius:5px}.ai-chat .chat-footer .command-box__menu .menu-item.selectable{position:relative}.ai-chat .chat-footer .command-box__menu .menu-item.selectable .label{color:var(--c-primary-color);margin-left:30px}.ai-chat .chat-footer .command-box__menu .menu-item.selectable:before{background:#d5d5d5;border-radius:5px;content:"/";height:20px;left:5px;line-height:20px;position:absolute;text-align:center;top:10px;width:20px}.ai-chat--small{padding:20px 0 44px}.ai-chat--small .chat-main{padding:0 20px 10px}.ai-chat--small .chat-main .message-item{display:unset}.ai-chat--small .chat-main .message-item .n-avatar{background:transparent}.ai-chat--small .chat-main .message-item .content-box{display:flex;flex-flow:row nowrap}.ai-chat--small .chat-main .message-item .content-box .content{border-radius:3px 14px 14px;max-width:calc(100% - 55px)}.ai-chat--small .chat-main .message-item .content-box .content.default{border-radius:4px 16px 16px}.ai-chat--small .chat-main .message-item .content-box.mine{flex-flow:row-reverse nowrap}.ai-chat--small .chat-main .message-item .content-box.mine .content{background:#5874dc;border-radius:14px 0 14px 14px;color:#fff}.ai-chat--small .chat-footer{padding:10px 20px 0}.ai-chat--small .chat-footer .menu-box{background:none;padding:0}.ai-chat--small .chat-footer .menu-box .n-button{background:#fff}.ai-chat--small .chat-footer .input-wrapper{border-radius:24px;box-shadow:0 0 6px 0 hsla(240,9%,85%,.74);padding:0}.ai-chat .prompt-wrapper{background:linear-gradient(135deg,#ecf3ff,#ecf3ff 20%,rgba(237,237,253,.5) 70%,rgba(203,175,255,.3))}.ai-chat .prompt-wrapper .n-drawer-header{padding:15px}.ai-chat .prompt-wrapper .n-drawer-header__main{width:100%}.ai-chat .prompt-wrapper .n-drawer-header__main .title{display:flex;font-size:14px}.ai-chat .prompt-wrapper .n-drawer-header__main .title .n-button{margin-left:auto}.ai-chat .prompt-wrapper .n-drawer-header__main .n-input{margin-top:10px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper{padding:0 10px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper{align-content:flex-start;display:flex;flex-wrap:wrap;height:100%;overflow-y:auto}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper::-webkit-scrollbar{width:5px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper .item{background:#fff;border-radius:10px;box-sizing:border-box;break-inside:avoid;cursor:pointer;margin:5px;padding:10px;width:calc(50% - 10px)}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper .item:hover{background-image:linear-gradient(#ecf3ff,#fff 40%,#fff)}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper .item p:last-child{color:#999;font-size:12px}
|
1
|
+
.c-recording-wrapper{align-items:center;background-color:#fff;border-radius:10px;bottom:100px;display:flex;height:350px;justify-content:center;left:calc(50% - 250px);position:fixed;width:500px}@keyframes toScale{0%{transform:translateX(-50%) translateY(-50%) scale(1)}to{transform:translateX(-50%) translateY(-50%) scale(1.5)}}.c-recording-wrapper .content{font-size:18px;position:absolute;text-align:center;top:20px}.c-recording-wrapper .animation{animation:toScale 1s infinite;background-color:#5585f54d;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%) scale(1);z-index:-1}.c-recording-wrapper .animation,.c-recording-wrapper .icon-box{align-items:center;border-radius:50%;display:flex;height:90px;justify-content:center;width:90px}.c-recording-wrapper .icon-box{background-color:#5585f5;cursor:pointer}.c-recording-wrapper .tip{bottom:20px;position:absolute}.c-template-render{box-sizing:border-box;color:#000;font-size:0;line-height:1.6}.c-template-render__flex{display:flex}.c-template-render__flexAlignCenter{align-items:center}.c-template-render__flex-wrap{flex-wrap:wrap}.c-template-render__flex1{flex:1}.c-template-render__width100{width:100%}.c-template-render__color60{color:rgba(0,0,0,.6)}.c-template-render__color100{color:#000}.c-template-render__text-ellipsis{-webkit-box-orient:vertical;-webkit-line-clamp:1;display:-webkit-box!important;overflow:hidden;overflow-wrap:break-word;text-overflow:ellipsis;word-break:break-all}.c-template-render__nowrap{white-space:nowrap}.c-template-render__mgr8{margin-right:8px!important}.c-template-render__mgb8{margin-bottom:8px!important}.c-template-render__mgt4{margin-top:4px!important}.c-template-render__mgb4{margin-bottom:4px!important}.c-template-render__un-mgr8{margin-right:-8px!important}.c-template-render__bar{padding-left:8px;position:relative}.c-template-render__bar:before{background:var(--c-primary-color);border-radius:4px;content:"";height:12px;left:0;position:absolute;top:50%;transform:translateY(-50%);width:4px}.c-template-render__inline{display:inline}.ai-chat{background:linear-gradient(135deg,#c9dbfb,#c9dbfb 20%,rgba(237,237,253,.5) 70%,rgba(151,97,251,.2));display:flex;flex-flow:column nowrap;font-size:14px;height:100%;padding:45px 0 60px;position:relative;width:100%}.ai-chat,.ai-chat *{box-sizing:border-box}.ai-chat .fillet-10{border-radius:10px}.ai-chat .fillet-8{border-radius:8px}.ai-chat .n-avatar{background-color:var(--c-primary-color)}.ai-chat .gradient{background:linear-gradient(178deg,#8f66f7,#4170ee);color:#fff}.ai-chat .gradient:active,.ai-chat .gradient:focus,.ai-chat .gradient:hover{color:#fff}.ai-chat .chat-main{display:flex;flex:1;flex-flow:column-reverse nowrap;overflow-y:auto;padding:0 130px 0 82px;row-gap:16px}.ai-chat .chat-main::-webkit-scrollbar{width:5px}.ai-chat .chat-main::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-main::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .chat-main .message-item{column-gap:8px;display:flex;flex-flow:row nowrap}.ai-chat .chat-main .message-item:first-child{margin-bottom:auto}.ai-chat .chat-main .message-item .n-avatar{flex-shrink:0}.ai-chat .chat-main .message-item .content-box .content{background:#fff;border-radius:10px;flex:unset;padding:10px 12px}.ai-chat .chat-main .message-item .content-box .content .card{width:236px}.ai-chat .chat-main .message-item .content-box .content .card>p{font-size:14px;line-height:19px}.ai-chat .chat-main .message-item .content-box .content .card .link-btn{display:flex;flex-flow:row wrap;font-size:14px;justify-content:space-between;margin-top:10px;width:100%}.ai-chat .chat-main .message-item .content-box .content .card .link-btn .n-button__content{display:unset;flex:1;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ai-chat .chat-main .message-item .content-box .content .card .card-body{border:1px solid #d5d5d5;border-radius:8px;margin-top:5px;overflow:hidden}.ai-chat .chat-main .message-item .content-box .content .card .card-body__head{background:rgba(65,112,238,.14);line-height:36px;padding:0 15px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content{padding:10px 6px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div{display:flex;font-size:12px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div .label{flex:0 0 60px;text-align:right}.ai-chat .chat-main .message-item .content-box .content .card .patient-info{border-top:1px solid #e5e5e5;margin-top:5px}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item{margin:5px 0 0 5px}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item:last-child{margin-bottom:0}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item p:first-child{font-weight:700}.ai-chat .chat-main .message-item .content-box .content .card .patient-info .patient-item p:last-child{color:#888}.ai-chat .chat-main .message-item .content-box .content .card .n-form{margin-top:10px}.ai-chat .chat-main .message-item .content-box .content .card .n-form .form-render__formItemLabel{color:#888}.ai-chat .chat-main .message-item .content-box .content.default h2{font-size:22px;font-weight:500;margin:10px 0}.ai-chat .chat-main .message-item .content-box .content.loading{align-items:center;color:#999;column-gap:10px;display:flex}.ai-chat .chat-main .message-item .content-box.mine .content{background:hsla(0,0%,100%,.48);border-radius:8px}.ai-chat .chat-footer{padding:30px 130px 0}.ai-chat .chat-footer.disabled{cursor:not-allowed}.ai-chat .chat-footer .menu-box{background:#fff;column-gap:8px;display:flex;margin-bottom:8px;overflow-x:auto;padding:10px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{width:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{height:5px}.ai-chat .chat-footer .input-wrapper{background:#fff;box-shadow:0 3px 4px 0 rgba(0,0,0,.1);padding:15px 20px}.ai-chat .chat-footer .input-wrapper .n-input__border,.ai-chat .chat-footer .input-wrapper .n-input__state-border{border:none}.ai-chat .chat-footer .input-wrapper .n-input:not(.n-input--disabled).n-input--focus .n-input__state-border{box-shadow:unset}.ai-chat .chat-footer .input-wrapper .btn-box{display:flex;justify-content:flex-end}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send{align-items:center;cursor:pointer;display:flex;height:46px;justify-content:center;width:58px}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send.disabled{cursor:not-allowed;opacity:.5}.ai-chat .chat-footer .command-box{display:flex;flex-flow:column nowrap;height:100%}.ai-chat .chat-footer .command-box__header{display:flex}.ai-chat .chat-footer .command-box__header .title{color:#999}.ai-chat .chat-footer .command-box__menu{flex:1;overflow-y:auto}.ai-chat .chat-footer .command-box__menu .menu-item{align-items:center;display:flex;padding:8px 0 8px 5px}.ai-chat .chat-footer .command-box__menu .menu-item .remark{color:#999;flex:1;font-size:12px;margin-left:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-chat .chat-footer .command-box__menu .menu-item .n-icon{margin-left:auto}.ai-chat .chat-footer .command-box__menu .menu-item:hover{cursor:default}.ai-chat .chat-footer .command-box__menu .menu-item.selected{background:#f2f2f2;border-radius:5px}.ai-chat .chat-footer .command-box__menu .menu-item.selectable{position:relative}.ai-chat .chat-footer .command-box__menu .menu-item.selectable .label{color:var(--c-primary-color);margin-left:30px}.ai-chat .chat-footer .command-box__menu .menu-item.selectable:before{background:#e5e5e5;border-radius:5px;content:"/";height:20px;left:5px;line-height:20px;position:absolute;text-align:center;top:10px;width:20px}.ai-chat--small{padding:20px 0 44px}.ai-chat--small .chat-main{padding:0 20px 10px}.ai-chat--small .chat-main .message-item{display:unset}.ai-chat--small .chat-main .message-item .n-avatar{background:transparent}.ai-chat--small .chat-main .message-item .content-box{display:flex;flex-flow:row nowrap}.ai-chat--small .chat-main .message-item .content-box .content{border-radius:3px 14px 14px;max-width:calc(100% - 55px)}.ai-chat--small .chat-main .message-item .content-box .content.default{border-radius:4px 16px 16px}.ai-chat--small .chat-main .message-item .content-box.mine{flex-flow:row-reverse nowrap}.ai-chat--small .chat-main .message-item .content-box.mine .content{background:#5874dc;border-radius:14px 0 14px 14px;color:#fff}.ai-chat--small .chat-footer{padding:10px 20px 0}.ai-chat--small .chat-footer .menu-box{background:none;padding:0}.ai-chat--small .chat-footer .menu-box .n-button{background:#fff}.ai-chat--small .chat-footer .input-wrapper{border-radius:24px;box-shadow:0 0 6px 0 hsla(240,9%,85%,.74);padding:0}.ai-chat .prompt-wrapper{background:linear-gradient(135deg,#ecf3ff,#ecf3ff 20%,rgba(237,237,253,.5) 70%,rgba(203,175,255,.3))}.ai-chat .prompt-wrapper .n-drawer-header{padding:15px}.ai-chat .prompt-wrapper .n-drawer-header__main{width:100%}.ai-chat .prompt-wrapper .n-drawer-header__main .title{display:flex;font-size:14px}.ai-chat .prompt-wrapper .n-drawer-header__main .title .n-button{margin-left:auto}.ai-chat .prompt-wrapper .n-drawer-header__main .n-input{margin-top:10px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper{padding:0 10px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper{align-content:flex-start;display:flex;flex-wrap:wrap;height:100%;overflow-y:auto}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper::-webkit-scrollbar{width:5px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper .item{background:#fff;border-radius:10px;box-sizing:border-box;break-inside:avoid;cursor:pointer;margin:5px;padding:10px;width:calc(50% - 10px)}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper .item:hover{background-image:linear-gradient(#ecf3ff,#fff 40%,#fff)}.ai-chat .prompt-wrapper .n-drawer-body-content-wrapper .list-wrapper .item p:last-child{color:#999;font-size:12px}
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,inject as t,ref as n,reactive as i,computed as r,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 U}from"../utils/print.js";import{isIReport as z}from"../utils/browserPrint.js";import A from"./IdentityVerification.vue.js";import{format as K}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 G={class:"newprint-button-outer"},q={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"},ie={class:"newprint-button-poperOver"},re={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:{}})},svrUpdateIp:{type:String}},setup(e,{expose:ve}){const fe=e,ye=String(navigator.platform).toLowerCase().includes("linux"),ge=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],he=C();let ke;const be=t(J),Pe=n(""),we=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],iReportExecuteMode:1}),Se=n({});let Ie=n([]),Oe=n([{label:fe.previewText,key:"previewText"},{label:fe.pdfLoadText,key:"downloadPdf"},{label:fe.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Ce=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),Le=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),Te=n([]),je=n([]),Me=r((()=>{if(!we.currentFormatId)return{};let e=we.currentFormatId;return we.formatList.find((t=>t.id===e))}));r((()=>{var e;return(null==(e=Me.value)?void 0:e.name)||"格式选择"}));const xe=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.templateId})),Ee=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.number})),Fe=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowPrintAll})),Ne=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowOutSetting})),_e=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.customProps)||{}})),De=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.defaultFormatId)||""})),Re=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.printAllType)||1})),Je=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.shortcut)||{}})),Ue=r((()=>{var e,t;const n=Object.keys(Je.value);if(n.length>0){if(De.value&&n.includes(De.value))return(null==(e=Je.value[De.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=Je.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=r((()=>{const e=ge.map((e=>e.key));return Ie.value.filter((t=>!e.includes(t.key)))})),Ae=r({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ke=async()=>{var e,t;(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await yt(),Le.oneShow=!0},Ve=async e=>{if(fe.directPrint){if(we.spinning)return;return"button"===e?void(Fe.value?await kt():De.value?async function(e){await yt(!1);const t=Te.value.find((t=>t.key==e));t&&it(t.templateCode,t.templateId,t.key,!1)}(De.value):Ke()):Ke()}return Ke()},Be=(e,t)=>we.printParams[t.templateCode]?z(t.key)&&(ye||2==we.iReportExecuteMode)?e.filter((e=>"formatEditText"!=e.key)):e:[],Ge=(e,t)=>{Ce[e]=t},qe=()=>{Te.value=Ie.value.filter((e=>!e.selected)),je.value=ze.value.filter((e=>e.selected)),He("oneShow"),He("isOutSetting"),be("saveOuterPrint",je.value)},Ye=e=>{Le[e]=!0},He=e=>{Ce.oneClickType="",Le[e]=!1,"isOutSetting"==e&&(Le.isOutSetting=!1)},$e=(e,t)=>{tt(!1);let n={type:t,formatId:we.currentFormatId,templateId:(null==e?void 0:e.templateId)||xe.value,templateCode:(null==e?void 0:e.templateCode)||Ee.value};V({type:"进入成功的回调",info:n},"PRINT-SDK"),be("success",e,n)},Qe=e=>{tt(!1),V({type:"进入失败的回调",res:e},"PRINT-SDK"),be("error",e),O(e)&&"notInstalledApp"===e.type&&he.error(e.message)},We=e=>{tt(!1),be("cancel",e)},Xe=e=>{be("error",{message:"前置条件执行错误",type:e,preExecution:!0})},Ze=()=>JSON.stringify({...fe.token?{token:fe.token}:{}}),et=(e=[],t)=>{var n,i;let r={},a={};if((null==(n=we.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(i=Object.keys(e[0].datasetData||{}))?void 0:i[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 r=Object.assign({},JSON.parse(Ze()),_e.value,a),JSON.stringify(r)},tt=(e,t)=>{if(we.isClickOuterPrint){if(e&&t){const n=je.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}je.value.forEach((e=>{e.isLoading=!1}))}else we.spinning=e},nt=()=>we.isClickOuterPrint?je.value.some((e=>e.isLoading)):we.spinning,it=(e,t,n,i)=>{const r=we.printParams[e];if(!r)return;we.isClickOuterPrint=i,we.currentFormatId=n;const a=we.originParams[e]||[];rt(r,e,t,n,a)},rt=async(e=[],t,n,i,r=[],a)=>{let l=e.length;const o=async e=>{try{--l<=0&&$e(e,"print")}catch(e){console.log("error",e)}};fe.showLoading&&nt()&&!a||(tt(!0,i),fe.prevFn("print",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const a={formatId:i,iReportExecuteMode:we.iReportExecuteMode,templateId:n,authorizationKey:Pe.value,printdlgshow:fe.printdlgshow,signature:fe.signature,copies:fe.printCopies,svrUpdateIp:fe.svrUpdateIp};if("MULTI"===fe.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[t]));ke.printDirect({...a,params:n},o,Qe,We)}else ke.printDirect({...a,params:et(e,t)},(e=>{e.params=r,e.templateCode=t,e.templateId=n,$e(e,"print")}),Qe,We)})).catch((()=>{Xe("print"),tt(!1)})).finally((()=>{we.visible=!1})))},at=async(e,{templateCode:t,templateId:n,key:i},r)=>{const a=we.printParams[t];if(a)switch(we.isClickOuterPrint=r,we.currentFormatId=i,e){case"previewText":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("preview",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,params:a,btnprint:fe.btnprint,signature:fe.signature};ke.preview(l,(e=>{$e(e,"preview")}),Qe)})).catch((()=>{Xe("preview"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"formatEditText":((e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("edit",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e,we.currentFormatId=i,we.identityVerification.visible=!0})).catch((()=>{Xe("edit")})).finally((()=>{tt(!1)})))})(a,0,n,i);break;case"downloadPdf":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("download",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,print:{print:"1",type:"1",resolution:null==fe?void 0:fe.resolution},params:a,signature:fe.signature};ke.downloadPDF(l,(e=>$e(e,"preview")),Qe)})).catch((()=>{Xe("download"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"resetPrinter":(async(e=[],t,n,i)=>{if(!fe.showLoading||!nt()){tt(!0,i);try{const e=await ke.resetPrinter(i,we.iReportExecuteMode);if(tt(!1),"success"==(null==e?void 0:e.result))return void he.success(e.message||"重置打印机成功");he.warning("重置打印机失败")}catch(e){tt(!1),he.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,i)}},lt=()=>{},ot=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},dt(n,t,e))})),n},st=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},pt(n,t,e))})),n},ut=(e,t,n)=>{const i={};return t.forEach((t=>{let r=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(i=K(t,n[e.type])),(null==e?void 0:e.defaultValue)||i})(t,e[t[n]]);e[t[n]]&&r&&(i[t[n]]=r)})),i},ct=({customizeDataset:e=[],param:t=[]},n={})=>{let i={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[e.name]=JSON.stringify(ut(n,t,"fieldName"))})),i=Object.assign({},i,ut(n,t,"key")),i},dt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i],a=n[r];if(!a)return e;e[r]||(e[r]=[]),e[r].push(ct(a,t))}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return e;e[a]||(e[a]=[]),e[a].push(ct(l,t))}return e},pt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i];if(!n[r])return e;e[r]||(e[r]=[]),e[r].push(t)}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r];if(!n[a])return e;e[a]||(e[a]=[]),e[a].push(t)}return e},mt=async e=>{var t;we.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):[],we.iReportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].iReportExecuteMode||1,(()=>{var e,t,n;const i=Object.keys(Je.value),r=we.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(i.includes(e.id)){const n=Je.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));Ie.value.unshift(...r),Ne.value&&Ie.value.push(...ge),(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(Ie.value.forEach((e=>{var t;(null==(t=fe.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),je.value=Ie.value.filter((e=>e.selected))),Te.value=Ie.value.filter((e=>!e.selected)),fe.hideButtons.length>0&&(Oe.value=Oe.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)||{},i=Object.keys(t);i.includes("RY7.2.21.1.M2.G94181E")||(Oe.value=Oe.value.filter((e=>"downloadPdf"!=e.key))),i.includes("RY7.2.21.1.M2.G33633A")||(Oe.value=Oe.value.filter((e=>"formatEditText"!=e.key))),i.includes("RY7.2.21.1.M2.G99314S")||(Oe.value=Oe.value.filter((e=>"resetPrinter"!=e.key)))}})(),we.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.templateParams,fe.params),ft()},vt=async()=>{var e;if(we.isInited)return!0;we.isInited=!0,we.spinning=!0,(()=>{if(ke)return!1;ke=new U})();const t=await fe.queryPrintFormatByNumber();return await mt(t),(null==(e=t.obj)?void 0:e.length)>0&&(Pe.value=t.obj[0].authorizationKey||""),we.spinning=!1,!0},ft=async()=>{const e=Object.keys(Je.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],i=Je.value[n],{stop:r,signature:a}=B().register({label:i.code,shortcutSignature:i.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=we.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=we.printParams[null==e?void 0:e.templateCode],i=t[null==e?void 0:e.templateCode]||[];rt(n,e.templateCode,e.templateId,e.key,i)}}}});Se.value[n]=r}},yt=async(e=!0)=>{if(await fe.clickPrevFn()){if(!we.visible){if(!await vt())return!1}e&&(we.visible=!we.visible)}},gt=e=>{if(we.identityVerification.visible=!1,z(we.currentFormatId))return $e({result:"success",message:""},"edit");const t=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,we.curPrintParamList[0])),n="MULTI"===fe.strategy?t:et(we.curPrintParamList,Ee.value),i={formatId:we.currentFormatId,templateId:xe.value,params:n,token:e};ke.editPrintFormat(i,(e=>{$e(e,"edit")}),Qe)},ht=(e,t)=>{const n=je.value[t+1];return t<je.value.length-1&&!we.printParams[e.templateCode]&&we.printParams[n.templateCode]};async function kt(){await yt(!1),(()=>{const e=Object.keys(we.printParams);we.isClickOuterPrint=!1;const t=we.originParams;if(1==Re.value)for(let n=0;n<e.length;n++){const i=e[n],r=we.printParams[i],a=t[i]||[],l=we.formatList.filter((e=>e.number==i));l&&l.length>0&&l.forEach((e=>{we.currentFormatId=e.id,rt(r,e.number,e.templateId,e.id,a,!0)}))}2==Re.value&&je.value.forEach((e=>{const n=we.printParams[e.templateCode],i=t[e.templateCode]||[];we.currentFormatId=e.key,rt(n,e.templateCode,e.templateId,e.key,i,!0)}))})()}return a((()=>{we.isInited=!1,yt()})),l((()=>{const e=Object.keys(Se.value);e.length>0&&e.forEach((e=>{Se.value[e]&&Se.value[e]()}))})),o((()=>fe.params),(e=>{Object.keys(we.templateParams).length>0&&(we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.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 yt(!1)}),{deep:!0,immediate:!0}),ve({directPrint:kt}),(t,n)=>(s(),u(c,null,[d("div",G,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(je.value,((t,n)=>(s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:lt,options:Be(v(Oe),t),onSelect:e=>at(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!we.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>it(t.templateCode,t.templateId,t.key,!0),class:h(n==je.value.length-1?"outerLastButton":ht(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",q,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"])))),128))])),_:1}),p(" 外显设置按钮 "),je.value.length>0&&je.value.length==v(ze).length&&v(Ne)&&2!=v(Re)?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,show:Le.isOutSetting,onClickoutside:n[2]||(n[2]=e=>He("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(je.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>Ye("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:qe},{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(x),{trigger:"click","show-arrow":!1,show:Le.oneShow,onClickoutside:n[10]||(n[10]=e=>He("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:yt,printSpinning:we.spinning,printbtnText:e.btnText,printVisible:we.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&&we.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(je.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(Ue)?(s(),u("span",Z,b(v(Ue)),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(Te.value,(e=>(s(),u("div",{class:h(["print-li",Ce.oneMouseType==e.key||Ce.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Ge("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Ge("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!we.printParams[n.templateCode])return[];Ge(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:Le.isOutSetting,onClickoutside:n[7]||(n[7]=e=>He("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>Ye("isOutSetting"))},[d("span",ne,b(e.label),1),m(v(M),{color:je.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",ie,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",re,[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:qe},{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",we.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>it(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),we.printParams[e.templateCode]?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Le[e.key],onClickoutside:t=>He(e.key)},{trigger:f((()=>[m(v(M),{component:v(R),size:"18",onClick:t=>Ye(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ce,[(s(!0),u(c,null,y(Be(v(Oe),e),(t=>(s(),u("div",{class:h(["print-li",Ce.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Ge("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Ge("twoMouseType",""))},[d("div",pe,[d("span",{class:"label",onClick:n=>at(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:we.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>we.identityVerification.visible=e),formatId:we.currentFormatId,templateId:v(xe),onSuccess:gt}),null,16,["modelValue","formatId","templateId"])],64))}});export{ve as default};
|
1
|
+
import{defineComponent as e,inject as t,ref as n,reactive as i,computed as r,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 U}from"../utils/print.js";import{isIReport as z}from"../utils/browserPrint.js";import A from"./IdentityVerification.vue.js";import{format as K}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 G={class:"newprint-button-outer"},q={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"},ie={class:"newprint-button-poperOver"},re={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:{}})},svrUpdateIp:{type:String}},setup(e,{expose:ve}){const fe=e,ye=String(navigator.platform).toLowerCase().includes("linux"),ge=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],he=C();let ke;const be=t(J),Pe=n(""),we=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],iReportExecuteMode:1}),Se=n({});let Ie=n([]),Oe=n([{label:fe.previewText,key:"previewText"},{label:fe.pdfLoadText,key:"downloadPdf"},{label:fe.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Ce=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),Le=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),Te=n([]),je=n([]),Me=r((()=>{if(!we.currentFormatId)return{};let e=we.currentFormatId;return we.formatList.find((t=>t.id===e))}));r((()=>{var e;return(null==(e=Me.value)?void 0:e.name)||"格式选择"}));const xe=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.templateId})),Ee=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.number})),Fe=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowPrintAll})),Ne=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowOutSetting})),_e=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.customProps)||{}})),De=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.defaultFormatId)||""})),Re=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.printAllType)||1})),Je=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.shortcut)||{}})),Ue=r((()=>{var e,t;const n=Object.keys(Je.value);if(n.length>0){if(De.value&&n.includes(De.value))return(null==(e=Je.value[De.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=Je.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=r((()=>{const e=ge.map((e=>e.key));return Ie.value.filter((t=>!e.includes(t.key)))})),Ae=r({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ke=async()=>{var e,t;(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await yt(),Le.oneShow=!0},Ve=async e=>{if(fe.directPrint){if(we.spinning)return;return"button"===e?void(Fe.value?await kt():De.value?async function(e){await yt(!1);const t=Te.value.find((t=>t.key==e));t&&it(t.templateCode,t.templateId,t.key,!1)}(De.value):Ke()):Ke()}return Ke()},Be=(e,t)=>we.printParams[t.templateCode]?z(t.key)&&(ye||2==we.iReportExecuteMode)?e.filter((e=>"formatEditText"!=e.key)):e:[],Ge=(e,t)=>{Ce[e]=t},qe=()=>{Te.value=Ie.value.filter((e=>!e.selected)),je.value=ze.value.filter((e=>e.selected)),He("oneShow"),He("isOutSetting"),be("saveOuterPrint",je.value)},Ye=e=>{Le[e]=!0},He=e=>{Ce.oneClickType="",Le[e]=!1,"isOutSetting"==e&&(Le.isOutSetting=!1)},$e=(e,t)=>{tt(!1);let n={type:t,formatId:we.currentFormatId,templateId:(null==e?void 0:e.templateId)||xe.value,templateCode:(null==e?void 0:e.templateCode)||Ee.value};V({type:"进入成功的回调",info:n},"PRINT-SDK"),be("success",e,n)},Qe=e=>{tt(!1),V({type:"进入失败的回调",res:e},"PRINT-SDK"),be("error",e),O(e)&&"notInstalledApp"===e.type&&he.error(e.message)},We=e=>{tt(!1),be("cancel",e)},Xe=e=>{be("error",{message:"前置条件执行错误",type:e,preExecution:!0})},Ze=()=>JSON.stringify({...fe.token?{token:fe.token}:{}}),et=(e=[],t)=>{var n,i;let r={},a={};if((null==(n=we.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(i=Object.keys(e[0].datasetData||{}))?void 0:i[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 r=Object.assign({},JSON.parse(Ze()),_e.value,a),JSON.stringify(r)},tt=(e,t)=>{if(we.isClickOuterPrint){if(e&&t){const n=je.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}je.value.forEach((e=>{e.isLoading=!1}))}else we.spinning=e},nt=()=>we.isClickOuterPrint?je.value.some((e=>e.isLoading)):we.spinning,it=(e,t,n,i)=>{const r=we.printParams[e];if(!r)return;we.isClickOuterPrint=i,we.currentFormatId=n;const a=we.originParams[e]||[];rt(r,e,t,n,a)},rt=async(e=[],t,n,i,r=[],a)=>{let l=e.length;const o=async e=>{try{--l<=0&&$e(e,"print")}catch(e){console.log("error",e)}};fe.showLoading&&nt()&&!a||(tt(!0,i),fe.prevFn("print",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const a={formatId:i,iReportExecuteMode:we.iReportExecuteMode,templateId:n,authorizationKey:Pe.value,printdlgshow:fe.printdlgshow,signature:fe.signature,copies:fe.printCopies,svrUpdateIp:fe.svrUpdateIp};if("MULTI"===fe.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[t]));ke.printDirect({...a,params:n},o,Qe,We)}else ke.printDirect({...a,params:et(e,t)},(e=>{e.params=r,e.templateCode=t,e.templateId=n,$e(e,"print")}),Qe,We)})).catch((()=>{Xe("print"),tt(!1)})).finally((()=>{we.visible=!1})))},at=async(e,{templateCode:t,templateId:n,key:i},r)=>{const a=we.printParams[t];if(a)switch(we.isClickOuterPrint=r,we.currentFormatId=i,e){case"previewText":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("preview",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,params:a,btnprint:fe.btnprint,signature:fe.signature};ke.preview(l,(e=>{$e(e,"preview")}),Qe)})).catch((()=>{Xe("preview"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"formatEditText":((e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("edit",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e,we.currentFormatId=i,we.identityVerification.visible=!0})).catch((()=>{Xe("edit")})).finally((()=>{tt(!1)})))})(a,0,n,i);break;case"downloadPdf":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("download",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,print:{print:"1",type:"1",resolution:null==fe?void 0:fe.resolution},params:a,signature:fe.signature};ke.downloadPDF(l,(e=>$e(e,"preview")),Qe)})).catch((()=>{Xe("download"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"resetPrinter":(async(e=[],t,n,i)=>{if(!fe.showLoading||!nt()){tt(!0,i);try{const e=await ke.resetPrinter(i,we.iReportExecuteMode);if(tt(!1),"success"==(null==e?void 0:e.result))return void he.success((null==e?void 0:e.message)||"重置打印机成功");he.warning((null==e?void 0:e.message)||"重置打印机失败")}catch(e){tt(!1),he.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,i)}},lt=()=>{},ot=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},dt(n,t,e))})),n},st=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},pt(n,t,e))})),n},ut=(e,t,n)=>{const i={};return t.forEach((t=>{let r=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(i=K(t,n[e.type])),(null==e?void 0:e.defaultValue)||i})(t,e[t[n]]);e[t[n]]&&r&&(i[t[n]]=r)})),i},ct=({customizeDataset:e=[],param:t=[]},n={})=>{let i={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[e.name]=JSON.stringify(ut(n,t,"fieldName"))})),i=Object.assign({},i,ut(n,t,"key")),i},dt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i],a=n[r];if(!a)return e;e[r]||(e[r]=[]),e[r].push(ct(a,t))}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return e;e[a]||(e[a]=[]),e[a].push(ct(l,t))}return e},pt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i];if(!n[r])return e;e[r]||(e[r]=[]),e[r].push(t)}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r];if(!n[a])return e;e[a]||(e[a]=[]),e[a].push(t)}return e},mt=async e=>{var t;we.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):[],we.iReportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].iReportExecuteMode||1,(()=>{var e,t,n;const i=Object.keys(Je.value),r=we.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(i.includes(e.id)){const n=Je.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));Ie.value.unshift(...r),Ne.value&&Ie.value.push(...ge),(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(Ie.value.forEach((e=>{var t;(null==(t=fe.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),je.value=Ie.value.filter((e=>e.selected))),Te.value=Ie.value.filter((e=>!e.selected)),fe.hideButtons.length>0&&(Oe.value=Oe.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)||{},i=Object.keys(t);i.includes("RY7.2.21.1.M2.G94181E")||(Oe.value=Oe.value.filter((e=>"downloadPdf"!=e.key))),i.includes("RY7.2.21.1.M2.G33633A")||(Oe.value=Oe.value.filter((e=>"formatEditText"!=e.key))),i.includes("RY7.2.21.1.M2.G99314S")||(Oe.value=Oe.value.filter((e=>"resetPrinter"!=e.key)))}})(),we.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.templateParams,fe.params),ft()},vt=async()=>{var e;if(we.isInited)return!0;we.isInited=!0,we.spinning=!0,(()=>{if(ke)return!1;ke=new U})();const t=await fe.queryPrintFormatByNumber();return await mt(t),(null==(e=t.obj)?void 0:e.length)>0&&(Pe.value=t.obj[0].authorizationKey||""),we.spinning=!1,!0},ft=async()=>{const e=Object.keys(Je.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],i=Je.value[n],{stop:r,signature:a}=B().register({label:i.code,shortcutSignature:i.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=we.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=we.printParams[null==e?void 0:e.templateCode],i=t[null==e?void 0:e.templateCode]||[];rt(n,e.templateCode,e.templateId,e.key,i)}}}});Se.value[n]=r}},yt=async(e=!0)=>{if(await fe.clickPrevFn()){if(!we.visible){if(!await vt())return!1}e&&(we.visible=!we.visible)}},gt=e=>{if(we.identityVerification.visible=!1,z(we.currentFormatId))return $e({result:"success",message:""},"edit");const t=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,we.curPrintParamList[0])),n="MULTI"===fe.strategy?t:et(we.curPrintParamList,Ee.value),i={formatId:we.currentFormatId,templateId:xe.value,params:n,token:e};ke.editPrintFormat(i,(e=>{$e(e,"edit")}),Qe)},ht=(e,t)=>{const n=je.value[t+1];return t<je.value.length-1&&!we.printParams[e.templateCode]&&we.printParams[n.templateCode]};async function kt(){await yt(!1),(()=>{const e=Object.keys(we.printParams);we.isClickOuterPrint=!1;const t=we.originParams;if(1==Re.value)for(let n=0;n<e.length;n++){const i=e[n],r=we.printParams[i],a=t[i]||[],l=we.formatList.filter((e=>e.number==i));l&&l.length>0&&l.forEach((e=>{we.currentFormatId=e.id,rt(r,e.number,e.templateId,e.id,a,!0)}))}2==Re.value&&je.value.forEach((e=>{const n=we.printParams[e.templateCode],i=t[e.templateCode]||[];we.currentFormatId=e.key,rt(n,e.templateCode,e.templateId,e.key,i,!0)}))})()}return a((()=>{we.isInited=!1,yt()})),l((()=>{const e=Object.keys(Se.value);e.length>0&&e.forEach((e=>{Se.value[e]&&Se.value[e]()}))})),o((()=>fe.params),(e=>{Object.keys(we.templateParams).length>0&&(we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.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 yt(!1)}),{deep:!0,immediate:!0}),ve({directPrint:kt}),(t,n)=>(s(),u(c,null,[d("div",G,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(je.value,((t,n)=>(s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:lt,options:Be(v(Oe),t),onSelect:e=>at(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!we.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>it(t.templateCode,t.templateId,t.key,!0),class:h(n==je.value.length-1?"outerLastButton":ht(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",q,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"])))),128))])),_:1}),p(" 外显设置按钮 "),je.value.length>0&&je.value.length==v(ze).length&&v(Ne)&&2!=v(Re)?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,show:Le.isOutSetting,onClickoutside:n[2]||(n[2]=e=>He("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(je.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>Ye("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:qe},{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(x),{trigger:"click","show-arrow":!1,show:Le.oneShow,onClickoutside:n[10]||(n[10]=e=>He("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:yt,printSpinning:we.spinning,printbtnText:e.btnText,printVisible:we.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&&we.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(je.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(Ue)?(s(),u("span",Z,b(v(Ue)),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(Te.value,(e=>(s(),u("div",{class:h(["print-li",Ce.oneMouseType==e.key||Ce.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Ge("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Ge("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!we.printParams[n.templateCode])return[];Ge(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:Le.isOutSetting,onClickoutside:n[7]||(n[7]=e=>He("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>Ye("isOutSetting"))},[d("span",ne,b(e.label),1),m(v(M),{color:je.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",ie,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",re,[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:qe},{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",we.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>it(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),we.printParams[e.templateCode]?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Le[e.key],onClickoutside:t=>He(e.key)},{trigger:f((()=>[m(v(M),{component:v(R),size:"18",onClick:t=>Ye(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ce,[(s(!0),u(c,null,y(Be(v(Oe),e),(t=>(s(),u("div",{class:h(["print-li",Ce.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Ge("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Ge("twoMouseType",""))},[d("div",pe,[d("span",{class:"label",onClick:n=>at(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:we.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>we.identityVerification.visible=e),formatId:we.currentFormatId,templateId:v(xe),onSuccess:gt}),null,16,["modelValue","formatId","templateId"])],64))}});export{ve as default};
|
@@ -1 +1 @@
|
|
1
|
-
import t from"axios";import{cloneDeep as e,isArray as i}from"lodash-es";import{IdentityVerificationDialog as r,PreviewDialog as s}from"./dialog.js";import{isIReport as a,getFileUrl as n,useBrowserPrint as o}from"./browserPrint.js";import{getCurrentInstance as l}from"vue";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import{format as h}from"date-fns";import{io as p}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,g=`${d}/fdp-api/print/assembly/printIReport`,y=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/printIReportForHex`,w=`${d}/bi-api/reprot/print/open/client/previewIReport`,v=`${d}/bi-api/reprot/print/open/client/getRemote`,P=`${d}/printService/file`;let _=null;class I{constructor(){var t,e,i;if(this.webview=null,this.dialog=new r,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,_)return _;_=this;const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(i=a.chrome)?void 0:i.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:r,reject:s}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void r({result:(null==i?void 0:i.res)?"success":"fail"});r(i.res||"")}catch(t){s(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=p(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=c();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)})),new Promise(((e,r)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),r({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=a(t),r=this.getIReportFormatId(i,t);if(i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:r}}).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:"notInstalledApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:r}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:r}}).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:this.printOrigin+"/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:r(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[r]}).then((({data:t})=>t));function r(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 r=t.message||t.Message;this._handleMonitorNotify(r);const s={type:"printError",message:r,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:r,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(s),!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,r,s){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:r},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,s)}_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,svrUpdateIp:i,params:r,paramsArr:s,cmdid:a,print:n,signature:o,copies:l,printdlgshow:c="0",nobillnode:p="1",btnprint:u="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:r,cmdid:a,nobillnode:p,printdlgshow:c,btnprint:u,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=h(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:r,messageTimeout:s=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:r,params:JSON.stringify(n),messageTimeout:s};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:v})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:g,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="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:y,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForBase16(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForPdf(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:w,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,r=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),s=r[r.length-2],a=r[r.length-1],l=await n(`${P}/${s}/${a}`),c=o(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let r=i.length;const s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new Blob([s],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,signature:c,btnprint:h,messageTimeout:p=0},m,d){const g=a(i),y=this.getIReportFormatId(g,i);if(g&&(u||2==t)){const t=await this._queryPrintForPdf(e,y,r,n);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const i=o(t,"preview");return this.instance||(this.instance=l()),this.showPreview(this.instance,i),null==m?void 0:m({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:y,params:r,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),i=this._handleResult(t,d);if(!i)return!1;if(this.isRemote){const t=await this._browserPrint(i,"preview");this.instance||(this.instance=l()),this.showPreview(this.instance,t)}await this.getPicAndUpload(i),null==m||m(i)}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 r=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=c(),s=await this.messageCollect(t,{exec:"printA",data:r});if(s&&Array.isArray(s)){s.some((t=>"success"===t.res.result))?null==e||e(s):(null==i||i(s),this._handleMonitorNotify(s))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(s||""),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:r="",paramsArr:s,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},y,f,w,v="printDirect"){const P=a(i),_=this.getIReportFormatId(P,i);if(P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notInstalledApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w):f({type:"notInstalledApp",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w))}await this._queryProxyOrigin();const I=await this._testConnection();if(!this._handleResultTest(I,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:_,params:r,paramsArr:s,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,messageTimeout:g}),i=this._handleResult(t,f,w);if(!i)return!1;d&&["downloadPDF"].includes(v)&&await this._browserPrint(i,v),null==y||y(i)}catch(t){const e="printDirect"===v?"打印失败":"下载失败",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:r},s,a,n){const o=await this._queryPrintForBase64(t,e,i,r);if(!o.success)return a({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=s,this._errorCallbackFn=a,n&&(this._cancelCallbackFn=n),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,r,s){var n;const o=e(t);if(this.webview&&this.downloadPath&&(Reflect.has(o,"print")||Reflect.set(o,"print",{print:"1",type:"1"}),!o.print.filename)){const t=h(new Date,"yyyy-MM-dd"),e=c(),i=h(new Date,"yyyyMMddHHmmss")+e;o.print.filename=`${this.downloadPath}/${t}/${i}/${i}`.replace(/\\/g,"/")}const l=a(o.formatId);if(o.formatId=this.getIReportFormatId(l,o.formatId),l&&(u||2==o.iReportExecuteMode)){const t=await this._queryPrintForBase16(o.templateId||"",o.formatId,o.params||"",o.authorizationKey);return(null==t?void 0:t.success)?r({filebase64:null==(n=null==t?void 0:t.map)?void 0:n.hex,isIreport:!0}):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(o,(async t=>{t||s({result:"error",message:""});const e=this,a=await async function(t){const r=[],s=JSON.parse(t);if(!i(s))return await e._downloadPDF("");if(1===s.length)return await e._downloadPDF(s[0]||"");for(let t=0,i=s.length;t<i;t++)r.push(await e._downloadPDF(s[t]||""));return r}(t.filedir);r(a,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:r},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;s&&s(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,r,a);return!!o&&(s&&s(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,s);return!!o&&(r&&r(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,s);if(!o)return!1;r&&r(o)}}export{I as Print};
|
1
|
+
import t from"axios";import{cloneDeep as e,isArray as i}from"lodash-es";import{IdentityVerificationDialog as r,PreviewDialog as s}from"./dialog.js";import{isIReport as a,getFileUrl as n,useBrowserPrint as o}from"./browserPrint.js";import{getCurrentInstance as l}from"vue";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import{format as h}from"date-fns";import{io as p}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,g=`${d}/fdp-api/print/assembly/printIReport`,y=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/printIReportForHex`,w=`${d}/bi-api/reprot/print/open/client/previewIReport`,v=`${d}/bi-api/reprot/print/open/client/getRemote`,P=`${d}/printService/file`;let _=null;class I{constructor(){var t,e,i;if(this.webview=null,this.dialog=new r,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,_)return _;_=this;const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(i=a.chrome)?void 0:i.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:r,reject:s}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void r({result:(null==i?void 0:i.res)?"success":"fail",message:(null==i?void 0:i.error)||""});r(i.res||"")}catch(t){s(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=p(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=c();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)})),new Promise(((e,r)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),r({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=a(t),r=this.getIReportFormatId(i,t);if(i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:r}}).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:"notInstalledApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:r}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:r}}).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:this.printOrigin+"/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:r(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[r]}).then((({data:t})=>t));function r(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 r=t.message||t.Message;this._handleMonitorNotify(r);const s={type:"printError",message:r,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:r,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(s),!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,r,s){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:r},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,s)}_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,svrUpdateIp:i,params:r,paramsArr:s,cmdid:a,print:n,signature:o,copies:l,printdlgshow:c="0",nobillnode:p="1",btnprint:u="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:r,cmdid:a,nobillnode:p,printdlgshow:c,btnprint:u,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=h(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:r,messageTimeout:s=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:r,params:JSON.stringify(n),messageTimeout:s};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:v})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:g,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="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:y,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForBase16(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForPdf(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:w,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,r=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),s=r[r.length-2],a=r[r.length-1],l=await n(`${P}/${s}/${a}`),c=o(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let r=i.length;const s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new Blob([s],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,signature:c,btnprint:h,messageTimeout:p=0},m,d){const g=a(i),y=this.getIReportFormatId(g,i);if(g&&(u||2==t)){const t=await this._queryPrintForPdf(e,y,r,n);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const i=o(t,"preview");return this.instance||(this.instance=l()),this.showPreview(this.instance,i),null==m?void 0:m({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:y,params:r,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),i=this._handleResult(t,d);if(!i)return!1;if(this.isRemote){const t=await this._browserPrint(i,"preview");this.instance||(this.instance=l()),this.showPreview(this.instance,t)}await this.getPicAndUpload(i),null==m||m(i)}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 r=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=c(),s=await this.messageCollect(t,{exec:"printA",data:r});if(s&&Array.isArray(s)){s.some((t=>"success"===t.res.result))?null==e||e(s):(null==i||i(s),this._handleMonitorNotify(s))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(s||""),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:r="",paramsArr:s,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},y,f,w,v="printDirect"){const P=a(i),_=this.getIReportFormatId(P,i);if(P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notInstalledApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w):f({type:"notInstalledApp",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w))}await this._queryProxyOrigin();const I=await this._testConnection();if(!this._handleResultTest(I,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:_,params:r,paramsArr:s,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,messageTimeout:g}),i=this._handleResult(t,f,w);if(!i)return!1;d&&["downloadPDF"].includes(v)&&await this._browserPrint(i,v),null==y||y(i)}catch(t){const e="printDirect"===v?"打印失败":"下载失败",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:r},s,a,n){const o=await this._queryPrintForBase64(t,e,i,r);if(!o.success)return a({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=s,this._errorCallbackFn=a,n&&(this._cancelCallbackFn=n),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,r,s){var n;const o=e(t);if(this.webview&&this.downloadPath&&(Reflect.has(o,"print")||Reflect.set(o,"print",{print:"1",type:"1"}),!o.print.filename)){const t=h(new Date,"yyyy-MM-dd"),e=c(),i=h(new Date,"yyyyMMddHHmmss")+e;o.print.filename=`${this.downloadPath}/${t}/${i}/${i}`.replace(/\\/g,"/")}const l=a(o.formatId);if(o.formatId=this.getIReportFormatId(l,o.formatId),l&&(u||2==o.iReportExecuteMode)){const t=await this._queryPrintForBase16(o.templateId||"",o.formatId,o.params||"",o.authorizationKey);return(null==t?void 0:t.success)?r({filebase64:null==(n=null==t?void 0:t.map)?void 0:n.hex,isIreport:!0}):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(o,(async t=>{t||s({result:"error",message:""});const e=this,a=await async function(t){const r=[],s=JSON.parse(t);if(!i(s))return await e._downloadPDF("");if(1===s.length)return await e._downloadPDF(s[0]||"");for(let t=0,i=s.length;t<i;t++)r.push(await e._downloadPDF(s[t]||""));return r}(t.filedir);r(a,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:r},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;s&&s(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,r,a);return!!o&&(s&&s(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,s);return!!o&&(r&&r(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,s);if(!o)return!1;r&&r(o)}}export{I as Print};
|
@@ -4238,6 +4238,21 @@ export declare const CallbackMaps: Map<string, {
|
|
4238
4238
|
} | undefined;
|
4239
4239
|
tableRowHeight?: string | number | undefined;
|
4240
4240
|
tableHeaderRowHeight?: string | number | undefined;
|
4241
|
+
crossColumnSetting?: {
|
4242
|
+
columnWidth?: number | undefined;
|
4243
|
+
rowHeight?: number | undefined;
|
4244
|
+
fixedColumnList?: {
|
4245
|
+
setting: {
|
4246
|
+
alias?: string | undefined;
|
4247
|
+
name?: string | undefined;
|
4248
|
+
option?: {
|
4249
|
+
text: string;
|
4250
|
+
value?: string | undefined;
|
4251
|
+
}[] | undefined;
|
4252
|
+
};
|
4253
|
+
columnWidth?: number | undefined;
|
4254
|
+
}[] | undefined;
|
4255
|
+
} | undefined;
|
4241
4256
|
onFormChange?: ((payload_0: import("../../../../../components/iho-table").IhoTableFormChangePayload) => void) | undefined;
|
4242
4257
|
onScroll?: ((params: import("vxe-table").VxeTableDefines.ScrollEventParams) => void) | undefined;
|
4243
4258
|
onKeydown?: ((params: import("vxe-table").VxeTableDefines.KeydownEventParams) => void) | undefined;
|
@@ -4306,6 +4321,7 @@ export declare const CallbackMaps: Map<string, {
|
|
4306
4321
|
}>;
|
4307
4322
|
updateConfigRefDebounced: () => void;
|
4308
4323
|
updateConfigRef: () => void;
|
4324
|
+
themeOverrides: import("vue").ComputedRef<import("naive-ui").GlobalThemeOverrides>;
|
4309
4325
|
fieldListRef: import("vue").Ref<{
|
4310
4326
|
[x: string]: any;
|
4311
4327
|
property?: string | undefined;
|
@@ -7816,6 +7832,21 @@ export declare const CallbackMaps: Map<string, {
|
|
7816
7832
|
} | undefined;
|
7817
7833
|
tableRowHeight?: string | number | undefined;
|
7818
7834
|
tableHeaderRowHeight?: string | number | undefined;
|
7835
|
+
crossColumnSetting?: {
|
7836
|
+
columnWidth?: number | undefined;
|
7837
|
+
rowHeight?: number | undefined;
|
7838
|
+
fixedColumnList?: {
|
7839
|
+
setting: {
|
7840
|
+
alias?: string | undefined;
|
7841
|
+
name?: string | undefined;
|
7842
|
+
option?: {
|
7843
|
+
text: string;
|
7844
|
+
value?: string | undefined;
|
7845
|
+
}[] | undefined;
|
7846
|
+
};
|
7847
|
+
columnWidth?: number | undefined;
|
7848
|
+
}[] | undefined;
|
7849
|
+
} | undefined;
|
7819
7850
|
onFormChange?: ((payload_0: import("../../../../../components/iho-table").IhoTableFormChangePayload) => void) | undefined;
|
7820
7851
|
onSettingClick?: (() => void) | undefined;
|
7821
7852
|
onFormClick?: ((payload_0: import("../../../../../components/iho-table").IhoTableFormChangePayload) => void) | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawPoint as n,defaultStyle as i,drawText as r,defaultTextStyle as l,drawTextAndIconGroup as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as c}from"../useGrid.js";import{useBirthProcessCumputedPoint as u}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as f,drawScaleNumber as d,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as p}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as b,last as k,range as j}from"lodash-es";import"../temperature/useShadow.js";import"@vueuse/shared";import{format as w}from"date-fns";import"naive-ui";import"@vueuse/core";function x(x,S,C,P,E){const{computedX:X,computedY:O,getXValue:A,getYValue:L}=u(S),{getEqualXTypes:M,handleAddPrevent:Y,isGridLimit:H,setPrevAndNextPoint:T,getPointEventProps:I}=p(x,C,S),{xAxis:D,grid:G,originX:N,originY:W,xCellWidth:z,endY:V,startTime:B,leftAddAreaWidth:F,leftScales:R,rightScales:$,yCellHeight:q,endX:J,scaleValues:K,canvasWidth:Q,borderStyle:U,rightAddAreaWidth:Z,event:_,originYCervix:ee,other:te,canvasHeight:oe,scalebarBorder:ne,padding:ie}=S,re=b(K),le=new Set;function se(){re.filter((({showData:e=!0})=>e)).forEach(((e,s)=>{var a;const c=[],u=[],f=[],{pointAttr:d={},lineAttr:h={},title:p="",key:g,type:v="circle",childbirthStyle:m={},surgicalDeliveryStyle:y={},dystociaStyle:b={}}=e;function k(r,l,s,a){if(l[s]){const{type:c="circle",style:u={},arrowStyle:d={}}=e[s+"Style"],p=X(l[s]),g=t([...r,p,r[1]],{...h,strokeDashArray:[4,2],...i}),v=n(c,{left:p,top:r[1],...u,...i}),m=r[1]+v.height/2,y="dystocia"===s?o([p,m+q,m],h,"up"):null;g&&(f.push(g),a[s+"Line"]={obj:g,type:"line",left:p-r[0]}),v&&(f.push(v),a[s]={obj:v,left:p-r[0]}),y&&(f.push(y),a[s+"Arrow"]={obj:y,left:p-r[0],moveHide:!0})}}null==(a=e.data)||a.forEach(((a,y)=>{!function(a,y,b){let j,S;const E=e.data[b+1],X=de(E,e);if(a&&X&&!y.breakpoint)S=t([...a,...X],{...h});else if(a&&!X&&!y.breakpoint){const o=de(E,e);S=o?t([...a,...o],{...h}):null}const O={};if("cervix"===g){let e,t;if(y.childbirth){const{type:s="arrow",style:c={}}=m;if("arrow"===s){const t=a[1]+q;e=o([a[0],a[1],t],c)}else e=n(s,{left:a[0],top:a[1],...c,...i,hoverCursor:"default"});t=r([a[0]+z/2,a[1]+q/2],{value:String(y.childbirth),...l,originX:"left",originY:"center",fill:c.stroke||c.fill,fontSize:c.fontSize||l.fontSize}),e&&(f.push(e),Object.assign(O,{childbirthIcon:{obj:e,type:s}})),t&&(f.push(t),Object.assign(O,{childbirthText:{obj:t,left:z/2,top:q/2}}))}}"fetalPresentation"===g&&(k(a,y,"surgicalDelivery",O),k(a,y,"dystocia",O));const M=u[b-1],Y={origin:{data:y,title:p,key:g||"",dataIndex:s,index:b},leftLine:M,rightLine:S,otherObj:O,...d,...I()};a&&(M||(Y.leftLine=null),j=n(v,{left:a[0],top:a[1],...Y}));u.push(S),j&&(!function(e){_.hovered&&(e.on("mouseover",(()=>{fe(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ue(e),function(e){var t,o;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:o,top:n=0,left:i=0,type:r="",moveHide:l}=t||{};o&&("line"===r?o.setCoords().set({x1:e.left,y1:e.top,x2:e.left+i,y2:e.top}):o.setCoords().set({left:e.left+i,top:e.top+n}),l&&(x.value.remove(o),delete e.otherObj.obj))}))}(e),_.hovered&&fe(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:L(t,e.top)}};["surgicalDelivery","dystocia"].some((t=>{var n;(null==(n=e.otherObj[t])?void 0:n.obj)&&(o.data[t]=w(new Date(A(e.left+e.otherObj[t].left)),"yyyy-MM-dd HH:mm"))})),x.value.discardActiveObject(),C("change",o),ae(o,"change")}}))}(j),c.push(j),le.add(j))}(de(a,e),a,y)})),Promise.all(c).then((e=>{const t=u.filter((e=>e));T(e),Promise.all(f).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront();const{childbirthIcon:t}=e.otherObj||{};(null==t?void 0:t.obj)&&"arrow"!==(null==t?void 0:t.type)&&t.obj.bringToFront()}))}))}))}))}function ae(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=re.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ce()}function ce(){var e;le.size&&(null==(e=x.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}([...le]))),le.clear(),se()}function ue(e){const t=e.prevPoint?e.prevPoint.left:N,o=e.nextPoint?e.nextPoint.left:J;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<ee&&e.set("top",ee),e.top<W&&e.set("top",W),e.top>V&&e.set("top",V),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function fe(e,t="moving"){const{title:o,key:n,data:i}=e.origin;P.point={x:e.left,y:e.top},P.list=[`${o} ${"hover"===t?i.value:L(n,e.top)}`,`时间 ${A(e.left).slice(-5)}`],P.show=!0}function de(e,t){if(v(e)&&function(e){const t=B+864e5,o=m(e);return o>=B&&o<=t}(e.time)){const o=X(e.time),n=O(t.key,t.range,e.value);return[o,n<W?W:n>V?V:n]}}function he(e,t){return e+1>t[1]?t[0]:e+1}return c(x,S),function(){const t=ne?{width:Q-F-Z-1,left:F}:{width:J-N-($.length?0:1),left:N},o=new e.Rect({...U,height:V-ie[0]-1,top:ie[0],fill:"transparent",...t});x.value.add(o)}(),function(){function t(t,o="left"){let n="left"===o?F:J;t.forEach(((t,o)=>{const{range:s,spaceValue:c,width:u,title:p,titleStyle:g,key:v,position:m="center",spaceGridNumber:b=1,showNumber:k=!0,showMaxMinNumber:j=!0,showName:w=!0}=t,S=[],C=[],P=n+u/2,E=y(s,c),X=E.length,{lineXMain:O,lineXSub:A,textLeft:L}=f(m,n,u);E.forEach(((e,o)=>{const n=V-o*q*b,i=0===o?V-8:o!==E.length-1||!ie[0]||ee&&"FHR"!==v?n:W+8;!k||(0===o||o===X-1)&&!j||S.push(d(String(e),t,L,i)),C.push(...h(t,o,O,A,n,q,W,X,1))}));const M=[],Y=ne?new e.Rect({...a,strokeWidth:.5,width:u,height:V-ie[0],left:P,top:ie[0]+(V-ie[0])/2}):null;if(Y&&M.push(Y),w){const e=r([P,W-ie[0]>0?W-q/2:q/2],{value:String(p),...l,...g});e&&M.push(e)}const H=new e.Group([...C,...S,...M],{objectCaching:!1,...i});x.value.add(H),H.sendToBack(),n+=u}))}t(R),t($,"right")}(),function(){const{show:t,startTime:o,range:n=[0,23],position:s="top",style:a}=D.time,{show:c,range:u=[0,23],position:f,style:d={}}=D.processTime;if(t||c){const h=[],p=j(u[0],u[1]+1),g=[],v=[],m=q/2;for(let e=0;e<G.mainXCell;e++){if(t){const{textAlign:t="center"}=a,i=N+("center"===t?z/2:0),c=0===e&&"center"!==t?i+5:i,u=0===e?+o.slice(11,13):he(k(h),n);h.push(u);const f="top"===s?W-m:V+m;g.push(r([c+e*z,f],{value:String(u),...l,...a})),e===G.mainXCell-1&&"center"!==t&&g.push(r([J-1,f],{value:String(he(k(h),n)),...l,...a,originX:"center"!==t?"right":"center"}))}if(c&&e<=p.length){const{textAlign:t="center"}=d,o=N+("center"===t?z/2:0),n=0===e&&"center"!==t?o+5:o,i="top"===f?m:oe-m;v.push(r([n+e*z,i],{value:String(p[e]),...l,...d})),e===G.mainXCell-1&&"center"!==t&&v.push(r([J-1,i],{value:String(k(p)),...l,...a,originX:"center"!==t?"right":"center"}))}}const y=new e.Group([...g,...v],{objectCaching:!1,...i});x.value.add(y),x.value.sendToBack(y)}}(),function(){var e;const o=Object.values(te),n=[],i={},r=re.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=O(o,n,10),l=[0,t],s=[-t/e,0],a=[(V-i-t)/e,V-i],c=[J-N,e*(J-N)+t];let u=[],f=[];function d([o,n]){return Math.abs(n-e*o-t)<=1}function h([e,t]){const[o,n]=[...p([e,t])];return o>=N&&o<=J&&n>=i&&n<=V}function p([e,t]){return[N+e,V-t]}return d(l)&&h(l)&&(u=p(l)),d(s)&&h(s)&&(u=p(s)),d(a)&&h(a)&&(f=p(a)),d(c)&&h(c)&&(f=p(c)),[...u,...f]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=re.find((e=>e.key===o));if(r){const r=O(o,i,0);n.push(t([N,r,J,r],{...e}))}break}case"alert":if(l){const{key:o,range:a}=r||{},c=216e5,u={time:w(new Date(m(l.time)+c),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[X(l.time)-N,V-O(o,a,l.value)],[h,p]=[X(u.time)-N,V-O(o,a,u.value)],g=(p-d)/(h-f),v=d-f*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,c=s(o,r-(X(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-X(l.time))*o);c.length>0&&n.push(t(c,{...e}))}}})),x.value.add(...n)}(),se(),function(){function e(e,t){const o=re.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}S.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:o=0,y:n=0}=t.pointer||{};o>=N&&o<=J&&n>=W&&n<=V&&(E.point={x:o,y:n},E.show=!0,t.target?(E.target=t.target,E.list=["删除节点"],[...le].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&E.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(E.target=null,E.list=["新增节点"],re.filter((e=>e.show)).forEach((i=>{if(!M([...le],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<ee)return;E.list.push(e(i,t.pointer))}})),1===E.list.length&&(E.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=Q-Z/2;function t(e,t){if(!e.length)return;let n=W;const i=[];e.forEach((e=>{const o=(e.alias||e.title).split("").join("\n"),a=K.findIndex((t=>t.key===e.key));if(e.alias){const s=r([t,n],{value:o,...l,originY:"top",...e.titleStyle});o&&(n+=s.height+15,i.push(s))}else{const{text:r,icon:l}=s(o,e,{text:{originX:"center",originY:"top",left:t,top:n},icon:{left:t,topY:n,originX:"center",originY:"top",origin:{type:e.type,dataIndex:a},...S.event}},"vertical");n+=r.height+l.height+15,(c=l).on("moving",(()=>{c.set("originY","center"),H(c)?(ue(c),fe(c)):P.show=!1})),c.on("mouseup:before",(e=>{if(P.show=!1,0===e.e.button&&H(c))if(M([...le],c.left,"key").includes(c.origin.key))Y("repeat");else{const e={data:{time:A(c.left),value:L(c.origin.key,c.top)},...c.origin};C("add",e),ae(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(c)})),i.push(r,l)}var c})),o(i),x.value.add(...i)}function o(e){const t=k(e),o=(V-W)/2,n=(t.height+t.top-W)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(R,F/2),t($,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(C("remove",o),ae(o,"remove")):(Object.assign(o,{data:{time:A(e.pointer.x),value:L(e.origin.key,e.pointer.y)}}),C("add",o),ae(o))},redrawPoints:ce}}export{x as useBirthProcess};
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawPoint as n,defaultStyle as i,drawText as r,defaultTextStyle as l,drawTextAndIconGroup as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as c}from"../useGrid.js";import{useBirthProcessCumputedPoint as u}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as p}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as b,last as k,range as j}from"lodash-es";import"../temperature/useShadow.js";import"@vueuse/shared";import{format as w}from"date-fns";import"naive-ui";import"@vueuse/core";function x(x,S,C,P,E){const{computedX:X,computedY:O,getXValue:A,getYValue:L}=u(S),{getEqualXTypes:M,handleAddPrevent:Y,isGridLimit:H,setPrevAndNextPoint:T,getPointEventProps:I}=p(x,C,S),{xAxis:D,grid:G,originX:N,originY:W,xCellWidth:V,endY:B,startTime:F,leftAddAreaWidth:R,leftScales:$,rightScales:q,yCellHeight:z,endX:J,scaleValues:K,canvasWidth:Q,borderStyle:U,rightAddAreaWidth:Z,event:_,originYCervix:ee,other:te,canvasHeight:oe,scalebarBorder:ne,padding:ie}=S,re=b(K),le=new Set;function se(){re.filter((({showData:e=!0})=>e)).forEach(((e,s)=>{var a;const c=[],u=[],d=[],{pointAttr:f={},lineAttr:h={},title:p="",key:g,type:v="circle",childbirthStyle:m={},surgicalDeliveryStyle:y={},dystociaStyle:b={}}=e;function k(r,l,s,a){if(l[s]){const{type:c="circle",style:u={},arrowStyle:f={}}=e[s+"Style"],p=X(l[s]),g=t([...r,p,r[1]],{...h,strokeDashArray:[4,2],...i}),v="dystocia"===s&&r[1]-W>=z?r[1]-z:r[1],m=n(c,{left:p,top:v,...u,...i}),y=v+m.height/2,b="dystocia"===s?o([p,y+z,y],h,"up"):null;g&&(d.push(g),a[s+"Line"]={obj:g,type:"line",left:p-r[0]}),m&&(d.push(m),a[s]={obj:m,left:p-r[0]}),b&&(d.push(b),a[s+"Arrow"]={obj:b,left:p-r[0],moveHide:!0})}}null==(a=e.data)||a.forEach(((a,y)=>{!function(a,y,b){let j,S;const E=e.data[b+1],X=fe(E,e);if(a&&X&&!y.breakpoint)S=t([...a,...X],{...h});else if(a&&!X&&!y.breakpoint){const o=fe(E,e);S=o?t([...a,...o],{...h}):null}const O={};if(["fetalPresentation","cervix"].includes(g)){let e,t;if(y.childbirth){const{type:s="arrow",style:c={},textStyle:u={}}=m;if("arrow"===s){const t=a[1]+z;e=o([a[0],a[1],t],c)}else e=n(s,{left:a[0],top:a[1],...c,...i,hoverCursor:"default"});t=r([a[0]+V/2,a[1]+z/2],{value:String(y.childbirth),...l,originX:"left",originY:"center",...u}),e&&(d.push(e),Object.assign(O,{childbirthIcon:{obj:e,type:s}})),t&&(d.push(t),Object.assign(O,{childbirthText:{obj:t,left:V/2,top:z/2}}))}}"fetalPresentation"===g&&(k(a,y,"surgicalDelivery",O),k(a,y,"dystocia",O));const M=u[b-1],Y={origin:{data:y,title:p,key:g||"",dataIndex:s,index:b},leftLine:M,rightLine:S,otherObj:O,...f,...I()};a&&(M||(Y.leftLine=null),j=n(v,{left:a[0],top:a[1],...Y}));u.push(S),j&&(!function(e){_.hovered&&(e.on("mouseover",(()=>{de(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ue(e),function(e){var t,o;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:o,top:n=0,left:i=0,type:r="",moveHide:l}=t||{};o&&("line"===r?o.setCoords().set({x1:e.left,y1:e.top,x2:e.left+i,y2:e.top}):o.setCoords().set({left:e.left+i,top:e.top+n}),l&&(x.value.remove(o),delete e.otherObj.obj))}))}(e),_.hovered&&de(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:L(t,e.top)}};["surgicalDelivery","dystocia"].some((t=>{var n;(null==(n=e.otherObj[t])?void 0:n.obj)&&(o.data[t]=w(new Date(A(e.left+e.otherObj[t].left)),"yyyy-MM-dd HH:mm"))})),x.value.discardActiveObject(),C("change",o),ae(o,"change")}}))}(j),c.push(j),le.add(j))}(fe(a,e),a,y)})),Promise.all(c).then((e=>{const t=u.filter((e=>e));T(e),Promise.all(d).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront();const{childbirthIcon:t}=e.otherObj||{};(null==t?void 0:t.obj)&&"arrow"!==(null==t?void 0:t.type)&&t.obj.bringToFront()}))}))}))}))}function ae(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=re.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ce()}function ce(){var e;le.size&&(null==(e=x.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}([...le]))),le.clear(),se()}function ue(e){const t=e.prevPoint?e.prevPoint.left:N,o=e.nextPoint?e.nextPoint.left:J;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<ee&&e.set("top",ee),e.top<W&&e.set("top",W),e.top>B&&e.set("top",B),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function de(e,t="moving"){const{title:o,key:n,data:i}=e.origin;P.point={x:e.left,y:e.top},P.list=[`${o} ${"hover"===t?i.value:L(n,e.top)}`,`时间 ${A(e.left).slice(-5)}`],P.show=!0}function fe(e,t){if(v(e)&&function(e){const t=F+864e5,o=m(e);return o>=F&&o<=t}(e.time)){const o=X(e.time),n=O(t.key,t.range,e.value);return[o,n<W?W:n>B?B:n]}}function he(e,t){return e+1>t[1]?t[0]:e+1}return c(x,S),function(){const t=ne?{width:Q-R-Z-1,left:R}:{width:J-N-(q.length?0:1),left:N},o=new e.Rect({...U,height:B-ie[0]-1,top:ie[0],fill:"transparent",...t});x.value.add(o)}(),function(){function t(t,o="left"){let n="left"===o?R:J;t.forEach(((t,o)=>{const{range:s,spaceValue:c,width:u,title:p,titleStyle:g,key:v,position:m="center",spaceGridNumber:b=1,showNumber:k=!0,showMaxMinNumber:j=!0,showName:w=!0}=t,S=[],C=[],P=n+u/2,E=y(s,c),X=E.length,{lineXMain:O,lineXSub:A,textLeft:L}=d(m,n,u);E.forEach(((e,o)=>{const n=B-o*z*b,i=0===o?B-8:o!==E.length-1||!ie[0]||ee&&"FHR"!==v?n:W+8;!k||(0===o||o===X-1)&&!j||S.push(f(String(e),t,L,i)),C.push(...h(t,o,O,A,n,z,W,X,1))}));const M=[],Y=ne?new e.Rect({...a,strokeWidth:.5,width:u,height:B-ie[0],left:P,top:ie[0]+(B-ie[0])/2}):null;if(Y&&M.push(Y),w){const e=r([P,W-ie[0]>0?W-z/2:z/2],{value:String(p),...l,...g});e&&M.push(e)}const H=new e.Group([...C,...S,...M],{objectCaching:!1,...i});x.value.add(H),H.sendToBack(),n+=u}))}t($),t(q,"right")}(),function(){const{show:t,startTime:o,range:n=[0,23],position:s="top",style:a}=D.time,{show:c,range:u=[0,23],position:d,style:f={}}=D.processTime;if(t||c){const h=[],p=j(u[0],u[1]+1),g=[],v=[],m=z/2;for(let e=0;e<G.mainXCell;e++){if(t){const{textAlign:t="center"}=a,i=N+("center"===t?V/2:0),c=0===e&&"center"!==t?i+5:i,u=0===e?+o.slice(11,13):he(k(h),n);h.push(u);const d="top"===s?W-m:B+m;g.push(r([c+e*V,d],{value:String(u),...l,...a})),e===G.mainXCell-1&&"center"!==t&&g.push(r([J-1,d],{value:String(he(k(h),n)),...l,...a,originX:"center"!==t?"right":"center"}))}if(c&&e<=p.length){const{textAlign:t="center"}=f,o=N+("center"===t?V/2:0),n=0===e&&"center"!==t?o+5:o,i="top"===d?m:oe-m;v.push(r([n+e*V,i],{value:String(p[e]),...l,...f})),e===G.mainXCell-1&&"center"!==t&&v.push(r([J-1,i],{value:String(k(p)),...l,...a,originX:"center"!==t?"right":"center"}))}}const y=new e.Group([...g,...v],{objectCaching:!1,...i});x.value.add(y),x.value.sendToBack(y)}}(),function(){var e;const o=Object.values(te),n=[],i={},r=re.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=O(o,n,10),l=[0,t],s=[-t/e,0],a=[(B-i-t)/e,B-i],c=[J-N,e*(J-N)+t];let u=[],d=[];function f([o,n]){return Math.abs(n-e*o-t)<=1}function h([e,t]){const[o,n]=[...p([e,t])];return o>=N&&o<=J&&n>=i&&n<=B}function p([e,t]){return[N+e,B-t]}return f(l)&&h(l)&&(u=p(l)),f(s)&&h(s)&&(u=p(s)),f(a)&&h(a)&&(d=p(a)),f(c)&&h(c)&&(d=p(c)),[...u,...d]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=re.find((e=>e.key===o));if(r){const r=O(o,i,0);n.push(t([N,r,J,r],{...e}))}break}case"alert":if(l){const{key:o,range:a}=r||{},c=216e5,u={time:w(new Date(m(l.time)+c),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[X(l.time)-N,B-O(o,a,l.value)],[h,p]=[X(u.time)-N,B-O(o,a,u.value)],g=(p-f)/(h-d),v=f-d*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,c=s(o,r-(X(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-X(l.time))*o);c.length>0&&n.push(t(c,{...e}))}}})),x.value.add(...n)}(),se(),function(){function e(e,t){const o=re.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}S.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:o=0,y:n=0}=t.pointer||{};o>=N&&o<=J&&n>=W&&n<=B&&(E.point={x:o,y:n},E.show=!0,t.target?(E.target=t.target,E.list=["删除节点"],[...le].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&E.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(E.target=null,E.list=["新增节点"],re.filter((e=>e.show)).forEach((i=>{if(!M([...le],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<ee)return;E.list.push(e(i,t.pointer))}})),1===E.list.length&&(E.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=Q-Z/2;function t(e,t){if(!e.length)return;let n=W;const i=[];e.forEach((e=>{const o=(e.alias||e.title).split("").join("\n"),a=K.findIndex((t=>t.key===e.key));if(e.alias){const s=r([t,n],{value:o,...l,originY:"top",...e.titleStyle});o&&(n+=s.height+15,i.push(s))}else{const{text:r,icon:l}=s(o,e,{text:{originX:"center",originY:"top",left:t,top:n},icon:{left:t,topY:n,originX:"center",originY:"top",origin:{type:e.type,dataIndex:a},...S.event}},"vertical");n+=r.height+l.height+15,(c=l).on("moving",(()=>{c.set("originY","center"),H(c)?(ue(c),de(c)):P.show=!1})),c.on("mouseup:before",(e=>{if(P.show=!1,0===e.e.button&&H(c))if(M([...le],c.left,"key").includes(c.origin.key))Y("repeat");else{const e={data:{time:A(c.left),value:L(c.origin.key,c.top)},...c.origin};C("add",e),ae(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(c)})),i.push(r,l)}var c})),o(i),x.value.add(...i)}function o(e){const t=k(e),o=(B-W)/2,n=(t.height+t.top-W)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t($,R/2),t(q,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(C("remove",o),ae(o,"remove")):(Object.assign(o,{data:{time:A(e.pointer.x),value:L(e.origin.key,e.pointer.y)}}),C("add",o),ae(o))},redrawPoints:ce}}export{x as useBirthProcess};
|
@@ -1 +1 @@
|
|
1
|
-
import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as r}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as u}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useBirthProcess as i}from"./useBirthProcess.js";function n(n,d,s,o,v,c){const h=e({select:null,redrawPoints:null,clickMenu:null}),m=a((()=>d.data.scaleValues.map((e=>{var a;return{...e,width:null!=(a=e.width)?a:60}})).filter((({layout:e="left",show:a=!0})=>"left"===e&&a)))),
|
1
|
+
import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as r}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as u}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useBirthProcess as i}from"./useBirthProcess.js";function n(n,d,s,o,v,c){const h=e({select:null,redrawPoints:null,clickMenu:null}),m=a((()=>d.data.scaleValues.map((e=>{var a;return{...e,width:null!=(a=e.width)?a:60}})).filter((({layout:e="left",show:a=!0})=>"left"===e&&a)))),p=a((()=>d.data.scaleValues.map((e=>{var a;return{...e,width:null!=(a=e.width)?a:60}})).filter((({layout:e="left",show:a=!0})=>"right"===e&&a)))),f=a((()=>{var e;return(null==(e=p.value)?void 0:e.length)?30:0})),g=a((()=>{var e;return 30+(null==(e=m.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),w=a((()=>{var e;const{width:a}=d.data,t=null==(e=p.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-f.value-t})),x=a((()=>d.data.grid.mainXCell)),y=a((()=>{const e=d.data.grid.mainYCell||14;return d.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),V=a((()=>(w.value-g.value)/x.value)),b=a((()=>{const e=d.data.padding||[5,5],a=B("top"),t=B("bottom");return[a?0:e[0],t?0:e[1]]})),k=a((()=>{const{height:e}=d.data,a=B();return(e-b.value.reduce(((e,a)=>e+a),0))/(y.value+a)})),C=a((()=>{const e=B("top");return k.value*e+b.value[0]})),j=a((()=>{var e;const{scaleValues:a}=d.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!C.value)return C.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],r=(null==t?void 0:t.spaceValue)||1;return A.value-b.value[0]-l*r*k.value})),A=a((()=>{const{height:e}=d.data,a=B("bottom");return e-k.value*a-b.value[1]})),Y=a((()=>u(d.data.xAxis.time.startTime))),S=a((()=>36e5/V.value)),H=a((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"cervix"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),P=a((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"FHR"===e.key));return k.value/((null==a?void 0:a.spaceValue)||10)})),R=a((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"fetalPresentation"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),X=a((()=>{var e;return(null==(e=d.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}}));function B(e){const{xAxis:a}=d.data;return Object.values(a).reduce(((a,t)=>(t.show&&(!e||e&&t.position===e)&&a++,a)),0)}const F=e({canvasWidth:d.data.width,canvasHeight:d.data.height,borderStyle:{...r,...d.data.borderStyle||{}},selectionStyle:d.data.selectionStyle||{},grid:d.data.grid,other:d.data.other,originX:g.value,endX:w.value,originY:C.value,endY:A.value,xCellWidth:V.value,yCellHeight:k.value,gridXNumber:x.value,gridYNumber:y.value,xAxis:d.data.xAxis,leftScales:m.value,rightScales:p.value,leftAddAreaWidth:30,rightAddAreaWidth:f.value,startTime:Y.value,timeXCell:S.value,cervixYCell:H.value,FHRYCell:P.value,fetalPresentationYCell:R.value,scaleValues:d.data.scaleValues,event:X.value,originYCervix:j.value,scalebarBorder:!Reflect.has(d.data,"scalebarBorder")||d.data.scalebarBorder,padding:b.value});return t((()=>n.value),(e=>{e&&function(){const{clickMenu:e,redrawPoints:a}=i(n,F,s,v,c);h.redrawPoints=a,h.clickMenu=e}()}),{immediate:!0}),{propItems:F,...l(h)}}export{n as useBirthProcessChart};
|