cnhis-design-vue 3.2.13-release.0 → 3.2.14-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/es/components/ai-chat/index.d.ts +3 -4
  2. package/es/components/ai-chat/src/Index.vue.d.ts +3 -4
  3. package/es/components/ai-chat/src/Index.vue2.js +1 -1
  4. package/es/components/ai-chat/src/components/ChatBI.vue.d.ts +101 -0
  5. package/es/components/ai-chat/src/components/ChatBI.vue.js +1 -0
  6. package/es/components/ai-chat/src/components/ChatBI.vue2.js +1 -0
  7. package/es/components/ai-chat/src/components/ChatCard.d.ts +13 -0
  8. package/es/components/ai-chat/src/components/ChatCard.js +1 -1
  9. package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +2 -3
  10. package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -1
  11. package/es/components/ai-chat/src/components/ChatMain.d.ts +1 -1
  12. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  13. package/es/components/ai-chat/src/components/ChatPatient.vue2.js +1 -1
  14. package/es/components/ai-chat/src/utils/index.d.ts +1 -0
  15. package/es/components/ai-chat/src/utils/index.js +1 -0
  16. package/es/components/ai-chat/style/index.css +1 -1
  17. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
  18. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  19. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  20. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  21. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  22. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  23. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  24. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +1 -1
  25. package/es/components/fabric-chart/src/utils/index.d.ts +1 -0
  26. package/es/components/fabric-chart/src/utils/index.js +1 -1
  27. package/es/components/form-config/index.d.ts +9 -110
  28. package/es/components/form-config/index.js +1 -1
  29. package/es/components/form-config/src/FormConfig.vue.d.ts +9 -110
  30. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  31. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +2 -0
  32. package/es/components/form-config/src/components/FormConfigCreator.vue2.js +1 -1
  33. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +4 -2
  34. package/es/components/form-config/src/components/FormConfigEdit.vue2.js +1 -1
  35. package/es/components/form-config/src/components/renderer/ComplexNode.vue.d.ts +2 -1
  36. package/es/components/form-config/src/components/renderer/ComplexNode.vue2.js +1 -1
  37. package/es/components/form-config/src/components/renderer/DefaultNode.vue2.js +1 -1
  38. package/es/components/form-config/src/constants/index.d.ts +2 -11
  39. package/es/components/form-config/src/constants/index.js +1 -1
  40. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  41. package/es/components/form-config/src/hooks/useLocale.d.ts +52 -0
  42. package/es/components/form-config/src/hooks/useLocale.js +1 -0
  43. package/es/components/form-config/src/types/index.d.ts +1 -0
  44. package/es/components/form-config/src/utils/index.d.ts +1 -0
  45. package/es/components/form-config/src/utils/index.js +1 -1
  46. package/es/components/form-render/index.js +1 -1
  47. package/es/components/form-render/src/hooks/useComplexOptions.js +1 -1
  48. package/es/components/form-render/src/utils/index.d.ts +1 -0
  49. package/es/components/form-render/src/utils/index.js +1 -1
  50. package/es/components/iho-chat/index.d.ts +104 -1
  51. package/es/components/iho-chat/src/Index.vue.d.ts +104 -1
  52. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  53. package/es/components/iho-chat/src/api/index.d.ts +1 -0
  54. package/es/components/iho-chat/src/api/index.js +1 -1
  55. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +13 -0
  56. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  57. package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +13 -0
  58. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +14 -0
  59. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  60. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +48 -1
  61. package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
  62. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +13 -0
  63. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  64. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  65. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +14 -1
  66. package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
  67. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  68. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +13 -0
  69. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  70. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  71. package/es/components/iho-chat/src/components/SiderList.vue.d.ts +2 -0
  72. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  73. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  74. package/es/components/iho-chat/src/constants/index.d.ts +11 -2
  75. package/es/components/iho-chat/src/constants/index.js +1 -1
  76. package/es/components/iho-chat/src/hooks/useSearchUserList.js +1 -1
  77. package/es/components/iho-chat/src/hooks/useSession.d.ts +2 -0
  78. package/es/components/iho-chat/src/hooks/useSession.js +1 -1
  79. package/es/components/iho-chat/src/utils/index.d.ts +1 -0
  80. package/es/components/iho-chat/src/utils/index.js +1 -1
  81. package/es/components/iho-chat/style/index.css +1 -1
  82. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +20 -0
  83. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  84. package/es/components/iho-table/src/types/index.d.ts +4 -0
  85. package/es/components/iho-table/style/index.css +1 -1
  86. package/es/components/index.css +1 -1
  87. package/es/components/index.js +1 -1
  88. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  89. package/es/components/select-label/src/ihoLabel/IhoLabelFormContent.vue2.js +1 -1
  90. package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +1 -1
  91. package/es/components/table-filter/src/components/render-widget/components/SelectDynamic.vue.d.ts +4 -7
  92. package/es/components/table-filter/src/components/render-widget/components/SelectDynamic.vue2.js +1 -1
  93. package/es/components/table-filter/src/components/render-widget/components/index.d.ts +4 -7
  94. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +4 -7
  95. package/es/env.d.ts +25 -25
  96. package/es/shared/package.json.js +1 -1
  97. package/es/shared/types/index.d.ts +3 -0
  98. package/es/shared/utils/index.d.ts +1 -0
  99. package/es/shared/utils/index.js +1 -1
  100. package/package.json +2 -2
  101. package/es/components/form-config/src/components/FormConfigEventSetting.vue.js +0 -1
  102. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +0 -1
@@ -1 +1 @@
1
- import{defineComponent as e,inject as t,ref as n,reactive as i,computed as r,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as f,renderList as y,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as I}from"vue";import{isObject as O}from"@vue/shared";import{useMessage as C,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as x,NCheckbox as E,NDivider as F}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as R}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as J}from"../constants/index.js";import{Print as U}from"../utils/print.js";import{isIReport as z}from"../utils/browserPrint.js";import A from"./IdentityVerification.vue.js";import{format as K}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{encapBrowserLog as V}from"../../../../shared/utils/index.js";import{useShortcuts as B}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const G={class:"newprint-button-outer"},q={key:0,class:"newprint-button-outer__shortcut"},Y=d("span",{class:"label bold"},"外显设置",-1),H={class:"newprint-button-poperOver"},$={class:"print-lite"},Q={class:"label bold"},W={class:"print-li"},X={class:"print-lite"},Z={key:0,class:"newprint-button-outer__shortcut"},ee={class:"newprint-button-poperOver"},te=["onMouseenter","onClick"],ne={class:"label bold"},ie={class:"newprint-button-poperOver"},re={class:"print-lite"},ae={class:"label bold"},le={class:"print-li"},oe={class:"print-lite"},se=["onClick"],ue={key:0,class:"newprint-button-outer__shortcut"},ce={class:"newprint-button-poperOver"},de=["onMouseenter"],pe={class:"print-lite"},me=["onClick"];var ve=e({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})},svrUpdateIp:{type:String}},setup(e,{expose:ve}){const fe=e,ye=String(navigator.platform).toLowerCase().includes("linux"),ge=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],he=C();let ke;const be=t(J),Pe=n(""),we=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],iReportExecuteMode:1}),Se=n({});let Ie=n([]),Oe=n([{label:fe.previewText,key:"previewText"},{label:fe.pdfLoadText,key:"downloadPdf"},{label:fe.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Ce=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),Le=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),Te=n([]),je=n([]),Me=r((()=>{if(!we.currentFormatId)return{};let e=we.currentFormatId;return we.formatList.find((t=>t.id===e))}));r((()=>{var e;return(null==(e=Me.value)?void 0:e.name)||"格式选择"}));const xe=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.templateId})),Ee=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.number})),Fe=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowPrintAll})),Ne=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowOutSetting})),_e=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.customProps)||{}})),De=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.defaultFormatId)||""})),Re=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.printAllType)||1})),Je=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.shortcut)||{}})),Ue=r((()=>{var e,t;const n=Object.keys(Je.value);if(n.length>0){if(De.value&&n.includes(De.value))return(null==(e=Je.value[De.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=Je.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=r((()=>{const e=ge.map((e=>e.key));return Ie.value.filter((t=>!e.includes(t.key)))})),Ae=r({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ke=async()=>{var e,t;(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await yt(),Le.oneShow=!0},Ve=async e=>{if(fe.directPrint){if(we.spinning)return;return"button"===e?void(Fe.value?await kt():De.value?async function(e){await yt(!1);const t=Te.value.find((t=>t.key==e));t&&it(t.templateCode,t.templateId,t.key,!1)}(De.value):Ke()):Ke()}return Ke()},Be=(e,t)=>we.printParams[t.templateCode]?z(t.key)&&(ye||2==we.iReportExecuteMode)?e.filter((e=>"formatEditText"!=e.key)):e:[],Ge=(e,t)=>{Ce[e]=t},qe=()=>{Te.value=Ie.value.filter((e=>!e.selected)),je.value=ze.value.filter((e=>e.selected)),He("oneShow"),He("isOutSetting"),be("saveOuterPrint",je.value)},Ye=e=>{Le[e]=!0},He=e=>{Ce.oneClickType="",Le[e]=!1,"isOutSetting"==e&&(Le.isOutSetting=!1)},$e=(e,t)=>{tt(!1);let n={type:t,formatId:we.currentFormatId,templateId:(null==e?void 0:e.templateId)||xe.value,templateCode:(null==e?void 0:e.templateCode)||Ee.value};V({type:"进入成功的回调",info:n},"PRINT-SDK"),be("success",e,n)},Qe=e=>{tt(!1),V({type:"进入失败的回调",res:e},"PRINT-SDK"),be("error",e),O(e)&&"notInstalledApp"===e.type&&he.error(e.message)},We=e=>{tt(!1),be("cancel",e)},Xe=e=>{be("error",{message:"前置条件执行错误",type:e,preExecution:!0})},Ze=()=>JSON.stringify({...fe.token?{token:fe.token}:{}}),et=(e=[],t)=>{var n,i;let r={},a={};if((null==(n=we.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(i=Object.keys(e[0].datasetData||{}))?void 0:i[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(Ze()),_e.value,a),JSON.stringify(r)},tt=(e,t)=>{if(we.isClickOuterPrint){if(e&&t){const n=je.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}je.value.forEach((e=>{e.isLoading=!1}))}else we.spinning=e},nt=()=>we.isClickOuterPrint?je.value.some((e=>e.isLoading)):we.spinning,it=(e,t,n,i)=>{const r=we.printParams[e];if(!r)return;we.isClickOuterPrint=i,we.currentFormatId=n;const a=we.originParams[e]||[];rt(r,e,t,n,a)},rt=async(e=[],t,n,i,r=[],a)=>{let l=e.length;const o=async e=>{try{--l<=0&&$e(e,"print")}catch(e){console.log("error",e)}};fe.showLoading&&nt()&&!a||(tt(!0,i),fe.prevFn("print",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const a={formatId:i,iReportExecuteMode:we.iReportExecuteMode,templateId:n,authorizationKey:Pe.value,printdlgshow:fe.printdlgshow,signature:fe.signature,copies:fe.printCopies,svrUpdateIp:fe.svrUpdateIp};if("MULTI"===fe.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[t]));ke.printDirect({...a,params:n},o,Qe,We)}else ke.printDirect({...a,params:et(e,t)},(e=>{e.params=r,e.templateCode=t,e.templateId=n,$e(e,"print")}),Qe,We)})).catch((()=>{Xe("print"),tt(!1)})).finally((()=>{we.visible=!1})))},at=async(e,{templateCode:t,templateId:n,key:i},r)=>{const a=we.printParams[t];if(a)switch(we.isClickOuterPrint=r,we.currentFormatId=i,e){case"previewText":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("preview",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,params:a,btnprint:fe.btnprint,signature:fe.signature};ke.preview(l,(e=>{$e(e,"preview")}),Qe)})).catch((()=>{Xe("preview"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"formatEditText":((e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("edit",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e,we.currentFormatId=i,we.identityVerification.visible=!0})).catch((()=>{Xe("edit")})).finally((()=>{tt(!1)})))})(a,0,n,i);break;case"downloadPdf":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("download",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,print:{print:"1",type:"1",resolution:null==fe?void 0:fe.resolution},params:a,signature:fe.signature};ke.downloadPDF(l,(e=>$e(e,"preview")),Qe)})).catch((()=>{Xe("download"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"resetPrinter":(async(e=[],t,n,i)=>{if(!fe.showLoading||!nt()){tt(!0,i);try{const e=await ke.resetPrinter(i,we.iReportExecuteMode);if(tt(!1),"success"==(null==e?void 0:e.result))return void he.success((null==e?void 0:e.message)||"重置打印机成功");he.warning((null==e?void 0:e.message)||"重置打印机失败")}catch(e){tt(!1),he.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,i)}},lt=()=>{},ot=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},dt(n,t,e))})),n},st=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},pt(n,t,e))})),n},ut=(e,t,n)=>{const i={};return t.forEach((t=>{let r=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(i=K(t,n[e.type])),(null==e?void 0:e.defaultValue)||i})(t,e[t[n]]);e[t[n]]&&r&&(i[t[n]]=r)})),i},ct=({customizeDataset:e=[],param:t=[]},n={})=>{let i={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[e.name]=JSON.stringify(ut(n,t,"fieldName"))})),i=Object.assign({},i,ut(n,t,"key")),i},dt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i],a=n[r];if(!a)return e;e[r]||(e[r]=[]),e[r].push(ct(a,t))}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return e;e[a]||(e[a]=[]),e[a].push(ct(l,t))}return e},pt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i];if(!n[r])return e;e[r]||(e[r]=[]),e[r].push(t)}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r];if(!n[a])return e;e[a]||(e[a]=[]),e[a].push(t)}return e},mt=async e=>{var t;we.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],we.iReportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].iReportExecuteMode||1,(()=>{var e,t,n;const i=Object.keys(Je.value),r=we.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(i.includes(e.id)){const n=Je.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));Ie.value.unshift(...r),Ne.value&&Ie.value.push(...ge),(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(Ie.value.forEach((e=>{var t;(null==(t=fe.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),je.value=Ie.value.filter((e=>e.selected))),Te.value=Ie.value.filter((e=>!e.selected)),fe.hideButtons.length>0&&(Oe.value=Oe.value.filter((e=>!fe.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},i=Object.keys(t);i.includes("RY7.2.21.1.M2.G94181E")||(Oe.value=Oe.value.filter((e=>"downloadPdf"!=e.key))),i.includes("RY7.2.21.1.M2.G33633A")||(Oe.value=Oe.value.filter((e=>"formatEditText"!=e.key))),i.includes("RY7.2.21.1.M2.G99314S")||(Oe.value=Oe.value.filter((e=>"resetPrinter"!=e.key)))}})(),we.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.templateParams,fe.params),ft()},vt=async()=>{var e;if(we.isInited)return!0;we.isInited=!0,we.spinning=!0,(()=>{if(ke)return!1;ke=new U})();const t=await fe.queryPrintFormatByNumber();return await mt(t),(null==(e=t.obj)?void 0:e.length)>0&&(Pe.value=t.obj[0].authorizationKey||""),we.spinning=!1,!0},ft=async()=>{const e=Object.keys(Je.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],i=Je.value[n],{stop:r,signature:a}=B().register({label:i.code,shortcutSignature:i.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=we.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=we.printParams[null==e?void 0:e.templateCode],i=t[null==e?void 0:e.templateCode]||[];rt(n,e.templateCode,e.templateId,e.key,i)}}}});Se.value[n]=r}},yt=async(e=!0)=>{if(await fe.clickPrevFn()){if(!we.visible){if(!await vt())return!1}e&&(we.visible=!we.visible)}},gt=e=>{if(we.identityVerification.visible=!1,z(we.currentFormatId))return $e({result:"success",message:""},"edit");const t=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,we.curPrintParamList[0])),n="MULTI"===fe.strategy?t:et(we.curPrintParamList,Ee.value),i={formatId:we.currentFormatId,templateId:xe.value,params:n,token:e};ke.editPrintFormat(i,(e=>{$e(e,"edit")}),Qe)},ht=(e,t)=>{const n=je.value[t+1];return t<je.value.length-1&&!we.printParams[e.templateCode]&&we.printParams[n.templateCode]};async function kt(){await yt(!1),(()=>{const e=Object.keys(we.printParams);we.isClickOuterPrint=!1;const t=we.originParams;if(1==Re.value)for(let n=0;n<e.length;n++){const i=e[n],r=we.printParams[i],a=t[i]||[],l=we.formatList.filter((e=>e.number==i));l&&l.length>0&&l.forEach((e=>{we.currentFormatId=e.id,rt(r,e.number,e.templateId,e.id,a,!0)}))}2==Re.value&&je.value.forEach((e=>{const n=we.printParams[e.templateCode],i=t[e.templateCode]||[];we.currentFormatId=e.key,rt(n,e.templateCode,e.templateId,e.key,i,!0)}))})()}return a((()=>{we.isInited=!1,yt()})),l((()=>{const e=Object.keys(Se.value);e.length>0&&e.forEach((e=>{Se.value[e]&&Se.value[e]()}))})),o((()=>fe.params),(e=>{Object.keys(we.templateParams).length>0&&(we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.templateParams,fe.params))}),{deep:!0}),o((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await yt(!1)}),{deep:!0,immediate:!0}),ve({directPrint:kt}),(t,n)=>(s(),u(c,null,[d("div",G,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(je.value,((t,n)=>(s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:lt,options:Be(v(Oe),t),onSelect:e=>at(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!we.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>it(t.templateCode,t.templateId,t.key,!0),class:h(n==je.value.length-1?"outerLastButton":ht(t,n)?"isPrintDisabled":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",q,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"])))),128))])),_:1}),p(" 外显设置按钮 "),je.value.length>0&&je.value.length==v(ze).length&&v(Ne)&&2!=v(Re)?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,show:Le.isOutSetting,onClickoutside:n[2]||(n[2]=e=>He("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(je.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>Ye("isOutSetting"))},{default:f((()=>[Y,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:f((()=>[d("div",H,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",$,[d("span",Q,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",W,[m(v(F)),d("div",X,[m(v(j),{type:"primary",size:"small",onClick:qe},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[1]||(n[1]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(x),{trigger:"click","show-arrow":!1,show:Le.oneShow,onClickoutside:n[10]||(n[10]=e=>He("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:yt,printSpinning:we.spinning,printbtnText:e.btnText,printVisible:we.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ve("icon")),["stop"]))},{default:f((()=>[m(v(j),{loading:e.showLoading&&we.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(je.value.length>0?"printAllLeftCls":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(v(Fe)?"打印全部":e.btnText)+" ",1),v(Ue)?(s(),u("span",Z,b(v(Ue)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:f((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:f((()=>[d("div",ee,[(s(!0),u(c,null,y(Te.value,(e=>(s(),u("div",{class:h(["print-li",Ce.oneMouseType==e.key||Ce.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Ge("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Ge("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!we.printParams[n.templateCode])return[];Ge(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(F),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(x),{trigger:"click","show-arrow":!1,placement:"right-start",show:Le.isOutSetting,onClickoutside:n[7]||(n[7]=e=>He("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>Ye("isOutSetting"))},[d("span",ne,b(e.label),1),m(v(M),{color:je.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",ie,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",re,[d("span",ae,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",le,[m(v(F)),d("div",oe,[m(v(j),{type:"primary",size:"small",onClick:qe},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[6]||(n[6]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",we.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>it(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",ue,b(e.shortcutLabel),1)):p("v-if",!0)],8,se),we.printParams[e.templateCode]?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Le[e.key],onClickoutside:t=>He(e.key)},{trigger:f((()=>[m(v(M),{component:v(R),size:"18",onClick:t=>Ye(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ce,[(s(!0),u(c,null,y(Be(v(Oe),e),(t=>(s(),u("div",{class:h(["print-li",Ce.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Ge("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Ge("twoMouseType",""))},[d("div",pe,[d("span",{class:"label",onClick:n=>at(t.key,e,!1)},b(t.label),9,me)])],42,de)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,te)))),128))])])),_:3},8,["show"])],2112))]),m(A,I(t.$attrs,{modelValue:we.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>we.identityVerification.visible=e),formatId:we.currentFormatId,templateId:v(xe),onSuccess:gt}),null,16,["modelValue","formatId","templateId"])],64))}});export{ve as default};
1
+ import{defineComponent as e,inject as t,ref as n,reactive as i,computed as r,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as f,renderList as y,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as I}from"vue";import{isObject as O}from"@vue/shared";import{useMessage as C,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as x,NCheckbox as E,NDivider as F}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as R}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as J}from"../constants/index.js";import{Print as U}from"../utils/print.js";import{isIReport as z}from"../utils/browserPrint.js";import A from"./IdentityVerification.vue.js";import{format as K}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{encapBrowserLog as V}from"../../../../shared/utils/index.js";import{useShortcuts as B}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const G={class:"newprint-button-outer"},q={key:0,class:"newprint-button-outer__shortcut"},Y=d("span",{class:"label bold"},"外显设置",-1),H={class:"newprint-button-poperOver"},$={class:"print-lite"},Q={class:"label bold"},W={class:"print-li"},X={class:"print-lite"},Z={key:0,class:"newprint-button-outer__shortcut"},ee={class:"newprint-button-poperOver"},te=["onMouseenter","onClick"],ne={class:"label bold"},ie={class:"newprint-button-poperOver"},re={class:"print-lite"},ae={class:"label bold"},le={class:"print-li"},oe={class:"print-lite"},se=["onClick"],ue={key:0,class:"newprint-button-outer__shortcut"},ce={class:"newprint-button-poperOver"},de=["onMouseenter"],pe={class:"print-lite"},me=["onClick"];var ve=e({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})},svrUpdateIp:{type:String}},setup(e,{expose:ve}){const fe=e,ye=String(navigator.platform).toLowerCase().includes("linux"),ge=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],he=C();let ke;const be=t(J),Pe=n(""),we=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],iReportExecuteMode:1}),Se=n({});let Ie=n([]),Oe=n([{label:fe.previewText,key:"previewText"},{label:fe.pdfLoadText,key:"downloadPdf"},{label:fe.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Ce=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),Le=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),Te=n([]),je=n([]),Me=r((()=>{if(!we.currentFormatId)return{};let e=we.currentFormatId;return we.formatList.find((t=>t.id===e))}));r((()=>{var e;return(null==(e=Me.value)?void 0:e.name)||"格式选择"}));const xe=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.templateId})),Ee=r((()=>{let e=we.formatList.find((e=>e.id===we.currentFormatId));return null==e?void 0:e.number})),Fe=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowPrintAll})),Ne=r((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowOutSetting})),_e=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.customProps)||{}})),De=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.defaultFormatId)||""})),Re=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.printAllType)||1})),Je=r((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.shortcut)||{}})),Ue=r((()=>{var e,t;const n=Object.keys(Je.value);if(n.length>0){if(De.value&&n.includes(De.value))return(null==(e=Je.value[De.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=Je.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=r((()=>{const e=ge.map((e=>e.key));return Ie.value.filter((t=>!e.includes(t.key)))})),Ae=r({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ke=async()=>{var e,t;(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await yt(),Le.oneShow=!0},Ve=async e=>{if(fe.directPrint){if(we.spinning)return;return"button"===e?void(Fe.value?await kt():De.value?async function(e){await yt(!1);const t=Te.value.find((t=>t.key==e));t&&it(t.templateCode,t.templateId,t.key,!1)}(De.value):Ke()):Ke()}return Ke()},Be=(e,t)=>we.printParams[t.templateCode]?z(t.key)&&(ye||2==we.iReportExecuteMode)?e.filter((e=>"formatEditText"!=e.key)):e:[],Ge=(e,t)=>{Ce[e]=t},qe=()=>{Te.value=Ie.value.filter((e=>!e.selected)),je.value=ze.value.filter((e=>e.selected)),He("oneShow"),He("isOutSetting"),be("saveOuterPrint",je.value)},Ye=e=>{Le[e]=!0},He=e=>{Ce.oneClickType="",Le[e]=!1,"isOutSetting"==e&&(Le.isOutSetting=!1)},$e=(e,t)=>{tt(!1);let n={type:t,formatId:we.currentFormatId,templateId:(null==e?void 0:e.templateId)||xe.value,templateCode:(null==e?void 0:e.templateCode)||Ee.value};V({type:"进入成功的回调",info:n},"PRINT-SDK"),be("success",e,n)},Qe=e=>{tt(!1),V({type:"进入失败的回调",res:e},"PRINT-SDK"),be("error",e),O(e)&&"notInstalledApp"===e.type&&he.error(e.message)},We=e=>{tt(!1),be("cancel",e)},Xe=e=>{be("error",{message:"前置条件执行错误",type:e,preExecution:!0})},Ze=()=>JSON.stringify({...fe.token?{token:fe.token}:{}}),et=(e=[],t)=>{var n,i;let r={},a={};if((null==(n=we.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(i=Object.keys(e[0].datasetData||{}))?void 0:i[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(Ze()),_e.value,a),JSON.stringify(r)},tt=(e,t)=>{if(we.isClickOuterPrint){if(e&&t){const n=je.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}je.value.forEach((e=>{e.isLoading=!1}))}else we.spinning=e},nt=()=>we.isClickOuterPrint?je.value.some((e=>e.isLoading)):we.spinning,it=(e,t,n,i)=>{const r=we.printParams[e];if(!r)return;we.isClickOuterPrint=i,we.currentFormatId=n;const a=we.originParams[e]||[];rt(r,e,t,n,a)},rt=async(e=[],t,n,i,r=[],a)=>{let l=e.length;const o=async e=>{try{--l<=0&&$e(e,"print")}catch(e){console.log("error",e)}};fe.showLoading&&nt()&&!a||(tt(!0,i),fe.prevFn("print",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const a={formatId:i,iReportExecuteMode:we.iReportExecuteMode,templateId:n,authorizationKey:Pe.value,printdlgshow:fe.printdlgshow,signature:fe.signature,copies:fe.printCopies,svrUpdateIp:fe.svrUpdateIp};if("MULTI"===fe.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[t]));ke.printDirect({...a,params:n},o,Qe,We)}else ke.printDirect({...a,params:et(e,t)},(e=>{e.params=r,e.templateCode=t,e.templateId=n,$e(e,"print")}),Qe,We)})).catch((()=>{Xe("print"),tt(!1)})).finally((()=>{we.visible=!1})))},at=async(e,{templateCode:t,templateId:n,key:i},r)=>{const a=we.printParams[t];if(a)switch(we.isClickOuterPrint=r,we.currentFormatId=i,e){case"previewText":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("preview",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,params:a,btnprint:fe.btnprint,signature:fe.signature};ke.preview(l,(e=>{$e(e,"preview")}),Qe)})).catch((()=>{Xe("preview"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"formatEditText":((e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("edit",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e,we.currentFormatId=i,we.identityVerification.visible=!0})).catch((()=>{Xe("edit")})).finally((()=>{tt(!1)})))})(a,0,n,i);break;case"downloadPdf":(async(e=[],t,n,i)=>{fe.showLoading&&nt()||(tt(!0,i),fe.prevFn("download",{formatId:i,templateId:n}).then((()=>{we.curPrintParamList=e;const r=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,e[0])),a="MULTI"===fe.strategy?r:et(e,t),l={formatId:i,templateId:n,iReportExecuteMode:we.iReportExecuteMode,authorizationKey:Pe.value,print:{print:"1",type:"1",resolution:null==fe?void 0:fe.resolution},params:a,signature:fe.signature};ke.downloadPDF(l,(e=>$e(e,"preview")),Qe)})).catch((()=>{Xe("download"),tt(!1)})).finally((()=>{we.visible=!1})))})(a,t,n,i);break;case"resetPrinter":(async(e=[],t,n,i)=>{if(!fe.showLoading||!nt()){tt(!0,i);try{const e=await ke.resetPrinter(i,we.iReportExecuteMode);if(tt(!1),"success"==(null==e?void 0:e.result))return void he.success((null==e?void 0:e.message)||"重置打印机成功");he.warning((null==e?void 0:e.message)||"重置打印机失败")}catch(e){tt(!1),he.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,i)}},lt=()=>{},ot=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},dt(n,t,e))})),n},st=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},pt(n,t,e))})),n},ut=(e,t,n)=>{const i={};return t.forEach((t=>{let r=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(i=K(t,n[e.type])),(null==e?void 0:e.defaultValue)||i})(t,e[t[n]]);e[t[n]]&&r&&(i[t[n]]=r)})),i},ct=({customizeDataset:e=[],param:t=[]},n={})=>{let i={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[e.name]=JSON.stringify(ut(n,t,"fieldName"))})),i=Object.assign({},i,ut(n,t,"key")),i},dt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i],a=n[r];if(!a)return e;e[r]||(e[r]=[]),e[r].push(ct(a,t))}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return e;e[a]||(e[a]=[]),e[a].push(ct(l,t))}return e},pt=(e,t,n)=>{if(t.templateNumbers){for(let i=0;i<t.templateNumbers.length;i++){const r=t.templateNumbers[i];if(!n[r])return e;e[r]||(e[r]=[]),e[r].push(t)}return e}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r];if(!n[a])return e;e[a]||(e[a]=[]),e[a].push(t)}return e},mt=async e=>{var t;we.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],we.iReportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].iReportExecuteMode||1,(()=>{var e,t,n;const i=Object.keys(Je.value),r=we.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(i.includes(e.id)){const n=Je.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));Ie.value.unshift(...r),Ne.value&&Ie.value.push(...ge),(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(Ie.value.forEach((e=>{var t;(null==(t=fe.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),je.value=Ie.value.filter((e=>e.selected))),Te.value=Ie.value.filter((e=>!e.selected)),fe.hideButtons.length>0&&(Oe.value=Oe.value.filter((e=>!fe.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},i=Object.keys(t);i.includes("RY7.2.21.1.M2.G94181E")||(Oe.value=Oe.value.filter((e=>"downloadPdf"!=e.key))),i.includes("RY7.2.21.1.M2.G33633A")||(Oe.value=Oe.value.filter((e=>"formatEditText"!=e.key))),i.includes("RY7.2.21.1.M2.G99314S")||(Oe.value=Oe.value.filter((e=>"resetPrinter"!=e.key)))}})(),we.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.templateParams,fe.params),ft()},vt=async()=>{var e;if(we.isInited)return!0;we.isInited=!0,we.spinning=!0,(()=>{if(ke)return!1;ke=new U})();const t=await fe.queryPrintFormatByNumber();return await mt(t),(null==(e=t.obj)?void 0:e.length)>0&&(Pe.value=t.obj[0].authorizationKey||""),we.spinning=!1,!0},ft=async()=>{const e=Object.keys(Je.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],i=Je.value[n],{stop:r,signature:a}=B().register({label:i.code,shortcutSignature:i.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=we.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=we.printParams[null==e?void 0:e.templateCode],i=t[null==e?void 0:e.templateCode]||[];rt(n,e.templateCode,e.templateId,e.key,i)}}}});Se.value[n]=r}},yt=async(e=!0)=>{if(await fe.clickPrevFn()){if(!we.visible){if(!await vt())return!1}e&&(we.visible=!we.visible)}},gt=e=>{if(we.identityVerification.visible=!1,z(we.currentFormatId))return $e({result:"success",message:""},"edit");const t=JSON.stringify(Object.assign({},JSON.parse(Ze()),_e.value,we.curPrintParamList[0])),n="MULTI"===fe.strategy?t:et(we.curPrintParamList,Ee.value),i={formatId:we.currentFormatId,templateId:xe.value,params:n,token:e};ke.editPrintFormat(i,(e=>{$e(e,"edit")}),Qe)},ht=(e,t)=>{const n=je.value[t+1];return t<je.value.length-1&&!we.printParams[e.templateCode]&&we.printParams[n.templateCode]};async function kt(){await yt(!1),(()=>{const e=Object.keys(we.printParams);we.isClickOuterPrint=!1;const t=we.originParams;if(1==Re.value)for(let n=0;n<e.length;n++){const i=e[n],r=we.printParams[i],a=t[i]||[],l=we.formatList.filter((e=>e.number==i));l&&l.length>0&&l.forEach((e=>{we.currentFormatId=e.id,rt(r,e.number,e.templateId,e.id,a,!0)}))}2==Re.value&&je.value.forEach((e=>{const n=we.printParams[e.templateCode],i=t[e.templateCode]||[];we.currentFormatId=e.key,rt(n,e.templateCode,e.templateId,e.key,i,!0)}))})()}return a((()=>{we.isInited=!1})),l((()=>{const e=Object.keys(Se.value);e.length>0&&e.forEach((e=>{Se.value[e]&&Se.value[e]()}))})),o((()=>fe.params),(e=>{Object.keys(we.templateParams).length>0&&(we.printParams=ot(we.templateParams,fe.params),we.originParams=st(we.templateParams,fe.params))}),{deep:!0}),o((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await yt(!1)}),{deep:!0,immediate:!0}),ve({directPrint:kt}),(t,n)=>(s(),u(c,null,[d("div",G,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(je.value,((t,n)=>(s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:lt,options:Be(v(Oe),t),onSelect:e=>at(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!we.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>it(t.templateCode,t.templateId,t.key,!0),class:h(n==je.value.length-1?"outerLastButton":ht(t,n)?"isPrintDisabled":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",q,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"])))),128))])),_:1}),p(" 外显设置按钮 "),je.value.length>0&&je.value.length==v(ze).length&&v(Ne)&&2!=v(Re)?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,show:Le.isOutSetting,onClickoutside:n[2]||(n[2]=e=>He("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(je.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>Ye("isOutSetting"))},{default:f((()=>[Y,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:f((()=>[d("div",H,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",$,[d("span",Q,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",W,[m(v(F)),d("div",X,[m(v(j),{type:"primary",size:"small",onClick:qe},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[1]||(n[1]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(x),{trigger:"click","show-arrow":!1,show:Le.oneShow,onClickoutside:n[10]||(n[10]=e=>He("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:Ke,printSpinning:we.spinning,printbtnText:e.btnText,printVisible:we.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ve("icon")),["stop"]))},{default:f((()=>[m(v(j),{loading:e.showLoading&&we.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(je.value.length>0?"printAllLeftCls":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(v(Fe)?"打印全部":e.btnText)+" ",1),v(Ue)?(s(),u("span",Z,b(v(Ue)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:f((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:f((()=>[d("div",ee,[(s(!0),u(c,null,y(Te.value,(e=>(s(),u("div",{class:h(["print-li",Ce.oneMouseType==e.key||Ce.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Ge("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Ge("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!we.printParams[n.templateCode])return[];Ge(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(F),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(x),{trigger:"click","show-arrow":!1,placement:"right-start",show:Le.isOutSetting,onClickoutside:n[7]||(n[7]=e=>He("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>Ye("isOutSetting"))},[d("span",ne,b(e.label),1),m(v(M),{color:je.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",ie,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",re,[d("span",ae,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",le,[m(v(F)),d("div",oe,[m(v(j),{type:"primary",size:"small",onClick:qe},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[6]||(n[6]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",we.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>it(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",ue,b(e.shortcutLabel),1)):p("v-if",!0)],8,se),we.printParams[e.templateCode]?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Le[e.key],onClickoutside:t=>He(e.key)},{trigger:f((()=>[m(v(M),{component:v(R),size:"18",onClick:t=>Ye(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ce,[(s(!0),u(c,null,y(Be(v(Oe),e),(t=>(s(),u("div",{class:h(["print-li",Ce.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Ge("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Ge("twoMouseType",""))},[d("div",pe,[d("span",{class:"label",onClick:n=>at(t.key,e,!1)},b(t.label),9,me)])],42,de)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,te)))),128))])])),_:3},8,["show"])],2112))]),m(A,I(t.$attrs,{modelValue:we.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>we.identityVerification.visible=e),formatId:we.currentFormatId,templateId:v(xe),onSuccess:gt}),null,16,["modelValue","formatId","templateId"])],64))}});export{ve as default};
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useThrottleFn as t}from"@vueuse/core";import{range as r}from"lodash-es";import{useDetailEvent as n}from"./hooks/useDetailEvent.js";import{defaultStyle as o,drawLine as i}from"../useDraw.js";import{useGrid as a}from"../useGrid.js";import{useElectrocardiogramCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import"date-fns";import"../temperature/useShadow.js";import{ECG as s}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";function u(u,d,c){const{computedX:m,computedY:h}=l(d),{borderStyle:f,originX:L,originY:g,xCellWidth:p,yCellHeight:E,canvasWidth:x,canvasHeight:M,dataList:v,columnNumber:C,gridYNumber:N,gridXNumber:y,rowNumber:b,lineStyle:S,titleStyle:w,config:A,calibrationLineHeight:j}=d,R=new Set,U=new Set;function X(e=[]){return~~(e.length/C)*(A.mainXCellValue/s.DEFAULTMAINXCELLVALUE)}function B(t=0){v.forEach(((r,n)=>{if(n===v.length-1&&arguments.length)return;const{x:o,y:i,rowIdx:a}=r.origin,l=X(r.data),u=r.data.reduce(((e,r,o)=>{const a=n<s.MAXLINENUMBER-1&&o>=t&&o<=t+l||n===s.MAXLINENUMBER-1?[{x:m(e.length+1),y:h(-+r)+i}]:[];return e.concat(a)}),[]),f=new e.Polyline(u,{...S,fill:"transparent",strokeWidth:1,left:o,hasControls:!1,hasBorders:!1,hoverCursor:"default",lockMovementX:!0,lockMovementY:!0,objectCaching:!0,evented:!0,selectable:!0});if(k(f,{...d.config,...d,lineStartIndex:t,points:r.data,scale:4,showScaleText:!0,showNumberText:!0,detailRadius:370,beforeEvent:()=>c.value&&Promise.reject()}),f.startIdx=t,n<v.length-1?R.add(f):U.add(f),arguments.length)return;I({x:o,y:i},S);const L=new e.Text(String(r.title),{...w,left:o+(4===C?p:p/2),top:i,originX:"left",originY:"bottom"});U.add(L)}));const r=arguments.length?[...R]:[...R,...U];u.value.add(...r)}function k(e,t){n(e,t)}function I({x:t,y:r},n){if(4===C)return;const i=t-p,a=p/s.SMALLCELLNUMBER,l=new e.Polyline([{x:i,y:r},{x:i+a,y:r},{x:i+a,y:r-j},{x:i+3*a,y:r-j},{x:i+3*a,y:r},{x:i+4*a,y:r}],{...n,fill:"transparent",strokeWidth:1,left:i,...o});U.add(l)}a(u,{...d,gridXNumber:y*s.SMALLCELLNUMBER,gridYNumber:N*s.SMALLCELLNUMBER,xCellWidth:p/s.SMALLCELLNUMBER,yCellHeight:E/s.SMALLCELLNUMBER,grid:{...d.grid,subXCell:s.SMALLCELLNUMBER,subYCell:s.SMALLCELLNUMBER}}),function(){const{strokeWidth:t}=f,r=new e.Rect({...f,width:x-t,height:M-t,left:L,top:g,fill:"transparent"});u.value.add(r)}(),function(){const e=x/C,t=[];r(C).forEach((r=>{if(r+1>=C)return;const n=(r+1)*e,o=i([n,0,n,M],{stroke:"#000"});t.push(o)})),u.value.add(...t)}(),B();return{updatePolyline:t((t=>{const r=X(v[v.length-1].data);if(r===v[0].data.length)return;const n=v[v.length-1].data.length,o=t/100*n-r/2,i=o+r>n?n-r:Math.max(0,o);e.util.requestAnimFrame((()=>{if(R.size){const[e]=[...R];if(e.startIdx===i)return;[...R].forEach((e=>u.value.remove(e))),R.clear()}B(i)}))}),150)}}export{u as useElectrocardiogram};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useThrottleFn as t}from"@vueuse/core";import{range as r}from"lodash-es";import{useDetailEvent as n}from"./hooks/useDetailEvent.js";import{defaultStyle as o,drawLine as i}from"../useDraw.js";import{useGrid as a}from"../useGrid.js";import{useElectrocardiogramCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import"date-fns";import"../temperature/useShadow.js";import{ECG as s}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";function d(d,u,c){const{computedX:m,computedY:h}=l(u),{borderStyle:f,originX:L,originY:g,xCellWidth:p,yCellHeight:E,canvasWidth:x,canvasHeight:M,dataList:v,columnNumber:C,gridYNumber:N,gridXNumber:y,rowNumber:b,lineStyle:S,titleStyle:w,config:A,calibrationLineHeight:j}=u,R=new Set,U=new Set;function X(e=[]){return~~(e.length/C)*(A.mainXCellValue/s.DEFAULTMAINXCELLVALUE)}function B(t=0){v.forEach(((r,n)=>{if(n===v.length-1&&arguments.length)return;const{x:o,y:i,rowIdx:a}=r.origin,l=X(r.data),d=r.data.reduce(((e,r,o)=>{const a=n<s.MAXLINENUMBER-1&&o>=t&&o<=t+l||n===s.MAXLINENUMBER-1?[{x:m(e.length+1),y:h(-+r)+i}]:[];return e.concat(a)}),[]),f=new e.Polyline(d,{...S,fill:"transparent",strokeWidth:1,left:o,hasControls:!1,hasBorders:!1,hoverCursor:"default",lockMovementX:!0,lockMovementY:!0,objectCaching:!0,evented:!0,selectable:!0});if(k(f,{...u.config,...u,lineStartIndex:t,points:r.data,scale:4,showScaleText:!0,showNumberText:!0,detailRadius:370,beforeEvent:()=>c.value&&Promise.reject()}),f.startIdx=t,n<v.length-1?R.add(f):U.add(f),arguments.length)return;I({x:o,y:i},S);const L=new e.Text(String(r.title),{...w,left:o+(4===C?p:p/2),top:i,originX:"left",originY:"bottom"});U.add(L)}));const r=arguments.length?[...R]:[...R,...U];d.value.add(...r)}function k(e,t){n(e,t)}function I({x:t,y:r},n){const i=t-p,a=p/s.SMALLCELLNUMBER,l=new e.Polyline([{x:i,y:r},{x:i+a,y:r},{x:i+a,y:r-j},{x:i+3*a,y:r-j},{x:i+3*a,y:r},{x:i+4*a,y:r}],{...n,fill:"transparent",strokeWidth:1,left:i,...o});U.add(l)}a(d,{...u,gridXNumber:y*s.SMALLCELLNUMBER,gridYNumber:N*s.SMALLCELLNUMBER,xCellWidth:p/s.SMALLCELLNUMBER,yCellHeight:E/s.SMALLCELLNUMBER,grid:{...u.grid,subXCell:s.SMALLCELLNUMBER,subYCell:s.SMALLCELLNUMBER}}),function(){const{strokeWidth:t}=f,r=new e.Rect({...f,width:x-t,height:M-t,left:L,top:g,fill:"transparent"});d.value.add(r)}(),function(){const e=x/C,t=[];r(C).forEach((r=>{if(r+1>=C)return;const n=(r+1)*e,o=i([n,0,n,M],{stroke:"#000"});t.push(o)})),d.value.add(...t)}(),B();return{updatePolyline:t((t=>{const r=X(v[v.length-1].data);if(r===v[0].data.length)return;const n=v[v.length-1].data.length,o=t/100*n-r/2,i=o+r>n?n-r:Math.max(0,o);e.util.requestAnimFrame((()=>{if(R.size){const[e]=[...R];if(e.startIdx===i)return;[...R].forEach((e=>d.value.remove(e))),R.clear()}B(i)}))}),150)}}export{d as useElectrocardiogram};
@@ -1 +1 @@
1
- import{reactive as e,computed as a,unref as t,watch as u,toRefs as l}from"vue";import{defaultBorderStyle as r,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 s}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as v}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,p,f,N,b){const M=e({updatePolyline:null,useMeasureRuler:null,useCaliper:null,useCaliperRuler:null,useRectRuler:null}),y=a((()=>h.data.width)),R=a((()=>h.data.height)),C=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})),L=a((()=>(y.value-0)/S.value)),x=a((()=>(R.value-0)/w.value)),S=a((()=>{var e,a,t;const{config:u,grid:l}=h.data;if(d(l.gridXNumber))return l.gridXNumber;const r=(null!=(t=null==(a=null==(e=s(C.value))?void 0:e.data)?void 0:a.length)?t:0)/u.hz;return Math.ceil(r/u.mainXCellValue)})),w=a((()=>{const{config:e,grid:a}=h.data;if(d(a.gridYNumber))return a.gridYNumber;const t=C.value.length;return Math.ceil(E.value*t*2/e.mainYCellValue)})),E=a((()=>{var e;const{config:a}=h.data,t=null==(e=s(C.value))?void 0:e.data,u=Math.max(...t)-Math.min(...t);return"uv"===a.valueUnit?.001*u:"v"===a.valueUnit?1e3*u:u})),X=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),Y=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),j=a((()=>{const{rowNumber:e}=Y.value,a=C.value.length;return Math.round(w.value/(e+(a===v.MAXLINENUMBER?1:0)))})),I=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:l}=Y.value,r=e/u,i=C.value.length,n=Math.ceil(j.value/2),o=function(){const{valueUnit:e,mainYCellValue:t}=a,l=C.value[0].data,r=o(Math.max(...l));if(2!==u)return r;const i=C.value[6].data,n=o(Math.max(...i));return Math.max(r,n);function o(a){return("uv"===e?.001*a:"v"===e?1e3*a:a)/t*x.value}}(),d=x.value*n,s=1===u||d<o?x.value*Math.ceil(o/x.value):d,m=4===u?0:L.value;return C.value.map(((e,a)=>{const t=v.MAXLINENUMBER===i&&a===i-1?l:a%l;return{...e,origin:{x:(v.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/l))*r+m,y:t*(x.value*j.value)+s,rowIdx:t}}}))})),U=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})),A=e({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...r,...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:y.value,originY:0,endY:R.value,xCellWidth:L.value,yCellHeight:x.value,gridXNumber:S.value,gridYNumber:w.value,event:X.value,dataList:I.value,columnNumber:t(Y).columnNumber,rowNumber:t(Y).rowNumber,config:h.data.config,calibrationLineHeight:t(U)});return u((()=>g.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:u,useRectRuler:l}=c(g,A),{updatePolyline:r}=m(g,A,a);M.useMeasureRuler=e,M.useCaliper=t,M.useCaliperRuler=u,M.updatePolyline=r,M.useRectRuler=l}()}),{immediate:!0}),{propItems:A,...l(M),getGridInfo:function(){return{cellWidth:L.value,cellHeight:x.value,smallCellNumber:v.SMALLCELLNUMBER}}}}export{g as useElectrocardiogramChart};
1
+ import{reactive as e,computed as a,unref as t,watch as u,toRefs as l}from"vue";import{defaultBorderStyle as r,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 s}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as v}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,p,f,N,b){const M=e({updatePolyline:null,useMeasureRuler:null,useCaliper:null,useCaliperRuler:null,useRectRuler:null}),y=a((()=>h.data.width)),R=a((()=>h.data.height)),C=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})),L=a((()=>(y.value-0)/S.value)),x=a((()=>(R.value-0)/w.value)),S=a((()=>{var e,a,t;const{config:u,grid:l}=h.data;if(d(l.gridXNumber))return l.gridXNumber;const r=(null!=(t=null==(a=null==(e=s(C.value))?void 0:e.data)?void 0:a.length)?t:0)/u.hz;return Math.ceil(r/u.mainXCellValue)})),w=a((()=>{const{config:e,grid:a}=h.data;if(d(a.gridYNumber))return a.gridYNumber;const t=C.value.length;return Math.ceil(E.value*t*2/e.mainYCellValue)})),E=a((()=>{var e;const{config:a}=h.data,t=null==(e=s(C.value))?void 0:e.data,u=Math.max(...t)-Math.min(...t);return"uv"===a.valueUnit?.001*u:"v"===a.valueUnit?1e3*u:u})),X=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),Y=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),j=a((()=>{const{rowNumber:e}=Y.value,a=C.value.length;return Math.round(w.value/(e+(a===v.MAXLINENUMBER?1:0)))})),I=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:l}=Y.value,r=e/u,i=C.value.length,n=Math.ceil(j.value/2),o=function(){const{valueUnit:e,mainYCellValue:t}=a,l=C.value[0].data,r=o(Math.max(...l));if(2!==u)return r;const i=C.value[6].data,n=o(Math.max(...i));return Math.max(r,n);function o(a){return("uv"===e?.001*a:"v"===e?1e3*a:a)/t*x.value}}(),d=x.value*n,s=1===u||d<o?x.value*Math.ceil(o/x.value):d,m=L.value;return C.value.map(((e,a)=>{const t=v.MAXLINENUMBER===i&&a===i-1?l:a%l;return{...e,origin:{x:(v.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/l))*r+m,y:t*(x.value*j.value)+s,rowIdx:t}}}))})),U=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})),A=e({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...r,...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:y.value,originY:0,endY:R.value,xCellWidth:L.value,yCellHeight:x.value,gridXNumber:S.value,gridYNumber:w.value,event:X.value,dataList:I.value,columnNumber:t(Y).columnNumber,rowNumber:t(Y).rowNumber,config:h.data.config,calibrationLineHeight:t(U)});return u((()=>g.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:a,useCaliper:t,useCaliperRuler:u,useRectRuler:l}=c(g,A),{updatePolyline:r}=m(g,A,a);M.useMeasureRuler=e,M.useCaliper=t,M.useCaliperRuler=u,M.updatePolyline=r,M.useRectRuler=l}()}),{immediate:!0}),{propItems:A,...l(M),getGridInfo:function(){return{cellWidth:L.value,cellHeight:x.value,smallCellNumber:v.SMALLCELLNUMBER}}}}export{g as useElectrocardiogramChart};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as i}from"../useDraw.js";import{useGrid as o}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import"vue";import{getPointRange as a,getIndex as f,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as p,last as d,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import{useIntervalFn as g}from"@vueuse/core";function y(y,h,k,x,L,P){const{computedX:w,computedY:b,getXValue:A,getYValue:I}=l(h),{xCellWidth:C,pointSelectionStyle:K,originX:E,endX:j,originY:T,endY:X,event:V,scaleValues:Y,xAxis:M,startTime:S,timeXCell:D,itemList:F,dialog:O,topGridOriginY:$,topGridEndY:_}=h,z=new Map,G=new Set,N=p(Y);let J=[],q=null;const R=new Set;o(y,h);const{getEqualXTypes:W,handleAddPrevent:B,setPrevAndNextPoint:H,getPointEventProps:Q}=s(y,k,h),{pause:U,resume:Z}=g((()=>{!function(){if(!R.size)return;for(const e of R)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function ee(){N.forEach((e=>{const{range:t=[],spaceValue:i}=e;i&&(t[0]||t[1])&&e.dataList.forEach(((t,i)=>{t.show&&(!function(e,t){const{max:i={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function s({show:e=!1,value:i,name:o,lineStyle:l}){if(!e||!i)return;const r=b(t.type,t.range,i),s=n([E,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});V.hovered&&o&&(s.on("mousemove",(({pointer:e})=>{x.point={...e||{x:s.left,y:s.top}},x.list=[`${o} ${i}${t.unit||""}`],x.show=!0})),s.on("mouseout",(()=>{x.show=!1}))),y.value.add(s)}s(i),s(o),s(l),s(r)}(t,e),oe(t,i,e))}))}))}function te(e=[]){if(!(null==q?void 0:q.areaPos))return[];const{startPos:t,endPos:n}=q.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:de()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function ne(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),ie()},onNegativeClick:()=>ie(),onClose:()=>ie()})}function ie(){q&&y.value.remove(q),q=null}function oe(e,t,o){var l;const{type:r,unit:s,dataList:a=[]}=o,f=[];z.set(e.key,[]),function(e,t){R.size&&[...R].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&R.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let v,g,h=c;l.key&&(h=a.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:w="",key:b,type:K="circle"}=h,E=pe(c.list[u+1],o);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(g=n([...e,...E],P));const j=f[u-1],T={origin:{data:l,title:w,key:c.key,selfKey:b,unit:s,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:j,rightLine:g,...L,...Q()};e&&(j||(T.leftLine=null),v=i(K,{left:e[0],top:e[1],...T}));f.push(g),v&&(v.originLeft=v.left,v.originTop=v.top,function(e){V.hovered&&(e.on("mouseover",(()=>{ue(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ce(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),V.hovered&&ue(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:s,top:a,origin:f}=e,u=~~((s-l)/C);if(s>l+C){if(0===J.length){re(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const c=l+C*u;if(J.every((e=>e.left!==c))){const t=A(c),n=I(f.type,a);J.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:c,top:a}),re(e,[...e.prevPointer,c,a])}if(J.length<u&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+C*l,r=J.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=J.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=J[l-1]||{left:n,top:i},f=~~((r.left-(t-C))/C),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:A(t),value:I(o.type,s.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},J.splice(l,0,s),re(e,[a.left,a.top,s.left,s.top])}}l++}}(e,u),e.nextPoint){const t=z.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=C/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<s?le(e,"#999"):le(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(J.length>0&&i<J[J.length-1].left){for(const e of G)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(J=J.filter((e=>e.left<=i)),0===J.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of G)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(J.length>0){const t=d(J);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:I(t,e.top)}};if(y.value.discardActiveObject(),J.length>0){const l=N.find((e=>e.type===t));let r=-1;const s=J.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void ae({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=s.findIndex((e=>e.time===n.time));o>-1?s[o].value=n.value:s.push({...d(s),time:n.time,value:n.value})}const a=l.dataList.findIndex((e=>e.key===n));k("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:a,key:n,data:s}),se({...o,data:s,coincideIndex:r})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),se(o,"change")}}))}(v),null==(p=z.get(c.key))||p.push(v))}(pe(l,o),l,u,e)})),Promise.all(z.get(e.key)).then((t=>{const n=f.filter((e=>e));H(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||R.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function le(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function re(e,t){const[,,i,o]=t;e.clone((l=>{l.set({left:i,top:o,scaleX:1,scaleY:1}),e.prevPointer=[i,o];const r=n(t,e.origin.lineAttr);l.leftLine=r,G.add(l),y.value.add(r,l)}))}function se(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:s}=e;let{dataIndex:a}=e;const u=N.find((e=>e.type===r)),c=u.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":c.list.splice(o,n),c.list[o-1]&&(c.list[o-1].breakpoint=!0);break;case"change":c.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=f(e,c.list),n=Array.isArray(i)?i:[i];c.list.splice(t,s>-1?s-t+1:0,...n);break}}ae({dataIndex:a,scaleValue:u})}function ae(e){var t,n,i;if(G.size&&(null==(t=y.value)||t.remove(...fe([...G]))),G.clear(),J=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...fe(z.get(o.key))),z.delete(o.key),oe(o,t,i)}else z.size&&(null==(i=y.value)||i.remove(...fe(de()))),z.clear(),ee()}function fe(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function ue(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:r}=e.origin;x.point={x:e.left,y:e.top};const s=A(e.left),a=`${"hover"===t?o.value:I(i,e.top)}`;x.list=[`${n} ${a}${l||""}`,`时间 ${s.slice(-5)}`],x.sourceData=[{type:i,title:n,unit:l,key:r,time:s,value:a}],x.isTarget=!0,x.show=!0}function ce(e){e.setCoords();const t=6e4/D,n=e.prevPoint?e.prevPoint.left+t:E,i=j;e.top<T&&e.set("top",T),e.top>X&&e.set("top",X),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function pe(e,t){if(u(e)&&function(e){const t=Date.parse(d(M.list)),n=c(e);return n>=S&&n<=t}(e.time)){const n=w(e.time),i=b(t.type,t.range,e.value);return[n,i<T?T:i>X?X:i]}}function de(){return v(Array.from(z.values()))}return ee(),function(){if(!V.evented)return;let n=!1,i={x:0,y:0};y.value.on("mouse:up",(e=>{if(3===e.button&&function(e){x.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=E&&t<=j&&n>=T&&n<=X)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=a(e.target);de().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&L.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===L.list.length&&(L.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),F.forEach((n=>{W(de(),t,"key",2*C).includes(n.linkKey||n.key)||L.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===L.list.length&&(L.show=!1,B("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=te();e.length>0?ne((()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return se(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);k("remove",t)})):r.emit(q)}})),y.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,i=e.pointer)})),y.value.on("mouse:move",(o=>{if(function(e){if(!P||L.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;x.movable=!1,(i<E||i>j)&&(x.show=!1);if(!t&&i>=E&&i<=j){const e=o>=T&&o<=X,l=o>=$&&o<=_;if(e||l){const l=A(i);x.sourceData=e?N.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:I(t,o)}})):[{type:"tree",time:l}],x.isTarget=!!t,x.point=n,x.movable=!0}else x.show=!1}}(o),!n)return;const{x:l,y:r}=i,{x:s,y:a}=o.pointer;q&&y.value.remove(q),q=new e.Rect({...t,fill:"#CAF982",opacity:.4,...K,left:l,top:r,width:s-l,height:a-r,objectCaching:!0}),q.areaPos={startPos:i,endPos:o.pointer},y.value.add(q)}))}(),{redrawPoints:ae,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),se(n,"remove")):(Object.assign(n,{data:{time:A(e.pointer.x),value:I(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),se({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ce,setPopup:ue,updateData:se,getGridPoints:de,getContainPoints:te,showDialog:ne,removeCurrentSelection:ie,pauseFlickerPoint:U}}export{y as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as i}from"../useDraw.js";import{useGrid as o}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as a}from"../useCommon.js";import"vue";import{getPointRange as s,getIndex as f,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as p,last as d,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import{useIntervalFn as g}from"@vueuse/core";function y(y,h,k,x,L,P){const{computedX:w,computedY:b,getXValue:A,getYValue:I}=l(h),{xCellWidth:C,pointSelectionStyle:K,originX:E,endX:j,originY:T,endY:X,event:M,scaleValues:V,xAxis:Y,startTime:S,timeXCell:D,itemList:F,dialog:O,topGridOriginY:$,topGridEndY:_}=h,z=new Map,G=new Set,N=p(V);let J=[],q=null;const R=new Set;o(y,h);const{getEqualXTypes:W,handleAddPrevent:B,setPrevAndNextPoint:H,getPointEventProps:Q}=a(y,k,h),{pause:U,resume:Z}=g((()=>{!function(){if(!R.size)return;for(const e of R)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function ee(){N.forEach((e=>{const{range:t=[],spaceValue:i}=e;i&&(t[0]||t[1])&&e.dataList.forEach(((t,i)=>{t.show&&(!function(e,t){const{max:i={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:i,name:o,lineStyle:l}){if(!e||!i)return;const r=b(t.type,t.range,i),a=n([E,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});M.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{x.point={...e||{x:a.left,y:a.top}},x.list=[`${o} ${i}${t.unit||""}`],x.show=!0})),a.on("mouseout",(()=>{x.show=!1}))),y.value.add(a)}a(i),a(o),a(l),a(r)}(t,e),oe(t,i,e))}))}))}function te(e=[]){if(!(null==q?void 0:q.areaPos))return[];const{startPos:t,endPos:n}=q.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:de()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function ne(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),ie()},onNegativeClick:()=>ie(),onClose:()=>ie()})}function ie(){q&&y.value.remove(q),q=null}function oe(e,t,o){var l;const{type:r,unit:a,dataList:s=[]}=o,f=[];z.set(e.key,[]),function(e,t){R.size&&[...R].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&R.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let v,g,h=c;l.key&&(h=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:w="",key:b,type:K="circle"}=h,E=pe(c.list[u+1],o);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(g=n([...e,...E],P));const j=f[u-1],T={origin:{data:l,title:w,key:c.key,selfKey:b,unit:a,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:j,rightLine:g,...L,...Q()};e&&(j||(T.leftLine=null),v=i(K,{left:e[0],top:e[1],...T}));f.push(g),v&&(v.originLeft=v.left,v.originTop=v.top,function(e){M.hovered&&(e.on("mouseover",(()=>{ue(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ce(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),M.hovered&&ue(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,u=~~((a-l)/C);if(a>l+C){if(0===J.length){re(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const c=l+C*u;if(J.every((e=>e.left!==c))){const t=A(c),n=I(f.type,s);J.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:c,top:s}),re(e,[...e.prevPointer,c,s])}if(J.length<u&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+C*l,r=J.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=J.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=J[l-1]||{left:n,top:i},f=~~((r.left-(t-C))/C),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:A(t),value:I(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},J.splice(l,0,a),re(e,[s.left,s.top,a.left,a.top])}}l++}}(e,u),e.nextPoint){const t=z.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=C/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<a?le(e,"#999"):le(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(J.length>0&&i<J[J.length-1].left){for(const e of G)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(J=J.filter((e=>e.left<=i)),0===J.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of G)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(J.length>0){const t=d(J);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:I(t,e.top)}};if(y.value.discardActiveObject(),J.length>0){const l=N.find((e=>e.type===t));let r=-1;const a=J.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void se({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=a.findIndex((e=>e.time===n.time));o>-1?a[o].value=n.value:a.push({...d(a),time:n.time,value:n.value})}const s=l.dataList.findIndex((e=>e.key===n));k("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ae({...o,data:a,coincideIndex:r})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),ae(o,"change")}}))}(v),null==(p=z.get(c.key))||p.push(v))}(pe(l,o),l,u,e)})),Promise.all(z.get(e.key)).then((t=>{const n=f.filter((e=>e));H(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||R.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function le(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function re(e,t){const[,,i,o]=t;e.clone((l=>{l.set({left:i,top:o,scaleX:1,scaleY:1}),e.prevPointer=[i,o];const r=n(t,e.origin.lineAttr);l.leftLine=r,G.add(l),y.value.add(r,l)}))}function ae(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const u=N.find((e=>e.type===r)),c=u.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":c.list.splice(o,n),c.list[o-1]&&(c.list[o-1].breakpoint=!0);break;case"change":c.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=f(e,c.list),n=Array.isArray(i)?i:[i];c.list.splice(t,a>-1?a-t+1:0,...n);break}}se({dataIndex:s,scaleValue:u})}function se(e){var t,n,i;if(G.size&&(null==(t=y.value)||t.remove(...fe([...G]))),G.clear(),J=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...fe(z.get(o.key))),z.delete(o.key),oe(o,t,i)}else z.size&&(null==(i=y.value)||i.remove(...fe(de()))),z.clear(),ee()}function fe(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function ue(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:r}=e.origin;x.point={x:e.left,y:e.top};const a=A(e.left),s=`${"hover"===t?o.value:I(i,e.top)}`;x.list=[`${n} ${s}${l||""}`,`时间 ${a.slice(-5)}`],x.sourceData=[{type:i,title:n,unit:l,key:r,time:a,value:s}],x.isTarget=!0,x.show=!0}function ce(e){e.setCoords();const t=6e4/D,n=e.prevPoint?e.prevPoint.left+t:E,i=j;e.top<T&&e.set("top",T),e.top>X&&e.set("top",X),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function pe(e,t){if(u(e)&&function(e){const t=Date.parse(d(Y.list)),n=c(e);return n>=S&&n<=t}(e.time)){const n=w(e.time),i=b(t.type,t.range,e.value);return[n,i<T?T:i>X?X:i]}}function de(){return v(Array.from(z.values()))}return ee(),function(){if(!M.evented)return;let n=!1,i={x:0,y:0};y.value.on("mouse:up",(e=>{if(3===e.button&&function(e){x.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=E&&t<=j&&n>=T&&n<=X)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=s(e.target);de().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&L.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===L.list.length&&(L.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),F.forEach((n=>{W(de(),t,"key",2*C).includes(n.linkKey||n.key)||L.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===L.list.length&&(L.show=!1,B("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=te();e.length>0?ne((()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ae(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);k("remove",t)})):r.emit(q)}})),y.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,i=e.pointer)})),y.value.on("mouse:move",(o=>{if(function(e){if(!P||L.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;x.movable=!1,(i<E||i>j)&&(x.show=!1);if(!t&&i>=E&&i<=j){const e=o>=T&&o<=X,l=o>=$&&o<=_;if(e||l){const l=A(i);x.sourceData=e?N.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:I(t,o)}})):[{type:"tree",time:l}],x.isTarget=!!t,x.point=n,x.movable=!0}else x.show=!1}}(o),!n)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;q&&y.value.remove(q),q=new e.Rect({...t,fill:"#CAF982",opacity:.4,...K,left:l>a?a:l,top:r>s?s:r,width:Math.abs(a-l),height:Math.abs(s-r),objectCaching:!0}),q.areaPos={startPos:i,endPos:o.pointer},y.value.add(q)}))}(),{redrawPoints:se,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),ae(n,"remove")):(Object.assign(n,{data:{time:A(e.pointer.x),value:I(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),ae({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ce,setPopup:ue,updateData:ae,getGridPoints:de,getContainPoints:te,showDialog:ne,removeCurrentSelection:ie,pauseFlickerPoint:U}}export{y as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as d}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function c(c,u,f,h,m,g,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(c,f,u),{other:E,yCellHeight:j,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:T,topGridYCellHeight:I}=u,H=new Map,Y=l(E);function W(){var o;if(!(null==(o=null==Y?void 0:Y.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=Y;let a=L+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:d={},textStyle:c={},data:u}=o;let f=null;u.forEach(((o,u)=>{const{time:h,value:m}=o,g=k(h);if(!$(g))return;const p=e(s,{...d,left:g,top:a}),v=g+p.width/2+2,x=i([v,a],{value:m,...c,originX:"left"}),y=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(y,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-y.width}}),f&&(y.limitX.x1=f.left,f.limitX.x2=y.left,y.prevPoint=f,f.nextPoint=y),f=y,q(y),H.get(n).push(y)})),a+=j})),c.value.add(...H.get(n))}function V(){var t;if(!(null==(t=null==Y?void 0:Y.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=Y;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,d=k(s);if(!n||!$(d))return;const{lineHeight:c=j}=a;let u=L+r+c/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:d,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...w()});u+=c,q(r),H.get(i).push(r)}));const f=H.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),m=d>A-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,m&&t.set("originX","right")}))})),c.value.add(...H.get(i))}function G(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=Y[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}O(t)}function O(t){var e;const{key:i}=t;switch(null==(e=c.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":W();break;case"vertical":V();break;case"mark":D()}}function D(){if(!(null==E?void 0:E.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=E.mark,a=i([C-5,M+S/2],{value:t,...o,originX:"right"});c.value.add(a);const l=M+S,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!$(r))return;let a=M;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),d=o.height;a+d<=l&&a>=M?(o.set("top",a+d/2),a+=d):(i||(a=M,i=!0),o.set("top",a-d/2),a-=d),s.push(o),q(o),c.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:A};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function q(t){if(T.hovered&&(t.on("mouseover",(()=>{B(t)})),t.on("mouseout",(()=>{h.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<L&&t.set("top",L);const e=M+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(g(t),function(t){const e=t.left+t.maxTextWidth>A?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),T.hovered&&B(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};c.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(m.point={x:t.left,y:t.top},m.show=!0,m.target=t,m.list=d.map((t=>({...t,renderItem:()=>t.label}))))}))}function B(t){const{key:e,data:i={}}=t.origin||{};let o=i.value;h.point={x:t.left,y:"mark"===e?t.top:t.top+I/2};const n=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,r=y(n);h.list=[`时间 ${r.slice(-5)}`],"mark"===e&&(o=i.name,h.list.unshift(o+" ")),h.sourceData=[{type:"other",key:e,time:r,value:o}],h.isTarget=!0,h.show=!0}function $(t){return t>=C&&t<=A}return function(){var t;if(!(null==(t=null==Y?void 0:Y.horizontal)?void 0:t.length))return;const{horizontal:i}=Y,o=C-5;let n=L+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var d;(d=s).on("moving",(()=>{d.set("originX","center"),b(d)?B(d):h.show=!1})),d.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&b(d))if(X(H.get("horizontal"),d.left,"key",z).includes(d.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:y(d.left),value:d.origin.defaultAddValue},...d.origin};f("add",t),G(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(d)})),c.value.add(s),n+=j}))}(),W(),V(),D(),n.on((()=>{const t="horizontal",e=p(H.get(t));e.length>0?v((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return s(Object.keys(e).map((t=>{const i=e[t];return Y.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);O({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&G(o,i)}}}export{c as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as d}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function c(c,u,f,h,m,g,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(c,f,u),{other:E,yCellHeight:j,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:T,topGridYCellHeight:I}=u,H=new Map,Y=l(E);function W(){var o;if(!(null==(o=null==Y?void 0:Y.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=Y;let a=L+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:d={},textStyle:c={},data:u}=o;let f=null;u.forEach(((o,u)=>{const{time:h,value:m}=o,g=k(h);if(!$(g))return;const p=e(s,{...d,left:g,top:a}),v=g+p.width/2+2,x=i([v,a],{value:m,...c,originX:"left"}),y=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(y,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-y.width}}),f&&(y.limitX.x1=f.left,f.limitX.x2=y.left,y.prevPoint=f,f.nextPoint=y),f=y,q(y),H.get(n).push(y)})),a+=j})),c.value.add(...H.get(n))}function V(){var t;if(!(null==(t=null==Y?void 0:Y.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=Y;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,d=k(s);if(!n||!$(d))return;const{lineHeight:c=j}=a;let u=L+r+c/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:d,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...w()});u+=c,q(r),H.get(i).push(r)}));const f=H.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),m=d>A-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,m&&t.set("originX","right")}))})),c.value.add(...H.get(i))}function G(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=Y[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}O(t)}function O(t){var e;const{key:i}=t;switch(null==(e=c.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":W();break;case"vertical":V();break;case"mark":D()}}function D(){if(!(null==E?void 0:E.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=E.mark,a=i([C-5,M+S/2],{value:t,...o,originX:"right"});c.value.add(a);const l=M+S,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!$(r))return;let a=M;o.forEach((t=>{const{style:i}=t;let o=!1;const d=e((null==i?void 0:i.type)||"circleAndText",{...(null==i?void 0:i.pointAttr)||n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),u=d.height;a+u<=l&&a>=M?(d.set("top",a+u/2),a+=u):(o||(a=M,o=!0),d.set("top",a-u/2),a-=u),s.push(d),q(d),c.value.add(d)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:A};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function q(t){if(T.hovered&&(t.on("mouseover",(()=>{B(t)})),t.on("mouseout",(()=>{h.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<L&&t.set("top",L);const e=M+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(g(t),function(t){const e=t.left+t.maxTextWidth>A?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),T.hovered&&B(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};c.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(m.point={x:t.left,y:t.top},m.show=!0,m.target=t,m.list=d.map((t=>({...t,renderItem:()=>t.label}))))}))}function B(t){const{key:e,data:i={}}=t.origin||{};let o=i.value;h.point={x:t.left,y:"mark"===e?t.top:t.top+I/2};const n=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,r=y(n);h.list=[`时间 ${r.slice(-5)}`],"mark"===e&&(o=i.name,h.list.unshift(o+" ")),h.sourceData=[{type:"other",key:e,time:r,value:o}],h.isTarget=!0,h.show=!0}function $(t){return t>=C&&t<=A}return function(){var t;if(!(null==(t=null==Y?void 0:Y.horizontal)?void 0:t.length))return;const{horizontal:i}=Y,o=C-5;let n=L+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var d;(d=s).on("moving",(()=>{d.set("originX","center"),b(d)?B(d):h.show=!1})),d.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&b(d))if(X(H.get("horizontal"),d.left,"key",z).includes(d.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:y(d.left),value:d.origin.defaultAddValue},...d.origin};f("add",t),G(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(d)})),c.value.add(s),n+=j}))}(),W(),V(),D(),n.on((()=>{const t="horizontal",e=p(H.get(t));e.length>0?v((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return s(Object.keys(e).map((t=>{const i=e[t];return Y.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);O({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&G(o,i)}}}export{c as useOther};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t}from"../useDraw.js";import"date-fns";import{cloneDeep as i,last as l}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,o,r,u,a,s){const{left:h,other:f,vitalSignsOriginY:c,xCellWidth:g,yCellHeight:v,endX:d}=o,p=(()=>{const e=Math.min(...((null==f?void 0:f.list)||[]).map((e=>{var t,i;return null!=(i=null==(t=e.style)?void 0:t.fontSize)?i:12})));return v<11?e:v})();let m=0;function b(i,l,o,u=!1){const a=[],s=u&&i.fixed&&i.fixedValue?i.fixedValue:i.value;String(s).split("").forEach(((l,n)=>{const o=new e.Text(l,{left:0,top:p*n,originX:"center",...t,objectCaching:!1,...i.style||{}});m=(p-(o.height||0))/2,a.push(o)}));const h=new e.Rect({left:0,top:0,width:g,height:p*a.length,fill:"transparent",originX:"center",...t}),{eventHighlight:c=!1}=f||{},d={originX:"center",left:l,top:o+m,baseTop:(i.baseTop||0)*v,trueLeft:l,trueHeight:a.length*p,objectCaching:!1,hoverCursor:"pointer",highlightObject:h,originData:i,selectable:!1,evented:c},b=new e.Group([h,...a],d);return function(e){const{highlightColor:t="#ffff00"}=f||{};e.on("mouseover",(()=>{e.highlightObject.set("fill",t),n.value.requestRenderAll()})),e.on("mouseout",(()=>{e.highlightObject.set("fill","transparent"),n.value.requestRenderAll()})),e.on("mousedown",(function(){r("eventClick",e.originData)}))}(b),n.value.add(b),b}!function(){var e,t;if(!(null==f?void 0:f.list))return!1;const n=[],o=[];i(f.list).forEach(((e,t)=>{e.value=e.value||"";const i=0===t?"vertical":e.align||"vertical",l=u(e.time,!0);if(l>d)return;const n=o.find((e=>e.left==l));if(n)n[i].push(e);else{const t={left:l,vertical:[],horizontal:[]};t[i].push(e),o.push(t)}}));const r=null==(t=null==(e=h.yScaleValue)?void 0:e.find((e=>"temperature"===e.type)))?void 0:t.list,m=(null==r?void 0:r.length)?a("temperature",35):0;o.forEach((e=>{let t=c.originY,i=e.left,o=0,r=m,u=i;function a(e,t){var o,a;if((e=>e.fixed&&m&&(e.fixedValue||e.value))(e)){const h=[...s].find((e=>Math.abs(e.left-i)<1));h&&(t||Math.abs(i-u)>1)&&(r=h.top+h.height),u=i,n.push(b(e,i,r,!0)),r+=null!=(a=null==(o=l(n))?void 0:o.trueHeight)?a:0}}e.vertical.forEach(((r,u)=>{var s,h,f;const d=(r.baseTop||0)*v,m=(null==(s=l(n))?void 0:s.left)||0;0===u&&e.left<=m&&(i=m+g);if(n.filter((e=>e.trueLeft===i)).length){const e=String(r.value).length;t+=o,t+e*p+d>c.endY&&(t=c.originY,i+=g)}t+=d,String(r.value).length&&(n.push(b(r,i,t)),o=null!=(f=null==(h=l(n))?void 0:h.trueHeight)?f:0),a(r,0===u)})),e.horizontal.forEach(((t,o)=>{var r,u;const s=c.originY+(t.baseTop||0)*v,h=(null==(r=l(n))?void 0:r.left)||0;e.left<=h&&(i=h+g),String(t.value).length&&n.push(b(t,i,s)),a(t,0===(null==(u=e.vertical)?void 0:u.length)&&0===o)}))}))}()}export{n as useOther};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t}from"../useDraw.js";import"date-fns";import{cloneDeep as i,last as l}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,o,r,u,a,s){const{left:h,other:f,vitalSignsOriginY:c,xCellWidth:g,yCellHeight:v,endX:d}=o,p=(()=>{const e=Math.min(...((null==f?void 0:f.list)||[]).map((e=>{var t,i;return null!=(i=null==(t=e.style)?void 0:t.fontSize)?i:12})));return v<11?e:v})();let m=0;function b(i,l,o,u=!1){const a=[],s=u&&i.fixed&&i.fixedValue?i.fixedValue:i.value;String(s).split("").forEach(((l,n)=>{const o=new e.Text(l,{left:0,top:p*n,originX:"center",...t,objectCaching:!1,...i.style||{}});m=(p-(o.height||0))/2,a.push(o)}));const h=new e.Rect({left:0,top:0,width:g,height:p*a.length,fill:"transparent",originX:"center",...t}),{eventHighlight:c=!1}=f||{},d={originX:"center",left:l,top:o+m,baseTop:(i.baseTop||0)*v,trueLeft:l,trueHeight:a.length*p,objectCaching:!1,hoverCursor:"pointer",highlightObject:h,originData:i,selectable:!1,evented:c},b=new e.Group([h,...a],d);return function(e){const{highlightColor:t="#ffff00"}=f||{};e.on("mouseover",(()=>{e.highlightObject.set("fill",t),n.value.requestRenderAll()})),e.on("mouseout",(()=>{e.highlightObject.set("fill","transparent"),n.value.requestRenderAll()})),e.on("mousedown",(function(){r("eventClick",e.originData)}))}(b),n.value.add(b),b}!function(){var e,t;if(!(null==f?void 0:f.list))return!1;const n=[],o=[];i(f.list).forEach(((e,t)=>{e.value=e.value||"";const i=0===t?"vertical":e.align||"vertical",l=u(e.time,!0);if(l>d)return;const n=o.find((e=>e.left==l));if(n)n[i].push(e);else{const t={left:l,vertical:[],horizontal:[]};t[i].push(e),o.push(t)}}));const r=null==(t=null==(e=h.yScaleValue)?void 0:e.find((e=>"temperature"===e.type)))?void 0:t.list,m=(null==r?void 0:r.length)?a("temperature",35):0,j=e=>e.fixed&&m&&(e.fixedValue||e.value);o.forEach((e=>{let t=c.originY,i=e.left,o=0,r=m,u=i;function a(e,t){if(j(e)){const l=[...s].find((e=>Math.abs(e.left-i)<1));l&&(t||Math.abs(i-u)>1)&&(r=l.top+l.height),u=i,n.push(b(e,i,r,!0))}}e.vertical.forEach(((u,s)=>{var h,f,d,m,x;const S=(u.baseTop||0)*v,w=(null==(h=l(n))?void 0:h.left)||0;0===s&&e.left<=w&&(i=w+g);if(n.filter((e=>e.trueLeft===i)).length){const e=String(u.value).length;t+=o,t+e*p+S>c.endY&&(t=c.originY,i+=g)}t+=S,String(u.value).length&&(n.push(b(u,i,t)),o=null!=(d=null==(f=l(n))?void 0:f.trueHeight)?d:0),a(u,0===s),j(u)&&(r+=null!=(x=null==(m=l(n))?void 0:m.trueHeight)?x:0)})),e.horizontal.forEach(((t,o)=>{var u,s;const h=c.originY+(t.baseTop||0)*v;r=m;const f=(null==(u=l(n))?void 0:u.left)||0;e.left<=f+.1&&(i=f+g),String(t.value).length&&n.push(b(t,i,h)),a(t,0===(null==(s=e.vertical)?void 0:s.length)&&0===o)}))}))}()}export{n as useOther};
@@ -1 +1 @@
1
- import{format as e}from"date-fns";import{getTime as n,getFloorNumber as t}from"../utils/index.js";import{last as l}from"lodash-es";function i(i){const{xScaleList:u,xCellWidth:r,yCellHeight:c,left:o,vitalSignsOriginY:a,painOriginY:d,canvasWidth:s}=i;function f(e){let n=0;const t=o.yScaleValue.find((n=>n.type===e)),l=(null==t?void 0:t.list)||[];return l.length?(n=c/((l[1]-l[0])/t.spaceGridNumber),{yScaleCell:n,list:l}):{yScaleCell:n,list:l}}return{computedX:function(e,t=!1){const i=n(e),[r]=u,c=l(u);if(i<r.start)return 0;if(i>c.end)return s;const o=u.findIndex((e=>e.end>=i));if(o>-1){return u[o].center}},computedY:function(e,n){const{yScaleCell:t,list:l}=f(e),i=+n-Math.min(...l);return("pain"===e?d.endY:a.endY)-t*i},getXValue:function(n){const t=u.findIndex((e=>e.left+r>=n));if(t>-1){const l=u[t],i=n-l.left,r=l.scaleCell*i,c=l.start+r;return e(new Date(c),"yyyy-MM-dd HH:mm")}},getYValue:function(e,n){const{yScaleCell:l,list:i}=f(e),u=i.length?Math.min(...i):0,r="pain"===e?d.endY:a.endY;return t((r-n)/l+u)}}}function u(l){const{xAxis:i,originX:u,originY:r,xCellWidth:c,endY:o,timeXCell:a,startTime:d,scaleValues:s}=l;return{computedX:function(e){return(n(e)-d)/a+u},computedY:function(e,n,t){const[i]=n;return o-(+t-i)*l[`${e}YCell`]},getXValue:function(n){return e(new Date((n-u)*a+d),"yyyy-MM-dd HH:mm")},getYValue:function(e,n){const i=s.find((n=>[n.key,n.type||""].includes(e))),[u]=(null==i?void 0:i.range)||[0],r=(o-n)/l[`${e}YCell`]+u;return t(r)}}}function r(e){const{config:n,xCellWidth:l,yCellHeight:i}=e,{hz:u,mainXCellValue:r,valueUnit:c,mainYCellValue:o}=n;return{computedX:function(e){return e/u/r*l},computedY:function(e){return("uv"===c?.001*e:"v"===c?1e3*e:e)/o*i},getXValue:function(e){return t(r/l*e)},getYValue:function(e){return t(o/i*e)}}}export{u as useBirthProcessCumputedPoint,i as useCumputedPoint,r as useElectrocardiogramCumputedPoint};
1
+ import{format as e}from"date-fns";import{getTime as n,getRoundNumber as t,getFloorNumber as l}from"../utils/index.js";import{last as i}from"lodash-es";function u(l){const{xScaleList:u,xCellWidth:r,yCellHeight:c,left:o,vitalSignsOriginY:a,painOriginY:d,canvasWidth:s}=l;function f(e){let n=0;const t=o.yScaleValue.find((n=>n.type===e)),l=(null==t?void 0:t.list)||[];return l.length?(n=c/((l[1]-l[0])/t.spaceGridNumber),{yScaleCell:n,list:l}):{yScaleCell:n,list:l}}return{computedX:function(e,t=!1){const l=n(e),[r]=u,c=i(u);if(l<r.start)return 0;if(l>c.end)return s;const o=u.findIndex((e=>e.end>=l));if(o>-1){return u[o].center}},computedY:function(e,n){const{yScaleCell:t,list:l}=f(e),i=+n-Math.min(...l);return("pain"===e?d.endY:a.endY)-t*i},getXValue:function(n){const t=u.findIndex((e=>e.left+r>=n));if(t>-1){const l=u[t],i=n-l.left,r=l.scaleCell*i,c=l.start+r;return e(new Date(c),"yyyy-MM-dd HH:mm")}},getYValue:function(e,n){const{yScaleCell:l,list:i}=f(e),u=i.length?Math.min(...i):0,r="pain"===e?d.endY:a.endY;return t((r-n)/l+u,"temperature"===e?10:1)}}}function r(t){const{xAxis:i,originX:u,originY:r,xCellWidth:c,endY:o,timeXCell:a,startTime:d,scaleValues:s}=t;return{computedX:function(e){return(n(e)-d)/a+u},computedY:function(e,n,l){const[i]=n;return o-(+l-i)*t[`${e}YCell`]},getXValue:function(n){return e(new Date((n-u)*a+d),"yyyy-MM-dd HH:mm")},getYValue:function(e,n){const i=s.find((n=>[n.key,n.type||""].includes(e))),[u]=(null==i?void 0:i.range)||[0],r=(o-n)/t[`${e}YCell`]+u;return l(r)}}}function c(e){const{config:n,xCellWidth:t,yCellHeight:i}=e,{hz:u,mainXCellValue:r,valueUnit:c,mainYCellValue:o}=n;return{computedX:function(e){return e/u/r*t},computedY:function(e){return("uv"===c?.001*e:"v"===c?1e3*e:e)/o*i},getXValue:function(e){return l(r/t*e)},getYValue:function(e){return l(o/i*e)}}}export{r as useBirthProcessCumputedPoint,u as useCumputedPoint,c as useElectrocardiogramCumputedPoint};
@@ -14,6 +14,7 @@ export declare function getType(type: string): string;
14
14
  export declare function isValidValue(value: number | string): boolean;
15
15
  export declare function isOverlapPoint(pointObj1: any, pointObj2: any): boolean;
16
16
  export declare function getFloorNumber(value: number, n?: number): number;
17
+ export declare function getRoundNumber(value: number, n?: number): number;
17
18
  export declare function getChildrenSize(treeData: ITreeItem[]): number;
18
19
  export declare function getTime(value: number | string): number;
19
20
  /**
@@ -1 +1 @@
1
- import{isNull as t,isNumber as n}from"lodash-es";function e(t){return(null==t?void 0:t.time)&&((null==t?void 0:t.value)||0===(null==t?void 0:t.value))}function r(t,n){const e={};for(const r in t)n.map((t=>t.type)).includes(r)||(e[r]=t[r]);return e}function u(t){return["temperature","pulse"].includes(t.type)&&t.dataList.length&&!!t.dataList.find((t=>t.enable))}function o(t,n){const e=n.findIndex((n=>d(n.time)>d(t)));return~e?e:n.length}function i(t,n){return t.includes("心率")?"pulse_other":n}function l(t){return t.includes("_other")?t.split("_")[0]:t}function c(n){return!Number.isNaN(+n)&&!t(n)}function f(t,n){return a(t.left,1)===a(n.left,1)&&Math.abs(a(t.top,1)-a(n.top,1))<=2}function a(t,n=100){return Math.floor(t*n)/n}function s(t){let n=0;return t.forEach((t=>{var e;(null==(e=t.children)?void 0:e.length)?n+=s(t.children):n++})),n}function d(t){return t?n(t)?new Date(t).getTime():Date.parse(t.replace(/-/g,"/")):Date.now()}function p(t,n){const e=[],[r,u]=t;n=n||1;for(let t=r;n>0?t<=u:t>=u;t+=n)e.push(t);return e}function h(t){const{width:n,height:e,left:r,top:u}=t,o=n/2,i=e/2;return{minLeft:r-o,maxLeft:r+o,minTop:u-i,maxTop:u+i}}export{r as deleteProperty,s as getChildrenSize,a as getFloorNumber,o as getIndex,h as getPointRange,p as getScaleNumberList,d as getTime,l as getType,e as isEffectiveNode,u as isOneLine,f as isOverlapPoint,c as isValidValue,i as setOtherType};
1
+ import{isNull as n,isNumber as t}from"lodash-es";function e(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function r(n,t){const e={};for(const r in n)t.map((n=>n.type)).includes(r)||(e[r]=n[r]);return e}function u(n){return["temperature","pulse"].includes(n.type)&&n.dataList.length&&!!n.dataList.find((n=>n.enable))}function o(n,t){const e=t.findIndex((t=>p(t.time)>p(n)));return~e?e:t.length}function i(n,t){return n.includes("心率")?"pulse_other":t}function l(n){return n.includes("_other")?n.split("_")[0]:n}function c(t){return!Number.isNaN(+t)&&!n(t)}function f(n,t){return a(n.left,1)===a(t.left,1)&&Math.abs(a(n.top,1)-a(t.top,1))<=2}function a(n,t=100){return Math.floor(n*t)/t}function s(n,t=1){return Math.round(n*t)/t}function d(n){let t=0;return n.forEach((n=>{var e;(null==(e=n.children)?void 0:e.length)?t+=d(n.children):t++})),t}function p(n){return n?t(n)?new Date(n).getTime():Date.parse(n.replace(/-/g,"/")):Date.now()}function h(n,t){const e=[],[r,u]=n;t=t||1;for(let n=r;t>0?n<=u:n>=u;n+=t)e.push(n);return e}function m(n){const{width:t,height:e,left:r,top:u}=n,o=t/2,i=e/2;return{minLeft:r-o,maxLeft:r+o,minTop:u-i,maxTop:u+i}}export{r as deleteProperty,d as getChildrenSize,a as getFloorNumber,o as getIndex,m as getPointRange,s as getRoundNumber,h as getScaleNumberList,p as getTime,l as getType,e as isEffectiveNode,u as isOneLine,f as isOverlapPoint,c as isValidValue,i as setOtherType};
@@ -1,5 +1,6 @@
1
1
  import { SFCWithInstall } from '../../shared/types';
2
2
  export * from './src/types';
3
+ export * from './src/hooks/useLocale';
3
4
  declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
4
5
  maxHeight: {
5
6
  type: StringConstructor;
@@ -16,7 +17,6 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
16
17
  extraMaterialList: {
17
18
  type: import("vue").PropType<import("./src/types").FormConfigItem[] | (() => import("./src/types").FormConfigItem[] | Promise<import("./src/types").FormConfigItem[]>)>;
18
19
  };
19
- showLowCodeReactions: BooleanConstructor;
20
20
  formProps: {
21
21
  type: import("vue").PropType<Partial<Partial<{
22
22
  fieldList: import("..").FieldItem[];
@@ -144,7 +144,6 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
144
144
  extraMaterialList: {
145
145
  type: import("vue").PropType<import("./src/types").FormConfigItem[] | (() => import("./src/types").FormConfigItem[] | Promise<import("./src/types").FormConfigItem[]>)>;
146
146
  };
147
- showLowCodeReactions: BooleanConstructor;
148
147
  formProps: {
149
148
  type: import("vue").PropType<Partial<Partial<{
150
149
  fieldList: import("..").FieldItem[];
@@ -258,9 +257,8 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
258
257
  }>> & {
259
258
  onAddItem?: ((...args: any[]) => any) | undefined;
260
259
  onRemoveItem?: ((...args: any[]) => any) | undefined;
261
- onReactionsValidateFailure?: ((...args: any[]) => any) | undefined;
262
260
  }>>;
263
- emit: (event: "addItem" | "removeItem" | "reactionsValidateFailure", ...args: any[]) => void;
261
+ emit: (event: "addItem" | "removeItem", ...args: any[]) => void;
264
262
  uuid: string;
265
263
  cssVars: import("vue").ComputedRef<import("../../shared/types").AnyObject>;
266
264
  fieldListRef: import("vue").Ref<import("./src/types").FormConfigItem[]>;
@@ -317,6 +315,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
317
315
  extraOptions: import("vue").ComputedRef<import("./src/types").FormConfigItem[]>;
318
316
  onFocus: () => Promise<void>;
319
317
  useVersion: typeof import("../../shared/hooks").useVersion;
318
+ useFormConfigLocale: typeof import("./src/hooks/useLocale").useFormConfigLocale;
320
319
  Draggable: import("vue").DefineComponent<{
321
320
  list: {
322
321
  type: ArrayConstructor;
@@ -404,6 +403,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
404
403
  NButton: any;
405
404
  NButtonGroup: any;
406
405
  NPopconfirm: any;
406
+ useFormConfigLocale: typeof import("./src/hooks/useLocale").useFormConfigLocale;
407
407
  CFormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
408
408
  formRenderRef: import("vue").Ref<import("..").FormRenderExpose | undefined>;
409
409
  key: import("vue").Ref<number>;
@@ -1967,6 +1967,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1967
1967
  layoutWidthEnum?: import("./src/types").FormConfigWidth | undefined;
1968
1968
  type?: string | undefined;
1969
1969
  name?: string | undefined;
1970
+ alias?: string | undefined;
1970
1971
  show?: boolean | undefined;
1971
1972
  defaultValue?: any;
1972
1973
  defaultExpand?: boolean | undefined;
@@ -1983,6 +1984,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1983
1984
  layoutWidthEnum: import("./src/types").FormConfigWidth;
1984
1985
  type: string;
1985
1986
  name: string;
1987
+ alias?: string | undefined;
1986
1988
  show?: boolean | undefined;
1987
1989
  defaultValue?: any;
1988
1990
  defaultExpand?: boolean | undefined;
@@ -2442,8 +2444,6 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2442
2444
  __extra?: boolean | undefined;
2443
2445
  }>;
2444
2446
  generateFieldListByFormConfigItem: (formConfigItem: import("./src/types").FormConfigItem, fieldItem?: import("..").FieldItem | undefined) => import("..").FieldItem[];
2445
- showModal: import("vue").Ref<boolean>;
2446
- onPositiveClick: () => Promise<void>;
2447
2447
  prevOldField: null;
2448
2448
  onFormChange: ({ fieldKey, value }: import("..").FormChangePayload) => void;
2449
2449
  createLabelRender: (originOptions?: import("../../shared/types").AnyObject[] | undefined) => (label: string) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
@@ -2669,6 +2669,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2669
2669
  }[]>;
2670
2670
  onOptionModalCancel: () => void;
2671
2671
  onOptionModalConfirm: () => void;
2672
+ useFormConfigLocale: typeof import("./src/hooks/useLocale").useFormConfigLocale;
2672
2673
  NModal: any;
2673
2674
  NSpace: any;
2674
2675
  NInput: any;
@@ -3783,104 +3784,6 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
3783
3784
  }>>>;
3784
3785
  };
3785
3786
  }>>, {}>;
3786
- FormConfigEventSetting: import("vue").DefineComponent<{
3787
- modelValue: {
3788
- type: ArrayConstructor;
3789
- required: true;
3790
- default: () => never[];
3791
- };
3792
- }, {
3793
- props: {
3794
- modelValue: import("../../shared/types").LowCodeTypes.reactionConfig[];
3795
- };
3796
- emit: (event: "update:modelValue" | "validateFailure", ...args: any[]) => void;
3797
- cssVars: import("vue").ComputedRef<import("../../shared/types").AnyObject>;
3798
- valueRef: import("vue").Ref<{
3799
- conObj: {
3800
- con: import("../../shared/types").LowCodeTypes.VALUE_RELATION;
3801
- field_key: string;
3802
- value: unknown;
3803
- }[];
3804
- compareMap?: {
3805
- NULL?: ((v1: any, v2: any) => boolean) | undefined;
3806
- EQ?: ((v1: any, v2: any) => boolean) | undefined;
3807
- BIG?: ((v1: any, v2: any) => boolean) | undefined;
3808
- LESS?: ((v1: any, v2: any) => boolean) | undefined;
3809
- BIGEQ?: ((v1: any, v2: any) => boolean) | undefined;
3810
- LESSEQ?: ((v1: any, v2: any) => boolean) | undefined;
3811
- CL?: ((v1: any, v2: any) => boolean) | undefined;
3812
- NC?: ((v1: any, v2: any) => boolean) | undefined;
3813
- NEQ?: ((v1: any, v2: any) => boolean) | undefined;
3814
- NOT_NULL?: ((v1: any, v2: any) => boolean) | undefined;
3815
- } | undefined;
3816
- isRestoreDefault?: boolean | undefined;
3817
- sqlExpression?: string | undefined;
3818
- showField?: string[] | undefined;
3819
- hideField?: string[] | undefined;
3820
- requiredField?: string[] | undefined;
3821
- notRequiredField?: string[] | undefined;
3822
- enabledField?: string[] | undefined;
3823
- disabledField?: string[] | undefined;
3824
- __oppositeBindField?: any | undefined;
3825
- __oppositeTargetField?: any | undefined;
3826
- }[]>;
3827
- expandedName: import("vue").Ref<string>;
3828
- addConnection: () => void;
3829
- removeConnection: (index: number) => void;
3830
- getOppositeBtnText: (item: import("../../shared/types").LowCodeTypes.reactionConfig) => string | undefined;
3831
- unBindOpposite: (item: import("../../shared/types").LowCodeTypes.reactionConfig) => void;
3832
- addOppositeCondition: (item: import("../../shared/types").LowCodeTypes.reactionConfig) => void;
3833
- getOppositeSqlExpression: (expression?: string | undefined) => string | undefined;
3834
- createOppositeCondition: (config: import("../../shared/types").LowCodeTypes.reactionConfig) => import("../../shared/types").LowCodeTypes.reactionConfig;
3835
- isOppositeConfig: (c1: import("../../shared/types").LowCodeTypes.reactionConfig, c2: import("../../shared/types").LowCodeTypes.reactionConfig) => boolean;
3836
- onUpdateExpandedNames: (value: string[]) => void;
3837
- getBinderFieldDesc: (index: number) => string;
3838
- addCondition: (config: import("../../shared/types").LowCodeTypes.reactionConfig) => void;
3839
- removeCondition: (config: import("../../shared/types").LowCodeTypes.reactionConfig, index: number) => void;
3840
- onUpdateConditionType: (condition: import("../../shared/types").LowCodeTypes.reactionsConObj, type: import("../../shared/types").LowCodeTypes.VALUE_RELATION) => void;
3841
- showRef: import("vue").Ref<boolean>;
3842
- fieldListRef: import("vue").Ref<import("./src/types").FormConfigItem[]>;
3843
- fieldOptions: import("vue").ComputedRef<import("./src/types").FormConfigItem[]>;
3844
- currentTypeList: string[];
3845
- dialog: import("naive-ui").DialogApi;
3846
- onNegativeClick: () => Promise<void>;
3847
- onPositiveClick: () => Promise<void>;
3848
- configValidate: () => Promise<void>;
3849
- HelpCircleSharp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
3850
- NButton: any;
3851
- NModal: any;
3852
- NSpace: any;
3853
- NScrollbar: any;
3854
- NThing: any;
3855
- NInputGroup: any;
3856
- NSelect: any;
3857
- NInput: any;
3858
- NCollapse: any;
3859
- NCollapseItem: any;
3860
- NEllipsis: any;
3861
- NEmpty: any;
3862
- NTooltip: any;
3863
- NIcon: any;
3864
- conditionTypeOptions: {
3865
- value: import("../../shared/types").LowCodeTypes.VALUE_RELATION;
3866
- label: string;
3867
- }[];
3868
- connectionTypeOptions: {
3869
- value: string;
3870
- label: string;
3871
- }[];
3872
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "validateFailure")[], "update:modelValue" | "validateFailure", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
3873
- modelValue: {
3874
- type: ArrayConstructor;
3875
- required: true;
3876
- default: () => never[];
3877
- };
3878
- }>> & {
3879
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
3880
- onValidateFailure?: ((...args: any[]) => any) | undefined;
3881
- }, {
3882
- modelValue: unknown[];
3883
- }>;
3884
3787
  FormConfigMaterialItem: import("vue").DefineComponent<{
3885
3788
  formConfigItem: {
3886
3789
  type: import("vue").PropType<import("./src/types").FormConfigItem>;
@@ -3913,7 +3816,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
3913
3816
  FORM_CONFIG_GROUP: string;
3914
3817
  NSelect: any;
3915
3818
  NSpace: any;
3916
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("addItem" | "removeItem" | "reactionsValidateFailure")[], "addItem" | "removeItem" | "reactionsValidateFailure", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
3819
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("addItem" | "removeItem")[], "addItem" | "removeItem", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
3917
3820
  maxHeight: {
3918
3821
  type: StringConstructor;
3919
3822
  };
@@ -3929,7 +3832,6 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
3929
3832
  extraMaterialList: {
3930
3833
  type: import("vue").PropType<import("./src/types").FormConfigItem[] | (() => import("./src/types").FormConfigItem[] | Promise<import("./src/types").FormConfigItem[]>)>;
3931
3834
  };
3932
- showLowCodeReactions: BooleanConstructor;
3933
3835
  formProps: {
3934
3836
  type: import("vue").PropType<Partial<Partial<{
3935
3837
  fieldList: import("..").FieldItem[];
@@ -4043,8 +3945,5 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
4043
3945
  }>> & {
4044
3946
  onAddItem?: ((...args: any[]) => any) | undefined;
4045
3947
  onRemoveItem?: ((...args: any[]) => any) | undefined;
4046
- onReactionsValidateFailure?: ((...args: any[]) => any) | undefined;
4047
- }, {
4048
- showLowCodeReactions: boolean;
4049
- }>>;
3948
+ }, {}>>;
4050
3949
  export default FormConfig;
@@ -1 +1 @@
1
- import{COMPONENT_NAMESPACE as o}from"../../shared/global/variable.js";import{safeComponentRegister as r}from"../../shared/utils/index.js";import i from"./src/FormConfig.vue.js";const s=i;s.install=function(i){r(i,s,o+"FormConfig")};export{s as default};
1
+ import{COMPONENT_NAMESPACE as o}from"../../shared/global/variable.js";import{safeComponentRegister as r}from"../../shared/utils/index.js";import s from"./src/FormConfig.vue.js";export{registFormConfigLocale,useFormConfigLocale}from"./src/hooks/useLocale.js";const e=s;e.install=function(s){r(s,e,o+"FormConfig")};export{e as default};