cnhis-design-vue 3.2.6-beta.0 → 3.2.6-beta.2

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.
@@ -94,6 +94,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
94
94
  type: NumberConstructor;
95
95
  default: number;
96
96
  };
97
+ printCustomProps: {
98
+ type: ObjectConstructor;
99
+ default: () => {};
100
+ };
97
101
  newPrintSetting: {
98
102
  type: ObjectConstructor;
99
103
  default: () => {};
@@ -195,6 +199,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
195
199
  type: NumberConstructor;
196
200
  default: number;
197
201
  };
202
+ printCustomProps: {
203
+ type: ObjectConstructor;
204
+ default: () => {};
205
+ };
198
206
  newPrintSetting: {
199
207
  type: ObjectConstructor;
200
208
  default: () => {};
@@ -912,6 +920,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
912
920
  type: NumberConstructor;
913
921
  default: number;
914
922
  };
923
+ printCustomProps: {
924
+ type: ObjectConstructor;
925
+ default: () => {};
926
+ };
915
927
  }, {
916
928
  $attrs: {
917
929
  [x: string]: unknown;
@@ -1013,6 +1025,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1013
1025
  type: NumberConstructor;
1014
1026
  default: number;
1015
1027
  };
1028
+ printCustomProps: {
1029
+ type: ObjectConstructor;
1030
+ default: () => {};
1031
+ };
1016
1032
  }>> & {}>>;
1017
1033
  emit: any;
1018
1034
  defaultFormatInfo: import("../../shared/types").AnyObject;
@@ -1342,6 +1358,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1342
1358
  type: NumberConstructor;
1343
1359
  default: number;
1344
1360
  };
1361
+ printCustomProps: {
1362
+ type: ObjectConstructor;
1363
+ default: () => {};
1364
+ };
1345
1365
  }>>, {
1346
1366
  params: import("../../shared/types").AnyObject[];
1347
1367
  btnText: string;
@@ -1366,6 +1386,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1366
1386
  showLoading: boolean;
1367
1387
  hideButtons: unknown[];
1368
1388
  printCopies: number;
1389
+ printCustomProps: Record<string, any>;
1369
1390
  }>>;
1370
1391
  getProps: import("vue").ComputedRef<Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
1371
1392
  printParams: {
@@ -1460,6 +1481,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1460
1481
  type: NumberConstructor;
1461
1482
  default: number;
1462
1483
  };
1484
+ printCustomProps: {
1485
+ type: ObjectConstructor;
1486
+ default: () => {};
1487
+ };
1463
1488
  newPrintSetting: {
1464
1489
  type: ObjectConstructor;
1465
1490
  default: () => {};
@@ -1568,6 +1593,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1568
1593
  type: NumberConstructor;
1569
1594
  default: number;
1570
1595
  };
1596
+ printCustomProps: {
1597
+ type: ObjectConstructor;
1598
+ default: () => {};
1599
+ };
1571
1600
  newPrintSetting: {
1572
1601
  type: ObjectConstructor;
1573
1602
  default: () => {};
@@ -1602,6 +1631,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1602
1631
  showLoading: boolean;
1603
1632
  hideButtons: unknown[];
1604
1633
  printCopies: number;
1634
+ printCustomProps: Record<string, any>;
1605
1635
  newPrintSetting: Record<string, any>;
1606
1636
  }>>;
1607
1637
  export default ButtonPrint;
@@ -97,6 +97,10 @@ declare const _default: import("vue").DefineComponent<{
97
97
  type: NumberConstructor;
98
98
  default: number;
99
99
  };
100
+ printCustomProps: {
101
+ type: ObjectConstructor;
102
+ default: () => {};
103
+ };
100
104
  newPrintSetting: {
101
105
  type: ObjectConstructor;
102
106
  default: () => {};
@@ -201,6 +205,10 @@ declare const _default: import("vue").DefineComponent<{
201
205
  type: NumberConstructor;
202
206
  default: number;
203
207
  };
208
+ printCustomProps: {
209
+ type: ObjectConstructor;
210
+ default: () => {};
211
+ };
204
212
  newPrintSetting: {
205
213
  type: ObjectConstructor;
206
214
  default: () => {};
@@ -918,6 +926,10 @@ declare const _default: import("vue").DefineComponent<{
918
926
  type: NumberConstructor;
919
927
  default: number;
920
928
  };
929
+ printCustomProps: {
930
+ type: ObjectConstructor;
931
+ default: () => {};
932
+ };
921
933
  }, {
922
934
  $attrs: {
923
935
  [x: string]: unknown;
@@ -1019,6 +1031,10 @@ declare const _default: import("vue").DefineComponent<{
1019
1031
  type: NumberConstructor;
1020
1032
  default: number;
1021
1033
  };
1034
+ printCustomProps: {
1035
+ type: ObjectConstructor;
1036
+ default: () => {};
1037
+ };
1022
1038
  }>> & {}>>;
1023
1039
  emit: any;
1024
1040
  defaultFormatInfo: AnyObject;
@@ -1348,6 +1364,10 @@ declare const _default: import("vue").DefineComponent<{
1348
1364
  type: NumberConstructor;
1349
1365
  default: number;
1350
1366
  };
1367
+ printCustomProps: {
1368
+ type: ObjectConstructor;
1369
+ default: () => {};
1370
+ };
1351
1371
  }>>, {
1352
1372
  params: AnyObject[];
1353
1373
  btnText: string;
@@ -1372,6 +1392,7 @@ declare const _default: import("vue").DefineComponent<{
1372
1392
  showLoading: boolean;
1373
1393
  hideButtons: unknown[];
1374
1394
  printCopies: number;
1395
+ printCustomProps: Record<string, any>;
1375
1396
  }>>;
1376
1397
  getProps: import("vue").ComputedRef<Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
1377
1398
  printParams: {
@@ -1469,6 +1490,10 @@ declare const _default: import("vue").DefineComponent<{
1469
1490
  type: NumberConstructor;
1470
1491
  default: number;
1471
1492
  };
1493
+ printCustomProps: {
1494
+ type: ObjectConstructor;
1495
+ default: () => {};
1496
+ };
1472
1497
  newPrintSetting: {
1473
1498
  type: ObjectConstructor;
1474
1499
  default: () => {};
@@ -1580,6 +1605,10 @@ declare const _default: import("vue").DefineComponent<{
1580
1605
  type: NumberConstructor;
1581
1606
  default: number;
1582
1607
  };
1608
+ printCustomProps: {
1609
+ type: ObjectConstructor;
1610
+ default: () => {};
1611
+ };
1583
1612
  newPrintSetting: {
1584
1613
  type: ObjectConstructor;
1585
1614
  default: () => {};
@@ -1614,6 +1643,7 @@ declare const _default: import("vue").DefineComponent<{
1614
1643
  showLoading: boolean;
1615
1644
  hideButtons: unknown[];
1616
1645
  printCopies: number;
1646
+ printCustomProps: Record<string, any>;
1617
1647
  newPrintSetting: Record<string, any>;
1618
1648
  }>;
1619
1649
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as t,useAttrs as e,ref as r,computed as n,provide as i,openBlock as o,createBlock as a,resolveDynamicComponent as p,unref as u,mergeProps as l,withCtx as s,createCommentVNode as d,renderSlot as f,normalizeProps as y,guardReactiveProps as m}from"vue";import{InjectionButtonPrintEmits as c}from"./constants/index.js";import g from"./components/NewPrintComponent.vue.js";import P from"./components/OldPrintComponent.vue.js";var v=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},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},newPrintSetting:{type:Object,default:()=>({})}},emits:["success","error","cancel","clickoutside","saveOuterPrint"],setup(t,{expose:v,emit:S}){const b=t,x=e(),F=r(),j=n((()=>{var t;return(null==(t=Object.keys(b.newPrintSetting))?void 0:t.length)>0?g:P})),O=n((()=>Object.assign({},b,x)));i(c,(function(t,...e){S(t,...e)}));return v({directPrint:async()=>{var t;null==(t=F.value)||t.directPrint()}}),(t,e)=>(o(),a(p(u(j)),l({ref_key:"printComponentRef",ref:F},u(O)),{button:s((e=>[d(" 自定义按钮样式 "),f(t.$slots,"button",y(m(e)))])),_:3},16))}});export{v as default};
1
+ import{defineComponent as t,useAttrs as e,ref as r,computed as n,provide as i,openBlock as o,createBlock as a,resolveDynamicComponent as p,unref as u,mergeProps as s,withCtx as l,createCommentVNode as d,renderSlot as f,normalizeProps as y,guardReactiveProps as m}from"vue";import{InjectionButtonPrintEmits as c}from"./constants/index.js";import g from"./components/NewPrintComponent.vue.js";import P from"./components/OldPrintComponent.vue.js";var v=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},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},printCustomProps:{type:Object,default:()=>({})},newPrintSetting:{type:Object,default:()=>({})}},emits:["success","error","cancel","clickoutside","saveOuterPrint"],setup(t,{expose:v,emit:S}){const b=t,x=e(),j=r(),F=n((()=>{var t;return(null==(t=Object.keys(b.newPrintSetting))?void 0:t.length)>0?g:P})),O=n((()=>Object.assign({},b,x)));i(c,(function(t,...e){S(t,...e)}));return v({directPrint:async()=>{var t;null==(t=j.value)||t.directPrint()}}),(t,e)=>(o(),a(p(u(F)),s({ref_key:"printComponentRef",ref:j},u(O)),{button:l((e=>[d(" 自定义按钮样式 "),f(t.$slots,"button",y(m(e)))])),_:3},16))}});export{v as default};
@@ -98,6 +98,10 @@ declare const _default: import("vue").DefineComponent<{
98
98
  type: NumberConstructor;
99
99
  default: number;
100
100
  };
101
+ printCustomProps: {
102
+ type: ObjectConstructor;
103
+ default: () => {};
104
+ };
101
105
  }, {
102
106
  $attrs: {
103
107
  [x: string]: unknown;
@@ -202,6 +206,10 @@ declare const _default: import("vue").DefineComponent<{
202
206
  type: NumberConstructor;
203
207
  default: number;
204
208
  };
209
+ printCustomProps: {
210
+ type: ObjectConstructor;
211
+ default: () => {};
212
+ };
205
213
  }>> & {}>>;
206
214
  emit: any;
207
215
  defaultFormatInfo: AnyObject;
@@ -534,6 +542,10 @@ declare const _default: import("vue").DefineComponent<{
534
542
  type: NumberConstructor;
535
543
  default: number;
536
544
  };
545
+ printCustomProps: {
546
+ type: ObjectConstructor;
547
+ default: () => {};
548
+ };
537
549
  }>>, {
538
550
  params: AnyObject[];
539
551
  btnText: string;
@@ -558,5 +570,6 @@ declare const _default: import("vue").DefineComponent<{
558
570
  showLoading: boolean;
559
571
  hideButtons: unknown[];
560
572
  printCopies: number;
573
+ printCustomProps: Record<string, any>;
561
574
  }>;
562
575
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as t,useAttrs as e,inject as n,ref as i,reactive as a,computed as r,onMounted as l,watch as o,openBlock as s,createElementBlock as p,Fragment as d,createVNode as u,unref as m,withCtx as c,renderSlot as f,withModifiers as y,createTextVNode as v,toDisplayString as g,mergeProps as b}from"vue";import{isObject as h}from"@vue/shared";import{useMessage as I,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as T}from"../constants/index.js";import{Print as S}from"../utils/print.js";import{isIReport as x}from"../utils/browserPrint.js";import O from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as L,getPrivateFormatApi as D}from"../api.js";var E=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1}},setup(t,{expose:E}){var M;const N=t,C=e(),V=I();let B;const R=n(T),z={},A=i(""),J=a({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let U=i([{label:N.printText,key:"printText"},{label:N.previewText,key:"previewText"},{label:N.pdfLoadText,key:"downloadPdf"},{label:N.formatEditText,key:"formatEditText"},...(null==(M=N.externalOptionConfig)?void 0:M.options)||[]]);const q=r((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=r((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=r((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(N.directPrint){if(J.spinning)return;return"button"===t?void await ut():st()}return st()},H=t=>u("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};R("success",t,n)},$=t=>{J.spinning=!1,R("error",t),h(t)&&"notInstalledApp"===t.type&&V.error(t.message)},Q=t=>{J.spinning=!1,R("cancel",t)},W=t=>{R("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=N.printParams)?void 0:e.length)?N.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...N.token?{token:N.token}:{}})},Z=()=>{var t,e;let n={},i={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{i[t]=[],J.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),i),JSON.stringify(n)},tt=((t,e,n=!0)=>{let i=null;return function(...a){i&&clearTimeout(i),n&&!i&&t.apply(null,a),i=setTimeout((()=>{i=null,!n&&t.apply(null,a)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};N.showLoading&&J.spinning||(J.spinning=!0,N.prevFn("print").then((()=>{const t={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:N.printdlgshow,signature:N.signature,copies:N.printCopies};if("MULTI"===N.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),B.printDirect({...t,params:X(n)},e,$,Q);else B.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,i;switch(t){case"printText":tt();break;case"previewText":(async()=>{N.showLoading&&J.spinning||(J.spinning=!0,N.prevFn("preview").then((()=>{const t="MULTI"===N.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,params:t,btnprint:N.btnprint,signature:N.signature};B.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":N.showLoading&&J.spinning||(J.spinning=!0,N.prevFn("edit").then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{N.showLoading&&J.spinning||(J.spinning=!0,N.prevFn("download").then((()=>{const t="MULTI"===N.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1"},params:t,signature:N.signature};B.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const a=J.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==a?void 0:a.name)||e.label,await L({formatForms:[{...a}],name:z.name||a.templateName,number:z.number||a.number,templateId:z.templateId||a.templateId,...z.id?{id:z.id}:{}},{token:N.token})}else null==(i=null==(n=N.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},nt=()=>{J.visible=!1,R("clickoutside")},it=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),at=(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=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},rt=({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(at(n,e,"fieldName"))}})),i=Object.assign({},i,at(n,e,"key")),i})),lt=async t=>{var e;if(J.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!C.isDoc){const{data:e}=await D({templateId:t[0].templateId},{token:N.token});if("SUCCESS"===e.result){const{formatForms:i=[]}=e.map||{};Object.assign(z,e.map||{});const a=null==(n=null==i?void 0:i[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}}const i=t.find((t=>1==t[e]));return(null==i?void 0:i.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],V.error(N.noDefaultFormatMsg),it();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),N.hideButtons.length>0&&(U.value=U.value.filter((t=>!N.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")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await N.queryTemplateParams())?void 0:e.obj;if(!n||!_.value)return V.error("获取打印模板失败,请联系管理员!"),it();J.templateParams=n,J.printParams=rt(J.templateParams,N.params)},ot=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(B)return!1;B=new S})();const e=await N.queryPrintFormatByNumber();return await lt(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await N.clickPrevFn())if((null==(e=N.params)?void 0:e.length)||(null==(n=N.printParams)?void 0:n.length)){if(!J.visible){if(!await ot())return!1}t&&(J.visible=!J.visible)}else V.warning(N.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=rt(J.templateParams,N.params):J.watchPrintParamsReformatFn=()=>o((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},dt=t=>{if(J.identityVerification.visible=!1,x(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};B.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function ut(){await st(!1),tt()}return l((()=>{J.isInited=!1})),o((()=>N.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),E({directPrint:ut}),(e,n)=>(s(),p(d,null,[u(m(P),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[u(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=y((()=>G("button")),["stop"]))},{default:c((()=>[v(g(t.btnText)+" ",1),u(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=y((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),u(O,b(m(C),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:dt}),null,16,["modelValue","formatId","templateId"])],64))}});export{E as default};
1
+ import{defineComponent as t,useAttrs as e,inject as n,ref as i,reactive as a,computed as r,onMounted as o,watch as l,openBlock as s,createElementBlock as p,Fragment as d,createVNode as u,unref as m,withCtx as c,renderSlot as f,withModifiers as y,createTextVNode as v,toDisplayString as g,mergeProps as b}from"vue";import{isObject as h}from"@vue/shared";import{useMessage as I,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as T}from"../constants/index.js";import{Print as S}from"../utils/print.js";import{isIReport as x}from"../utils/browserPrint.js";import O from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as L,getPrivateFormatApi as D}from"../api.js";var E=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},printCustomProps:{type:Object,default:()=>({})}},setup(t,{expose:E}){var M;const C=t,N=e(),V=I();let B;const R=n(T),z={},A=i(""),J=a({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let U=i([{label:C.printText,key:"printText"},{label:C.previewText,key:"previewText"},{label:C.pdfLoadText,key:"downloadPdf"},{label:C.formatEditText,key:"formatEditText"},...(null==(M=C.externalOptionConfig)?void 0:M.options)||[]]);const q=r((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=r((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=r((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(C.directPrint){if(J.spinning)return;return"button"===t?void await ut():st()}return st()},H=t=>u("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};R("success",t,n)},$=t=>{J.spinning=!1,R("error",t),h(t)&&"notInstalledApp"===t.type&&V.error(t.message)},Q=t=>{J.spinning=!1,R("cancel",t)},W=t=>{R("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=C.printParams)?void 0:e.length)?C.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...C.token?{token:C.token}:{},...C.printCustomProps||{}})},Z=()=>{var t,e;let n={},i={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{i[t]=[],J.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),i),JSON.stringify(n)},tt=((t,e,n=!0)=>{let i=null;return function(...a){i&&clearTimeout(i),n&&!i&&t.apply(null,a),i=setTimeout((()=>{i=null,!n&&t.apply(null,a)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("print").then((()=>{const t={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:C.printdlgshow,signature:C.signature,copies:C.printCopies};if("MULTI"===C.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),B.printDirect({...t,params:X(n)},e,$,Q);else B.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,i;switch(t){case"printText":tt();break;case"previewText":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("preview").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,params:t,btnprint:C.btnprint,signature:C.signature};B.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("edit").then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("download").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1"},params:t,signature:C.signature};B.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const a=J.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==a?void 0:a.name)||e.label,await L({formatForms:[{...a}],name:z.name||a.templateName,number:z.number||a.number,templateId:z.templateId||a.templateId,...z.id?{id:z.id}:{}},{token:C.token})}else null==(i=null==(n=C.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},nt=()=>{J.visible=!1,R("clickoutside")},it=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),at=(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=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},rt=({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(at(n,e,"fieldName"))}})),i=Object.assign({},i,at(n,e,"key")),i})),ot=async t=>{var e;if(J.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!N.isDoc){const{data:e}=await D({templateId:t[0].templateId},{token:C.token});if("SUCCESS"===e.result){const{formatForms:i=[]}=e.map||{};Object.assign(z,e.map||{});const a=null==(n=null==i?void 0:i[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}}const i=t.find((t=>1==t[e]));return(null==i?void 0:i.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],V.error(C.noDefaultFormatMsg),it();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),C.hideButtons.length>0&&(U.value=U.value.filter((t=>!C.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),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")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await C.queryTemplateParams())?void 0:e.obj;if(!n||!_.value)return V.error("获取打印模板失败,请联系管理员!"),it();J.templateParams=n,J.printParams=rt(J.templateParams,C.params)},lt=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(B)return!1;B=new S})();const e=await C.queryPrintFormatByNumber();return await ot(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await C.clickPrevFn())if((null==(e=C.params)?void 0:e.length)||(null==(n=C.printParams)?void 0:n.length)){if(!J.visible){if(!await lt())return!1}t&&(J.visible=!J.visible)}else V.warning(C.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=rt(J.templateParams,C.params):J.watchPrintParamsReformatFn=()=>l((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},dt=t=>{if(J.identityVerification.visible=!1,x(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};B.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function ut(){await st(!1),tt()}return o((()=>{J.isInited=!1})),l((()=>C.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),E({directPrint:ut}),(e,n)=>(s(),p(d,null,[u(m(P),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[u(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=y((()=>G("button")),["stop"]))},{default:c((()=>[v(g(t.btnText)+" ",1),u(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=y((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),u(O,b(m(N),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:dt}),null,16,["modelValue","formatId","templateId"])],64))}});export{E as default};
@@ -90,6 +90,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
90
90
  useMeasureRuler: any;
91
91
  useCaliper: any;
92
92
  useCaliperRuler: any;
93
+ useRectRuler: any;
93
94
  updatePolyline: any;
94
95
  getGridInfo: any;
95
96
  init: () => import("../../shared/types").AnyObject;
@@ -84,6 +84,7 @@ declare const _default: import("vue").DefineComponent<{
84
84
  useMeasureRuler: any;
85
85
  useCaliper: any;
86
86
  useCaliperRuler: any;
87
+ useRectRuler: any;
87
88
  updatePolyline: any;
88
89
  getGridInfo: any;
89
90
  init: () => AnyObject;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,reactive as t,computed as o,onMounted as s,onBeforeUnmount as a,openBlock as i,createElementBlock as p,normalizeStyle as l,unref as n,createElementVNode as u,Fragment as c,createVNode as h,mergeProps as d,createCommentVNode as m}from"vue";import{fabric as f}from"../../../shared/utils/fabricjs/index.js";import v from"./components/PopupTip.vue.js";import g from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"./hooks/useEvent.js";import{useBirthProcessChart as w}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as C}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";import{useElectrocardiogramChart as y}from"./hooks/electrocardiogram/useElectrocardiogramChart.js";import{useNewBirthProcessChart as j}from"./hooks/newBirthProcess/useNewBirthProcessChart.js";var P=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},popupTipRender:{type:Function},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent","click:grid","eventClick"],setup(e,{expose:P,emit:R}){const b=e,x=r(null),I=r(),T=t({show:!1,point:{x:0,y:0},list:[],movable:!1,sourceData:[],isTarget:!1}),M=t({show:!1,point:{x:0,y:0},list:[],target:null}),B=o((()=>{var e;return null==(e=I.value)?void 0:e.wrapperEl})),A=o((()=>({width:`${b.data.width||800}px`,height:`${b.data.height||500}px`}))),{propItems:E,redrawPoints:F,select:S,clickMenu:_,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,updatePolyline:q,getGridInfo:H}=function(){const e=[I,b,R,x,T,M];switch(b.type){case"birthProcess":return w(...e);case"surgicalAnesthesia":return k(...e,!!b.popupTipRender);case"electrocardiogram":return y(...e);case"newBirthProcess":return j(...e);default:return C(...e)}}();return s((()=>{I.value=new f.Canvas(x.value,{width:E.canvasWidth,height:E.canvasHeight,backgroundColor:"#fff",selection:!1,stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),a((()=>{var e,r,t,o;null==(r=null==(e=I.value)?void 0:e.off)||r.call(e),null==(o=null==(t=I.value)?void 0:t.clear)||o.call(t)})),P({redrawPoints:F,select:S,canvas:I,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,updatePolyline:q,getGridInfo:H}),(r,t)=>(i(),p("div",{class:"c-fabric-chart",style:l(n(A))},[u("canvas",{ref_key:"canvasRef",ref:x},null,512),n(B)?(i(),p(c,{key:0},[h(v,d({popupTipRender:e.popupTipRender,...T},{propItems:n(E)}),null,16,["propItems"]),h(n(g),d({propItems:n(E)},M,{show:M.show,"onUpdate:show":t[0]||(t[0]=e=>M.show=e),onClickMenu:n(_)}),null,16,["propItems","show","onClickMenu"])],64)):m("v-if",!0)],4))}});export{P as default};
1
+ import{defineComponent as e,ref as r,reactive as t,computed as o,onMounted as s,onBeforeUnmount as a,openBlock as i,createElementBlock as u,normalizeStyle as l,unref as p,createElementVNode as n,Fragment as c,createVNode as h,mergeProps as d,createCommentVNode as m}from"vue";import{fabric as f}from"../../../shared/utils/fabricjs/index.js";import v from"./components/PopupTip.vue.js";import g from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"./hooks/useEvent.js";import{useBirthProcessChart as w}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as C}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";import{useElectrocardiogramChart as R}from"./hooks/electrocardiogram/useElectrocardiogramChart.js";import{useNewBirthProcessChart as y}from"./hooks/newBirthProcess/useNewBirthProcessChart.js";var j=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},popupTipRender:{type:Function},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent","click:grid","eventClick"],setup(e,{expose:j,emit:P}){const b=e,x=r(null),I=r(),T=t({show:!1,point:{x:0,y:0},list:[],movable:!1,sourceData:[],isTarget:!1}),M=t({show:!1,point:{x:0,y:0},list:[],target:null}),B=o((()=>{var e;return null==(e=I.value)?void 0:e.wrapperEl})),A=o((()=>({width:`${b.data.width||800}px`,height:`${b.data.height||500}px`}))),{propItems:E,redrawPoints:F,select:S,clickMenu:_,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,useRectRuler:q,updatePolyline:H,getGridInfo:N}=function(){const e=[I,b,P,x,T,M];switch(b.type){case"birthProcess":return w(...e);case"surgicalAnesthesia":return k(...e,!!b.popupTipRender);case"electrocardiogram":return R(...e);case"newBirthProcess":return y(...e);default:return C(...e)}}();return s((()=>{I.value=new f.Canvas(x.value,{width:E.canvasWidth,height:E.canvasHeight,backgroundColor:"#fff",selection:!1,stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),a((()=>{var e,r,t,o;null==(r=null==(e=I.value)?void 0:e.off)||r.call(e),null==(o=null==(t=I.value)?void 0:t.clear)||o.call(t)})),j({redrawPoints:F,select:S,canvas:I,useMeasureRuler:D,useCaliper:G,useCaliperRuler:$,useRectRuler:q,updatePolyline:H,getGridInfo:N}),(r,t)=>(i(),u("div",{class:"c-fabric-chart",style:l(p(A))},[n("canvas",{ref_key:"canvasRef",ref:x},null,512),p(B)?(i(),u(c,{key:0},[h(v,d({popupTipRender:e.popupTipRender,...T},{propItems:p(E)}),null,16,["propItems"]),h(p(g),d({propItems:p(E)},M,{show:M.show,"onUpdate:show":t[0]||(t[0]=e=>M.show=e),onClickMenu:p(_)}),null,16,["propItems","show","onClickMenu"])],64)):m("v-if",!0)],4))}});export{j as default};
@@ -9,6 +9,7 @@ export declare function useElectrocardiogramChart(canvas: Ref<fabric.Canvas>, pr
9
9
  useMeasureRuler: Ref<any>;
10
10
  useCaliper: Ref<any>;
11
11
  useCaliperRuler: Ref<any>;
12
+ useRectRuler: Ref<any>;
12
13
  getGridInfo: () => {
13
14
  cellWidth: number;
14
15
  cellHeight: number;
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,unref as u,watch as r}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{cloneDeep as o,isNumber as d,last as v}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as m}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as s}from"./useElectrocardiogram.js";import{useMeasureInstrument as c}from"./useMeasureInstrument.js";function g(g,h,f,p,N,b){const M=e(),y=e(),L=e(),x=e(),C=a((()=>h.data.width)),S=a((()=>h.data.height)),w=a((()=>{const{dataList:e=[],config:a={}}=h.data,t=o(e),u=t.find((e=>a.lastDataKey&&e.key===a.lastDataKey));return u?[...t,u]:t})),E=a((()=>(C.value-0)/Y.value)),X=a((()=>(S.value-0)/j.value)),Y=a((()=>{var e,a,t;const{config:u,grid:r}=h.data;if(d(r.gridXNumber))return r.gridXNumber;const l=(null!=(t=null==(a=null==(e=v(w.value))?void 0:e.data)?void 0:a.length)?t:0)/u.hz;return Math.ceil(l/u.mainXCellValue)})),j=a((()=>{const{config:e,grid:a}=h.data;if(d(a.gridYNumber))return a.gridYNumber;const t=w.value.length;return Math.ceil(R.value*t*2/e.mainYCellValue)})),R=a((()=>{var e;const{config:a}=h.data,t=null==(e=v(w.value))?void 0:e.data,u=Math.max(...t)-Math.min(...t);return"uv"===a.valueUnit?.001*u:"v"===a.valueUnit?1e3*u:u})),I=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),U=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),A=a((()=>{const{rowNumber:e}=U.value,a=w.value.length;return Math.round(j.value/(e+(a===m.MAXLINENUMBER?1:0)))})),B=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:r}=U.value,l=e/u,i=w.value.length,n=Math.ceil(A.value/2),o=function(){const{valueUnit:e,mainYCellValue:t}=a,r=w.value[0].data,l=o(Math.max(...r));if(2!==u)return l;const i=w.value[6].data,n=o(Math.max(...i));return Math.max(l,n);function o(a){return("uv"===e?.001*a:"v"===e?1e3*a:a)/t*X.value}}(),d=X.value*n,v=1===u||d<o?X.value*Math.ceil(o/X.value):d,s=4===u?0:E.value;return w.value.map(((e,a)=>{const t=m.MAXLINENUMBER===i&&a===i-1?r:a%r;return{...e,origin:{x:(m.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/r))*l+s,y:t*(X.value*A.value)+v,rowIdx:t}}}))})),H=a((()=>{var e;const{calibrationLineGridYNumber:a,mainYCellValue:t}=(null==(e=h.data)?void 0:e.config)||{};return a?X.value*a:t?X.value/t:X.value})),V=t({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...l,...h.data.borderStyle},lineStyle:{...i,...h.data.lineStyle},titleStyle:{...n,...h.data.titleStyle},measureLineStyle:{...i,...h.data.measureLineStyle},measureTextStyle:{...n,...h.data.measureTextStyle},grid:h.data.grid,originX:0,endX:C.value,originY:0,endY:S.value,xCellWidth:E.value,yCellHeight:X.value,gridXNumber:Y.value,gridYNumber:j.value,event:I.value,dataList:B.value,columnNumber:u(U).columnNumber,rowNumber:u(U).rowNumber,config:h.data.config,calibrationLineHeight:u(H)});return r((()=>g.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:u}=c(g,V),{updatePolyline:r}=s(g,V,a);y.value=e,L.value=t,x.value=u,M.value=r}()}),{immediate:!0}),{propItems:V,updatePolyline:M,useMeasureRuler:y,useCaliper:L,useCaliperRuler:x,getGridInfo:function(){return{cellWidth:E.value,cellHeight:X.value,smallCellNumber:m.SMALLCELLNUMBER}}}}export{g as useElectrocardiogramChart};
1
+ import{ref as e,computed as a,reactive as t,unref as u,watch as r}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{cloneDeep as o,isNumber as d,last as v}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as s}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as m}from"./useElectrocardiogram.js";import{useMeasureInstrument as c}from"./useMeasureInstrument.js";function g(g,h,f,p,N,b){const M=e(),y=e(),L=e(),x=e(),C=e(),R=a((()=>h.data.width)),S=a((()=>h.data.height)),w=a((()=>{const{dataList:e=[],config:a={}}=h.data,t=o(e),u=t.find((e=>a.lastDataKey&&e.key===a.lastDataKey));return u?[...t,u]:t})),E=a((()=>(R.value-0)/Y.value)),X=a((()=>(S.value-0)/j.value)),Y=a((()=>{var e,a,t;const{config:u,grid:r}=h.data;if(d(r.gridXNumber))return r.gridXNumber;const l=(null!=(t=null==(a=null==(e=v(w.value))?void 0:e.data)?void 0:a.length)?t:0)/u.hz;return Math.ceil(l/u.mainXCellValue)})),j=a((()=>{const{config:e,grid:a}=h.data;if(d(a.gridYNumber))return a.gridYNumber;const t=w.value.length;return Math.ceil(I.value*t*2/e.mainYCellValue)})),I=a((()=>{var e;const{config:a}=h.data,t=null==(e=v(w.value))?void 0:e.data,u=Math.max(...t)-Math.min(...t);return"uv"===a.valueUnit?.001*u:"v"===a.valueUnit?1e3*u:u})),U=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),A=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),B=a((()=>{const{rowNumber:e}=A.value,a=w.value.length;return Math.round(j.value/(e+(a===s.MAXLINENUMBER?1:0)))})),H=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:r}=A.value,l=e/u,i=w.value.length,n=Math.ceil(B.value/2),o=function(){const{valueUnit:e,mainYCellValue:t}=a,r=w.value[0].data,l=o(Math.max(...r));if(2!==u)return l;const i=w.value[6].data,n=o(Math.max(...i));return Math.max(l,n);function o(a){return("uv"===e?.001*a:"v"===e?1e3*a:a)/t*X.value}}(),d=X.value*n,v=1===u||d<o?X.value*Math.ceil(o/X.value):d,m=4===u?0:E.value;return w.value.map(((e,a)=>{const t=s.MAXLINENUMBER===i&&a===i-1?r:a%r;return{...e,origin:{x:(s.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/r))*l+m,y:t*(X.value*B.value)+v,rowIdx:t}}}))})),V=a((()=>{var e;const{calibrationLineGridYNumber:a,mainYCellValue:t}=(null==(e=h.data)?void 0:e.config)||{};return a?X.value*a:t?X.value/t:X.value})),D=t({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...l,...h.data.borderStyle},lineStyle:{...i,...h.data.lineStyle},titleStyle:{...n,...h.data.titleStyle},measureLineStyle:{...i,...h.data.measureLineStyle},measureTextStyle:{...n,...h.data.measureTextStyle},grid:h.data.grid,originX:0,endX:R.value,originY:0,endY:S.value,xCellWidth:E.value,yCellHeight:X.value,gridXNumber:Y.value,gridYNumber:j.value,event:U.value,dataList:H.value,columnNumber:u(A).columnNumber,rowNumber:u(A).rowNumber,config:h.data.config,calibrationLineHeight:u(V)});return r((()=>g.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:u,useRectRuler:r}=c(g,D),{updatePolyline:l}=m(g,D,a);y.value=e,L.value=t,x.value=u,M.value=l,C.value=r}()}),{immediate:!0}),{propItems:D,updatePolyline:M,useMeasureRuler:y,useCaliper:L,useCaliperRuler:x,useRectRuler:C,getGridInfo:function(){return{cellWidth:E.value,cellHeight:X.value,smallCellNumber:s.SMALLCELLNUMBER}}}}export{g as useElectrocardiogramChart};
@@ -6,4 +6,5 @@ export declare function useMeasureInstrument(canvas: Ref<fabric.Canvas>, propIte
6
6
  useMeasureRuler: () => void;
7
7
  useCaliper: () => void;
8
8
  useCaliperRuler: () => void;
9
+ useRectRuler: () => void;
9
10
  };
@@ -1 +1 @@
1
- import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as r}from"../useDraw.js";import{useElectrocardiogramCumputedPoint as i}from"../useCumputedPoint.js";import"../useEvent.js";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,l){const{getXValue:s,getYValue:u}=i(l),{yCellHeight:a,xCellWidth:c,measureLineStyle:f,measureTextStyle:h}=l,d=e(!1),v={origin:{x:0,y:0},line:null,rendering:!1},p={origin:{x:300,y:0},caliper:{width:4*c,height:60,rect:null},caliperRuler:{width:6*c,height:120,rect:null}};function m(e){C();const{width:o,height:i,rect:l}=p[e];if(l)return;const{x:s,y:u}=p.origin,a=p.caliper.height;p[e].rect=new t.Rect({left:s,top:u,width:o,height:i,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"move"});const c={...f,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",strokeWidth:2,__type:e,evented:!0,selectable:!0},d=new t.Line([s,u,s,i],{...c,lockMovementY:!0,originX:"center"}),v=new t.Line([s+o,u,s+o,i],{...c,lockMovementY:!0,originX:"center"}),m=new t.Line([s,a,s+o,a],{...c,lockMovementX:!0,evented:"caliper"===e,hoverCursor:"caliper"===e?"n-resize":"default",originY:"center"}),y=r([s,m.top+10],{value:x(m.x1,m.x2),...h,originX:"left",originY:"top"});d.rect=p[e].rect,v.rect=p[e].rect,m.rect=p[e].rect,Object.assign(p[e].rect,{leftLine:d,rightLine:v,horizontalLine:m,text:y}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:r,horizontalLine:i,text:n}=e;null==o||o.setCoords().set({x1:e.left,y1:e.top,x2:e.left,y2:e.top+e.height}),null==r||r.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const l="caliper"===t?e.top+e.height:e.top+e.height/2;null==i||i.setCoords().set({x1:e.left,y1:l,x2:e.left+e.width,y2:l}),n.setCoords().set({left:e.left,top:l+10})})),e.on("mouseup",(t=>{1===t.button&&(n.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront())}))}(p[e].rect,e),g(d,"left"),g(v,"right"),"caliper"===e&&g(m,"horizontal"),n.value.add(p[e].rect,d,v,m,y)}function x(e,t){return`${1e3*s(t-e)}ms`}function g(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:r,rightLine:i,horizontalLine:n,text:l}=o;if("horizontal"===t)return e.top<=o.top?e.setCoords().set({y1:o.top,y2:o.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==r||r.setCoords().set({y2:e.top}),null==i||i.setCoords().set({y2:e.top}),void l.setCoords().set({top:e.top+10});"left"===t&&(e.left>=i.left?e.setCoords().set({x1:i.left,x2:i.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left,width:i.left-e.left}),n.setCoords().set({x1:e.left}),l.setCoords().set({left:e.left})),"right"===t&&(e.left<=r.left?e.setCoords().set({x1:r.left,x2:r.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-r.left}),n.setCoords().set({x2:e.left})),l.set("text",x(n.x1,n.x2))}))}function C(){Object.values(p).forEach((e=>{const{rect:t}=e;t&&(n.value.remove(t),n.value.remove(t.leftLine),n.value.remove(t.rightLine),n.value.remove(t.horizontalLine),n.value.remove(t.text),e.rect=null)})),v.line&&(n.value.remove(v.line),v.line.text&&n.value.remove(v.line.text),v.line=null)}return n.value.on("mouse:down",(e=>{if(1===e.button&&d.value){const{x:t=0,y:o=0}=e.pointer||{};v.origin={x:t,y:o},v.rendering=!0}})),n.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&d.value&&setTimeout((()=>{d.value=!1,v.rendering=!1})),3===t&&C()})),n.value.on("mouse:move",(e=>{var t;if(1===e.button&&d.value&&v.rendering){const{x:i=0,y:l=0}=e.pointer||{};v.line&&n.value.remove(v.line),(null==(t=v.line)?void 0:t.text)&&n.value.remove(v.line.text);const{x:c,y:d}=v.origin;v.line=o([c,d,i,l],f);const p=-u(l-d).toFixed(2),m=1e3*s(i-c),x=r([i,l+2*a],{value:`${p}mv\n${m}ms`,...h});v.line.text=x,n.value.add(v.line,x)}})),{flag:d,useMeasureRuler:function(){d.value||(d.value=!0)},useCaliper:function(){m("caliper")},useCaliperRuler:function(){m("caliperRuler")}}}export{n as useMeasureInstrument};
1
+ import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as r}from"../useDraw.js";import{useElectrocardiogramCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{isNumber as n}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function i(i,s){const{getXValue:u,getYValue:c}=l(s),{yCellHeight:a,xCellWidth:d,measureLineStyle:h,measureTextStyle:f}=s,p=e(!1),v={origin:{x:0,y:0},line:null,rendering:!1},x={origin:{x:300,y:10},caliper:{width:4*d,height:60,rect:null},caliperRuler:{width:6*d,height:120,rect:null},rectRuler:{width:12*d,height:120,rect:null}};function m(e){C();const{width:o,height:l,rect:n}=x[e];if(n)return;let s;const{x:u,y:c}=x.origin,a=c+x.caliper.height,d=["caliper","rectRuler"].includes(e);x[e].rect=new t.Rect({left:u,top:c,width:o,height:l,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"move"});const p={...h,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",strokeWidth:2,__type:e,evented:!0,selectable:!0},v=new t.Line([u,c,u,c+l],{...p,lockMovementY:!0,originX:"center"}),m=new t.Line([u+o,c,u+o,c+l],{...p,lockMovementY:!0,originX:"center"}),L=new t.Line([u,a,u+o,a],{...p,lockMovementX:!0,evented:d,hoverCursor:d?"n-resize":"default",originY:"center"});let b=g({x1:L.x1,x2:L.x2}).millisecond;if("rectRuler"===e){const{millivolt:e,millisecond:r,bpm:n}=g({x1:u+o,x2:u,y1:c+l,y2:c});b=`测量幅度:${e}\n测试时间:${r}\n瞬时心率:${n}`,L.set({y1:c,y2:c}),s=new t.Line([u,c+l,u+o,c+l],{...p,lockMovementX:!0,evented:!0,hoverCursor:"n-resize",originY:"center"})}const w=r([u,("rectRuler"===e?s.top:L.top)+10],{value:b,...f,originX:"left",originY:"top",backgroundColor:"#fff"});v.rect=x[e].rect,m.rect=x[e].rect,L.rect=x[e].rect,s&&(s.rect=x[e].rect),Object.assign(x[e].rect,{leftLine:v,rightLine:m,horizontalLine:L,horizontalLine2:s,text:w}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:r,horizontalLine:l,horizontalLine2:n,text:i}=e;null==o||o.setCoords().set({x1:e.left,y1:e.top,x2:e.left,y2:e.top+e.height}),null==r||r.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const s=["caliper","rectRuler"].includes(t)?e.top+e.height:e.top+e.height/2;i.setCoords().set({left:e.left,top:s+10}),"rectRuler"===t?(null==l||l.setCoords().set({x1:e.left,x2:e.left+e.width,y1:e.top,y2:e.top}),null==n||n.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})):null==l||l.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})})),e.on("mouseup",(t=>{var o;1===t.button&&(i.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront(),null==(o=e.horizontalLine2)||o.bringToFront())}))}(x[e].rect,e),y(v,"left"),y(m,"right"),d&&y(L,"horizontal"),s&&y(s,"horizontal2");const z=[x[e].rect,v,m,L,s,w].filter((e=>!!e));i.value.add(...z)}function g({x1:e,x2:t,y1:o,y2:r}){const l=(1e3*u(Math.abs(t-e))).toFixed(3);return{millisecond:`${l}ms`,millivolt:`${n(o)&&n(r)?c(Math.abs(r-o)).toFixed(3):0}mv`,bpm:`${(6e4/+l).toFixed(3)}bpm`}}function y(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:r,rightLine:l,horizontalLine:n,horizontalLine2:i,text:s}=o;if(("horizontal"===t&&!i||"horizontal2"===t)&&(e.top<=o.top?e.setCoords().set({y1:o.top,y2:o.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==r||r.setCoords().set({y2:e.top}),null==l||l.setCoords().set({y2:e.top}),s.setCoords().set({top:e.top+10}),!i))return;"horizontal"===t&&i&&(e.top>=i.top?e.setCoords().set({y1:i.top,y2:i.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({top:e.top,height:i.top-e.top}),null==r||r.setCoords().set({y1:e.top}),null==l||l.setCoords().set({y1:e.top}),s.setCoords().set({top:i.top+10})),"left"===t&&(e.left>=l.left?e.setCoords().set({x1:l.left,x2:l.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left,width:l.left-e.left}),n.setCoords().set({x1:e.left}),null==i||i.setCoords().set({x1:e.left}),s.setCoords().set({left:e.left})),"right"===t&&(e.left<=r.left?e.setCoords().set({x1:r.left,x2:r.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-r.left}),n.setCoords().set({x2:e.left}),null==i||i.setCoords().set({x2:e.left}));const{millivolt:u,millisecond:c,bpm:a}=g({x1:n.x1,x2:n.x2,y1:r.y1,y2:r.y2}),d=i?`测量幅度:${u}\n测试时间:${c}\n瞬时心率:${a}`:c;s.set("text",d)}))}function C(){Object.values(x).forEach((e=>{const{rect:t}=e;t&&(i.value.remove(t),t.leftLine&&i.value.remove(t.leftLine),t.rightLine&&i.value.remove(t.rightLine),t.horizontalLine&&i.value.remove(t.horizontalLine),t.horizontalLine2&&i.value.remove(t.horizontalLine2),t.text&&i.value.remove(t.text),e.rect=null)})),v.line&&(i.value.remove(v.line),v.line.text&&i.value.remove(v.line.text),v.line=null)}return i.value.on("mouse:down",(e=>{if(1===e.button&&p.value){const{x:t=0,y:o=0}=e.pointer||{};v.origin={x:t,y:o},v.rendering=!0}})),i.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&p.value&&setTimeout((()=>{p.value=!1,v.rendering=!1})),3===t&&C()})),i.value.on("mouse:move",(e=>{var t;if(1===e.button&&p.value&&v.rendering){const{x:l=0,y:n=0}=e.pointer||{};v.line&&i.value.remove(v.line),(null==(t=v.line)?void 0:t.text)&&i.value.remove(v.line.text);const{x:s,y:u}=v.origin;v.line=o([s,u,l,n],h);const{millivolt:c,millisecond:d}=g({x1:s,x2:l,y1:u,y2:n}),p=r([l,n+2*a],{value:`${c}\n${d}`,...f});v.line.text=p,i.value.add(v.line,p)}})),{flag:p,useMeasureRuler:function(){p.value||(p.value=!0)},useCaliper:function(){m("caliper")},useCaliperRuler:function(){m("caliperRuler")},useRectRuler:function(){m("rectRuler")}}}export{i as useMeasureInstrument};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.2.6-beta.0",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.6-beta.0",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
1
+ var e="@cnhis-design-vue/shared",i="3.2.6-beta.2",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.6-beta.2",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.2.6-beta.0",
3
+ "version": "3.2.6-beta.2",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -72,5 +72,5 @@
72
72
  "iOS 7",
73
73
  "last 3 iOS versions"
74
74
  ],
75
- "gitHead": "c2831f8b3a7bc07e27c94895828c4880a32e29c6"
75
+ "gitHead": "8ff3e251ba4a5a702fbfbc279e4de4a88a13549d"
76
76
  }