cnhis-design-vue 3.2.15-beta.2 → 3.2.15-beta.5

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 (172) hide show
  1. package/README.md +87 -87
  2. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  3. package/es/components/ai-chat/src/components/ChatPatient.vue2.js +1 -1
  4. package/es/components/big-table/src/BigTable.vue2.js +1 -1
  5. package/es/components/branch-notice/index.d.ts +393 -6
  6. package/es/components/branch-notice/src/BranchNotice.vue.d.ts +369 -6
  7. package/es/components/branch-notice/src/BranchNotice.vue2.js +1 -1
  8. package/es/components/branch-notice/src/canstants.d.ts +2 -1
  9. package/es/components/branch-notice/src/canstants.js +1 -1
  10. package/es/components/branch-notice/src/components/NoticeItem.vue.d.ts +168 -44
  11. package/es/components/branch-notice/src/components/NoticeItem.vue.js +1 -0
  12. package/es/components/branch-notice/src/components/NoticeItem.vue2.js +1 -0
  13. package/es/components/branch-notice/src/components/NoticeItemAside.vue.d.ts +74 -5
  14. package/es/components/branch-notice/src/components/NoticeItemAside.vue.js +1 -0
  15. package/es/components/branch-notice/src/components/NoticeItemAside.vue2.js +1 -0
  16. package/es/components/branch-notice/src/components/NoticeOperationList.vue.js +1 -0
  17. package/es/components/branch-notice/src/components/NoticeOperationList.vue2.js +1 -0
  18. package/es/components/branch-notice/src/drawLine.js +1 -1
  19. package/es/components/branch-notice/src/hooks/useTheme.d.ts +1 -0
  20. package/es/components/branch-notice/src/hooks/useTheme.js +1 -0
  21. package/es/components/branch-notice/src/types.d.ts +22 -4
  22. package/es/components/branch-notice/style/index.css +1 -1
  23. package/es/components/button-print/src/components/IdentityVerification.vue2.js +1 -1
  24. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
  25. package/es/components/classification/src/components/search-filter/index.vue2.js +1 -1
  26. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  27. package/es/components/classification/src/components/table-modal/index.vue2.js +1 -1
  28. package/es/components/expand-field/src/components/FormBatchOptionsModal.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/fabric-chart/src/FabricChart.vue2.js +1 -1
  33. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  34. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  35. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -1
  36. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  37. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  38. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
  39. package/es/components/fabric-chart/src/hooks/index.d.ts +1 -0
  40. package/es/components/fabric-chart/src/hooks/index.js +1 -1
  41. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  42. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
  43. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  44. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  45. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  46. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  47. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  48. package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
  49. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  50. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  51. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  52. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  53. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  54. package/es/components/fabric-chart/src/hooks/{temperature/useShadow.d.ts → useShadow.d.ts} +2 -2
  55. package/es/components/fabric-chart/src/hooks/useShadow.js +1 -0
  56. package/es/components/fabric-chart/src/utils/index.d.ts +1 -0
  57. package/es/components/fabric-chart/src/utils/index.js +1 -1
  58. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  59. package/es/components/field-set/src/FieldColor.vue2.js +1 -1
  60. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  61. package/es/components/field-set/src/FieldFilter.vue2.js +1 -1
  62. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  63. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  64. package/es/components/field-set/src/TableStyle.vue2.js +1 -1
  65. package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -1
  66. package/es/components/field-set/src/components/edit-filter.vue2.js +1 -1
  67. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  68. package/es/components/field-set/src/constants/filter.js +1 -1
  69. package/es/components/field-set/src/constants/index.js +1 -1
  70. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -1
  71. package/es/components/form-config/src/hooks/useLocale.js +1 -1
  72. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  73. package/es/components/form-render/src/components/renderer/combination/combination.js +1 -1
  74. package/es/components/form-render/src/components/renderer/complex.js +1 -1
  75. package/es/components/form-render/src/components/renderer/date.js +1 -1
  76. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  77. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  78. package/es/components/form-render/src/components/renderer/select.js +1 -1
  79. package/es/components/form-render/src/components/renderer/switch.js +1 -1
  80. package/es/components/form-render/src/components/renderer/text.js +1 -1
  81. package/es/components/form-render/src/components/renderer/textarea.js +1 -1
  82. package/es/components/form-render/src/hooks/useAnchor.js +1 -1
  83. package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
  84. package/es/components/form-render/src/hooks/useComplexOptions.js +1 -1
  85. package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
  86. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  87. package/es/components/form-render/src/hooks/usePresetScope.js +1 -1
  88. package/es/components/form-render/src/utils/index.js +1 -1
  89. package/es/components/iho-chat/index.d.ts +10 -10
  90. package/es/components/iho-chat/src/Index.vue.d.ts +10 -10
  91. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  92. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  93. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  94. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +2 -2
  95. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +1 -1
  96. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  97. package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +1 -1
  98. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +1 -1
  99. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  100. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  101. package/es/components/iho-chat/src/components/PersonProfile.vue.d.ts +1 -1
  102. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  103. package/es/components/iho-chat/src/components/SiderList.vue.d.ts +1 -1
  104. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  105. package/es/components/iho-chat/src/hooks/useData.d.ts +2 -2
  106. package/es/components/iho-chat/src/hooks/useData.js +1 -1
  107. package/es/components/iho-chat/src/hooks/useWebSocket.js +1 -1
  108. package/es/components/iho-chat/src/utils/index.js +1 -1
  109. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue2.js +1 -1
  110. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  111. package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue2.js +1 -1
  112. package/es/components/index.css +1 -1
  113. package/es/components/info-header/src/components/patientInfo/index.vue2.js +1 -1
  114. package/es/components/keyboard/src/components/NumberPanel.vue2.js +1 -1
  115. package/es/components/map/src/Map.vue2.js +1 -1
  116. package/es/components/quick-search/src/index.vue2.js +1 -1
  117. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  118. package/es/components/scale-view/src/components/formitem/r-sign.js +1 -1
  119. package/es/components/scale-view/src/components/formitem/standard-modal.js +1 -1
  120. package/es/components/scale-view/src/hooks/scaleview-methods.js +1 -1
  121. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  122. package/es/components/select-label/src/SelectLabel.vue2.js +1 -1
  123. package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +1 -1
  124. package/es/components/table-export-field/src/components/ExportModal.vue2.js +1 -1
  125. package/es/components/table-export-field/src/components/SaveProjectModal.vue2.js +1 -1
  126. package/es/components/table-filter/src/components/bi-filter/helpers/options.js +1 -1
  127. package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +1 -1
  128. package/es/components/table-filter/src/tool/baseOptions.js +1 -1
  129. package/es/components/template-render/src/components/index.d.ts +23 -23
  130. package/es/components/tooth-bitmap/src/ToothBitmap.vue2.js +1 -1
  131. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue2.js +1 -1
  132. package/es/components/vod-chunk-upload/src/vod-upload-modal.js +1 -1
  133. package/es/env.d.ts +25 -25
  134. package/es/shared/assets/img/ai__avatar.png.js +1 -1
  135. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  136. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  137. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  138. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  139. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  140. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  141. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  142. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  143. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  144. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  145. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  146. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  147. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  148. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  149. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  150. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  151. package/es/shared/assets/img/failure.png.js +1 -1
  152. package/es/shared/assets/img/logo.png.js +1 -1
  153. package/es/shared/assets/img/no-permission.png.js +1 -1
  154. package/es/shared/assets/img/nodata.png.js +1 -1
  155. package/es/shared/assets/img/notfound.png.js +1 -1
  156. package/es/shared/assets/img/qr.png.js +1 -1
  157. package/es/shared/assets/img/success.png.js +1 -1
  158. package/es/shared/assets/img/table_style_2.png.js +1 -1
  159. package/es/shared/assets/img/video.png.js +1 -1
  160. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  161. package/es/shared/assets/img/xb_big.png.js +1 -1
  162. package/es/shared/assets/img/xb_small.png.js +1 -1
  163. package/es/shared/package.json.js +1 -1
  164. package/package.json +2 -2
  165. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  166. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  167. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  168. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  169. package/es/components/fabric-chart/src/hooks/temperature/useShadow.js +0 -1
  170. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  171. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  172. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -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 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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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)/j.value)),L=a((()=>(R.value-0)/S.value)),j=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)})),S=a((()=>{const{config:e,grid:a}=h.data;if(s(a.gridYNumber))return a.gridYNumber;const t=C.value.length;return Math.ceil(w.value*t*2/e.mainYCellValue)})),w=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(S.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:j.value,gridYNumber:S.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
+ 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"../useShadow.js";import"../useCommon.js";import{ECG as m}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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)/j.value)),L=a((()=>(R.value-0)/S.value)),j=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)})),S=a((()=>{const{config:e,grid:a}=h.data;if(s(a.gridYNumber))return a.gridYNumber;const t=C.value.length;return Math.ceil(w.value*t*2/e.mainYCellValue)})),w=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(S.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:j.value,gridYNumber:S.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 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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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 g(){x.obj&&(l.value.remove(x.obj),x.obj.text&&l.value.remove(x.obj.text),x.obj=null)}function v(){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},g=new t.Line([c,a,c,a+n],{...x,lockMovementY:!0,originX:"center"}),v=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"});g.rect=m[e].rect,v.rect=m[e].rect,y.rect=m[e].rect,u&&(u.rect=m[e].rect),Object.assign(m[e].rect,{leftLine:g,rightLine:v,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(g,"left"),b(v,"right"),p&&b(y,"horizontal"),u&&b(u,"horizontal2");const z=[m[e].rect,g,v,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)})),g()}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),g(),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(g(),"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(){v(),x.type="line"},useCaliper:function(){y("caliper")},useCaliperRuler:function(){y("caliperRuler")},useRectRuler:function(){v(),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"../useShadow.js";import"../useCommon.js";import{isNumber as n}from"lodash-es";import"date-fns";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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 g(){x.obj&&(l.value.remove(x.obj),x.obj.text&&l.value.remove(x.obj.text),x.obj=null)}function v(){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},g=new t.Line([c,a,c,a+n],{...x,lockMovementY:!0,originX:"center"}),v=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"});g.rect=m[e].rect,v.rect=m[e].rect,y.rect=m[e].rect,u&&(u.rect=m[e].rect),Object.assign(m[e].rect,{leftLine:g,rightLine:v,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(g,"left"),b(v,"right"),p&&b(y,"horizontal"),u&&b(u,"horizontal2");const z=[m[e].rect,g,v,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)})),g()}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),g(),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(g(),"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(){v(),x.type="line"},useCaliper:function(){y("caliper")},useCaliperRuler:function(){y("caliperRuler")},useRectRuler:function(){v(),x.type="rect"}}}export{l as useMeasureInstrument};
@@ -2,6 +2,7 @@ export * from './useDraw';
2
2
  export * from './useGrid';
3
3
  export * from './useCumputedPoint';
4
4
  export * from './useEvent';
5
+ export * from './useShadow';
5
6
  export * from './useScaleColumn';
6
7
  export * from './useCommon';
7
8
  export * from './birthProcess/useBirthProcessChart';
@@ -1 +1 @@
1
- export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint,useElectrocardiogramCumputedPoint}from"./useCumputedPoint.js";export{bus,useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";export{useElectrocardiogramChart}from"./electrocardiogram/useElectrocardiogramChart.js";export{useNewBirthProcessChart}from"./newBirthProcess/useNewBirthProcessChart.js";
1
+ export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint,useElectrocardiogramCumputedPoint}from"./useCumputedPoint.js";export{bus,useCanvasEvent}from"./useEvent.js";export{useShadow}from"./useShadow.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";export{useElectrocardiogramChart}from"./electrocardiogram/useElectrocardiogramChart.js";export{useNewBirthProcessChart}from"./newBirthProcess/useNewBirthProcessChart.js";
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as t,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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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:A,getPointEventProps:P}=c(v,x,g),{xAxis:C,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:O,canvasHeight:R,extraTimeXAxisList:J}=g,K=p(q),Q=new Set;function U(){K.filter((e=>e.show)).forEach(((e,r)=>{var l;const s=[],a=[],u=[];null==(l=e.data)||l.forEach(((l,c)=>{!function(l,c,d){if(!l&&!c.childbirth||!(null==c?void 0:c.time)||!ee(c.time))return;let h,f;const{pointAttr:v={},lineAttr:g={},title:x="",key:y,type:j="circle",childbirthStyle:E={}}=e,k=p(e.data[d+1]);k&&!k.value&&k.childbirth&&(k.value=c.value);const X=_(k,e);l&&X&&!c.breakpoint&&(f=Z([...l,...X],g));if(c.childbirth){const e=l?l[0]:b(c.time),n=l?l[1]:m(s).top,o=n+$/2,r=Z([e,n,e,o],g);u.push(r);const a=t([e,o],{value:String(c.childbirth),...i,...E,backgroundColor:"#fff"});u.push(a)}const A=a[d-1],C={origin:{data:c,title:x,key:y||"",dataIndex:r,index:d},leftLine:A,rightLine:f,...v,...P(),...n};l&&(A||(C.leftLine=null),h=o(j,{left:l[0],top:l[1],...C}));f&&a.push(f),h&&(!function(e){F.hovered&&(e.on("mouseover",(()=>{!function(e,t="moving"){const{title:i,key:n,data:o}=e.origin;w.point={x:e.left,y:e.top},w.list=[`${i} ${"hover"===t?o.value:S(n,e.top)}`,`时间 ${L(e.left).slice(-5)}`],w.show=!0}(e,"hover")})),e.on("mouseout",(()=>{w.show=!1})))}(h),s.push(h),Q.add(h))}(_(l,e),l,c)})),Promise.all(s).then((e=>{A(e),Promise.all(u).then((t=>{v.value.add(...a,...e,...t),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function Z([t,i,o,r],l){return new e.Polyline([{x:t,y:i},{x:o,y:i},{x:o,y:r}],{...l,fill:"transparent",...n})}function _(e,t){if(d(e)&&ee(e.time)){const i=b(e.time),n=j(t.key,t.range,e.value);return[i,n<Y?Y:n>V?V:n]}}function ee(e){var t,i;const n=(null==(i=null==(t=null==C?void 0:C.time)?void 0:t.range)?void 0:i[1])||20,o=B+60*n*60*1e3,r=h(e);return r>=B&&r<=o}return r(v,g),function(){const t=new e.Rect({...D,width:W-G,height:V-Y,left:G,top:Y,fill:"transparent"});v.value.add(t)}(),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:A,lineXSub:P,textLeft:C}=s(y,c,p);k.forEach(((e,t)=>{const i=V-t*$*b;!j||(0===t||t===X-1)&&!L||S.push(a(String(e),o,C,i)),E.push(...u(o,t,A,P,i,$,Y,X,1))}));const T=t([c+l,Y+(V-Y)/2],{value:String(m+"("+x+")"),...i,originX:"center",angle:-90,...g}),G=new e.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}=C.time;if(o){const o=[],c=$/2;f(r,u).forEach(((e,n)=>{const r="top"===l?Y-c:V+O+c;o.push(t([G+n*N*a,r],{value:0===n?"Admission":String(e),...i,...s}))}));const d=new e.Group(o,{objectCaching:!1,...n});v.value.add(d),v.value.sendToBack(d)}!function(){if((null==J?void 0:J.length)>0){const e=[];J.forEach((n=>{const o=b(n),r=V+O;e.push(t([o,r],{value:String(n.slice(11,16)),...i,originY:"bottom"}))})),v.value.add(...e)}}()}(),function(){var e;const{alertLineList:n=[],alertLineTitle:o=(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.227"))||"入院时宫颈扩张不同情况"}=I;if(n.length<1)return;const r=t([W,0],{value:o,...i,originX:"right",originY:"top"});v.value.add(r),n.forEach((e=>{const{style:i,data:n=[]}=e;if(n.length<1)return;const o=[],r=K.find((e=>"cervix"===e.key));n.map((e=>({...e,time:B+60*e.time*60*1e3}))).forEach(((e,n,l)=>{const s=_(e,r),a=_(l[n+1],r);s&&!a&&o.push(t([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 e;Q.size&&(null==(e=v.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)})),t}([...Q]))),Q.clear(),U()}}}export{v as useNewBirthProcess};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as t,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"../useShadow.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"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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:A,getPointEventProps:P}=c(v,x,g),{xAxis:C,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:O,canvasHeight:R,extraTimeXAxisList:J}=g,K=p(q),Q=new Set;function U(){K.filter((e=>e.show)).forEach(((e,r)=>{var l;const s=[],a=[],u=[];null==(l=e.data)||l.forEach(((l,c)=>{!function(l,c,d){if(!l&&!c.childbirth||!(null==c?void 0:c.time)||!ee(c.time))return;let h,f;const{pointAttr:v={},lineAttr:g={},title:x="",key:y,type:j="circle",childbirthStyle:E={}}=e,k=p(e.data[d+1]);k&&!k.value&&k.childbirth&&(k.value=c.value);const X=_(k,e);l&&X&&!c.breakpoint&&(f=Z([...l,...X],g));if(c.childbirth){const e=l?l[0]:b(c.time),n=l?l[1]:m(s).top,o=n+$/2,r=Z([e,n,e,o],g);u.push(r);const a=t([e,o],{value:String(c.childbirth),...i,...E,backgroundColor:"#fff"});u.push(a)}const A=a[d-1],C={origin:{data:c,title:x,key:y||"",dataIndex:r,index:d},leftLine:A,rightLine:f,...v,...P(),...n};l&&(A||(C.leftLine=null),h=o(j,{left:l[0],top:l[1],...C}));f&&a.push(f),h&&(!function(e){F.hovered&&(e.on("mouseover",(()=>{!function(e,t="moving"){const{title:i,key:n,data:o}=e.origin;w.point={x:e.left,y:e.top},w.list=[`${i} ${"hover"===t?o.value:S(n,e.top)}`,`时间 ${L(e.left).slice(-5)}`],w.show=!0}(e,"hover")})),e.on("mouseout",(()=>{w.show=!1})))}(h),s.push(h),Q.add(h))}(_(l,e),l,c)})),Promise.all(s).then((e=>{A(e),Promise.all(u).then((t=>{v.value.add(...a,...e,...t),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function Z([t,i,o,r],l){return new e.Polyline([{x:t,y:i},{x:o,y:i},{x:o,y:r}],{...l,fill:"transparent",...n})}function _(e,t){if(d(e)&&ee(e.time)){const i=b(e.time),n=j(t.key,t.range,e.value);return[i,n<Y?Y:n>V?V:n]}}function ee(e){var t,i;const n=(null==(i=null==(t=null==C?void 0:C.time)?void 0:t.range)?void 0:i[1])||20,o=B+60*n*60*1e3,r=h(e);return r>=B&&r<=o}return r(v,g),function(){const t=new e.Rect({...D,width:W-G,height:V-Y,left:G,top:Y,fill:"transparent"});v.value.add(t)}(),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:A,lineXSub:P,textLeft:C}=s(y,c,p);k.forEach(((e,t)=>{const i=V-t*$*b;!j||(0===t||t===X-1)&&!L||S.push(a(String(e),o,C,i)),E.push(...u(o,t,A,P,i,$,Y,X,1))}));const T=t([c+l,Y+(V-Y)/2],{value:String(m+"("+x+")"),...i,originX:"center",angle:-90,...g}),G=new e.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}=C.time;if(o){const o=[],c=$/2;f(r,u).forEach(((e,n)=>{const r="top"===l?Y-c:V+O+c;o.push(t([G+n*N*a,r],{value:0===n?"Admission":String(e),...i,...s}))}));const d=new e.Group(o,{objectCaching:!1,...n});v.value.add(d),v.value.sendToBack(d)}!function(){if((null==J?void 0:J.length)>0){const e=[];J.forEach((n=>{const o=b(n),r=V+O;e.push(t([o,r],{value:String(n.slice(11,16)),...i,originY:"bottom"}))})),v.value.add(...e)}}()}(),function(){var e;const{alertLineList:n=[],alertLineTitle:o=(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.227"))||"入院时宫颈扩张不同情况"}=I;if(n.length<1)return;const r=t([W,0],{value:o,...i,originX:"right",originY:"top"});v.value.add(r),n.forEach((e=>{const{style:i,data:n=[]}=e;if(n.length<1)return;const o=[],r=K.find((e=>"cervix"===e.key));n.map((e=>({...e,time:B+60*e.time*60*1e3}))).forEach(((e,n,l)=>{const s=_(e,r),a=_(l[n+1],r);s&&!a&&o.push(t([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 e;Q.size&&(null==(e=v.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)})),t}([...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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{useNewBirthProcess as n}from"./useNewBirthProcess.js";function d(d,v,c,m,h,p){const x=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)))),j=a((()=>{var e;return null==(e=g.value)?void 0:e.reduce(((e,a)=>e+=a.width),0)})),w=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)})),b=a((()=>v.data.grid.mainXCell||20)),y=a((()=>v.data.grid.mainYCell||8)),A=a((()=>(w.value-j.value)/b.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,b.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}})),O=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:j.value,endX:w.value,originY:C.value,endY:S.value,xCellWidth:A.value,yCellHeight:M.value,gridXNumber:b.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,O,c,h);x.value=e}()}),{immediate:!0}),{propItems:O,redrawPoints:x}}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 s}from"../../utils/index.js";import{range as u,last as o}from"lodash-es";import"../useEvent.js";import"../useShadow.js";import"../useCommon.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{useNewBirthProcess as n}from"./useNewBirthProcess.js";function d(d,v,c,m,h,p){const x=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)))),j=a((()=>{var e;return null==(e=g.value)?void 0:e.reduce(((e,a)=>e+=a.width),0)})),w=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)})),b=a((()=>v.data.grid.mainXCell||20)),y=a((()=>v.data.grid.mainYCell||8)),A=a((()=>(w.value-j.value)/b.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((()=>s(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=>s(e.time))),i=Math.min(...l);let n=Math.min(Math.max(...l));const d=H.value*A.value,v=u(1,b.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}})),O=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:j.value,endX:w.value,originY:C.value,endY:S.value,xCellWidth:A.value,yCellHeight:M.value,gridXNumber:b.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,O,c,h);x.value=e}()}),{immediate:!0}),{propItems:O,redrawPoints:x}}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{getIndex as s,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as f,filter as d,last as p,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as g}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"./useOther.js";import"../../../../../shared/utils/index.js";import{useIntervalFn as y}from"@vueuse/core";function h(h,x,k,w,L,P){const{computedX:b,computedY:C,getXValue:A,getYValue:j}=l(x),{xCellWidth:I,pointSelectionStyle:E,originX:K,endX:M,originY:X,endY:V,event:Y,scaleValues:T,xAxis:O,startTime:S,timeXCell:D,itemList:F,dialog:$,topGridOriginY:z,topGridEndY:B,extraMenuConfig:G}=x,N=new Map,_=new Set;let J=f(T),q=[],R=null;const W=new Set;o(h,x);const{getEqualXTypes:H,handleAddPrevent:Q,setPrevAndNextPoint:U,getPointEventProps:Z}=r(h,k,x),{pause:ee,resume:te}=y((()=>{!function(){if(!W.size)return;for(const e of W)e.set("opacity",1===e.opacity?.5:1);h.value.renderAll()}()}),800);function ne(){J.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=C(t.type,t.range,i),r=n([K,a,M,a],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});Y.hovered&&o&&(r.on("mousemove",(({pointer:e})=>{w.point={...e||{x:r.left,y:r.top}},w.list=[`${o} ${i}${t.unit||""}`],w.show=!0})),r.on("mouseout",(()=>{w.show=!1}))),h.value.add(r)}r(i),r(o),r(l),r(a)}(t,e),ae(t,i,e))}))}))}function ie(e=[]){if(!(null==R?void 0:R.areaPos))return[];const{startPos:t,endPos:n}=R.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:ve()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=a))}function oe(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:(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(),le()},onNegativeClick:()=>le(),onClose:()=>le()})}function le(){R&&h.value.remove(R),R=null}function ae(e,t,o){var l;const{type:a,unit:r,dataList:s=[]}=o,u=[];N.set(e.key,[]),function(e,t){W.size&&[...W].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&W.delete(n)}))}(a,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,f){var d;let v,g,y=f;l.key&&(y=s.find((e=>e.key===l.key)));const{pointAttr:x={},lineAttr:L={},title:P="",key:b,type:C="circle"}=y,E=me(f.list[c+1],o);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(g=n([...e,...E],L));const K=u[c-1],M={origin:{data:l,title:P,key:f.key,selfKey:b,unit:r,type:a,dataIndex:t,index:c,lineAttr:L},__type:"main",leftLine:K,rightLine:g,...x,...Z()};e&&(K||(M.leftLine=null),v=i(C,{left:e[0],top:e[1],...M}));u.push(g),v&&(v.originLeft=v.left,v.originTop=v.top,function(e){Y.hovered&&(e.on("mouseover",(()=>{de(e,"hover")})),e.on("mouseout",(()=>{w.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{pe(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),Y.hovered&&de(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===q.length){se(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(q.every((e=>e.left!==f))){const t=A(f),n=j(u.type,s);q.push({data:{time:t,value:n,...u.selfKey!==u.key?{key:u.selfKey}:{}},left:f,top:s}),se(e,[...e.prevPointer,f,s])}if(q.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=q.some((e=>Math.abs(e.left-t)<=1));if(!a){let l=0;const a=q.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(a){const r=JSON.parse(JSON.stringify(a)),s=q[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:A(t),value:j(o.type,r.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},q.splice(l,0,r),se(e,[s.left,s.top,r.left,r.top])}}l++}}(e,c),e.nextPoint){const t=N.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?re(e,"#999"):re(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(q.length>0&&i<q[q.length-1].left){for(const e of _)e.left>i&&(e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e));if(q=q.filter((e=>e.left<=i)),0===q.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of _)e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e)}if(q.length>0){const t=p(q);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(w.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:A(e.left),value:j(t,e.top)}};if(h.value.discardActiveObject(),q.length>0){const l=J.find((e=>e.type===t));let a=-1;const r=q.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void ce({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}),ue({...o,data:r,coincideIndex:a})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),ue(o,"change")}}))}(v),null==(d=N.get(f.key))||d.push(v))}(me(l,o),l,c,e)})),Promise.all(N.get(e.key)).then((t=>{const n=u.filter((e=>e));U(t),h.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||W.add(e)}))}a(n,"max"),a(i,"min"),a(o,"max"),a(l,"min")}(t,e)}))}function re(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 se(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,_.add(l),h.value.add(a,l)}))}function ue(e,t="add",n=1){const{data:i,index:o,key:l,type:a,coincideIndex:r,linkKey:u}=e;let{dataIndex:c}=e;const f=J.find((e=>e.type===a)),d=f.dataList.find(((e,t)=>{c=t;const n=u||l;return e.key===n}));switch(t){case"remove":d.list.splice(o,n),d.list[o-1]&&(d.list[o-1].breakpoint=!0);break;case"change":d.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=s(e,d.list,!0),n=Array.isArray(i)?i:[i];d.list.splice(t,r>-1?r-t+1:0,...n);break}}ce({dataIndex:c,scaleValue:f})}function ce(e){var t,n,i;if(_.size&&(null==(t=h.value)||t.remove(...fe([..._]))),_.clear(),q=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=h.value)||n.remove(...fe(N.get(o.key))),N.delete(o.key),ae(o,t,i)}else J=f(T),N.size&&(null==(i=h.value)||i.remove(...fe(ve()))),N.clear(),ne()}function fe(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function de(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:a}=e.origin;w.point={x:e.left,y:e.top};const r=A(e.left),s=`${"hover"===t?o.value:j(i,e.top)}`;w.list=[`${n} ${s}${l||""}`,`时间 ${r.slice(-5)}`],w.sourceData=[{type:i,title:n,unit:l,key:a,time:r,value:s}],w.isTarget=!0,w.show=!0}function pe(e,t=M){e.setCoords();const n=6e4/D,i=e.prevPoint?e.prevPoint.left+n:K;e.top<X&&e.set("top",X),e.top>V&&e.set("top",V),e.left<i&&e.set("left",i),e.left>t&&e.set("left",t)}function me(e,t){if(u(e)&&function(e){const t=Date.parse(p(O.list)),n=c(e);return n>=S&&n<=t}(e.time)){const n=b(e.time),i=C(t.type,t.range,e.value);return[n,i<X?X:i>V?V:i]}}function ve(){return v(Array.from(N.values()))}return ne(),function(){if(!Y.evented)return;let n=!1,i={x:0,y:0};h.value.on("mouse:up",(e=>{if(3===e.button&&function(e){w.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=M&&n>=X&&n<=V)if(e.target){if("main"!==e.target.__type)return;const t=e.target;i({x:t.left,y:t.top},e.target,[]),L.list=d(g,(e=>"edit"!==e.type)).map((e=>({...e,renderItem:()=>e.label,type:e.key||e.type,pointer:{x:t.left,y:t.top},..."add"===e.type?{}:{origin:{...t.origin}}})))}else{i(e.pointer,null,[]);const{menuList:t=[]}=G;L.list=d(g,(e=>"add"===e.type)).concat(t).map((t=>({...t,renderItem:()=>t.label,type:t.key||t.type,pointer:e.pointer})))}function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=ie();e.length>0?oe((()=>{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 ue(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);k("remove",t)})):a.emit(R)}})),h.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,i=e.pointer)})),h.value.on("mouse:move",(o=>{if(function(e){if(!P||L.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;w.movable=!1,(i<K||i>M)&&(w.show=!1);if(!t&&i>=K&&i<=M){const e=o>=X&&o<=V,l=o>=z&&o<=B;if(e||l){const l=A(i);w.sourceData=e?J.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:j(t,o)}})):[{type:"tree",time:l}],w.isTarget=!!t,w.point=n,w.movable=!0}else w.show=!1}}(o),!n)return;const{x:l,y:a}=i,{x:r,y:s}=o.pointer;R&&h.value.remove(R),R=new e.Rect({...t,fill:"#CAF982",opacity:.4,...E,left:l>r?r:l,top:a>s?s:a,width:Math.abs(r-l),height:Math.abs(s-a),objectCaching:!0}),R.areaPos={startPos:i,endPos:o.pointer},h.value.add(R)}))}(),{redrawPoints:ce,clickMenu:function({item:e,target:t}){var n;const{type:i,origin:o,pointer:l}=e,a={...o};o||Object.assign(a,{data:{time:A(l.x)},type:null}),d(g,(e=>"edit"!==e.type)).map((e=>e.type)).includes(i)?("remove"===i&&ue(a,"remove"),k(i,a)):null==(n=G.click)||n.call(G,i,a)},moveLimit:pe,setPopup:de,updateData:ue,getGridPoints:ve,getContainPoints:ie,showDialog:oe,removeCurrentSelection:le,pauseFlickerPoint:ee}}export{h as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as i}from"../useDraw.js";import{useGrid as o}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import"../useShadow.js";import{useCommon as a}from"../useCommon.js";import"vue";import{nearlyEqual as s,getIndex as f,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as d,filter as p,last as m,omit as g,flatten as v}from"lodash-es";import"date-fns";import{OTHER_MENU as y}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"./useOther.js";import"../../../../../shared/utils/index.js";import{useIntervalFn as h}from"@vueuse/core";function x(x,k,L,w,P,b){const{computedX:A,computedY:C,getXValue:j,getYValue:I}=l(k),{xCellWidth:M,pointSelectionStyle:E,originX:K,endX:X,originY:V,endY:Y,event:T,scaleValues:O,xAxis:S,startTime:D,timeXCell:F,itemList:$,dialog:z,topGridOriginY:B,topGridEndY:G,extraMenuConfig:N}=k,_=new Map,J=new Set;let q=d(O),R=[],W=null;const H=new Set;o(x,k);const{getEqualXTypes:Q,handleAddPrevent:U,setPrevAndNextPoint:Z,getPointEventProps:ee}=a(x,L,k),{pause:te,resume:ne}=h((()=>{!function(){if(!H.size)return;for(const e of H)e.set("opacity",1===e.opacity?.5:1);x.value.renderAll()}()}),800);function ie(){q.forEach((e=>{const{range:t=[],spaceValue:i}=e;i&&(t[0]||t[1])&&e.dataList.forEach(((t,i)=>{t.show&&(!function(e,t){const{max:i={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:i,name:o,lineStyle:l}){if(!e||!i)return;const r=C(t.type,t.range,i),a=n([K,r,X,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{w.point={...e||{x:a.left,y:a.top}},w.list=[`${o} ${i}${t.unit||""}`],w.show=!0})),a.on("mouseout",(()=>{w.show=!1}))),x.value.add(a)}a(i),a(o),a(l),a(r)}(t,e),ae(t,i,e))}))}))}function oe(e=[]){if(!(null==W?void 0:W.areaPos))return[];const{startPos:t,endPos:n}=W.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:ve()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function le(e){var t,n,i,o;z.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.27"))||"确定",negativeText:(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.28"))||"取消",onPositiveClick:()=>{e(),re()},onNegativeClick:()=>re(),onClose:()=>re()})}function re(){W&&x.value.remove(W),W=null}function ae(e,t,o){var l;const{type:r,unit:a,dataList:f=[]}=o,u=[];_.set(e.key,[]),function(e,t){H.size&&[...H].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&H.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,d){var p;let v,y,h=d;l.key&&(h=f.find((e=>e.key===l.key)));const{pointAttr:k={},lineAttr:P={},title:b="",key:A,type:C="circle"}=h,E=ge(d.list[c+1],o);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(y=n([...e,...E],P));const K=u[c-1],X={origin:{data:l,title:b,key:d.key,selfKey:A,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:K,rightLine:y,...k,...ee()};e&&(K||(X.leftLine=null),v=i(C,{left:e[0],top:e[1],...X}));u.push(y),v&&(v.originLeft=v.left,v.originTop=v.top,function(e){T.hovered&&(e.on("mouseover",(()=>{pe(e,"hover")})),e.on("mouseout",(()=>{w.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{me(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),T.hovered&&pe(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:f,origin:u}=e,c=~~(Math.abs(a-l)/M),d=a>l;if(Math.abs(a-l)>M){if(0===R.length){let a=e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r];d||(a=e.rightLine?[e.rightLine.x2,e.rightLine.y2]:[l,r]),fe(e,[...a,l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const p=M*c,m=d?l+p:l-p;if(R.every((e=>!s(e.left,m)))){const t=j(m),n=I(u.type,f);R.push({data:{time:t,value:n,...u.selfKey!==u.key?{key:u.selfKey}:{}},left:m,top:f}),fe(e,[...e.prevPointer,m,f],d)}if(R.length<c&&function(e,t,n=!0){const{originLeft:i,originTop:o,origin:l}=e;let r=1;for(;r<=t;){const t=M*r,a=n?i+t:i-t,s=R.some((e=>Math.abs(e.left-a)<=1));if(!s){let t=0;const r=R.find(((e,i)=>n?(e.left>a&&(t=i),e.left>a):(e.left<a&&(t=i),e.left<a)));if(r){const s=JSON.parse(JSON.stringify(r)),f=R[t-1]||{left:i,top:o},u=~~(Math.abs(r.left-(n?a-M:a+M))/M),c=(r.top-f.top)/u;s.top=f.top+c,s.left=a,s.data={time:j(a),value:I(l.type,s.top),...l.selfKey!==l.key?{key:l.selfKey}:{}},R.splice(t,0,s),fe(e,[f.left,f.top,s.left,s.top],n)}}r++}}(e,c,d),d&&e.nextPoint||!d&&e.prevPoint){const t=_.get(u.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=M/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{s(e.left,l)||u.index===e.origin.index||(d&&e.left>l&&e.left<a||!d&&e.left<l&&e.left>a?se(e,"#999"):se(e,e.origin.lineAttr.stroke))}))}}!function(e,t=!0){var n,i,o,l;const{left:r,originLeft:a}=e;if((null==R?void 0:R.length)>0){for(const e of J)(t&&(e.left>r||e.left<a)||!t&&(e.left<r||e.left>a))&&(e.left<r||e.left>a)&&(e.leftLine&&x.value.remove(e.leftLine),e.rightLine&&x.value.remove(e.rightLine),x.value.remove(e));if(R=R.filter((e=>t&&e.left<=r&&e.left>a||!t&&e.left>=r&&e.left<a)),0===R.length){null==(i=null==(n=e.leftLine)?void 0:n.set)||i.call(n,e.prevPoint.origin.lineAttr),null==(l=null==(o=e.rightLine)?void 0:o.set)||l.call(o,e.origin.lineAttr);for(const e of J)e.leftLine&&x.value.remove(e.leftLine),x.value.remove(e)}if(R.length>0){const t=m(R);e.prevPointer=[t.left,t.top]}}}(e,d)}(e)})),e.on("mouseup",(t=>{if(w.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:j(e.left),value:I(t,e.top)}};if(x.value.discardActiveObject(),R.length>0){const l=q.find((e=>e.type===t));let r=-1;const a=m(R).left>e.originLeft,s=R.map((e=>e.data));if(a&&e.nextPoint||!a){if(2.5!==e.scaleX)return void ce({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=s.findIndex((e=>e.time===n.time));o>-1&&s.splice(o,1),a||(s.reverse(),r=e.origin.index)}const f=l.dataList.findIndex((e=>e.key===n));L("add",{...g(o,["index","selfKey","lineAttr"]),dataIndex:f,key:n,data:s}),ue({...o,data:s,coincideIndex:r})}else L("change",{...g(o,["selfKey","lineAttr"]),key:n}),ue(o,"change")}}))}(v),null==(p=_.get(d.key))||p.push(v))}(ge(l,o),l,c,e)})),Promise.all(_.get(e.key)).then((t=>{const n=u.filter((e=>e));Z(t),x.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||H.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function se(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&&![t,"transparent"].includes(e.rightLine.stroke)&&e.rightLine.set("stroke",t)}function fe(e,t,i=!0){const[o,,l,r]=t;e.clone((a=>{a.set({left:l,top:r,scaleX:1,scaleY:1}),e.prevPointer=[l,r];const f=n(t,e.leftLine&&s(o,e.leftLine.x1)?e.prevPoint.origin.lineAttr:e.origin.lineAttr);i?a.leftLine=f:a.rightLine=f,J.add(a),x.value.add(f,a)}))}function ue(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a,linkKey:s}=e;let{dataIndex:u}=e;const c=q.find((e=>e.type===r)),d=c.dataList.find(((e,t)=>{u=t;const n=s||l;return e.key===n}));switch(t){case"remove":d.list.splice(o,n),d.list[o-1]&&(d.list[o-1].breakpoint=!0);break;case"change":d.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=f(e,d.list,!0),n=Array.isArray(i)?i:[i];d.list.splice(t,a>-1?a-t:0,...n);break}}ce({dataIndex:u,scaleValue:c})}function ce(e){var t,n,i;if(J.size&&(null==(t=x.value)||t.remove(...de([...J]))),J.clear(),R=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=x.value)||n.remove(...de(_.get(o.key))),_.delete(o.key),ae(o,t,i)}else q=d(O),_.size&&(null==(i=x.value)||i.remove(...de(ve()))),_.clear(),ie()}function de(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 pe(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:r}=e.origin;w.point={x:e.left,y:e.top};const a=j(e.left),s=`${"hover"===t?o.value:I(i,e.top)}`;w.list=[`${n} ${s}${l||""}`,`时间 ${a.slice(-5)}`],w.sourceData=[{type:i,title:n,unit:l,key:r,time:a,value:s}],w.isTarget=!0,w.show=!0}function me(e,t=X){e.setCoords();const n=K;e.top<V&&e.set("top",V),e.top>Y&&e.set("top",Y),e.left<n&&e.set("left",n),e.left>t&&e.set("left",t)}function ge(e,t){if(u(e)&&function(e){const t=Date.parse(m(S.list)),n=c(e);return n>=D&&n<=t}(e.time)){const n=A(e.time),i=C(t.type,t.range,e.value);return[n,i<V?V:i>Y?Y:i]}}function ve(){return v(Array.from(_.values()))}return ie(),function(){if(!T.evented)return;let n=!1,i={x:0,y:0};x.value.on("mouse:up",(e=>{if(3===e.button&&function(e){w.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=X&&n>=V&&n<=Y)if(e.target){if("main"!==e.target.__type)return;const t=e.target;i({x:t.left,y:t.top},e.target,[]),P.list=p(y,(e=>"edit"!==e.type)).map((e=>({...e,renderItem:()=>e.label,type:e.key||e.type,pointer:{x:t.left,y:t.top},..."add"===e.type?{}:{origin:{...t.origin}}})))}else{i(e.pointer,null,[]);const{menuList:t=[]}=N;P.list=p(y,(e=>"add"===e.type)).concat(t).map((t=>({...t,renderItem:()=>t.label,type:t.key||t.type,pointer:e.pointer})))}function i(e,t,n){Object.assign(P,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=oe();e.length>0?le((()=>{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 ue(n[0],"remove",n.length),n.map((e=>({...g(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);L("remove",t)})):r.emit(W)}})),x.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,i=e.pointer)})),x.value.on("mouse:move",(o=>{if(function(e){if(!b||P.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;w.movable=!1,(i<K||i>X)&&(w.show=!1);if(!t&&i>=K&&i<=X){const e=o>=V&&o<=Y,l=o>=B&&o<=G;if(e||l){const l=j(i);w.sourceData=e?q.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:I(t,o)}})):[{type:"tree",time:l}],w.isTarget=!!t,w.point=n,w.movable=!0}else w.show=!1}}(o),!n)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;W&&x.value.remove(W),W=new e.Rect({...t,fill:"#CAF982",opacity:.4,...E,left:l>a?a:l,top:r>s?s:r,width:Math.abs(a-l),height:Math.abs(s-r),objectCaching:!0}),W.areaPos={startPos:i,endPos:o.pointer},x.value.add(W)}))}(),{redrawPoints:ce,clickMenu:function({item:e,target:t}){var n;const{type:i,origin:o,pointer:l}=e,r={...o};o||Object.assign(r,{data:{time:j(l.x)},type:null}),p(y,(e=>"edit"!==e.type)).map((e=>e.type)).includes(i)?("remove"===i&&ue(r,"remove"),L(i,r)):null==(n=N.click)||n.call(N,i,r)},moveLimit:me,setPopup:pe,updateData:ue,getGridPoints:ve,getContainPoints:oe,showDialog:le,removeCurrentSelection:re,pauseFlickerPoint:te}}export{x as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as i,defaultRectStyle as e,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{isEffectiveNode as d,getScaleNumberList as g}from"../../utils/index.js";import{cloneDeep as h,omit as m,last as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"@vueuse/core";import"./useOther.js";import"../../../../../shared/utils/index.js";function f(f,p,y,k,v,j,x,w){const{getYValue:E,getXValue:X,computedX:b}=s(p),{getEqualXTypes:K,handleAddPrevent:R,isGridLimit:W}=u(f,y,p),{originY:C,endY:S,borderStyle:Y,left:L,itemList:M,scaleValues:N,originX:P,endX:T,yCellHeight:V,markHeight:G,canvasWidth:H,canvasHeight:A,xCellWidth:$}=p;!function(){if(!L)return;const{title:t,titleWidth:e,titleStyle:o}=L,n=i({width:e,height:S-C+G,...Y},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);f.value.add(n)}(),N.forEach(((i,e)=>{var o,s;const{range:u,spaceValue:d,title:h,unit:m,titleStyle:p,spaceGridNumber:y=1,showNumber:k,showMaxMinNumber:v,titleMargin:j=[5,30],margin:x=5}=i,w="left"===i.layout?P-x:T+x,E=[],X=g(u,d),b=X.length;X.forEach(((t,e)=>{const o=0===e?S-5:S-e*V*y;!k||(0===e||e===b-1)&&!v||E.push(a(String(t),{...i,position:i.layout},w,o))}));const K="left"===i.layout?"right":"left",R=(h||m)&&n(["left"===i.layout?P-j[0]:T+j[0],(null!=(s=null==(o=c(E))?void 0:o.top)?s:330)-V-j[1]],{value:`${h}${m?"\n"+m:""}`,...r,...p,textAlign:K,originX:K,originY:"bottom"}),W=new t.Group([...E,...R?[R]:[]],{objectCaching:!1,...l});f.value.add(W),W.sendToBack()})),function(){const i=new t.Rect({width:P-L.titleWidth,height:S-C+G,left:L.titleWidth,top:C,...e,originX:"left",originY:"top",...Y});f.value.add(i);const n=h(M);n.forEach((t=>{var i;const e=t.linkKey?null==(i=n.find((i=>i.key===t.linkKey)))?void 0:i.list:t.list;let o=P;e.find((t=>{let i=!1;if(d(t)){const e=b(t.time);i=e>=P&&e<=T,i&&(o=e)}return i})),t.limitRight=o-$}));const r=h(L.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:s=20}=L;let a=S+G-l[0];const u=s+l[1],g=[];r.concat(n.reverse()).forEach((t=>{a-=10;const i=t.title,{text:e,icon:n}=o(i,t,{text:{left:u,top:a},icon:{leftX:u,topY:a,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey,limitRight:t.limitRight}}});var r;a-=e.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),W(r)?(v(r,r.origin.limitRight),j(r)):k.show=!1})),r.on("mouseup:before",(t=>{if(k.show=!1,0===t.e.button&&W(r)){v(r,r.origin.limitRight);const t=r.origin.linkKey||r.origin.key;if(K(w(),r.left,"key",$).includes(t))R("repeat");else{const i={data:{time:X(r.left),value:E(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin},e=r.left-$;r.linkPoints.forEach((t=>{t.origin.limitRight=e})),y("add",m(i,["limitRight"])),x({...i,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),!t.isExternal&&g.push(n),f.value.add(e,n)})),g.forEach((t=>{const{linkKey:i,key:e}=t.origin,o=g.filter((t=>i?t.origin.key===i||t.origin.linkKey===i:t.origin.key===e||t.origin.linkKey===e));t.linkPoints=o}))}(),f.value.add(new t.Rect({left:0,top:0,width:H-Y.strokeWidth,height:A-Y.strokeWidth,fill:"transparent",...Y}))}export{f as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as i,defaultRectStyle as e,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"../useShadow.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{isEffectiveNode as g,getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as h,omit as c,last as m}from"lodash-es";import"date-fns";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"@vueuse/core";import"./useOther.js";import"../../../../../shared/utils/index.js";function f(f,p,y,k,v,j,x,w){const{getYValue:E,getXValue:X,computedX:b}=s(p),{getEqualXTypes:K,handleAddPrevent:R,isGridLimit:C}=u(f,y,p),{originY:W,endY:S,borderStyle:Y,left:H,itemList:L,scaleValues:M,originX:N,endX:P,yCellHeight:T,markHeight:V,extracorporealCirculationHeight:G,canvasWidth:A,canvasHeight:$,xCellWidth:q}=p;!function(){if(!H)return;const{title:t,titleWidth:e,titleStyle:o}=H,n=i({width:e,height:S-W+V+G,...Y},{value:t.split("").join("\n"),...o||{}},{left:0,top:W},!0);f.value.add(n)}(),M.forEach(((i,e)=>{var o,s;const{range:u,spaceValue:g,title:h,unit:c,titleStyle:p,spaceGridNumber:y=1,showNumber:k,showMaxMinNumber:v,titleMargin:j=[5,30],margin:x=5}=i,w="left"===i.layout?N-x:P+x,E=[],X=d(u,g),b=X.length;X.forEach(((t,e)=>{const o=0===e?S-5:S-e*T*y;!k||(0===e||e===b-1)&&!v||E.push(a(String(t),{...i,position:i.layout},w,o))}));const K="left"===i.layout?"right":"left",R=(h||c)&&n(["left"===i.layout?N-j[0]:P+j[0],(null!=(s=null==(o=m(E))?void 0:o.top)?s:330)-T-j[1]],{value:`${h}${c?"\n"+c:""}`,...r,...p,textAlign:K,originX:K,originY:"bottom"}),C=new t.Group([...E,...R?[R]:[]],{objectCaching:!1,...l});f.value.add(C),C.sendToBack()})),function(){const i=new t.Rect({width:N-H.titleWidth,height:S-W+V+G,left:H.titleWidth,top:W,...e,originX:"left",originY:"top",...Y});f.value.add(i);const n=h(L);n.forEach((t=>{var i;const e=t.linkKey?null==(i=n.find((i=>i.key===t.linkKey)))?void 0:i.list:t.list;let o=N;e.find((t=>{let i=!1;if(g(t)){const e=b(t.time);i=e>=N&&e<=P,i&&(o=e)}return i})),t.limitRight=o-q}));const r=h(H.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:s=20}=H;let a=S+V+G-l[0];const u=s+l[1],d=[];r.concat(n.reverse()).forEach((t=>{a-=10;const i=t.title,{text:e,icon:n}=o(i,t,{text:{left:u,top:a},icon:{leftX:u,topY:a,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey,limitRight:t.limitRight}}});var r;a-=e.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),C(r)?(v(r,r.origin.limitRight),j(r)):k.show=!1})),r.on("mouseup:before",(t=>{if(k.show=!1,0===t.e.button&&C(r)){v(r,r.origin.limitRight);const t=r.origin.linkKey||r.origin.key;if(K(w(),r.left,"key",q).includes(t))R("repeat");else{const i={data:{time:X(r.left),value:E(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin},e=r.left-q;r.linkPoints.forEach((t=>{t.origin.limitRight=e})),y("add",c(i,["limitRight"])),x({...i,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),!t.isExternal&&d.push(n),f.value.add(e,n)})),d.forEach((t=>{const{linkKey:i,key:e}=t.origin,o=d.filter((t=>i?t.origin.key===i||t.origin.linkKey===i:t.origin.key===e||t.origin.linkKey===e));t.linkPoints=o}))}(),f.value.add(new t.Rect({left:0,top:0,width:A-Y.strokeWidth,height:$-Y.strokeWidth,fill:"transparent",...Y}))}export{f as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i,drawLine as o}from"../useDraw.js";import{useBirthProcessCumputedPoint as n}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as l}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{filter as s,cloneDeep as d,omit as c,flatten as u}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as f}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"@vueuse/core";import"../../../../../shared/utils/index.js";const h=s(f,(t=>"add"!==t.type));function m(s,f,m,g,p,v,x,y,k){const{computedX:X,getXValue:P}=n(f),{getEqualXTypes:w,handleAddPrevent:b,isGridLimit:j,getPointEventProps:E}=l(s,m,f),{other:z,yCellHeight:A,xCellWidth:L,endX:C,originX:M,originY:T,endY:I,markHeight:S,event:H,topGridYCellHeight:Y}=f,W=new Map,V=d(z);function G(){var o;if(!(null==(o=null==V?void 0:V.horizontal)?void 0:o.length))return;const n="horizontal";W.set(n,[]);const{horizontal:r}=V;let l=T+A/2;r.forEach(((o,r)=>{const{title:a,type:s,pointAttr:d={},textStyle:c={},data:u,showIcon:f=!0}=o;let h=null;u.forEach(((o,u)=>{const{time:m,value:g}=o,p=X(m);if(!F(p))return;const v=[],x=f&&e(s,{...d,left:p,top:l});x&&v.push(x);const y=f?p+x.width/2+2:p,k=i([y,l],{value:g,...c,originX:"left"});v.push(k);const P=new t.Group(v,{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...E()});Object.assign(P,{originLeft:p,iconHalfWidth:x?x.width/2:0,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:a},limitX:{x1:M,x2:C-P.width}}),h&&(P.limitX.x1=h.left,h.limitX.x2=P.left,P.prevPoint=h,h.nextPoint=P),h=P,B(P),W.get(n).push(P)})),l+=A})),s.value.add(...W.get(n))}function O(){var t;if(!(null==(t=null==V?void 0:V.vertical)?void 0:t.length))return;const i="vertical";W.set(i,[]);const{vertical:o}=V;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:l={},data:a,time:s}=t,d=X(s);if(!n||!F(d))return;const{lineHeight:c=A}=l;let u=T+r+c/2;a.forEach(((t,n)=>{const r=e(String(t),{...l,lockMovementY:!0,left:d,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...E()});u+=c,B(r),W.get(i).push(r)}));const f=W.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),m=d>C-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")}))})),s.value.add(...W.get(i))}function D(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=V[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}}_(t)}function _(t){var e;const{key:i}=t;switch(null==(e=s.value)||e.remove(...W.get(i)),W.delete(i),i){case"horizontal":G();break;case"vertical":O();break;case"mark":q()}}function q(){if(!(null==z?void 0:z.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=z.mark,l=i([M-5,I+S/2],{value:t,...o,originX:"right"});s.value.add(l);const a=I+S,d=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=X(i);if(!F(r))return;let l=I;o.forEach((t=>{const{style:i}=t;let o=!1;const c=e((null==i?void 0:i.type)||"circleAndText",{...(null==i?void 0:i.pointAttr)||n,text:t.text,left:r,top:l,origin:{data:t,key:"mark",type:"other"}}),u=c.height;l+u<=a&&l>=I?(c.set("top",l+u/2),l+=u):(o||(l=I,o=!0),c.set("top",l-u/2),l-=u),d.push(c),B(c),s.value.add(c)}))})),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:M,x2:C};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(d)}function B(t){if(H.hovered&&(t.on("mouseover",(()=>{$(t)})),t.on("mouseout",(()=>{g.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<T&&t.set("top",T);const e=I+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(v(t),function(t){const e=t.left+t.maxTextWidth>C?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),H.hovered&&$(t)})),t.on("mouseup",(n=>{var r;if(g.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=P(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};s.value.discardActiveObject(),m("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(p.point={x:t.left,y:t.top},p.show=!0,p.target=t,p.list=h.map((t=>({...t,renderItem:()=>t.label,_type:"other"}))))}))}function $(t){g.isTarget=!0,g.show=!0;const{key:e,data:i={}}=t.origin||{};let o=i.value;g.point={x:t.left,y:"mark"===e?t.top:t.top+Y/2};const n=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,r=P(n);g.list=[`时间 ${r.slice(-5)}`],"mark"===e&&(o=i.name,g.list.unshift(o+" ")),g.sourceData=[{type:"other",key:e,time:r,value:o}]}function F(t){return t>=M&&t<=C}return function(){if(!(null==z?void 0:z.longLine)||!z.longLine.time)return;const{time:t,style:e}=z.longLine,i=X(t),n=o([i,0,i,I],e);s.value.add(n)}(),function(){var t;if(!(null==(t=null==V?void 0:V.horizontal)?void 0:t.length))return;const{horizontal:i}=V,o=M-5;let n=T+A/2;i.forEach(((t,i)=>{const{title:r,titleStyle:l={},defaultAddValue:a}=t,d=r&&e(r,{...l,originX:"right",left:o,top:n,origin:{defaultAddValue:a,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var u;(u=d).on("moving",(()=>{u.set("originX","center"),j(u)?$(u):g.show=!1})),u.on("mouseup:before",(t=>{if(g.show=!1,0===t.e.button&&j(u))if(w(W.get("horizontal"),u.left,"key",L).includes(u.origin.key))b("repeat"),console.log("重复节点");else{const t={data:{time:P(u.left),value:u.origin.defaultAddValue},...u.origin};m("add",c(t,["isMenu"])),D(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),s.value.add(d),n+=A}))}(),G(),O(),q(),r.on((()=>{const t="horizontal",e=x(W.get(t));e.length>0?y((()=>{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 u(Object.keys(e).map((t=>{const i=e[t];return V.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);_({key:t}),m("remove",i)})):k()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i,_type:o}=t,n={...e.origin,type:o};m(i,n),"remove"===i&&D(n,i)}}}export{m as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as o,drawLine as i,defaultLineStyle as n}from"../useDraw.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useShadow as l}from"../useShadow.js";import{useCommon as s}from"../useCommon.js";import"vue";import{getIndex as c}from"../../utils/index.js";import{filter as u,cloneDeep as d,omit as f,flatten as h}from"lodash-es";import{format as m}from"date-fns";import{OTHER_MENU as p}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"@vueuse/core";import"../../../../../shared/utils/index.js";const g=u(p,(t=>"add"!==t.type));function x(u,p,x,v,y,k,C,w,X){const{computedX:A,getXValue:b}=r(p),{getEqualXTypes:P,handleAddPrevent:E,isGridLimit:j,getPointEventProps:S}=s(u,x,p),{createShadowLines:L}=l(),{canvasWidth:M,other:z,yCellHeight:H,xCellWidth:T,endX:I,originX:W,originY:Y,endY:B,markHeight:O,event:D,topGridYCellHeight:V,extracorporealCirculationHeight:G}=p,$=new Map,K=d(z);function _(){var i;if(!(null==(i=null==K?void 0:K.horizontal)?void 0:i.length))return;const n="horizontal";$.set(n,[]);const{horizontal:r}=K;let a=Y+H/2;r.forEach(((i,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:u={},data:d,showIcon:f=!0}=i;let h=null;d.forEach(((i,d)=>{const{time:m,value:p}=i,g=A(m);if(!Z(g))return;const x=[],v=f&&e(s,{...c,left:g,top:a});v&&x.push(v);const y=f?g+v.width/2+2:g,k=o([y,a],{value:p,...u,originX:"left"});x.push(k);const C=new t.Group(x,{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...S()});Object.assign(C,{originLeft:g,iconHalfWidth:v?v.width/2:0,origin:{type:"other",key:n,dataIndex:r,index:d,data:i,title:l},limitX:{x1:W,x2:I-C.width}}),h&&(C.limitX.x1=h.left,h.limitX.x2=C.left,C.prevPoint=h,h.nextPoint=C),h=C,Q(C),$.get(n).push(C)})),a+=H})),u.value.add(...$.get(n))}function q(){var t;if(!(null==(t=null==K?void 0:K.vertical)?void 0:t.length))return;const o="vertical";$.set(o,[]);const{vertical:i}=K;i.forEach(((t,i)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,c=A(s);if(!n||!Z(c))return;const{lineHeight:u=H}=a;let d=Y+r+u/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:c,originX:"left",top:d,origin:{type:"other",key:o,dataIndex:i,index:n,data:{value:t}},...S()});d+=u,Q(r),$.get(o).push(r)}));const f=$.get(o).filter((t=>t.origin.dataIndex===i)),h=Math.max(...f.map((t=>t.width))),m=c>I-h;f.forEach(((t,e,o)=>{t.siblingPoints=o.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,m&&t.set("originX","right")}))})),u.value.add(...$.get(o))}function F(t,e="add"){const{dataIndex:o,data:i,index:n,key:r,dataKey:a}=t,l=K[r],s=["mark"].includes(r)||"extracorporealCirculation"===r?l.dataList[o]:l[o];switch(e){case"remove":s.data.splice(n,1);break;case"change":"extracorporealCirculation"===r?s[a]=i:s.data[n]=i;break;default:{const t=Array.isArray(i)?i[0].time:i.time,e=c(t,s.data),o=Array.isArray(i)?i:[i];s.data.splice(e,0,...o);break}}J(t)}function J(t){var e;const{key:o}=t;switch(null==(e=u.value)||e.remove(...$.get(o)),$.delete(o),o){case"horizontal":_();break;case"vertical":q();break;case"mark":N();break;case"extracorporealCirculation":et()}}function N(){if(!(null==z?void 0:z.mark)||!O)return;const{title:t,titleStyle:i,pointAttr:n,dataList:r}=z.mark,a=o([W-5,B+O/2],{value:t,...i,originX:"right"});u.value.add(a);const l=B+O+G,s=G+B,c=[];r.forEach((t=>{const{time:o,list:i=[]}=t,r=A(o);if(!Z(r))return;let a=s;i.forEach((t=>{const{style:o}=t;let i=!1;const d=e((null==o?void 0:o.type)||"circleAndText",{...(null==o?void 0:o.pointAttr)||n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),f=d.height;a+f<=l&&a>=s?(d.set("top",a+f/2),a+=f):(i||(a=B,i=!0),d.set("top",a-f/2),a-=f),c.push(d),Q(d),u.value.add(d)}))})),function(t){const e=t=>{var e,o;return null==(o=null==(e=t.origin)?void 0:e.data)?void 0:o.isStart},o=t.find((t=>e(t))),i=t.find((t=>!e(t)&&t.left>o.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:W,x2:I};e(t)?(r.x2=i.left,t.otherPoints=n):(r.x1=o.left,t.startPoint=o),t.limitX=r}))}(c)}function Q(t){if(D.hovered&&(t.on("mouseover",(()=>{R(t)})),t.on("mouseout",(()=>{v.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,o=["mark","horizontal"].includes(e),i=["mark","vertical"].includes(e),n="extracorporealCirculation"===e;t.on("moving",(()=>{o?function(t){const e=t.origin.key,o="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(o?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(o?-1:0));if("mark"===e){t.top<Y&&t.set("top",Y);const e=B+O-t.height/2;t.top>e&&t.set("top",e)}o&&(t.originLeft=t.left+t.iconHalfWidth)}(t):n?function(t){t.setCoords();const{left:e,limitX:o}=t,i=m(new Date,"yyyy-MM-dd HH:mm"),n=A(i);o.isCurrentTime&&o.x2<n&&n>0&&n<M&&(o.x2=n);e<o.x1&&t.set({x1:o.x1,x2:o.x1});e>o.x2&&t.set({x1:o.x2,x2:o.x2});U(t,"left"),U(t,"right")}(t):(k(t),function(t){const e=t.left+t.maxTextWidth>I?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((o=>o.setCoords().set({originX:e,left:t.left})))}(t)),D.hovered&&R(t)})),t.on("mouseup",(r=>{var a;if(v.show=!1,1===r.button){o&&function(t){var e,o;if("mark"===t.origin.key){if((null==(o=null==(e=t.origin)?void 0:e.data)?void 0:o.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),o=Math.min(...e);t.startPoint.limitX.x2=o}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=b(null!=(a=t.originLeft)?a:t.left),r={...t.origin,...i?{time:e}:{data:{...t.origin.data,time:e}}};u.value.discardActiveObject(),x("change",r),n&&F(r,"change")}3===r.button&&["horizontal","vertical"].includes(e)&&(y.point={x:t.left,y:t.top},y.show=!0,y.target=t,y.list=g.map((t=>({...t,renderItem:()=>t.label,_type:"other"}))))}))}function R(t){v.isTarget=!0,v.show=!0;const{key:e,data:o={}}=t.origin||{};let i=o.value;const n="extracorporealCirculation"===e||"mark"===e;v.point={x:t.left,y:n?t.top:t.top+V/2};const r=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,a=b(r);v.list=[`时间 ${a.slice(-5)}`],n&&("mark"===e&&(i=o.name),v.list.unshift(i+" ")),v.sourceData=[{type:"other",key:e,time:a,value:i}]}function U(t,e){const{shadowObjs:o,params:i}=t[`${e}ShadowBox`]||{};if(!o||!i)return;o.forEach((t=>u.value.remove(t)));i["left"===e?1:0]=t.left;const n=tt(...i);t[`${e}ShadowBox`]={shadowObjs:n,params:i}}function Z(t){return t>=W&&t<=I}function tt(...e){const[o,i,r,a]=e,{mode:l,style:s}=a,c=f(s,["angle","space"]),d=[[o,B],[i,B],[i,r],[o,r]],h=new t.Polygon(d.map((t=>({x:t[0],y:t[1]}))),{...n,...c,stroke:"transparent",..."slash"===l?{fill:"transparent"}:{}}),m=[];return["slash"].includes(l)&&m.push(...L(d,s.angle,s.space,c)),u.value.add(h,...m),$.get("extracorporealCirculation").push(h,...m),[h,...m]}function et(){if(!G)return;const{dataList:e,ascendAortaStyle:o,extracorporealCirculationStyle:i}=K.extracorporealCirculation||{};if(!(null==e?void 0:e.length))return;const n="extracorporealCirculation";$.set(n,[]);const r=B+G;let a,l;function s(t){return t&&t>W&&t<M}function c(t){return void 0===t||""===t}e.forEach(((d,f)=>{const h=function(t){const{extracorporealCirculationStart:e,closeAscendAorta:o,openAscendAorta:i,extracorporealCirculationEnd:n}=t;let r,a,l,s;return e&&(r=A(e.time)),o&&(a=A(o.time)),i&&(l=A(i.time)),n&&(s=A(n.time)),[r,a,l,s]}(d);if(-1===h.findIndex((t=>t>0&&t<M)))return;let p;h.forEach(((g,x)=>{if(c(g))return;const v=h[x+1],y=h[x-1];if(s(g)||s(v)){const k=s(g)?g:W,C=s(v)?v:c(v)?null:I,w=s(y)?y:W,X={};if(x<h.length-1&&C&&(X.params=[k,C,r,[0,2].includes(x)?i:o],X.shadowObjs=tt(...X.params)),s(g)){const o=function(t){switch(t){case 0:return"extracorporealCirculationStart";case 1:return"closeAscendAorta";case 2:return"openAscendAorta";case 3:return"extracorporealCirculationEnd"}}(x),i=m(new Date,"yyyy-MM-dd HH:mm"),c=A(i),v=g<c&&s(c)?c:g,y=function(e,o){const i=new t.Line(e,{...o,stroke:"transparent",strokeWidth:5,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",lockMovementY:!0,originX:"center"});return Q(i),u.value.add(i),$.get("extracorporealCirculation").push(i),i}([g,B,g,r],{origin:{dataIndex:f,dataKey:o,key:n,data:d[o],type:"other"},limitX:{x1:0===x?null!=a?a:W:w,x2:C||v,isCurrentTime:!C&&f===e.length-1},...[1,2,3].includes(x)?{leftShadowBox:p}:{},...[0,1,2].includes(x)?{rightShadowBox:X}:{}});x===h.length-1&&(a=g,l=y),0===x&&l&&(l.limitX.x2=k)}p=X}}))}))}return function(){if(!(null==z?void 0:z.longLine)||!z.longLine.time)return;const{time:t,style:e}=z.longLine,o=A(t),n=i([o,0,o,B],e);u.value.add(n)}(),function(){var t;if(!(null==(t=null==K?void 0:K.horizontal)?void 0:t.length))return;const{horizontal:o}=K,i=W-5;let n=Y+H/2;o.forEach(((t,o)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:i,top:n,origin:{defaultAddValue:l,dataIndex:o,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:i,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),j(c)?R(c):v.show=!1})),c.on("mouseup:before",(t=>{if(v.show=!1,0===t.e.button&&j(c))if(P($.get("horizontal"),c.left,"key",T).includes(c.origin.key))E("repeat"),console.log("重复节点");else{const t={data:{time:b(c.left),value:c.origin.defaultAddValue},...c.origin};x("add",f(t,["isMenu"])),F(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),u.value.add(s),n+=H}))}(),_(),q(),N(),et(),a.on((()=>{const t="horizontal",e=C($.get(t));e.length>0?w((()=>{const o=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:o}=e.origin;return t[o]=t[o]?t[o].concat(e.origin):[e.origin],t}),{});return h(Object.keys(e).map((t=>{const o=e[t];return K.horizontal[t].data.splice(o[0].index,o.length),o})))}(e);J({key:t}),x("remove",o)})):X()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:o,_type:i}=t,n={...e.origin,type:i};x(o,n),"remove"===o&&F(n,o)}}}export{x as useOther};
@@ -1 +1 @@
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
+ 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"../useShadow.js";import"../useCommon.js";import"../../constants/index.js";import"@vueuse/shared";import"@vueuse/core";import{useTop as g}from"./useTop.js";import{useLeft as f}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,H,M,T){var k;const D=s(),P=e({redrawPoints:null,clickMenu:null,redrawLinePoints:null}),S=t();let A=null;const L=m((null==(k=C.data.top)?void 0:k.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((()=>ue(ne("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=se(),B=a((()=>ue(ne("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((()=>ue(ne("intraoperatively")||"bottom"))),Q=a((()=>{var e;const{show:t,height:a}=(null==(e=C.data.other)?void 0:e.extracorporealCirculation)||{};return t&&a?a:0})),R=a((()=>{var e;const{show:t,height:a}=(null==(e=C.data.other)?void 0:e.mark)||{};return t&&a?a:0})),U=a((()=>K.value+(C.data.height-W.value-q.value.height-R.value-Q.value))),Z=a((()=>(J.value-G.value)/N.value)),$=a((()=>(U.value-K.value)/V.value)),ee=a((()=>q.value.spaceTimeStamp/Z.value)),te=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}))))))})),ae=a((()=>de("pulse"))),re=a((()=>de("temperature"))),ie=a((()=>{var e;return(null==(e=C.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),oe=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:se,xAxis:r(q),originYXAxis:r(B),startTime:r(_),timeXCell:r(ee),gridXNumber:r(N),gridYNumber:r(V),xCellWidth:r(Z),yCellHeight:r($),originX:r(G),endX:r(J),originY:r(K),endY:r(U),markHeight:r(R),extracorporealCirculationHeight:r(Q),itemList:r(te),scaleValues:C.data.scaleValues,pulseYCell:r(ae),temperatureYCell:r(re),event:r(ie),dialog:D,extraMenuConfig:C.data.extraMenuConfig||{}});function ne(e){let t="";return Object.entries(X.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function le(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 ue(e){switch(e){case"top":return 0;case"center":return le("top");default:return le("top")+le("center")}}function se(){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 de(e){const{scaleValues:t}=C.data,a=t.find((t=>t.type===e));return $.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await o();const{redrawLinePoints:e,clickMenu:t}=g(y,oe,j,H,M),{redrawPoints:a,clickMenu:r,moveLimit:i,setPopup:n,updateData:l,getGridPoints:u,getContainPoints:s,showDialog:d,removeCurrentSelection:c,pauseFlickerPoint:m}=w(y,oe,j,H,M,T);S.value=m,f(y,oe,j,H,i,n,l,u);const{clickMenu:p}=x(y,oe,j,H,M,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()})),T&&l((()=>null==H?void 0:H.point),(()=>{H.movable?(H.show=!0,A&&clearTimeout(A),A=setTimeout((()=>{H.show=!1,H.movable=!1}),3e3)):A&&clearTimeout(A)}),{deep:!0}),{propItems:oe,...u(P)}}export{y as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,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 u}from"../useScaleColumn.js";import{useCommon as a}from"../useCommon.js";import"vue";import{getScaleNumberList as f}from"../../utils/index.js";import{filter as d,omit as h,has as p,isArray as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as g}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"./useOther.js";import"../../../../../shared/utils/index.js";const v=d(g,(e=>"add"!==e.type));function L(e,t,[n,i]){var o,r;let l=null;for(let s=0;s<e.length;s++){const c=e[s],{left:u,top:a,width:f,height:d}=c;if("tree"===t&&!(null==(o=c.children)?void 0:o.length)&&i>=a&&i<=a+d){l=c;break}if("treeMenu"===t&&n>=u&&n<=u+f&&i>=a&&i<=a+d){l=c;break}if(null==(r=c.children)?void 0:r.length){const e=L(c.children,t,[n,i]);if(e){l=e;break}}}return l?h(l,["uuid","left","top","width","height"]):null}function x(d,g,x,y,w){const{computedX:X,getXValue:C}=c(g),{originX:b,endX:Y,xCellWidth:k,originYXAxis:S,top:j,canvasWidth:M,borderStyle:$,treeData:G,xAxis:E,topGridYNumber:I,topGridOriginY:P,topGridYCellHeight:R,topGridEndY:T,event:z,extraMenuConfig:A,getTreeData:V,grid:D}=g,{getPointEventProps:B}=a(d,x,g);let N=V();const W=new Set;function F(){const{show:e=!0,range:t}=(null==j?void 0:j.scaleValue)||{};return e&&m(t)}function H(){!function e(t){t.forEach((t=>{var i;(null==(i=t.children)?void 0:i.length)?e(t.children):(function(e){if(!(null==e?void 0:e.data)||!Array.isArray(e.data))return;const{lineStyle:t}=j.dataStyle||{},n=e.top,i=n+R,o=i-R/2,l={y1:n,y2:i,halfY:o};let s=null;const c=h(e,["data","width","height","left","top"]);e.data.forEach(((n,i,u)=>{const a={...c,data:n,index:i},{time:f,continue:d}=n,[h,p]=f,m=h&&X(h),g=p&&X(p),v=q({...l,x:m},{isCustomIcon:!g&&!d,isContinue:!1,isLeft:!0}),L=q({...l,x:g},{isCustomIcon:!1,isContinue:!!d});let x,y;if((v||m<b)&&(L||g>Y)){const n=v?m:b,i=L?g:Y;x="wavy"===e.lineType?O([n,i,o],t):r([n,o,i,o],t),y=U({width:i-n-k,left:n+(i-n)/2,top:o,onlyRect:!0}),y.origin=a,x.centerLineRect=y}const w={startLine:v,centerLine:x,endLine:L};let C,S;!function(e,t,n){const{startLine:i,centerLine:o,endLine:r}=t,{startLine:l,endLine:s}=e||{};if(i){i.origin=n;const e={x1:b,x2:r?r.left:Y};s?(e.x1=s.left,s.limitX.x2=i.left,i.prevLine=s,s.nextLine=i):l&&(e.x1=l.left,l.limitX.x2=i.left,i.prevLine=l,l.nextLine=i),i.limitX=e,o&&(i.centerLine=o)}if(r){r.origin=n;const e={x1:i?i.left:b,x2:Y};r.limitX=e,o&&(r.centerLine=o)}o&&(o.origin=n);i&&r&&(i.nearLine=r,r.nearLine=i)}(s,w,a),s&&(C=_(u[i-1],s,o,a)),i===u.length-1&&(S=_(n,w,o,a)),s=w,x&&W.add(x),y&&W.add(y),v&&W.add(v),L&&W.add(L),C&&W.add(C),S&&W.add(S)}))}(t),function(e){if(F())return;const t=M-Y,{divider:i={},style:o}=(null==j?void 0:j.total)||{};if(i.show){const n=e.top+R,o=r([Y,n,Y+t,n],i.style);d.value.add(o)}if(!(null==e?void 0:e.total))return;const l=e.top+R/2,s=Y+t/2,c=n([s,l],{value:e.total,...o}),u=M-$.strokeWidth;s+c.width>u&&c.set({originX:"right",left:u});c&&d.value.add(c)}(t))}))}(N),W.size&&d.value.add(...W)}function O([n,i,o],r){const{stroke:l="#000"}=r||{},{subXCell:s=6}=D,c=k*s,u=R/2,a=c/2,f=o-u,d=o+u;if(n>i)return;let h=n,p=`M${h} ${o}`,m=0;for(;i-h>=c;)p+=` Q${h+a} ${m%2==0?f:d} ${h+c} ${o}`,h+=c,m++;i-h<c&&(p+=` L${i} ${o}`);const g=new e.Gradient({gradientUnits:"pencentage",coords:{x1:i,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:l+"90"},{offset:.5,color:l+"50"},{offset:1,color:l+"20"}]}),v=new e.Path(p,{fill:g,objectCaching:!1,...r,...t});return v.pathPointer=[n,i,o],v.selfStyle=r,v}function _(e,t,n,i){let o;const{content:r}=e.value||{},{startLine:s,endLine:c,centerLine:u}=t;if(r&&(s||u||c)){const{textStyle:e}=j.dataStyle||{};o=l(r,{fontSize:12,...e,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const u=Q(o,t,n);o&&(o.set(u),o.origin=i,J(o),s&&(s.text=o),c&&(c.text=o))}return o}function Q(e,t,n){var i,o,r;const l=e.width+1,{startLine:s,centerLine:c,endLine:u}=t,a={top:n,originX:"center",originY:"center"},f=null!=(r=null!=(o=null==c?void 0:c.x1)?o:null==(i=null==c?void 0:c.pathPointer)?void 0:i[0])?r:0;return c&&l<=c.width?a.left=f+c.width/2:u&&l<=u.limitX.x2-u.left?(a.originX="left",a.left=u.left+1):s&&!u&&l<=s.limitX.x2-s.left?(a.originX="left",a.left=s.left+(s.isCustomIcon?5:1)):s&&l<=s.left-s.limitX.x1?(a.originX="right",a.left=s.left-(s.isCustomIcon?5:1)):c?(a.originY="top",a.left=f+c.width/2,a.top=n+1,a.fontSize=10):s&&(a.originX="left",a.originY="top",a.fontSize=10,a.left=s.left,a.top=n+1),e.bringToFront(),a}function U(t){const{bindLine:n,width:i,left:o,top:r,props:l,onlyRect:s=!1}=t,c={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",left:o,top:r},u=new e.Rect({width:i,height:R,fill:"transparent",...c});if(s)return u.set({lockMovementX:!0,lockMovementY:!0}),J(u),u;const a=new e.Group([n,u],{...c,...l,lockMovementY:!0});return J(a),a}function q(e,{isCustomIcon:t,isContinue:n,isLeft:i}){const{x:o,y1:s,y2:c,halfY:u}=e;if(!o||o<b||o>Y)return;const{lineStyle:a}=j.dataStyle||{};let f;const d={left:o,top:u};f=t?l("circle",{fill:a.stroke,...d}):n?l(">",{fill:a.stroke,...d,fontSize:18}):r([o,s,o,u],a);const h=U({...d,width:k,bindLine:f,props:B()});return h.isLeft=i,h.isCustomIcon=t,h}function J(e){z.hovered&&(e.on("mouseover",(()=>{K(e,"hover")})),e.on("mouseout",(()=>{y.show=!1}))),e.lockMovementX&&e.lockMovementY||(e.on("moving",(()=>{!function(e){e.setCoords(),e.left<e.limitX.x1&&e.set("left",e.limitX.x1);e.left>e.limitX.x2&&e.set("left",e.limitX.x2)}(e),function(e){var t,n;if(e.centerLine){const i=e.isLeft?{x1:e.left}:{x2:e.left};if(p(e.centerLine,"pathPointer")){const{pathPointer:t,selfStyle:n}=e.centerLine;t[e.isLeft?0:1]=e.left,d.value.remove(e.centerLine);const{centerLineRect:i}=e.centerLine;e.centerLine=null;const o=O(t,n);o&&(i.bringToFront(),o.centerLineRect=i,e.centerLine=o,e.nearLine.centerLine=o,d.value.add(o))}else e.centerLine.setCoords().set(i);if(e.isLeft){const n=e.limitX.x2-e.left;null==(t=e.centerLine.centerLineRect)||t.setCoords().set({width:n-k,left:e.left+n/2})}else{const t=e.left-e.limitX.x1;null==(n=e.centerLine.centerLineRect)||n.setCoords().set({width:t-k,left:e.limitX.x1+t/2})}}if(e.text){const t=Q(e.text,{startLine:e.isLeft?e:e.nearLine,centerLine:e.centerLine,endLine:e.isLeft?e.nearLine:e},e.top);e.text.setCoords().set(t)}}(e),z.hovered&&K(e)})),e.on("mouseup",(t=>{if(1===t.button){!function(e){e.isLeft?(e.prevLine&&(e.prevLine.limitX.x2=e.left),e.nearLine&&(e.nearLine.limitX.x1=e.left)):(e.nextLine&&(e.nextLine.limitX.x1=e.left),e.nearLine&&(e.nearLine.limitX.x2=e.left))}(e);const t={type:"tree",...e.origin};x("change",h(t,["uuid"]))}})))}function K(e,t="moving"){var n,i,o;y.isTarget=!0,y.show=!0;const{data:r}=e.origin;y.point={x:e.left,y:e.top},y.marginTop=R/2;let[l="",s=""]=r.time||[];if("moving"===t){const t=C(e.left);e.isLeft?l=t:s=t,r.time=[l,s],e.text&&(e.text.origin.data.time=[l,s])}y.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)||""}`],y.sourceData=[{type:"tree",startTime:l,endTime:s,value:r.value}]}return s(d,{...g,gridYNumber:I,originY:P,yCellHeight:R,endY:T}),function(){var o;const{height:r,list:l,left:s,spaceValue:c,style:u,marginBottom:a}=E;if(!r)return;const f=[],h=S+(a?r-a:r/2),p=a?"bottom":"center";l.forEach(((e,t)=>{const i=s+t*k*c;f.push(n([i,h],{value:e.slice(11,16),originY:p,...u}))}));const m=f.length>0?new e.Group([...f],{...t,objectCaching:!1}):null;m&&d.value.add(m);const g=new e.Rect({width:M,height:r,left:0,top:S,...i,originX:"left",originY:"top",...$});if(d.value.add(g),!F()){const{title:e=(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.234"))||"总量",style:t}=(null==j?void 0:j.total)||{},i=n([Y+(M-Y)/2,h],{value:e,originY:p,...t});d.value.add(i)}}(),function(){var n;const i=(null==(n=null==j?void 0:j.tree)?void 0:n.textStyle)||{},r=[];!function e(t){t.forEach((t=>{var n;const{width:l,height:s,left:c,top:u,title:a=""}=t,f={value:a,...i};(null==(n=t.children)?void 0:n.length)?(f.value=a.split("").join("\n"),e(t.children)):f.textAlign="left",r.push(o({width:l,height:s,...$},f,{left:c,top:u},!0))}))}(G);const l=r.length>0?new e.Group([...r],{...t,objectCaching:!1}):null;l&&d.value.add(l)}(),H(),function(){const{range:n,spaceValue:i=.5,spaceGridNumber:o=1,style:r,margin:l=5}=(null==j?void 0:j.scaleValue)||{};if(!F())return;const s=f(n,i),c=[];if(s.forEach(((e,t)=>{if(0===t||t===s.length-1)return;const n=T-t*R*o;Math.abs(n-P)<1||c.push(u(String(e),{style:r,position:"right"},Y+l,n))})),!c.length)return;const a=new e.Group(c,{objectCaching:!1,...t});d.value.add(a)}(),z.evented&&d.value.on("mouse:up",(e=>{3===e.button&&function(e){y.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(n>=P&&n<=T)if(t>=b&&t<=Y)if(e.target){const t=e.target;w.point={x:t.left,y:t.top},w.show=!0,w.target=t;const{treeMenuList:n=[]}=A;w.list=v.concat(n).map((e=>({...e,renderItem:()=>e.label,type:e.key||e.type,_type:"tree"})))}else{const e={type:"tree",treeItem:L(N,"tree",[t,n]),time:C(t)};x("right-click",e)}else{const e={type:"treeMenu",treeItem:L(G,"treeMenu",[t,n])};x("right-click",e)}}(e)})),{redrawLinePoints:function(){var e;W.size&&(null==(e=d.value)||e.remove(...W)),W.clear(),N=V(),H()},clickMenu:function({item:e,target:t}){var n;if(!t)return;const{type:i,_type:o}=e,r={...t.origin,type:o};if(v.map((e=>e.type)).includes(i)){if("remove"===i){const e=[...W].filter((e=>{var t;return(null==(t=e.origin)?void 0:t.uuid)===r.uuid}));e.length&&(d.value.remove(...e),e.forEach((e=>{W.delete(e)})))}x(i,h(r,["uuid"]))}else null==(n=A.click)||n.call(A,i,h(r,["uuid"]))}}}export{x as useTop};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,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"../useShadow.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{filter as d,omit as h,has as p,isArray as m}from"lodash-es";import"date-fns";import{OTHER_MENU as g}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import"./useOther.js";import"../../../../../shared/utils/index.js";const v=d(g,(e=>"add"!==e.type));function L(e,t,[n,i]){var o,r;let l=null;for(let s=0;s<e.length;s++){const c=e[s],{left:u,top:a,width:f,height:d}=c;if("tree"===t&&!(null==(o=c.children)?void 0:o.length)&&i>=a&&i<=a+d){l=c;break}if("treeMenu"===t&&n>=u&&n<=u+f&&i>=a&&i<=a+d){l=c;break}if(null==(r=c.children)?void 0:r.length){const e=L(c.children,t,[n,i]);if(e){l=e;break}}}return l?h(l,["uuid","left","top","width","height"]):null}function x(d,g,x,y,w){const{computedX:X,getXValue:C}=c(g),{originX:b,endX:Y,xCellWidth:k,originYXAxis:S,top:j,canvasWidth:M,borderStyle:$,treeData:G,xAxis:E,topGridYNumber:I,topGridOriginY:P,topGridYCellHeight:R,topGridEndY:T,event:z,extraMenuConfig:A,getTreeData:V,grid:D}=g,{getPointEventProps:B}=a(d,x,g);let N=V();const W=new Set;function F(){const{show:e=!0,range:t}=(null==j?void 0:j.scaleValue)||{};return e&&m(t)}function H(){!function e(t){t.forEach((t=>{var i;(null==(i=t.children)?void 0:i.length)?e(t.children):(function(e){if(!(null==e?void 0:e.data)||!Array.isArray(e.data))return;const{lineStyle:t}=j.dataStyle||{},n=e.top,i=n+R,o=i-R/2,l={y1:n,y2:i,halfY:o};let s=null;const c=h(e,["data","width","height","left","top"]);e.data.forEach(((n,i,u)=>{const a={...c,data:n,index:i},{time:f,continue:d}=n,[h,p]=f,m=h&&X(h),g=p&&X(p),v=q({...l,x:m},{isCustomIcon:!g&&!d,isContinue:!1,isLeft:!0}),L=q({...l,x:g},{isCustomIcon:!1,isContinue:!!d});let x,y;if((v||m<b)&&(L||g>Y)){const n=v?m:b,i=L?g:Y;x="wavy"===e.lineType?O([n,i,o],t):r([n,o,i,o],t),y=U({width:i-n-k,left:n+(i-n)/2,top:o,onlyRect:!0}),y.origin=a,x.centerLineRect=y}const w={startLine:v,centerLine:x,endLine:L};let C,S;!function(e,t,n){const{startLine:i,centerLine:o,endLine:r}=t,{startLine:l,endLine:s}=e||{};if(i){i.origin=n;const e={x1:b,x2:r?r.left:Y};s?(e.x1=s.left,s.limitX.x2=i.left,i.prevLine=s,s.nextLine=i):l&&(e.x1=l.left,l.limitX.x2=i.left,i.prevLine=l,l.nextLine=i),i.limitX=e,o&&(i.centerLine=o)}if(r){r.origin=n;const e={x1:i?i.left:b,x2:Y};r.limitX=e,o&&(r.centerLine=o)}o&&(o.origin=n);i&&r&&(i.nearLine=r,r.nearLine=i)}(s,w,a),s&&(C=_(u[i-1],s,o,a)),i===u.length-1&&(S=_(n,w,o,a)),s=w,x&&W.add(x),y&&W.add(y),v&&W.add(v),L&&W.add(L),C&&W.add(C),S&&W.add(S)}))}(t),function(e){if(F())return;const t=M-Y,{divider:i={},style:o}=(null==j?void 0:j.total)||{};if(i.show){const n=e.top+R,o=r([Y,n,Y+t,n],i.style);d.value.add(o)}if(!(null==e?void 0:e.total))return;const l=e.top+R/2,s=Y+t/2,c=n([s,l],{value:e.total,...o}),u=M-$.strokeWidth;s+c.width>u&&c.set({originX:"right",left:u});c&&d.value.add(c)}(t))}))}(N),W.size&&d.value.add(...W)}function O([n,i,o],r){const{stroke:l="#000"}=r||{},{subXCell:s=6}=D,c=k*s,u=R/2,a=c/2,f=o-u,d=o+u;if(n>i)return;let h=n,p=`M${h} ${o}`,m=0;for(;i-h>=c;)p+=` Q${h+a} ${m%2==0?f:d} ${h+c} ${o}`,h+=c,m++;i-h<c&&(p+=` L${i} ${o}`);const g=new e.Gradient({gradientUnits:"pencentage",coords:{x1:i,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:l+"90"},{offset:.5,color:l+"50"},{offset:1,color:l+"20"}]}),v=new e.Path(p,{fill:g,objectCaching:!1,...r,...t});return v.pathPointer=[n,i,o],v.selfStyle=r,v}function _(e,t,n,i){let o;const{content:r}=e.value||{},{startLine:s,endLine:c,centerLine:u}=t;if(r&&(s||u||c)){const{textStyle:e}=j.dataStyle||{};o=l(r,{fontSize:12,...e,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const u=Q(o,t,n);o&&(o.set(u),o.origin=i,J(o),s&&(s.text=o),c&&(c.text=o))}return o}function Q(e,t,n){var i,o,r;const l=e.width+1,{startLine:s,centerLine:c,endLine:u}=t,a={top:n,originX:"center",originY:"center"},f=null!=(r=null!=(o=null==c?void 0:c.x1)?o:null==(i=null==c?void 0:c.pathPointer)?void 0:i[0])?r:0;return c&&l<=c.width?a.left=f+c.width/2:u&&l<=u.limitX.x2-u.left?(a.originX="left",a.left=u.left+1):s&&!u&&l<=s.limitX.x2-s.left?(a.originX="left",a.left=s.left+(s.isCustomIcon?5:1)):s&&l<=s.left-s.limitX.x1?(a.originX="right",a.left=s.left-(s.isCustomIcon?5:1)):c?(a.originY="top",a.left=f+c.width/2,a.top=n+1,a.fontSize=10):s&&(a.originX="left",a.originY="top",a.fontSize=10,a.left=s.left,a.top=n+1),e.bringToFront(),a}function U(t){const{bindLine:n,width:i,left:o,top:r,props:l,onlyRect:s=!1}=t,c={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",left:o,top:r},u=new e.Rect({width:i,height:R,fill:"transparent",...c});if(s)return u.set({lockMovementX:!0,lockMovementY:!0}),J(u),u;const a=new e.Group([n,u],{...c,...l,lockMovementY:!0});return J(a),a}function q(e,{isCustomIcon:t,isContinue:n,isLeft:i}){const{x:o,y1:s,y2:c,halfY:u}=e;if(!o||o<b||o>Y)return;const{lineStyle:a}=j.dataStyle||{};let f;const d={left:o,top:u};f=t?l("circle",{fill:a.stroke,...d}):n?l(">",{fill:a.stroke,...d,fontSize:18}):r([o,s,o,u],a);const h=U({...d,width:k,bindLine:f,props:B()});return h.isLeft=i,h.isCustomIcon=t,h}function J(e){z.hovered&&(e.on("mouseover",(()=>{K(e,"hover")})),e.on("mouseout",(()=>{y.show=!1}))),e.lockMovementX&&e.lockMovementY||(e.on("moving",(()=>{!function(e){e.setCoords(),e.left<e.limitX.x1&&e.set("left",e.limitX.x1);e.left>e.limitX.x2&&e.set("left",e.limitX.x2)}(e),function(e){var t,n;if(e.centerLine){const i=e.isLeft?{x1:e.left}:{x2:e.left};if(p(e.centerLine,"pathPointer")){const{pathPointer:t,selfStyle:n}=e.centerLine;t[e.isLeft?0:1]=e.left,d.value.remove(e.centerLine);const{centerLineRect:i}=e.centerLine;e.centerLine=null;const o=O(t,n);o&&(i.bringToFront(),o.centerLineRect=i,e.centerLine=o,e.nearLine.centerLine=o,d.value.add(o))}else e.centerLine.setCoords().set(i);if(e.isLeft){const n=e.limitX.x2-e.left;null==(t=e.centerLine.centerLineRect)||t.setCoords().set({width:n-k,left:e.left+n/2})}else{const t=e.left-e.limitX.x1;null==(n=e.centerLine.centerLineRect)||n.setCoords().set({width:t-k,left:e.limitX.x1+t/2})}}if(e.text){const t=Q(e.text,{startLine:e.isLeft?e:e.nearLine,centerLine:e.centerLine,endLine:e.isLeft?e.nearLine:e},e.top);e.text.setCoords().set(t)}}(e),z.hovered&&K(e)})),e.on("mouseup",(t=>{if(1===t.button){!function(e){e.isLeft?(e.prevLine&&(e.prevLine.limitX.x2=e.left),e.nearLine&&(e.nearLine.limitX.x1=e.left)):(e.nextLine&&(e.nextLine.limitX.x1=e.left),e.nearLine&&(e.nearLine.limitX.x2=e.left))}(e);const t={type:"tree",...e.origin};x("change",h(t,["uuid"]))}})))}function K(e,t="moving"){var n,i,o;y.isTarget=!0,y.show=!0;const{data:r}=e.origin;y.point={x:e.left,y:e.top},y.marginTop=R/2;let[l="",s=""]=r.time||[];if("moving"===t){const t=C(e.left);e.isLeft?l=t:s=t,r.time=[l,s],e.text&&(e.text.origin.data.time=[l,s])}y.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)||""}`],y.sourceData=[{type:"tree",startTime:l,endTime:s,value:r.value}]}return s(d,{...g,gridYNumber:I,originY:P,yCellHeight:R,endY:T}),function(){var o;const{height:r,list:l,left:s,spaceValue:c,style:u,marginBottom:a}=E;if(!r)return;const f=[],h=S+(a?r-a:r/2),p=a?"bottom":"center";l.forEach(((e,t)=>{const i=s+t*k*c;f.push(n([i,h],{value:e.slice(11,16),originY:p,...u}))}));const m=f.length>0?new e.Group([...f],{...t,objectCaching:!1}):null;m&&d.value.add(m);const g=new e.Rect({width:M,height:r,left:0,top:S,...i,originX:"left",originY:"top",...$});if(d.value.add(g),!F()){const{title:e=(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.234"))||"总量",style:t}=(null==j?void 0:j.total)||{},i=n([Y+(M-Y)/2,h],{value:e,originY:p,...t});d.value.add(i)}}(),function(){var n;const i=(null==(n=null==j?void 0:j.tree)?void 0:n.textStyle)||{},r=[];!function e(t){t.forEach((t=>{var n;const{width:l,height:s,left:c,top:u,title:a=""}=t,f={value:a,...i};(null==(n=t.children)?void 0:n.length)?(f.value=a.split("").join("\n"),e(t.children)):f.textAlign="left",r.push(o({width:l,height:s,...$},f,{left:c,top:u},!0))}))}(G);const l=r.length>0?new e.Group([...r],{...t,objectCaching:!1}):null;l&&d.value.add(l)}(),H(),function(){const{range:n,spaceValue:i=.5,spaceGridNumber:o=1,style:r,margin:l=5}=(null==j?void 0:j.scaleValue)||{};if(!F())return;const s=f(n,i),c=[];if(s.forEach(((e,t)=>{if(0===t||t===s.length-1)return;const n=T-t*R*o;Math.abs(n-P)<1||c.push(u(String(e),{style:r,position:"right"},Y+l,n))})),!c.length)return;const a=new e.Group(c,{objectCaching:!1,...t});d.value.add(a)}(),z.evented&&d.value.on("mouse:up",(e=>{3===e.button&&function(e){y.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(n>=P&&n<=T)if(t>=b&&t<=Y)if(e.target){const t=e.target;w.point={x:t.left,y:t.top},w.show=!0,w.target=t;const{treeMenuList:n=[]}=A;w.list=v.concat(n).map((e=>({...e,renderItem:()=>e.label,type:e.key||e.type,_type:"tree"})))}else{const e={type:"tree",treeItem:L(N,"tree",[t,n]),time:C(t)};x("right-click",e)}else{const e={type:"treeMenu",treeItem:L(G,"treeMenu",[t,n])};x("right-click",e)}}(e)})),{redrawLinePoints:function(){var e;W.size&&(null==(e=d.value)||e.remove(...W)),W.clear(),N=V(),H()},clickMenu:function({item:e,target:t}){var n;if(!t)return;const{type:i,_type:o}=e,r={...t.origin,type:o};if(v.map((e=>e.type)).includes(i)){if("remove"===i){const e=[...W].filter((e=>{var t;return(null==(t=e.origin)?void 0:t.uuid)===r.uuid}));e.length&&(d.value.remove(...e),e.forEach((e=>{W.delete(e)})))}x(i,h(r,["uuid"]))}else null==(n=A.click)||n.call(A,i,h(r,["uuid"]))}}}export{x as useTop};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as s}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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function o(o,n){const{xScaleList:r,originX:a,endX:l,endY:u,xCellWidth:h,canvasWidth:c,canvasHeight:d,bottom:p,breathingHeight:m,iconsWidth:g,borderStyle:v}=n;!function(){var n,c,d;if(!m||!p){const e=new t.Line([g,u-1,l,u-1],v);return o.value.add(e),e.sendToBack(),!1}const f=m,j=(null==(n=p.breathing)?void 0:n.list)||[],b=[];let x=!0;r.forEach(((t,s)=>{const o=a+s*h;let n="";j.forEach(((e,i)=>{const s=new Date(e.time).getTime();s>=t&&s<+t+t.scaleCell&&(n=e.value)}));const r=x?{top:-(f/2-10)}:{top:f/2-10};n&&(x=!x);const l=e({width:h,height:f,...v},Object.assign({},{text:String(n),...i},n?r:{}),{left:o,top:u});b.push(l)}));const w=e({width:l,height:f,...v},{text:String((null==(c=p.breathing)?void 0:c.title)+(null==(d=p.breathing)?void 0:d.unit)),...i,left:-(l-a)/2},{left:0,top:u});b.push(w);const S=b.length>0?new t.Group([...b],{...s}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as s}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"../useShadow.js";import"../useCommon.js";import"vue";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function o(o,n){const{xScaleList:r,originX:a,endX:l,endY:u,xCellWidth:h,canvasWidth:c,canvasHeight:d,bottom:p,breathingHeight:m,iconsWidth:g,borderStyle:v}=n;!function(){var n,c,d;if(!m||!p){const e=new t.Line([g,u-1,l,u-1],v);return o.value.add(e),e.sendToBack(),!1}const f=m,j=(null==(n=p.breathing)?void 0:n.list)||[],b=[];let x=!0;r.forEach(((t,s)=>{const o=a+s*h;let n="";j.forEach(((e,i)=>{const s=new Date(e.time).getTime();s>=t&&s<+t+t.scaleCell&&(n=e.value)}));const r=x?{top:-(f/2-10)}:{top:f/2-10};n&&(x=!x);const l=e({width:h,height:f,...v},Object.assign({},{text:String(n),...i},n?r:{}),{left:o,top:u});b.push(l)}));const w=e({width:l,height:f,...v},{text:String((null==(c=p.breathing)?void 0:c.title)+(null==(d=p.breathing)?void 0:d.unit)),...i,left:-(l-a)/2},{left:0,top:u});b.push(w);const S=b.length>0?new t.Group([...b],{...s}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o 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 j}from"../useCommon.js";import"vue";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import{TEMPERATURE_MENU as L,PAIN_MENU as k,OVERLAP as S}from"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,O,C,$,T,V,A,P,R,I){s(E,O);const{getEqualXTypes:X,handleAddPrevent:B,getPointEventProps:D}=j(E,C,O),{createShadowLines:H}=t(),{left:W,xScaleList:z,xCellWidth:F,yCellHeight:K,originX:_,endX:q,originY:G,endY:N,itemList:J,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:j={},belowMinValueStyle:L={},respiratorStyle:k={},dataList:S=[],list:Y=[]}=s,{type:O,textStyle:V}=j,P=[],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 j,z,_,q;const G=W?S.find((e=>e.key===a.key)):e,N=xe(H(a)?{...a,value:k.fixedValue}:a,s),J=e.list[c+1],ee=J?xe(H(J)?{...J,value:k.fixedValue}:J,s):void 0,oe=J?W?S.find((e=>e.key===J.key)):e:{},{title:le=""}=G;if(le===((null==(j=window.getLanguageByCode)?void 0:j.call(window,"10010.1.235"))||"脉搏")&&oe.title!==((null==(z=window.getLanguageByCode)?void 0:z.call(window,"10010.1.235"))||"脉搏")||le!==((null==(_=window.getLanguageByCode)?void 0:_.call(window,"10010.1.235"))||"脉搏")&&oe.title===((null==(q=window.getLanguageByCode)?void 0:q.call(window,"10010.1.235"))||"脉搏")||!N||!ee||f(N[0],1)!==f(ee[0],1))N&&B&&(N[0]=B),B=null;else{const e=N[0]-F/2;N[0]=e+F/4,ee[0]=B=N[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+K?e[1]+K:e[1]-K,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:-K}}(N,a,G),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 j,L,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*K],{...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?K: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?K: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;j=i([...e,r,l],{...m,...y.line,...n}),L=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"}),j&&X.push(j),L&&X.push(L)}t.respirator&&(O=o(k.type,{left:b,top:e[1]-(x?K:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(O))}Object.assign(a,{reduceLine:{obj:j,type:"line"},noRiseText:{obj:S,top:p.text?5:2*K,isFixed:M(p,t)},riseText:{obj:Y,top:(x?-K:0)-5},verifiedText:{obj:E,left:F/2,top:(x?-K:0)-5},reducePoint:{obj:L,type:"reduce"},respirator:{obj:O,top:(x?-K:0)-5}})}(N,a,G,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*K,i=[e[1]-K/2,t];t<U.originY&&(t=e[1]+2.5*K,i=[t,e[1]+K/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]+K/2+a.height:e[1]+K;d=l([e[0],t],i),X.push(d)}+t.value<s&&(d=l([e[0],e[1]-K],i),X.push(d))}if(L.show&&+t.value<s){const t=e[1];if(L.text)c=l([e[0],e[1]+5],{value:L.text.split("").join("\n"),originY:"top",...L.style});else{const i=t+2*K;c=r([e[0],t,i],{...L.style})}X.push(c)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:d,top:-K},belowMinValue:{obj:c,top:L.text?5:2*K,moveHide:!0}})}(N,a,G,re),function(n,l,r,a,d,c){let f,h;const{pointAttr:g={},lineAttr:y={},title:x="",key:b,type:j="circle",overlapKey:L}=d,S=g.height?g.height/2:5,Y=e.list[a+1];let M=w(n),B=w(l);const z=ye(u,e.list[a].value),F=()=>"pulse"==u&&r.pacemakerShow?m.value:H(r)?k.type:z&&"number"===O?0:j,K=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||K(r))&&(l||K(Y))){const e=T(u,35);return n||(M=[$(r.time),e]),l||(B=[$(Y.time),e]),!0}return!!n&&!!l})()){M&&B&&z&&ye(u,Y.value)&&!ne[1]&&"icon"===O&&(M[1]=M[1]-S,B[1]=B[1]-S),h=i([...M,...B],{...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 _=F(),q=I[a-1],G={origin:{data:H(r)?{...r,value:k.fixedValue}:r,title:x,key:b||"",overlapKey:L,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,...z?{selectable:!1,evented:!1,..."number"===O?V:{}}:{}};n&&(q?G.leftLine.set("x2",n[0]):G.leftLine=null,f=o(_,{left:n[0],top:z&&!ne[1]?n[1]-S: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",(()=>{R.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(R.show=!1,1===t.button){const{type:t}=e.origin,i=A(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),C("change",n),je(n,"change")}}))}(f),P.push(f),pe.add(f))}(N,ee,a,c,G,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]=P.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(P))}}const z=I.filter((e=>e));E.value.add(...z,...P,...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;R.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||V(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:s,physicsReduce:a}=l||{},u="hover"===t?l.value:A(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],R.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 je(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;Le()}function Le(){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,r=t.origin.overlapKey;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let a=r||"koumai";"yemai"===e&&(a=e);const u=r||e;l.push(o(a,{...i[u],...s}))}}}))})),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([_,t,q,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>=_&&e<=q&&i>=G&&i<=N){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=[...L]),"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"))||"新增节点"],J.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:P?P(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>=_&&e<=q&&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,[...L,...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),je(u,"change")}else{const t={data:{time:V(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.isOneLine?{key:e.origin.key}:{}},...e.origin};C("add",t),je(t)}},setPopup:me,isAddPoint:be,updateData:je,redrawPoints:Le,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{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as s}from"date-fns";import{getType as a,getTime as u,isOneLine as d,isOverlapPoint as c,getFloorNumber as p,isValidValue as f,setOtherType as h,isEffectiveNode as v,deleteProperty as g,getIndex as y}from"../../utils/index.js";import{cloneDeep as m,omit as w,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useShadow as j}from"../useShadow.js";import{useCommon as L}from"../useCommon.js";import"vue";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as S,OVERLAP as Y}from"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";import{promiseTimeout as E}from"@vueuse/shared";function M(M,C,$,T,V,A,P,R,I,X){r(M,C);const{getEqualXTypes:B,handleAddPrevent:D,getPointEventProps:H}=L(M,$,C),{createShadowLines:W}=j(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:K,originX:q,endX:G,originY:N,endY:J,itemList:Q,event:U,vitalSignsOriginY:Z,painOriginY:ee,hospitalizationDate:te,config:ie,canvasHeight:ne,painSurplusCell:oe,iconsWidth:le,canvasWidth:re,borderStyle:se}=C,ae=new Set,ue=["xinmai","mai"],de=new Map,ce=new Set,pe=new Set,fe=new Set,he=m(z.yScaleValue),ve=new Set;function ge(n){var o;const l=he.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ae.size&&M.value.remove(...ae),ae.clear(),de.size>1)){if(n){const{type:e,key:t}=n.origin||{};if("pulse"===e){const e=de.get(t),i=null==e?void 0:e.findIndex((e=>e[0]===n.left));e.splice(i,1,[n.left,n.top])}}const o=function(){const e=[],t=[],i=[];for(const e of de)t.push(e[1]),e[0]===ue[0]&&e[1].forEach((e=>{(de.get(ue[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){E(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(fe).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)===ue[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&&M.value.remove(e.rightLine):e.leftLine&&M.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((n=>{const o=n.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...i,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...W(n,s._angle,s.space,w(s,["_angle","space"]))),e.forEach((e=>{ae.add(e)}));else{const i=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}(n);i.forEach((i=>{const n=t([...x(i)],{...s,originX:"center"});e.push(n),ae.add(n)}))}M.value.add(...e)}ae.add(l),M.value.add(l)}))}}function ye(e,r,s){var a;const{type:u,riseStyle:c={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:y={},pacemaker:w={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:L={},respiratorStyle:k={},dataList:S=[],list:Y=[]}=s,{type:E,textStyle:C}=j,A=[],R=[],X=[];let B=null;const D=e=>"breathe"==u&&e.respirator&&k.type&&k.fixedValue&&!e.value&&xe(e.time),W=d(s);if(null==(a=e.list)||a.forEach(((a,d)=>{var j,z,F,q;const G=W?S.find((e=>e.key===a.key)):e,N=be(D(a)?{...a,value:k.fixedValue}:a,s),J=e.list[d+1],Q=J?be(D(J)?{...J,value:k.fixedValue}:J,s):void 0,te=J?W?S.find((e=>e.key===J.key)):e:{},{title:le=""}=G;if(le===((null==(j=window.getLanguageByCode)?void 0:j.call(window,"10010.1.235"))||"脉搏")&&te.title!==((null==(z=window.getLanguageByCode)?void 0:z.call(window,"10010.1.235"))||"脉搏")||le!==((null==(F=window.getLanguageByCode)?void 0:F.call(window,"10010.1.235"))||"脉搏")&&te.title===((null==(q=window.getLanguageByCode)?void 0:q.call(window,"10010.1.235"))||"脉搏")||!N||!Q||p(N[0],1)!==p(Q[0],1))N&&B&&(N[0]=B),B=null;else{const e=N[0]-_/2;N[0]=e+_/4,Q[0]=B=N[0]+_/2}const re={};re.value=function(e,t,i){if(!(null==e?void 0:e.length)||!ie.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=Z.originY+K?e[1]+K:e[1]-K,r=o([e[0],l],{value:D(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-K}}(N,a,G),function(e,r,s,a){var d,p,h;if(!["temperature","pain","breathe"].includes(u))return;if(!(null==e?void 0:e.length)&&"temperature"===u&&!xe(r.time))return;if(!(null==e?void 0:e.length)&&"pain"===u)return;if(!r.value&&"breathe"===u)return;const{lineAttr:m={},key:w}=s,{value:x}=a,b=T(r.time);let j,L,S,Y,E,M;if(r.noRise&&v.show){const t=O(v,r)?V(u,35):(null==e?void 0:e[1])||0;if(v.text)S=o([b,O(v,r)?t:t+5],{value:v.text.split("").join("\n"),originY:"top",...v.style}),r.value||fe.add(S);else if(r.value){S=l([b,t,t+2*K],{...v.style})}S&&X.push(S),S&&O(v,r)&&ve.add(S)}if(null==e?void 0:e[1]){if(r.rise&&c.show&&c.text&&(Y=o([b,e[1]-(x?K:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(Y)),r.verified){const t=(null==(d=null==g?void 0:g.position)?void 0:d[w])||"top";E=o(["top-right"===t?b+_/2:b,e[1]-(x?K:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(E)}if(f(r.physicsReduce)||f(r.drugReduce)){const o=V(u,null!=(p=r.physicsReduce)?p:r.drugReduce),l=o<e[1]&&(null==ie?void 0:ie.hypothermyViewCustom)?b+_/2:b;j=t([...e,l,o],{...m,...y.line,...i}),L=n((null==(h=null==y?void 0:y.point)?void 0:h.type)||"circle",{left:l,top:o,...y.point,...i,originY:o===ne?"bottom":"center"}),j&&X.push(j),L&&X.push(L)}r.respirator&&(M=n(k.type,{left:b,top:e[1]-(x?K:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(M))}Object.assign(a,{reduceLine:{obj:j,type:"line"},noRiseText:{obj:S,top:v.text?5:2*K,isFixed:O(v,r)},riseText:{obj:Y,top:(x?-K:0)-5},verifiedText:{obj:E,left:_/2,top:(x?-K:0)-5},reducePoint:{obj:L,type:"reduce"},respirator:{obj:M,top:(x?-K:0)-5}})}(N,a,G,re),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;const r=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*K,i=[e[1]-K/2,t];t<Z.originY&&(t=e[1]+2.5*K,i=[t,e[1]+K/2]),a=l([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>r){const t=a?e[1]+K/2+a.height:e[1]+K;d=o([e[0],t],i),X.push(d)}+t.value<s&&(d=o([e[0],e[1]-K],i),X.push(d))}if(L.show&&+t.value<s){const t=e[1];if(L.text)c=o([e[0],e[1]+5],{value:L.text.split("").join("\n"),originY:"top",...L.style});else{const i=t+2*K;c=l([e[0],t,i],{...L.style})}X.push(c)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:d,top:-K},belowMinValue:{obj:c,top:L.text?5:2*K,moveHide:!0}})}(N,a,G,re),function(i,o,l,a,d,c){let p,f;const{pointAttr:g={},lineAttr:y={},title:x="",key:b,type:j="circle",overlapKey:L}=d,S=g.height?g.height/2:5,Y=e.list[a+1];let O=m(i),B=m(o);const z=me(u,e.list[a].value),F=()=>"pulse"==u&&l.pacemakerShow?w.value:D(l)?k.type:z&&"number"===E?0:j,_=e=>e&&v.show&&v.fixed&&xe(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(l.breakpoint)return!1;if("temperature"===u&&(i||_(l))&&(o||_(Y))){const e=V(u,35);return i||(O=[T(l.time),e]),o||(B=[T(Y.time),e]),!0}return!!i&&!!o})()){O&&B&&z&&me(u,Y.value)&&!oe[1]&&"icon"===E&&(O[1]=O[1]-S,B[1]=B[1]-S),f=t([...O,...B],{...y});const{obj:e}=(null==c?void 0:c.reducePoint)||{};if(i&&o&&(null==e?void 0:e.top)<i[1]&&(null==ie?void 0:ie.hypothermyViewCustom)){const i=t([e.left,e.top,...o],{...y});X.unshift(i),Object.assign(c,{reduceRightLine:{obj:i,type:"reduce"}}),f.set("stroke","transparent")}}const K=F(),q=R[a-1],G={origin:{data:D(l)?{...l,value:k.fixedValue}:l,title:x,key:b||"",overlapKey:L,unit:s.unit,type:u,_type:h(x,u),dataIndex:r,index:a,isOneLine:W},leftLine:q,rightLine:f,otherObj:c,...l.pacemakerShow&&"pulse"==u?w.style:D(l)?k.style:g,...H(),lockMovementX:!0,...z?{selectable:!1,evented:!1,..."number"===E?C:{}}:{}};i&&(q?G.leftLine.set("x2",i[0]):G.leftLine=null,p=n(K,{left:i[0],top:z&&!oe[1]?i[1]-S:i[1],...G}));R.push(f),p&&(b===ue[1]?ce.add(p):D(l)||pe.add(p),function(e){U.hovered&&(e.on("mouseover",(()=>{we(e,"hover")})),e.on("mouseout",(()=>{I.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?ee:Z;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&&(M.value.remove(i),delete e.otherObj.obj)))})),ge(e)}(e),U.hovered&&we(e)})),e.on("mouseup",(t=>{if(I.show=!1,1===t.button){const{type:t}=e.origin,i=P(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};M.value.discardActiveObject(),$("change",n),Le(n,"change")}}))}(p),A.push(p),fe.add(p))}(N,Q,a,d,G,re)})),"pulse"===u){let t=null;const i=e=>e.map(((e,i,n)=>{var o,l;const r=n[i+1];if(r&&p(e.left,1)===p(r.left,1)){const i=e.left-_/2;e.set("left",i+_/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+_/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={};ue.forEach((t=>{e[t]=A.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t})),de.set(t,i(e[t]))}))}else{const{key:t}=e;de.set(t,i(A))}}const z=R.filter((e=>e));M.value.add(...z,...A,...X)}function me(e,t){return"pain"===e&&0==t}function we(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;I.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||A(e.left)).slice(-5)}`;I.list=[function(){const{drugReduce:s,physicsReduce:a}=l||{},u="hover"===t?l.value:P(o,e.top);if(f(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(f(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],I.show=!0}function xe(e){const[t]=F,i=b(F),n=t.start,o=i.end,l=u(e);return l>=n&&l<=o}function be(e,t){const i="pain"===t.type?ee:Z;if(!v(e)||!xe(e.time))return;const n=T(e.time),o=V(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function je(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=u(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=u(`${A(e)}:00`);return te&&l<u(te)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function Le(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=he.find((e=>e.type===i));if("add"===t){const e=d(s)?s.dataList.find((e=>e.enable)):s.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;ke()}function ke(){var e;fe.size&&(null==(e=M.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}([...fe]))),fe.clear(),Se()}function Se(e){de.clear(),fe.clear(),ce.clear(),ve.clear(),pe.clear(),he.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t)&&!e.enable||ye(e,i,t)})))})),ge(),[...fe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=he.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 o=Object.assign({},Y,z.overlap||{}),l=[];ce.size&&[...ce].forEach((e=>{[...pe].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key,r=t.origin.overlapKey;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let a=r||"koumai";"yemai"===e&&(a=e);const u=r||e;l.push(n(a,{...o[u],...s}))}}}))})),setTimeout((()=>{M.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),fe.add(e)}))}))}()}return function(){const t=new e.Rect({left:le,top:0,width:re-le-se.strokeWidth,height:ne-se.strokeWidth,fill:"transparent",...se});M.value.add(t)}(),Se((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const i=V(e.type,e.positionLine.value),n=t([q,i,G,i],e.positionLine);M.value.add(n)}(e))),M.value.on("mouse:up",(e=>{var t;const{button:i,target:n,pointer:o={}}=e;if(3===i){if(!C.event.evented)return;const{x:e=0,y:i=0}=o;if(e>=q&&e<=G&&i>=N&&i<=J){X.point={x:e,y:i},X.show=!0;const{type:l}=(null==n?void 0:n.origin)||{};if(n&&["temperature","pain"].includes(l))"temperature"===l&&(X.list=[...k]),"pain"===l&&(X.list=[...S]),X.target=n;else{X.target=null,X.list=[(null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.219"))||"新增节点"],Q.forEach((t=>{if(!B([...fe],e,"_type").includes(t.bigType)){const e=["pain"].includes(t.bigType)?ee:Z;i>=e.originY&&i<=e.endY&&X.list.push({renderItem:R?R(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:a(t.bigType),dataIndex:t.dataIndex,key:t.key,isOneLine:t.isOneLine},pointer:o})}}));const n=je(e);n&&1!==X.list.length||(X.show=!1,1===X.list.length&&n&&D("repeat"))}}}if(1===i){if(n)return;const{x:e=0,y:t=0}=o;e>=q&&e<=G&&t>0&&t<ne&&$("click:grid",{x:e,y:t,time:A(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,isOneLine:o,dataIndex:l,index:r}=t.origin,a=g(i,[...k,...S]);a[`${e.type}`]=e.value,a.changeTime=s(new Date,"yyyy-MM-dd HH:mm"),o&&(a.key=t.origin.key);const u={...t.origin,data:a};$("change",u),Le(u,"change")}else{const t={data:{time:A(e.pointer.x),value:P(e.origin.type,e.pointer.y),...e.origin.isOneLine?{key:e.origin.key}:{}},...e.origin};$("add",t),Le(t)}},setPopup:we,isAddPoint:je,updateData:Le,redrawPoints:ke,gridPoints:fe,fixedNoRisePoints:ve}}function O(e,t){return e.fixed||!t.value&&0!==t.value}export{M 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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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:T}=c(p,g,d),{originY:N,endY:O,originX:V,endX:k,xCellWidth:E,yCellHeight:M,left:A,vitalSignsOriginY:G,painOriginY:I,painHeight:W,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=V;"right"===c&&(d=k,g=k+(null!=(s=null==B?void 0:B.width)?s:0));const f=[],m=W&&"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=I.originY-z[0]*M,v=l({width:V-H,height:W+(z[0]+z[1])*M,...D},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,V,m],D),w=[];if(r||h){const{lineXMain:t,textLeft:i}=u(c,H,V-H),l=o.length;o.forEach(((o,u)=>{let c=I.endY-u*M*s;if(0===u&&0===z[1]&&(c=O-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:G.originY,b="right"===c?$:G.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:T,showMaxMinNumber:k,detailedList:E=[],showdetailedScale:A,showRange:R=[]}=o;if(L||X){const{lineXMain:e,lineXSub:t,textLeft:i}=u(T,w,m),n=(j[1]-j[0])/2,l=A&&!E.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):A&&(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=G.endY-r*M*(A?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=G.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...h(o,r,e,t,u,M,G.originY,l.findIndex((e=>e==c))+1))}))}let B=o.title||"";o.unit&&(B+="\n"+o.unit);let J=G.originY+2;0!==_&&P[0]>0&&(J=N+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=O;const i=H-A.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>=V&&e.left<=k){e.setCoords();const t="pain"===e.origin.type?I:G;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&T(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=A.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&&A.yScaleValue[_].show){const e=A.yScaleValue[_];0===_&&A.yScaleValue.length>1&&K.unshift(e),_==A.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"../useShadow.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";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:T}=c(p,g,d),{originY:N,endY:O,originX:V,endX:k,xCellWidth:E,yCellHeight:M,left:A,vitalSignsOriginY:G,painOriginY:I,painHeight:W,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=V;"right"===c&&(d=k,g=k+(null!=(s=null==B?void 0:B.width)?s:0));const f=[],m=W&&"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=I.originY-z[0]*M,v=l({width:V-H,height:W+(z[0]+z[1])*M,...D},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,V,m],D),w=[];if(r||h){const{lineXMain:t,textLeft:i}=u(c,H,V-H),l=o.length;o.forEach(((o,u)=>{let c=I.endY-u*M*s;if(0===u&&0===z[1]&&(c=O-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:G.originY,b="right"===c?$:G.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:T,showMaxMinNumber:k,detailedList:E=[],showdetailedScale:A,showRange:R=[]}=o;if(L||X){const{lineXMain:e,lineXSub:t,textLeft:i}=u(T,w,m),n=(j[1]-j[0])/2,l=A&&!E.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):A&&(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=G.endY-r*M*(A?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=G.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...h(o,r,e,t,u,M,G.originY,l.findIndex((e=>e==c))+1))}))}let B=o.title||"";o.unit&&(B+="\n"+o.unit);let J=G.originY+2;0!==_&&P[0]>0&&(J=N+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=O;const i=H-A.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>=V&&e.left<=k){e.setCoords();const t="pain"===e.origin.type?I:G;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&T(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=A.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&&A.yScaleValue[_].show){const e=A.yScaleValue[_];0===_&&A.yScaleValue.length>1&&K.unshift(e),_==A.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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function l(l,o,r,s,u,a){const{left:h,other:f,vitalSignsOriginY:c,xCellWidth:g,yCellHeight:p,endX:v}=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 p<11?e:p})();let m=0;function j(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:d*l,originX:"center",...t,objectCaching:!1,...i.style||{}});m=(d-(o.height||0))/2,u.push(o)}));const h=new e.Rect({left:0,top:0,width:g,height:d*u.length,fill:"transparent",originX:"center",...t}),{eventHighlight:c=!1}=f||{},v={originX:"center",left:n,top:o+m,baseTop:(i.baseTop||0)*p,trueLeft:n,trueHeight:u.length*d,objectCaching:!1,hoverCursor:"pointer",highlightObject:h,originData:i,selectable:!1,evented:c},j=new e.Group([h,...u],v);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)}))}(j),l.value.add(j),j}!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>v)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,b=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(b(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(j(e,i,r,!0))}}e.vertical.forEach(((s,a)=>{var h,f,v,m,x;const C=(s.baseTop||0)*p,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*d+C>c.endY&&(t=c.originY,i+=g)}t+=C,String(s.value).length&&(l.push(j(s,i,t)),o=null!=(v=null==(f=n(l))?void 0:f.trueHeight)?v:0),u(s,0===a),b(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)*p;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(j(t,i,h)),u(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"../useShadow.js";import"../useCommon.js";import"vue";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function l(l,o,r,s,u,a){const{left:h,other:f,vitalSignsOriginY:c,xCellWidth:g,yCellHeight:p,endX:v}=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 p<11?e:p})();let m=0;function j(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:d*l,originX:"center",...t,objectCaching:!1,...i.style||{}});m=(d-(o.height||0))/2,u.push(o)}));const h=new e.Rect({left:0,top:0,width:g,height:d*u.length,fill:"transparent",originX:"center",...t}),{eventHighlight:c=!1}=f||{},v={originX:"center",left:n,top:o+m,baseTop:(i.baseTop||0)*p,trueLeft:n,trueHeight:u.length*d,objectCaching:!1,hoverCursor:"pointer",highlightObject:h,originData:i,selectable:!1,evented:c},j=new e.Group([h,...u],v);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)}))}(j),l.value.add(j),j}!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>v)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,b=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(b(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(j(e,i,r,!0))}}e.vertical.forEach(((s,a)=>{var h,f,v,m,x;const C=(s.baseTop||0)*p,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*d+C>c.endY&&(t=c.originY,i+=g)}t+=C,String(s.value).length&&(l.push(j(s,i,t)),o=null!=(v=null==(f=n(l))?void 0:f.trueHeight)?v:0),u(s,0===a),b(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)*p;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(j(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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";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,j){const C=15,D=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||C)||0})),P=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||C)||0})),M=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||C)||0})),I=a((()=>{var e,a,t;const{top:l}=w.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),O=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||C)||0})),N=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]*z.value)),A=a((()=>{const{top:e,left:a}=w.data;return e.titleWidth+B.value})),T=a((()=>{const{bottom:e=null,height:a}=w.data;if(!e)return a;return a-(e.height||30)})),q=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||C)||0;return L.value+t+l+P.value+M.value+O.value})),z=a((()=>(W.value-A.value)/k.value)),G=a((()=>(T.value-q.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=A.value-z.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+=z.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+z.value/2,scaleCell:(l-t)/z.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:G.value*e.subYCell})),U=a((()=>{const{left:e}=w.data,a={originY:q.value+V.value[0]*G.value,endY:T.value-V.value[1]*G.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:q.value+H.value[0]*G.value,endY:T.value-H.value[2]*G.value};return 0===K.value&&e.yScaleValue.length>1?a.originY=U.value.endY+H.value[0]*G.value:K.value===e.yScaleValue.length-1&&(a.endY=U.value.originY-H.value[2]*G.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:O.value,topList:_.value,breathingHeight:N.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:A.value,originY:q.value,endX:W.value,endXLimit:$.value,endY:T.value,xCellWidth:z.value,yCellHeight:G.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,j);D.redrawPoints=l,D.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);D.select=s}()}),{immediate:!0}),{propItems:ae,...l(D)}}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"../useShadow.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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../../constants/index.js";import"../surgicalAnesthesia/useOther.js";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,j,x){const C=15,D=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||C)||0})),P=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||C)||0})),M=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||C)||0})),I=a((()=>{var e,a,t;const{top:l}=w.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),O=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||C)||0})),N=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]*z.value)),A=a((()=>{const{top:e,left:a}=w.data;return e.titleWidth+B.value})),T=a((()=>{const{bottom:e=null,height:a}=w.data;if(!e)return a;return a-(e.height||30)})),q=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||C)||0;return L.value+t+l+P.value+M.value+O.value})),z=a((()=>(W.value-A.value)/k.value)),G=a((()=>(T.value-q.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=A.value-z.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+=z.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+z.value/2,scaleCell:(l-t)/z.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:G.value*e.subYCell})),U=a((()=>{const{left:e}=w.data,a={originY:q.value+V.value[0]*G.value,endY:T.value-V.value[1]*G.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:q.value+H.value[0]*G.value,endY:T.value-H.value[2]*G.value};return 0===K.value&&e.yScaleValue.length>1?a.originY=U.value.endY+H.value[0]*G.value:K.value===e.yScaleValue.length-1&&(a.endY=U.value.originY-H.value[2]*G.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:O.value,topList:_.value,breathingHeight:N.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:A.value,originY:q.value,endX:W.value,endXLimit:$.value,endY:T.value,xCellWidth:z.value,yCellHeight:G.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,j,x);D.redrawPoints=l,D.clickMenu=u;const{drawScaleValue:o}=p(S,ae,b,e,j,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);D.select=s}()}),{immediate:!0}),{propItems:ae,...l(D)}}export{S as useTemperatureChart};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultStyle as s,drawTextGroup as i,defaultTextStyle as l}from"../useDraw.js";import"date-fns";import{flatten as o}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"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function u(u,n){const{grid:h,originX:r,endX:a,xCellWidth:p,gridXNumber:c,top:d,xScalevalueHeight:f,iconsWidth:m,topList:v,endXLimit:g,canvasWidth:y,borderStyle:j,surplusCell:S}=n;!function(){const w=[];g&&w.push(new e.Line([g,0,y,0],j));let x=0;v.forEach(((e,s)=>{if(s>0&&(x+=n[`${v[s-1].key}Height`]),"xScalevalue"==e.key)!function(e,s,o){const u=d.dayHeight;if(!u)return;s.push(t([r,o+u,a,o+u],j));const n=p*h.subSecondXCell,f=(c-S[1]-S[3])/h.subSecondXCell;for(let h=0;h<f;h++){const a=r+h*n,p=h%2==0?"上午":"下午",c=i({width:n,height:u,...j},{value:p,...l,...e.style||{}},{left:a,top:o});s.push(c),s.push(t([a+n,o,a+n,o+u],j))}}(e,w,x),function(e,s,u){var n;const c=d.xScalevalue.show&&null!=(n=d.dayHeight)?n:0,v=f-c;if(!v)return;s.push(t([m,u+f,a,u+f],j));const g=i({width:r-m,height:f,...j},{value:d.xScalevalue.title,...l,...e.style||{},...e.titleStyle||{}},{left:m,top:u});s.push(g),s.push(t([r,u,r,u+f],j));const y=[];for(let e=0;e<h.mainXCell;e++)y.push(d.xScalevalue.list);o(y).forEach(((o,n)=>{const h=r+n*p,a=i({width:p,height:v,...j},{value:o.value,...l,...e.style||{},...o.style||{}},{left:h,top:u+c});s.push(a),s.push(t([h+p,u+c,h+p,u+c+v],j))}))}(e,w,x);else{if(!n[`${e.key}Height`])return;const o=n[`${v[s].key}Height`];!function(e,s,o){const u=n[`${e.key}Height`],a=i({width:r-m,height:u,...j},{value:e.title,...l,...(null==e?void 0:e.style)||{},...e.titleStyle||{}},{left:m,top:o});s.push(a);const c=p*h.subXCell;e.list.forEach(((n,h)=>{const a=r+h*c,p=i({width:c,height:u,...j},{value:n,...l,...(null==e?void 0:e.style)||{}},{left:a,top:o});s.push(t([a+c,o,a+c,o+u],j)),s.push(p)}))}(e,w,x),w.push(t([m,x+o,a,x+o],j)),w.push(t([r,x,r,x+o],j))}}));const C=w.length>0?new e.Group([...w],{...s,objectCaching:!1}):null;C&&C.sendToBack(),C&&u.value.add(C)}()}export{u as useTop};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultStyle as s,drawTextGroup as i,defaultTextStyle as l}from"../useDraw.js";import"date-fns";import{flatten as o}from"lodash-es";import"../useEvent.js";import"../useShadow.js";import"../useCommon.js";import"vue";import"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function u(u,n){const{grid:h,originX:r,endX:a,xCellWidth:p,gridXNumber:c,top:d,xScalevalueHeight:f,iconsWidth:m,topList:v,endXLimit:g,canvasWidth:y,borderStyle:j,surplusCell:S}=n;!function(){const w=[];g&&w.push(new e.Line([g,0,y,0],j));let x=0;v.forEach(((e,s)=>{if(s>0&&(x+=n[`${v[s-1].key}Height`]),"xScalevalue"==e.key)!function(e,s,o){const u=d.dayHeight;if(!u)return;s.push(t([r,o+u,a,o+u],j));const n=p*h.subSecondXCell,f=(c-S[1]-S[3])/h.subSecondXCell;for(let h=0;h<f;h++){const a=r+h*n,p=h%2==0?"上午":"下午",c=i({width:n,height:u,...j},{value:p,...l,...e.style||{}},{left:a,top:o});s.push(c),s.push(t([a+n,o,a+n,o+u],j))}}(e,w,x),function(e,s,u){var n;const c=d.xScalevalue.show&&null!=(n=d.dayHeight)?n:0,v=f-c;if(!v)return;s.push(t([m,u+f,a,u+f],j));const g=i({width:r-m,height:f,...j},{value:d.xScalevalue.title,...l,...e.style||{},...e.titleStyle||{}},{left:m,top:u});s.push(g),s.push(t([r,u,r,u+f],j));const y=[];for(let e=0;e<h.mainXCell;e++)y.push(d.xScalevalue.list);o(y).forEach(((o,n)=>{const h=r+n*p,a=i({width:p,height:v,...j},{value:o.value,...l,...e.style||{},...o.style||{}},{left:h,top:u+c});s.push(a),s.push(t([h+p,u+c,h+p,u+c+v],j))}))}(e,w,x);else{if(!n[`${e.key}Height`])return;const o=n[`${v[s].key}Height`];!function(e,s,o){const u=n[`${e.key}Height`],a=i({width:r-m,height:u,...j},{value:e.title,...l,...(null==e?void 0:e.style)||{},...e.titleStyle||{}},{left:m,top:o});s.push(a);const c=p*h.subXCell;e.list.forEach(((n,h)=>{const a=r+h*c,p=i({width:c,height:u,...j},{value:n,...l,...(null==e?void 0:e.style)||{}},{left:a,top:o});s.push(t([a+c,o,a+c,o+u],j)),s.push(p)}))}(e,w,x),w.push(t([m,x+o,a,x+o],j)),w.push(t([r,x,r,x+o],j))}}));const C=w.length>0?new e.Group([...w],{...s,objectCaching:!1}):null;C&&C.sendToBack(),C&&u.value.add(C)}()}export{u as useTop};
@@ -1,6 +1,6 @@
1
- import { fabric } from '../../../../../shared/utils/fabricjs';
1
+ import { fabric } from '../../../../shared/utils/fabricjs';
2
2
  type Point = [number, number];
3
3
  export declare function useShadow(): {
4
- createShadowLines: (coordinates: Point[], angle?: number, space?: number) => fabric.Line[];
4
+ createShadowLines: (coordinates: Point[], angle?: number, space?: number, style?: {}) => fabric.Line[];
5
5
  };
6
6
  export {};