cnhis-design-vue 3.2.15-beta.2 → 3.2.15-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -87
- package/es/components/ai-chat/index.d.ts +9 -0
- package/es/components/ai-chat/src/Index.vue.d.ts +9 -0
- package/es/components/ai-chat/src/Index.vue2.js +1 -1
- package/es/components/ai-chat/src/components/ChatCard.js +1 -1
- package/es/components/ai-chat/src/components/ChatMain.js +1 -1
- package/es/components/ai-chat/src/components/ChatPatient.vue2.js +1 -1
- package/es/components/ai-chat/style/index.css +1 -1
- package/es/components/big-table/src/BigTable.vue2.js +1 -1
- package/es/components/branch-notice/index.d.ts +425 -9
- package/es/components/branch-notice/src/BranchNotice.vue.d.ts +378 -9
- package/es/components/branch-notice/src/BranchNotice.vue2.js +1 -1
- package/es/components/branch-notice/src/canstants.d.ts +2 -1
- package/es/components/branch-notice/src/canstants.js +1 -1
- package/es/components/branch-notice/src/components/NoticeItem.vue.d.ts +168 -44
- package/es/components/branch-notice/src/components/NoticeItem.vue.js +1 -0
- package/es/components/branch-notice/src/components/NoticeItem.vue2.js +1 -0
- package/es/components/branch-notice/src/components/NoticeItemAside.vue.d.ts +74 -5
- package/es/components/branch-notice/src/components/NoticeItemAside.vue.js +1 -0
- package/es/components/branch-notice/src/components/NoticeItemAside.vue2.js +1 -0
- package/es/components/branch-notice/src/components/NoticeOperationList.vue.js +1 -0
- package/es/components/branch-notice/src/components/NoticeOperationList.vue2.js +1 -0
- package/es/components/branch-notice/src/drawLine.js +1 -1
- package/es/components/branch-notice/src/hooks/useTheme.d.ts +1 -0
- package/es/components/branch-notice/src/hooks/useTheme.js +1 -0
- package/es/components/branch-notice/src/types.d.ts +22 -4
- package/es/components/branch-notice/style/index.css +1 -1
- package/es/components/button-print/src/components/IdentityVerification.vue2.js +1 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
- package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
- package/es/components/classification/src/components/search-filter/index.vue2.js +1 -1
- package/es/components/classification/src/components/table-modal/index.vue2.js +1 -1
- package/es/components/classification/src/index.vue2.js +1 -1
- package/es/components/expand-field/src/components/FormBatchOptionsModal.vue2.js +1 -1
- package/es/components/expand-field/src/components/PersonModal.vue2.js +1 -1
- package/es/components/expand-field/src/components/form.vue2.js +1 -1
- package/es/components/expand-field/src/index.vue2.js +1 -1
- package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -1
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
- package/es/components/fabric-chart/src/hooks/index.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/index.js +1 -1
- package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCommon.d.ts +1 -2
- package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
- package/es/components/fabric-chart/src/hooks/{temperature/useShadow.d.ts → useShadow.d.ts} +2 -2
- package/es/components/fabric-chart/src/hooks/useShadow.js +1 -0
- package/es/components/fabric-chart/src/utils/index.d.ts +1 -0
- package/es/components/fabric-chart/src/utils/index.js +1 -1
- package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldColor.vue2.js +1 -1
- package/es/components/field-set/src/FieldFilter.vue.d.ts +3 -2
- package/es/components/field-set/src/FieldFilter.vue2.js +1 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/field-set/src/TableStyle.vue2.js +1 -1
- package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -1
- package/es/components/field-set/src/components/edit-filter.vue2.js +1 -1
- package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
- package/es/components/field-set/src/components/table-row.vue2.js +1 -1
- package/es/components/field-set/src/constants/filter.js +1 -1
- package/es/components/field-set/src/constants/index.js +1 -1
- package/es/components/field-set/src/utils/index.js +1 -1
- package/es/components/form-config/index.d.ts +1021 -1
- package/es/components/form-config/src/FormConfig.vue.d.ts +1021 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +0 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue2.js +1 -1
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +1019 -0
- package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -1
- package/es/components/form-config/src/constants/index.js +1 -1
- package/es/components/form-config/src/hooks/useLocale.js +1 -1
- package/es/components/form-config/style/index.css +1 -1
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/components/renderer/combination/combination.js +1 -1
- package/es/components/form-render/src/components/renderer/complex.js +1 -1
- package/es/components/form-render/src/components/renderer/date.js +1 -1
- package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
- package/es/components/form-render/src/components/renderer/select.d.ts +6 -0
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/components/renderer/switch.js +1 -1
- package/es/components/form-render/src/components/renderer/text.js +1 -1
- package/es/components/form-render/src/components/renderer/textarea.js +1 -1
- package/es/components/form-render/src/hooks/useAnchor.js +1 -1
- package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
- package/es/components/form-render/src/hooks/useComplexOptions.js +1 -1
- package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
- package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
- package/es/components/form-render/src/hooks/useLowCodeReactions.js +1 -1
- package/es/components/form-render/src/hooks/usePresetScope.js +1 -1
- package/es/components/form-render/src/utils/index.js +1 -1
- package/es/components/iho-chat/index.d.ts +518 -83
- package/es/components/iho-chat/src/Index.vue.d.ts +518 -83
- package/es/components/iho-chat/src/Index.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +33 -8
- package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +33 -8
- package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +33 -8
- package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +101 -26
- package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +34 -9
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +33 -34
- package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +34 -9
- package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
- package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +34 -8
- package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue.d.ts +1 -1
- package/es/components/iho-chat/src/components/SiderList.vue.d.ts +207 -4
- package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
- package/es/components/iho-chat/src/components/Video.vue.d.ts +1 -0
- package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
- package/es/components/iho-chat/src/components/userItemRender.d.ts +18 -0
- package/es/components/iho-chat/src/components/userItemRender.js +1 -0
- package/es/components/iho-chat/src/hooks/useData.d.ts +6 -2
- package/es/components/iho-chat/src/hooks/useData.js +1 -1
- package/es/components/iho-chat/src/hooks/useVideo.d.ts +1 -0
- package/es/components/iho-chat/src/hooks/useVideo.js +1 -1
- package/es/components/iho-chat/src/hooks/useWebSocket.js +1 -1
- package/es/components/iho-chat/src/types/index.d.ts +13 -0
- package/es/components/iho-chat/src/utils/index.js +1 -1
- package/es/components/iho-chat/style/iconfont.ttf +0 -0
- package/es/components/iho-chat/style/index.css +1 -1
- package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue2.js +1 -1
- package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
- package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue2.js +1 -1
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/info-header/src/components/patientInfo/index.vue2.js +1 -1
- package/es/components/keyboard/src/components/NumberPanel.vue2.js +1 -1
- package/es/components/map/src/Map.vue2.js +1 -1
- package/es/components/quick-search/src/index.vue2.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/scale-view/src/components/formitem/r-sign.js +1 -1
- package/es/components/scale-view/src/components/formitem/standard-modal.js +1 -1
- package/es/components/scale-view/src/hooks/scaleview-methods.js +1 -1
- package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
- package/es/components/select-label/src/SelectLabel.vue2.js +1 -1
- package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +1 -1
- package/es/components/table-export-field/src/components/ExportModal.vue2.js +1 -1
- package/es/components/table-export-field/src/components/SaveProjectModal.vue2.js +1 -1
- package/es/components/table-filter/src/components/bi-filter/helpers/options.js +1 -1
- package/es/components/table-filter/src/components/render-widget/components/SelectDynamic.vue2.js +1 -1
- package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +1 -1
- package/es/components/table-filter/src/tool/baseOptions.js +1 -1
- package/es/components/template-render/src/components/index.d.ts +23 -23
- package/es/components/tooth-bitmap/src/ToothBitmap.vue2.js +1 -1
- package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue2.js +1 -1
- package/es/components/vod-chunk-upload/src/vod-upload-modal.js +1 -1
- package/es/shared/assets/img/ai__avatar.png.js +1 -1
- package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
- package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
- package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
- package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
- package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
- package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
- package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
- package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
- package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
- package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
- package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/logo.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/hooks/useLevelSearchCascader.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/es/shared/types/business.d.ts +4 -0
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/components/fabric-chart/src/hooks/temperature/useShadow.js +0 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- package/es/shared/utils/fabricjs/index.d.ts +0 -6823
- package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as n,createElementVNode as o,createVNode as i,unref as d,withCtx as s,Fragment as u,renderList as r,createTextVNode as c,toDisplayString as m,createBlock as p,withModifiers as v}from"vue";import{useMessage as w,NGrid as g,NGridItem as f,NTooltip as y,NIcon as C,NPopconfirm as h,NButton as _}from"naive-ui";import{Brush as k}from"@vicons/ionicons5";import x from"./components/form.vue.js";import B from"./hooks/useAsyncData.js";import{InjectionExpandFieldApiConfig as D}from"./constants/index.js";const L={class:"tableset-expand-field"},b={class:"list"},M={class:"table-modal-list"},N={class:"list-content"},I=o("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[o("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),o("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),o("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),o("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),z={class:"footer"};var A=t({__name:"index",props:{id:{type:String,default:""},expandFieldApiConfig:{type:Object},tableData:{type:Array,default:()=>[]},orgId:{type:String,default:""}},emits:["closeModal"],setup(t,{emit:A}){var S,j,F,O,V,E;const P=t,U=w(),{deleteExtendFieldById:q}=B();e(D,P.expandFieldApiConfig);const G=[{title:(null==(S=window.getLanguageByCode)?void 0:S.call(window,"10010.1.529"))||"字段标题",columnName:"name",span:3},{title:(null==(j=window.getLanguageByCode)?void 0:j.call(window,"10010.1.530"))||"字段键名",columnName:"code",span:3},{title:(null==(F=window.getLanguageByCode)?void 0:F.call(window,"10010.1.532"))||"字段类型",columnName:"html_type",span:3},{title:(null==(O=window.getLanguageByCode)?void 0:O.call(window,"10010.1.15"))||"问号提示",columnName:"remark",span:4},{title:(null==(V=window.getLanguageByCode)?void 0:V.call(window,"10010.1.236"))||"创建时间",columnName:"createdDate",span:4},{title:"修改时间",columnName:"updatedDate",span:4},{title:(null==(E=window.getLanguageByCode)?void 0:E.call(window,"10010.1.241"))||"操作",columnName:"operator",span:3}],H=l(!1),J=l("add"),K=l({});function Q(){A("closeModal")}function R(){H.value=!0,J.value="add",K.value={}}function T(){H.value=!1}return(e,l)=>(a(),n("div",L,[o("div",b,[o("div",M,[i(d(g),{cols:24,class:"list-title"},{default:s((()=>[(a(),n(u,null,r(G,(t=>i(d(f),{span:t.span,class:"list-title-item",key:t.columnName},{default:s((()=>[c(m(t.title),1)])),_:2},1032,["span"]))),64))])),_:1}),o("div",N,[(a(!0),n(u,null,r(t.tableData,((t,e)=>(a(),p(d(g),{key:e,class:"list-content-block"},{default:s((()=>[i(d(f),{span:3,title:t.name,class:"list-content-item"},{default:s((()=>[c(m(t.name),1)])),_:2},1032,["title"]),i(d(f),{span:3,title:t.code,class:"list-content-item"},{default:s((()=>[c(m(t.code),1)])),_:2},1032,["title"]),i(d(f),{span:3,title:t.html_type,class:"list-content-item"},{default:s((()=>[c(m(t.html_type),1)])),_:2},1032,["title"]),i(d(f),{span:4,title:t.remark,class:"list-content-item"},{default:s((()=>[c(m(t.remark),1)])),_:2},1032,["title"]),i(d(f),{span:4,title:t.createdDate,class:"list-content-item"},{default:s((()=>[c(m(t.createdDate),1)])),_:2},1032,["title"]),i(d(f),{span:4,title:t.updatedDate,class:"list-content-item"},{default:s((()=>[c(m(t.updatedDate),1)])),_:2},1032,["title"]),i(d(f),{span:3,class:"list-content-item"},{default:s((()=>[i(d(y),{duration:0},{trigger:s((()=>[i(d(C),{component:d(k),onClick:v((e=>{return l=t,H.value=!0,J.value="edit",void(K.value={...l});var l}),["prevent","stop"])},null,8,["component","onClick"])])),default:s((()=>{var t;return[c((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.284"))||"编辑")]})),_:2},1024),i(d(y),{duration:0},{trigger:s((()=>[i(d(h),{onPositiveClick:e=>async function(t){var e,l;try{const a=await q(t,P.expandFieldApiConfig);if("SUCCESS"!==(null==a?void 0:a.result))return void U.error((null==a?void 0:a.resultMsg)||(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.521"))||"删除失败");U.success((null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.411"))||"删除成功")}catch(t){U.error(t)}}(t)},{trigger:s((()=>[i(d(C),null,{default:s((()=>[I])),_:1})])),default:s((()=>[c(" 确认要删除-"+m(t.name)+"吗? ",1)])),_:2},1032,["onPositiveClick"])])),default:s((()=>{var t;return[c((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.215"))||"删除")]})),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])]),o("div",z,[i(d(_),{onClick:Q},{default:s((()=>{var t;return[c((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.
|
1
|
+
import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as n,createElementVNode as o,createVNode as i,unref as d,withCtx as s,Fragment as u,renderList as r,createTextVNode as c,toDisplayString as m,createBlock as p,withModifiers as v}from"vue";import{useMessage as w,NGrid as g,NGridItem as f,NTooltip as y,NIcon as C,NPopconfirm as h,NButton as _}from"naive-ui";import{Brush as k}from"@vicons/ionicons5";import x from"./components/form.vue.js";import B from"./hooks/useAsyncData.js";import{InjectionExpandFieldApiConfig as D}from"./constants/index.js";const L={class:"tableset-expand-field"},b={class:"list"},M={class:"table-modal-list"},N={class:"list-content"},I=o("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[o("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),o("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),o("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),o("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),z={class:"footer"};var A=t({__name:"index",props:{id:{type:String,default:""},expandFieldApiConfig:{type:Object},tableData:{type:Array,default:()=>[]},orgId:{type:String,default:""}},emits:["closeModal"],setup(t,{emit:A}){var S,j,F,O,V,E;const P=t,U=w(),{deleteExtendFieldById:q}=B();e(D,P.expandFieldApiConfig);const G=[{title:(null==(S=window.getLanguageByCode)?void 0:S.call(window,"10010.1.529"))||"字段标题",columnName:"name",span:3},{title:(null==(j=window.getLanguageByCode)?void 0:j.call(window,"10010.1.530"))||"字段键名",columnName:"code",span:3},{title:(null==(F=window.getLanguageByCode)?void 0:F.call(window,"10010.1.532"))||"字段类型",columnName:"html_type",span:3},{title:(null==(O=window.getLanguageByCode)?void 0:O.call(window,"10010.1.15"))||"问号提示",columnName:"remark",span:4},{title:(null==(V=window.getLanguageByCode)?void 0:V.call(window,"10010.1.236"))||"创建时间",columnName:"createdDate",span:4},{title:"修改时间",columnName:"updatedDate",span:4},{title:(null==(E=window.getLanguageByCode)?void 0:E.call(window,"10010.1.241"))||"操作",columnName:"operator",span:3}],H=l(!1),J=l("add"),K=l({});function Q(){A("closeModal")}function R(){H.value=!0,J.value="add",K.value={}}function T(){H.value=!1}return(e,l)=>(a(),n("div",L,[o("div",b,[o("div",M,[i(d(g),{cols:24,class:"list-title"},{default:s((()=>[(a(),n(u,null,r(G,(t=>i(d(f),{span:t.span,class:"list-title-item",key:t.columnName},{default:s((()=>[c(m(t.title),1)])),_:2},1032,["span"]))),64))])),_:1}),o("div",N,[(a(!0),n(u,null,r(t.tableData,((t,e)=>(a(),p(d(g),{key:e,class:"list-content-block"},{default:s((()=>[i(d(f),{span:3,title:t.name,class:"list-content-item"},{default:s((()=>[c(m(t.name),1)])),_:2},1032,["title"]),i(d(f),{span:3,title:t.code,class:"list-content-item"},{default:s((()=>[c(m(t.code),1)])),_:2},1032,["title"]),i(d(f),{span:3,title:t.html_type,class:"list-content-item"},{default:s((()=>[c(m(t.html_type),1)])),_:2},1032,["title"]),i(d(f),{span:4,title:t.remark,class:"list-content-item"},{default:s((()=>[c(m(t.remark),1)])),_:2},1032,["title"]),i(d(f),{span:4,title:t.createdDate,class:"list-content-item"},{default:s((()=>[c(m(t.createdDate),1)])),_:2},1032,["title"]),i(d(f),{span:4,title:t.updatedDate,class:"list-content-item"},{default:s((()=>[c(m(t.updatedDate),1)])),_:2},1032,["title"]),i(d(f),{span:3,class:"list-content-item"},{default:s((()=>[i(d(y),{duration:0},{trigger:s((()=>[i(d(C),{component:d(k),onClick:v((e=>{return l=t,H.value=!0,J.value="edit",void(K.value={...l});var l}),["prevent","stop"])},null,8,["component","onClick"])])),default:s((()=>{var t;return[c((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.284"))||"编辑")]})),_:2},1024),i(d(y),{duration:0},{trigger:s((()=>[i(d(h),{onPositiveClick:e=>async function(t){var e,l;try{const a=await q(t,P.expandFieldApiConfig);if("SUCCESS"!==(null==a?void 0:a.result))return void U.error((null==a?void 0:a.resultMsg)||(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.521"))||"删除失败");U.success((null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.411"))||"删除成功")}catch(t){U.error(t)}}(t)},{trigger:s((()=>[i(d(C),null,{default:s((()=>[I])),_:1})])),default:s((()=>[c(" 确认要删除-"+m(t.name)+"吗? ",1)])),_:2},1032,["onPositiveClick"])])),default:s((()=>{var t;return[c((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.215"))||"删除")]})),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])]),o("div",z,[i(d(_),{onClick:Q},{default:s((()=>{var t;return[c((null==(t=window.getLanguageByCode)?void 0:t.call(window,"10010.1.28"))||"取消")]})),_:1}),i(d(_),{type:"info",onClick:R},{default:s((()=>[c("增加字段")])),_:1})])]),i(x,{visible:H.value,formItemData:K.value,formOntype:J.value,id:t.id,orgId:t.orgId,onCancelModal:T},null,8,["visible","formItemData","formOntype","id","orgId"])]))}});export{A as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as r,reactive as t,computed as o,onMounted as s,onBeforeUnmount as a,openBlock as i,createElementBlock as
|
1
|
+
import{defineComponent as e,ref as r,reactive as t,computed as o,onMounted as s,onBeforeUnmount as a,openBlock as i,createElementBlock as u,normalizeStyle as n,unref as l,createElementVNode as p,Fragment as c,createVNode as h,mergeProps as d,createCommentVNode as m}from"vue";import{fabric as f}from"../../../shared/utils/fabricjs/index.js";import v from"./components/PopupTip.vue.js";import w from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"./hooks/useEvent.js";import"./hooks/useShadow.js";import"./hooks/useCommon.js";import{useBirthProcessChart as g}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as k}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as C}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";import{useElectrocardiogramChart as R}from"./hooks/electrocardiogram/useElectrocardiogramChart.js";import{useNewBirthProcessChart as j}from"./hooks/newBirthProcess/useNewBirthProcessChart.js";var P=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},popupTipRender:{type:Function},addRenderItem:{type:Function}},emits:["change","add","remove","edit","right-click","select","add:prevent","click:grid","event-click"],setup(e,{expose:P,emit:y}){const b=e,x=r(null),I=r(),T=t({show:!1,point:{x:0,y:0},list:[],movable:!1,sourceData:[],isTarget:!1}),M=t({show:!1,point:{x:0,y:0},list:[],target:null}),B=o((()=>{var e;return null==(e=I.value)?void 0:e.wrapperEl})),S=o((()=>({width:`${b.data.width||800}px`,height:`${b.data.height||500}px`}))),{propItems:A,redrawPoints:E,select:F,clickMenu:_,useMeasureRuler:D,useCaliper:G,useCaliperRuler:L,useRectRuler:$,updatePolyline:q,getGridInfo:H,redrawLinePoints:N}=function(){const e=[I,b,y,x,T,M];switch(b.type){case"birthProcess":return g(...e);case"surgicalAnesthesia":return C(...e,!!b.popupTipRender);case"electrocardiogram":return R(...e);case"newBirthProcess":return j(...e);default:return k(...e)}}();return s((()=>{I.value=new f.Canvas(x.value,{width:A.canvasWidth,height:A.canvasHeight,backgroundColor:"#fff",selection:!1,stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),a((()=>{var e,r,t,o;null==(r=null==(e=I.value)?void 0:e.off)||r.call(e),null==(o=null==(t=I.value)?void 0:t.clear)||o.call(t)})),P({redrawPoints:E,redrawLinePoints:N,select:F,canvas:I,useMeasureRuler:D,useCaliper:G,useCaliperRuler:L,useRectRuler:$,updatePolyline:q,getGridInfo:H}),(r,t)=>(i(),u("div",{class:"c-fabric-chart",style:n(l(S))},[p("canvas",{ref_key:"canvasRef",ref:x},null,512),l(B)?(i(),u(c,{key:0},[h(v,d({popupTipRender:e.popupTipRender,...T},{propItems:l(A)}),null,16,["propItems"]),h(l(w),d({propItems:l(A)},M,{show:M.show,"onUpdate:show":t[0]||(t[0]=e=>M.show=e),onClickMenu:l(_)}),null,16,["propItems","show","onClickMenu"])],64)):m("v-if",!0)],4))}});export{P as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawPoint as n,defaultStyle as i,drawText as r,defaultTextStyle as l,drawTextAndIconGroup as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as c}from"../useGrid.js";import{useBirthProcessCumputedPoint as u}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as h,drawScaleLine as f}from"../useScaleColumn.js";import{useCommon as p}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as b,last as w,range as j}from"lodash-es";import"../temperature/useShadow.js";import"../../constants/index.js";import"@vueuse/shared";import{format as k}from"date-fns";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function x(x,S,C,P,A){const{computedX:E,computedY:O,getXValue:X,getYValue:L}=u(S),{getEqualXTypes:M,handleAddPrevent:Y,isGridLimit:T,setPrevAndNextPoint:H,getPointEventProps:I}=p(x,C,S),{xAxis:D,grid:B,originX:G,originY:N,xCellWidth:W,endY:V,startTime:F,leftAddAreaWidth:R,leftScales:$,rightScales:q,yCellHeight:z,endX:J,scaleValues:K,canvasWidth:Q,borderStyle:U,rightAddAreaWidth:Z,event:_,originYCervix:ee,other:te,canvasHeight:oe,scalebarBorder:ne,padding:ie}=S,re=b(K),le=new Set;function se(){re.filter((({showData:e=!0})=>e)).forEach(((e,s)=>{var a;const c=[],u=[],d=[],{pointAttr:h={},lineAttr:f={},title:p="",key:g,type:v="circle",childbirthStyle:m={},surgicalDeliveryStyle:y={},dystociaStyle:b={}}=e;function w(r,l,s,a){if(l[s]){const{type:c="circle",style:u={},arrowStyle:h={}}=e[s+"Style"],p=E(l[s]),g=t([...r,p,r[1]],{...f,strokeDashArray:[4,2],...i}),v="dystocia"===s&&r[1]-N>=z?r[1]-z:r[1],m=n(c,{left:p,top:v,...u,...i}),y=v+m.height/2,b="dystocia"===s?o([p,y+z,y],f,"up"):null;g&&(d.push(g),a[s+"Line"]={obj:g,type:"line",left:p-r[0]}),m&&(d.push(m),a[s]={obj:m,left:p-r[0]}),b&&(d.push(b),a[s+"Arrow"]={obj:b,left:p-r[0],moveHide:!0})}}null==(a=e.data)||a.forEach(((a,y)=>{!function(a,y,b){let j,S;const A=e.data[b+1],E=he(A,e);if(a&&E&&!y.breakpoint)S=t([...a,...E],{...f});else if(a&&!E&&!y.breakpoint){const o=he(A,e);S=o?t([...a,...o],{...f}):null}const O={};if(["fetalPresentation","cervix"].includes(g)){let e,t;if(y.childbirth){const{type:s="arrow",style:c={},textStyle:u={}}=m;if("arrow"===s){const t=a[1]+z;e=o([a[0],a[1],t],c)}else e=n(s,{left:a[0],top:a[1],...c,...i,hoverCursor:"default"});t=r([a[0]+W/2,a[1]+z/2],{value:String(y.childbirth),...l,originX:"left",originY:"center",...u}),e&&(d.push(e),Object.assign(O,{childbirthIcon:{obj:e,type:s}})),t&&(d.push(t),Object.assign(O,{childbirthText:{obj:t,left:W/2,top:z/2}}))}}"fetalPresentation"===g&&(w(a,y,"surgicalDelivery",O),w(a,y,"dystocia",O));const M=u[b-1],Y={origin:{data:y,title:p,key:g||"",dataIndex:s,index:b},leftLine:M,rightLine:S,otherObj:O,...h,...I()};a&&(M||(Y.leftLine=null),j=n(v,{left:a[0],top:a[1],...Y}));u.push(S),j&&(!function(e){_.hovered&&(e.on("mouseover",(()=>{de(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ue(e),function(e){var t,o;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:o,top:n=0,left:i=0,type:r="",moveHide:l}=t||{};o&&("line"===r?o.setCoords().set({x1:e.left,y1:e.top,x2:e.left+i,y2:e.top}):o.setCoords().set({left:e.left+i,top:e.top+n}),l&&(x.value.remove(o),delete e.otherObj.obj))}))}(e),_.hovered&&de(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:X(e.left),value:L(t,e.top)}};["surgicalDelivery","dystocia"].some((t=>{var n;(null==(n=e.otherObj[t])?void 0:n.obj)&&(o.data[t]=k(new Date(X(e.left+e.otherObj[t].left)),"yyyy-MM-dd HH:mm"))})),x.value.discardActiveObject(),C("change",o),ae(o,"change")}}))}(j),c.push(j),le.add(j))}(he(a,e),a,y)})),Promise.all(c).then((e=>{const t=u.filter((e=>e));H(e),Promise.all(d).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront();const{childbirthIcon:t}=e.otherObj||{};(null==t?void 0:t.obj)&&"arrow"!==(null==t?void 0:t.type)&&t.obj.bringToFront()}))}))}))}))}function ae(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=re.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ce()}function ce(){var e;le.size&&(null==(e=x.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}([...le]))),le.clear(),se()}function ue(e){const t=e.prevPoint?e.prevPoint.left:G,o=e.nextPoint?e.nextPoint.left:J;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<ee&&e.set("top",ee),e.top<N&&e.set("top",N),e.top>V&&e.set("top",V),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function de(e,t="moving"){const{title:o,key:n,data:i}=e.origin;P.point={x:e.left,y:e.top},P.list=[`${o} ${"hover"===t?i.value:L(n,e.top)}`,`时间 ${X(e.left).slice(-5)}`],P.show=!0}function he(e,t){if(v(e)&&function(e){const t=F+864e5,o=m(e);return o>=F&&o<=t}(e.time)){const o=E(e.time),n=O(t.key,t.range,e.value);return[o,n<N?N:n>V?V:n]}}function fe(e,t){return e+1>t[1]?t[0]:e+1}return c(x,S),function(){const t=ne?{width:Q-R-Z-1,left:R}:{width:J-G-(q.length?0:1),left:G},o=new e.Rect({...U,height:V-ie[0]-1,top:ie[0],fill:"transparent",...t});x.value.add(o)}(),function(){function t(t,o="left"){let n="left"===o?R:J;t.forEach(((t,o)=>{const{range:s,spaceValue:c,width:u,title:p,titleStyle:g,key:v,position:m="center",spaceGridNumber:b=1,showNumber:w=!0,showMaxMinNumber:j=!0,showName:k=!0}=t,S=[],C=[],P=n+u/2,A=y(s,c),E=A.length,{lineXMain:O,lineXSub:X,textLeft:L}=d(m,n,u);A.forEach(((e,o)=>{const n=V-o*z*b,i=0===o?V-8:o!==A.length-1||!ie[0]||ee&&"FHR"!==v?n:N+8;!w||(0===o||o===E-1)&&!j||S.push(h(String(e),t,L,i)),C.push(...f(t,o,O,X,n,z,N,E,1))}));const M=[],Y=ne?new e.Rect({...a,strokeWidth:.5,width:u,height:V-ie[0],left:P,top:ie[0]+(V-ie[0])/2}):null;if(Y&&M.push(Y),k){const e=r([P,N-ie[0]>0?N-z/2:z/2],{value:String(p),...l,...g});e&&M.push(e)}const T=new e.Group([...C,...S,...M],{objectCaching:!1,...i});x.value.add(T),T.sendToBack(),n+=u}))}t($),t(q,"right")}(),function(){const{show:t,startTime:o,range:n=[0,23],position:s="top",style:a}=D.time,{show:c,range:u=[0,23],position:d,style:h={}}=D.processTime;if(t||c){const f=[],p=j(u[0],u[1]+1),g=[],v=[],m=z/2;for(let e=0;e<B.mainXCell;e++){if(t){const{textAlign:t="center"}=a,i=G+("center"===t?W/2:0),c=0===e&&"center"!==t?i+5:i,u=0===e?+o.slice(11,13):fe(w(f),n);f.push(u);const d="top"===s?N-m:V+m;g.push(r([c+e*W,d],{value:String(u),...l,...a})),e===B.mainXCell-1&&"center"!==t&&g.push(r([J-1,d],{value:String(fe(w(f),n)),...l,...a,originX:"center"!==t?"right":"center"}))}if(c&&e<=p.length){const{textAlign:t="center"}=h,o=G+("center"===t?W/2:0),n=0===e&&"center"!==t?o+5:o,i="top"===d?m:oe-m;v.push(r([n+e*W,i],{value:String(p[e]),...l,...h})),e===B.mainXCell-1&&"center"!==t&&v.push(r([J-1,i],{value:String(w(p)),...l,...a,originX:"center"!==t?"right":"center"}))}}const y=new e.Group([...g,...v],{objectCaching:!1,...i});x.value.add(y),x.value.sendToBack(y)}}(),function(){var e;const o=Object.values(te),n=[],i={},r=re.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=O(o,n,10),l=[0,t],s=[-t/e,0],a=[(V-i-t)/e,V-i],c=[J-G,e*(J-G)+t];let u=[],d=[];function h([o,n]){return Math.abs(n-e*o-t)<=1}function f([e,t]){const[o,n]=[...p([e,t])];return o>=G&&o<=J&&n>=i&&n<=V}function p([e,t]){return[G+e,V-t]}return h(l)&&f(l)&&(u=p(l)),h(s)&&f(s)&&(u=p(s)),h(a)&&f(a)&&(d=p(a)),h(c)&&f(c)&&(d=p(c)),[...u,...d]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=re.find((e=>e.key===o));if(r){const r=O(o,i,0);n.push(t([G,r,J,r],{...e}))}break}case"alert":if(l){const{key:o,range:a}=r||{},c=216e5,u={time:k(new Date(m(l.time)+c),"yyyy-MM-dd HH:mm"),value:10},[d,h]=[E(l.time)-G,V-O(o,a,l.value)],[f,p]=[E(u.time)-G,V-O(o,a,u.value)],g=(p-h)/(f-d),v=h-d*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,c=s(o,r-(E(k(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-E(l.time))*o);c.length>0&&n.push(t(c,{...e}))}}})),x.value.add(...n)}(),se(),function(){function e(e,t){const o=re.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}S.event.evented&&x.value.on("mouse:up",(t=>{var o,n;if(3===t.button){const{x:i=0,y:r=0}=t.pointer||{};i>=G&&i<=J&&r>=N&&r<=V&&(A.point={x:i,y:r},A.show=!0,t.target?(A.target=t.target,A.list=[(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.220"))||"删除节点"],[...le].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&A.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(A.target=null,A.list=[(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.219"))||"新增节点"],re.filter((e=>e.show)).forEach((o=>{if(!M([...le],i,"key").includes(o.key)){if(["cervix","fetalPresentation"].includes(o.key)&&r<ee)return;A.list.push(e(o,t.pointer))}})),1===A.list.length&&(A.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=Q-Z/2;function t(e,t){if(!e.length)return;let n=N;const i=[];e.forEach((e=>{const o=(e.alias||e.title).split("").join("\n"),a=K.findIndex((t=>t.key===e.key));if(e.alias){const s=r([t,n],{value:o,...l,originY:"top",...e.titleStyle});o&&(n+=s.height+15,i.push(s))}else{const{text:r,icon:l}=s(o,e,{text:{originX:"center",originY:"top",left:t,top:n},icon:{left:t,topY:n,originX:"center",originY:"top",origin:{type:e.type,dataIndex:a},...S.event}},"vertical");n+=r.height+l.height+15,(c=l).on("moving",(()=>{c.set("originY","center"),T(c)?(ue(c),de(c)):P.show=!1})),c.on("mouseup:before",(e=>{if(P.show=!1,0===e.e.button&&T(c))if(M([...le],c.left,"key").includes(c.origin.key))Y("repeat");else{const e={data:{time:X(c.left),value:L(c.origin.key,c.top)},...c.origin};C("add",e),ae(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(c)})),i.push(r,l)}var c})),o(i),x.value.add(...i)}function o(e){const t=w(e),o=(V-N)/2,n=(t.height+t.top-N)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t($,R/2),t(q,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(C("remove",o),ae(o,"remove")):(Object.assign(o,{data:{time:X(e.pointer.x),value:L(e.origin.key,e.pointer.y)}}),C("add",o),ae(o))},redrawPoints:ce}}export{x as useBirthProcess};
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawPoint as n,defaultStyle as i,drawText as r,defaultTextStyle as l,drawTextAndIconGroup as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as c}from"../useGrid.js";import{useBirthProcessCumputedPoint as u}from"../useCumputedPoint.js";import"../useEvent.js";import"../useShadow.js";import{getScaleInfo as d,drawScaleNumber as h,drawScaleLine as f}from"../useScaleColumn.js";import{useCommon as p}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as b,last as w,range as j}from"lodash-es";import"../../constants/index.js";import"@vueuse/shared";import{format as k}from"date-fns";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"@vueuse/core";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function x(x,S,C,P,A){const{computedX:E,computedY:O,getXValue:X,getYValue:L}=u(S),{getEqualXTypes:M,handleAddPrevent:Y,isGridLimit:T,setPrevAndNextPoint:H,getPointEventProps:I}=p(x,C,S),{xAxis:D,grid:B,originX:G,originY:N,xCellWidth:W,endY:V,startTime:F,leftAddAreaWidth:R,leftScales:$,rightScales:q,yCellHeight:z,endX:J,scaleValues:K,canvasWidth:Q,borderStyle:U,rightAddAreaWidth:Z,event:_,originYCervix:ee,other:te,canvasHeight:oe,scalebarBorder:ne,padding:ie}=S,re=b(K),le=new Set;function se(){re.filter((({showData:e=!0})=>e)).forEach(((e,s)=>{var a;const c=[],u=[],d=[],{pointAttr:h={},lineAttr:f={},title:p="",key:g,type:v="circle",childbirthStyle:m={},surgicalDeliveryStyle:y={},dystociaStyle:b={}}=e;function w(r,l,s,a){if(l[s]){const{type:c="circle",style:u={},arrowStyle:h={}}=e[s+"Style"],p=E(l[s]),g=t([...r,p,r[1]],{...f,strokeDashArray:[4,2],...i}),v="dystocia"===s&&r[1]-N>=z?r[1]-z:r[1],m=n(c,{left:p,top:v,...u,...i}),y=v+m.height/2,b="dystocia"===s?o([p,y+z,y],f,"up"):null;g&&(d.push(g),a[s+"Line"]={obj:g,type:"line",left:p-r[0]}),m&&(d.push(m),a[s]={obj:m,left:p-r[0]}),b&&(d.push(b),a[s+"Arrow"]={obj:b,left:p-r[0],moveHide:!0})}}null==(a=e.data)||a.forEach(((a,y)=>{!function(a,y,b){let j,S;const A=e.data[b+1],E=he(A,e);if(a&&E&&!y.breakpoint)S=t([...a,...E],{...f});else if(a&&!E&&!y.breakpoint){const o=he(A,e);S=o?t([...a,...o],{...f}):null}const O={};if(["fetalPresentation","cervix"].includes(g)){let e,t;if(y.childbirth){const{type:s="arrow",style:c={},textStyle:u={}}=m;if("arrow"===s){const t=a[1]+z;e=o([a[0],a[1],t],c)}else e=n(s,{left:a[0],top:a[1],...c,...i,hoverCursor:"default"});t=r([a[0]+W/2,a[1]+z/2],{value:String(y.childbirth),...l,originX:"left",originY:"center",...u}),e&&(d.push(e),Object.assign(O,{childbirthIcon:{obj:e,type:s}})),t&&(d.push(t),Object.assign(O,{childbirthText:{obj:t,left:W/2,top:z/2}}))}}"fetalPresentation"===g&&(w(a,y,"surgicalDelivery",O),w(a,y,"dystocia",O));const M=u[b-1],Y={origin:{data:y,title:p,key:g||"",dataIndex:s,index:b},leftLine:M,rightLine:S,otherObj:O,...h,...I()};a&&(M||(Y.leftLine=null),j=n(v,{left:a[0],top:a[1],...Y}));u.push(S),j&&(!function(e){_.hovered&&(e.on("mouseover",(()=>{de(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ue(e),function(e){var t,o;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:o,top:n=0,left:i=0,type:r="",moveHide:l}=t||{};o&&("line"===r?o.setCoords().set({x1:e.left,y1:e.top,x2:e.left+i,y2:e.top}):o.setCoords().set({left:e.left+i,top:e.top+n}),l&&(x.value.remove(o),delete e.otherObj.obj))}))}(e),_.hovered&&de(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:X(e.left),value:L(t,e.top)}};["surgicalDelivery","dystocia"].some((t=>{var n;(null==(n=e.otherObj[t])?void 0:n.obj)&&(o.data[t]=k(new Date(X(e.left+e.otherObj[t].left)),"yyyy-MM-dd HH:mm"))})),x.value.discardActiveObject(),C("change",o),ae(o,"change")}}))}(j),c.push(j),le.add(j))}(he(a,e),a,y)})),Promise.all(c).then((e=>{const t=u.filter((e=>e));H(e),Promise.all(d).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront();const{childbirthIcon:t}=e.otherObj||{};(null==t?void 0:t.obj)&&"arrow"!==(null==t?void 0:t.type)&&t.obj.bringToFront()}))}))}))}))}function ae(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=re.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ce()}function ce(){var e;le.size&&(null==(e=x.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}([...le]))),le.clear(),se()}function ue(e){const t=e.prevPoint?e.prevPoint.left:G,o=e.nextPoint?e.nextPoint.left:J;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<ee&&e.set("top",ee),e.top<N&&e.set("top",N),e.top>V&&e.set("top",V),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function de(e,t="moving"){const{title:o,key:n,data:i}=e.origin;P.point={x:e.left,y:e.top},P.list=[`${o} ${"hover"===t?i.value:L(n,e.top)}`,`时间 ${X(e.left).slice(-5)}`],P.show=!0}function he(e,t){if(v(e)&&function(e){const t=F+864e5,o=m(e);return o>=F&&o<=t}(e.time)){const o=E(e.time),n=O(t.key,t.range,e.value);return[o,n<N?N:n>V?V:n]}}function fe(e,t){return e+1>t[1]?t[0]:e+1}return c(x,S),function(){const t=ne?{width:Q-R-Z-1,left:R}:{width:J-G-(q.length?0:1),left:G},o=new e.Rect({...U,height:V-ie[0]-1,top:ie[0],fill:"transparent",...t});x.value.add(o)}(),function(){function t(t,o="left"){let n="left"===o?R:J;t.forEach(((t,o)=>{const{range:s,spaceValue:c,width:u,title:p,titleStyle:g,key:v,position:m="center",spaceGridNumber:b=1,showNumber:w=!0,showMaxMinNumber:j=!0,showName:k=!0}=t,S=[],C=[],P=n+u/2,A=y(s,c),E=A.length,{lineXMain:O,lineXSub:X,textLeft:L}=d(m,n,u);A.forEach(((e,o)=>{const n=V-o*z*b,i=0===o?V-8:o!==A.length-1||!ie[0]||ee&&"FHR"!==v?n:N+8;!w||(0===o||o===E-1)&&!j||S.push(h(String(e),t,L,i)),C.push(...f(t,o,O,X,n,z,N,E,1))}));const M=[],Y=ne?new e.Rect({...a,strokeWidth:.5,width:u,height:V-ie[0],left:P,top:ie[0]+(V-ie[0])/2}):null;if(Y&&M.push(Y),k){const e=r([P,N-ie[0]>0?N-z/2:z/2],{value:String(p),...l,...g});e&&M.push(e)}const T=new e.Group([...C,...S,...M],{objectCaching:!1,...i});x.value.add(T),T.sendToBack(),n+=u}))}t($),t(q,"right")}(),function(){const{show:t,startTime:o,range:n=[0,23],position:s="top",style:a}=D.time,{show:c,range:u=[0,23],position:d,style:h={}}=D.processTime;if(t||c){const f=[],p=j(u[0],u[1]+1),g=[],v=[],m=z/2;for(let e=0;e<B.mainXCell;e++){if(t){const{textAlign:t="center"}=a,i=G+("center"===t?W/2:0),c=0===e&&"center"!==t?i+5:i,u=0===e?+o.slice(11,13):fe(w(f),n);f.push(u);const d="top"===s?N-m:V+m;g.push(r([c+e*W,d],{value:String(u),...l,...a})),e===B.mainXCell-1&&"center"!==t&&g.push(r([J-1,d],{value:String(fe(w(f),n)),...l,...a,originX:"center"!==t?"right":"center"}))}if(c&&e<=p.length){const{textAlign:t="center"}=h,o=G+("center"===t?W/2:0),n=0===e&&"center"!==t?o+5:o,i="top"===d?m:oe-m;v.push(r([n+e*W,i],{value:String(p[e]),...l,...h})),e===B.mainXCell-1&&"center"!==t&&v.push(r([J-1,i],{value:String(w(p)),...l,...a,originX:"center"!==t?"right":"center"}))}}const y=new e.Group([...g,...v],{objectCaching:!1,...i});x.value.add(y),x.value.sendToBack(y)}}(),function(){var e;const o=Object.values(te),n=[],i={},r=re.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=O(o,n,10),l=[0,t],s=[-t/e,0],a=[(V-i-t)/e,V-i],c=[J-G,e*(J-G)+t];let u=[],d=[];function h([o,n]){return Math.abs(n-e*o-t)<=1}function f([e,t]){const[o,n]=[...p([e,t])];return o>=G&&o<=J&&n>=i&&n<=V}function p([e,t]){return[G+e,V-t]}return h(l)&&f(l)&&(u=p(l)),h(s)&&f(s)&&(u=p(s)),h(a)&&f(a)&&(d=p(a)),h(c)&&f(c)&&(d=p(c)),[...u,...d]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=re.find((e=>e.key===o));if(r){const r=O(o,i,0);n.push(t([G,r,J,r],{...e}))}break}case"alert":if(l){const{key:o,range:a}=r||{},c=216e5,u={time:k(new Date(m(l.time)+c),"yyyy-MM-dd HH:mm"),value:10},[d,h]=[E(l.time)-G,V-O(o,a,l.value)],[f,p]=[E(u.time)-G,V-O(o,a,u.value)],g=(p-h)/(f-d),v=h-d*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,c=s(o,r-(E(k(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-E(l.time))*o);c.length>0&&n.push(t(c,{...e}))}}})),x.value.add(...n)}(),se(),function(){function e(e,t){const o=re.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}S.event.evented&&x.value.on("mouse:up",(t=>{var o,n;if(3===t.button){const{x:i=0,y:r=0}=t.pointer||{};i>=G&&i<=J&&r>=N&&r<=V&&(A.point={x:i,y:r},A.show=!0,t.target?(A.target=t.target,A.list=[(null==(n=window.getLanguageByCode)?void 0:n.call(window,"10010.1.220"))||"删除节点"],[...le].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&A.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(A.target=null,A.list=[(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.219"))||"新增节点"],re.filter((e=>e.show)).forEach((o=>{if(!M([...le],i,"key").includes(o.key)){if(["cervix","fetalPresentation"].includes(o.key)&&r<ee)return;A.list.push(e(o,t.pointer))}})),1===A.list.length&&(A.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=Q-Z/2;function t(e,t){if(!e.length)return;let n=N;const i=[];e.forEach((e=>{const o=(e.alias||e.title).split("").join("\n"),a=K.findIndex((t=>t.key===e.key));if(e.alias){const s=r([t,n],{value:o,...l,originY:"top",...e.titleStyle});o&&(n+=s.height+15,i.push(s))}else{const{text:r,icon:l}=s(o,e,{text:{originX:"center",originY:"top",left:t,top:n},icon:{left:t,topY:n,originX:"center",originY:"top",origin:{type:e.type,dataIndex:a},...S.event}},"vertical");n+=r.height+l.height+15,(c=l).on("moving",(()=>{c.set("originY","center"),T(c)?(ue(c),de(c)):P.show=!1})),c.on("mouseup:before",(e=>{if(P.show=!1,0===e.e.button&&T(c))if(M([...le],c.left,"key").includes(c.origin.key))Y("repeat");else{const e={data:{time:X(c.left),value:L(c.origin.key,c.top)},...c.origin};C("add",e),ae(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(c)})),i.push(r,l)}var c})),o(i),x.value.add(...i)}function o(e){const t=w(e),o=(V-N)/2,n=(t.height+t.top-N)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t($,R/2),t(q,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(C("remove",o),ae(o,"remove")):(Object.assign(o,{data:{time:X(e.pointer.x),value:L(e.origin.key,e.pointer.y)}}),C("add",o),ae(o))},redrawPoints:ce}}export{x as useBirthProcess};
|
@@ -1 +1 @@
|
|
1
|
-
import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as r}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as u}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import"../
|
1
|
+
import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as r}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as u}from"../../utils/index.js";import"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{useBirthProcess as i}from"./useBirthProcess.js";function s(s,n,d,o,v,c){const h=e({select:null,redrawPoints:null,clickMenu:null}),m=a((()=>n.data.scaleValues.map((e=>{var a;return{...e,width:null!=(a=e.width)?a:60}})).filter((({layout:e="left",show:a=!0})=>"left"===e&&a)))),p=a((()=>n.data.scaleValues.map((e=>{var a;return{...e,width:null!=(a=e.width)?a:60}})).filter((({layout:e="left",show:a=!0})=>"right"===e&&a)))),f=a((()=>{var e;return(null==(e=p.value)?void 0:e.length)?30:0})),g=a((()=>{var e;return 30+(null==(e=m.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),w=a((()=>{var e;const{width:a}=n.data,t=null==(e=p.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-f.value-t})),x=a((()=>n.data.grid.mainXCell)),j=a((()=>{const e=n.data.grid.mainYCell||14;return n.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),y=a((()=>(w.value-g.value)/x.value)),V=a((()=>{const e=n.data.padding||[5,5],a=B("top"),t=B("bottom");return[a?0:e[0],t?0:e[1]]})),b=a((()=>{const{height:e}=n.data,a=B();return(e-V.value.reduce(((e,a)=>e+a),0))/(j.value+a)})),A=a((()=>{const e=B("top");return b.value*e+V.value[0]})),C=a((()=>{var e;const{scaleValues:a}=n.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!A.value)return A.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],r=(null==t?void 0:t.spaceValue)||1;return k.value-V.value[0]-l*r*b.value})),k=a((()=>{const{height:e}=n.data,a=B("bottom");return e-b.value*a-V.value[1]})),Y=a((()=>u(n.data.xAxis.time.startTime))),S=a((()=>36e5/y.value)),H=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"cervix"===e.key));return b.value/((null==a?void 0:a.spaceValue)||1)})),P=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"FHR"===e.key));return b.value/((null==a?void 0:a.spaceValue)||10)})),R=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"fetalPresentation"===e.key));return b.value/((null==a?void 0:a.spaceValue)||1)})),X=a((()=>{var e;return(null==(e=n.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}}));function B(e){const{xAxis:a}=n.data;return Object.values(a).reduce(((a,t)=>(t.show&&(!e||e&&t.position===e)&&a++,a)),0)}const F=e({canvasWidth:n.data.width,canvasHeight:n.data.height,borderStyle:{...r,...n.data.borderStyle||{}},selectionStyle:n.data.selectionStyle||{},grid:n.data.grid,other:n.data.other,originX:g.value,endX:w.value,originY:A.value,endY:k.value,xCellWidth:y.value,yCellHeight:b.value,gridXNumber:x.value,gridYNumber:j.value,xAxis:n.data.xAxis,leftScales:m.value,rightScales:p.value,leftAddAreaWidth:30,rightAddAreaWidth:f.value,startTime:Y.value,timeXCell:S.value,cervixYCell:H.value,FHRYCell:P.value,fetalPresentationYCell:R.value,scaleValues:n.data.scaleValues,event:X.value,originYCervix:C.value,scalebarBorder:!Reflect.has(n.data,"scalebarBorder")||n.data.scalebarBorder,padding:V.value});return t((()=>s.value),(e=>{e&&function(){const{clickMenu:e,redrawPoints:a}=i(s,F,d,v,c);h.redrawPoints=a,h.clickMenu=e}()}),{immediate:!0}),{propItems:F,...l(h)}}export{s as useBirthProcessChart};
|
@@ -1 +1 @@
|
|
1
|
-
import{fabric as e}from"../../../../../../shared/utils/fabricjs/index.js";import{range as t}from"lodash-es";import{defaultStyle as n}from"../../useDraw.js";import{useElectrocardiogramCumputedPoint as o}from"../../useCumputedPoint.js";import"../../useEvent.js";import"../../useCommon.js";import"vue";import"date-fns";import"
|
1
|
+
import{fabric as e}from"../../../../../../shared/utils/fabricjs/index.js";import{range as t}from"lodash-es";import{defaultStyle as n}from"../../useDraw.js";import{useElectrocardiogramCumputedPoint as o}from"../../useCumputedPoint.js";import"../../useEvent.js";import"../../useShadow.js";import"../../useCommon.js";import"vue";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 r(r,i){const{scale:s,beforeEvent:l,endY:a,endX:u,showScaleText:p,showNumberText:c,detailRadius:y,points:f,lineStartIndex:h,xCellWidth:m,yCellHeight:d,grid:x={subLineStyle:{},mainLineStyle:{x:{},y:{}}}}=i;let w=null;const{computedX:g,computedY:v,getYValue:b}=o(i);function j(e){return g(e)*s}function S(e){return v(e)*s}function L(e){return b(e/s)}const k=d*s;function M(){var e;w&&(null==(e=r.canvas)||e.remove(w)),w=null}r.on("mousedown",(async o=>{var i,m;if(await(null==l?void 0:l()),1!==o.button||!o.target||!o.pointer)return;const d=o.target;if(!d.points)return;const{x:g,y:v}=o.pointer,b=Math.floor((g-d.left)/d.width*d.points.length)+h;let T=b-y,G=b+y;T<=0?(T=0,G=Math.min(2*y,f.length-1)):G>=f.length-1&&(G=f.length-1,T=Math.max(f.length-2*y,0));const C=f.slice(T,G).map(((e,t)=>({x:T+j(t),y:S(e)}))),A=b-T;let W=0,Y=0;C.forEach(((e,t)=>{e.y>C[W].y&&(W=t),e.y<C[Y].y&&(Y=t)}));const $=j(2*y-1),E=C[W].y-C[Y].y-1,X=E+30+70,z={x:u-g<=$?g-$:g,y:a-v<=X?v-X:v};M(),w=new e.Group;const D=[new e.Rect({...n,left:z.x,top:z.y,width:$,height:X,stroke:"transparent",fill:"#fff",shadow:new e.Shadow({color:"rgba(0, 0, 0, 0.3)",blur:15,offsetX:8,offsetY:8})}),function(n,o){const r=e=>e%5?x.subLineStyle:null,i=k/5,s=30+n[W].y/Math.abs(n[W].y-n[Y].y)*E,l=Math.ceil(s/i),a=Math.ceil((X-s)/i);function u(t,n){return new e.Line([z.x,z.y+t,z.x+$,z.y+t],{...x.mainLineStyle.x,...r(n)})}const p=new e.Group([...t(a).map((e=>u(e*i+s,e))),...t(l).map((e=>u(-e*i+s,e)))]),c=o/n.length*$,y=Math.ceil(c/i),f=Math.ceil(($-c)/i);function h(t,n){return new e.Line([z.x+t,z.y,z.x+t,z.y+X],{...x.mainLineStyle.y,...0===n?x.subLineStyle:r(n)})}const m=new e.Group([...t(f).map((e=>h(e*i+c,e))),...t(y).map((e=>h(-e*i+c,e)))]);return new e.Group([m,p])}(C,A),(R=C.map((({x:e,y:t})=>({x:e,y:-t}))),new e.Polyline(R,{...n,fill:"transparent",stroke:"red",strokeWidth:1,left:z.x,top:z.y+30})),function(t,o){const r={strokeDashArray:[3,4],width:3,top:z.y},i=new e.Line(a(t[W]),{...n,...r,left:z.x+W/t.length*$,stroke:"red"}),s=new e.Line(a(t[Y]),{...n,...r,stroke:"blue",left:z.x+Y/t.length*$}),l=new e.Line(a(t[o]),{...n,...r,stroke:"green",left:z.x+o/t.length*$});return new e.Group([i,s,l]);function a(e){return[e.x,e.y,e.x,e.y-X]}}(C,A),(O=C,P=A,new e.Circle({...n,radius:5,fill:"transparent",stroke:"green",strokeWidth:1,left:z.x+P/O.length*$-5,top:z.y+30+(O[W].y-O[P].y)/Math.abs(O[W].y-O[Y].y)*E-5}))];var O,P,R;p&&D.push(new e.Text(`x${s}`,{...n,fill:"black",fontSize:20,left:z.x+10,top:z.y+X-30})),c&&D.push(function(t,o){const r={fontSize:16,left:z.x+$/2+10},i=new e.Text(`最大: ${L(t[W].y)} mv`,{...n,...r,fill:"red",top:z.y+X-20}),s=new e.Text(`最小: ${L(t[Y].y)} mv`,{...n,...r,fill:"blue",top:z.y+X-40}),l=new e.Text(`当前: ${L(t[o].y)} mv`,{...n,...r,fill:"green",top:z.y+X-60});return new e.Group([i,s,l])}(C,A)),w.add(...D).addWithUpdate(),null==(i=r.canvas)||i.add(w),null==(m=r.canvas)||m.discardActiveObject()})),r.on("mouseup",(async e=>{await(null==l?void 0:l()),1===e.button&&M()}))}export{r as useDetailEvent};
|
@@ -1 +1 @@
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useThrottleFn as t}from"@vueuse/core";import{range as r}from"lodash-es";import{useDetailEvent as o}from"./hooks/useDetailEvent.js";import{defaultStyle as i,drawLine as n}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useElectrocardiogramCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"../useCommon.js";import"vue";import"date-fns";import
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useThrottleFn as t}from"@vueuse/core";import{range as r}from"lodash-es";import{useDetailEvent as o}from"./hooks/useDetailEvent.js";import{defaultStyle as i,drawLine as n}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useElectrocardiogramCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"../useShadow.js";import"../useCommon.js";import"vue";import"date-fns";import{ECG as l}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"../surgicalAnesthesia/useTop.js";import"../surgicalAnesthesia/useOther.js";import"../../../../../shared/utils/index.js";function u(u,d,c){const{computedX:m,computedY:h}=a(d),{borderStyle:f,originX:L,originY:g,xCellWidth:p,yCellHeight:E,canvasWidth:x,canvasHeight:M,dataList:C,columnNumber:v,gridYNumber:N,gridXNumber:y,rowNumber:b,lineStyle:S,titleStyle:j,config:A,calibrationLineHeight:w}=d,R=new Set,U=new Set;function X(e=[]){return~~(e.length/v)*(A.mainXCellValue/l.DEFAULTMAINXCELLVALUE)}function B(t=0){C.forEach(((r,o)=>{if(o===C.length-1&&arguments.length)return;const{x:i,y:n,rowIdx:s}=r.origin,a=X(r.data),u=r.data.reduce(((e,r,i)=>{const s=o<l.MAXLINENUMBER-1&&i>=t&&i<=t+a||o===l.MAXLINENUMBER-1?[{x:m(e.length+1),y:h(-+r)+n}]:[];return e.concat(s)}),[]),f=new e.Polyline(u,{...S,fill:"transparent",strokeWidth:1,left:i,hasControls:!1,hasBorders:!1,hoverCursor:"default",lockMovementX:!0,lockMovementY:!0,objectCaching:!0,evented:!0,selectable:!0});if(k(f,{...d.config,...d,lineStartIndex:t,points:r.data,scale:4,showScaleText:!0,showNumberText:!0,detailRadius:370,beforeEvent:()=>c.value&&Promise.reject()}),f.startIdx=t,o<C.length-1?R.add(f):U.add(f),arguments.length)return;I({x:i,y:n},S);const L=new e.Text(String(r.title),{...j,left:i+(4===v?p:p/2),top:n,originX:"left",originY:"bottom"});U.add(L)}));const r=arguments.length?[...R]:[...R,...U];u.value.add(...r)}function k(e,t){o(e,t)}function I({x:t,y:r},o){const n=t-p,s=p/l.SMALLCELLNUMBER,a=new e.Polyline([{x:n,y:r},{x:n+s,y:r},{x:n+s,y:r-w},{x:n+3*s,y:r-w},{x:n+3*s,y:r},{x:n+4*s,y:r}],{...o,fill:"transparent",strokeWidth:1,left:n,...i});U.add(a)}s(u,{...d,gridXNumber:y*l.SMALLCELLNUMBER,gridYNumber:N*l.SMALLCELLNUMBER,xCellWidth:p/l.SMALLCELLNUMBER,yCellHeight:E/l.SMALLCELLNUMBER,grid:{...d.grid,subXCell:l.SMALLCELLNUMBER,subYCell:l.SMALLCELLNUMBER}}),function(){const{strokeWidth:t}=f,r=new e.Rect({...f,width:x-t,height:M-t,left:L,top:g,fill:"transparent"});u.value.add(r)}(),function(){const e=x/v,t=[];r(v).forEach((r=>{if(r+1>=v)return;const o=(r+1)*e,i=n([o,0,o,M],{stroke:"#000"});t.push(i)})),u.value.add(...t)}(),B();return{updatePolyline:t((t=>{const r=X(C[C.length-1].data);if(r===C[0].data.length)return;const o=C[C.length-1].data.length,i=t/100*o-r/2,n=i+r>o?o-r:Math.max(0,i);e.util.requestAnimFrame((()=>{if(R.size){const[e]=[...R];if(e.startIdx===n)return;[...R].forEach((e=>u.value.remove(e))),R.clear()}B(n)}))}),150)}}export{u as useElectrocardiogram};
|
@@ -1 +1 @@
|
|
1
|
-
import{reactive as e,computed as a,unref as t,watch as u,toRefs as l}from"vue";import{defaultBorderStyle as r,defaultLineStyle as i,defaultTextStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{cloneDeep as o,isNumber as s,last as d}from"lodash-es";import"../useEvent.js";import"../
|
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"
|
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"
|
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
|
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,b,P){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,grid:_}=k,J=new Map,q=new Set;let R=d(O),W=[],H=null;const Q=new Set;o(x,k);const{getEqualXTypes:U,handleAddPrevent:Z,setPrevAndNextPoint:ee,getPointEventProps:te}=a(x,L,k),{pause:ne,resume:ie}=h((()=>{!function(){if(!Q.size)return;for(const e of Q)e.set("opacity",1===e.opacity?.5:1);x.value.renderAll()}()}),800);function oe(){R.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),se(t,i,e))}))}))}function le(e=[]){if(!(null==H?void 0:H.areaPos))return[];const{startPos:t,endPos:n}=H.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:ye()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function re(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(),ae()},onNegativeClick:()=>ae(),onClose:()=>ae()})}function ae(){H&&x.value.remove(H),H=null}function se(e,t,o){var l;const{type:r,unit:a,dataList:f=[]}=o,u=[];J.set(e.key,[]),function(e,t){Q.size&&[...Q].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&Q.delete(n)}))}(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:b={},title:P="",key:A,type:C="circle"}=h,E=ve(d.list[c+1],o);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(!_.breakpoint||_.breakpoint&&E[0]-e[0]<=M)&&(y=n([...e,...E],b));const K=u[c-1],X={origin:{data:l,title:P,key:d.key,selfKey:A,unit:a,type:r,dataIndex:t,index:c,lineAttr:b},__type:"main",leftLine:K,rightLine:y,...k,...te()};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",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{w.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ge(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&&me(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===W.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]),ue(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(W.every((e=>!s(e.left,m)))){const t=j(m),n=I(u.type,f);W.push({data:{time:t,value:n,...u.selfKey!==u.key?{key:u.selfKey}:{}},left:m,top:f}),ue(e,[...e.prevPointer,m,f],d)}if(W.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=W.some((e=>Math.abs(e.left-a)<=1));if(!s){let t=0;const r=W.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=W[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}:{}},W.splice(t,0,s),ue(e,[f.left,f.top,s.left,s.top],n)}}r++}}(e,c,d),d&&e.nextPoint||!d&&e.prevPoint){const t=J.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?fe(e,"#999"):fe(e,e.origin.lineAttr.stroke))}))}}!function(e,t=!0){var n,i,o,l;const{left:r,originLeft:a}=e;if((null==W?void 0:W.length)>0){for(const e of q)(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(W=W.filter((e=>t&&e.left<=r&&e.left>a||!t&&e.left>=r&&e.left<a)),0===W.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 q)e.leftLine&&x.value.remove(e.leftLine),x.value.remove(e)}if(W.length>0){const t=m(W);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(),W.length>0){const l=R.find((e=>e.type===t));let r=-1;const a=m(W).left>e.originLeft,s=W.map((e=>e.data));if(a&&e.nextPoint||!a){if(2.5!==e.scaleX)return void de({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}),ce({...o,data:s,coincideIndex:r})}else L("change",{...g(o,["selfKey","lineAttr"]),key:n}),ce(o,"change")}}))}(v),null==(p=J.get(d.key))||p.push(v))}(ve(l,o),l,c,e)})),Promise.all(J.get(e.key)).then((t=>{const n=u.filter((e=>e));ee(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||Q.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function fe(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 ue(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,q.add(a),x.value.add(f,a)}))}function ce(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=R.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}}de({dataIndex:u,scaleValue:c})}function de(e){var t,n,i;if(q.size&&(null==(t=x.value)||t.remove(...pe([...q]))),q.clear(),W=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=x.value)||n.remove(...pe(J.get(o.key))),J.delete(o.key),se(o,t,i)}else R=d(O),J.size&&(null==(i=x.value)||i.remove(...pe(ye()))),J.clear(),oe()}function pe(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 me(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 ge(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 ve(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 ye(){return v(Array.from(J.values()))}return oe(),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,[]),b.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;b.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(b,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=le();e.length>0?re((()=>{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 ce(n[0],"remove",n.length),n.map((e=>({...g(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);L("remove",t)})):r.emit(H)}})),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(!P||b.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?R.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;H&&x.value.remove(H),H=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}),H.areaPos={startPos:i,endPos:o.pointer},x.value.add(H)}))}(),{redrawPoints:de,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&&ce(r,"remove"),L(i,r)):null==(n=N.click)||n.call(N,i,r)},moveLimit:ge,setPopup:me,updateData:ce,getGridPoints:ye,getContainPoints:le,showDialog:re,removeCurrentSelection:ae,pauseFlickerPoint:ne}}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
|
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 i,drawLine as o,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 d,cloneDeep as u,omit as f,flatten as h,isNumber as g,pick as m}from"lodash-es";import{format as p}from"date-fns";import{OTHER_MENU as v}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"./useTop.js";import"@vueuse/core";import"../../../../../shared/utils/index.js";const x=d(v,(t=>"add"!==t.type));function y(d,v,y,k,C,w,X,b,E){const{computedX:A,getXValue:L}=r(v),{getEqualXTypes:j,handleAddPrevent:P,isGridLimit:S,getPointEventProps:z}=s(d,y,v),{createShadowLines:I}=l(),{canvasWidth:M,other:T,yCellHeight:H,xCellWidth:O,endX:$,originX:B,originY:W,endY:Y,markHeight:D,event:_,topGridYCellHeight:V,extracorporealCirculationHeight:G}=v,K=new Map,R=u(T);let q=[],F=null;function J(){var o;if(!(null==(o=null==R?void 0:R.horizontal)?void 0:o.length))return;const n="horizontal";K.set(n,[]);const{horizontal:r}=R;let a=W+H/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:d={},data:u,showIcon:f=!0}=o;let h=null;u.forEach(((o,u)=>{const{time:g,value:m}=o,p=A(g);if(!ot(p))return;const v=[],x=f&&e(s,{...c,left:p,top:a});x&&v.push(x);const y=f?p+x.width/2+2:p,k=i([y,a],{value:m,...d,originX:"left"});v.push(k);const C=new t.Group(v,{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...z()});Object.assign(C,{originLeft:p,iconHalfWidth:x?x.width/2:0,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:B,x2:$-C.width}}),h&&(C.limitX.x1=h.left,h.limitX.x2=C.left,C.prevPoint=h,h.nextPoint=C),h=C,tt(C),K.get(n).push(C)})),a+=H})),d.value.add(...K.get(n))}function N(){var t;if(!(null==(t=null==R?void 0:R.vertical)?void 0:t.length))return;const i="vertical";K.set(i,[]);const{vertical:o}=R;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,c=A(s);if(!n||!ot(c))return;const{lineHeight:d=H}=a;let u=W+r+d/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:c,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...z()});u+=d,tt(r),K.get(i).push(r)}));const f=K.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),g=c>$-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,g&&t.set("originX","right")}))})),d.value.add(...K.get(i))}function Q(t,e="add"){const{dataIndex:i,data:o,index:n,key:r,dataKey:a,time:l}=t,s=R[r],d=["mark","extracorporealCirculation"].includes(r)?s.dataList[i]:s[i];switch(e){case"remove":d.data.splice(n,1);break;case"change":if("mark"===r){d.list.splice(n,1);const t=s.dataList.find((t=>t.time===l));t?t.list.push(o):(s.dataList.push({time:l,list:[o]}),s.dataList.sort(((t,e)=>Date.parse(t.time)-Date.parse(e.time))))}else"extracorporealCirculation"===r?d[a]=o:d.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=c(t,d.data),i=Array.isArray(o)?o:[o];d.data.splice(e,0,...i);break}}U(t)}function U(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...K.get(i)),K.delete(i),i){case"horizontal":J();break;case"vertical":N();break;case"mark":Z();break;case"extracorporealCirculation":rt()}}function Z(){if(!D)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=R.mark||{};if(!(null==r?void 0:r.length))return;const a="mark";K.set(a,[]);const l=i([B-5,Y+D/2],{value:t,...o,originX:"right"});d.value.add(l);const s=Y+D+G,c=Y+G;let u=0;const f={};r.forEach(((t,i)=>{const{time:o,list:r=[]}=t,l=A(o);if(!ot(l))return;let h=c+1;r.forEach(((t,o)=>{var r;const{style:g}=t,m=e((null==g?void 0:g.type)||"circleAndText",{...(null==g?void 0:g.pointAttr)||n,text:t.text,left:l,top:c+10,origin:{data:t,key:"mark",type:"other",dataIndex:i,index:o}}),p=m.height;u&&l-u<=O&&(null==(r=f[`x_${u}`])||r.forEach((([t,e])=>{h+p>=s&&(h=Y-1),t<e&&h>=t&&h<e&&(h=e),t>e&&h>e&&h<=t&&(h=e)})));const{topObj:v,startTop:x,oldStartTop:y}=function(t,e){const i={};let o;if(t>Y){const r=t+e;i.y2=t+e/2,r>=s?n(Y-1):(o=t,t=r)}else n(t);function n(n){o=n,i.y2=n-e/2;t=n-e}return{topObj:i,startTop:t,oldStartTop:o}}(h,p);h=x,f[`x_${l}`]||(f[`x_${l}`]=[]),f[`x_${l}`].push([y,h]),m.set("top",v.y2),K.get(a).push(m),tt(m),d.value.add(m)})),u=l})),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:B,x2:$};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(K.get(a))}function tt(t){if(_.hovered&&(t.on("mouseover",(()=>{et(t)})),t.on("mouseout",(()=>{k.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e),n=["mark","extracorporealCirculation"].includes(e),r="extracorporealCirculation"===e;t.on("moving",(()=>{t.moving=!0,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<W&&t.set("top",W);const e=Y+G+D-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):r?function(t){t.setCoords();const{left:e,limitX:i}=t,o=p(new Date,"yyyy-MM-dd HH:mm"),n=A(o);i.isCurrentTime&&i.x2<n&&n>0&&n<M&&(i.x2=n);e<i.x1&&t.set({x1:i.x1,x2:i.x1});e>i.x2&&t.set({x1:i.x2,x2:i.x2});it(t,"left"),it(t,"right")}(t):(w(t),function(t){const e=t.left+t.maxTextWidth>$?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),_.hovered&&et(t)})),t.on("mouseup",(r=>{var a;if(k.show=!1,1===r.button){if(!t.moving)return;t.moving=!1,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=L(null!=(a=t.originLeft)?a:t.left),r={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),y("change",r),n&&Q(r,"change")}3===r.button&&["horizontal","vertical"].includes(e)&&(C.point={x:t.left,y:t.top},C.show=!0,C.target=t,C.list=x.map((t=>({...t,renderItem:()=>t.label,_type:"other"}))))}))}function et(t){k.isTarget=!0,k.show=!0;const{key:e,data:i={}}=t.origin||{};let o=i.value;const n="extracorporealCirculation"===e||"mark"===e;k.point={x:t.left,y:n?t.top:t.top+V/2};const r=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,a=L(r);k.list=[`时间 ${a.slice(-5)}`],n&&("mark"===e&&(o=i.name),k.list.unshift(o+" ")),k.sourceData=[{type:"other",key:e,time:a,value:o}]}function it(t,e){const{shadowObjs:i,params:o}=t[`${e}ShadowBox`]||{};if(!i||!o)return;i.forEach((t=>d.value.remove(t)));o["left"===e?1:0]=t.left;const n=nt(...o);t[`${e}ShadowBox`]={shadowObjs:n,params:o}}function ot(t){return t>=B&&t<=$}function nt(...e){const[i,o,r,a]=e,{mode:l,style:s}=a,c=f(s,["angle","space"]),u=[[i,Y],[o,Y],[o,r],[i,r]],h=new t.Polygon(u.map((t=>({x:t[0],y:t[1]}))),{...n,...c,stroke:"transparent",..."slash"===l?{fill:"transparent"}:{}}),g=[];return["slash"].includes(l)&&g.push(...I(u,s.angle,s.space,c)),d.value.add(h,...g),K.get("extracorporealCirculation").push(h,...g),[h,...g]}function rt(){if(!G)return;const{dataList:e,ascendAortaStyle:i,extracorporealCirculationStyle:o}=R.extracorporealCirculation||{};if(!(null==e?void 0:e.length))return;const n="extracorporealCirculation";K.set(n,[]);const r=Y+G;let a,l;function s(t){return t&&t>B&&t<M}function c(t){return void 0===t||""===t}e.forEach(((u,f)=>{const h=function(t){const{extracorporealCirculationStart:e,closeAscendAorta:i,openAscendAorta:o,extracorporealCirculationEnd:n}=t;let r,a,l,s;return e&&(r=A(e.time)),i&&(a=A(i.time)),o&&(l=A(o.time)),n&&(s=A(n.time)),[r,a,l,s]}(u);if(-1===h.findIndex((t=>t>0&&t<M)))return;let g;h.forEach(((m,v)=>{if(c(m))return;const x=h[v+1],y=h[v-1];if(s(m)||s(x)){const k=s(m)?m:B,C=s(x)?x:c(x)?null:$,w=s(y)?y:B,X={};if(v<h.length-1&&C&&(X.params=[k,C,r,[0,2].includes(v)?o:i],X.shadowObjs=nt(...X.params)),s(m)){const i=function(t){switch(t){case 0:return"extracorporealCirculationStart";case 1:return"closeAscendAorta";case 2:return"openAscendAorta";case 3:return"extracorporealCirculationEnd"}}(v),o=p(new Date,"yyyy-MM-dd HH:mm"),c=A(o),x=m<c&&s(c)?c:m,y=function(e,i){const o=new t.Line(e,{...i,stroke:"transparent",strokeWidth:5,hasControls:!1,hasBorders:!1,hoverCursor:"e-resize",lockMovementY:!0,originX:"center"});return tt(o),d.value.add(o),K.get("extracorporealCirculation").push(o),o}([m,Y,m,r],{origin:{dataIndex:f,dataKey:i,key:n,data:u[i],type:"other"},limitX:{x1:0===v?null!=a?a:B:w,x2:C||x,isCurrentTime:!C&&f===e.length-1},...[1,2,3].includes(v)?{leftShadowBox:g}:{},...[0,1,2].includes(v)?{rightShadowBox:X}:{}});v===h.length-1&&(a=m,l=y),0===v&&l&&(l.limitX.x2=k)}g=X}}))}))}function at(t){const{code:e}=t;F&&(e.includes("Enter")||e.includes("Esc"))&&(e.includes("Esc")&&(F.text=""),F.exitEditing(),d.value.discardActiveObject(F))}return function(){if(!(null==T?void 0:T.longLine)||!T.longLine.time)return;const{time:t,style:e}=T.longLine,i=A(t),n=o([i,0,i,Y],e);d.value.add(n)}(),function(){var t;if(!(null==(t=null==R?void 0:R.horizontal)?void 0:t.length))return;q=[];const{horizontal:i}=R,o=B-5;let n=W+H/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l,data:s=[]}=t,c=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var u;q.push({type:"other",title:r,key:"horizontal",dataIndex:i,dataList:s.map((t=>A(t.time))),y1:n-c.height/2,y2:n+c.height/2}),(u=c).on("moving",(()=>{u.set("originX","center"),S(u)?et(u):k.show=!1})),u.on("mouseup:before",(t=>{if(k.show=!1,0===t.e.button&&S(u))if(j(K.get("horizontal"),u.left,"key",O).includes(u.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:L(u.left),value:u.origin.defaultAddValue},...u.origin};y("add",f(t,["isMenu"])),Q(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),d.value.add(c),n+=H}))}(),J(),N(),Z(),rt(),a.on((()=>{const t="horizontal",e=X(K.get(t));e.length>0?b((()=>{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 h(Object.keys(e).map((t=>{const i=e[t];return R.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);U({key:t}),y("remove",i)})):E()})),_.evented&&(window.addEventListener("keydown",at,!0),d.value.on("mouse:up",(e=>{var i,o,n,r;if(1===e.button){const{target:a,pointer:l={}}=e,{x:s=0,y:c=0}=l;if(!S({left:s,top:c}))return;if(!(null==q?void 0:q.length)||F)return;if(a&&"horizontal"!==(null==(i=a.origin)?void 0:i.key))return;let u="";if(a){if(a.moving)return;u=null==(r=null==(n=null==(o=a.origin)?void 0:o.data)?void 0:n.value)?void 0:r.toString()}const f=q.find((({y1:t,y2:e})=>c>=t&&c<=e));g(null==f?void 0:f.dataIndex)&&(F=new t.Textbox(u,{left:s,top:c,width:100,height:100,fontSize:18,objectCaching:!1,hasControls:!1,borderColor:"#000",editingBorderColor:"#000",backgroundColor:"#fff",fontFamily:"微软雅黑"}),F.otherListPointHeightRangeItem={...f,left:s,target:a},d.value.add(F),d.value.setActiveObject(F),F.enterEditing(),u&&F.setSelectionEnd(u.length))}})),d.value.on("selection:cleared",(({deselected:t})=>{var e;if(null==t?void 0:t.find((t=>t.otherListPointHeightRangeItem))){let{text:t}=F;const{otherListPointHeightRangeItem:i}=F;if(t=t.replace(/^\s+|\s+$/g,""),d.value.remove(F),F=null,!t)return;const{left:o,target:n}=i;if(n){if(t==(null==(e=n.origin)?void 0:e.data.value))return;const i={...n.origin,data:{...n.origin.data,value:t}};y("change",i),Q(i,"change")}else{const e={...m(i,["title","type","key","dataIndex"]),data:{time:L(o),value:t}};y("add",e),Q(e)}}}))),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i,_type:o}=t,n={...e.origin,type:o};y(i,n),"remove"===i&&Q(n,i)},handleKeydown:at}}export{y as useOther};
|
package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js
CHANGED
@@ -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"../
|
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,isFunction as g}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 f}from"./useTop.js";import{useLeft as w}from"./useLeft.js";import{useCenter as x}from"./useCenter.js";import{useOther as y}from"./useOther.js";import{uuidGenerator as b}from"../../../../../shared/utils/index.js";function C(C,j,Y,k,H,M,T){var D;let P=null;const S=s(),L=e({redrawPoints:null,clickMenu:null,redrawLinePoints:null}),A=t();let X=null;const G=m((null==(D=j.data.top)?void 0:D.treeData)||[]),N=a((()=>j.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),V=a((()=>{var e;return null!=(e=j.data.left.width)?e:0})),E=a((()=>{const{grid:e}=j.data;return e.mainXCell*e.subXCell})),O=a((()=>{const{grid:e}=j.data;return e.mainYCell*e.subYCell})),W=a((()=>{const{show:e=!0,tree:t={}}=j.data.top;if(!e)return 0;const{rowNumber:a=G}=t;return G<a?a:G})),I=a((()=>j.data.top.tree.cellHeight)),F=a((()=>I.value*W.value)),K=a((()=>de(ue("drug")||"top"))),_=a((()=>K.value+F.value)),q=a((()=>{var e;return Date.parse((null==(e=j.data.xAxis)?void 0:e.startTime)||c(new Date,"yyyy-MM-dd HH:mm:ss"))})),z=a((()=>{const e=p(j.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=h(E.value/t+1).map((r=>0===r?e.startTime:c(new Date(q.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:V.value}})),B=ce(),J=a((()=>de(ue("xAxis")||"center"))),Q=a((()=>{var e;const{width:t,right:a}=j.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),R=a((()=>de(ue("intraoperatively")||"bottom"))),U=a((()=>{var e;const{show:t,height:a}=(null==(e=j.data.other)?void 0:e.extracorporealCirculation)||{};return t&&a?a:0})),Z=a((()=>{var e;const{show:t,height:a}=(null==(e=j.data.other)?void 0:e.mark)||{};return t&&a?a:0})),$=a((()=>R.value+(j.data.height-F.value-z.value.height-Z.value-U.value))),ee=a((()=>(Q.value-V.value)/E.value)),te=a((()=>($.value-R.value)/O.value)),ae=a((()=>z.value.spaceTimeStamp/ee.value)),re=a((()=>{const{scaleValues:e}=j.data;return v(e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))))})),ie=a((()=>me("pulse"))),oe=a((()=>me("temperature"))),ne=a((()=>{var e;return(null==(e=j.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),le=e({canvasWidth:j.data.width,canvasHeight:j.data.height,borderStyle:{...d,...j.data.borderStyle},pointSelectionStyle:j.data.pointSelectionStyle||{},grid:j.data.grid,top:j.data.top,left:j.data.left,other:j.data.other,topGridYNumber:r(W),topGridYCellHeight:r(I),topGridOriginY:r(K),topGridEndY:r(_),treeData:B,getTreeData:ce,xAxis:r(z),originYXAxis:r(J),startTime:r(q),timeXCell:r(ae),gridXNumber:r(E),gridYNumber:r(O),xCellWidth:r(ee),yCellHeight:r(te),originX:r(V),endX:r(Q),originY:r(R),endY:r($),markHeight:r(Z),extracorporealCirculationHeight:r(U),itemList:r(re),scaleValues:j.data.scaleValues,pulseYCell:r(ie),temperatureYCell:r(oe),event:r(ne),dialog:S,extraMenuConfig:j.data.extraMenuConfig||{}});function ue(e){let t="";return Object.entries(N.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function se(e){const t=N.value[e],a=z.value.height;switch(t){case"drug":return F.value;case"xAxis":return a;default:return j.data.height-F.value-a}}function de(e){switch(e){case"top":return 0;case"center":return se("top");default:return se("top")+se("center")}}function ce(){const{show:e=!0,tree:t={}}=j.data.top;if(!e)return[];const a=p(j.data.top.treeData);let r=0;const{cellWidth:i,cellHeight:o}=j.data.top.tree,{rowNumber:n=G}=t;return G<n&&a.push(...h(n-G).map((()=>({})))),function e(t,a=0){t.forEach((t=>{var n;const l={top:r*o+K.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=V.value-l.left;Object.assign(t,l)}))}(a),a}function me(e){const{scaleValues:t}=j.data,a=t.find((t=>t.type===e));return te.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await o();const{redrawLinePoints:e,clickMenu:t}=f(C,le,Y,H,M),{redrawPoints:a,clickMenu:r,moveLimit:i,setPopup:n,updateData:l,getGridPoints:u,getContainPoints:s,showDialog:d,removeCurrentSelection:c,pauseFlickerPoint:m}=x(C,le,Y,H,M,T);A.value=m,w(C,le,Y,H,i,n,l,u);const{clickMenu:p,handleKeydown:h}=y(C,le,Y,H,M,i,s,d,c);P=h,L.redrawPoints=a,L.redrawLinePoints=e,L.clickMenu=e=>{const{item:a}=e;switch(a._type){case"tree":t(e);break;case"other":p(e);break;default:r(e)}}})),n((()=>{A.value(),g(P)&&window.removeEventListener("keydown",P,!0)})),T&&l((()=>null==H?void 0:H.point),(()=>{H.movable?(H.show=!0,X&&clearTimeout(X),X=setTimeout((()=>{H.show=!1,H.movable=!1}),3e3)):X&&clearTimeout(X)}),{deep:!0}),{propItems:le,...u(L)}}export{C 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:I,topGridYNumber:E,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,customIcon:f={}}=j.dataStyle||{};let d;const h={left:o,top:u};d=t?l(f.type||"circle",{fill:a.stroke,...f.style,...h}):n?l(">",{fill:a.stroke,...h,fontSize:18}):r([o,s,o,u],a);const p=U({...h,width:k,bindLine:d,props:B()});return p.isLeft=i,p.isCustomIcon=t,p}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:E,originY:P,yCellHeight:R,endY:T}),function(){var o;const{height:r,list:l,left:s,spaceValue:c,style:u,marginBottom:a}=I;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"../
|
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};
|