cnhis-design-vue 3.2.3-beta.16 → 3.2.3-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/biunique-chat/index.d.ts +24 -3
- package/es/components/biunique-chat/src/Index.vue.d.ts +24 -3
- package/es/components/biunique-chat/src/Index.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/ChatMain.vue.d.ts +10 -3
- package/es/components/biunique-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/MessageTemplate.vue.d.ts +2 -1
- package/es/components/biunique-chat/src/components/MessageTemplate.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/SiderList.vue2.js +1 -1
- package/es/components/biunique-chat/src/hooks/useScrollLoading.d.ts +2 -0
- package/es/components/biunique-chat/src/hooks/useScrollLoading.js +1 -0
- package/es/components/biunique-chat/src/hooks/useSession.d.ts +1 -0
- package/es/components/biunique-chat/src/hooks/useSession.js +1 -1
- package/es/components/biunique-chat/src/hooks/useState.js +1 -1
- package/es/components/biunique-chat/src/utils/index.d.ts +1 -1
- package/es/components/biunique-chat/src/utils/index.js +1 -1
- package/es/components/biunique-chat/style/index.css +1 -1
- package/es/components/button-print/index.d.ts +5 -2
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +5 -2
- package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
- package/es/components/button-print/src/utils/print.d.ts +2 -2
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/calendar/index.d.ts +11 -2
- package/es/components/calendar/src/Calendar.vue.d.ts +11 -1
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
- package/es/components/classification/src/index.vue.d.ts +0 -3
- package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
- package/es/components/field-set/src/FieldColor.vue.d.ts +2 -2
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/field-set/src/components/Row.vue.d.ts +1 -1
- package/es/components/field-set/src/components/edit-dialog.vue.d.ts +1 -1
- package/es/components/guide/src/renderer.d.ts +2 -2
- package/es/components/index.css +1 -1
- package/es/components/scale-view/src/components/formitem/standard-modal.d.ts +1 -1
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
- package/es/components/node_modules/naive-ui/node_modules/date-fns/docs/logo.svg +0 -26
- package/es/components/node_modules/naive-ui/node_modules/date-fns/docs/logotype.svg +0 -1
|
@@ -179,9 +179,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
179
179
|
}>> & {
|
|
180
180
|
onError?: ((...args: any[]) => any) | undefined;
|
|
181
181
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
182
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
182
183
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
|
183
184
|
}>>;
|
|
184
|
-
emit: (event: "success" | "error" | "clickoutside", ...args: any[]) => void;
|
|
185
|
+
emit: (event: "success" | "error" | "cancel" | "clickoutside", ...args: any[]) => void;
|
|
185
186
|
defaultFormatInfo: import("../../shared/types").AnyObject;
|
|
186
187
|
authorizationKey: import("vue").Ref<string>;
|
|
187
188
|
state: {
|
|
@@ -206,6 +207,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
206
207
|
renderLabel: (option: import("../../shared/types").AnyObject) => JSX.Element;
|
|
207
208
|
callLocalServicesSuccessCb: (res: any, type: any) => void;
|
|
208
209
|
callLocalServicesErrorCb: (res: unknown) => void;
|
|
210
|
+
callLocalServicesCancelCb: (res: unknown) => void;
|
|
209
211
|
prevFnError: (type: string) => void;
|
|
210
212
|
getPrintParams: (index?: number) => string;
|
|
211
213
|
getOnceParams: () => string;
|
|
@@ -1865,7 +1867,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1865
1867
|
verifyUser: Function;
|
|
1866
1868
|
identityVerificationTitle: string;
|
|
1867
1869
|
}>;
|
|
1868
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "clickoutside")[], "success" | "error" | "clickoutside", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1870
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside")[], "success" | "error" | "cancel" | "clickoutside", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1869
1871
|
printParams: {
|
|
1870
1872
|
type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
|
|
1871
1873
|
};
|
|
@@ -1953,6 +1955,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1953
1955
|
}>> & {
|
|
1954
1956
|
onError?: ((...args: any[]) => any) | undefined;
|
|
1955
1957
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
1958
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
1956
1959
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
|
1957
1960
|
}, {
|
|
1958
1961
|
params: import("../../shared/types").AnyObject[];
|
|
@@ -186,9 +186,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
186
186
|
}>> & {
|
|
187
187
|
onError?: ((...args: any[]) => any) | undefined;
|
|
188
188
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
189
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
189
190
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
|
190
191
|
}>>;
|
|
191
|
-
emit: (event: "success" | "error" | "clickoutside", ...args: any[]) => void;
|
|
192
|
+
emit: (event: "success" | "error" | "cancel" | "clickoutside", ...args: any[]) => void;
|
|
192
193
|
defaultFormatInfo: AnyObject;
|
|
193
194
|
authorizationKey: import("vue").Ref<string>;
|
|
194
195
|
state: {
|
|
@@ -213,6 +214,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
213
214
|
renderLabel: (option: AnyObject) => JSX.Element;
|
|
214
215
|
callLocalServicesSuccessCb: (res: any, type: any) => void;
|
|
215
216
|
callLocalServicesErrorCb: (res: unknown) => void;
|
|
217
|
+
callLocalServicesCancelCb: (res: unknown) => void;
|
|
216
218
|
prevFnError: (type: string) => void;
|
|
217
219
|
getPrintParams: (index?: number) => string;
|
|
218
220
|
getOnceParams: () => string;
|
|
@@ -1872,7 +1874,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1872
1874
|
verifyUser: Function;
|
|
1873
1875
|
identityVerificationTitle: string;
|
|
1874
1876
|
}>;
|
|
1875
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "clickoutside")[], "success" | "error" | "clickoutside", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1877
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside")[], "success" | "error" | "cancel" | "clickoutside", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1876
1878
|
printParams: {
|
|
1877
1879
|
type: PropType<AnyObject[]>;
|
|
1878
1880
|
};
|
|
@@ -1963,6 +1965,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1963
1965
|
}>> & {
|
|
1964
1966
|
onError?: ((...args: any[]) => any) | undefined;
|
|
1965
1967
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
1968
|
+
onCancel?: ((...args: any[]) => any) | undefined;
|
|
1966
1969
|
onClickoutside?: ((...args: any[]) => any) | undefined;
|
|
1967
1970
|
}, {
|
|
1968
1971
|
params: AnyObject[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as t,ref as e,reactive as n,computed as i,onMounted as a,watch as r,openBlock as o,createElementBlock as s,Fragment as l,createVNode as d,unref as p,withCtx as u,renderSlot as m,withModifiers as c,createTextVNode as f,toDisplayString as v,mergeProps as y}from"vue";import{isObject as g}from"@vue/shared";import{useMessage as b,NDropdown as h,NButton as I,NIcon as P}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as k}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as S}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as O}from"./api.js";var j=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]}},emits:["success","error","clickoutside"],setup(t,{expose:j,emit:L}){var E;const D=t,M=b();let N;const V={},B=e(""),C=n({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let R=e([{label:D.printText,key:"printText"},{label:D.previewText,key:"previewText"},{label:D.pdfLoadText,key:"downloadPdf"},{label:D.formatEditText,key:"formatEditText"},...(null==(E=D.externalOptionConfig)?void 0:E.options)||[]]);const z=i((()=>{if(!C.currentFormatId)return{};let t=C.currentFormatId;return C.formatList.find((e=>e.id===t))})),A=i((()=>{var t;return(null==(t=z.value)?void 0:t.name)||"格式选择"})),J=i((()=>{let t=C.formatList.find((t=>t.id===C.currentFormatId));return null==t?void 0:t.templateId})),U=async t=>{if(D.directPrint){if(C.spinning)return;return"button"===t?void await
|
|
1
|
+
import{defineComponent as t,ref as e,reactive as n,computed as i,onMounted as a,watch as r,openBlock as o,createElementBlock as s,Fragment as l,createVNode as d,unref as p,withCtx as u,renderSlot as m,withModifiers as c,createTextVNode as f,toDisplayString as v,mergeProps as y}from"vue";import{isObject as g}from"@vue/shared";import{useMessage as b,NDropdown as h,NButton as I,NIcon as P}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as k}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as S}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as O}from"./api.js";var j=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]}},emits:["success","error","cancel","clickoutside"],setup(t,{expose:j,emit:L}){var E;const D=t,M=b();let N;const V={},B=e(""),C=n({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let R=e([{label:D.printText,key:"printText"},{label:D.previewText,key:"previewText"},{label:D.pdfLoadText,key:"downloadPdf"},{label:D.formatEditText,key:"formatEditText"},...(null==(E=D.externalOptionConfig)?void 0:E.options)||[]]);const z=i((()=>{if(!C.currentFormatId)return{};let t=C.currentFormatId;return C.formatList.find((e=>e.id===t))})),A=i((()=>{var t;return(null==(t=z.value)?void 0:t.name)||"格式选择"})),J=i((()=>{let t=C.formatList.find((t=>t.id===C.currentFormatId));return null==t?void 0:t.templateId})),U=async t=>{if(D.directPrint){if(C.spinning)return;return"button"===t?void await st():at()}return at()},q=t=>d("span",{class:{active:t.key===C.currentFormatId}},[t.label]),K=(t,e)=>{C.spinning=!1;let n={type:e,formatId:C.currentFormatId,templateId:J.value};L("success",t,n)},_=t=>{C.spinning=!1,L("error",t),g(t)&&"notInstalledApp"===t.type&&M.error(t.message)},G=t=>{C.spinning=!1,L("cancel",t)},H=t=>{L("error",{message:"前置条件执行错误",type:t,preExecution:!0})},Y=(t=0)=>{var e;const n=(null==(e=D.printParams)?void 0:e.length)?D.printParams[t]:C.printParams[t];return JSON.stringify({...n||{},...D.token?{token:D.token}:{}})},$=()=>{var t,e;let n={},i={};if(null==(t=C.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(C.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(C.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(C.printParams[0]).forEach((t=>{i[t]=[],C.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(Y(0)),i),JSON.stringify(n)},Q=()=>{let t=C.printParams.length;const e=async e=>{try{--t<=0&&K(e,"print")}catch(t){console.log("error",t)}};D.showLoading&&C.spinning||(C.spinning=!0,D.prevFn("print").then((()=>{const t={formatId:C.currentFormatId,templateId:J.value,authorizationKey:B.value,printdlgshow:D.printdlgshow,signature:D.signature};if("MULTI"===D.strategy)for(let n=0;n<C.printParams.length;n++)n>0&&(t.printdlgshow="0"),N.printDirect({...t,params:Y(n)},e,_,G);else N.printDirect({...t,params:$()},(t=>{K(t,"print")}),_,G)})).catch((()=>{H("print"),C.spinning=!1})).finally((()=>{C.visible=!1})))},W=async(t,e)=>{var n,i;switch(t){case"printText":Q();break;case"previewText":(async()=>{D.showLoading&&C.spinning||(C.spinning=!0,D.prevFn("preview").then((()=>{const t="MULTI"===D.strategy?Y():$(),e={formatId:C.currentFormatId,templateId:J.value,authorizationKey:B.value,params:t,btnprint:D.btnprint,signature:D.signature};N.preview(e,(t=>{K(t,"preview")}),_)})).catch((()=>{H("preview"),C.spinning=!1})).finally((()=>{C.visible=!1})))})();break;case"formatEditText":D.showLoading&&C.spinning||(C.spinning=!0,D.prevFn("edit").then((()=>{C.identityVerification.visible=!0})).catch((()=>{H("edit")})).finally((()=>{C.visible=!1,C.spinning=!1})));break;case"downloadPdf":(async()=>{D.showLoading&&C.spinning||(C.spinning=!0,D.prevFn("download").then((()=>{const t="MULTI"===D.strategy?Y():$(),e={formatId:C.currentFormatId,templateId:J.value,authorizationKey:B.value,print:{print:"1",type:"1"},params:t,signature:D.signature};N.downloadPDF(e,(t=>K(t,"preview")),_)})).catch((()=>{H("download"),C.spinning=!1})).finally((()=>{C.visible=!1})))})();break;default:{C.visible=!1;const a=C.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){C.currentFormatId=t;const[e]=R.value;e.label=(null==a?void 0:a.name)||e.label,await x({formatForms:[{...a}],name:V.name||a.templateName,number:V.number||a.number,templateId:V.templateId||a.templateId,...V.id?{id:V.id}:{}},{token:D.token})}else null==(i=null==(n=D.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},X=()=>{C.visible=!1,L("clickoutside")},Z=()=>(C.isInited=!1,C.spinning=!1,setTimeout((()=>{C.visible=!1}),0),!1),tt=(t,e,n)=>{const i={};return e.forEach((e=>{let a=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=S(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},et=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(tt(n,e,"fieldName"))}})),i=Object.assign({},i,tt(n,e,"key")),i})),nt=async t=>{var e;if(C.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],C.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";const{data:i}=await O({templateId:t[0].templateId},{token:D.token});if("SUCCESS"===i.result){const{formatForms:e=[]}=i.map||{};Object.assign(V,i.map||{});const a=null==(n=null==e?void 0:e[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}const a=t.find((t=>1==t[e]));return(null==a?void 0:a.id)||t[0].id})(C.formatList,"defaultFlag"),!C.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),Z();(()=>{var t;const e=C.formatList.map((t=>({label:t.name,key:t.id})));R.value.unshift({label:A.value,key:"format",children:e}),D.hideButtons.length>0&&(R.value=R.value.filter((t=>!D.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),i=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},a=Object.keys(i);a.includes("RY7.2.21.1.M2.G94181E")||(R.value=R.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(R.value=R.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await D.queryTemplateParams())?void 0:e.obj;if(!n||!J.value)return M.error("获取打印模板失败,请联系管理员!"),Z();C.templateParams=n,C.printParams=et(C.templateParams,D.params)},it=async()=>{var t;if(C.isInited)return!0;C.isInited=!0,C.spinning=!0,(()=>{if(N)return!1;N=new k})();const e=await D.queryPrintFormatByNumber();return await nt(e),(null==(t=e.obj)?void 0:t.length)>0&&(B.value=e.obj[0].authorizationKey||""),C.spinning=!1,!0},at=async(t=!0)=>{var e,n;if(await D.clickPrevFn())if((null==(e=D.params)?void 0:e.length)||(null==(n=D.printParams)?void 0:n.length)){if(!C.visible){if(!await it())return!1}t&&(C.visible=!C.visible)}else M.warning(D.noDataMsg)},rt=()=>{C.watchPrintParamsReformatFn&&C.watchPrintParamsReformatFn(),C.isInited?C.printParams=et(C.templateParams,D.params):C.watchPrintParamsReformatFn=()=>r((()=>C.isInited),(t=>{if(!t)return!1;rt()}))},ot=t=>{if(C.identityVerification.visible=!1,F(C.currentFormatId))return K(null,"edit");const e={formatId:C.currentFormatId,templateId:J.value,params:Y(),token:t};N.editPrintFormat(e,(t=>{K(t,"edit")}),_)};async function st(){await at(!1),Q()}return a((()=>{C.isInited=!1})),r((()=>D.params),(t=>{if(!(null==t?void 0:t.length))return!1;rt()}),{deep:!0}),j({directPrint:st}),(e,n)=>(o(),s(l,null,[d(p(h),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:C.visible,onClickoutside:X,options:p(R),onSelect:W,"render-label":q},{default:u((()=>[m(e.$slots,"button",{handleClickPrintBtn:at,printSpinning:C.spinning,printbtnText:t.btnText,printVisible:C.visible},(()=>[d(p(I),{class:"dropdown-button",loading:t.showLoading&&C.spinning,onClick:n[1]||(n[1]=c((()=>U("button")),["stop"]))},{default:u((()=>[f(v(t.btnText)+" ",1),d(p(P),{component:p(w),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=c((()=>U("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),d(T,y(e.$attrs,{modelValue:C.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>C.identityVerification.visible=t),formatId:C.currentFormatId,templateId:p(J),onSuccess:ot}),null,16,["modelValue","formatId","templateId"])],64))}});export{j as default};
|
|
@@ -38,7 +38,7 @@ export declare class Print {
|
|
|
38
38
|
_queryBase64ServicesPrint(params: AnyObject): Promise<any>;
|
|
39
39
|
_callPrintWithFile(queryParams: AnyObject): Promise<any>;
|
|
40
40
|
_handleMonitorNotify(message: string | unknown): void;
|
|
41
|
-
_handleResult(data: AnyObject, errorCallbackFn?: AnyFn): false | AnyObject;
|
|
41
|
+
_handleResult(data: AnyObject, errorCallbackFn?: AnyFn, cancelCallbackFn?: AnyFn): false | AnyObject;
|
|
42
42
|
_handleResultTest(result: unknown, errorCallbackFn?: AnyFn): boolean;
|
|
43
43
|
_handleEventQueryPrintData(templateId: string, formatId: string, params: AnyObject, messageTimeout: number, errorCallbackFn?: AnyFn): Promise<false | {
|
|
44
44
|
file: any;
|
|
@@ -64,7 +64,7 @@ export declare class Print {
|
|
|
64
64
|
_base64ToBlob(fileBase64: string, fileType: string): Blob;
|
|
65
65
|
preview({ templateId, formatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
|
|
66
66
|
printSync(data: AnyObject[], successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<void>;
|
|
67
|
-
printDirect({ templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, mode?: string): Promise<any>;
|
|
67
|
+
printDirect({ templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<any>;
|
|
68
68
|
private _downloadPDF;
|
|
69
69
|
/**
|
|
70
70
|
* 下载pdf
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const m=String(navigator.platform).toLowerCase().includes("linux"),d=t.create({timeout:6e4,withCredentials:!1}),p=`${window.location.protocol}//${window.location.host}`,u=`${p}/fdp-api/print/assembly/printIReport`,f=`${p}/bi-api/reprot/print/open/client/printIReportForBase64`,g=`${p}/bi-api/reprot/print/open/client/previewIReport`,w=`${p}/bi-api/reprot/print/open/client/getRemote`,y=`${p}/printService/file`;let P=null;class v{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.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._isHiprint=!1,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this,m&&this._isHiprint&&this._initDomesticSystem();const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{reconnectionAttempts:3,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",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(t){console.log("hiprint系统连接失败",t)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({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)}))}))}_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}}):d({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const s={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(s),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,printdlgshow:o="0",nobillnode:l="1",btnprint:h="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:l,printdlgshow:o,btnprint:h,messageTimeout:m,...a?{signature:a}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=p+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:u,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:g,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${y}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},d,p){const u=a(e);if(e=this.getIReportFormatId(u,e),u&&m&&this._isHiprint){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==p?void 0:p("获取文件失败!");const a=n(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==d?void 0:d({file:s})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,p))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:l,btnprint:c,messageTimeout:h}),n=this._handleResult(r,p);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==d||d(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==p||p(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,print:n,signature:o,printdlgshow:l,nobillnode:c,isDownloadFile:h=!0,messageTimeout:d=0},p,u,f="printDirect"){const g=a(e);if(e=this.getIReportFormatId(g,e),g&&m&&this._isHiprint){if(!this.isConnectHiPrint)return void u({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return u({message:s.resultMsg});const{base64:n,formatId:a}=s.map;return this.base64Fragment=n,this._successCallbackFn=p,this._errorCallbackFn=u,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const w=await this._testConnection();if(!this._handleResultTest(w,u))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,messageTimeout:d}),a=this._handleResult(r,u);if(!a)return!1;h&&["downloadPDF"].includes(f)&&await this._browserPrint(a,f),null==p||p(a)}catch(t){const e="printDirect"===f?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==u||u(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&m&&this._isHiprint){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v as Print};
|
|
1
|
+
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const m=String(navigator.platform).toLowerCase().includes("linux"),d=t.create({timeout:6e4,withCredentials:!1}),p=`${window.location.protocol}//${window.location.host}`,u=`${p}/fdp-api/print/assembly/printIReport`,f=`${p}/bi-api/reprot/print/open/client/printIReportForBase64`,g=`${p}/bi-api/reprot/print/open/client/previewIReport`,w=`${p}/bi-api/reprot/print/open/client/getRemote`,y=`${p}/printService/file`;let P=null;class v{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.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._isHiprint=!1,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this,m&&this._isHiprint&&this._initDomesticSystem();const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{reconnectionAttempts:3,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",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(t){console.log("hiprint系统连接失败",t)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({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)}))}))}_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}}):d({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,printdlgshow:o="0",nobillnode:l="1",btnprint:h="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:l,printdlgshow:o,btnprint:h,messageTimeout:m,...a?{signature:a}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=p+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:u,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:g,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${y}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},d,p){const u=a(e);if(e=this.getIReportFormatId(u,e),u&&m&&this._isHiprint){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==p?void 0:p("获取文件失败!");const a=n(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==d?void 0:d({file:s})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,p))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:l,btnprint:c,messageTimeout:h}),n=this._handleResult(r,p);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==d||d(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==p||p(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,print:n,signature:o,printdlgshow:l,nobillnode:c,isDownloadFile:h=!0,messageTimeout:d=0},p,u,f,g="printDirect"){const w=a(e);if(e=this.getIReportFormatId(w,e),w&&m&&this._isHiprint){if(!this.isConnectHiPrint)return void u({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return u({message:s.resultMsg});const{base64:n,formatId:a}=s.map;return this.base64Fragment=n,this._successCallbackFn=p,this._errorCallbackFn=u,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const y=await this._testConnection();if(!this._handleResultTest(y,u))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,messageTimeout:d}),a=this._handleResult(r,u,f);if(!a)return!1;h&&["downloadPDF"].includes(g)&&await this._browserPrint(a,g),null==p||p(a)}catch(t){const e="printDirect"===g?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==u||u(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&m&&this._isHiprint){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v as Print};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="date-fns" />
|
|
2
|
-
/// <reference types="../../components/node_modules/naive-ui/node_modules/date-fns/typings" />
|
|
3
2
|
import { SFCWithInstall } from '../../shared/types';
|
|
4
3
|
export * from './src/types';
|
|
5
4
|
declare const Calendar: SFCWithInstall<import("vue").DefineComponent<{
|
|
@@ -229,7 +228,17 @@ declare const Calendar: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
229
228
|
NIcon: any;
|
|
230
229
|
ChevronBackOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
231
230
|
ChevronForwardOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
232
|
-
FullCalendar:
|
|
231
|
+
FullCalendar: import("vue").DefineComponent<{
|
|
232
|
+
options: import("vue").PropType<import("@fullcalendar/core/internal-common").a>;
|
|
233
|
+
}, unknown, {
|
|
234
|
+
renderId: number;
|
|
235
|
+
customRenderingMap: Map<string, import("@fullcalendar/core/internal-common").eF<any>>;
|
|
236
|
+
}, {}, {
|
|
237
|
+
getApi(): import("@fullcalendar/core").Calendar;
|
|
238
|
+
buildOptions(suppliedOptions: import("@fullcalendar/core/internal-common").a | undefined): import("@fullcalendar/core/internal-common").a;
|
|
239
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
240
|
+
options: import("vue").PropType<import("@fullcalendar/core/internal-common").a>;
|
|
241
|
+
}>>, {}>;
|
|
233
242
|
isSameDay: typeof import("date-fns").isSameDay;
|
|
234
243
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange")[], "select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
235
244
|
showDateNavigation: {
|
|
@@ -221,7 +221,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
221
221
|
NIcon: any;
|
|
222
222
|
ChevronBackOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
223
223
|
ChevronForwardOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
224
|
-
FullCalendar:
|
|
224
|
+
FullCalendar: import("vue").DefineComponent<{
|
|
225
|
+
options: PropType<import("@fullcalendar/core/internal-common").a>;
|
|
226
|
+
}, unknown, {
|
|
227
|
+
renderId: number;
|
|
228
|
+
customRenderingMap: Map<string, import("@fullcalendar/core/internal-common").eF<any>>;
|
|
229
|
+
}, {}, {
|
|
230
|
+
getApi(): import("@fullcalendar/core").Calendar;
|
|
231
|
+
buildOptions(suppliedOptions: import("@fullcalendar/core/internal-common").a | undefined): import("@fullcalendar/core/internal-common").a;
|
|
232
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
233
|
+
options: PropType<import("@fullcalendar/core/internal-common").a>;
|
|
234
|
+
}>>, {}>;
|
|
225
235
|
isSameDay: typeof isSameDay;
|
|
226
236
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange")[], "select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
227
237
|
showDateNavigation: {
|
|
@@ -699,9 +699,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
699
699
|
handleInitConditions: () => Promise<void>;
|
|
700
700
|
validate: () => Promise<unknown>;
|
|
701
701
|
saveAdd: () => void;
|
|
702
|
-
/**
|
|
703
|
-
* 改变展示方式
|
|
704
|
-
*/
|
|
705
702
|
cancelSaveAdd: () => void;
|
|
706
703
|
checkActionList: () => boolean;
|
|
707
704
|
NSpin: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as s,drawScaleNumber as a,drawScaleLine as u}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import{isEffectiveNode as
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as s,drawScaleNumber as a,drawScaleLine as u}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import{isEffectiveNode as f,getTime as h,getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as p}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function m(m,v,g,x,y){const{computedX:b,computedY:w,getXValue:S,getYValue:E}=l(v),{getEqualXTypes:L,handleAddPrevent:j,isGridLimit:k,setPrevAndNextPoint:X,getPointEventProps:P}=c(m,g,v),{xAxis:A,grid:C,originX:T,originY:G,xCellWidth:Y,endY:N,startTime:V,leftScales:H,rightScales:M,yCellHeight:$,endX:B,scaleValues:W,canvasWidth:q,borderStyle:z,event:D,other:F,timeXAxisHeight:I,canvasHeight:R,extraTimeXAxisList:J}=v,K=p(W),O=new Set;function Q(){K.filter((t=>t.show)).forEach(((t,r)=>{var l;const s=[],a=[],u=[];null==(l=t.data)||l.forEach(((l,c)=>{!function(l,c,f){if(!l)return;let h,d;const{pointAttr:p={},lineAttr:m={},title:v="",key:g,type:y="circle",childbirthStyle:b={}}=t,w=t.data[f+1],L=Z(w,t);if(l&&L&&!c.breakpoint)d=U([...l,...L],m);else if(l&&!L&&!c.breakpoint){const e=Z(w,t);d=e?U([...l,...e],m):null}if(c.childbirth){const t=l[0]+Y,n=l[1]+$/2,o=U([l[0],l[1],t,n],m);u.push(o);const r=e([t,n],{value:String(c.childbirth),...i,...b,backgroundColor:"#fff"});u.push(r)}const j=a[f-1],k={origin:{data:c,title:v,key:g||"",dataIndex:r,index:f},leftLine:j,rightLine:d,...p,...P(),...n};l&&(j||(k.leftLine=null),h=o(y,{left:l[0],top:l[1],...k}));a.push(d),h&&(!function(t){D.hovered&&(t.on("mouseover",(()=>{!function(t,e="moving"){const{title:i,key:n,data:o}=t.origin;x.point={x:t.left,y:t.top},x.list=[`${i} ${"hover"===e?o.value:E(n,t.top)}`,`时间 ${S(t.left).slice(-5)}`],x.show=!0}(t,"hover")})),t.on("mouseout",(()=>{x.show=!1})))}(h),s.push(h),O.add(h))}(Z(l,t),l,c)})),Promise.all(s).then((t=>{const e=a.filter((t=>t));X(t),Promise.all(u).then((i=>{m.value.add(...e,...t,...i),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function U([e,i,o,r],l){return new t.Polyline([{x:e,y:i},{x:o,y:i},{x:o,y:r}],{...l,fill:"transparent",...n})}function Z(t,e){if(f(t)&&function(t){const e=V+864e5,i=h(t);return i>=V&&i<=e}(t.time)){const i=b(t.time),n=w(e.key,e.range,t.value);return[i,n<G?G:n>N?N:n]}}return r(m,v),function(){const e=new t.Rect({...z,width:B-T,height:N-G,left:T,top:G,fill:"transparent"});m.value.add(e)}(),function(){function o(o,r="left"){const l=10;let c="left"===r?0:B;o.forEach(((o,r)=>{const{range:f,spaceValue:h,width:p,title:v,titleStyle:g,unit:x,key:y,position:b="center",spaceGridNumber:w=1,showNumber:S,showMaxMinNumber:E}=o,L=[],j=[],k=d(f,h),X=k.length,{lineXMain:P,lineXSub:A,textLeft:C}=s(b,c,p);k.forEach(((t,e)=>{const i=N-e*$*w;!S||(0===e||e===X-1)&&!E||L.push(a(String(t),o,C,i)),j.push(...u(o,e,P,A,i,$,G,X))}));const T=e([c+l,G+(N-G)/2],{value:String(v+"("+x+")"),...i,originX:"center",angle:-90,...g}),Y=new t.Group([...j,...L,...T?[T]:[]],{objectCaching:!1,...n});m.value.add(Y),Y.sendToBack(),c+=p}))}o(H),o(M,"right")}(),function(){const{show:o,range:r=[0,20],position:l="top",style:s,spaceGridNumber:a=2,spaceValue:u=2}=A.time;if(o){const o=[],c=$/2;d(r,u).forEach(((t,n)=>{const r="top"===l?G-c:N+I+c;o.push(e([T+n*Y*a,r],{value:0===n?"Admission":String(t),...i,...s}))}));const f=new t.Group(o,{objectCaching:!1,...n});m.value.add(f),m.value.sendToBack(f)}!function(){if((null==J?void 0:J.length)>0){const t=[];J.forEach((n=>{const o=b(n),r=N+I;t.push(e([o,r],{value:String(n.slice(11,16)),...i,originY:"bottom"}))})),m.value.add(...t)}}()}(),function(){const{alertLineList:t=[],alertLineTitle:n="入院时宫颈扩张不同情况"}=F;if(t.length<1)return;const o=e([B,0],{value:n,...i,originX:"right",originY:"top"});m.value.add(o),t.forEach((t=>{const{style:i,data:n=[]}=t;if(n.length<1)return;const o=[],r=K.find((t=>"cervix"===t.key));n.map((t=>({...t,time:V+60*t.time*60*1e3}))).forEach(((t,n,l)=>{const s=Z(t,r),a=Z(l[n+1],r);s&&!a&&o.push(e([s[0],G-10],{value:l[0].value+(r.unit||"cm"),fill:i.stroke||"#000"})),s&&a&&o.push(U([...s,...a],i))})),m.value.add(...o)}))}(),Q(),{redrawPoints:function(){var t;O.size&&(null==(t=m.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine)})),e}([...O]))),O.clear(),Q()}}}export{m as useNewBirthProcess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as r}from"date-fns";import{getTime as u}from"../../utils/index.js";import{range as s}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";import{useNewBirthProcess as
|
|
1
|
+
import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as r}from"date-fns";import{getTime as u}from"../../utils/index.js";import{range as s,last as n}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";import{useNewBirthProcess as o}from"./useNewBirthProcess.js";function d(d,v,c,m,h,x){const p=e(),g=e(),f=e(),w=a((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),b=a((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=a((()=>{var e;return null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0)})),j=a((()=>{var e;const{width:a}=v.data;return a-((null==(e=b.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))||15)})),A=a((()=>v.data.grid.mainXCell||20)),M=a((()=>v.data.grid.mainYCell||8)),S=a((()=>(j.value-y.value)/A.value)),V=a((()=>{var e;const{xAxis:a,height:t,other:l}=v.data,i=Object.values(a).reduce(((e,a)=>(a.show&&e++,e)),0),r=(null!=(e=null==l?void 0:l.alertLineList.length)?e:0)>0;return(t-H.value)/(M.value+i+(r?1:0))})),X=a((()=>{var e;const{xAxis:a,other:t}=v.data,l=Object.values(a).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0),i=(null!=(e=null==t?void 0:t.alertLineList.length)?e:0)>0;return V.value*(l||i?1:0)})),C=a((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-V.value*t-H.value})),H=a((()=>{const e=w.value.concat(b.value);return(null==e?void 0:e.length)>0?20:0})),L=a((()=>u(v.data.xAxis.time.startTime))),Y=a((()=>{const{spaceValue:e,spaceGridNumber:a}=v.data.xAxis.time||{};return 60*e*60*1e3/(S.value*a)})),N=a((()=>{var e,a,t;const l=null==(t=null==(a=null==(e=w.value.concat(b.value))?void 0:e[0])?void 0:a.data)?void 0:t.map((e=>u(e.time))),i=Math.min(...l);let o=Math.min(Math.max(...l));const d=Y.value*S.value,v=s(1,A.value+1).reduce(((e,a,t)=>e.concat(L.value+a*d)),[L.value]);o=Math.min(o,n(v));const c=v.findIndex((e=>Math.abs(e-i)<d)),m=v.findIndex((e=>Math.abs(e-o)<d))+1;return v.filter(((e,a)=>a>=c&&a<=m)).map((e=>r(new Date(e),"yyyy-MM-dd HH:mm:ss")))})),I=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return V.value/((null==a?void 0:a.spaceValue)||1)})),O=a((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),P=t({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...i,...v.data.borderStyle||{}},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:y.value,endX:j.value,originY:X.value,endY:C.value,xCellWidth:S.value,yCellHeight:V.value,gridXNumber:A.value,gridYNumber:M.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:b.value,startTime:L.value,timeXCell:Y.value,cervixYCell:I.value,scaleValues:v.data.scaleValues,timeXAxisHeight:H.value,extraTimeXAxisList:N.value,event:O.value});return l((()=>d.value),(e=>{e&&function(){const{redrawPoints:e}=o(d,P,c,h);g.value=e}()}),{immediate:!0}),{propItems:P,redrawPoints:g,select:p,clickMenu:f}}export{d as useNewBirthProcessChart};
|
|
@@ -457,9 +457,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
457
457
|
requiredDisable: boolean;
|
|
458
458
|
hide: boolean;
|
|
459
459
|
}>;
|
|
460
|
-
isHighlightRow: boolean;
|
|
461
460
|
idx: number;
|
|
462
461
|
isHighlight: boolean;
|
|
462
|
+
isHighlightRow: boolean;
|
|
463
463
|
}>;
|
|
464
464
|
EditDialog: import("vue").DefineComponent<{
|
|
465
465
|
visible: {
|
|
@@ -504,7 +504,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
504
504
|
formRef: import("vue").Ref<any>;
|
|
505
505
|
conditionRef: import("vue").Ref<any>;
|
|
506
506
|
filterVisible: import("vue").Ref<boolean>;
|
|
507
|
-
title: import("vue").ComputedRef<"
|
|
507
|
+
title: import("vue").ComputedRef<"修改" | "新增" | "过滤条件">;
|
|
508
508
|
model: {
|
|
509
509
|
name: string;
|
|
510
510
|
color: string;
|
|
@@ -575,9 +575,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
575
575
|
requiredDisable: boolean;
|
|
576
576
|
hide: boolean;
|
|
577
577
|
}>;
|
|
578
|
-
isHighlightRow: boolean;
|
|
579
578
|
idx: number;
|
|
580
579
|
isHighlight: boolean;
|
|
580
|
+
isHighlightRow: boolean;
|
|
581
581
|
}>;
|
|
582
582
|
isArray: {
|
|
583
583
|
(value?: any): value is any[];
|
|
@@ -282,8 +282,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
282
282
|
requiredDisable: boolean;
|
|
283
283
|
hide: boolean;
|
|
284
284
|
}>;
|
|
285
|
-
isHighlightRow: boolean;
|
|
286
285
|
idx: number;
|
|
287
286
|
isHighlight: boolean;
|
|
287
|
+
isHighlightRow: boolean;
|
|
288
288
|
}>;
|
|
289
289
|
export default _default;
|
|
@@ -44,7 +44,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
44
|
formRef: import("vue").Ref<any>;
|
|
45
45
|
conditionRef: import("vue").Ref<any>;
|
|
46
46
|
filterVisible: import("vue").Ref<boolean>;
|
|
47
|
-
title: import("vue").ComputedRef<"
|
|
47
|
+
title: import("vue").ComputedRef<"修改" | "新增" | "过滤条件">;
|
|
48
48
|
model: {
|
|
49
49
|
name: string;
|
|
50
50
|
color: string;
|
|
@@ -14,7 +14,7 @@ export declare function createGuideStep(instance?: ComponentInternalInstance | n
|
|
|
14
14
|
type: NumberConstructor;
|
|
15
15
|
required: true;
|
|
16
16
|
};
|
|
17
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("
|
|
17
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "next" | "toNext")[], "cancel" | "next" | "toNext", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
18
18
|
config: {
|
|
19
19
|
type: PropType<GuideDefine.Config>;
|
|
20
20
|
required: true;
|
|
@@ -29,8 +29,8 @@ export declare function createGuideStep(instance?: ComponentInternalInstance | n
|
|
|
29
29
|
required: true;
|
|
30
30
|
};
|
|
31
31
|
}>> & {
|
|
32
|
-
onNext?: ((...args: any[]) => any) | undefined;
|
|
33
32
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
onNext?: ((...args: any[]) => any) | undefined;
|
|
34
34
|
onToNext?: ((...args: any[]) => any) | undefined;
|
|
35
35
|
}, {
|
|
36
36
|
config: GuideDefine.Config;
|