cnhis-design-vue 3.2.1-release.0 → 3.2.1-release.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/button-print/index.d.ts +1 -0
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +1 -0
- package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
- package/es/components/button-print/src/utils/print.d.ts +16 -4
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/callback/src/components/render/popupMaps.d.ts +268 -2
- package/es/components/drag-scroll/src/index.d.ts +3 -3
- package/es/components/drag-scroll/src/index.js +1 -1
- package/es/components/drag-scroll/src/types.d.ts +12 -7
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/utils/index.js +1 -1
- package/es/components/field-set/index.d.ts +1 -1
- package/es/components/field-set/src/FieldColor.vue.d.ts +1 -0
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -0
- package/es/components/field-set/src/Index.vue.d.ts +1 -1
- package/es/components/field-set/src/Index.vue2.js +1 -1
- package/es/components/field-set/src/TableStyle.vue.d.ts +71 -0
- package/es/components/field-set/src/TableStyle.vue.js +1 -0
- package/es/components/field-set/src/TableStyle.vue2.js +1 -0
- package/es/components/field-set/src/components/Row.vue.d.ts +1 -0
- package/es/components/field-set/src/components/Row.vue2.js +1 -1
- package/es/components/field-set/src/types/index.d.ts +1 -1
- package/es/components/field-set/style/index.css +1 -1
- package/es/components/form-config/index.d.ts +11 -4
- package/es/components/form-config/src/FormConfig.vue.d.ts +11 -4
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +2 -2
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +5 -2
- package/es/components/form-render/index.d.ts +2 -2
- package/es/components/form-render/index.js +1 -1
- package/es/components/form-render/src/FormRender.vue.d.ts +1 -1
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +2 -2
- package/es/components/form-render/src/FormRenderWrapper.vue2.js +1 -1
- package/es/components/form-render/src/components/renderer/combination/tableCombination.d.ts +9 -0
- package/es/components/form-render/src/components/renderer/combination/tableCombination.js +1 -1
- package/es/components/form-render/src/components/renderer/formItem.js +1 -1
- package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
- package/es/components/form-render/src/hooks/index.d.ts +1 -0
- package/es/components/form-render/src/hooks/index.js +1 -1
- package/es/components/form-render/src/hooks/useAutoHidden.d.ts +1 -1
- package/es/components/form-render/src/hooks/useAutoHidden.js +1 -1
- package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
- package/es/components/form-render/src/hooks/useSelectedSetting.d.ts +5 -0
- package/es/components/form-render/src/hooks/useSelectedSetting.js +1 -0
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/components/form-render/src/types/index.d.ts +1 -0
- package/es/components/form-render/src/utils/index.d.ts +1 -0
- package/es/components/form-render/src/utils/index.js +1 -1
- package/es/components/iho-table/index.d.ts +266 -0
- package/es/components/iho-table/src/IhoTable.vue.d.ts +266 -0
- package/es/components/iho-table/src/plugins/dragScrollPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/headerPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.d.ts +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/renderer.d.ts +4 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/renderer.js +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/types.d.ts +11 -7
- package/es/components/iho-table/src/plugins/verticalTablePlugin/utils.d.ts +17 -4
- package/es/components/iho-table/src/plugins/verticalTablePlugin/utils.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +2 -0
- package/es/components/iho-table/src/utils/index.d.ts +1 -0
- package/es/components/iho-table/src/utils/index.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +1 -2
- package/es/components/index.js +1 -1
- package/es/components/info-header/index.d.ts +4 -4
- package/es/components/info-header/src/InfoHeader.vue.d.ts +4 -4
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +2 -2
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +2 -2
- package/es/components/search-cascader/index.d.ts +1 -1
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +1 -1
- package/es/components/search-cascader/src/components/SearchMenu.d.ts +1 -1
- package/es/components/shortcut-setter/index.d.ts +3 -2
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +3 -2
- package/es/components/steps-wheel/src/StepsWheel.vue2.js +1 -1
- package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +0 -3
- package/es/components/table-export-field/src/components/ExportModal.vue2.js +1 -1
- package/es/components/table-export-field/style/index.css +1 -1
- package/es/components/table-export-field/style/table-export-field-iconfont.ttf +0 -0
- package/es/shared/assets/img/table_style_1.png.js +1 -0
- package/es/shared/assets/img/table_style_2.png.js +1 -0
- package/es/shared/assets/img/table_style_3.png.js +1 -0
- package/es/shared/assets/img/table_style_4.png.js +1 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/types/business.d.ts +15 -6
- package/es/shared/utils/business.d.ts +1 -1
- package/es/shared/utils/index.js +1 -1
- package/package.json +9 -8
|
@@ -173,6 +173,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
173
173
|
}>>;
|
|
174
174
|
emit: (event: "success" | "error" | "clickoutside", ...args: any[]) => void;
|
|
175
175
|
defaultFormatInfo: import("../../shared/types").AnyObject;
|
|
176
|
+
authorizationKey: import("vue").Ref<string>;
|
|
176
177
|
state: {
|
|
177
178
|
spinning: boolean;
|
|
178
179
|
visible: boolean;
|
|
@@ -180,6 +180,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
180
180
|
}>>;
|
|
181
181
|
emit: (event: "success" | "error" | "clickoutside", ...args: any[]) => void;
|
|
182
182
|
defaultFormatInfo: AnyObject;
|
|
183
|
+
authorizationKey: import("vue").Ref<string>;
|
|
183
184
|
state: {
|
|
184
185
|
spinning: boolean;
|
|
185
186
|
visible: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as t,
|
|
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 p,unref as d,withCtx as m,renderSlot as u,withModifiers as c,createTextVNode as f,toDisplayString as g,mergeProps as y}from"vue";import{isObject as v}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 F}from"./utils/print.js";import{isIReport as k}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as x}from"date-fns";import{savePrivateFormatApi as S,getPrivateFormatApi as L}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}},emits:["success","error","clickoutside"],setup(t,{expose:j,emit:O}){var D;const E=t,M=b();let N;const V={},C=e(""),z=n({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),B=n([{label:E.printText,key:"printText"},{label:E.previewText,key:"previewText"},{label:E.pdfLoadText,key:"downloadPdf"},{label:E.formatEditText,key:"formatEditText"},...(null==(D=E.externalOptionConfig)?void 0:D.options)||[]]),J=i((()=>{if(!z.currentFormatId)return{};let t=z.currentFormatId;return z.formatList.find((e=>e.id===t))})),U=i((()=>{var t;return(null==(t=J.value)?void 0:t.name)||"格式选择"})),A=i((()=>{let t=z.formatList.find((t=>t.id===z.currentFormatId));return null==t?void 0:t.templateId})),q=async t=>{if(E.directPrint){if(z.spinning)return;return"button"===t?void await ot():it()}return it()},K=t=>p("span",{class:{active:t.key===z.currentFormatId}},[t.label]),R=(t,e)=>{z.spinning=!1;let n={type:e,formatId:z.currentFormatId,templateId:A.value};O("success",t,n)},_=t=>{z.spinning=!1,O("error",t),v(t)&&"notInstalledApp"===t.type&&M.error(t.message)},H=t=>{O("error",{message:"前置条件执行错误",type:t,preExecution:!0})},$=(t=0)=>{var e;const n=(null==(e=E.printParams)?void 0:e.length)?E.printParams[t]:z.printParams[t];return JSON.stringify({...n||{},...E.token?{token:E.token}:{}})},G=()=>{var t,e;let n={},i={};if(null==(t=z.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(z.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(z.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(z.printParams[0]).forEach((t=>{i[t]=[],z.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse($(0)),i),JSON.stringify(n)},Q=()=>{let t=z.printParams.length;const e=async e=>{try{--t<=0&&R(e,"print")}catch(t){console.log("error",t)}};E.showLoading&&z.spinning||(z.spinning=!0,E.prevFn("print").then((()=>{const t={formatId:z.currentFormatId,templateId:A.value,authorizationKey:C.value,printdlgshow:E.printdlgshow,signature:E.signature};if("MULTI"===E.strategy)for(let n=0;n<z.printParams.length;n++)n>0&&(t.printdlgshow="0"),N.printDirect({...t,params:$(n)},e,_);else N.printDirect({...t,params:G()},(t=>{R(t,"print")}),_)})).catch((()=>{H("print"),z.spinning=!1})).finally((()=>{z.visible=!1})))},W=async(t,e)=>{var n,i;switch(t){case"printText":Q();break;case"previewText":(async()=>{E.showLoading&&z.spinning||(z.spinning=!0,E.prevFn("preview").then((()=>{const t="MULTI"===E.strategy?$():G(),e={formatId:z.currentFormatId,templateId:A.value,authorizationKey:C.value,params:t,btnprint:E.btnprint,signature:E.signature};N.preview(e,(t=>{R(t,"preview")}),_)})).catch((()=>{H("preview"),z.spinning=!1})).finally((()=>{z.visible=!1})))})();break;case"formatEditText":E.showLoading&&z.spinning||(z.spinning=!0,E.prevFn("edit").then((()=>{z.identityVerification.visible=!0})).catch((()=>{H("edit")})).finally((()=>{z.visible=!1,z.spinning=!1})));break;case"downloadPdf":(async()=>{E.showLoading&&z.spinning||(z.spinning=!0,E.prevFn("download").then((()=>{const t="MULTI"===E.strategy?$():G(),e={formatId:z.currentFormatId,templateId:A.value,authorizationKey:C.value,print:{print:"1",type:"1"},params:t,signature:E.signature};N.downloadPDF(e,(t=>R(t,"preview")),_)})).catch((()=>{H("download"),z.spinning=!1})).finally((()=>{z.visible=!1})))})();break;default:{z.visible=!1;const a=z.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){z.currentFormatId=t;const[e]=B;e.label=(null==a?void 0:a.name)||e.label,await S({formatForms:[{...a}],name:V.name||a.templateName,number:V.number||a.number,templateId:V.templateId||a.templateId,...V.id?{id:V.id}:{}},{token:E.token})}else null==(i=null==(n=E.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},X=()=>{z.visible=!1,O("clickoutside")},Y=()=>(z.isInited=!1,z.spinning=!1,setTimeout((()=>{z.visible=!1}),0),!1),Z=(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=x(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},tt=({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(Z(n,e,"fieldName"))}})),i=Object.assign({},i,Z(n,e,"key")),i})),et=async t=>{var e;if(z.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],z.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";const{data:i}=await L({templateId:t[0].templateId},{token:E.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})(z.formatList,"defaultFlag"),!z.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),Y();(()=>{const t=z.formatList.map((t=>({label:t.name,key:t.id})));B.unshift({label:U.value,key:"format",children:t})})();let n=null==(e=await E.queryTemplateParams())?void 0:e.obj;if(!n||!A.value)return M.error("获取打印模板失败,请联系管理员!"),Y();z.templateParams=n,z.printParams=tt(z.templateParams,E.params)},nt=async()=>{var t;if(z.isInited)return!0;z.isInited=!0,z.spinning=!0,(()=>{if(N)return!1;N=new F})();const e=await E.queryPrintFormatByNumber();return await et(e),(null==(t=e.obj)?void 0:t.length)>0&&(C.value=e.obj[0].authorizationKey||""),z.spinning=!1,!0},it=async(t=!0)=>{var e,n;if(await E.clickPrevFn())if((null==(e=E.params)?void 0:e.length)||(null==(n=E.printParams)?void 0:n.length)){if(!z.visible){if(!await nt())return!1}t&&(z.visible=!z.visible)}else M.warning(E.noDataMsg)},at=()=>{z.watchPrintParamsReformatFn&&z.watchPrintParamsReformatFn(),z.isInited?z.printParams=tt(z.templateParams,E.params):z.watchPrintParamsReformatFn=()=>r((()=>z.isInited),(t=>{if(!t)return!1;at()}))},rt=t=>{if(z.identityVerification.visible=!1,k(z.currentFormatId))return R(null,"edit");const e={formatId:z.currentFormatId,templateId:A.value,params:$(),token:t};N.editPrintFormat(e,(t=>{R(t,"edit")}),_)};async function ot(){await it(!1),Q()}return a((()=>{z.isInited=!1})),r((()=>E.params),(t=>{if(!(null==t?void 0:t.length))return!1;at()}),{deep:!0}),j({directPrint:ot}),(e,n)=>(o(),s(l,null,[p(d(h),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:z.visible,onClickoutside:X,options:B,onSelect:W,"render-label":K},{default:m((()=>[u(e.$slots,"button",{handleClickPrintBtn:it,printSpinning:z.spinning,printbtnText:t.btnText,printVisible:z.visible},(()=>[p(d(I),{class:"dropdown-button",loading:t.showLoading&&z.spinning,onClick:n[1]||(n[1]=c((()=>q("button")),["stop"]))},{default:m((()=>[f(g(t.btnText)+" ",1),p(d(P),{component:d(w),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=c((()=>q("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),p(T,y(e.$attrs,{modelValue:z.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>z.identityVerification.visible=t),formatId:z.currentFormatId,templateId:d(A),onSuccess:rt}),null,16,["modelValue","formatId","templateId"])],64))}});export{j as default};
|
|
@@ -11,9 +11,17 @@ export declare class Print {
|
|
|
11
11
|
private isRemote;
|
|
12
12
|
private CMonitor;
|
|
13
13
|
private queryServicesParams;
|
|
14
|
+
private isConnectHiPrint;
|
|
15
|
+
private clientInfo;
|
|
16
|
+
private printerList;
|
|
17
|
+
private hiPrintSocket;
|
|
18
|
+
private base64Fragment;
|
|
19
|
+
private _successCallbackFn;
|
|
20
|
+
private _errorCallbackFn;
|
|
14
21
|
constructor();
|
|
15
22
|
private readonly messageHandlerQueue;
|
|
16
23
|
private messageHandler;
|
|
24
|
+
private _initDomesticSystem;
|
|
17
25
|
getPicAndUpload(obj: any): Promise<void>;
|
|
18
26
|
_uploadImageServices(uploadParams: AnyObject): Promise<any>;
|
|
19
27
|
private postMessage;
|
|
@@ -43,19 +51,23 @@ export declare class Print {
|
|
|
43
51
|
pageCount: any;
|
|
44
52
|
formatId: string;
|
|
45
53
|
};
|
|
46
|
-
_handleEventDirect({ templateId, formatId, params, cmdid, print, signature, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
|
|
54
|
+
_handleEventDirect({ templateId, formatId, params, paramsArr, cmdid, print, signature, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
|
|
47
55
|
_handleEventEditFormat({ templateId, formatId, params, token, messageTimeout }: AnyObject): Promise<any>;
|
|
48
56
|
_queryProxyOrigin(): Promise<void>;
|
|
49
57
|
_queryPrintFile(formatId: string, params?: string): Promise<any>;
|
|
58
|
+
paramsSerializer(params: AnyObject): AnyObject;
|
|
59
|
+
_queryPrintForBase64(templateId: string, formatId: string, params: string | undefined, authorizationKey: String): Promise<any>;
|
|
60
|
+
_queryPrintForPdf(templateId: string, formatId: string, params: string | undefined, authorizationKey: String): Promise<any>;
|
|
50
61
|
_browserPrint(result: AnyObject, mode: string): Promise<string | void>;
|
|
51
|
-
|
|
62
|
+
_base64ToBlob(fileBase64: string, fileType: string): Blob;
|
|
63
|
+
preview({ templateId, formatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
|
|
52
64
|
printSync(data: AnyObject[], successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<void>;
|
|
53
|
-
printDirect({ templateId, formatId, params, print, signature, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, mode?: string): Promise<any>;
|
|
65
|
+
printDirect({ templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, mode?: string): Promise<any>;
|
|
54
66
|
private _downloadPDF;
|
|
55
67
|
/**
|
|
56
68
|
* 下载pdf
|
|
57
69
|
*/
|
|
58
|
-
downloadPDF(params: AnyObject, onResolve: AnyFn, onReject: AnyFn):
|
|
70
|
+
downloadPDF(params: AnyObject, onResolve: AnyFn, onReject: AnyFn): Promise<any>;
|
|
59
71
|
print({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<false | undefined>;
|
|
60
72
|
queryPrintData({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<false | {
|
|
61
73
|
file: any;
|
|
@@ -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 a,useBrowserPrint as r,isIReport as n}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as d}from"date-fns";const c=t.create({timeout:1e3,withCredentials:!1}),u=`${window.location.protocol}//${window.location.host}`,m=`${u}/fdp-api/print/assembly/printIReport`,h=`${u}/bi-api/reprot/print/open/client/getRemote`,p=`${u}/bi-api/reprot/print/open/client/uploadTemplate`,f=`${u}/printService/file`;let w=null;class g{constructor(){var t,e,a;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.messageHandlerQueue=[],w)return w;w=this;const r=window;this.CMonitor=r.$CMonitor;try{this.webview=r.top?null==(t=r.top.chrome)?void 0:t.webview:null==(e=r.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(a=r.chrome)?void 0:a.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:a}=e;try{s(i.res||"")}catch(t){a(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}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:2,callback:1};const i=await this._queryServicesPrint(this.queryServicesParams);if(i&&i.filebase64&&i.key){const t={templateId:this.queryServicesParams.templateId,formatId:this.queryServicesParams.formatId,fileBase64:i.filebase64,authorizationKey:i.key,params:this.queryServicesParams.params},e=await this._uploadImageServices(t);"success"===(null==e?void 0:e.result)&&console.log("图片上传成功")}}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async _uploadImageServices(t){const e=new FormData;Object.keys(t).forEach((i=>{e.append(i,t[i])}));const{data:i}=await c({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:p,data:e})||{};return i}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=>{c({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))}_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)}):c({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,a){const r={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},n=await this._queryServicesPrint(r);return this._handleQueryPrintDataResult(n,e,a)}_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,cmdid:s,print:a,signature:r,printdlgshow:n="0",nobillnode:o="1",btnprint:l="1",messageTimeout:c=0}){const u={templateId:t,formatId:e,params:i,cmdid:s,nobillnode:o,printdlgshow:n,btnprint:l,messageTimeout:c,...r?{signature:r}:{}};if(a){try{a=JSON.parse(a)}catch(t){}u.print=a}else if(this.isRemote){const t=d(new Date,"yyyyMMddHHmmss");u.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=u,await this._queryServicesPrint(u)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:a=0}){const r={};let n={};try{n=Object.assign({},r,JSON.parse(i))}catch(t){n=r}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(n),messageTimeout:a};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await c({method:"get",url:h})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=u+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await c({method:"post",url:m,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),n=s[s.length-2],o=s[s.length-1],l=await a(`${f}/${n}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",signature:s,btnprint:a,messageTimeout:l=0},d,c){if(n(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==c?void 0:c("获取文件失败!");const s=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,s),void(null==d||d({file:t}))}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,c))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",signature:s,btnprint:a,messageTimeout:l}),n=this._handleResult(r,c);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==c||c(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(),a=await this.messageCollect(t,{exec:"printA",data:s});if(a&&Array.isArray(a)){a.some((t=>"success"===t.res.result))?null==e||e(a):(null==i||i(a),this._handleMonitorNotify(a))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(a||""),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="",print:s,signature:a,printdlgshow:o,nobillnode:l,isDownloadFile:d=!0,messageTimeout:c=0},u,m,h="printDirect"){if(n(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,h),void(null==u||u({file:t}))):null==m?void 0:m("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,m))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:s,signature:a,printdlgshow:o,nobillnode:l,messageTimeout:c}),n=this._handleResult(r,m);if(!n)return!1;d&&["downloadPDF"].includes(h)&&await this._browserPrint(n,h),null==u||u(n)}catch(t){const e="printDirect"===h?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==m||m(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):c.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}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=d(new Date,"yyyy-MM-dd"),i=l(),s=d(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}this.printDirect(t,(async a=>{if(a||s(null),n(t.formatId))return i(a);const r=this,o=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}(a.filedir);i(o,a)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},a,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,r);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,r);if(!l)return!1;a&&a(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},a,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,r);return!!o&&(a&&a(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,a){const r=await this._testConnection();if(!this._handleResultTest(r,a))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,a);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:a=0},r,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:s,messageTimeout:a}),d=this._handleResult(l,n);if(!d)return!1;r&&r(d)}async addPrintFormat({templateId:t,params:e,token:i},s,a){const r=await this._testConnection();if(!this._handleResultTest(r,a))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,a);if(!o)return!1;s&&s(o)}}export{g 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 a,isIReport as n}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 d=t.create({timeout:6e4,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,p=`${m}/fdp-api/print/assembly/printIReport`,u=`${m}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${m}/bi-api/reprot/print/open/client/previewIReport`,w=`${m}/bi-api/reprot/print/open/client/getRemote`,y=`${m}/bi-api/reprot/print/open/client/uploadTemplate`,g=`${m}/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.messageHandlerQueue=[],P)return P;P=this,this._initDomesticSystem();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==(r=a.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",{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.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:2,callback:1};const i=await this._queryServicesPrint(this.queryServicesParams);if(i&&i.filebase64&&i.key){const t={templateId:this.queryServicesParams.templateId,formatId:this.queryServicesParams.formatId,fileBase64:i.filebase64,authorizationKey:i.key,params:this.queryServicesParams.params},e=await this._uploadImageServices(t);"success"===(null==e?void 0:e.result)&&console.log("图片上传成功")}}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async _uploadImageServices(t){const e=new FormData;Object.keys(t).forEach((i=>{e.append(i,t[i])}));const{data:i}=await d({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:y,data:e})||{};return i}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))}_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 a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,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:a,signature:n,printdlgshow:o="0",nobillnode:l="1",btnprint:h="1",messageTimeout:d=0}){const m={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:l,printdlgshow:o,btnprint:h,messageTimeout:d,...n?{signature:n}:{}};if(s&&(m.paramsArr=s),a){try{a=JSON.parse(a)}catch(t){}m.print=a}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");m.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=m,await this._queryServicesPrint(m)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=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:s,params:JSON.stringify(n),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=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:p,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:a}=await d({method:"post",url:u,params:{id:t,formatId:e.split("_")[1],params:this.paramsSerializer(r),authorizationKey:s}})||{};return a}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:a}=await d({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e.split("_")[1],params:this.paramsSerializer(r),authorizationKey:s}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),n=s[s.length-2],o=s[s.length-1],l=await r(`${g}/${n}/${o}`),c=a(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},d,m){if(n(e)){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==m?void 0:m("获取文件失败!");const n=a(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),null==d?void 0:d({file:s})}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,m))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}),a=this._handleResult(r,m);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(a),null==d||d(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==m||m(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:a,signature:o,printdlgshow:l,nobillnode:c,isDownloadFile:h=!0,messageTimeout:d=0},m,p,u="printDirect"){if(n(e)){if(!this.isConnectHiPrint)return void p({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return p({message:s.resultMsg});const{base64:a,formatId:n}=s.map;return this.base64Fragment=a,this._successCallbackFn=m,this._errorCallbackFn=p,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:n,pdf_stream:this.base64Fragment})}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:"7",print:a,signature:o,printdlgshow:l,nobillnode:c,messageTimeout:d}),n=this._handleResult(r,p);if(!n)return!1;h&&["downloadPDF"].includes(u)&&await this._browserPrint(n,u),null==m||m(n)}catch(t){const e="printDirect"===u?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==p||p(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,"/")}if(n(t.formatId)){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params,t.authorizationKey);return e?(a(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,a=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(a,t)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,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:s},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;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,a);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=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:s,messageTimeout:r}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,r);if(!o)return!1;s&&s(o)}}export{v as Print};
|
|
@@ -3,7 +3,7 @@ export declare const CallbackMaps: Map<string, {
|
|
|
3
3
|
formRenderRef: import("vue").Ref<import("../../../../../components/form-render").FormRenderExpose | undefined>;
|
|
4
4
|
key: import("vue").Ref<number>;
|
|
5
5
|
reload: () => Promise<void>;
|
|
6
|
-
formRenderExposeKeyList: readonly ["validate", "getFormValues", "setFormValues", "setFieldState", "resetFields", "queryWidget", "getFieldList"];
|
|
6
|
+
formRenderExposeKeyList: readonly ["validate", "getFormValues", "setFormValues", "setFieldState", "resetFields", "queryWidget", "getFieldList", "applySelectedSetting"];
|
|
7
7
|
exposed: Partial<import("../../../../../components/form-render").FormRenderExpose>;
|
|
8
8
|
FormRender: import("vue").DefineComponent<{
|
|
9
9
|
fieldList: {
|
|
@@ -396,7 +396,7 @@ export declare const CallbackMaps: Map<string, {
|
|
|
396
396
|
afterRequest(fieldKey: string, res?: any, payload?: import("../../../..").AnyObject | undefined): import("../../../..").AnyObject[];
|
|
397
397
|
afterOptionInit(fieldKey: string, options: import("../../../..").AnyObject[], payload?: import("../../../..").AnyObject | undefined): void;
|
|
398
398
|
}>>[T]>>;
|
|
399
|
-
triggerAutoHidden: (field: import("@formily/core").GeneralField) => Promise<void>;
|
|
399
|
+
triggerAutoHidden: (field: import("@formily/core").GeneralField, includeLinebar?: boolean) => Promise<void>;
|
|
400
400
|
observeFormGraph: Record<string, import("@formily/core").GeneralField>;
|
|
401
401
|
setGraph: (field: import("@formily/core").GeneralField) => void;
|
|
402
402
|
removeGraph: (field: import("@formily/core").GeneralField) => void;
|
|
@@ -3030,6 +3030,139 @@ export declare const CallbackMaps: Map<string, {
|
|
|
3030
3030
|
isBatchSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
3031
3031
|
isSingleSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
3032
3032
|
dragScroll?: boolean | undefined;
|
|
3033
|
+
dragScrollConfig?: {
|
|
3034
|
+
dragEle?: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | HTMLElement | {
|
|
3035
|
+
[x: string]: any;
|
|
3036
|
+
setup?: ((this: void, props: Readonly<import("@vue/shared").LooseRequired<any>>, ctx: import("vue").SetupContext<any>) => any) | undefined;
|
|
3037
|
+
name?: string | undefined;
|
|
3038
|
+
template?: string | object | undefined;
|
|
3039
|
+
render?: Function | undefined;
|
|
3040
|
+
components?: Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>> | undefined;
|
|
3041
|
+
directives?: Record<string, import("vue").Directive<any, any>> | undefined;
|
|
3042
|
+
inheritAttrs?: boolean | undefined;
|
|
3043
|
+
emits?: any;
|
|
3044
|
+
expose?: string[] | undefined;
|
|
3045
|
+
serverPrefetch?: (() => Promise<any>) | undefined;
|
|
3046
|
+
compilerOptions?: {
|
|
3047
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
3048
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
3049
|
+
comments?: boolean | undefined;
|
|
3050
|
+
delimiters?: [string, string] | undefined;
|
|
3051
|
+
} | undefined;
|
|
3052
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
3053
|
+
__isFragment?: undefined;
|
|
3054
|
+
__isTeleport?: undefined;
|
|
3055
|
+
__isSuspense?: undefined;
|
|
3056
|
+
__defaults?: {} | undefined;
|
|
3057
|
+
compatConfig?: {
|
|
3058
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
3059
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
3060
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
3061
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
3062
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
3063
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
3064
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
3065
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
3066
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
3067
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
3068
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
3069
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
3070
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
3071
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
3072
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
3073
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
3074
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
3075
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
3076
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
3077
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
3078
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
3079
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
3080
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
3081
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
3082
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
3083
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
3084
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
3085
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
3086
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
3087
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
3088
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
3089
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
3090
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
3091
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
3092
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
3093
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
3094
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
3095
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
3096
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
3097
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
3098
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
3099
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
3100
|
+
MODE?: 2 | 3 | ((comp: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | null) => 2 | 3) | undefined;
|
|
3101
|
+
} | undefined;
|
|
3102
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
3103
|
+
computed?: import("vue").ComputedOptions | undefined;
|
|
3104
|
+
methods?: import("vue").MethodOptions | undefined;
|
|
3105
|
+
watch?: {
|
|
3106
|
+
[x: string]: (string | import("vue").WatchCallback<any, any> | ({
|
|
3107
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
3108
|
+
} & import("vue").WatchOptions<boolean>)) | (string | import("vue").WatchCallback<any, any> | ({
|
|
3109
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
3110
|
+
} & import("vue").WatchOptions<boolean>))[];
|
|
3111
|
+
} | undefined;
|
|
3112
|
+
provide?: import("vue").ComponentProvideOptions | undefined;
|
|
3113
|
+
inject?: (string[] | {
|
|
3114
|
+
[x: string]: string | symbol | {
|
|
3115
|
+
from?: string | symbol | undefined;
|
|
3116
|
+
default?: unknown;
|
|
3117
|
+
};
|
|
3118
|
+
[x: symbol]: string | symbol | {
|
|
3119
|
+
from?: string | symbol | undefined;
|
|
3120
|
+
default?: unknown;
|
|
3121
|
+
};
|
|
3122
|
+
}) | undefined;
|
|
3123
|
+
filters?: Record<string, Function> | undefined;
|
|
3124
|
+
mixins?: any[] | undefined;
|
|
3125
|
+
extends?: any;
|
|
3126
|
+
beforeCreate?: (() => void) | undefined;
|
|
3127
|
+
created?: (() => void) | undefined;
|
|
3128
|
+
beforeMount?: (() => void) | undefined;
|
|
3129
|
+
mounted?: (() => void) | undefined;
|
|
3130
|
+
beforeUpdate?: (() => void) | undefined;
|
|
3131
|
+
updated?: (() => void) | undefined;
|
|
3132
|
+
activated?: (() => void) | undefined;
|
|
3133
|
+
deactivated?: (() => void) | undefined;
|
|
3134
|
+
beforeDestroy?: (() => void) | undefined;
|
|
3135
|
+
beforeUnmount?: (() => void) | undefined;
|
|
3136
|
+
destroyed?: (() => void) | undefined;
|
|
3137
|
+
unmounted?: (() => void) | undefined;
|
|
3138
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
3139
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
3140
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
3141
|
+
delimiters?: [string, string] | undefined;
|
|
3142
|
+
__differentiator?: string | number | symbol | undefined;
|
|
3143
|
+
__isBuiltIn?: boolean | undefined;
|
|
3144
|
+
__file?: string | undefined;
|
|
3145
|
+
__name?: string | undefined;
|
|
3146
|
+
} | undefined;
|
|
3147
|
+
changeCursor?: boolean | undefined;
|
|
3148
|
+
scrollTarget?: any;
|
|
3149
|
+
duration?: number | undefined;
|
|
3150
|
+
type?: "px" | "percent" | undefined;
|
|
3151
|
+
isDraggableEle?: ((event: MouseEvent) => boolean) | undefined;
|
|
3152
|
+
getScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined) => {
|
|
3153
|
+
scrollTop: number;
|
|
3154
|
+
scrollLeft: number;
|
|
3155
|
+
}) | undefined;
|
|
3156
|
+
setScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined, state: {
|
|
3157
|
+
scrollTarget: any;
|
|
3158
|
+
scrollTop: number;
|
|
3159
|
+
scrollLeft: number;
|
|
3160
|
+
offsetX: number;
|
|
3161
|
+
offsetY: number;
|
|
3162
|
+
startScrollX: number;
|
|
3163
|
+
startScrollY: number;
|
|
3164
|
+
}) => void) | undefined;
|
|
3165
|
+
} | undefined;
|
|
3033
3166
|
selectType?: "checkbox" | "radio" | null | undefined;
|
|
3034
3167
|
rowDraggable?: boolean | undefined;
|
|
3035
3168
|
showSeq?: boolean | undefined;
|
|
@@ -5494,6 +5627,139 @@ export declare const CallbackMaps: Map<string, {
|
|
|
5494
5627
|
isBatchSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
5495
5628
|
isSingleSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
5496
5629
|
dragScroll?: boolean | undefined;
|
|
5630
|
+
dragScrollConfig?: {
|
|
5631
|
+
dragEle?: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | HTMLElement | {
|
|
5632
|
+
[x: string]: any;
|
|
5633
|
+
setup?: ((this: void, props: Readonly<import("@vue/shared").LooseRequired<any>>, ctx: import("vue").SetupContext<any>) => any) | undefined;
|
|
5634
|
+
name?: string | undefined;
|
|
5635
|
+
template?: string | object | undefined;
|
|
5636
|
+
render?: Function | undefined;
|
|
5637
|
+
components?: Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>> | undefined;
|
|
5638
|
+
directives?: Record<string, import("vue").Directive<any, any>> | undefined;
|
|
5639
|
+
inheritAttrs?: boolean | undefined;
|
|
5640
|
+
emits?: any;
|
|
5641
|
+
expose?: string[] | undefined;
|
|
5642
|
+
serverPrefetch?: (() => Promise<any>) | undefined;
|
|
5643
|
+
compilerOptions?: {
|
|
5644
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
5645
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
5646
|
+
comments?: boolean | undefined;
|
|
5647
|
+
delimiters?: [string, string] | undefined;
|
|
5648
|
+
} | undefined;
|
|
5649
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
5650
|
+
__isFragment?: undefined;
|
|
5651
|
+
__isTeleport?: undefined;
|
|
5652
|
+
__isSuspense?: undefined;
|
|
5653
|
+
__defaults?: {} | undefined;
|
|
5654
|
+
compatConfig?: {
|
|
5655
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
5656
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
5657
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
5658
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
5659
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
5660
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
5661
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
5662
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
5663
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
5664
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
5665
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
5666
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
5667
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
5668
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
5669
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
5670
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
5671
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
5672
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
5673
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
5674
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
5675
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
5676
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
5677
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
5678
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
5679
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
5680
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
5681
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
5682
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
5683
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
5684
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
5685
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
5686
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
5687
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
5688
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
5689
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
5690
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
5691
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
5692
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
5693
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
5694
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
5695
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
5696
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
5697
|
+
MODE?: 2 | 3 | ((comp: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | null) => 2 | 3) | undefined;
|
|
5698
|
+
} | undefined;
|
|
5699
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
5700
|
+
computed?: import("vue").ComputedOptions | undefined;
|
|
5701
|
+
methods?: import("vue").MethodOptions | undefined;
|
|
5702
|
+
watch?: {
|
|
5703
|
+
[x: string]: (string | import("vue").WatchCallback<any, any> | ({
|
|
5704
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
5705
|
+
} & import("vue").WatchOptions<boolean>)) | (string | import("vue").WatchCallback<any, any> | ({
|
|
5706
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
5707
|
+
} & import("vue").WatchOptions<boolean>))[];
|
|
5708
|
+
} | undefined;
|
|
5709
|
+
provide?: import("vue").ComponentProvideOptions | undefined;
|
|
5710
|
+
inject?: (string[] | {
|
|
5711
|
+
[x: string]: string | symbol | {
|
|
5712
|
+
from?: string | symbol | undefined;
|
|
5713
|
+
default?: unknown;
|
|
5714
|
+
};
|
|
5715
|
+
[x: symbol]: string | symbol | {
|
|
5716
|
+
from?: string | symbol | undefined;
|
|
5717
|
+
default?: unknown;
|
|
5718
|
+
};
|
|
5719
|
+
}) | undefined;
|
|
5720
|
+
filters?: Record<string, Function> | undefined;
|
|
5721
|
+
mixins?: any[] | undefined;
|
|
5722
|
+
extends?: any;
|
|
5723
|
+
beforeCreate?: (() => void) | undefined;
|
|
5724
|
+
created?: (() => void) | undefined;
|
|
5725
|
+
beforeMount?: (() => void) | undefined;
|
|
5726
|
+
mounted?: (() => void) | undefined;
|
|
5727
|
+
beforeUpdate?: (() => void) | undefined;
|
|
5728
|
+
updated?: (() => void) | undefined;
|
|
5729
|
+
activated?: (() => void) | undefined;
|
|
5730
|
+
deactivated?: (() => void) | undefined;
|
|
5731
|
+
beforeDestroy?: (() => void) | undefined;
|
|
5732
|
+
beforeUnmount?: (() => void) | undefined;
|
|
5733
|
+
destroyed?: (() => void) | undefined;
|
|
5734
|
+
unmounted?: (() => void) | undefined;
|
|
5735
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
5736
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
5737
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
5738
|
+
delimiters?: [string, string] | undefined;
|
|
5739
|
+
__differentiator?: string | number | symbol | undefined;
|
|
5740
|
+
__isBuiltIn?: boolean | undefined;
|
|
5741
|
+
__file?: string | undefined;
|
|
5742
|
+
__name?: string | undefined;
|
|
5743
|
+
} | undefined;
|
|
5744
|
+
changeCursor?: boolean | undefined;
|
|
5745
|
+
scrollTarget?: any;
|
|
5746
|
+
duration?: number | undefined;
|
|
5747
|
+
type?: "px" | "percent" | undefined;
|
|
5748
|
+
isDraggableEle?: ((event: MouseEvent) => boolean) | undefined;
|
|
5749
|
+
getScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined) => {
|
|
5750
|
+
scrollTop: number;
|
|
5751
|
+
scrollLeft: number;
|
|
5752
|
+
}) | undefined;
|
|
5753
|
+
setScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined, state: {
|
|
5754
|
+
scrollTarget: any;
|
|
5755
|
+
scrollTop: number;
|
|
5756
|
+
scrollLeft: number;
|
|
5757
|
+
offsetX: number;
|
|
5758
|
+
offsetY: number;
|
|
5759
|
+
startScrollX: number;
|
|
5760
|
+
startScrollY: number;
|
|
5761
|
+
}) => void) | undefined;
|
|
5762
|
+
} | undefined;
|
|
5497
5763
|
selectType?: "checkbox" | "radio" | null | undefined;
|
|
5498
5764
|
rowDraggable?: boolean | undefined;
|
|
5499
5765
|
showSeq?: boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Directive } from 'vue';
|
|
2
|
-
import { DragScrollConfig } from '../../../components/drag-scroll';
|
|
3
|
-
export declare function useDragScroll(uuid: any, config: DragScrollConfig): () => void;
|
|
4
|
-
export declare const DragScroll: Directive<HTMLElement, Partial<DragScrollConfig
|
|
2
|
+
import { DragScrollConfig, DragScrollTargetType } from '../../../components/drag-scroll';
|
|
3
|
+
export declare function useDragScroll<T extends DragScrollTargetType>(uuid: any, config: DragScrollConfig<T>): () => void;
|
|
4
|
+
export declare const DragScroll: Directive<HTMLElement, Partial<DragScrollConfig<any>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{findAncestor as e,isHTMLElement as t}from"../../../shared/utils/index.js";import{useThrottleFn as r}from"@vueuse/core";import{isFunction as
|
|
1
|
+
import{findAncestor as e,isHTMLElement as t}from"../../../shared/utils/index.js";import{useThrottleFn as r}from"@vueuse/core";import{isFunction as l,isObject as s,isString as o,flow as n}from"lodash-es";import{unref as a}from"vue";const c={events:new Map,regist(e,t,r){window.addEventListener(t,r);const l=this.events.get(e)||[];l.push((()=>window.removeEventListener(t,r))),this.events.set(e,l)},stopper(e){var t;n(null!=(t=this.events.get(e))?t:[])(),this.events.delete(e)}};class i{constructor(){this.queue=[],this.lock=!1}add(e){this.queue.push(e),this.execute()}async execute(){if(!this.lock){this.lock=!0;try{for(;this.queue.length;)await this.queue.shift()()}finally{this.lock=!1}}}clear(){this.queue.length=0}}function u(o,n){var a;c.stopper(o);let u=0,g=0,d=0,p=0,f=!1;const m=new i;return c.regist(o,"mousemove",r((r=>{var s;if(!f){const t=h(n.dragEle);if(!t)return;if(!1!==n.changeCursor){const s=r.target;if(!e(s,(e=>e===t)))return;const o=!l(n.isDraggableEle)||n.isDraggableEle(r);t.style.cursor=o?"grab":"default"}return}const{pageX:o,pageY:a}=r,c=o-u,i=a-g;m.add((()=>{let e=Math.max(0,d-c),r=Math.max(0,p-i);const s=h(n.scrollTarget);if("percent"===n.type)if(t(s)){const{scrollWidth:t,scrollHeight:l,clientHeight:o,clientWidth:n}=s;e=Math.max(0,d-c/n*t),r=Math.max(0,p-i/o*l)}else console.warn(`[DragScroll]: scrollTarget ${s} is not HTMLElement`);l(n.setScrollState)?n.setScrollState(n.scrollTarget,{scrollTarget:n.scrollTarget,scrollLeft:e,scrollTop:r,startScrollX:d,startScrollY:p,offsetX:c,offsetY:i}):null==s||s.scrollTo(e,r)})),window.getSelection&&(null==(s=window.getSelection())||s.removeAllRanges())}),null!=(a=n.duration)?a:50)),c.regist(o,"mousedown",(t=>{const r=h(n.dragEle);if(!r)return;const o=t.target;if(!e(o,(e=>e===r)))return;if(!(!l(n.isDraggableEle)||n.isDraggableEle(t)))return;const a=l(n.getScrollState)?n.getScrollState(n.scrollTarget):h(n.scrollTarget);s(a)&&(u=t.pageX,g=t.pageY,d=a.scrollLeft,p=a.scrollTop,f=!0)})),c.regist(o,"mouseup",(()=>{f=!1,m.clear()})),()=>c.stopper(o)}const g={mounted(e,t){u(e,Object.assign({dragEle:e,scrollTarget:e},t.value))},unmounted(e){c.stopper(e)},updated(e,t){c.stopper(e),u(e,Object.assign({dragEle:e,scrollTarget:e},t.value))}};function h(e){return e=a(e),o(e)?document.querySelector(e):t(e)?e:s(e)?Reflect.get(e,"$el"):null}export{g as DragScroll,u as useDragScroll};
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { MaybeRef } from '@vueuse/shared';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
|
-
declare type
|
|
4
|
-
export declare type DragScrollConfig = Partial<{
|
|
5
|
-
dragEle:
|
|
3
|
+
export declare type DragScrollTargetType = MaybeRef<HTMLElement | string | Component>;
|
|
4
|
+
export declare type DragScrollConfig<T extends DragScrollTargetType = any> = Partial<{
|
|
5
|
+
dragEle: DragScrollTargetType;
|
|
6
6
|
changeCursor: boolean;
|
|
7
|
-
scrollTarget:
|
|
7
|
+
scrollTarget: T;
|
|
8
8
|
duration: number;
|
|
9
|
+
type: 'percent' | 'px';
|
|
9
10
|
isDraggableEle: (event: MouseEvent) => boolean;
|
|
10
|
-
getScrollState: (target:
|
|
11
|
+
getScrollState: (target: DragScrollTargetType | undefined) => {
|
|
11
12
|
scrollTop: number;
|
|
12
13
|
scrollLeft: number;
|
|
13
14
|
};
|
|
14
|
-
setScrollState: (target:
|
|
15
|
+
setScrollState: (target: DragScrollTargetType | undefined, state: {
|
|
16
|
+
scrollTarget: T;
|
|
15
17
|
scrollTop: number;
|
|
16
18
|
scrollLeft: number;
|
|
19
|
+
offsetX: number;
|
|
20
|
+
offsetY: number;
|
|
21
|
+
startScrollX: number;
|
|
22
|
+
startScrollY: number;
|
|
17
23
|
}) => void;
|
|
18
24
|
}>;
|
|
19
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as t,reactive as a,unref as r,watch as u}from"vue";import{defaultBorderStyle as l,defaultLineStyle as i,defaultTextStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{isNumber as o}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as d}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as
|
|
1
|
+
import{ref as e,computed as t,reactive as a,unref as r,watch as u}from"vue";import{defaultBorderStyle as l,defaultLineStyle as i,defaultTextStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{isNumber as o}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as d}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as m}from"./useElectrocardiogram.js";import{useMeasureInstrument as s}from"./useMeasureInstrument.js";function v(v,c,g,h,f,p){const N=e(),M=e(),b=e(),L=e(),y=t((()=>c.data.width)),x=t((()=>c.data.height)),S=t((()=>(y.value-0)/C.value)),w=t((()=>(x.value-0)/E.value)),C=t((()=>{const{dataList:e,config:t,grid:a}=c.data;if(o(a.gridXNumber))return a.gridXNumber;const r=e[e.length-1].data.length/t.hz;return Math.ceil(r/t.mainXCellValue)})),E=t((()=>{const{config:e,grid:t,dataList:a}=c.data;if(o(t.gridYNumber))return t.gridYNumber;const r=a.length;return Math.ceil(X.value*r*2/e.mainYCellValue)})),X=t((()=>{const{dataList:e,config:t}=c.data,a=e[e.length-1].data,r=Math.max(...a)-Math.min(...a);return"uv"===t.valueUnit?.001*r:"v"===t.valueUnit?1e3*r:r})),j=t((()=>{var e;return(null==(e=c.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),R=t((()=>{const{mode:e="2-6"}=c.data,[t,a]=e.split("-").map((e=>+e));return{columnNumber:t,rowNumber:a}})),I=t((()=>{const{rowNumber:e}=R.value,{dataList:t}=c.data,a=t.length;return Math.round(E.value/(e+(a===d.MAXLINENUMBER?1:0)))})),U=t((()=>{const{dataList:e,width:t,config:a,grid:r}=c.data,{columnNumber:u,rowNumber:l}=R.value,i=t/u,n=e.length,o=Math.ceil(I.value/2),m=function(){const{valueUnit:t,mainYCellValue:r}=a,l=e[0].data,i=d(Math.max(...l));if(2!==u)return i;const n=e[6].data,o=d(Math.max(...n));return Math.max(i,o);function d(e){return("uv"===t?.001*e:"v"===t?1e3*e:e)/r*w.value}}(),s=w.value*o,v=1===u||s<m?w.value*Math.ceil(m/w.value):s;return e.map(((e,t)=>{const a=d.MAXLINENUMBER===n&&t===n-1?l:t%l;return{...e,origin:{x:(d.MAXLINENUMBER===n&&t===n-1?0:Math.floor(t/l))*i,y:a*(w.value*I.value)+v,rowIdx:a}}}))})),Y=a({canvasWidth:c.data.width,canvasHeight:c.data.height,borderStyle:{...l,...c.data.borderStyle},lineStyle:{...i,...c.data.lineStyle},titleStyle:{...n,...c.data.titleStyle},measureLineStyle:{...i,...c.data.measureLineStyle},measureTextStyle:{...n,...c.data.measureTextStyle},grid:c.data.grid,originX:0,endX:y.value,originY:0,endY:x.value,xCellWidth:S.value,yCellHeight:w.value,gridXNumber:C.value,gridYNumber:E.value,event:j.value,dataList:U.value,columnNumber:r(R).columnNumber,rowNumber:r(R).rowNumber,config:c.data.config});return u((()=>v.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:t,useCaliper:a,useCaliperRuler:r}=s(v,Y),{updatePolyline:u}=m(v,Y,t);M.value=e,b.value=a,L.value=r,N.value=u}()}),{immediate:!0}),{propItems:Y,updatePolyline:N,useMeasureRuler:M,useCaliper:b,useCaliperRuler:L,getGridInfo:function(){return{cellWidth:S.value,cellHeight:w.value,smallCellNumber:d.SMALLCELLNUMBER}}}}export{v as useElectrocardiogramChart};
|