cnhis-design-vue 3.2.14-beta.24 → 3.2.14-beta.29

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 (154) hide show
  1. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  2. package/es/components/ai-chat/src/components/ChatPatient.vue2.js +1 -1
  3. package/es/components/base-search/src/index.vue2.js +1 -1
  4. package/es/components/big-table/src/BigTable.vue2.js +1 -1
  5. package/es/components/big-table/src/components/NoData.vue2.js +1 -1
  6. package/es/components/big-table/src/components/edit-form/edit-input.js +1 -1
  7. package/es/components/big-table/src/hooks/useNestTable.js +1 -1
  8. package/es/components/body-select/src/index.vue2.js +1 -1
  9. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  10. package/es/components/button-print/src/components/EditFormat.vue2.js +1 -1
  11. package/es/components/button-print/src/components/IdentityVerification.vue2.js +1 -1
  12. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
  13. package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
  14. package/es/components/button-print/src/components/Preview.vue2.js +1 -1
  15. package/es/components/button-print/src/utils/dialog.js +1 -1
  16. package/es/components/button-print/src/utils/print.js +1 -1
  17. package/es/components/calendar/index.d.ts +4 -4
  18. package/es/components/calendar/src/Calendar.vue.d.ts +4 -4
  19. package/es/components/card-reader-sdk/src/components/readCardDialog.vue2.js +1 -1
  20. package/es/components/card-reader-sdk/src/utils/readHealthCard.js +1 -1
  21. package/es/components/classification/src/components/search-filter/index.vue2.js +1 -1
  22. package/es/components/classification/src/components/set-classification/index.vue2.js +1 -1
  23. package/es/components/classification/src/components/table-modal/index.vue2.js +1 -1
  24. package/es/components/classification/src/index.vue2.js +1 -1
  25. package/es/components/default-page/src/constants/index.js +1 -1
  26. package/es/components/default-page/src/index.vue2.js +1 -1
  27. package/es/components/expand-field/src/components/FormBatchOptionsModal.vue2.js +1 -1
  28. package/es/components/expand-field/src/components/FormItemPerson.vue2.js +1 -1
  29. package/es/components/expand-field/src/components/PersonModal.vue2.js +1 -1
  30. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  31. package/es/components/expand-field/src/index.vue2.js +1 -1
  32. package/es/components/expand-field/src/utils/constant.js +1 -1
  33. package/es/components/fabric-chart/index.d.ts +6 -4
  34. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +6 -4
  35. package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
  36. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  37. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  38. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -1
  39. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  40. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  41. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
  42. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  43. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
  44. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  45. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  46. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  47. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  48. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  49. package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
  50. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  51. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  52. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  53. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  54. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  55. package/es/components/field-set/src/FieldColor.vue2.js +1 -1
  56. package/es/components/field-set/src/FieldFilter.vue2.js +1 -1
  57. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  58. package/es/components/field-set/src/TableStyle.vue2.js +1 -1
  59. package/es/components/field-set/src/components/condition.vue2.js +1 -1
  60. package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -1
  61. package/es/components/field-set/src/components/edit-filter.vue2.js +1 -1
  62. package/es/components/field-set/src/components/table-row.vue2.js +1 -1
  63. package/es/components/field-set/src/constants/filter.js +1 -1
  64. package/es/components/field-set/src/constants/index.js +1 -1
  65. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -1
  66. package/es/components/form-config/src/hooks/useLocale.js +1 -1
  67. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  68. package/es/components/form-render/src/components/renderer/switch.js +1 -1
  69. package/es/components/iho-chat/index.d.ts +23 -2
  70. package/es/components/iho-chat/src/Index.vue.d.ts +23 -2
  71. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  72. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  73. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  74. package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
  75. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  76. package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +40 -19
  77. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  78. package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
  79. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  80. package/es/components/iho-chat/src/components/MessageTemplate.vue2.js +1 -1
  81. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  82. package/es/components/iho-chat/src/components/SiderList.vue.d.ts +3 -0
  83. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  84. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  85. package/es/components/iho-chat/src/constants/index.d.ts +1 -2
  86. package/es/components/iho-chat/src/constants/index.js +1 -1
  87. package/es/components/iho-chat/src/hooks/useData.js +1 -1
  88. package/es/components/iho-chat/src/hooks/useSearchUserList.js +1 -1
  89. package/es/components/iho-chat/src/utils/chatSock.js +1 -1
  90. package/es/components/iho-chat/src/utils/index.d.ts +1 -0
  91. package/es/components/iho-chat/src/utils/index.js +1 -1
  92. package/es/components/iho-chat/style/index.css +1 -1
  93. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue2.js +1 -1
  94. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  95. package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue2.js +1 -1
  96. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
  97. package/es/components/index.css +1 -1
  98. package/es/components/info-header/src/components/patientInfo/index.vue2.js +1 -1
  99. package/es/components/keyboard/src/components/NumberPanel.vue2.js +1 -1
  100. package/es/components/map/src/Map.vue2.js +1 -1
  101. package/es/components/picture-clipper/src/PictureClipper.vue2.js +1 -1
  102. package/es/components/quick-search/src/index.vue2.js +1 -1
  103. package/es/components/recommend-search/src/components/BaseSearch.js +1 -1
  104. package/es/components/recommend-search/src/components/RecommendInput.vue2.js +1 -1
  105. package/es/components/recommend-search/src/components/RecommendSelect.vue2.js +1 -1
  106. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  107. package/es/components/scale-view/src/components/NoData.vue2.js +1 -1
  108. package/es/components/scale-view/src/components/formitem/r-checkbox.js +1 -1
  109. package/es/components/scale-view/src/components/formitem/r-input.js +1 -1
  110. package/es/components/scale-view/src/components/formitem/r-radio.js +1 -1
  111. package/es/components/scale-view/src/components/formitem/r-sign.js +1 -1
  112. package/es/components/scale-view/src/components/formitem/standard-modal.js +1 -1
  113. package/es/components/scale-view/src/hooks/scaleview-methods.js +1 -1
  114. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  115. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  116. package/es/components/select-label/src/SelectLabel.vue2.js +1 -1
  117. package/es/components/select-label/src/components/label-classify.vue2.js +1 -1
  118. package/es/components/select-label/src/ihoLabel/IhoLabelFormContent.vue2.js +1 -1
  119. package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +1 -1
  120. package/es/components/select-label/src/ihoLabel/iho-label-classify.vue2.js +1 -1
  121. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  122. package/es/components/select-person/src/SelectPersonType.vue2.js +1 -1
  123. package/es/components/select-person/src/components/SearchOrgAndStaff.vue2.js +1 -1
  124. package/es/components/select-person/src/index.vue2.js +1 -1
  125. package/es/components/slider-tree/src/index.vue2.js +1 -1
  126. package/es/components/table-export-field/src/components/ExportModal.vue2.js +1 -1
  127. package/es/components/table-export-field/src/components/SaveProjectModal.vue2.js +1 -1
  128. package/es/components/table-export-field/src/index.vue2.js +1 -1
  129. package/es/components/table-filter/src/components/bi-filter/ValueCfg.vue2.js +1 -1
  130. package/es/components/table-filter/src/components/bi-filter/helpers/options.js +1 -1
  131. package/es/components/table-filter/src/components/bi-filter/index.vue2.js +1 -1
  132. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue2.js +1 -1
  133. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue2.js +1 -1
  134. package/es/components/table-filter/src/components/classify-filter/components/InputFilter.vue2.js +1 -1
  135. package/es/components/table-filter/src/components/classify-filter/components/InputNumberGroup.vue2.js +1 -1
  136. package/es/components/table-filter/src/components/classify-filter/helpers/options.js +1 -1
  137. package/es/components/table-filter/src/components/classify-filter/hooks/useDisplayCategory.js +1 -1
  138. package/es/components/table-filter/src/components/classify-filter/index.vue2.js +1 -1
  139. package/es/components/table-filter/src/components/render-widget/components/DateInner.vue2.js +1 -1
  140. package/es/components/table-filter/src/components/render-widget/components/DateOut.vue2.js +1 -1
  141. package/es/components/table-filter/src/components/render-widget/components/DateRangeInner.vue2.js +1 -1
  142. package/es/components/table-filter/src/components/render-widget/components/DateRangeOut.vue2.js +1 -1
  143. package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue2.js +1 -1
  144. package/es/components/table-filter/src/components/render-widget/components/InputNumberGroup.vue2.js +1 -1
  145. package/es/components/table-filter/src/components/render-widget/components/LabelInner.vue2.js +1 -1
  146. package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue2.js +1 -1
  147. package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +1 -1
  148. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
  149. package/es/components/table-filter/src/tool/baseOptions.js +1 -1
  150. package/es/components/tooth-bitmap/src/ToothBitmap.vue2.js +1 -1
  151. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue2.js +1 -1
  152. package/es/components/vod-chunk-upload/src/vod-upload-modal.js +1 -1
  153. package/es/shared/package.json.js +1 -1
  154. package/package.json +76 -76
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../../shared/utils/fabricjs/index.js";import{range as t}from"lodash-es";import{defaultStyle as n}from"../../useDraw.js";import{useElectrocardiogramCumputedPoint as o}from"../../useCumputedPoint.js";import"../../useEvent.js";import"../../useCommon.js";import"vue";import"date-fns";import"../../temperature/useShadow.js";import"../../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function r(r,i){const{scale:l,beforeEvent:s,endY:a,endX:u,showScaleText:p,showNumberText:c,detailRadius:y,points:f,lineStartIndex:h,xCellWidth:m,yCellHeight:d,grid:x={subLineStyle:{},mainLineStyle:{x:{},y:{}}}}=i;let w=null;const{computedX:g,computedY:v,getYValue:b}=o(i);function S(e){return g(e)*l}function L(e){return v(e)*l}function k(e){return b(e/l)}const j=d*l;function M(){var e;w&&(null==(e=r.canvas)||e.remove(w)),w=null}r.on("mousedown",(async o=>{var i,m;if(await(null==s?void 0:s()),1!==o.button||!o.target||!o.pointer)return;const d=o.target;if(!d.points)return;const{x:g,y:v}=o.pointer,b=Math.floor((g-d.left)/d.width*d.points.length)+h;let G=b-y,T=b+y;G<=0?(G=0,T=Math.min(2*y,f.length-1)):T>=f.length-1&&(T=f.length-1,G=Math.max(f.length-2*y,0));const C=f.slice(G,T).map(((e,t)=>({x:G+S(t),y:L(e)}))),W=b-G;let Y=0,$=0;C.forEach(((e,t)=>{e.y>C[Y].y&&(Y=t),e.y<C[$].y&&($=t)}));const E=S(2*y-1),X=C[Y].y-C[$].y-1,z=X+30+70,A={x:u-g<=E?g-E:g,y:a-v<=z?v-z:v};M(),w=new e.Group;const D=[new e.Rect({...n,left:A.x,top:A.y,width:E,height:z,stroke:"transparent",fill:"#fff",shadow:new e.Shadow({color:"rgba(0, 0, 0, 0.3)",blur:15,offsetX:8,offsetY:8})}),function(n,o){const r=e=>e%5?x.subLineStyle:null,i=j/5,l=30+n[Y].y/Math.abs(n[Y].y-n[$].y)*X,s=Math.ceil(l/i),a=Math.ceil((z-l)/i);function u(t,n){return new e.Line([A.x,A.y+t,A.x+E,A.y+t],{...x.mainLineStyle.x,...r(n)})}const p=new e.Group([...t(a).map((e=>u(e*i+l,e))),...t(s).map((e=>u(-e*i+l,e)))]),c=o/n.length*E,y=Math.ceil(c/i),f=Math.ceil((E-c)/i);function h(t,n){return new e.Line([A.x+t,A.y,A.x+t,A.y+z],{...x.mainLineStyle.y,...0===n?x.subLineStyle:r(n)})}const m=new e.Group([...t(f).map((e=>h(e*i+c,e))),...t(y).map((e=>h(-e*i+c,e)))]);return new e.Group([m,p])}(C,W),(H=C.map((({x:e,y:t})=>({x:e,y:-t}))),new e.Polyline(H,{...n,fill:"transparent",stroke:"red",strokeWidth:1,left:A.x,top:A.y+30})),function(t,o){const r={strokeDashArray:[3,4],width:3,top:A.y},i=new e.Line(a(t[Y]),{...n,...r,left:A.x+Y/t.length*E,stroke:"red"}),l=new e.Line(a(t[$]),{...n,...r,stroke:"blue",left:A.x+$/t.length*E}),s=new e.Line(a(t[o]),{...n,...r,stroke:"green",left:A.x+o/t.length*E});return new e.Group([i,l,s]);function a(e){return[e.x,e.y,e.x,e.y-z]}}(C,W),(P=C,R=W,new e.Circle({...n,radius:5,fill:"transparent",stroke:"green",strokeWidth:1,left:A.x+R/P.length*E-5,top:A.y+30+(P[Y].y-P[R].y)/Math.abs(P[Y].y-P[$].y)*X-5}))];var P,R,H;p&&D.push(new e.Text(`x${l}`,{...n,fill:"black",fontSize:20,left:A.x+10,top:A.y+z-30})),c&&D.push(function(t,o){const r={fontSize:16,left:A.x+E/2+10},i=new e.Text(`最大: ${k(t[Y].y)} mv`,{...n,...r,fill:"red",top:A.y+z-20}),l=new e.Text(`最小: ${k(t[$].y)} mv`,{...n,...r,fill:"blue",top:A.y+z-40}),s=new e.Text(`当前: ${k(t[o].y)} mv`,{...n,...r,fill:"green",top:A.y+z-60});return new e.Group([i,l,s])}(C,W)),w.add(...D).addWithUpdate(),null==(i=r.canvas)||i.add(w),null==(m=r.canvas)||m.discardActiveObject()})),r.on("mouseup",(async e=>{await(null==s?void 0:s()),1===e.button&&M()}))}export{r as useDetailEvent};
1
+ import{fabric as e}from"../../../../../../shared/utils/fabricjs/index.js";import{range as t}from"lodash-es";import{defaultStyle as n}from"../../useDraw.js";import{useElectrocardiogramCumputedPoint as o}from"../../useCumputedPoint.js";import"../../useEvent.js";import"../../useCommon.js";import"vue";import"date-fns";import"../../temperature/useShadow.js";import"../../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../../shared/utils/index.js";function r(r,i){const{scale:l,beforeEvent:s,endY:a,endX:u,showScaleText:p,showNumberText:c,detailRadius:y,points:f,lineStartIndex:d,xCellWidth:h,yCellHeight:m,grid:x={subLineStyle:{},mainLineStyle:{x:{},y:{}}}}=i;let w=null;const{computedX:g,computedY:v,getYValue:b}=o(i);function S(e){return g(e)*l}function L(e){return v(e)*l}function j(e){return b(e/l)}const k=m*l;function M(){var e;w&&(null==(e=r.canvas)||e.remove(w)),w=null}r.on("mousedown",(async o=>{var i,h;if(await(null==s?void 0:s()),1!==o.button||!o.target||!o.pointer)return;const m=o.target;if(!m.points)return;const{x:g,y:v}=o.pointer,b=Math.floor((g-m.left)/m.width*m.points.length)+d;let G=b-y,T=b+y;G<=0?(G=0,T=Math.min(2*y,f.length-1)):T>=f.length-1&&(T=f.length-1,G=Math.max(f.length-2*y,0));const C=f.slice(G,T).map(((e,t)=>({x:G+S(t),y:L(e)}))),W=b-G;let Y=0,$=0;C.forEach(((e,t)=>{e.y>C[Y].y&&(Y=t),e.y<C[$].y&&($=t)}));const E=S(2*y-1),X=C[Y].y-C[$].y-1,z=X+30+70,A={x:u-g<=E?g-E:g,y:a-v<=z?v-z:v};M(),w=new e.Group;const D=[new e.Rect({...n,left:A.x,top:A.y,width:E,height:z,stroke:"transparent",fill:"#fff",shadow:new e.Shadow({color:"rgba(0, 0, 0, 0.3)",blur:15,offsetX:8,offsetY:8})}),function(n,o){const r=e=>e%5?x.subLineStyle:null,i=k/5,l=30+n[Y].y/Math.abs(n[Y].y-n[$].y)*X,s=Math.ceil(l/i),a=Math.ceil((z-l)/i);function u(t,n){return new e.Line([A.x,A.y+t,A.x+E,A.y+t],{...x.mainLineStyle.x,...r(n)})}const p=new e.Group([...t(a).map((e=>u(e*i+l,e))),...t(s).map((e=>u(-e*i+l,e)))]),c=o/n.length*E,y=Math.ceil(c/i),f=Math.ceil((E-c)/i);function d(t,n){return new e.Line([A.x+t,A.y,A.x+t,A.y+z],{...x.mainLineStyle.y,...0===n?x.subLineStyle:r(n)})}const h=new e.Group([...t(f).map((e=>d(e*i+c,e))),...t(y).map((e=>d(-e*i+c,e)))]);return new e.Group([h,p])}(C,W),(H=C.map((({x:e,y:t})=>({x:e,y:-t}))),new e.Polyline(H,{...n,fill:"transparent",stroke:"red",strokeWidth:1,left:A.x,top:A.y+30})),function(t,o){const r={strokeDashArray:[3,4],width:3,top:A.y},i=new e.Line(a(t[Y]),{...n,...r,left:A.x+Y/t.length*E,stroke:"red"}),l=new e.Line(a(t[$]),{...n,...r,stroke:"blue",left:A.x+$/t.length*E}),s=new e.Line(a(t[o]),{...n,...r,stroke:"green",left:A.x+o/t.length*E});return new e.Group([i,l,s]);function a(e){return[e.x,e.y,e.x,e.y-z]}}(C,W),(P=C,R=W,new e.Circle({...n,radius:5,fill:"transparent",stroke:"green",strokeWidth:1,left:A.x+R/P.length*E-5,top:A.y+30+(P[Y].y-P[R].y)/Math.abs(P[Y].y-P[$].y)*X-5}))];var P,R,H;p&&D.push(new e.Text(`x${l}`,{...n,fill:"black",fontSize:20,left:A.x+10,top:A.y+z-30})),c&&D.push(function(t,o){const r={fontSize:16,left:A.x+E/2+10},i=new e.Text(`最大: ${j(t[Y].y)} mv`,{...n,...r,fill:"red",top:A.y+z-20}),l=new e.Text(`最小: ${j(t[$].y)} mv`,{...n,...r,fill:"blue",top:A.y+z-40}),s=new e.Text(`当前: ${j(t[o].y)} mv`,{...n,...r,fill:"green",top:A.y+z-60});return new e.Group([i,l,s])}(C,W)),w.add(...D).addWithUpdate(),null==(i=r.canvas)||i.add(w),null==(h=r.canvas)||h.discardActiveObject()})),r.on("mouseup",(async e=>{await(null==s?void 0:s()),1===e.button&&M()}))}export{r as useDetailEvent};
@@ -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 o}from"./hooks/useDetailEvent.js";import{defaultStyle as n,drawLine as i}from"../useDraw.js";import{useGrid as a}from"../useGrid.js";import{useElectrocardiogramCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import"../useCommon.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:C,columnNumber:v,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/v)*(A.mainXCellValue/s.DEFAULTMAINXCELLVALUE)}function B(t=0){C.forEach(((r,o)=>{if(o===C.length-1&&arguments.length)return;const{x:n,y:i,rowIdx:a}=r.origin,l=X(r.data),u=r.data.reduce(((e,r,n)=>{const a=o<s.MAXLINENUMBER-1&&n>=t&&n<=t+l||o===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:n,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,o<C.length-1?R.add(f):U.add(f),arguments.length)return;I({x:n,y:i},S);const L=new e.Text(String(r.title),{...w,left:n+(4===v?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){o(e,t)}function I({x:t,y:r},o){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}],{...o,fill:"transparent",strokeWidth:1,left:i,...n});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/v,t=[];r(v).forEach((r=>{if(r+1>=v)return;const o=(r+1)*e,n=i([o,0,o,M],{stroke:"#000"});t.push(n)})),u.value.add(...t)}(),B();return{updatePolyline:t((t=>{const r=X(C[C.length-1].data);if(r===C[0].data.length)return;const o=C[C.length-1].data.length,n=t/100*o-r/2,i=n+r>o?o-r:Math.max(0,n);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 o}from"./hooks/useDetailEvent.js";import{defaultStyle as n,drawLine as i}from"../useDraw.js";import{useGrid as a}from"../useGrid.js";import{useElectrocardiogramCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import"../useCommon.js";import"vue";import"date-fns";import"../temperature/useShadow.js";import{ECG as s}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../../../../../shared/utils/index.js";function d(d,u,m){const{computedX:c,computedY:h}=l(u),{borderStyle:f,originX:L,originY:g,xCellWidth:p,yCellHeight:E,canvasWidth:x,canvasHeight:M,dataList:C,columnNumber:v,gridYNumber:N,gridXNumber:y,rowNumber:b,lineStyle:S,titleStyle:j,config:w,calibrationLineHeight:A}=u,R=new Set,U=new Set;function X(e=[]){return~~(e.length/v)*(w.mainXCellValue/s.DEFAULTMAINXCELLVALUE)}function B(t=0){C.forEach(((r,o)=>{if(o===C.length-1&&arguments.length)return;const{x:n,y:i,rowIdx:a}=r.origin,l=X(r.data),d=r.data.reduce(((e,r,n)=>{const a=o<s.MAXLINENUMBER-1&&n>=t&&n<=t+l||o===s.MAXLINENUMBER-1?[{x:c(e.length+1),y:h(-+r)+i}]:[];return e.concat(a)}),[]),f=new e.Polyline(d,{...S,fill:"transparent",strokeWidth:1,left:n,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:()=>m.value&&Promise.reject()}),f.startIdx=t,o<C.length-1?R.add(f):U.add(f),arguments.length)return;I({x:n,y:i},S);const L=new e.Text(String(r.title),{...j,left:n+(4===v?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){o(e,t)}function I({x:t,y:r},o){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-A},{x:i+3*a,y:r-A},{x:i+3*a,y:r},{x:i+4*a,y:r}],{...o,fill:"transparent",strokeWidth:1,left:i,...n});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/v,t=[];r(v).forEach((r=>{if(r+1>=v)return;const o=(r+1)*e,n=i([o,0,o,M],{stroke:"#000"});t.push(n)})),d.value.add(...t)}(),B();return{updatePolyline:t((t=>{const r=X(C[C.length-1].data);if(r===C[0].data.length)return;const o=C[C.length-1].data.length,n=t/100*o-r/2,i=n+r>o?o-r:Math.max(0,n);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"../useCommon.js";import"../temperature/useShadow.js";import{ECG as m}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as v}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})),j=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),X=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),Y=a((()=>{const{rowNumber:e}=X.value,a=C.value.length;return Math.round(w.value/(e+(a===m.MAXLINENUMBER?1:0)))})),I=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:l}=X.value,r=e/u,i=C.value.length,n=Math.ceil(Y.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,v=L.value;return C.value.map(((e,a)=>{const t=m.MAXLINENUMBER===i&&a===i-1?l:a%l;return{...e,origin:{x:(m.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/l))*r+v,y:t*(x.value*Y.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:j.value,dataList:I.value,columnNumber:t(X).columnNumber,rowNumber:t(X).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}=v(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:m.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 s,last as d}from"lodash-es";import"../useEvent.js";import"../useCommon.js";import"../temperature/useShadow.js";import{ECG as m}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";import{useElectrocardiogram as v}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})),x=a((()=>(y.value-0)/S.value)),L=a((()=>(R.value-0)/w.value)),S=a((()=>{var e,a,t;const{config:u,grid:l}=h.data;if(s(l.gridXNumber))return l.gridXNumber;const r=(null!=(t=null==(a=null==(e=d(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(s(a.gridYNumber))return a.gridYNumber;const t=C.value.length;return Math.ceil(j.value*t*2/e.mainYCellValue)})),j=a((()=>{var e;const{config:a}=h.data,t=null==(e=d(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})),E=a((()=>{var e;return(null==(e=h.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),X=a((()=>{const{mode:e="2-6"}=h.data,[a,t]=e.split("-").map((e=>+e));return{columnNumber:a,rowNumber:t}})),Y=a((()=>{const{rowNumber:e}=X.value,a=C.value.length;return Math.round(w.value/(e+(a===m.MAXLINENUMBER?1:0)))})),I=a((()=>{const{width:e,config:a,grid:t}=h.data,{columnNumber:u,rowNumber:l}=X.value,r=e/u,i=C.value.length,n=Math.ceil(Y.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*L.value}}(),s=L.value*n,d=1===u||s<o?L.value*Math.ceil(o/L.value):s,v=x.value;return C.value.map(((e,a)=>{const t=m.MAXLINENUMBER===i&&a===i-1?l:a%l;return{...e,origin:{x:(m.MAXLINENUMBER===i&&a===i-1?0:Math.floor(a/l))*r+v,y:t*(L.value*Y.value)+d,rowIdx:t}}}))})),U=a((()=>{var e;const{calibrationLineGridYNumber:a,mainYCellValue:t}=(null==(e=h.data)?void 0:e.config)||{};return a?L.value*a:t?L.value/t:L.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:x.value,yCellHeight:L.value,gridXNumber:S.value,gridYNumber:w.value,event:E.value,dataList:I.value,columnNumber:t(X).columnNumber,rowNumber:t(X).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}=v(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:x.value,cellHeight:L.value,smallCellNumber:m.SMALLCELLNUMBER}}}}export{g as useElectrocardiogramChart};
@@ -1 +1 @@
1
- import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as r}from"../useDraw.js";import{useElectrocardiogramCumputedPoint as i}from"../useCumputedPoint.js";import"../useEvent.js";import"../useCommon.js";import{isNumber as n}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function l(l,s){const{getXValue:u,getYValue:c}=i(s),{yCellHeight:a,xCellWidth:h,measureLineStyle:d,measureTextStyle:f}=s,p=e(!1),x={origin:{x:0,y:0},obj:null,rendering:!1,type:"line"},m={origin:{x:300,y:10},caliper:{width:4*h,height:60,rect:null},caliperRuler:{width:6*h,height:120,rect:null},rectRuler:{width:12*h,height:120,rect:null}};function v(){x.obj&&(l.value.remove(x.obj),x.obj.text&&l.value.remove(x.obj.text),x.obj=null)}function g(){p.value||(p.value=!0)}function y(e,o){L();const{width:i,height:n,rect:s}=m[e];if(s)return;let u;const{x:c,y:a}=o||m.origin,h=a+m.caliper.height,p=["caliper","rectRuler"].includes(e);m[e].rect=new t.Rect({left:c,top:a,width:i,height:n,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"move"});const x={...d,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",strokeWidth:2,__type:e,evented:!0,selectable:!0},v=new t.Line([c,a,c,a+n],{...x,lockMovementY:!0,originX:"center"}),g=new t.Line([c+i,a,c+i,a+n],{...x,lockMovementY:!0,originX:"center"}),y=new t.Line([c,h,c+i,h],{...x,lockMovementX:!0,evented:p,hoverCursor:p?"n-resize":"default",originY:"center"});let j=C({x1:y.x1,x2:y.x2}).millisecond;if("rectRuler"===e){const{millivolt:e,millisecond:o,bpm:r}=C({x1:c+i,x2:c,y1:a+n,y2:a});j=`测量幅度:${e}\n测试时间:${o}\n瞬时心率:${r}`,y.set({y1:a,y2:a}),u=new t.Line([c,a+n,c+i,a+n],{...x,lockMovementX:!0,evented:!0,hoverCursor:"n-resize",originY:"center"})}const w=r([c,("rectRuler"===e?u.top:y.top)+10],{value:j,...f,originX:"left",originY:"top",backgroundColor:"#fff"});v.rect=m[e].rect,g.rect=m[e].rect,y.rect=m[e].rect,u&&(u.rect=m[e].rect),Object.assign(m[e].rect,{leftLine:v,rightLine:g,horizontalLine:y,horizontalLine2:u,text:w}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:r,horizontalLine:i,horizontalLine2:n,text:l}=e;null==o||o.setCoords().set({x1:e.left,y1:e.top,x2:e.left,y2:e.top+e.height}),null==r||r.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const s=["caliper","rectRuler"].includes(t)?e.top+e.height:e.top+e.height/2;l.setCoords().set({left:e.left,top:s+10}),"rectRuler"===t?(null==i||i.setCoords().set({x1:e.left,x2:e.left+e.width,y1:e.top,y2:e.top}),null==n||n.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})):null==i||i.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})})),e.on("mouseup",(t=>{var o;1===t.button&&(l.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront(),null==(o=e.horizontalLine2)||o.bringToFront())}))}(m[e].rect,e),b(v,"left"),b(g,"right"),p&&b(y,"horizontal"),u&&b(u,"horizontal2");const z=[m[e].rect,v,g,y,u,w].filter((e=>!!e));l.value.add(...z)}function C({x1:e,x2:t,y1:o,y2:r}){const i=(1e3*u(Math.abs(t-e))).toFixed(3);return{millisecond:`${i}ms`,millivolt:`${n(o)&&n(r)?c(Math.abs(r-o)).toFixed(3):0}mv`,bpm:`${(6e4/+i).toFixed(3)}bpm`}}function b(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:r,rightLine:i,horizontalLine:n,horizontalLine2:l,text:s}=o;if(("horizontal"===t&&!l||"horizontal2"===t)&&(e.top<=o.top?e.setCoords().set({y1:o.top,y2:o.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==r||r.setCoords().set({y2:e.top}),null==i||i.setCoords().set({y2:e.top}),s.setCoords().set({top:e.top+10}),!l))return;"horizontal"===t&&l&&(e.top>=l.top?e.setCoords().set({y1:l.top,y2:l.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({top:e.top,height:l.top-e.top}),null==r||r.setCoords().set({y1:e.top}),null==i||i.setCoords().set({y1:e.top}),s.setCoords().set({top:l.top+10})),"left"===t&&(e.left>=i.left?e.setCoords().set({x1:i.left,x2:i.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left,width:i.left-e.left}),n.setCoords().set({x1:e.left}),null==l||l.setCoords().set({x1:e.left}),s.setCoords().set({left:e.left})),"right"===t&&(e.left<=r.left?e.setCoords().set({x1:r.left,x2:r.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-r.left}),n.setCoords().set({x2:e.left}),null==l||l.setCoords().set({x2:e.left}));const{millivolt:u,millisecond:c,bpm:a}=C({x1:n.x1,x2:n.x2,y1:r.y1,y2:r.y2}),h=l?`测量幅度:${u}\n测试时间:${c}\n瞬时心率:${a}`:c;s.set("text",h)}))}function L(){Object.values(m).forEach((e=>{const{rect:t}=e;t&&(l.value.remove(t),t.leftLine&&l.value.remove(t.leftLine),t.rightLine&&l.value.remove(t.rightLine),t.horizontalLine&&l.value.remove(t.horizontalLine),t.horizontalLine2&&l.value.remove(t.horizontalLine2),t.text&&l.value.remove(t.text),e.rect=null)})),v()}return l.value.on("mouse:down",(e=>{if(1===e.button&&p.value){const{x:t=0,y:o=0}=e.pointer||{};L(),x.rendering=!0,x.origin={x:t,y:o}}})),l.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&p.value&&setTimeout((()=>{if(p.value=!1,x.rendering&&(x.rendering=!1),"rect"===x.type){const{width:e,height:t}=x.obj,o={x:Math.min(x.origin.x,x.origin.x+e),y:Math.min(x.origin.y,x.origin.y+t)+2};m.rectRuler.width=Math.abs(e),m.rectRuler.height=Math.abs(t),v(),y("rectRuler",o)}})),3===t&&L()})),l.value.on("mouse:move",(e=>{if(1===e.button&&p.value&&x.rendering){const{x:i=0,y:n=0}=e.pointer||{};if(v(),"line"===x.type){const{x:e,y:t}=x.origin;x.obj=o([e,t,i,n],d);const{millivolt:s,millisecond:u}=C({x1:e,x2:i,y1:t,y2:n}),c=r([i,n+2*a],{value:`${s}\n${u}`,...f});x.obj.text=c,l.value.add(x.obj,c)}else!function({x:e,y:o}){const{x:i,y:n}=x.origin;x.obj=new t.Rect({...d,objectCaching:!1,fill:"transparent",left:i,top:n,width:e-i,height:o-n,strokeWidth:2});const{millivolt:s,millisecond:u,bpm:c}=C({x1:i,x2:e,y1:n,y2:o}),a=r([i,o+10],{value:`测量幅度:${s}\n测试时间:${u}\n瞬时心率:${c}`,...f,originX:"left",originY:"top",backgroundColor:"#fff"});x.obj.text=a,l.value.add(x.obj,a)}({x:i,y:n})}})),{flag:p,useMeasureRuler:function(){g(),x.type="line"},useCaliper:function(){y("caliper")},useCaliperRuler:function(){y("caliperRuler")},useRectRuler:function(){g(),x.type="rect"}}}export{l as useMeasureInstrument};
1
+ import{ref as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as o,drawText as i}from"../useDraw.js";import{useElectrocardiogramCumputedPoint as r}from"../useCumputedPoint.js";import"../useEvent.js";import"../useCommon.js";import{isNumber as n}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";function l(l,s){const{getXValue:u,getYValue:c}=r(s),{yCellHeight:a,xCellWidth:h,measureLineStyle:d,measureTextStyle:f}=s,p=e(!1),x={origin:{x:0,y:0},obj:null,rendering:!1,type:"line"},m={origin:{x:300,y:10},caliper:{width:4*h,height:60,rect:null},caliperRuler:{width:6*h,height:120,rect:null},rectRuler:{width:12*h,height:120,rect:null}};function v(){x.obj&&(l.value.remove(x.obj),x.obj.text&&l.value.remove(x.obj.text),x.obj=null)}function g(){p.value||(p.value=!0)}function y(e,o){L();const{width:r,height:n,rect:s}=m[e];if(s)return;let u;const{x:c,y:a}=o||m.origin,h=a+m.caliper.height,p=["caliper","rectRuler"].includes(e);m[e].rect=new t.Rect({left:c,top:a,width:r,height:n,strokeWidth:0,fill:"transparent",hasControls:!1,hasBorders:!1,hoverCursor:"move"});const x={...d,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",strokeWidth:2,__type:e,evented:!0,selectable:!0},v=new t.Line([c,a,c,a+n],{...x,lockMovementY:!0,originX:"center"}),g=new t.Line([c+r,a,c+r,a+n],{...x,lockMovementY:!0,originX:"center"}),y=new t.Line([c,h,c+r,h],{...x,lockMovementX:!0,evented:p,hoverCursor:p?"n-resize":"default",originY:"center"});let j=C({x1:y.x1,x2:y.x2}).millisecond;if("rectRuler"===e){const{millivolt:e,millisecond:o,bpm:i}=C({x1:c+r,x2:c,y1:a+n,y2:a});j=`测量幅度:${e}\n测试时间:${o}\n瞬时心率:${i}`,y.set({y1:a,y2:a}),u=new t.Line([c,a+n,c+r,a+n],{...x,lockMovementX:!0,evented:!0,hoverCursor:"n-resize",originY:"center"})}const w=i([c,("rectRuler"===e?u.top:y.top)+10],{value:j,...f,originX:"left",originY:"top",backgroundColor:"#fff"});v.rect=m[e].rect,g.rect=m[e].rect,y.rect=m[e].rect,u&&(u.rect=m[e].rect),Object.assign(m[e].rect,{leftLine:v,rightLine:g,horizontalLine:y,horizontalLine2:u,text:w}),function(e,t){e.on("moving",(()=>{const{leftLine:o,rightLine:i,horizontalLine:r,horizontalLine2:n,text:l}=e;null==o||o.setCoords().set({x1:e.left,y1:e.top,x2:e.left,y2:e.top+e.height}),null==i||i.setCoords().set({x1:e.left+e.width,y1:e.top,x2:e.left+e.width,y2:e.top+e.height});const s=["caliper","rectRuler"].includes(t)?e.top+e.height:e.top+e.height/2;l.setCoords().set({left:e.left,top:s+10}),"rectRuler"===t?(null==r||r.setCoords().set({x1:e.left,x2:e.left+e.width,y1:e.top,y2:e.top}),null==n||n.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})):null==r||r.setCoords().set({x1:e.left,y1:s,x2:e.left+e.width,y2:s})})),e.on("mouseup",(t=>{var o;1===t.button&&(l.value.discardActiveObject(),e.leftLine.bringToFront(),e.rightLine.bringToFront(),e.horizontalLine.bringToFront(),null==(o=e.horizontalLine2)||o.bringToFront())}))}(m[e].rect,e),b(v,"left"),b(g,"right"),p&&b(y,"horizontal"),u&&b(u,"horizontal2");const z=[m[e].rect,v,g,y,u,w].filter((e=>!!e));l.value.add(...z)}function C({x1:e,x2:t,y1:o,y2:i}){const r=(1e3*u(Math.abs(t-e))).toFixed(3);return{millisecond:`${r}ms`,millivolt:`${n(o)&&n(i)?c(Math.abs(i-o)).toFixed(3):0}mv`,bpm:`${(6e4/+r).toFixed(3)}bpm`}}function b(e,t){e.on("moving",(()=>{const{rect:o}=e;if(!o)return;const{leftLine:i,rightLine:r,horizontalLine:n,horizontalLine2:l,text:s}=o;if(("horizontal"===t&&!l||"horizontal2"===t)&&(e.top<=o.top?e.setCoords().set({y1:o.top,y2:o.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({height:e.top-o.top}),null==i||i.setCoords().set({y2:e.top}),null==r||r.setCoords().set({y2:e.top}),s.setCoords().set({top:e.top+10}),!l))return;"horizontal"===t&&l&&(e.top>=l.top?e.setCoords().set({y1:l.top,y2:l.top}):e.setCoords().set({y1:e.top,y2:e.top}),o.setCoords().set({top:e.top,height:l.top-e.top}),null==i||i.setCoords().set({y1:e.top}),null==r||r.setCoords().set({y1:e.top}),s.setCoords().set({top:l.top+10})),"left"===t&&(e.left>=r.left?e.setCoords().set({x1:r.left,x2:r.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({left:e.left,width:r.left-e.left}),n.setCoords().set({x1:e.left}),null==l||l.setCoords().set({x1:e.left}),s.setCoords().set({left:e.left})),"right"===t&&(e.left<=i.left?e.setCoords().set({x1:i.left,x2:i.left}):e.setCoords().set({x1:e.left,x2:e.left}),o.setCoords().set({width:e.left-i.left}),n.setCoords().set({x2:e.left}),null==l||l.setCoords().set({x2:e.left}));const{millivolt:u,millisecond:c,bpm:a}=C({x1:n.x1,x2:n.x2,y1:i.y1,y2:i.y2}),h=l?`测量幅度:${u}\n测试时间:${c}\n瞬时心率:${a}`:c;s.set("text",h)}))}function L(){Object.values(m).forEach((e=>{const{rect:t}=e;t&&(l.value.remove(t),t.leftLine&&l.value.remove(t.leftLine),t.rightLine&&l.value.remove(t.rightLine),t.horizontalLine&&l.value.remove(t.horizontalLine),t.horizontalLine2&&l.value.remove(t.horizontalLine2),t.text&&l.value.remove(t.text),e.rect=null)})),v()}return l.value.on("mouse:down",(e=>{if(1===e.button&&p.value){const{x:t=0,y:o=0}=e.pointer||{};L(),x.rendering=!0,x.origin={x:t,y:o}}})),l.value.on("mouse:up",(e=>{const{button:t}=e;1===t&&p.value&&setTimeout((()=>{if(p.value=!1,x.rendering&&(x.rendering=!1),"rect"===x.type){const{width:e,height:t}=x.obj,o={x:Math.min(x.origin.x,x.origin.x+e),y:Math.min(x.origin.y,x.origin.y+t)+2};m.rectRuler.width=Math.abs(e),m.rectRuler.height=Math.abs(t),v(),y("rectRuler",o)}})),3===t&&L()})),l.value.on("mouse:move",(e=>{if(1===e.button&&p.value&&x.rendering){const{x:r=0,y:n=0}=e.pointer||{};if(v(),"line"===x.type){const{x:e,y:t}=x.origin;x.obj=o([e,t,r,n],d);const{millivolt:s,millisecond:u}=C({x1:e,x2:r,y1:t,y2:n}),c=i([r,n+2*a],{value:`${s}\n${u}`,...f});x.obj.text=c,l.value.add(x.obj,c)}else!function({x:e,y:o}){const{x:r,y:n}=x.origin;x.obj=new t.Rect({...d,objectCaching:!1,fill:"transparent",left:r,top:n,width:e-r,height:o-n,strokeWidth:2});const{millivolt:s,millisecond:u,bpm:c}=C({x1:r,x2:e,y1:n,y2:o}),a=i([r,o+10],{value:`测量幅度:${s}\n测试时间:${u}\n瞬时心率:${c}`,...f,originX:"left",originY:"top",backgroundColor:"#fff"});x.obj.text=a,l.value.add(x.obj,a)}({x:r,y:n})}})),{flag:p,useMeasureRuler:function(){g(),x.type="line"},useCaliper:function(){y("caliper")},useCaliperRuler:function(){y("caliperRuler")},useRectRuler:function(){g(),x.type="rect"}}}export{l as useMeasureInstrument};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as s,drawScaleNumber as a,drawScaleLine as u}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import{isEffectiveNode as d,getTime as h,getScaleNumberList as f}from"../../utils/index.js";import{cloneDeep as p,last as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function v(v,g,w,x,y){const{computedX:b,computedY:L,getXValue:S,getYValue:j}=l(g),{getEqualXTypes:E,handleAddPrevent:k,isGridLimit:X,setPrevAndNextPoint:P,getPointEventProps:C}=c(v,w,g),{xAxis:A,grid:T,originX:G,originY:Y,xCellWidth:N,endY:V,startTime:B,leftScales:H,rightScales:M,yCellHeight:$,endX:W,scaleValues:q,canvasWidth:z,borderStyle:D,event:F,other:I,timeXAxisHeight:R,canvasHeight:J,extraTimeXAxisList:K}=g,O=p(q),Q=new Set;function U(){O.filter((t=>t.show)).forEach(((t,r)=>{var l;const s=[],a=[],u=[];null==(l=t.data)||l.forEach(((l,c)=>{!function(l,c,d){if(!l&&!c.childbirth||!(null==c?void 0:c.time)||!tt(c.time))return;let h,f;const{pointAttr:v={},lineAttr:g={},title:w="",key:y,type:L="circle",childbirthStyle:E={}}=t,k=p(t.data[d+1]);k&&!k.value&&k.childbirth&&(k.value=c.value);const X=_(k,t);l&&X&&!c.breakpoint&&(f=Z([...l,...X],g));if(c.childbirth){const t=l?l[0]:b(c.time),n=l?l[1]:m(s).top,o=n+$/2,r=Z([t,n,t,o],g);u.push(r);const a=e([t,o],{value:String(c.childbirth),...i,...E,backgroundColor:"#fff"});u.push(a)}const P=a[d-1],A={origin:{data:c,title:w,key:y||"",dataIndex:r,index:d},leftLine:P,rightLine:f,...v,...C(),...n};l&&(P||(A.leftLine=null),h=o(L,{left:l[0],top:l[1],...A}));f&&a.push(f),h&&(!function(t){F.hovered&&(t.on("mouseover",(()=>{!function(t,e="moving"){const{title:i,key:n,data:o}=t.origin;x.point={x:t.left,y:t.top},x.list=[`${i} ${"hover"===e?o.value:j(n,t.top)}`,`时间 ${S(t.left).slice(-5)}`],x.show=!0}(t,"hover")})),t.on("mouseout",(()=>{x.show=!1})))}(h),s.push(h),Q.add(h))}(_(l,t),l,c)})),Promise.all(s).then((t=>{P(t),Promise.all(u).then((e=>{v.value.add(...a,...t,...e),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function Z([e,i,o,r],l){return new t.Polyline([{x:e,y:i},{x:o,y:i},{x:o,y:r}],{...l,fill:"transparent",...n})}function _(t,e){if(d(t)&&tt(t.time)){const i=b(t.time),n=L(e.key,e.range,t.value);return[i,n<Y?Y:n>V?V:n]}}function tt(t){var e,i;const n=(null==(i=null==(e=null==A?void 0:A.time)?void 0:e.range)?void 0:i[1])||20,o=B+60*n*60*1e3,r=h(t);return r>=B&&r<=o}return r(v,g),function(){const e=new t.Rect({...D,width:W-G,height:V-Y,left:G,top:Y,fill:"transparent"});v.value.add(e)}(),function(){function o(o,r="left"){const l=10;let c="left"===r?0:W;o.forEach(((o,r)=>{const{range:d,spaceValue:h,width:p,title:m,titleStyle:g,unit:w,key:x,position:y="center",spaceGridNumber:b=1,showNumber:L,showMaxMinNumber:S}=o,j=[],E=[],k=f(d,h),X=k.length,{lineXMain:P,lineXSub:C,textLeft:A}=s(y,c,p);k.forEach(((t,e)=>{const i=V-e*$*b;!L||(0===e||e===X-1)&&!S||j.push(a(String(t),o,A,i)),E.push(...u(o,e,P,C,i,$,Y,X,1))}));const T=e([c+l,Y+(V-Y)/2],{value:String(m+"("+w+")"),...i,originX:"center",angle:-90,...g}),G=new t.Group([...E,...j,...T?[T]:[]],{objectCaching:!1,...n});v.value.add(G),G.sendToBack(),c+=p}))}o(H),o(M,"right")}(),function(){const{show:o,range:r=[0,20],position:l="top",style:s,spaceGridNumber:a=2,spaceValue:u=2}=A.time;if(o){const o=[],c=$/2;f(r,u).forEach(((t,n)=>{const r="top"===l?Y-c:V+R+c;o.push(e([G+n*N*a,r],{value:0===n?"Admission":String(t),...i,...s}))}));const d=new t.Group(o,{objectCaching:!1,...n});v.value.add(d),v.value.sendToBack(d)}!function(){if((null==K?void 0:K.length)>0){const t=[];K.forEach((n=>{const o=b(n),r=V+R;t.push(e([o,r],{value:String(n.slice(11,16)),...i,originY:"bottom"}))})),v.value.add(...t)}}()}(),function(){var t;const{alertLineList:n=[],alertLineTitle:o=(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.227"))||"入院时宫颈扩张不同情况"}=I;if(n.length<1)return;const r=e([W,0],{value:o,...i,originX:"right",originY:"top"});v.value.add(r),n.forEach((t=>{const{style:i,data:n=[]}=t;if(n.length<1)return;const o=[],r=O.find((t=>"cervix"===t.key));n.map((t=>({...t,time:B+60*t.time*60*1e3}))).forEach(((t,n,l)=>{const s=_(t,r),a=_(l[n+1],r);s&&!a&&o.push(e([s[0],Y-10],{value:l[0].value+(r.unit||"cm"),fill:i.stroke||"#000"})),s&&a&&o.push(Z([...s,...a],i))})),v.value.add(...o)}))}(),U(),{redrawPoints:function(){var t;Q.size&&(null==(t=v.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine)})),e}([...Q]))),Q.clear(),U()}}}export{v as useNewBirthProcess};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as s,drawScaleNumber as a,drawScaleLine as u}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import{isEffectiveNode as d,getTime as h,getScaleNumberList as f}from"../../utils/index.js";import{cloneDeep as p,last as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";function v(v,g,x,w,y){const{computedX:b,computedY:j,getXValue:L,getYValue:S}=l(g),{getEqualXTypes:E,handleAddPrevent:k,isGridLimit:X,setPrevAndNextPoint:P,getPointEventProps:C}=c(v,x,g),{xAxis:A,grid:T,originX:G,originY:Y,xCellWidth:N,endY:V,startTime:B,leftScales:H,rightScales:M,yCellHeight:$,endX:W,scaleValues:q,canvasWidth:z,borderStyle:D,event:F,other:I,timeXAxisHeight:R,canvasHeight:J,extraTimeXAxisList:K}=g,O=p(q),Q=new Set;function U(){O.filter((t=>t.show)).forEach(((t,r)=>{var l;const s=[],a=[],u=[];null==(l=t.data)||l.forEach(((l,c)=>{!function(l,c,d){if(!l&&!c.childbirth||!(null==c?void 0:c.time)||!tt(c.time))return;let h,f;const{pointAttr:v={},lineAttr:g={},title:x="",key:y,type:j="circle",childbirthStyle:E={}}=t,k=p(t.data[d+1]);k&&!k.value&&k.childbirth&&(k.value=c.value);const X=_(k,t);l&&X&&!c.breakpoint&&(f=Z([...l,...X],g));if(c.childbirth){const t=l?l[0]:b(c.time),n=l?l[1]:m(s).top,o=n+$/2,r=Z([t,n,t,o],g);u.push(r);const a=e([t,o],{value:String(c.childbirth),...i,...E,backgroundColor:"#fff"});u.push(a)}const P=a[d-1],A={origin:{data:c,title:x,key:y||"",dataIndex:r,index:d},leftLine:P,rightLine:f,...v,...C(),...n};l&&(P||(A.leftLine=null),h=o(j,{left:l[0],top:l[1],...A}));f&&a.push(f),h&&(!function(t){F.hovered&&(t.on("mouseover",(()=>{!function(t,e="moving"){const{title:i,key:n,data:o}=t.origin;w.point={x:t.left,y:t.top},w.list=[`${i} ${"hover"===e?o.value:S(n,t.top)}`,`时间 ${L(t.left).slice(-5)}`],w.show=!0}(t,"hover")})),t.on("mouseout",(()=>{w.show=!1})))}(h),s.push(h),Q.add(h))}(_(l,t),l,c)})),Promise.all(s).then((t=>{P(t),Promise.all(u).then((e=>{v.value.add(...a,...t,...e),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function Z([e,i,o,r],l){return new t.Polyline([{x:e,y:i},{x:o,y:i},{x:o,y:r}],{...l,fill:"transparent",...n})}function _(t,e){if(d(t)&&tt(t.time)){const i=b(t.time),n=j(e.key,e.range,t.value);return[i,n<Y?Y:n>V?V:n]}}function tt(t){var e,i;const n=(null==(i=null==(e=null==A?void 0:A.time)?void 0:e.range)?void 0:i[1])||20,o=B+60*n*60*1e3,r=h(t);return r>=B&&r<=o}return r(v,g),function(){const e=new t.Rect({...D,width:W-G,height:V-Y,left:G,top:Y,fill:"transparent"});v.value.add(e)}(),function(){function o(o,r="left"){const l=10;let c="left"===r?0:W;o.forEach(((o,r)=>{const{range:d,spaceValue:h,width:p,title:m,titleStyle:g,unit:x,key:w,position:y="center",spaceGridNumber:b=1,showNumber:j,showMaxMinNumber:L}=o,S=[],E=[],k=f(d,h),X=k.length,{lineXMain:P,lineXSub:C,textLeft:A}=s(y,c,p);k.forEach(((t,e)=>{const i=V-e*$*b;!j||(0===e||e===X-1)&&!L||S.push(a(String(t),o,A,i)),E.push(...u(o,e,P,C,i,$,Y,X,1))}));const T=e([c+l,Y+(V-Y)/2],{value:String(m+"("+x+")"),...i,originX:"center",angle:-90,...g}),G=new t.Group([...E,...S,...T?[T]:[]],{objectCaching:!1,...n});v.value.add(G),G.sendToBack(),c+=p}))}o(H),o(M,"right")}(),function(){const{show:o,range:r=[0,20],position:l="top",style:s,spaceGridNumber:a=2,spaceValue:u=2}=A.time;if(o){const o=[],c=$/2;f(r,u).forEach(((t,n)=>{const r="top"===l?Y-c:V+R+c;o.push(e([G+n*N*a,r],{value:0===n?"Admission":String(t),...i,...s}))}));const d=new t.Group(o,{objectCaching:!1,...n});v.value.add(d),v.value.sendToBack(d)}!function(){if((null==K?void 0:K.length)>0){const t=[];K.forEach((n=>{const o=b(n),r=V+R;t.push(e([o,r],{value:String(n.slice(11,16)),...i,originY:"bottom"}))})),v.value.add(...t)}}()}(),function(){var t;const{alertLineList:n=[],alertLineTitle:o=(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.227"))||"入院时宫颈扩张不同情况"}=I;if(n.length<1)return;const r=e([W,0],{value:o,...i,originX:"right",originY:"top"});v.value.add(r),n.forEach((t=>{const{style:i,data:n=[]}=t;if(n.length<1)return;const o=[],r=O.find((t=>"cervix"===t.key));n.map((t=>({...t,time:B+60*t.time*60*1e3}))).forEach(((t,n,l)=>{const s=_(t,r),a=_(l[n+1],r);s&&!a&&o.push(e([s[0],Y-10],{value:l[0].value+(r.unit||"cm"),fill:i.stroke||"#000"})),s&&a&&o.push(Z([...s,...a],i))})),v.value.add(...o)}))}(),U(),{redrawPoints:function(){var t;Q.size&&(null==(t=v.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine)})),e}([...Q]))),Q.clear(),U()}}}export{v as useNewBirthProcess};
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as r}from"date-fns";import{getTime as u}from"../../utils/index.js";import{range as s,last as o}from"lodash-es";import"../useEvent.js";import"../useCommon.js";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useNewBirthProcess as n}from"./useNewBirthProcess.js";function d(d,v,c,m,h,x){const p=e(),g=a((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),f=a((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),w=a((()=>{var e;return null==(e=g.value)?void 0:e.reduce(((e,a)=>e+=a.width),0)})),b=a((()=>{var e;const{width:a}=v.data;return a-((null==(e=f.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))||15)})),j=a((()=>v.data.grid.mainXCell||20)),y=a((()=>v.data.grid.mainYCell||8)),A=a((()=>(b.value-w.value)/j.value)),M=a((()=>{var e;const{xAxis:a,height:t,other:l}=v.data,i=Object.values(a).reduce(((e,a)=>(a.show&&e++,e)),0),r=(null!=(e=null==l?void 0:l.alertLineList.length)?e:0)>0;return(t-V.value)/(y.value+i+(r?1:0))})),C=a((()=>{var e;const{xAxis:a,other:t}=v.data,l=Object.values(a).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0),i=(null!=(e=null==t?void 0:t.alertLineList.length)?e:0)>0;return M.value*(l||i?1:0)})),S=a((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-M.value*t-V.value})),V=a((()=>{const e=g.value.concat(f.value);return(null==e?void 0:e.length)>0?20:0})),X=a((()=>u(v.data.xAxis.time.startTime))),H=a((()=>{const{spaceValue:e,spaceGridNumber:a}=v.data.xAxis.time||{};return 60*e*60*1e3/(A.value*a)})),L=a((()=>{var e,a,t;const l=null==(t=null==(a=null==(e=g.value.concat(f.value))?void 0:e[0])?void 0:a.data)?void 0:t.map((e=>u(e.time))),i=Math.min(...l);let n=Math.min(Math.max(...l));const d=H.value*A.value,v=s(1,j.value+1).reduce(((e,a,t)=>e.concat(X.value+a*d)),[X.value]);n=Math.min(n,o(v));const c=v.findIndex((e=>Math.abs(e-i)<d)),m=v.findIndex((e=>Math.abs(e-n)<d))+1;return v.filter(((e,a)=>a>=c&&a<=m)).map((e=>r(new Date(e),"yyyy-MM-dd HH:mm:ss")))})),Y=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return M.value/((null==a?void 0:a.spaceValue)||1)})),N=a((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),I=t({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...i,...v.data.borderStyle||{}},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:w.value,endX:b.value,originY:C.value,endY:S.value,xCellWidth:A.value,yCellHeight:M.value,gridXNumber:j.value,gridYNumber:y.value,xAxis:v.data.xAxis,leftScales:g.value,rightScales:f.value,startTime:X.value,timeXCell:H.value,cervixYCell:Y.value,scaleValues:v.data.scaleValues,timeXAxisHeight:V.value,extraTimeXAxisList:L.value,event:N.value});return l((()=>d.value),(e=>{e&&function(){const{redrawPoints:e}=n(d,I,c,h);p.value=e}()}),{immediate:!0}),{propItems:I,redrawPoints:p}}export{d as useNewBirthProcessChart};
1
+ import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as r}from"date-fns";import{getTime as u}from"../../utils/index.js";import{range as s,last as o}from"lodash-es";import"../useEvent.js";import"../useCommon.js";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";import{useNewBirthProcess as n}from"./useNewBirthProcess.js";function d(d,v,c,m,h,x){const p=e(),g=a((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),f=a((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),w=a((()=>{var e;return null==(e=g.value)?void 0:e.reduce(((e,a)=>e+=a.width),0)})),b=a((()=>{var e;const{width:a}=v.data;return a-((null==(e=f.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))||15)})),j=a((()=>v.data.grid.mainXCell||20)),y=a((()=>v.data.grid.mainYCell||8)),A=a((()=>(b.value-w.value)/j.value)),M=a((()=>{var e;const{xAxis:a,height:t,other:l}=v.data,i=Object.values(a).reduce(((e,a)=>(a.show&&e++,e)),0),r=(null!=(e=null==l?void 0:l.alertLineList.length)?e:0)>0;return(t-V.value)/(y.value+i+(r?1:0))})),C=a((()=>{var e;const{xAxis:a,other:t}=v.data,l=Object.values(a).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0),i=(null!=(e=null==t?void 0:t.alertLineList.length)?e:0)>0;return M.value*(l||i?1:0)})),S=a((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-M.value*t-V.value})),V=a((()=>{const e=g.value.concat(f.value);return(null==e?void 0:e.length)>0?20:0})),X=a((()=>u(v.data.xAxis.time.startTime))),H=a((()=>{const{spaceValue:e,spaceGridNumber:a}=v.data.xAxis.time||{};return 60*e*60*1e3/(A.value*a)})),L=a((()=>{var e,a,t;const l=null==(t=null==(a=null==(e=g.value.concat(f.value))?void 0:e[0])?void 0:a.data)?void 0:t.map((e=>u(e.time))),i=Math.min(...l);let n=Math.min(Math.max(...l));const d=H.value*A.value,v=s(1,j.value+1).reduce(((e,a,t)=>e.concat(X.value+a*d)),[X.value]);n=Math.min(n,o(v));const c=v.findIndex((e=>Math.abs(e-i)<d)),m=v.findIndex((e=>Math.abs(e-n)<d))+1;return v.filter(((e,a)=>a>=c&&a<=m)).map((e=>r(new Date(e),"yyyy-MM-dd HH:mm:ss")))})),Y=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return M.value/((null==a?void 0:a.spaceValue)||1)})),N=a((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),I=t({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...i,...v.data.borderStyle||{}},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:w.value,endX:b.value,originY:C.value,endY:S.value,xCellWidth:A.value,yCellHeight:M.value,gridXNumber:j.value,gridYNumber:y.value,xAxis:v.data.xAxis,leftScales:g.value,rightScales:f.value,startTime:X.value,timeXCell:H.value,cervixYCell:Y.value,scaleValues:v.data.scaleValues,timeXAxisHeight:V.value,extraTimeXAxisList:L.value,event:N.value});return l((()=>d.value),(e=>{e&&function(){const{redrawPoints:e}=n(d,I,c,h);p.value=e}()}),{immediate:!0}),{propItems:I,redrawPoints:p}}export{d as useNewBirthProcessChart};
@@ -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 a}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getPointRange as s,getIndex as u,isEffectiveNode as c,getTime as f}from"../../utils/index.js";import{cloneDeep as d,last as p,omit as m,flatten as g}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function y(y,h,k,x,w,L){const{computedX:P,computedY:b,getXValue:C,getYValue:A}=l(h),{xCellWidth:I,pointSelectionStyle:K,originX:j,endX:E,originY:T,endY:X,event:M,scaleValues:V,xAxis:Y,startTime:S,timeXCell:D,itemList:F,dialog:O,topGridOriginY:$,topGridEndY:_}=h,B=new Map,z=new Set,G=d(V);let N=[],J=null;const q=new Set;o(y,h);const{getEqualXTypes:R,handleAddPrevent:W,setPrevAndNextPoint:H,getPointEventProps:Q}=r(y,k,h),{pause:U,resume:Z}=v((()=>{!function(){if(!q.size)return;for(const e of q)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function ee(){G.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:a={}}=e.diffValue||{};function r({show:e=!1,value:i,name:o,lineStyle:l}){if(!e||!i)return;const a=b(t.type,t.range,i),r=n([j,a,E,a],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});M.hovered&&o&&(r.on("mousemove",(({pointer:e})=>{x.point={...e||{x:r.left,y:r.top}},x.list=[`${o} ${i}${t.unit||""}`],x.show=!0})),r.on("mouseout",(()=>{x.show=!1}))),y.value.add(r)}r(i),r(o),r(l),r(a)}(t,e),oe(t,i,e))}))}))}function te(e=[]){if(!(null==J?void 0:J.areaPos))return[];const{startPos:t,endPos:n}=J.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,a]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:pe()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=a))}function ne(e){var t,n,i;O.warning({maskClosable:!1,closeOnEsc:!1,title:(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.228"))||"警告",content:"确认删除当前选中的节点?",positiveText:(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.27"))||"确定",negativeText:(null==(i=window.getLanguageByCode)?void 0:i.call(window,"10010.1.28"))||"取消",onPositiveClick:()=>{e(),ie()},onNegativeClick:()=>ie(),onClose:()=>ie()})}function ie(){J&&y.value.remove(J),J=null}function oe(e,t,o){var l;const{type:a,unit:r,dataList:s=[]}=o,u=[];B.set(e.key,[]),function(e,t){q.size&&[...q].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&q.delete(n)}))}(a,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,f){var d;let g,v,h=f;l.key&&(h=s.find((e=>e.key===l.key)));const{pointAttr:w={},lineAttr:L={},title:P="",key:b,type:K="circle"}=h,j=de(f.list[c+1],o);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(v=n([...e,...j],L));const E=u[c-1],T={origin:{data:l,title:P,key:f.key,selfKey:b,unit:r,type:a,dataIndex:t,index:c,lineAttr:L},__type:"main",leftLine:E,rightLine:v,...w,...Q()};e&&(E||(T.leftLine=null),g=i(K,{left:e[0],top:e[1],...T}));u.push(v),g&&(g.originLeft=g.left,g.originTop=g.top,function(e){M.hovered&&(e.on("mouseover",(()=>{ce(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{fe(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&&ce(e),function(e){var t,n,i,o;const{originLeft:l,originTop:a,left:r,top:s,origin:u}=e,c=~~((r-l)/I);if(r>l+I){if(0===N.length){ae(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,a],l,a]),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 f=l+I*c;if(N.every((e=>e.left!==f))){const t=C(f),n=A(u.type,s);N.push({data:{time:t,value:n,...u.selfKey!==u.key?{key:u.selfKey}:{}},left:f,top:s}),ae(e,[...e.prevPointer,f,s])}if(N.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+I*l,a=N.some((e=>Math.abs(e.left-t)<=1));if(!a){let l=0;const a=N.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(a){const r=JSON.parse(JSON.stringify(a)),s=N[l-1]||{left:n,top:i},u=~~((a.left-(t-I))/I),c=(a.top-s.top)/u;r.top=s.top+c,r.left=t,r.data={time:C(t),value:A(o.type,r.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},N.splice(l,0,r),ae(e,[s.left,s.top,r.left,r.top])}}l++}}(e,c),e.nextPoint){const t=B.get(u.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=I/2,a=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));a>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[a]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||u.index===e.origin.index||(e.left<r?le(e,"#999"):le(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(N.length>0&&i<N[N.length-1].left){for(const e of z)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(N=N.filter((e=>e.left<=i)),0===N.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of z)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(N.length>0){const t=p(N);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:C(e.left),value:A(t,e.top)}};if(y.value.discardActiveObject(),N.length>0){const l=G.find((e=>e.type===t));let a=-1;const r=N.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;a=t.index;const o=r.findIndex((e=>e.time===n.time));o>-1?r[o].value=n.value:r.push({...p(r),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:r}),re({...o,data:r,coincideIndex:a})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),re(o,"change")}}))}(g),null==(d=B.get(f.key))||d.push(g))}(de(l,o),l,c,e)})),Promise.all(B.get(e.key)).then((t=>{const n=u.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 a({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||q.add(e)}))}a(n,"max"),a(i,"min"),a(o,"max"),a(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 ae(e,t){const[,,i,o]=t;e.clone((l=>{l.set({left:i,top:o,scaleX:1,scaleY:1}),e.prevPointer=[i,o];const a=n(t,e.origin.lineAttr);l.leftLine=a,z.add(l),y.value.add(a,l)}))}function re(e,t="add",n=1){const{data:i,index:o,key:l,type:a,coincideIndex:r}=e;let{dataIndex:s}=e;const c=G.find((e=>e.type===a)),f=c.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":f.list.splice(o,n),f.list[o-1]&&(f.list[o-1].breakpoint=!0);break;case"change":f.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=u(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,r>-1?r-t+1:0,...n);break}}se({dataIndex:s,scaleValue:c})}function se(e){var t,n,i;if(z.size&&(null==(t=y.value)||t.remove(...ue([...z]))),z.clear(),N=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...ue(B.get(o.key))),B.delete(o.key),oe(o,t,i)}else B.size&&(null==(i=y.value)||i.remove(...ue(pe()))),B.clear(),ee()}function ue(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 ce(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:a}=e.origin;x.point={x:e.left,y:e.top};const r=C(e.left),s=`${"hover"===t?o.value:A(i,e.top)}`;x.list=[`${n} ${s}${l||""}`,`时间 ${r.slice(-5)}`],x.sourceData=[{type:i,title:n,unit:l,key:a,time:r,value:s}],x.isTarget=!0,x.show=!0}function fe(e){e.setCoords();const t=6e4/D,n=e.prevPoint?e.prevPoint.left+t:j,i=E;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 de(e,t){if(c(e)&&function(e){const t=Date.parse(p(Y.list)),n=f(e);return n>=S&&n<=t}(e.time)){const n=P(e.time),i=b(t.type,t.range,e.value);return[n,i<T?T:i>X?X:i]}}function pe(){return g(Array.from(B.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){var t,n;x.show=!1;const{x:i=0,y:o=0}=e.pointer||{};if(i>=j&&i<=E&&o>=T&&o<=X)if(e.target){if("main"!==e.target.__type)return;l(e.pointer,e.target,[(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.220"))||"删除节点"]);const{minLeft:t,maxLeft:i,minTop:o,maxTop:a}=s(e.target);pe().forEach((n=>{"main"===n.__type&&n.left>t&&n.left<i&&n.top>o&&n.top<a&&w.list.push({renderItem:()=>n.origin.title,origin:{...n.origin},mode:"remove",pointer:e.pointer})})),1===w.list.length&&(w.show=!1,console.log("当前时间段内无可删除节点"))}else l(e.pointer,null,[(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.219"))||"新增节点"]),F.forEach((t=>{R(pe(),i,"key",2*I).includes(t.linkKey||t.key)||w.list.push({renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,type:t.bigType,dataIndex:t.dataIndex,key:t.key,linkKey:t.linkKey},pointer:e.pointer})})),1===w.list.length&&(w.show=!1,W("repeat"),console.log("当前时间段内无可新增节点"));function l(e,t,n){Object.assign(w,{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 re(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);k("remove",t)})):a.emit(J)}})),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(!L||w.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;x.movable=!1,(i<j||i>E)&&(x.show=!1);if(!t&&i>=j&&i<=E){const e=o>=T&&o<=X,l=o>=$&&o<=_;if(e||l){const l=C(i);x.sourceData=e?G.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:A(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:a}=i,{x:r,y:s}=o.pointer;J&&y.value.remove(J),J=new e.Rect({...t,fill:"#CAF982",opacity:.4,...K,left:l>r?r:l,top:a>s?s:a,width:Math.abs(r-l),height:Math.abs(s-a),objectCaching:!0}),J.areaPos={startPos:i,endPos:o.pointer},y.value.add(J)}))}(),{redrawPoints:se,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),re(n,"remove")):(Object.assign(n,{data:{time:C(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),re({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:fe,setPopup:ce,updateData:re,getGridPoints:pe,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 a}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getPointRange as s,getIndex as u,isEffectiveNode as c,getTime as f}from"../../utils/index.js";import{cloneDeep as d,last as p,omit as m,flatten as g}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../../../../../shared/utils/index.js";import{useIntervalFn as v}from"@vueuse/core";function y(y,h,k,x,w,L){const{computedX:P,computedY:b,getXValue:C,getYValue:A}=l(h),{xCellWidth:I,pointSelectionStyle:j,originX:K,endX:E,originY:T,endY:X,event:M,scaleValues:V,xAxis:Y,startTime:S,timeXCell:D,itemList:F,dialog:O,topGridOriginY:$,topGridEndY:B}=h,_=new Map,z=new Set,G=d(V);let N=[],J=null;const q=new Set;o(y,h);const{getEqualXTypes:R,handleAddPrevent:W,setPrevAndNextPoint:H,getPointEventProps:Q}=r(y,k,h),{pause:U,resume:Z}=v((()=>{!function(){if(!q.size)return;for(const e of q)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function ee(){G.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:a={}}=e.diffValue||{};function r({show:e=!1,value:i,name:o,lineStyle:l}){if(!e||!i)return;const a=b(t.type,t.range,i),r=n([K,a,E,a],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});M.hovered&&o&&(r.on("mousemove",(({pointer:e})=>{x.point={...e||{x:r.left,y:r.top}},x.list=[`${o} ${i}${t.unit||""}`],x.show=!0})),r.on("mouseout",(()=>{x.show=!1}))),y.value.add(r)}r(i),r(o),r(l),r(a)}(t,e),oe(t,i,e))}))}))}function te(e=[]){if(!(null==J?void 0:J.areaPos))return[];const{startPos:t,endPos:n}=J.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,a]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:pe()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=a))}function ne(e){var t,n,i,o;O.warning({maskClosable:!1,closeOnEsc:!1,title:(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.228"))||"警告",content:(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.229"))||"确认删除当前选中的节点?",positiveText:(null==(i=window.getLanguageByCode)?void 0:i.call(window,"10010.1.33"))||"确定",negativeText:(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.32"))||"取消",onPositiveClick:()=>{e(),ie()},onNegativeClick:()=>ie(),onClose:()=>ie()})}function ie(){J&&y.value.remove(J),J=null}function oe(e,t,o){var l;const{type:a,unit:r,dataList:s=[]}=o,u=[];_.set(e.key,[]),function(e,t){q.size&&[...q].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&q.delete(n)}))}(a,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,f){var d;let g,v,h=f;l.key&&(h=s.find((e=>e.key===l.key)));const{pointAttr:w={},lineAttr:L={},title:P="",key:b,type:j="circle"}=h,K=de(f.list[c+1],o);e&&K&&!l.breakpoint&&e[0]!==K[0]&&(v=n([...e,...K],L));const E=u[c-1],T={origin:{data:l,title:P,key:f.key,selfKey:b,unit:r,type:a,dataIndex:t,index:c,lineAttr:L},__type:"main",leftLine:E,rightLine:v,...w,...Q()};e&&(E||(T.leftLine=null),g=i(j,{left:e[0],top:e[1],...T}));u.push(v),g&&(g.originLeft=g.left,g.originTop=g.top,function(e){M.hovered&&(e.on("mouseover",(()=>{ce(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{fe(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&&ce(e),function(e){var t,n,i,o;const{originLeft:l,originTop:a,left:r,top:s,origin:u}=e,c=~~((r-l)/I);if(r>l+I){if(0===N.length){ae(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,a],l,a]),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 f=l+I*c;if(N.every((e=>e.left!==f))){const t=C(f),n=A(u.type,s);N.push({data:{time:t,value:n,...u.selfKey!==u.key?{key:u.selfKey}:{}},left:f,top:s}),ae(e,[...e.prevPointer,f,s])}if(N.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+I*l,a=N.some((e=>Math.abs(e.left-t)<=1));if(!a){let l=0;const a=N.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(a){const r=JSON.parse(JSON.stringify(a)),s=N[l-1]||{left:n,top:i},u=~~((a.left-(t-I))/I),c=(a.top-s.top)/u;r.top=s.top+c,r.left=t,r.data={time:C(t),value:A(o.type,r.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},N.splice(l,0,r),ae(e,[s.left,s.top,r.left,r.top])}}l++}}(e,c),e.nextPoint){const t=_.get(u.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=I/2,a=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));a>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[a]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||u.index===e.origin.index||(e.left<r?le(e,"#999"):le(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(N.length>0&&i<N[N.length-1].left){for(const e of z)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(N=N.filter((e=>e.left<=i)),0===N.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of z)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(N.length>0){const t=p(N);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:C(e.left),value:A(t,e.top)}};if(y.value.discardActiveObject(),N.length>0){const l=G.find((e=>e.type===t));let a=-1;const r=N.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;a=t.index;const o=r.findIndex((e=>e.time===n.time));o>-1?r[o].value=n.value:r.push({...p(r),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:r}),re({...o,data:r,coincideIndex:a})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),re(o,"change")}}))}(g),null==(d=_.get(f.key))||d.push(g))}(de(l,o),l,c,e)})),Promise.all(_.get(e.key)).then((t=>{const n=u.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 a({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||q.add(e)}))}a(n,"max"),a(i,"min"),a(o,"max"),a(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 ae(e,t){const[,,i,o]=t;e.clone((l=>{l.set({left:i,top:o,scaleX:1,scaleY:1}),e.prevPointer=[i,o];const a=n(t,e.origin.lineAttr);l.leftLine=a,z.add(l),y.value.add(a,l)}))}function re(e,t="add",n=1){const{data:i,index:o,key:l,type:a,coincideIndex:r}=e;let{dataIndex:s}=e;const c=G.find((e=>e.type===a)),f=c.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":f.list.splice(o,n),f.list[o-1]&&(f.list[o-1].breakpoint=!0);break;case"change":f.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=u(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,r>-1?r-t+1:0,...n);break}}se({dataIndex:s,scaleValue:c})}function se(e){var t,n,i;if(z.size&&(null==(t=y.value)||t.remove(...ue([...z]))),z.clear(),N=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...ue(_.get(o.key))),_.delete(o.key),oe(o,t,i)}else _.size&&(null==(i=y.value)||i.remove(...ue(pe()))),_.clear(),ee()}function ue(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 ce(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:a}=e.origin;x.point={x:e.left,y:e.top};const r=C(e.left),s=`${"hover"===t?o.value:A(i,e.top)}`;x.list=[`${n} ${s}${l||""}`,`时间 ${r.slice(-5)}`],x.sourceData=[{type:i,title:n,unit:l,key:a,time:r,value:s}],x.isTarget=!0,x.show=!0}function fe(e){e.setCoords();const t=6e4/D,n=e.prevPoint?e.prevPoint.left+t:K,i=E;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 de(e,t){if(c(e)&&function(e){const t=Date.parse(p(Y.list)),n=f(e);return n>=S&&n<=t}(e.time)){const n=P(e.time),i=b(t.type,t.range,e.value);return[n,i<T?T:i>X?X:i]}}function pe(){return g(Array.from(_.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){var t,n;x.show=!1;const{x:i=0,y:o=0}=e.pointer||{};if(i>=K&&i<=E&&o>=T&&o<=X)if(e.target){if("main"!==e.target.__type)return;l(e.pointer,e.target,[(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.220"))||"删除节点"]);const{minLeft:t,maxLeft:i,minTop:o,maxTop:a}=s(e.target);pe().forEach((n=>{"main"===n.__type&&n.left>t&&n.left<i&&n.top>o&&n.top<a&&w.list.push({renderItem:()=>n.origin.title,origin:{...n.origin},mode:"remove",pointer:e.pointer})})),1===w.list.length&&(w.show=!1,console.log("当前时间段内无可删除节点"))}else l(e.pointer,null,[(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.219"))||"新增节点"]),F.forEach((t=>{R(pe(),i,"key",2*I).includes(t.linkKey||t.key)||w.list.push({renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,type:t.bigType,dataIndex:t.dataIndex,key:t.key,linkKey:t.linkKey},pointer:e.pointer})})),1===w.list.length&&(w.show=!1,W("repeat"),console.log("当前时间段内无可新增节点"));function l(e,t,n){Object.assign(w,{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 re(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);k("remove",t)})):a.emit(J)}})),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(!L||w.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;x.movable=!1,(i<K||i>E)&&(x.show=!1);if(!t&&i>=K&&i<=E){const e=o>=T&&o<=X,l=o>=$&&o<=B;if(e||l){const l=C(i);x.sourceData=e?G.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:A(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:a}=i,{x:r,y:s}=o.pointer;J&&y.value.remove(J),J=new e.Rect({...t,fill:"#CAF982",opacity:.4,...j,left:l>r?r:l,top:a>s?s:a,width:Math.abs(r-l),height:Math.abs(s-a),objectCaching:!0}),J.areaPos={startPos:i,endPos:o.pointer},y.value.add(J)}))}(),{redrawPoints:se,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),re(n,"remove")):(Object.assign(n,{data:{time:C(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),re({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:fe,setPopup:ce,updateData:re,getGridPoints:pe,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{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as r,defaultStyle as l}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c,last as p}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function m(m,f,h,g,v,y,j,k){const{getYValue:w,getXValue:x}=s(f),{getEqualXTypes:b,handleAddPrevent:X,isGridLimit:W}=u(m,h,f),{originY:C,endY:E,borderStyle:S,left:Y,itemList:K,scaleValues:L,originX:M,endX:N,yCellHeight:V,markHeight:G,canvasWidth:H,canvasHeight:T,xCellWidth:A}=f;!function(){if(!Y)return;const{title:t,titleWidth:i,titleStyle:o}=Y,n=e({width:i,height:E-C+G,...S},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);m.value.add(n)}(),L.forEach(((e,i)=>{var o,s;const{range:u,spaceValue:c,title:f,unit:h,titleStyle:g,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:j,titleMargin:k=[5,30],margin:w=5}=e,x="left"===e.layout?M-w:N+w,b=[],X=d(u,c),W=X.length;X.forEach(((t,i)=>{const o=0===i?E-5:E-i*V*v;!y||(0===i||i===W-1)&&!j||b.push(a(String(t),{...e,position:e.layout},x,o))}));const C="left"===e.layout?"right":"left",S=(f||h)&&n(["left"===e.layout?M-k[0]:N+k[0],(null!=(s=null==(o=p(b))?void 0:o.top)?s:330)-V-k[1]],{value:`${f}${h?"\n"+h:""}`,...r,...g,textAlign:C,originX:C,originY:"bottom"}),Y=new t.Group([...b,...S?[S]:[]],{objectCaching:!1,...l});m.value.add(Y),Y.sendToBack()})),function(){const e=new t.Rect({width:M-Y.titleWidth,height:E-C+G,left:Y.titleWidth,top:C,...i,originX:"left",originY:"top",...S});m.value.add(e);const n=c(K),r=c(Y.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:s=20}=Y;let a=E+G-l[0];const u=s+l[1];r.concat(n.reverse()).forEach((t=>{a-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:u,top:a},icon:{leftX:u,topY:a,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var r;a-=i.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),W(r)?(v(r),y(r)):g.show=!1})),r.on("mouseup:before",(t=>{if(g.show=!1,0===t.e.button&&W(r)){const t=r.origin.linkKey||r.origin.key;if(b(k(),r.left,"key",2*A).includes(t))X("repeat");else{const e={data:{time:x(r.left),value:w(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin};h("add",e),j({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),m.value.add(i,n)}))}(),m.value.add(new t.Rect({left:0,top:0,width:H-S.strokeWidth,height:T-S.strokeWidth,fill:"transparent",...S}))}export{m as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as r,defaultStyle as l}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c,last as p}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";function m(m,h,f,g,v,y,j,k){const{getYValue:w,getXValue:x}=s(h),{getEqualXTypes:b,handleAddPrevent:X,isGridLimit:W}=u(m,f,h),{originY:C,endY:E,borderStyle:S,left:Y,itemList:K,scaleValues:L,originX:M,endX:N,yCellHeight:V,markHeight:G,canvasWidth:H,canvasHeight:T,xCellWidth:A}=h;!function(){if(!Y)return;const{title:t,titleWidth:i,titleStyle:o}=Y,n=e({width:i,height:E-C+G,...S},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);m.value.add(n)}(),L.forEach(((e,i)=>{var o,s;const{range:u,spaceValue:c,title:h,unit:f,titleStyle:g,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:j,titleMargin:k=[5,30],margin:w=5}=e,x="left"===e.layout?M-w:N+w,b=[],X=d(u,c),W=X.length;X.forEach(((t,i)=>{const o=0===i?E-5:E-i*V*v;!y||(0===i||i===W-1)&&!j||b.push(a(String(t),{...e,position:e.layout},x,o))}));const C="left"===e.layout?"right":"left",S=(h||f)&&n(["left"===e.layout?M-k[0]:N+k[0],(null!=(s=null==(o=p(b))?void 0:o.top)?s:330)-V-k[1]],{value:`${h}${f?"\n"+f:""}`,...r,...g,textAlign:C,originX:C,originY:"bottom"}),Y=new t.Group([...b,...S?[S]:[]],{objectCaching:!1,...l});m.value.add(Y),Y.sendToBack()})),function(){const e=new t.Rect({width:M-Y.titleWidth,height:E-C+G,left:Y.titleWidth,top:C,...i,originX:"left",originY:"top",...S});m.value.add(e);const n=c(K),r=c(Y.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:s=20}=Y;let a=E+G-l[0];const u=s+l[1];r.concat(n.reverse()).forEach((t=>{a-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:u,top:a},icon:{leftX:u,topY:a,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var r;a-=i.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),W(r)?(v(r),y(r)):g.show=!1})),r.on("mouseup:before",(t=>{if(g.show=!1,0===t.e.button&&W(r)){const t=r.origin.linkKey||r.origin.key;if(b(k(),r.left,"key",2*A).includes(t))X("repeat");else{const e={data:{time:x(r.left),value:w(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin};f("add",e),j({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),m.value.add(i,n)}))}(),m.value.add(new t.Rect({left:0,top:0,width:H-S.strokeWidth,height:T-S.strokeWidth,fill:"transparent",...S}))}export{m as useLeft};
@@ -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:y,getXValue:k}=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=y(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"}),k=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(k,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-k.width}}),f&&(k.limitX.x1=f.left,f.limitX.x2=k.left,k.prevPoint=f,f.nextPoint=k),f=k,q(k),H.get(n).push(k)})),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=y(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=y(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=k(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,_type:"other"}))))}))}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=k(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:k(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";import"../../../../../shared/utils/index.js";function c(c,u,f,h,m,g,p,v,x){const{computedX:y,getXValue:k}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(c,f,u),{other:j,yCellHeight:E,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:T,topGridYCellHeight:I}=u,H=new Map,Y=l(j);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+E/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=y(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"}),k=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(k,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-k.width}}),f&&(k.limitX.x1=f.left,f.limitX.x2=k.left,k.prevPoint=f,f.nextPoint=k),f=k,q(k),H.get(n).push(k)})),a+=E})),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=y(s);if(!n||!$(d))return;const{lineHeight:c=E}=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==j?void 0:j.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=j.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=y(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=k(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,_type:"other"}))))}))}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=k(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+E/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:k(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+=E}))}(),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{reactive as e,ref as t,computed as a,unref as r,onMounted as i,nextTick as n,onBeforeUnmount as o,watch as l,toRefs as u}from"vue";import{useDialog as s}from"naive-ui";import{defaultBorderStyle as d}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as c}from"date-fns";import{getChildrenSize as m}from"../../utils/index.js";import{cloneDeep as p,range as v,flatten as h}from"lodash-es";import"../useEvent.js";import"../useCommon.js";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"@vueuse/core";import{useTop as f}from"./useTop.js";import{useLeft as g}from"./useLeft.js";import{useCenter as w}from"./useCenter.js";import{useOther as b}from"./useOther.js";function x(x,y,C,j,Y,M,k){var H;const P=s(),S=e({redrawPoints:null,clickMenu:null,redrawLinePoints:null}),T=t();let D=null;const A=m((null==(H=y.data.top)?void 0:H.treeData)||[]),L=a((()=>y.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),X=a((()=>{var e;return null!=(e=y.data.left.width)?e:0})),G=a((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell})),N=a((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell})),V=a((()=>{const{show:e=!0,tree:t={}}=y.data.top;if(!e)return 0;const{rowNumber:a=A}=t;return A<a?a:A})),O=a((()=>y.data.top.tree.cellHeight)),E=a((()=>O.value*V.value)),W=a((()=>oe(ie("drug")||"top"))),I=a((()=>W.value+E.value)),F=a((()=>{var e;return Date.parse((null==(e=y.data.xAxis)?void 0:e.startTime)||c(new Date,"yyyy-MM-dd HH:mm:ss"))})),_=a((()=>{const e=p(y.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=v(G.value/t+1).map((r=>0===r?e.startTime:c(new Date(F.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:X.value}})),q=function(){const{show:e=!0,tree:t={}}=y.data.top;if(!e)return[];const a=p(y.data.top.treeData);let r=0;const{cellWidth:i,cellHeight:n}=y.data.top.tree,{rowNumber:o=A}=t;A<o&&a.push(...v(o-A).map((()=>({}))));return function e(t,a=0){t.forEach((t=>{var o;const l={top:r*n+W.value,left:a*i,width:i,height:n};if(r++,null==(o=t.children)?void 0:o.length){r--;const i=m(t.children);l.height=i*n,e(t.children,a+1)}else l.width=X.value-l.left;Object.assign(t,l)}))}(a),a}(),z=a((()=>oe(ie("xAxis")||"center"))),B=a((()=>{var e;const{width:t,right:a}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),J=a((()=>oe(ie("intraoperatively")||"bottom"))),K=a((()=>{var e;const{show:t,height:a}=(null==(e=y.data.other)?void 0:e.mark)||{};return t&&a?a:0})),Q=a((()=>J.value+(y.data.height-E.value-_.value.height-K.value))),R=a((()=>(B.value-X.value)/G.value)),U=a((()=>(Q.value-J.value)/N.value)),Z=a((()=>_.value.spaceTimeStamp/R.value)),$=a((()=>{const{scaleValues:e}=y.data;return h(e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))))})),ee=a((()=>le("pulse"))),te=a((()=>le("temperature"))),ae=a((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),re=e({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...d,...y.data.borderStyle},pointSelectionStyle:y.data.pointSelectionStyle||{},grid:y.data.grid,top:y.data.top,left:y.data.left,other:y.data.other,topGridYNumber:r(V),topGridYCellHeight:r(O),topGridOriginY:r(W),topGridEndY:r(I),treeData:q,xAxis:r(_),originYXAxis:r(z),startTime:r(F),timeXCell:r(Z),gridXNumber:r(G),gridYNumber:r(N),xCellWidth:r(R),yCellHeight:r(U),originX:r(X),endX:r(B),originY:r(J),endY:r(Q),markHeight:r(K),itemList:r($),scaleValues:y.data.scaleValues,pulseYCell:r(ee),temperatureYCell:r(te),event:r(ae),dialog:P,extraMenuConfig:y.data.extraMenuConfig||{}});function ie(e){let t="";return Object.entries(L.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function ne(e){const t=L.value[e],a=_.value.height;switch(t){case"drug":return E.value;case"xAxis":return a;default:return y.data.height-E.value-a}}function oe(e){switch(e){case"top":return 0;case"center":return ne("top");default:return ne("top")+ne("center")}}function le(e){const{scaleValues:t}=y.data,a=t.find((t=>t.type===e));return U.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await n();const{redrawLinePoints:e,clickMenu:t}=f(x,re,C,Y,M),{redrawPoints:a,clickMenu:r,moveLimit:i,setPopup:o,updateData:l,getGridPoints:u,getContainPoints:s,showDialog:d,removeCurrentSelection:c,pauseFlickerPoint:m}=w(x,re,C,Y,M,k);T.value=m,g(x,re,C,Y,i,o,l,u);const{clickMenu:p}=b(x,re,C,Y,M,i,s,d,c);S.redrawPoints=a,S.redrawLinePoints=e,S.clickMenu=e=>{const{item:a}=e;switch(a._type){case"tree":t(e);break;case"other":p(e);break;default:r(e)}}})),o((()=>{T.value()})),k&&l((()=>null==Y?void 0:Y.point),(()=>{Y.movable?(Y.show=!0,D&&clearTimeout(D),D=setTimeout((()=>{Y.show=!1,Y.movable=!1}),3e3)):D&&clearTimeout(D)}),{deep:!0}),{propItems:re,...u(S)}}export{x as useSurgicalAnesthesiaChart};
1
+ import{reactive as e,ref as t,computed as a,unref as r,onMounted as i,nextTick as o,onBeforeUnmount as n,watch as l,toRefs as u}from"vue";import{useDialog as s}from"naive-ui";import{defaultBorderStyle as d}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as c}from"date-fns";import{getChildrenSize as m}from"../../utils/index.js";import{cloneDeep as p,range as h,flatten as v}from"lodash-es";import"../useEvent.js";import"../useCommon.js";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"@vueuse/core";import{useTop as f}from"./useTop.js";import{useLeft as g}from"./useLeft.js";import{useCenter as w}from"./useCenter.js";import{useOther as x}from"./useOther.js";import{uuidGenerator as b}from"../../../../../shared/utils/index.js";function y(y,C,j,Y,M,T,k){var D;const H=s(),P=e({redrawPoints:null,clickMenu:null,redrawLinePoints:null}),S=t();let A=null;const L=m((null==(D=C.data.top)?void 0:D.treeData)||[]),X=a((()=>C.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),G=a((()=>{var e;return null!=(e=C.data.left.width)?e:0})),N=a((()=>{const{grid:e}=C.data;return e.mainXCell*e.subXCell})),V=a((()=>{const{grid:e}=C.data;return e.mainYCell*e.subYCell})),O=a((()=>{const{show:e=!0,tree:t={}}=C.data.top;if(!e)return 0;const{rowNumber:a=L}=t;return L<a?a:L})),E=a((()=>C.data.top.tree.cellHeight)),W=a((()=>E.value*O.value)),I=a((()=>le(oe("drug")||"top"))),F=a((()=>I.value+W.value)),_=a((()=>{var e;return Date.parse((null==(e=C.data.xAxis)?void 0:e.startTime)||c(new Date,"yyyy-MM-dd HH:mm:ss"))})),q=a((()=>{const e=p(C.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=h(N.value/t+1).map((r=>0===r?e.startTime:c(new Date(_.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:G.value}})),z=ue(),B=a((()=>le(oe("xAxis")||"center"))),J=a((()=>{var e;const{width:t,right:a}=C.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),K=a((()=>le(oe("intraoperatively")||"bottom"))),Q=a((()=>{var e;const{show:t,height:a}=(null==(e=C.data.other)?void 0:e.mark)||{};return t&&a?a:0})),R=a((()=>K.value+(C.data.height-W.value-q.value.height-Q.value))),U=a((()=>(J.value-G.value)/N.value)),Z=a((()=>(R.value-K.value)/V.value)),$=a((()=>q.value.spaceTimeStamp/U.value)),ee=a((()=>{const{scaleValues:e}=C.data;return v(e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))))})),te=a((()=>se("pulse"))),ae=a((()=>se("temperature"))),re=a((()=>{var e;return(null==(e=C.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),ie=e({canvasWidth:C.data.width,canvasHeight:C.data.height,borderStyle:{...d,...C.data.borderStyle},pointSelectionStyle:C.data.pointSelectionStyle||{},grid:C.data.grid,top:C.data.top,left:C.data.left,other:C.data.other,topGridYNumber:r(O),topGridYCellHeight:r(E),topGridOriginY:r(I),topGridEndY:r(F),treeData:z,getTreeData:ue,xAxis:r(q),originYXAxis:r(B),startTime:r(_),timeXCell:r($),gridXNumber:r(N),gridYNumber:r(V),xCellWidth:r(U),yCellHeight:r(Z),originX:r(G),endX:r(J),originY:r(K),endY:r(R),markHeight:r(Q),itemList:r(ee),scaleValues:C.data.scaleValues,pulseYCell:r(te),temperatureYCell:r(ae),event:r(re),dialog:H,extraMenuConfig:C.data.extraMenuConfig||{}});function oe(e){let t="";return Object.entries(X.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function ne(e){const t=X.value[e],a=q.value.height;switch(t){case"drug":return W.value;case"xAxis":return a;default:return C.data.height-W.value-a}}function le(e){switch(e){case"top":return 0;case"center":return ne("top");default:return ne("top")+ne("center")}}function ue(){const{show:e=!0,tree:t={}}=C.data.top;if(!e)return[];const a=p(C.data.top.treeData);let r=0;const{cellWidth:i,cellHeight:o}=C.data.top.tree,{rowNumber:n=L}=t;return L<n&&a.push(...h(n-L).map((()=>({})))),function e(t,a=0){t.forEach((t=>{var n;const l={top:r*o+I.value,left:a*i,width:i,height:o,uuid:b()};if(r++,null==(n=t.children)?void 0:n.length){r--;const i=m(t.children);l.height=i*o,e(t.children,a+1)}else l.width=G.value-l.left;Object.assign(t,l)}))}(a),a}function se(e){const{scaleValues:t}=C.data,a=t.find((t=>t.type===e));return Z.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await o();const{redrawLinePoints:e,clickMenu:t}=f(y,ie,j,M,T),{redrawPoints:a,clickMenu:r,moveLimit:i,setPopup:n,updateData:l,getGridPoints:u,getContainPoints:s,showDialog:d,removeCurrentSelection:c,pauseFlickerPoint:m}=w(y,ie,j,M,T,k);S.value=m,g(y,ie,j,M,i,n,l,u);const{clickMenu:p}=x(y,ie,j,M,T,i,s,d,c);P.redrawPoints=a,P.redrawLinePoints=e,P.clickMenu=e=>{const{item:a}=e;switch(a._type){case"tree":t(e);break;case"other":p(e);break;default:r(e)}}})),n((()=>{S.value()})),k&&l((()=>null==M?void 0:M.point),(()=>{M.movable?(M.show=!0,A&&clearTimeout(A),A=setTimeout((()=>{M.show=!1,M.movable=!1}),3e3)):A&&clearTimeout(A)}),{deep:!0}),{propItems:ie,...u(P)}}export{y as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e,drawText as n,defaultRectStyle as i,drawTextGroup as o,drawLine as r,drawPoint as l}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as f}from"../../utils/index.js";import{isArray as d,omit as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as p}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function h(h,g,v,x,L){const{computedX:y,getXValue:X}=c(g),{originX:w,endX:C,xCellWidth:Y,originYXAxis:S,top:b,canvasWidth:j,borderStyle:k,treeData:M,xAxis:G,topGridYNumber:E,topGridOriginY:I,topGridYCellHeight:R,topGridEndY:z,event:A,extraMenuConfig:$}=g,{getPointEventProps:P}=u(h,v,g),T=new Set;function V(n=!1){var i;const l=(null==(i=null==b?void 0:b.tree)?void 0:i.textStyle)||{},s=[];!function t(e){e.forEach((e=>{var i;const{width:c,height:a,left:u,top:f,title:d=""}=e,p={value:d,...l};(null==(i=e.children)?void 0:i.length)?(p.value=d.split("").join("\n"),t(e.children)):(p.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=b.dataStyle||{},n=t.top,i=n+R,o=i-R/2,l={y1:n,y2:i,halfY:o};let s=null;const c=m(t,["data","width","height","left","top"]);t.data.forEach(((t,n,i)=>{const a={...c,data:t,index:n},{time:u,continue:f}=t,[d,m]=u,p=d&&y(d),h=m&&y(m),g=H({...l,x:p},{isCustomIcon:!h&&!f,isContinue:!1,isLeft:!0}),v=H({...l,x:h},{isCustomIcon:!1,isContinue:!!f});let x,L;if((g||p<w)&&(v||h>C)){const t=g?p:w,n=v?h:C;x=r([t,o,n,o],e),L=B({width:n-t-Y,left:t+(n-t)/2,top:o,onlyRect:!0}),L.origin=a,x.centerLineRect=L}const X={startLine:g,centerLine:x,endLine:v};let S,b;!function(t,e,n){const{startLine:i,centerLine:o,endLine:r}=e,{startLine:l,endLine:s}=t||{};if(i){i.origin=n;const t={x1:w,x2:r?r.left:C};s?(t.x1=s.left,s.limitX.x2=i.left,i.prevLine=s,s.nextLine=i):l&&(t.x1=l.left,l.limitX.x2=i.left,i.prevLine=l,l.nextLine=i),i.limitX=t,o&&(i.centerLine=o)}if(r){r.origin=n;const t={x1:i?i.left:w,x2:C};r.limitX=t,o&&(r.centerLine=o)}i&&r&&(i.nearLine=r,r.nearLine=i)}(s,X,a),s&&(S=D(i[n-1],s,o,a)),n===i.length-1&&(b=D(t,X,o,a)),s=X,x&&T.add(x),L&&T.add(L),g&&T.add(g),v&&T.add(v),S&&T.add(S),b&&T.add(b)}))}(e)),n||s.push(o({width:c,height:a,...k},p,{left:u,top:f},!0))}))}(M);const c=s.length>0?new t.Group([...s],{...e,objectCaching:!1}):null;c&&h.value.add(c),T.size&&h.value.add(...T)}function D(t,e,n,i){let o;const{content:r}=t.value||{},{startLine:s,endLine:c,centerLine:a}=e;if(r&&(s||a||c)){const{textStyle:t}=b.dataStyle||{};o=l(r,{fontSize:12,...t,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const a=N(o,e,n);o&&(o.set(a),o.origin=i,W(o),s&&(s.text=o),c&&(c.text=o))}return o}function N(t,e,n){const i=t.width+1,{startLine:o,centerLine:r,endLine:l}=e,s={top:n,originX:"center",originY:"center"};return r&&i<=r.width?s.left=r.x1+r.width/2:l&&i<=l.limitX.x2-l.left?(s.originX="left",s.left=l.left+1):o&&!l&&i<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&i<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):r?(s.originY="top",s.left=r.x1+r.width/2,s.top=n+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=n+1),s}function B(e){const{bindLine:n,width:i,left:o,top:r,props:l,onlyRect:s=!1}=e,c={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",left:o,top:r},a=new t.Rect({width:i,height:R,fill:"transparent",opacity:.5,...c});if(s)return a.set({lockMovementX:!0,lockMovementY:!0}),W(a),a;const u=new t.Group([n,a],{...c,...l,lockMovementY:!0});return W(u),u}function H(t,{isCustomIcon:e,isContinue:n,isLeft:i}){const{x:o,y1:s,y2:c,halfY:a}=t;if(!o||o<w||o>C)return;const{lineStyle:u}=b.dataStyle||{};let f;const d={left:o,top:a};f=e?l("circle",{fill:u.stroke,...d}):n?l(">",{fill:u.stroke,...d,fontSize:18}):r([o,s,o,a],u);const m=B({...d,width:Y,bindLine:f,props:P()});return m.isLeft=i,m.isCustomIcon=e,m}function W(t){A.hovered&&(t.on("mouseover",(()=>{O(t,"hover")})),t.on("mouseout",(()=>{x.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=N(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),A.hovered&&O(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){var e,n,i,o;if(t.isLeft){t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left);const i=t.limitX.x2-t.left;null==(n=null==(e=t.centerLine)?void 0:e.centerLineRect)||n.setCoords().set({width:i-Y,left:t.left+i/2})}else{t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left);const e=t.left-t.limitX.x1;null==(o=null==(i=t.centerLine)?void 0:i.centerLineRect)||o.setCoords().set({width:e-Y,left:t.limitX.x1+e/2})}}(t);const e={type:"tree",...t.origin};v("change",e)}})))}function O(t,e="moving"){var n,i,o;x.isTarget=!0,x.show=!0;const{data:r}=t.origin;x.point={x:t.left,y:t.top},x.marginTop=R/2;let[l="",s=""]=r.time||[];if("moving"===e){const e=X(t.left);t.isLeft?l=e:s=e,r.time=[l,s],t.text&&(t.text.origin.data.time=[l,s])}x.list=[`开始时间 ${l}`,`结束时间 ${s}`,`流速 ${(null==(n=r.value)?void 0:n.currentSpeed)||""}`,`浓度 ${(null==(i=r.value)?void 0:i.consistence)||""}`,`总量 ${(null==(o=r.value)?void 0:o.total)||""}`],x.sourceData=[{type:"tree",startTime:l,endTime:s,value:r.value}]}return s(h,{...g,gridYNumber:E,originY:I,yCellHeight:R,endY:z}),function(){const{height:o,list:r,left:l,spaceValue:s,style:c,marginBottom:a}=G;if(!o)return;const u=[],f=S+(a?o-a:o/2),d=a?"bottom":"center";r.forEach(((t,e)=>{const i=l+e*Y*s;u.push(n([i,f],{value:t.slice(11,16),originY:d,...c}))}));const m=u.length>0?new t.Group([...u],{...e,objectCaching:!1}):null;m&&h.value.add(m);const p=new t.Rect({width:j,height:o,left:0,top:S,...i,originX:"left",originY:"top",...k});h.value.add(p);const{show:g=!0}=b}(),V(),function(){const{show:n=!0,range:i,spaceValue:o=.5,spaceGridNumber:r=1,style:l,margin:s=5}=(null==b?void 0:b.scaleValue)||{};if(!n||!d(i))return;const c=f(i,o),u=[];if(c.forEach(((t,e)=>{if(0===e||e===c.length-1)return;const n=z-e*R*r;Math.abs(n-I)<1||u.push(a(String(t),{style:l,position:"right"},C+s,n))})),!u.length)return;const m=new t.Group(u,{objectCaching:!1,...e});h.value.add(m)}(),A.evented&&h.value.on("mouse:up",(t=>{3===t.button&&function(t){x.show=!1;const{x:e=0,y:n=0}=t.pointer||{};if(e>=w&&e<=C&&n>=I&&n<=z&&t.target){const e=t.target;L.point={x:e.left,y:e.top},L.show=!0,L.target=e;const{treeMenuList:n=[]}=$;L.list=p.concat(n).map((t=>({...t,renderItem:()=>t.label,type:t.key||t.type,_type:"tree"})))}}(t)})),{redrawLinePoints:function(){var t;T.size&&(null==(t=h.value)||t.remove(...T)),T.clear(),V(!0)},clickMenu:function({item:t,target:e}){var n;if(!e)return;const{type:i}=t,o={...e.origin,type:"tree"};p.map((t=>t.type)).includes(i)?v(i,o):null==(n=$.click)||n.call($,i,o)}}}export{h as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e,drawText as n,defaultRectStyle as i,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as u}from"../useScaleColumn.js";import{useCommon as a}from"../useCommon.js";import"vue";import{getScaleNumberList as f}from"../../utils/index.js";import{omit as d,isArray as h}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as m}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";function p(t,e,[n,i]){var o,l;let r=null;for(let s=0;s<t.length;s++){const c=t[s],{left:u,top:a,width:f,height:d}=c;if("tree"===e&&!(null==(o=c.children)?void 0:o.length)&&i>=a&&i<=a+d){r=c;break}if("treeMenu"===e&&n>=u&&n<=u+f&&i>=a&&i<=a+d){r=c;break}if(null==(l=c.children)?void 0:l.length){const t=p(c.children,e,[n,i]);if(t){r=t;break}}}return r?d(r,["uuid","left","top","width","height"]):null}function v(v,g,x,L,y){const{computedX:w,getXValue:X}=c(g),{originX:C,endX:S,xCellWidth:Y,originYXAxis:b,top:k,canvasWidth:j,borderStyle:M,treeData:G,xAxis:E,topGridYNumber:I,topGridOriginY:R,topGridYCellHeight:z,topGridEndY:A,event:T,extraMenuConfig:V,getTreeData:$}=g,{getPointEventProps:D}=a(v,x,g);let P=$();const B=new Set;function N(){const{show:t=!0,range:e}=(null==k?void 0:k.scaleValue)||{};return t&&h(e)}function W(){!function t(e){e.forEach((e=>{var i;(null==(i=e.children)?void 0:i.length)?t(e.children):(function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=k.dataStyle||{},n=t.top,i=n+z,o=i-z/2,r={y1:n,y2:i,halfY:o};let s=null;const c=d(t,["data","width","height","left","top"]);t.data.forEach(((t,n,i)=>{const u={...c,data:t,index:n},{time:a,continue:f}=t,[d,h]=a,m=d&&w(d),p=h&&w(h),v=q({...r,x:m},{isCustomIcon:!p&&!f,isContinue:!1,isLeft:!0}),g=q({...r,x:p},{isCustomIcon:!1,isContinue:!!f});let x,L;if((v||m<C)&&(g||p>S)){const t=v?m:C,n=g?p:S;x=l([t,o,n,o],e),L=_({width:n-t-Y,left:t+(n-t)/2,top:o,onlyRect:!0}),L.origin=u,x.centerLineRect=L}const y={startLine:v,centerLine:x,endLine:g};let X,b;!function(t,e,n){const{startLine:i,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(i){i.origin=n;const t={x1:C,x2:l?l.left:S};s?(t.x1=s.left,s.limitX.x2=i.left,i.prevLine=s,s.nextLine=i):r&&(t.x1=r.left,r.limitX.x2=i.left,i.prevLine=r,r.nextLine=i),i.limitX=t,o&&(i.centerLine=o)}if(l){l.origin=n;const t={x1:i?i.left:C,x2:S};l.limitX=t,o&&(l.centerLine=o)}o&&(o.origin=n);i&&l&&(i.nearLine=l,l.nearLine=i)}(s,y,u),s&&(X=H(i[n-1],s,o,u)),n===i.length-1&&(b=H(t,y,o,u)),s=y,x&&B.add(x),L&&B.add(L),v&&B.add(v),g&&B.add(g),X&&B.add(X),b&&B.add(b)}))}(e),function(t){var e;if(N())return;const i=j-S,{divider:o={}}=(null==k?void 0:k.total)||{};if(o.show){const e=t.top+z,n=l([S,e,S+i,e],o.style);v.value.add(n)}if(!(null==t?void 0:t.total))return;const r=t.top+z/2,s=S+i/2,c=n([s,r],{value:t.total,...null==(e=k.dataStyle)?void 0:e.totalStyle}),u=j-M.strokeWidth;s+c.width>u&&c.set({originX:"right",left:u});c&&v.value.add(c)}(e))}))}(P),B.size&&v.value.add(...B)}function H(t,e,n,i){let o;const{content:l}=t.value||{},{startLine:s,endLine:c,centerLine:u}=e;if(l&&(s||u||c)){const{textStyle:t}=k.dataStyle||{};o=r(l,{fontSize:12,...t,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const u=O(o,e,n);o&&(o.set(u),o.origin=i,F(o),s&&(s.text=o),c&&(c.text=o))}return o}function O(t,e,n){const i=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:n,originX:"center",originY:"center"};return l&&i<=l.width?s.left=l.x1+l.width/2:r&&i<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&i<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&i<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=n+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=n+1),s}function _(e){const{bindLine:n,width:i,left:o,top:l,props:r,onlyRect:s=!1}=e,c={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",left:o,top:l},u=new t.Rect({width:i,height:z,fill:"transparent",...c});if(s)return u.set({lockMovementX:!0,lockMovementY:!0}),F(u),u;const a=new t.Group([n,u],{...c,...r,lockMovementY:!0});return F(a),a}function q(t,{isCustomIcon:e,isContinue:n,isLeft:i}){const{x:o,y1:s,y2:c,halfY:u}=t;if(!o||o<C||o>S)return;const{lineStyle:a}=k.dataStyle||{};let f;const d={left:o,top:u};f=e?r("circle",{fill:a.stroke,...d}):n?r(">",{fill:a.stroke,...d,fontSize:18}):l([o,s,o,u],a);const h=_({...d,width:Y,bindLine:f,props:D()});return h.isLeft=i,h.isCustomIcon=e,h}function F(t){T.hovered&&(t.on("mouseover",(()=>{J(t,"hover")})),t.on("mouseout",(()=>{L.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){var e,n;if(t.centerLine){const i=t.isLeft?{x1:t.left}:{x2:t.left};if(t.centerLine.setCoords().set(i),t.isLeft){const n=t.limitX.x2-t.left;null==(e=t.centerLine.centerLineRect)||e.setCoords().set({width:n-Y,left:t.left+n/2})}else{const e=t.left-t.limitX.x1;null==(n=t.centerLine.centerLineRect)||n.setCoords().set({width:e-Y,left:t.limitX.x1+e/2})}}if(t.text){const e=O(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),T.hovered&&J(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};x("change",d(e,["uuid"]))}})))}function J(t,e="moving"){var n,i,o;L.isTarget=!0,L.show=!0;const{data:l}=t.origin;L.point={x:t.left,y:t.top},L.marginTop=z/2;let[r="",s=""]=l.time||[];if("moving"===e){const e=X(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}L.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(n=l.value)?void 0:n.currentSpeed)||""}`,`浓度 ${(null==(i=l.value)?void 0:i.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],L.sourceData=[{type:"tree",startTime:r,endTime:s,value:l.value}]}return s(v,{...g,gridYNumber:I,originY:R,yCellHeight:z,endY:A}),function(){var o,l;const{height:r,list:s,left:c,spaceValue:u,style:a,marginBottom:f}=E;if(!r)return;const d=[],h=b+(f?r-f:r/2),m=f?"bottom":"center";s.forEach(((t,e)=>{const i=c+e*Y*u;d.push(n([i,h],{value:t.slice(11,16),originY:m,...a}))}));const p=d.length>0?new t.Group([...d],{...e,objectCaching:!1}):null;p&&v.value.add(p);const g=new t.Rect({width:j,height:r,left:0,top:b,...i,originX:"left",originY:"top",...M});if(v.value.add(g),!N()){const{title:t=(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.234"))||"总量"}=(null==k?void 0:k.total)||{},e=n([S+(j-S)/2,h],{value:t,originY:m,...null==(l=k.dataStyle)?void 0:l.totalStyle});v.value.add(e)}}(),function(){var n;const i=(null==(n=null==k?void 0:k.tree)?void 0:n.textStyle)||{},l=[];!function t(e){e.forEach((e=>{var n;const{width:r,height:s,left:c,top:u,title:a=""}=e,f={value:a,...i};(null==(n=e.children)?void 0:n.length)?(f.value=a.split("").join("\n"),t(e.children)):f.textAlign="left",l.push(o({width:r,height:s,...M},f,{left:c,top:u},!0))}))}(G);const r=l.length>0?new t.Group([...l],{...e,objectCaching:!1}):null;r&&v.value.add(r)}(),W(),function(){const{range:n,spaceValue:i=.5,spaceGridNumber:o=1,style:l,margin:r=5}=(null==k?void 0:k.scaleValue)||{};if(!N())return;const s=f(n,i),c=[];if(s.forEach(((t,e)=>{if(0===e||e===s.length-1)return;const n=A-e*z*o;Math.abs(n-R)<1||c.push(u(String(t),{style:l,position:"right"},S+r,n))})),!c.length)return;const a=new t.Group(c,{objectCaching:!1,...e});v.value.add(a)}(),T.evented&&v.value.on("mouse:up",(t=>{3===t.button&&function(t){L.show=!1;const{x:e=0,y:n=0}=t.pointer||{};if(n>=R&&n<=A)if(e>=C&&e<=S)if(t.target){const e=t.target;y.point={x:e.left,y:e.top},y.show=!0,y.target=e;const{treeMenuList:n=[]}=V;y.list=m.concat(n).map((t=>({...t,renderItem:()=>t.label,type:t.key||t.type,_type:"tree"})))}else{const t={type:"tree",treeItem:p(P,"tree",[e,n]),time:X(e)};x("right-click",t)}else{const t={type:"treeMenu",treeItem:p(G,"treeMenu",[e,n])};x("right-click",t)}}(t)})),{redrawLinePoints:function(){var t;B.size&&(null==(t=v.value)||t.remove(...B)),B.clear(),P=$(),W()},clickMenu:function({item:t,target:e}){var n;if(!e)return;const{type:i}=t,o={...e.origin,type:"tree"};if(m.map((t=>t.type)).includes(i)){if("remove"===i){const t=[...B].filter((t=>{var e;return(null==(e=t.origin)?void 0:e.uuid)===o.uuid}));t.length&&(v.value.remove(...t),t.forEach((t=>{B.delete(t)})))}x(i,d(o,["uuid"]))}else null==(n=V.click)||n.call(V,i,o)}}}export{v as useTop};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as o}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"../useCommon.js";import"vue";import"./useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,s){const{xScaleList:r,originX:a,endX:l,endY:u,xCellWidth:c,canvasWidth:d,canvasHeight:h,bottom:p,breathingHeight:m,iconsWidth:g,borderStyle:v}=s;!function(){var s,d,h;if(!m||!p){const e=new t.Line([g,u-1,l,u-1],v);return n.value.add(e),e.sendToBack(),!1}const f=m,b=(null==(s=p.breathing)?void 0:s.list)||[],j=[];let w=!0;r.forEach(((t,o)=>{const n=a+o*c;let s="";b.forEach(((e,i)=>{const o=new Date(e.time).getTime();o>=t&&o<+t+t.scaleCell&&(s=e.value)}));const r=w?{top:-(f/2-10)}:{top:f/2-10};s&&(w=!w);const l=e({width:c,height:f,...v},Object.assign({},{text:String(s),...i},s?r:{}),{left:n,top:u});j.push(l)}));const x=e({width:l,height:f,...v},{text:String((null==(d=p.breathing)?void 0:d.title)+(null==(h=p.breathing)?void 0:h.unit)),...i,left:-(l-a)/2},{left:0,top:u});j.push(x);const S=j.length>0?new t.Group([...j],{...o}):null;S&&S.sendToBack(),S&&n.value.add(S)}()}export{n as useBottom};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as o}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"../useCommon.js";import"vue";import"./useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";function n(n,s){const{xScaleList:r,originX:a,endX:l,endY:d,xCellWidth:u,canvasWidth:h,canvasHeight:c,bottom:p,breathingHeight:m,iconsWidth:g,borderStyle:v}=s;!function(){var s,h,c;if(!m||!p){const e=new t.Line([g,d-1,l,d-1],v);return n.value.add(e),e.sendToBack(),!1}const f=m,j=(null==(s=p.breathing)?void 0:s.list)||[],b=[];let x=!0;r.forEach(((t,o)=>{const n=a+o*u;let s="";j.forEach(((e,i)=>{const o=new Date(e.time).getTime();o>=t&&o<+t+t.scaleCell&&(s=e.value)}));const r=x?{top:-(f/2-10)}:{top:f/2-10};s&&(x=!x);const l=e({width:u,height:f,...v},Object.assign({},{text:String(s),...i},s?r:{}),{left:n,top:d});b.push(l)}));const w=e({width:l,height:f,...v},{text:String((null==(h=p.breathing)?void 0:h.title)+(null==(c=p.breathing)?void 0:c.unit)),...i,left:-(l-a)/2},{left:0,top:d});b.push(w);const S=b.length>0?new t.Group([...b],{...o}):null;S&&S.sendToBack(),S&&n.value.add(S)}()}export{n as useBottom};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{format as a}from"date-fns";import{getType as u,getTime as d,isOneLine as c,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as w,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useCommon as L}from"../useCommon.js";import"vue";import"naive-ui";import{TEMPERATURE_MENU as j,PAIN_MENU as k,OVERLAP as S}from"../../constants/index.js";import"@vueuse/core";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,O,C,$,T,V,P,R,A,I){s(E,O);const{getEqualXTypes:X,handleAddPrevent:B,getPointEventProps:D}=L(E,C,O),{createShadowLines:H}=t(),{left:W,xScaleList:z,xCellWidth:F,yCellHeight:_,originX:q,endX:G,originY:N,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:re}=O,se=new Set,ae=["xinmai","mai"],ue=new Map,de=new Set,ce=new Set,pe=new Set,fe=w(W.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(se.size&&E.value.remove(...se),se.clear(),ue.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ue.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ue)t.push(e[1]),e[0]===ae[0]&&e[1].forEach((e=>{(ue.get(ae[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],d=n[i-1],c=n[i+1],p=o[s-1],f=o[s+1];if(d&&p){if(d[0]!==p[0]){const e=Math.max(d[0],p[0]);l.push([d,p].find((t=>t[0]===e)))}}else d?l.push(d):p&&r.push(p);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=b(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(r.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ae[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{0==t?e.rightLine&&E.value.remove(e.rightLine):e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...H(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),se.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...x(t)],{...s,originX:"center"});e.push(n),se.add(n)}))}E.value.add(...e)}se.add(l),E.value.add(l)}))}}function ge(e,t,s){var a;const{type:u,riseStyle:d={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:L={},belowMinValueStyle:j={},respiratorStyle:k={},dataList:S=[],list:Y=[]}=s,{type:O,textStyle:V}=L,R=[],I=[],X=[];let B=null;const H=e=>"breathe"==u&&e.respirator&&k.type&&k.fixedValue&&!e.value&&we(e.time),W=c(s);if(null==(a=e.list)||a.forEach(((a,c)=>{var L,z,q,G;const N=W?S.find((e=>e.key===a.key)):e,J=xe(H(a)?{...a,value:k.fixedValue}:a,s),K=e.list[c+1],ee=K?xe(H(K)?{...K,value:k.fixedValue}:K,s):void 0,oe=K?W?S.find((e=>e.key===K.key)):e:{},{title:le=""}=N;if(le===((null==(L=window.getLanguageByCode)?void 0:L.call(window,"10010.1.235"))||"脉搏")&&oe.title!==((null==(z=window.getLanguageByCode)?void 0:z.call(window,"10010.1.235"))||"脉搏")||le!==((null==(q=window.getLanguageByCode)?void 0:q.call(window,"10010.1.235"))||"脉搏")&&oe.title===((null==(G=window.getLanguageByCode)?void 0:G.call(window,"10010.1.235"))||"脉搏")||!J||!ee||f(J[0],1)!==f(ee[0],1))J&&B&&(J[0]=B),B=null;else{const e=J[0]-F/2;J[0]=e+F/4,ee[0]=B=J[0]+F/2}const re={};re.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+_?e[1]+_:e[1]-_,r=l([e[0],o],{value:H(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-_}}(J,a,N),function(e,t,s,a){var c,f,v;if(!["temperature","pain","breathe"].includes(u))return;if(!(null==e?void 0:e.length)&&"temperature"===u&&!we(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===u)return;if(!t.value&&"breathe"===u)return;const{lineAttr:m={},key:w}=s,{value:x}=a,b=$(t.time);let L,j,S,Y,E,O;if(t.noRise&&p.show){const i=M(p,t)?T(u,35):(null==e?void 0:e[1])||0;if(p.text)S=l([b,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(S);else if(t.value){S=r([b,i,i+2*_],{...p.style})}S&&X.push(S),S&&M(p,t)&&he.add(S)}if(null==e?void 0:e[1]){if(t.rise&&d.show&&d.text&&(Y=l([b,e[1]-(x?_:0)-5],{value:d.text.split("").join("\n"),originY:"bottom",...d.style}),X.push(Y)),t.verified){const t=(null==(c=null==g?void 0:g.position)?void 0:c[w])||"top";E=l(["top-right"===t?b+F/2:b,e[1]-(x?_:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(E)}if(h(t.physicsReduce)||h(t.drugReduce)){const l=T(u,null!=(f=t.physicsReduce)?f:t.drugReduce),r=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?b+F/2:b;L=i([...e,r,l],{...m,...y.line,...n}),j=o((null==(v=null==y?void 0:y.point)?void 0:v.type)||"circle",{left:r,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),L&&X.push(L),j&&X.push(j)}t.respirator&&(O=o(k.type,{left:b,top:e[1]-(x?_:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(O))}Object.assign(a,{reduceLine:{obj:L,type:"line"},noRiseText:{obj:S,top:p.text?5:2*_,isFixed:M(p,t)},riseText:{obj:Y,top:(x?-_:0)-5},verifiedText:{obj:E,left:F/2,top:(x?-_:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:O,top:(x?-_:0)-5}})}(J,a,N,re),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;const o=Math.max(...Y),s=Math.min(...Y);let a,d,c;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*_,i=[e[1]-_/2,t];t<U.originY&&(t=e[1]+2.5*_,i=[t,e[1]+_/2]),a=r([e[0],i[0],i[1]],x,"up"),X.push(a)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=a?e[1]+_/2+a.height:e[1]+_;d=l([e[0],t],i),X.push(d)}+t.value<s&&(d=l([e[0],e[1]-_],i),X.push(d))}if(j.show&&+t.value<s){const t=e[1];if(j.text)c=l([e[0],e[1]+5],{value:j.text.split("").join("\n"),originY:"top",...j.style});else{const i=t+2*_;c=r([e[0],t,i],{...j.style})}X.push(c)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:d,top:-_},belowMinValue:{obj:c,top:j.text?5:2*_,moveHide:!0}})}(J,a,N,re),function(n,l,r,a,d,c){let f,h;const{pointAttr:g={},lineAttr:y={},title:x="",key:b,type:L="circle"}=d,j=g.height?g.height/2:5,S=e.list[a+1];let Y=w(n),M=w(l);const B=ye(u,e.list[a].value),z=()=>"pulse"==u&&r.pacemakerShow?m.value:H(r)?k.type:B&&"number"===O?0:L,F=e=>e&&p.show&&p.fixed&&we(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(r.breakpoint)return!1;if("temperature"===u&&(n||F(r))&&(l||F(S))){const e=T(u,35);return n||(Y=[$(r.time),e]),l||(M=[$(S.time),e]),!0}return!!n&&!!l})()){Y&&M&&B&&ye(u,S.value)&&!ne[1]&&"icon"===O&&(Y[1]=Y[1]-j,M[1]=M[1]-j),h=i([...Y,...M],{...y});const{obj:e}=(null==c?void 0:c.reducePoint)||{};if(n&&l&&(null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...y});X.unshift(t),Object.assign(c,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const _=z(),q=I[a-1],G={origin:{data:H(r)?{...r,value:k.fixedValue}:r,title:x,key:b||"",unit:s.unit,type:u,_type:v(x,u),dataIndex:t,index:a,isOneLine:W},leftLine:q,rightLine:h,otherObj:c,...r.pacemakerShow&&"pulse"==u?m.style:H(r)?k.style:g,...D(),lockMovementX:!0,...B?{selectable:!1,evented:!1,..."number"===O?V:{}}:{}};n&&(q?G.leftLine.set("x2",n[0]):G.leftLine=null,f=o(_,{left:n[0],top:B&&!ne[1]?n[1]-j:n[1],...G}));I.push(h),f&&(b===ae[1]?de.add(f):H(r)||ce.add(f),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:r=!1,left:s=0}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left+s,top:e.top+o}),r&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=P(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),C("change",n),Le(n,"change")}}))}(f),R.push(f),pe.add(f))}(J,ee,a,c,N,re)})),"pulse"===u){let t=null;const i=e=>e.map(((e,i,n)=>{var o,l;const r=n[i+1];if(r&&f(e.left,1)===f(r.left,1)){const i=e.left-F/2;e.set("left",i+F/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+F/2,r.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]}));if(W){const e={};ae.forEach((t=>{e[t]=R.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t})),ue.set(t,i(e[t]))}))}else{const{key:t}=e;ue.set(t,i(R))}}const z=I.filter((e=>e));E.value.add(...z,...R,...X)}function ye(e,t){return"pain"===e&&0==t}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||V(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:s,physicsReduce:a}=l||{},u="hover"===t?l.value:P(o,e.top);if(h(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(h(a))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${u}—>${a}${n||""}`;return`${i} ${u}${n||""}`}(),r],A.show=!0}function we(e){const[t]=z,i=b(z),n=t.start,o=i.end,l=d(e);return l>=n&&l<=o}function xe(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!we(e.time))return;const n=$(e.time),o=T(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function be(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=d(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=d(`${V(e)}:00`);return ee&&l<d(ee)?(B("exceedMin"),!1):!(l>o)||(B("exceedMax"),!1)}function Le(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=fe.find((e=>e.type===i));if("add"===t){const e=c(s)?s.dataList.find((e=>e.enable)):s.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;je()}function je(){var e;pe.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...pe]))),pe.clear(),ke()}function ke(e){ue.clear(),pe.clear(),de.clear(),he.clear(),ce.clear(),fe.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||c(t)&&!e.enable||ge(e,i,t)})))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>e.show&&"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>{var t;return e.title.includes((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.235"))||"脉搏")})))return;const i=Object.assign({},S,W.overlap||{}),l=[];de.size&&[...de].forEach((e=>{[...ce].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),l.push(o(s,{...i[e],...r}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-re.strokeWidth,height:ie-re.strokeWidth,fill:"transparent",...re});E.value.add(t)}(),ke((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=T(e.type,e.positionLine.value),n=i([q,t,G,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{var t;const{button:i,target:n,pointer:o={}}=e;if(3===i){if(!O.event.evented)return;const{x:e=0,y:i=0}=o;if(e>=q&&e<=G&&i>=N&&i<=J){I.point={x:e,y:i},I.show=!0;const{type:l}=(null==n?void 0:n.origin)||{};if(n&&["temperature","pain"].includes(l))"temperature"===l&&(I.list=[...j]),"pain"===l&&(I.list=[...k]),I.target=n;else{I.target=null,I.list=[(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.219"))||"新增节点"],K.forEach((t=>{if(!X([...pe],e,"_type").includes(t.bigType)){const e=["pain"].includes(t.bigType)?Z:U;i>=e.originY&&i<=e.endY&&I.list.push({renderItem:R?R(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key,isOneLine:t.isOneLine},pointer:o})}}));const n=be(e);n&&1!==I.list.length||(I.show=!1,1===I.list.length&&n&&B("repeat"))}}}if(1===i){if(n)return;const{x:e=0,y:t=0}=o;e>=q&&e<=G&&t>0&&t<ie&&C("click:grid",{x:e,y:t,time:V(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,isOneLine:o,dataIndex:l,index:r}=t.origin,s=y(i,[...j,...k]);s[`${e.type}`]=e.value,s.changeTime=a(new Date,"yyyy-MM-dd HH:mm"),o&&(s.key=t.origin.key);const u={...t.origin,data:s};C("change",u),Le(u,"change")}else{const t={data:{time:V(e.pointer.x),value:P(e.origin.type,e.pointer.y),...e.origin.isOneLine?{key:e.origin.key}:{}},...e.origin};C("add",t),Le(t)}},setPopup:me,isAddPoint:be,updateData:Le,redrawPoints:je,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{format as a}from"date-fns";import{getType as u,getTime as d,isOneLine as c,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as w,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useCommon as L}from"../useCommon.js";import"vue";import"naive-ui";import{TEMPERATURE_MENU as j,PAIN_MENU as k,OVERLAP as S}from"../../constants/index.js";import"@vueuse/core";import"../../../../../shared/utils/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,O,C,$,T,V,P,R,A,I){s(E,O);const{getEqualXTypes:X,handleAddPrevent:B,getPointEventProps:D}=L(E,C,O),{createShadowLines:H}=t(),{left:W,xScaleList:z,xCellWidth:F,yCellHeight:_,originX:q,endX:G,originY:N,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:re}=O,se=new Set,ae=["xinmai","mai"],ue=new Map,de=new Set,ce=new Set,pe=new Set,fe=w(W.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(se.size&&E.value.remove(...se),se.clear(),ue.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ue.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ue)t.push(e[1]),e[0]===ae[0]&&e[1].forEach((e=>{(ue.get(ae[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],d=n[i-1],c=n[i+1],p=o[s-1],f=o[s+1];if(d&&p){if(d[0]!==p[0]){const e=Math.max(d[0],p[0]);l.push([d,p].find((t=>t[0]===e)))}}else d?l.push(d):p&&r.push(p);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=b(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(r.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ae[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{0==t?e.rightLine&&E.value.remove(e.rightLine):e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...H(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),se.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...x(t)],{...s,originX:"center"});e.push(n),se.add(n)}))}E.value.add(...e)}se.add(l),E.value.add(l)}))}}function ge(e,t,s){var a;const{type:u,riseStyle:d={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:L={},belowMinValueStyle:j={},respiratorStyle:k={},dataList:S=[],list:Y=[]}=s,{type:O,textStyle:V}=L,R=[],I=[],X=[];let B=null;const H=e=>"breathe"==u&&e.respirator&&k.type&&k.fixedValue&&!e.value&&we(e.time),W=c(s);if(null==(a=e.list)||a.forEach(((a,c)=>{var L,z,q,G;const N=W?S.find((e=>e.key===a.key)):e,J=xe(H(a)?{...a,value:k.fixedValue}:a,s),K=e.list[c+1],ee=K?xe(H(K)?{...K,value:k.fixedValue}:K,s):void 0,oe=K?W?S.find((e=>e.key===K.key)):e:{},{title:le=""}=N;if(le===((null==(L=window.getLanguageByCode)?void 0:L.call(window,"10010.1.235"))||"脉搏")&&oe.title!==((null==(z=window.getLanguageByCode)?void 0:z.call(window,"10010.1.235"))||"脉搏")||le!==((null==(q=window.getLanguageByCode)?void 0:q.call(window,"10010.1.235"))||"脉搏")&&oe.title===((null==(G=window.getLanguageByCode)?void 0:G.call(window,"10010.1.235"))||"脉搏")||!J||!ee||f(J[0],1)!==f(ee[0],1))J&&B&&(J[0]=B),B=null;else{const e=J[0]-F/2;J[0]=e+F/4,ee[0]=B=J[0]+F/2}const re={};re.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+_?e[1]+_:e[1]-_,r=l([e[0],o],{value:H(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-_}}(J,a,N),function(e,t,s,a){var c,f,v;if(!["temperature","pain","breathe"].includes(u))return;if(!(null==e?void 0:e.length)&&"temperature"===u&&!we(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===u)return;if(!t.value&&"breathe"===u)return;const{lineAttr:m={},key:w}=s,{value:x}=a,b=$(t.time);let L,j,S,Y,E,O;if(t.noRise&&p.show){const i=M(p,t)?T(u,35):(null==e?void 0:e[1])||0;if(p.text)S=l([b,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(S);else if(t.value){S=r([b,i,i+2*_],{...p.style})}S&&X.push(S),S&&M(p,t)&&he.add(S)}if(null==e?void 0:e[1]){if(t.rise&&d.show&&d.text&&(Y=l([b,e[1]-(x?_:0)-5],{value:d.text.split("").join("\n"),originY:"bottom",...d.style}),X.push(Y)),t.verified){const t=(null==(c=null==g?void 0:g.position)?void 0:c[w])||"top";E=l(["top-right"===t?b+F/2:b,e[1]-(x?_:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(E)}if(h(t.physicsReduce)||h(t.drugReduce)){const l=T(u,null!=(f=t.physicsReduce)?f:t.drugReduce),r=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?b+F/2:b;L=i([...e,r,l],{...m,...y.line,...n}),j=o((null==(v=null==y?void 0:y.point)?void 0:v.type)||"circle",{left:r,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),L&&X.push(L),j&&X.push(j)}t.respirator&&(O=o(k.type,{left:b,top:e[1]-(x?_:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(O))}Object.assign(a,{reduceLine:{obj:L,type:"line"},noRiseText:{obj:S,top:p.text?5:2*_,isFixed:M(p,t)},riseText:{obj:Y,top:(x?-_:0)-5},verifiedText:{obj:E,left:F/2,top:(x?-_:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:O,top:(x?-_:0)-5}})}(J,a,N,re),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;const o=Math.max(...Y),s=Math.min(...Y);let a,d,c;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*_,i=[e[1]-_/2,t];t<U.originY&&(t=e[1]+2.5*_,i=[t,e[1]+_/2]),a=r([e[0],i[0],i[1]],x,"up"),X.push(a)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=a?e[1]+_/2+a.height:e[1]+_;d=l([e[0],t],i),X.push(d)}+t.value<s&&(d=l([e[0],e[1]-_],i),X.push(d))}if(j.show&&+t.value<s){const t=e[1];if(j.text)c=l([e[0],e[1]+5],{value:j.text.split("").join("\n"),originY:"top",...j.style});else{const i=t+2*_;c=r([e[0],t,i],{...j.style})}X.push(c)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:d,top:-_},belowMinValue:{obj:c,top:j.text?5:2*_,moveHide:!0}})}(J,a,N,re),function(n,l,r,a,d,c){let f,h;const{pointAttr:g={},lineAttr:y={},title:x="",key:b,type:L="circle"}=d,j=g.height?g.height/2:5,S=e.list[a+1];let Y=w(n),M=w(l);const B=ye(u,e.list[a].value),z=()=>"pulse"==u&&r.pacemakerShow?m.value:H(r)?k.type:B&&"number"===O?0:L,F=e=>e&&p.show&&p.fixed&&we(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(r.breakpoint)return!1;if("temperature"===u&&(n||F(r))&&(l||F(S))){const e=T(u,35);return n||(Y=[$(r.time),e]),l||(M=[$(S.time),e]),!0}return!!n&&!!l})()){Y&&M&&B&&ye(u,S.value)&&!ne[1]&&"icon"===O&&(Y[1]=Y[1]-j,M[1]=M[1]-j),h=i([...Y,...M],{...y});const{obj:e}=(null==c?void 0:c.reducePoint)||{};if(n&&l&&(null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...y});X.unshift(t),Object.assign(c,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const _=z(),q=I[a-1],G={origin:{data:H(r)?{...r,value:k.fixedValue}:r,title:x,key:b||"",unit:s.unit,type:u,_type:v(x,u),dataIndex:t,index:a,isOneLine:W},leftLine:q,rightLine:h,otherObj:c,...r.pacemakerShow&&"pulse"==u?m.style:H(r)?k.style:g,...D(),lockMovementX:!0,...B?{selectable:!1,evented:!1,..."number"===O?V:{}}:{}};n&&(q?G.leftLine.set("x2",n[0]):G.leftLine=null,f=o(_,{left:n[0],top:B&&!ne[1]?n[1]-j:n[1],...G}));I.push(h),f&&(b===ae[1]?de.add(f):H(r)||ce.add(f),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:r=!1,left:s=0}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left+s,top:e.top+o}),r&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=P(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),C("change",n),Le(n,"change")}}))}(f),R.push(f),pe.add(f))}(J,ee,a,c,N,re)})),"pulse"===u){let t=null;const i=e=>e.map(((e,i,n)=>{var o,l;const r=n[i+1];if(r&&f(e.left,1)===f(r.left,1)){const i=e.left-F/2;e.set("left",i+F/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+F/2,r.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]}));if(W){const e={};ae.forEach((t=>{e[t]=R.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t})),ue.set(t,i(e[t]))}))}else{const{key:t}=e;ue.set(t,i(R))}}const z=I.filter((e=>e));E.value.add(...z,...R,...X)}function ye(e,t){return"pain"===e&&0==t}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||V(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:s,physicsReduce:a}=l||{},u="hover"===t?l.value:P(o,e.top);if(h(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(h(a))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${u}—>${a}${n||""}`;return`${i} ${u}${n||""}`}(),r],A.show=!0}function we(e){const[t]=z,i=b(z),n=t.start,o=i.end,l=d(e);return l>=n&&l<=o}function xe(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!we(e.time))return;const n=$(e.time),o=T(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function be(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=d(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=d(`${V(e)}:00`);return ee&&l<d(ee)?(B("exceedMin"),!1):!(l>o)||(B("exceedMax"),!1)}function Le(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=fe.find((e=>e.type===i));if("add"===t){const e=c(s)?s.dataList.find((e=>e.enable)):s.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;je()}function je(){var e;pe.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...pe]))),pe.clear(),ke()}function ke(e){ue.clear(),pe.clear(),de.clear(),he.clear(),ce.clear(),fe.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||c(t)&&!e.enable||ge(e,i,t)})))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>e.show&&"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>{var t;return e.title.includes((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.235"))||"脉搏")})))return;const i=Object.assign({},S,W.overlap||{}),l=[];de.size&&[...de].forEach((e=>{[...ce].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),l.push(o(s,{...i[e],...r}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-re.strokeWidth,height:ie-re.strokeWidth,fill:"transparent",...re});E.value.add(t)}(),ke((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=T(e.type,e.positionLine.value),n=i([q,t,G,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{var t;const{button:i,target:n,pointer:o={}}=e;if(3===i){if(!O.event.evented)return;const{x:e=0,y:i=0}=o;if(e>=q&&e<=G&&i>=N&&i<=J){I.point={x:e,y:i},I.show=!0;const{type:l}=(null==n?void 0:n.origin)||{};if(n&&["temperature","pain"].includes(l))"temperature"===l&&(I.list=[...j]),"pain"===l&&(I.list=[...k]),I.target=n;else{I.target=null,I.list=[(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.219"))||"新增节点"],K.forEach((t=>{if(!X([...pe],e,"_type").includes(t.bigType)){const e=["pain"].includes(t.bigType)?Z:U;i>=e.originY&&i<=e.endY&&I.list.push({renderItem:R?R(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key,isOneLine:t.isOneLine},pointer:o})}}));const n=be(e);n&&1!==I.list.length||(I.show=!1,1===I.list.length&&n&&B("repeat"))}}}if(1===i){if(n)return;const{x:e=0,y:t=0}=o;e>=q&&e<=G&&t>0&&t<ie&&C("click:grid",{x:e,y:t,time:V(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,isOneLine:o,dataIndex:l,index:r}=t.origin,s=y(i,[...j,...k]);s[`${e.type}`]=e.value,s.changeTime=a(new Date,"yyyy-MM-dd HH:mm"),o&&(s.key=t.origin.key);const u={...t.origin,data:s};C("change",u),Le(u,"change")}else{const t={data:{time:V(e.pointer.x),value:P(e.origin.type,e.pointer.y),...e.origin.isOneLine?{key:e.origin.key}:{}},...e.origin};C("add",t),Le(t)}},setPopup:me,isAddPoint:be,updateData:Le,redrawPoints:je,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s}from"../../utils/index.js";import{last as r}from"lodash-es";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"./useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function p(p,d,g,f,m,v,y,w,S,b,Y,x){var j,C;const{getEqualXTypes:L,handleAddPrevent:X,isGridLimit:N}=c(p,g,d),{originY:T,endY:V,originX:O,endX:k,xCellWidth:E,yCellHeight:M,left:G,vitalSignsOriginY:I,painOriginY:W,painHeight:A,iconsWidth:H,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P,painSurplusCell:z}=d;function F(o){var s;if(!(null==o?void 0:o.length))return;const{layout:c}=o[0];let d=H,g=O;"right"===c&&(d=k,g=k+(null!=(s=null==B?void 0:B.width)?s:0));const f=[],m=A&&"right"!==c?o.length-1:o.length,v=(g-d)/m,y=v+(g-d)%m;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:d,style:g,title:f}=n,m=W.originY-z[0]*M,v=l({width:O-H,height:A+(z[0]+z[1])*M,...D},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,O,m],D),w=[];if(r||h){const{lineXMain:t,textLeft:i}=u(c,H,O-H),l=o.length;o.forEach(((o,u)=>{let c=W.endY-u*M*s;if(0===u&&0===z[1]&&(c=V-5),h&&(!(0===u||u===l-1)||d||0===u&&z[1]>0||u===l-1&&z[0]>0)&&w.push(a(o,n,i,c)),r&&(0!==u||z[1]>0)){const[i,n]=t,o=new e.Line([i,c,n,c],{...D,...g});w.push(o)}}))}p.value.add(y,v,...w),v.sendToBack()}(o);const g=[],m=0===s?y:v,w=0===s?d:y+d+(s-1)*v,S="right"===c?0:I.originY,b="right"===c?$:I.endY,Y=s>0?t([w,S,w,b],{objectCaching:!1,...D}):null;Y&&g.push(Y);const x=w+m/2,{list:j=[],spaceGridNumber:C=5,showScale:L,showNumber:X,position:N,showMaxMinNumber:k,detailedList:E=[],showdetailedScale:G,showRange:R=[]}=o;if(L||X){const{lineXMain:e,lineXSub:t,textLeft:i}=u(N,w,m),n=(j[1]-j[0])/2,l=G&&!E.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):G&&(null==E?void 0:E.length)?E:j,[s=l[0],c=r(l)]=R;l.forEach(((n,r)=>{if(s&&+n<+s)return;if(c&&+n>+c)return;const u=I.endY-r*M*(G?C/2:C),p=[s,c].includes(n);if(X&&(!p||k)){const e=0==r?u-5:u,t=a(n,o,i,e),l=I.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...h(o,r,e,t,u,M,I.originY,l.findIndex((e=>e==c))+1))}))}let B=o.title||"";o.unit&&(B+="\n"+o.unit);let J=I.originY+2;0!==_&&P[0]>0&&(J=T+2),B&&g.push(new e.Text(String(B),{...i,originY:"top",left:x,top:J,textAlign:"center",...o.style}));const q=new e.Group(g,{...n,objectCaching:!1});f.push(q)}));const w=f.length>0?new e.Group([...f],{...n,objectCaching:!1}):null;w&&p.value.add(w),w&&w.sendToBack()}H&&function(){const e=JSON.parse(JSON.stringify(R));let t=V;const i=H-G.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:r}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{key:e.key,type:s(e.bigType),_type:e.bigType,isOneLine:e.isOneLine},...d.event}});var u;t-=l.height||30,(u=r).on("moving",(()=>{u.set("originX","center"),function(e){if(e.left>=O&&e.left<=k){e.setCoords();const t="pain"===e.origin.type?W:I;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(u),N(u)?f(u):m.show=!1})),u.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&N(u)){const e=L([...x],u.left,"_type").includes(u.origin._type),t=b(u.left);if(!t||e)e&&t&&X("repeat");else{const e={data:{time:w(u.left),value:S(u.origin.type,u.top),...u.origin.isOneLine?{key:u.origin.key}:{}},...u.origin};g("add",e),Y(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(u)})),p.value.add(l,r)}))}();const K=G.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&K.push(q),_>0&&G.yScaleValue[_].show){const e=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&K.unshift(e),_==G.yScaleValue.length-1&&K.push(e)}const Q=K.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),U=K[Q];return Q>-1&&K.splice(Q,0,{...U,title:(null==U?void 0:U.doubleTitle)||(null==U?void 0:U.title)}),F(K),{drawScaleValue:F}}export{p as useLeft};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s}from"../../utils/index.js";import{last as r}from"lodash-es";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"./useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";function p(p,d,g,f,m,v,y,w,S,b,Y,x){var j,C;const{getEqualXTypes:L,handleAddPrevent:X,isGridLimit:N}=c(p,g,d),{originY:T,endY:V,originX:O,endX:k,xCellWidth:E,yCellHeight:M,left:G,vitalSignsOriginY:I,painOriginY:W,painHeight:A,iconsWidth:H,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P,painSurplusCell:z}=d;function F(o){var s;if(!(null==o?void 0:o.length))return;const{layout:c}=o[0];let d=H,g=O;"right"===c&&(d=k,g=k+(null!=(s=null==B?void 0:B.width)?s:0));const f=[],m=A&&"right"!==c?o.length-1:o.length,v=(g-d)/m,y=v+(g-d)%m;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:d,style:g,title:f}=n,m=W.originY-z[0]*M,v=l({width:O-H,height:A+(z[0]+z[1])*M,...D},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,O,m],D),w=[];if(r||h){const{lineXMain:t,textLeft:i}=u(c,H,O-H),l=o.length;o.forEach(((o,u)=>{let c=W.endY-u*M*s;if(0===u&&0===z[1]&&(c=V-5),h&&(!(0===u||u===l-1)||d||0===u&&z[1]>0||u===l-1&&z[0]>0)&&w.push(a(o,n,i,c)),r&&(0!==u||z[1]>0)){const[i,n]=t,o=new e.Line([i,c,n,c],{...D,...g});w.push(o)}}))}p.value.add(y,v,...w),v.sendToBack()}(o);const g=[],m=0===s?y:v,w=0===s?d:y+d+(s-1)*v,S="right"===c?0:I.originY,b="right"===c?$:I.endY,Y=s>0?t([w,S,w,b],{objectCaching:!1,...D}):null;Y&&g.push(Y);const x=w+m/2,{list:j=[],spaceGridNumber:C=5,showScale:L,showNumber:X,position:N,showMaxMinNumber:k,detailedList:E=[],showdetailedScale:G,showRange:R=[]}=o;if(L||X){const{lineXMain:e,lineXSub:t,textLeft:i}=u(N,w,m),n=(j[1]-j[0])/2,l=G&&!E.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):G&&(null==E?void 0:E.length)?E:j,[s=l[0],c=r(l)]=R;l.forEach(((n,r)=>{if(s&&+n<+s)return;if(c&&+n>+c)return;const u=I.endY-r*M*(G?C/2:C),p=[s,c].includes(n);if(X&&(!p||k)){const e=0==r?u-5:u,t=a(n,o,i,e),l=I.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...h(o,r,e,t,u,M,I.originY,l.findIndex((e=>e==c))+1))}))}let B=o.title||"";o.unit&&(B+="\n"+o.unit);let J=I.originY+2;0!==_&&P[0]>0&&(J=T+2),B&&g.push(new e.Text(String(B),{...i,originY:"top",left:x,top:J,textAlign:"center",...o.style}));const q=new e.Group(g,{...n,objectCaching:!1});f.push(q)}));const w=f.length>0?new e.Group([...f],{...n,objectCaching:!1}):null;w&&p.value.add(w),w&&w.sendToBack()}H&&function(){const e=JSON.parse(JSON.stringify(R));let t=V;const i=H-G.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:r}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{key:e.key,type:s(e.bigType),_type:e.bigType,isOneLine:e.isOneLine},...d.event}});var u;t-=l.height||30,(u=r).on("moving",(()=>{u.set("originX","center"),function(e){if(e.left>=O&&e.left<=k){e.setCoords();const t="pain"===e.origin.type?W:I;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(u),N(u)?f(u):m.show=!1})),u.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&N(u)){const e=L([...x],u.left,"_type").includes(u.origin._type),t=b(u.left);if(!t||e)e&&t&&X("repeat");else{const e={data:{time:w(u.left),value:S(u.origin.type,u.top),...u.origin.isOneLine?{key:u.origin.key}:{}},...u.origin};g("add",e),Y(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(u)})),p.value.add(l,r)}))}();const K=G.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&K.push(q),_>0&&G.yScaleValue[_].show){const e=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&K.unshift(e),_==G.yScaleValue.length-1&&K.push(e)}const Q=K.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),U=K[Q];return Q>-1&&K.splice(Q,0,{...U,title:(null==U?void 0:U.doubleTitle)||(null==U?void 0:U.title)}),F(K),{drawScaleValue:F}}export{p as useLeft};
@@ -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 n}from"lodash-es";import"../useEvent.js";import"../useCommon.js";import"vue";import"./useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function l(l,o,r,u,s,a){const{left:h,other:f,vitalSignsOriginY:c,xCellWidth:g,yCellHeight:v,endX:p}=o,d=(()=>{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,n,o,u=!1){const s=[],a=u&&i.fixed&&i.fixedValue?i.fixedValue:i.value;String(a).split("").forEach(((n,l)=>{const o=new e.Text(n,{left:0,top:d*l,originX:"center",...t,objectCaching:!1,...i.style||{}});m=(d-(o.height||0))/2,s.push(o)}));const h=new e.Rect({left:0,top:0,width:g,height:d*s.length,fill:"transparent",originX:"center",...t}),{eventHighlight:c=!1}=f||{},p={originX:"center",left:n,top:o+m,baseTop:(i.baseTop||0)*v,trueLeft:n,trueHeight:s.length*d,objectCaching:!1,hoverCursor:"pointer",highlightObject:h,originData:i,selectable:!1,evented:c},b=new e.Group([h,...s],p);return function(e){const{highlightColor:t="#ffff00"}=f||{};e.on("mouseover",(()=>{e.highlightObject.set("fill",t),l.value.requestRenderAll()})),e.on("mouseout",(()=>{e.highlightObject.set("fill","transparent"),l.value.requestRenderAll()})),e.on("mousedown",(function(){r("eventClick",e.originData)}))}(b),l.value.add(b),b}!function(){var e,t;if(!(null==f?void 0:f.list))return!1;const l=[],o=[];i(f.list).forEach(((e,t)=>{e.value=e.value||"";const i=0===t?"vertical":e.align||"vertical",n=u(e.time,!0);if(n>p)return;const l=o.find((e=>e.left==n));if(l)l[i].push(e);else{const t={left:n,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)?s("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 s(e,t){if(j(e)){const n=[...a].find((e=>Math.abs(e.left-i)<1));n&&(t||Math.abs(i-u)>1)&&(r=n.top+n.height),u=i,l.push(b(e,i,r,!0))}}e.vertical.forEach(((u,a)=>{var h,f,p,m,x;const C=(u.baseTop||0)*v,S=(null==(h=n(l))?void 0:h.left)||0;0===a&&e.left<=S&&(i=S+g);if(l.filter((e=>e.trueLeft===i)).length){const e=String(u.value).length;t+=o,t+e*d+C>c.endY&&(t=c.originY,i+=g)}t+=C,String(u.value).length&&(l.push(b(u,i,t)),o=null!=(p=null==(f=n(l))?void 0:f.trueHeight)?p:0),s(u,0===a),j(u)&&(r+=null!=(x=null==(m=n(l))?void 0:m.trueHeight)?x:0)})),e.horizontal.forEach(((t,o)=>{var u,a;const h=c.originY+(t.baseTop||0)*v;r=m;const f=(null==(u=n(l))?void 0:u.left)||0;e.left<=f+.1&&(i=f+g),String(t.value).length&&l.push(b(t,i,h)),s(t,0===(null==(a=e.vertical)?void 0:a.length)&&0===o)}))}))}()}export{l 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 n}from"lodash-es";import"../useEvent.js";import"../useCommon.js";import"vue";import"./useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"../../../../../shared/utils/index.js";function l(l,o,r,s,u,a){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,n,o,s=!1){const u=[],a=s&&i.fixed&&i.fixedValue?i.fixedValue:i.value;String(a).split("").forEach(((n,l)=>{const o=new e.Text(n,{left:0,top:p*l,originX:"center",...t,objectCaching:!1,...i.style||{}});m=(p-(o.height||0))/2,u.push(o)}));const h=new e.Rect({left:0,top:0,width:g,height:p*u.length,fill:"transparent",originX:"center",...t}),{eventHighlight:c=!1}=f||{},d={originX:"center",left:n,top:o+m,baseTop:(i.baseTop||0)*v,trueLeft:n,trueHeight:u.length*p,objectCaching:!1,hoverCursor:"pointer",highlightObject:h,originData:i,selectable:!1,evented:c},b=new e.Group([h,...u],d);return function(e){const{highlightColor:t="#ffff00"}=f||{};e.on("mouseover",(()=>{e.highlightObject.set("fill",t),l.value.requestRenderAll()})),e.on("mouseout",(()=>{e.highlightObject.set("fill","transparent"),l.value.requestRenderAll()})),e.on("mousedown",(function(){r("eventClick",e.originData)}))}(b),l.value.add(b),b}!function(){var e,t;if(!(null==f?void 0:f.list))return!1;const l=[],o=[];i(f.list).forEach(((e,t)=>{e.value=e.value||"";const i=0===t?"vertical":e.align||"vertical",n=s(e.time,!0);if(n>d)return;const l=o.find((e=>e.left==n));if(l)l[i].push(e);else{const t={left:n,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)?u("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,s=i;function u(e,t){if(j(e)){const n=[...a].find((e=>Math.abs(e.left-i)<1));n&&(t||Math.abs(i-s)>1)&&(r=n.top+n.height),s=i,l.push(b(e,i,r,!0))}}e.vertical.forEach(((s,a)=>{var h,f,d,m,x;const C=(s.baseTop||0)*v,S=(null==(h=n(l))?void 0:h.left)||0;0===a&&e.left<=S&&(i=S+g);if(l.filter((e=>e.trueLeft===i)).length){const e=String(s.value).length;t+=o,t+e*p+C>c.endY&&(t=c.originY,i+=g)}t+=C,String(s.value).length&&(l.push(b(s,i,t)),o=null!=(d=null==(f=n(l))?void 0:f.trueHeight)?d:0),u(s,0===a),j(s)&&(r+=null!=(x=null==(m=n(l))?void 0:m.trueHeight)?x:0)})),e.horizontal.forEach(((t,o)=>{var s,a;const h=c.originY+(t.baseTop||0)*v;r=m;const f=(null==(s=n(l))?void 0:s.left)||0;e.left<=f+.1&&(i=f+g),String(t.value).length&&l.push(b(t,i,h)),u(t,0===(null==(a=e.vertical)?void 0:a.length)&&0===o)}))}))}()}export{l as useOther};
@@ -1 +1 @@
1
- import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import"../useCommon.js";import{setOtherType as r,isOneLine as o,getFloorNumber as s}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as d,addDays as c}from"date-fns";import"naive-ui";import"../../constants/index.js";import"@vueuse/core";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function S(S,w,b,Y,x,C){const D=15,j=e({select:null,redrawPoints:null,clickMenu:null}),V=a((()=>{const{painSurplusCell:e=[0,0]}=w.data.grid||{};return~K.value?e:[0,0]})),H=a((()=>{var e,a;const t=(null==(a=null==(e=w.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===K.value?t[0]=t[0]+V.value[1]:K.value>0&&(t[2]=t[2]+V.value[0]),t})),X=a((()=>0===K.value?[V.value[0],H.value[1],H.value[2],H.value[3]]:K.value>0?[H.value[0],H.value[1],V.value[1],H.value[3]]:H.value)),L=a((()=>{const{top:e}=w.data;return e.date.show&&(e.date.height||D)||0})),P=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||D)||0})),M=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||D)||0})),I=a((()=>{var e,a,t;const{top:l}=w.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||D)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),N=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||D)||0})),O=a((()=>{var e;const{bottom:a}=w.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=w.data;return e.mainXCell*e.subXCell+H.value[1]+H.value[3]})),R=a((()=>{const{grid:e}=w.data,a=K.value>0?V.value[1]:V.value[0];return e.mainYCell*e.subYCell+H.value[0]+H.value[2]+a})),W=a((()=>{var e;const{width:a,right:t=null,top:l}=w.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),$=a((()=>W.value-H.value[1]*T.value)),q=a((()=>{const{top:e,left:a}=w.data;return e.titleWidth+B.value})),z=a((()=>{const{bottom:e=null,height:a}=w.data;if(!e)return a;return a-(e.height||30)})),G=a((()=>{var e;const{top:a}=w.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||D)||0;return L.value+t+l+P.value+M.value+N.value})),T=a((()=>(W.value-q.value)/k.value)),A=a((()=>(z.value-G.value)/R.value)),B=a((()=>{var e,a;const{left:t}=w.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=q.value-T.value;const r=t.date.startDate||d(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(d(c(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=T.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+T.value/2,scaleCell:(l-t)/T.value}}))));return v(o)})),F=a((()=>{var e;return(null==(e=w.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),J=a((()=>{const{left:e}=w.data;return v(e.yScaleValue.filter((e=>e.show)).map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t,isOneLine:o(e)}))))))})),K=a((()=>{const{left:e}=w.data,a=e.yScaleValue.findIndex((e=>"pain"===e.type));return a>-1&&e.yScaleValue[a].show?a:-1})),Q=a((()=>{const{grid:e}=w.data;return-1===K.value?0:A.value*e.subYCell})),U=a((()=>{const{left:e}=w.data,a={originY:G.value+V.value[0]*A.value,endY:z.value-V.value[1]*A.value};return 0===K.value&&e.yScaleValue.length>1?a.endY=a.originY+Q.value:K.value===e.yScaleValue.length-1&&(a.originY=a.endY-Q.value),a})),Z=a((()=>{const{left:e}=w.data,a={originY:G.value+H.value[0]*A.value,endY:z.value-H.value[2]*A.value};return 0===K.value&&e.yScaleValue.length>1?a.originY=U.value.endY+H.value[0]*A.value:K.value===e.yScaleValue.length-1&&(a.endY=U.value.originY-H.value[2]*A.value),a})),_=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),ee=a((()=>{var e;const{left:a,right:t}=w.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>s(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ae=e({canvasWidth:w.data.width,canvasHeight:w.data.height,borderStyle:{...u,...w.data.borderStyle||{}},selectionStyle:w.data.selectionStyle||{},dateHeight:L.value,hospitalDaysHeight:P.value,operationDaysHeight:M.value,xScalevalueHeight:I.value,childbirthDaysHeight:N.value,topList:_.value,breathingHeight:O.value,hospitalizationDate:w.data.hospitalizationDate,grid:w.data.grid,top:w.data.top,left:w.data.left,right:w.data.right,bottom:w.data.bottom,other:w.data.other,painIndex:K.value,painHeight:Q.value,painOriginY:U.value,vitalSignsOriginY:Z.value,gridXNumber:k.value,gridYNumber:R.value,iconsWidth:B.value,originX:q.value,originY:G.value,endX:W.value,endXLimit:$.value,endY:z.value,xCellWidth:T.value,yCellHeight:A.value,xScaleList:E.value,event:F.value,itemList:J.value,getRightInfo:ee.value,config:w.data.config||{},surplusCell:H.value,painSurplusCell:V.value,mainSurplusCell:X.value}),{computedX:te,computedY:le,getXValue:ue,getYValue:ie}=i(ae);return t((()=>S.value),(e=>{e&&function(){h(S,ae);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=m(S,ae,b,te,le,ue,ie,w.addRenderItem,x,C);j.redrawPoints=l,j.clickMenu=u;const{drawScaleValue:o}=p(S,ae,b,e,x,te,le,ue,ie,a,t,i);g(S,ae,o),f(S,ae),y(S,ae,b,te,le,r);const{select:s}=n(S,ae,b);j.select=s}()}),{immediate:!0}),{propItems:ae,...l(j)}}export{S as useTemperatureChart};
1
+ import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import"../useCommon.js";import{setOtherType as r,isOneLine as o,getFloorNumber as s}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as d,addDays as c}from"date-fns";import"naive-ui";import"../../constants/index.js";import"@vueuse/core";import"../../../../../shared/utils/index.js";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function S(S,w,b,Y,x,C){const D=15,j=e({select:null,redrawPoints:null,clickMenu:null}),V=a((()=>{const{painSurplusCell:e=[0,0]}=w.data.grid||{};return~K.value?e:[0,0]})),H=a((()=>{var e,a;const t=(null==(a=null==(e=w.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===K.value?t[0]=t[0]+V.value[1]:K.value>0&&(t[2]=t[2]+V.value[0]),t})),X=a((()=>0===K.value?[V.value[0],H.value[1],H.value[2],H.value[3]]:K.value>0?[H.value[0],H.value[1],V.value[1],H.value[3]]:H.value)),L=a((()=>{const{top:e}=w.data;return e.date.show&&(e.date.height||D)||0})),P=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||D)||0})),M=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||D)||0})),I=a((()=>{var e,a,t;const{top:l}=w.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||D)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),N=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||D)||0})),O=a((()=>{var e;const{bottom:a}=w.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=w.data;return e.mainXCell*e.subXCell+H.value[1]+H.value[3]})),R=a((()=>{const{grid:e}=w.data,a=K.value>0?V.value[1]:V.value[0];return e.mainYCell*e.subYCell+H.value[0]+H.value[2]+a})),W=a((()=>{var e;const{width:a,right:t=null,top:l}=w.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),$=a((()=>W.value-H.value[1]*T.value)),q=a((()=>{const{top:e,left:a}=w.data;return e.titleWidth+B.value})),z=a((()=>{const{bottom:e=null,height:a}=w.data;if(!e)return a;return a-(e.height||30)})),G=a((()=>{var e;const{top:a}=w.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||D)||0;return L.value+t+l+P.value+M.value+N.value})),T=a((()=>(W.value-q.value)/k.value)),A=a((()=>(z.value-G.value)/R.value)),B=a((()=>{var e,a;const{left:t}=w.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=q.value-T.value;const r=t.date.startDate||d(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(d(c(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=T.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+T.value/2,scaleCell:(l-t)/T.value}}))));return v(o)})),F=a((()=>{var e;return(null==(e=w.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),J=a((()=>{const{left:e}=w.data;return v(e.yScaleValue.filter((e=>e.show)).map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t,isOneLine:o(e)}))))))})),K=a((()=>{const{left:e}=w.data,a=e.yScaleValue.findIndex((e=>"pain"===e.type));return a>-1&&e.yScaleValue[a].show?a:-1})),Q=a((()=>{const{grid:e}=w.data;return-1===K.value?0:A.value*e.subYCell})),U=a((()=>{const{left:e}=w.data,a={originY:G.value+V.value[0]*A.value,endY:z.value-V.value[1]*A.value};return 0===K.value&&e.yScaleValue.length>1?a.endY=a.originY+Q.value:K.value===e.yScaleValue.length-1&&(a.originY=a.endY-Q.value),a})),Z=a((()=>{const{left:e}=w.data,a={originY:G.value+H.value[0]*A.value,endY:z.value-H.value[2]*A.value};return 0===K.value&&e.yScaleValue.length>1?a.originY=U.value.endY+H.value[0]*A.value:K.value===e.yScaleValue.length-1&&(a.endY=U.value.originY-H.value[2]*A.value),a})),_=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),ee=a((()=>{var e;const{left:a,right:t}=w.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>s(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ae=e({canvasWidth:w.data.width,canvasHeight:w.data.height,borderStyle:{...u,...w.data.borderStyle||{}},selectionStyle:w.data.selectionStyle||{},dateHeight:L.value,hospitalDaysHeight:P.value,operationDaysHeight:M.value,xScalevalueHeight:I.value,childbirthDaysHeight:N.value,topList:_.value,breathingHeight:O.value,hospitalizationDate:w.data.hospitalizationDate,grid:w.data.grid,top:w.data.top,left:w.data.left,right:w.data.right,bottom:w.data.bottom,other:w.data.other,painIndex:K.value,painHeight:Q.value,painOriginY:U.value,vitalSignsOriginY:Z.value,gridXNumber:k.value,gridYNumber:R.value,iconsWidth:B.value,originX:q.value,originY:G.value,endX:W.value,endXLimit:$.value,endY:z.value,xCellWidth:T.value,yCellHeight:A.value,xScaleList:E.value,event:F.value,itemList:J.value,getRightInfo:ee.value,config:w.data.config||{},surplusCell:H.value,painSurplusCell:V.value,mainSurplusCell:X.value}),{computedX:te,computedY:le,getXValue:ue,getYValue:ie}=i(ae);return t((()=>S.value),(e=>{e&&function(){h(S,ae);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=m(S,ae,b,te,le,ue,ie,w.addRenderItem,x,C);j.redrawPoints=l,j.clickMenu=u;const{drawScaleValue:o}=p(S,ae,b,e,x,te,le,ue,ie,a,t,i);g(S,ae,o),f(S,ae),y(S,ae,b,te,le,r);const{select:s}=n(S,ae,b);j.select=s}()}),{immediate:!0}),{propItems:ae,...l(j)}}export{S as useTemperatureChart};