cnhis-design-vue 3.1.50-release.3 → 3.1.51-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/es/components/base-search/index.d.ts +14 -8
  2. package/es/components/base-search/src/index.vue.d.ts +14 -8
  3. package/es/components/base-search/src/index.vue2.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  9. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  10. package/es/components/fabric-chart/src/hooks/useCommon.d.ts +1 -0
  11. package/es/components/fabric-chart/src/hooks/useCommon.js +1 -1
  12. package/es/components/field-set/index.d.ts +1 -1
  13. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  14. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  15. package/es/components/form-config/index.d.ts +174 -25
  16. package/es/components/form-config/src/FormConfig.vue.d.ts +175 -26
  17. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  18. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +4 -4
  19. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +13 -10
  20. package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +121 -0
  21. package/es/components/form-config/src/components/FormConfigEventSetting.vue.js +1 -0
  22. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -0
  23. package/es/components/form-config/src/constants/index.d.ts +19 -1
  24. package/es/components/form-config/src/constants/index.js +1 -1
  25. package/es/components/form-config/src/hooks/useDataNormalize.d.ts +1 -1
  26. package/es/components/form-config/src/hooks/useDataNormalize.js +1 -1
  27. package/es/components/form-config/src/types/index.d.ts +7 -3
  28. package/es/components/form-config/style/index.css +1 -1
  29. package/es/components/form-render/index.d.ts +4 -4
  30. package/es/components/form-render/src/FormRender.vue.d.ts +2 -2
  31. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +4 -4
  32. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  33. package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +2 -2
  34. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  35. package/es/components/form-render/src/hooks/useLowCodeReactions.d.ts +1 -1
  36. package/es/components/form-render/src/types/fieldItem.d.ts +2 -1
  37. package/es/components/form-render/src/types/index.d.ts +1 -19
  38. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
  39. package/es/components/iho-table/src/types/index.d.ts +2 -1
  40. package/es/components/index.css +1 -1
  41. package/es/components/info-header/index.d.ts +13 -13
  42. package/es/components/info-header/src/InfoHeader.vue.d.ts +13 -13
  43. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +1 -1
  44. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +1 -1
  45. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +5 -5
  46. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +4 -4
  47. package/es/components/quick-search/index.d.ts +13 -8
  48. package/es/components/quick-search/src/index.vue.d.ts +13 -8
  49. package/es/components/quick-search/src/index.vue2.js +1 -1
  50. package/es/components/shortcut-setter/index.d.ts +6 -5
  51. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -5
  52. package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue.d.ts +58 -0
  53. package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue.js +1 -0
  54. package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue2.js +1 -0
  55. package/es/components/table-filter/src/components/render-widget/components/index.d.ts +56 -1
  56. package/es/components/table-filter/src/components/render-widget/components/index.js +1 -1
  57. package/es/components/table-filter/src/components/render-widget/index.vue.d.ts +4 -1
  58. package/es/components/table-filter/src/components/render-widget/index.vue.js +1 -1
  59. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +55 -1
  60. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
  61. package/es/components/table-filter/src/hooks/useAdvanced.d.ts +2 -0
  62. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  63. package/es/components/table-filter/src/hooks/useRenderWidget.d.ts +1 -7
  64. package/es/components/table-filter/src/hooks/useRenderWidget.js +1 -1
  65. package/es/components/table-filter/src/types/index.d.ts +6 -0
  66. package/es/shared/components/InputNumberSlash/InputNumberSlash.d.ts +19 -1
  67. package/es/shared/components/InputNumberSlash/InputNumberSlash.js +1 -1
  68. package/es/shared/package.json.js +1 -1
  69. package/es/shared/types/business.d.ts +20 -0
  70. package/es/shared/utils/business.d.ts +1 -2
  71. package/package.json +2 -2
@@ -27,13 +27,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
27
27
  handlerInitSearchItem(arr: import("..").ISearchType[]): void;
28
28
  };
29
29
  isRender: (cfg: import("..").ISearchType) => any;
30
- getRenderSearchConObj: (cfg: import("..").ISearchType) => {
31
- widgetType: any;
32
- field_key: string;
33
- con: string | undefined;
34
- value: any[] | null;
35
- unit: string;
36
- } | null;
30
+ getRenderSearchConObj: (cfg: import("..").ISearchType) => any;
37
31
  isExistDefValByRenderWidget: (cfg: import("..").ISearchType) => boolean;
38
32
  resetRenderWidgetValue: (cfg: import("..").ISearchType) => any;
39
33
  transformData: (advancedFilterData: import("..").IApiServerType[], extendData: import("..").IExtendConfigurationType) => {
@@ -61,6 +55,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
61
55
  };
62
56
  rangeFilter: boolean | undefined;
63
57
  unit: any;
58
+ isAccurateSearchVal: boolean;
64
59
  _extendData: import("..").IExtendConfigurationType;
65
60
  title: string;
66
61
  alias: string | undefined;
@@ -70,6 +65,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
70
65
  advanceOptionSetting: string;
71
66
  placeholder: string | undefined;
72
67
  advanceColWidth: number | null | undefined;
68
+ accurateSearch: any;
73
69
  }[];
74
70
  transformParams: (paramsList: any[]) => {};
75
71
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -107,6 +103,9 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
107
103
  con: string;
108
104
  value: string[];
109
105
  unit: "custom" | null;
106
+ switchEnable?: boolean | undefined;
107
+ isAccurateSearch?: boolean | undefined;
108
+ accurateSearchKey?: string | undefined;
110
109
  }[]>;
111
110
  showResetFilterBtn: import("vue").Ref<boolean>;
112
111
  outSearchFieldList: import("vue").Ref<{
@@ -136,6 +135,8 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
136
135
  value?: any;
137
136
  sid?: string | undefined;
138
137
  alias?: string | undefined;
138
+ accurateSearch?: any;
139
+ isAccurateSearchVal?: boolean | undefined;
139
140
  }[]>;
140
141
  showQuickSearch: import("vue").ComputedRef<boolean>;
141
142
  showResetBtn: import("vue").ComputedRef<boolean>;
@@ -148,6 +149,8 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
148
149
  onFilterSearch: (obj: import("..").ISearchParamsType[], transResult: object, isOutFilter?: boolean, config?: {}) => void;
149
150
  handleReset: () => void;
150
151
  resetFunc: (arr: import("..").ISearchType[]) => void;
152
+ getFilterParams: () => {};
153
+ setFilterParams: (params?: any) => void;
151
154
  RenderWidget: import("vue").DefineComponent<{
152
155
  cfg: {
153
156
  type: ObjectConstructor;
@@ -161,6 +164,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
161
164
  }, {
162
165
  valueCp(): any;
163
166
  unit(): any;
167
+ isAccurateSearchVal(): any;
164
168
  }, {
165
169
  search(): void;
166
170
  getEleWidth(cfg: any): {
@@ -172,7 +176,8 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
172
176
  }> | null;
173
177
  handleUpdate(val: any): void;
174
178
  handleUpdateUnit(val: any): void;
175
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:unit" | "outFilterChange")[], "update:modelValue" | "update:unit" | "outFilterChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
179
+ handleUpdateAccurateSearch(val: any): void;
180
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:unit" | "update:isAccurate" | "outFilterChange")[], "update:modelValue" | "update:unit" | "update:isAccurate" | "outFilterChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
176
181
  cfg: {
177
182
  type: ObjectConstructor;
178
183
  required: true;
@@ -183,6 +188,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
183
188
  }>> & {
184
189
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
185
190
  "onUpdate:unit"?: ((...args: any[]) => any) | undefined;
191
+ "onUpdate:isAccurate"?: ((...args: any[]) => any) | undefined;
186
192
  onOutFilterChange?: ((...args: any[]) => any) | undefined;
187
193
  }, {}>;
188
194
  NIcon: any;
@@ -28,13 +28,7 @@ declare const _default: import("vue").DefineComponent<{
28
28
  handlerInitSearchItem(arr: ISearchType[]): void;
29
29
  };
30
30
  isRender: (cfg: ISearchType) => any;
31
- getRenderSearchConObj: (cfg: ISearchType) => {
32
- widgetType: any;
33
- field_key: string;
34
- con: string | undefined;
35
- value: any[] | null;
36
- unit: string;
37
- } | null;
31
+ getRenderSearchConObj: (cfg: ISearchType) => any;
38
32
  isExistDefValByRenderWidget: (cfg: ISearchType) => boolean;
39
33
  resetRenderWidgetValue: (cfg: ISearchType) => any;
40
34
  transformData: (advancedFilterData: IApiServerType[], extendData: import("../../../../es/components/table-filter/src/types").IExtendConfigurationType) => {
@@ -62,6 +56,7 @@ declare const _default: import("vue").DefineComponent<{
62
56
  };
63
57
  rangeFilter: boolean | undefined;
64
58
  unit: any;
59
+ isAccurateSearchVal: boolean;
65
60
  _extendData: import("../../../../es/components/table-filter/src/types").IExtendConfigurationType;
66
61
  title: string;
67
62
  alias: string | undefined;
@@ -71,6 +66,7 @@ declare const _default: import("vue").DefineComponent<{
71
66
  advanceOptionSetting: string;
72
67
  placeholder: string | undefined;
73
68
  advanceColWidth: number | null | undefined;
69
+ accurateSearch: any;
74
70
  }[];
75
71
  transformParams: (paramsList: any[]) => {};
76
72
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -108,6 +104,9 @@ declare const _default: import("vue").DefineComponent<{
108
104
  con: string;
109
105
  value: string[];
110
106
  unit: "custom" | null;
107
+ switchEnable?: boolean | undefined;
108
+ isAccurateSearch?: boolean | undefined;
109
+ accurateSearchKey?: string | undefined;
111
110
  }[]>;
112
111
  showResetFilterBtn: import("vue").Ref<boolean>;
113
112
  outSearchFieldList: import("vue").Ref<{
@@ -137,6 +136,8 @@ declare const _default: import("vue").DefineComponent<{
137
136
  value?: any;
138
137
  sid?: string | undefined;
139
138
  alias?: string | undefined;
139
+ accurateSearch?: any;
140
+ isAccurateSearchVal?: boolean | undefined;
140
141
  }[]>;
141
142
  showQuickSearch: import("vue").ComputedRef<boolean>;
142
143
  showResetBtn: import("vue").ComputedRef<boolean>;
@@ -149,6 +150,8 @@ declare const _default: import("vue").DefineComponent<{
149
150
  onFilterSearch: (obj: ISearchParamsType[], transResult: object, isOutFilter?: boolean, config?: {}) => void;
150
151
  handleReset: () => void;
151
152
  resetFunc: (arr: ISearchType[]) => void;
153
+ getFilterParams: () => {};
154
+ setFilterParams: (params?: any) => void;
152
155
  RenderWidget: import("vue").DefineComponent<{
153
156
  cfg: {
154
157
  type: ObjectConstructor;
@@ -162,6 +165,7 @@ declare const _default: import("vue").DefineComponent<{
162
165
  }, {
163
166
  valueCp(): any;
164
167
  unit(): any;
168
+ isAccurateSearchVal(): any;
165
169
  }, {
166
170
  search(): void;
167
171
  getEleWidth(cfg: any): {
@@ -173,7 +177,8 @@ declare const _default: import("vue").DefineComponent<{
173
177
  }> | null;
174
178
  handleUpdate(val: any): void;
175
179
  handleUpdateUnit(val: any): void;
176
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:unit" | "outFilterChange")[], "update:modelValue" | "update:unit" | "outFilterChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
180
+ handleUpdateAccurateSearch(val: any): void;
181
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:unit" | "update:isAccurate" | "outFilterChange")[], "update:modelValue" | "update:unit" | "update:isAccurate" | "outFilterChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
177
182
  cfg: {
178
183
  type: ObjectConstructor;
179
184
  required: true;
@@ -184,6 +189,7 @@ declare const _default: import("vue").DefineComponent<{
184
189
  }>> & {
185
190
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
186
191
  "onUpdate:unit"?: ((...args: any[]) => any) | undefined;
192
+ "onUpdate:isAccurate"?: ((...args: any[]) => any) | undefined;
187
193
  onOutFilterChange?: ((...args: any[]) => any) | undefined;
188
194
  }, {}>;
189
195
  NIcon: any;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,provide as l,computed as i,watch as a,openBlock as n,createElementBlock as r,createElementVNode as s,createCommentVNode as o,renderSlot as u,unref as c,createVNode as f,withCtx as d,createTextVNode as m,toDisplayString as h,Fragment as p,renderList as v}from"vue";import b from"../../table-filter/src/components/render-widget/index.vue.js";import g from"../../table-filter/src/hooks/useMixins.js";import y from"../../table-filter/src/hooks/useAdvanced.js";import C from"../../table-filter/src/hooks/useRenderWidget.js";import{NButton as k,NIcon as j}from"naive-ui";import{Search as S}from"@vicons/ionicons5";import{isObject as x,cloneDeep as O}from"lodash-es";import{InjectionFilterApiConfig as q,InjectionFilterSearchConfig as R}from"../../table-filter/src/constants/index.js";const A={class:"base-search-block"},F={class:"base-container"},V={class:"bease-left"},Q={class:"base-ul"},_={key:0,class:"baseli showQuickBtn"},w=s("i",{class:"iconfont-table-filter icon-table-filter-shaixuan",style:{color:"inherit","margin-right":"6px"}},null,-1),I={key:0,class:"qqConObjCount"},N={key:1,class:"baseli"},B={key:2,class:"baseli"},E=s("i",{class:"iconfont-table-filter icon-table-filter-reset",style:{"margin-right":"6px"}},null,-1);var D=e({__name:"index",props:{showSettings:{type:Object,default:()=>({hideQuickSearch:0,hideResetBtn:0})},searchFieldList:{type:Array,default:()=>[]},qqConObjCount:{type:Number,default:0},filterApiConfig:{type:Object},appendValueConfig:{type:Object,default:()=>({})}},emits:["foldQuickSearch","onFilterSearch","handleReset","getFilterParam"],setup(e,{expose:D,emit:L}){const P=e,{outQuickSearchFn:W}=g(),{isRender:U,getRenderSearchConObj:$,isExistDefValByRenderWidget:z,resetRenderWidgetValue:M}=C(),{transformData:T,transformParams:G}=y(),H=t([]),J=t(!1),K=t([]);l(q,P.filterApiConfig),l(R,K);const X=i((()=>Z("hideQuickSearch"))),Y=i((()=>Z("hideResetBtn")));function Z(e){return 0==P.showSettings[e]}function ee(){L("foldQuickSearch",!0)}function te(e={}){const t=le()||[];!function(e,t,l=!1,i={}){let a=[];K.value.length>0&&(a=O(K.value));L("onFilterSearch",e,t,l,a,i)}(t,G(t),!0,e)}function le(){return function(e){if(!Array.isArray(e))return[];let t=[];for(let l=0;l<e.length;l++){let i=e[l];const a=$(i);a&&t.push(a)}return t.filter((e=>e.value))}(K.value)}function ie(){!function(e){if(!Array.isArray(e))return;e.forEach((e=>{M(e)})),W.handlerInitSearchItem(e)}(K.value),L("handleReset",{targetType:"outQuickSearchReset"})}return a((()=>P.searchFieldList),(e=>{e&&e.length>0&&function(){K.value=[];let e=O(T(P.searchFieldList,{_filterApiConfig:P.filterApiConfig})).filter((e=>1==e.isShowSearch&&1==e.filterExplicit));K.value=e,W.handlerInitSearchItem(K.value),K.value.some((e=>U(e)?z(e):!!e.explicitDefaultVal))}()}),{immediate:!0,deep:!0}),a((()=>P.qqConObjCount),(e=>{const t=H.value.length||0;J.value=t+Number(e)>0&&Y.value}),{immediate:!0}),a((()=>K),(()=>{H.value=le()||[];const e=G(H.value);J.value=H.value.length+Number(P.qqConObjCount)>0&&Y.value,L("getFilterParam",H.value,e)}),{immediate:!0,deep:!0}),a((()=>P.appendValueConfig),(e=>{if(x(e)&&Object.keys(e).length>0){const t=Object.keys(e);K.value.forEach((l=>{t.includes(l.columnName)&&(l.value=e[l.columnName])}))}}),{immediate:!0,deep:!0}),D({handleReset:ie}),(t,l)=>(n(),r("div",A,[s("div",F,[s("div",V,[s("ul",Q,[o(" 筛选分类插槽 "),u(t.$slots,"classification"),c(X)?(n(),r("li",_,[f(c(k),{class:"search-default",type:"default",onClick:ee},{default:d((()=>[w,m(" 筛选"),e.qqConObjCount?(n(),r("span",I,"("+h(e.qqConObjCount)+")",1)):o("v-if",!0)])),_:1})])):o("v-if",!0),o(" start--筛选外显--start "),(n(!0),r(p,null,v(K.value,(e=>(n(),r(p,null,[e.isRender?(n(),r("li",{class:"baseli outQuickSearch-li",key:e._frontId},[f(b,{cfg:e,modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,onOutFilterChange:te},null,8,["cfg","modelValue","onUpdate:modelValue"])])):o("v-if",!0)],64)))),256)),o(" end--筛选外显--end "),o(" 查询按钮 "),K.value&&K.value.length>0?(n(),r("li",N,[f(c(k),{type:"primary",onClick:te},{default:d((()=>[f(c(j),{component:c(S),size:"16",style:{"margin-right":"6px"}},null,8,["component"]),m(" 查询 ")])),_:1})])):o("v-if",!0),o(" 重置按钮 "),J.value?(n(),r("li",B,[f(c(k),{onClick:ie},{default:d((()=>[E,m(" 重置 ")])),_:1})])):o("v-if",!0),o(" 业务按钮插槽 "),u(t.$slots,"buttons")])])])]))}});export{D as default};
1
+ import{defineComponent as e,ref as t,provide as a,computed as l,watch as i,openBlock as n,createElementBlock as r,createElementVNode as s,createCommentVNode as o,renderSlot as c,unref as u,createVNode as f,withCtx as d,createTextVNode as m,toDisplayString as h,Fragment as p,renderList as v}from"vue";import g from"../../table-filter/src/components/render-widget/index.vue.js";import b from"../../table-filter/src/hooks/useMixins.js";import y from"../../table-filter/src/hooks/useAdvanced.js";import C from"../../table-filter/src/hooks/useRenderWidget.js";import{NButton as k,NIcon as j}from"naive-ui";import{Search as A}from"@vicons/ionicons5";import{isObject as S,cloneDeep as O}from"lodash-es";import{InjectionFilterApiConfig as x,InjectionFilterSearchConfig as q}from"../../table-filter/src/constants/index.js";const R={class:"base-search-block"},F={class:"base-container"},V={class:"bease-left"},Q={class:"base-ul"},N={key:0,class:"baseli showQuickBtn"},_=s("i",{class:"iconfont-table-filter icon-table-filter-shaixuan",style:{color:"inherit","margin-right":"6px"}},null,-1),w={key:0,class:"qqConObjCount"},E={key:1,class:"baseli"},I={key:2,class:"baseli"},P=s("i",{class:"iconfont-table-filter icon-table-filter-reset",style:{"margin-right":"6px"}},null,-1);var B=e({__name:"index",props:{showSettings:{type:Object,default:()=>({hideQuickSearch:0,hideResetBtn:0})},searchFieldList:{type:Array,default:()=>[]},qqConObjCount:{type:Number,default:0},filterApiConfig:{type:Object},appendValueConfig:{type:Object,default:()=>({})}},emits:["foldQuickSearch","onFilterSearch","handleReset","getFilterParam"],setup(e,{expose:B,emit:U}){const D=e,{outQuickSearchFn:L}=b(),{isRender:W,getRenderSearchConObj:$,isExistDefValByRenderWidget:z,resetRenderWidgetValue:M}=C(),{transformData:T,transformParams:G}=y(),H=t([]),J=t(!1),K=t([]);a(x,D.filterApiConfig),a(q,K);const X=l((()=>Z("hideQuickSearch"))),Y=l((()=>Z("hideResetBtn")));function Z(e){return 0==D.showSettings[e]}function ee(){U("foldQuickSearch",!0)}function te(e={}){const t=ae()||[];!function(e,t,a=!1,l={}){let i=[];K.value.length>0&&(i=O(K.value));U("onFilterSearch",e,t,a,i,l)}(t,G(t),!0,e)}function ae(){return function(e){if(!Array.isArray(e))return[];let t=[];for(let a=0;a<e.length;a++){let l=e[a];const i=$(l);i&&t.push(i)}return t.filter((e=>e.value))}(K.value)}function le(){!function(e){if(!Array.isArray(e))return;e.forEach((e=>{M(e)})),L.handlerInitSearchItem(e)}(K.value),U("handleReset",{targetType:"outQuickSearchReset"})}return i((()=>D.searchFieldList),(e=>{e&&e.length>0&&function(){K.value=[];let e=O(T(D.searchFieldList,{_filterApiConfig:D.filterApiConfig})).filter((e=>1==e.isShowSearch&&1==e.filterExplicit));K.value=e,L.handlerInitSearchItem(K.value),K.value.some((e=>W(e)?z(e):!!e.explicitDefaultVal))}()}),{immediate:!0,deep:!0}),i((()=>D.qqConObjCount),(e=>{const t=H.value.length||0;J.value=t+Number(e)>0&&Y.value}),{immediate:!0}),i((()=>K),(()=>{H.value=ae()||[];const e=G(H.value);J.value=H.value.length+Number(D.qqConObjCount)>0&&Y.value,U("getFilterParam",H.value,e)}),{immediate:!0,deep:!0}),i((()=>D.appendValueConfig),(e=>{if(S(e)&&Object.keys(e).length>0){const t=Object.keys(e);K.value.forEach((a=>{t.includes(a.columnName)&&(a.value=e[a.columnName])}))}}),{immediate:!0,deep:!0}),B({handleReset:le,getFilterParams:function(){const e=ae()||[];return G(e)},setFilterParams:function(e){const t=e?Object.keys(e):[];t.length>0&&K.value.forEach((a=>{var l;if(W(a)&&t.includes(a.columnName)){const t=e[a.columnName];a.value=Array.isArray(t)&&!1===(null==(l=a.widgetCfg)?void 0:l.multiple)?t[0]:t}}))}}),(t,a)=>(n(),r("div",R,[s("div",F,[s("div",V,[s("ul",Q,[o(" 筛选分类插槽 "),c(t.$slots,"classification"),u(X)?(n(),r("li",N,[f(u(k),{class:"search-default",type:"default",onClick:ee},{default:d((()=>[_,m(" 筛选"),e.qqConObjCount?(n(),r("span",w,"("+h(e.qqConObjCount)+")",1)):o("v-if",!0)])),_:1})])):o("v-if",!0),o(" start--筛选外显--start "),(n(!0),r(p,null,v(K.value,(e=>(n(),r(p,null,[e.isRender?(n(),r("li",{class:"baseli outQuickSearch-li",key:e._frontId},[f(g,{cfg:e,modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,isAccurate:e.isAccurateSearchVal,"onUpdate:isAccurate":t=>e.isAccurateSearchVal=t,onOutFilterChange:te},null,8,["cfg","modelValue","onUpdate:modelValue","isAccurate","onUpdate:isAccurate"])])):o("v-if",!0)],64)))),256)),o(" end--筛选外显--end "),o(" 查询按钮 "),K.value&&K.value.length>0?(n(),r("li",E,[f(u(k),{type:"primary",onClick:te},{default:d((()=>[f(u(j),{component:u(A),size:"16",style:{"margin-right":"6px"}},null,8,["component"]),m(" 查询 ")])),_:1})])):o("v-if",!0),o(" 重置按钮 "),J.value?(n(),r("li",I,[f(u(k),{onClick:le},{default:d((()=>[P,m(" 重置 ")])),_:1})])):o("v-if",!0),o(" 业务按钮插槽 "),c(t.$slots,"buttons")])])])]))}});export{B as default};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:E,getXValue:G,getYValue:M}=c(b),{getEqualXTypes:T,handleAddPrevent:Y,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:W,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const n=le(P,e);h=n?t([...s,...n],{...v}):null}let E,T;if(d.childbirth){const e=s[1]+$;E=n([s[0],s[1],e],w),c.push(E),T=o([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(T)}const Y=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:Y,rightLine:h,arrowGroup:E,arrowGroupText:T,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};Y?p=r(k,{left:Y.get("x2"),top:Y.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,n,o,i;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}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+W/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:G(e.left),value:M(t,e.top)}};x.value.discardActiveObject(),j("change",n),ne(n,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{x.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}oe()}function oe(){var e;ee.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),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,n=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function re(e,t="moving"){const{title:n,key:o,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${n} ${"hover"===t?i.value:M(o,e.top)}`,`时间 ${G(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,n=m(e);return n>=V&&n<=t}(e.time)){const n=S(e.time),o=E(t.key,t.range,e.value);return[n,o<H?H:o>O?O:o]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?D:B;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),E=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=d(m,r,c),s=O-n*$*k,a=0===n?O-8:n!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===n||n===E-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,n,o,i,s,$,H,E))}));const G=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),M=o([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),T=new e.Group([...C,...j,G,...M?[M]:[]],{objectCaching:!1,...s});x.value.add(T),T.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+W/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(o([m+e*W,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===d?y:Z-y;v.push(o([m+e*W,n],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const n=Object.values(U),o=[],i={},r=_.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:n,range:o}=r||{},i=E(n,o,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[B-I,e*(B-I)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=I&&n<=B&&o>=i&&o<=O}function h([e,t]){return[I+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===n));if(r){const r=E(n,i,0);o.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-I,O-E(n,a,l.value)],[p,h]=[S(c.time)-I,O-E(n,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),x.value.add(...o)}(),te(),function(){function e(e,t){const n=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=I&&n<=B&&o>=H&&o<=O&&(P.point={x:n,y:o},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...ee].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!T([...ee],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let o=H;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(T([...ee],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:G(u.left),value:M(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),x.value.add(...i)}function n(e){const t=e.at(-1),n=(O-H)/2,o=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(j("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:G(e.pointer.x),value:M(e.origin.key,e.pointer.y)}}),j("add",n),ne(n))},redrawPoints:oe}}export{x as useBirthProcess};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:E,getXValue:G,getYValue:M}=c(b),{getEqualXTypes:T,handleAddPrevent:Y,isGridLimit:L,setPrevAndNextPoint:X}=h(x,j,b),{xAxis:A,grid:I,originX:H,originY:W,xCellWidth:N,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:R,rightScales:$,yCellHeight:B,endX:F,scaleValues:q,canvasWidth:z,borderStyle:J,rightAddAreaWidth:K,event:Q,originYCervix:U,other:Z,canvasHeight:_}=b,ee=k(q),te=new Set;function ne(){ee.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=se(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const n=se(P,e);h=n?t([...s,...n],{...v}):null}let E,T;if(d.childbirth){const e=s[1]+B;E=n([s[0],s[1],e],w),c.push(E),T=o([s[0]+N/2,e-B/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(T)}const Y=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:Y,rightLine:h,arrowGroup:E,arrowGroupText:T,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};Y?p=r(k,{left:Y.get("x2"),top:Y.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){Q.hovered&&(e.on("mouseover",(()=>{le(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{re(e),function(e){var t,n,o,i;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}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+N/2,top:e.top+B/2})}(e),Q.hovered&&le(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:G(e.left),value:M(t,e.top)}};x.value.discardActiveObject(),j("change",n),oe(n,"change")}}))}(p),a.push(p),te.add(p))}(se(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));X(e),Promise.all(c).then((n=>{x.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function oe(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=ee.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}ie()}function ie(){var e;te.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),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...te]))),te.clear(),ne()}function re(e){const t=e.prevPoint?e.prevPoint.left:H,n=e.nextPoint?e.nextPoint.left:F;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<U&&e.set("top",U),e.top<W&&e.set("top",W),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function le(e,t="moving"){const{title:n,key:o,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${n} ${"hover"===t?i.value:M(o,e.top)}`,`时间 ${G(e.left).slice(-5)}`],C.show=!0}function se(e,t){if(v(e)&&function(e){const t=V+864e5,n=m(e);return n>=V&&n<=t}(e.time)){const n=S(e.time),o=E(t.key,t.range,e.value);return[n,o<W?W:o>O?O:o]}}function ae(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...J,width:z-D-K-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?D:F;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),E=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=d(m,r,c),s=O-n*B*k,a=0===n?O-8:n!==S.length-1||W||U&&"FHR"!==v?s:W+8;!w||(0===n||n===E-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,n,o,i,s,B,W,E))}));const G=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),M=o([P,W>0?W-B/2:B/2],{value:String(h),...i,...g}),T=new e.Group([...C,...j,G,...M?[M]:[]],{objectCaching:!1,...s});x.value.add(T),T.sendToBack(),r+=c}))}t(R),t($,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=A.time,{show:u,range:c=[0,23],position:d,style:f}=A.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=H+N/2,y=B/2;for(let e=0;e<I.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):ae(p.at(-1),r);p.push(t);const s="top"===l?W-y:O+y;g.push(o([m+e*N,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===d?y:_-y;v.push(o([m+e*N,n],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const n=Object.values(Z),o=[],i={},r=ee.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:n,range:o}=r||{},i=E(n,o,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[F-H,e*(F-H)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=H&&n<=F&&o>=i&&o<=O}function h([e,t]){return[H+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=ee.find((e=>e.key===n));if(r){const r=E(n,i,0);o.push(t([H,r,F,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-H,O-E(n,a,l.value)],[p,h]=[S(c.time)-H,O-E(n,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),x.value.add(...o)}(),ne(),function(){function e(e,t){const n=ee.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=H&&n<=F&&o>=W&&o<=O&&(P.point={x:n,y:o},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...te].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],ee.filter((e=>e.show)).forEach((i=>{if(!T([...te],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<U)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=z-K/2;function t(e,t){if(!e.length)return;let o=W;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=q.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(re(u),le(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(T([...te],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:G(u.left),value:M(u.origin.key,u.top)},...u.origin};j("add",e),oe(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),x.value.add(...i)}function n(e){const t=e.at(-1),n=(O-W)/2,o=(t.height+t.top-W)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(R,D/2),t($,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(j("remove",n),oe(n,"remove")):(Object.assign(n,{data:{time:G(e.pointer.x),value:M(e.origin.key,e.pointer.y)}}),j("add",n),oe(n))},redrawPoints:ie}}export{x as useBirthProcess};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as a}from"../useCommon.js";import"vue";import{getPointRange as s,getIndex as u,isEffectiveNode as f,getTime as c}from"../../utils/index.js";import{cloneDeep as p}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function m(m,d,v,g,h){const{cumputedX:y,cumputedY:x,getXValue:L,getYValue:k}=l(d),{xCellWidth:P,pointSelectionStyle:w,originX:b,endX:C,originY:j,endY:A,event:T,scaleValues:E,xAxis:M,startTime:X,timeXCell:I,itemList:S,dialog:$}=d,O=new Map,V=new Set,Y=p(E);let D=[],_=null;i(m,d);const{getEqualXTypes:N,handleAddPrevent:z}=a(m,v,d);function G(){Y.forEach((e=>{e.dataList.forEach(((t,o)=>{t.show&&(!function(e,t){const{max:o={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:o,name:i,lineStyle:l}){if(!e||!o)return;const r=x(t.type,t.range,o),a=n([b,r,C,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{g.point={...e||{x:a.left,y:a.top}},g.list=[`${i} ${o}${t.unit||""}`],g.show=!0})),a.on("mouseout",(()=>{g.show=!1}))),m.value.add(a)}a(o),a(i),a(l),a(r)}(t,e),R(t,o,e))}))}))}function J(e=[]){if(!(null==_?void 0:_.areaPos))return[];const{startPos:t,endPos:n}=_.areaPos,[o,i]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:ee()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function q(e){$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),F()},onNegativeClick:()=>F(),onClose:()=>F()})}function F(){_&&m.value.remove(_),_=null}function R(e,t,i){var l;const{type:r,unit:a,dataList:s=[]}=i,u=[];O.set(e.key,[]),null==(l=e.list)||l.forEach(((l,s)=>{!function(e,l,s,f){var c;let p,h;const{pointAttr:y={},lineAttr:x={},title:w="",key:b,type:C="circle"}=f,j=Z(f.list[s+1],i);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(h=n([...e,...j],x));const A=u[s-1],E={origin:{data:l,title:w,key:b||"",unit:a,type:r,dataIndex:t,index:s,lineAttr:x},__type:"main",leftLine:A,rightLine:h,...y,...d.event.hovered?d.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:d.event};A?p=o(C,{left:A.get("x2"),top:A.get("y2"),...E}):e&&(E.leftLine=null,p=o(C,{left:e[0],top:e[1],...E}));u.push(h),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){T.hovered&&(e.on("mouseover",(()=>{Q(e,"hover")})),e.on("mouseout",(()=>{g.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{U(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&&Q(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/P);if(o>t+P&&!e.nextPoint){if(0===D.length){W(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+P*r;if(D.every((e=>e.left!==o))){const t=L(o),n=k(l.type,i);D.push({data:{time:t,value:n},left:o,top:i}),W(e,[...e.prevPointer,o,i])}D.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+P*l,r=D.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=D.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=D[l-1]||{left:n,top:o},u=~~((r.left-(t-P))/P),f=(r.top-s.top)/u;a.top=s.top+f,a.left=t,a.data={time:L(t),value:k(i.type,a.top)},D.splice(l,0,a),W(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(D.length>0&&o<D[D.length-1].left){for(const e of V)e.left>o&&(e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e));if(D=D.filter((e=>e.left<=o)),0===D.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of V)e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e)}if(D.length>0){const t=D.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(g.show=!1,1===t.button){const{key:t,type:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:L(e.left),value:k(n,e.top)}};if(m.value.discardActiveObject(),D.length>0){const e=D.map((e=>e.data));v("add",{...o,data:e}),B({...o,data:e})}else v("change",o),B(o,"change")}}))}(p),null==(c=O.get(b))||c.push(p))}(Z(l,i),l,s,e)})),Promise.all(O.get(e.key)).then((e=>{const t=u.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),m.value.add(...t,...e)}))}function W(e,t){const[o,i,l,r]=t;e.clone((o=>{o.set({left:l,top:r}),e.prevPointer=[l,r];const i=n(t,e.origin.lineAttr);o.leftLine=i,V.add(o),m.value.add(i,o)}))}function B(e,t="add",n=1){const{dataIndex:o,data:i,index:l,key:r,type:a}=e,s=Y.find((e=>e.type===a)),f=s.dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(l,n);break;case"change":f.list[l]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=u(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}H({dataIndex:o,scaleValue:s})}function H(e){var t,n,o;if(V.size&&(null==(t=m.value)||t.remove(...K([...V]))),V.clear(),D=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=m.value)||n.remove(...K(O.get(i.key))),O.delete(i.key),R(i,t,o)}else O.size&&(null==(o=m.value)||o.remove(...K(ee()))),O.clear(),G()}function K(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 Q(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;g.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:k(o,e.top)}`;g.list=[`${n} ${r}${l||""}`,`时间 ${L(e.left).slice(-5)}`],g.show=!0}function U(e){e.setCoords();const t=6e4/I,n=e.prevPoint?e.prevPoint.left+t:b,o=e.nextPoint?e.nextPoint.left-t:C;e.top<j&&e.set("top",j),e.top>A&&e.set("top",A),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function Z(e,t){if(f(e)&&function(e){const t=Date.parse(M.list.at(-1)),n=c(e);return n>=X&&n<=t}(e.time)){const n=y(e.time),o=x(t.type,t.range,e.value);return[n,o<j?j:o>A?A:o]}}function ee(){return Array.from(O.values()).flat()}return G(),function(){if(!T.evented)return;let n=!1,o={x:0,y:0};m.value.on("mouse:up",(e=>{if(3===e.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=b&&t<=C&&n>=j&&n<=A)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=s(e.target);ee().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&h.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===h.list.length&&(h.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),S.forEach((n=>{N(ee(),t,"key",2*P).includes(n.key)||h.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key},pointer:e.pointer})})),1===h.list.length&&(h.show=!1,z("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(h,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=J();e.length>0?q((()=>{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 B(n[0],"remove",n.length),n}))}(e);v("remove",t)})):r.emit(_)}})),m.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,o=e.pointer)})),m.value.on("mouse:move",(i=>{if(!n)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;_&&m.value.remove(_),_=new e.Rect({...t,fill:"#CAF982",opacity:.4,...w,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),_.areaPos={startPos:o,endPos:i.pointer},m.value.add(_)}))}(),{redrawPoints:H,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(v("remove",n),B(n,"remove")):(Object.assign(n,{data:{time:L(e.pointer.x),value:k(e.origin.type,e.pointer.y)}}),v("add",n),B(n))},moveLimit:U,setPopup:Q,updateData:B,getGridPoints:ee,getContainPoints:J,showDialog:q,removeCurrentSelection:F}}export{m as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import"vue";import{getPointRange as a,getIndex as f,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as p,omit as d}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function m(m,v,y,g,h){const{cumputedX:k,cumputedY:x,getXValue:L,getYValue:P}=l(v),{xCellWidth:w,pointSelectionStyle:b,originX:A,endX:C,originY:K,endY:j,event:I,scaleValues:T,xAxis:E,startTime:M,timeXCell:X,itemList:S,dialog:$}=v,O=new Map,V=new Set,Y=p(T);let D=[],_=null;i(m,v);const{getEqualXTypes:N,handleAddPrevent:z,setPrevAndNextPoint:G}=s(m,y,v);function J(){Y.forEach((e=>{e.dataList.forEach(((t,o)=>{t.show&&(!function(e,t){const{max:o={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function s({show:e=!1,value:o,name:i,lineStyle:l}){if(!e||!o)return;const r=x(t.type,t.range,o),s=n([A,r,C,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});I.hovered&&i&&(s.on("mousemove",(({pointer:e})=>{g.point={...e||{x:s.left,y:s.top}},g.list=[`${i} ${o}${t.unit||""}`],g.show=!0})),s.on("mouseout",(()=>{g.show=!1}))),m.value.add(s)}s(o),s(i),s(l),s(r)}(t,e),W(t,o,e))}))}))}function q(e=[]){if(!(null==_?void 0:_.areaPos))return[];const{startPos:t,endPos:n}=_.areaPos,[o,i]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:ne()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function F(e){$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),R()},onNegativeClick:()=>R(),onClose:()=>R()})}function R(){_&&m.value.remove(_),_=null}function W(e,t,i){var l;const{type:r,unit:s,dataList:a=[]}=i,f=[];O.set(e.key,[]),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let h,k,x=c;l.key&&(x=a.find((e=>e.key===l.key)));const{pointAttr:b={},lineAttr:A={},title:C="",key:K,type:j="circle"}=x,T=te(c.list[u+1],i);e&&T&&!l.breakpoint&&e[0]!==T[0]&&(k=n([...e,...T],A));const E=f[u-1],M={origin:{data:l,title:C,key:c.key,selfKey:K,unit:s,type:r,dataIndex:t,index:u,lineAttr:A},__type:"main",leftLine:E,rightLine:k,...b,...v.event.hovered?v.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:v.event};E?h=o(j,{left:E.get("x2"),top:E.get("y2"),...M}):e&&(M.leftLine=null,h=o(j,{left:e[0],top:e[1],...M}));f.push(k),h&&(h.originLeft=h.left,h.originTop=h.top,function(e){I.hovered&&(e.on("mouseover",(()=>{Z(e,"hover")})),e.on("mouseout",(()=>{g.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ee(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),I.hovered&&Z(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/w);if(o>t+w&&!e.nextPoint){if(0===D.length){B(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+w*r;if(D.every((e=>e.left!==o))){const t=L(o),n=P(l.type,i);D.push({data:{time:t,value:n,...l.selfKey!==l.key?{key:l.selfKey}:{}},left:o,top:i}),B(e,[...e.prevPointer,o,i])}D.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+w*l,r=D.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=D.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=D[l-1]||{left:n,top:o},f=~~((r.left-(t-w))/w),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:L(t),value:P(i.type,s.top),...i.selfKey!==i.key?{key:i.selfKey}:{}},D.splice(l,0,s),B(e,[a.left,a.top,s.left,s.top])}}l++}}(e,r)}if(D.length>0&&o<D[D.length-1].left){for(const e of V)e.left>o&&(e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e));if(D=D.filter((e=>e.left<=o)),0===D.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of V)e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e)}if(D.length>0){const t=D.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(g.show=!1,1===t.button){const{type:t,selfKey:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:L(e.left),value:P(t,e.top)}};if(m.value.discardActiveObject(),D.length>0){const e=D.map((e=>e.data)),i=Y.find((e=>e.type===t)),l=i.dataList.findIndex((e=>e.key===n));y("add",{...d(o,["index","selfKey","lineAttr"]),dataIndex:l,key:n,data:e}),H({...o,data:e})}else y("change",{...d(o,["selfKey","lineAttr"]),key:n}),H(o,"change")}}))}(h),null==(p=O.get(c.key))||p.push(h))}(te(l,i),l,u,e)})),Promise.all(O.get(e.key)).then((e=>{const t=f.filter((e=>e));G(e),m.value.add(...t,...e)}))}function B(e,t){const[,,o,i]=t;e.clone((l=>{l.set({left:o,top:i}),e.prevPointer=[o,i];const r=n(t,e.origin.lineAttr);l.leftLine=r,V.add(l),m.value.add(r,l)}))}function H(e,t="add",n=1){const{data:o,index:i,key:l,type:r}=e;let{dataIndex:s}=e;const a=Y.find((e=>e.type===r)),u=a.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":u.list.splice(i,n);break;case"change":u.list[i]=o;break;default:{const e=Array.isArray(o)?o[0].time:o.time,t=f(e,u.list),n=Array.isArray(o)?o:[o];u.list.splice(t,0,...n);break}}Q({dataIndex:s,scaleValue:a})}function Q(e){var t,n,o;if(V.size&&(null==(t=m.value)||t.remove(...U([...V]))),V.clear(),D=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=m.value)||n.remove(...U(O.get(i.key))),O.delete(i.key),W(i,t,o)}else O.size&&(null==(o=m.value)||o.remove(...U(ne()))),O.clear(),J()}function U(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 Z(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;g.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:P(o,e.top)}`;g.list=[`${n} ${r}${l||""}`,`时间 ${L(e.left).slice(-5)}`],g.show=!0}function ee(e){e.setCoords();const t=6e4/X,n=e.prevPoint?e.prevPoint.left+t:A,o=e.nextPoint?e.nextPoint.left-t:C;e.top<K&&e.set("top",K),e.top>j&&e.set("top",j),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function te(e,t){if(u(e)&&function(e){const t=Date.parse(E.list.at(-1)),n=c(e);return n>=M&&n<=t}(e.time)){const n=k(e.time),o=x(t.type,t.range,e.value);return[n,o<K?K:o>j?j:o]}}function ne(){return Array.from(O.values()).flat()}return J(),function(){if(!I.evented)return;let n=!1,o={x:0,y:0};m.value.on("mouse:up",(e=>{if(3===e.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=A&&t<=C&&n>=K&&n<=j)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=a(e.target);ne().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&h.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===h.list.length&&(h.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),S.forEach((n=>{N(ne(),t,"key",2*w).includes(n.linkKey||n.key)||h.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===h.list.length&&(h.show=!1,z("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(h,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=q();e.length>0?F((()=>{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 H(n[0],"remove",n.length),n.map((e=>({...d(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);y("remove",t)})):r.emit(_)}})),m.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,o=e.pointer)})),m.value.on("mouse:move",(i=>{if(!n)return;const{x:l,y:r}=o,{x:s,y:a}=i.pointer;_&&m.value.remove(_),_=new e.Rect({...t,fill:"#CAF982",opacity:.4,...b,left:l,top:r,width:s-l,height:a-r,objectCaching:!0}),_.areaPos={startPos:o,endPos:i.pointer},m.value.add(_)}))}(),{redrawPoints:Q,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(y("remove",n),H(n,"remove")):(Object.assign(n,{data:{time:L(e.pointer.x),value:P(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),y("add",n),H({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ee,setPopup:Z,updateData:H,getGridPoints:ne,getContainPoints:q,showDialog:F,removeCurrentSelection:R}}export{m as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as l,defaultStyle as r}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function h(h,p,f,m,g,v,w,j){const{getYValue:y,getXValue:x}=s(p),{getEqualXTypes:b,handleAddPrevent:W,isGridLimit:X}=u(h,f,p),{originY:C,endY:E,borderStyle:k,left:S,itemList:Y,scaleValues:L,originX:V,endX:G,yCellHeight:H,markHeight:N,canvasWidth:T,canvasHeight:M,xCellWidth:P}=p;!function(){if(!S)return;const{title:t,titleWidth:i,titleStyle:o}=S,n=e({width:i,height:E-C+N,...k},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);h.value.add(n)}(),L.forEach(((e,i)=>{var o,s;const u="left"===e.layout?V-5:G+5,{range:c,spaceValue:p,title:f,unit:m,titleStyle:g,spaceGridNumber:v=1,showNumber:w,showMaxMinNumber:j}=e,y=[],x=d(c,p),b=x.length;x.forEach(((t,i)=>{const o=0===i?E-5:E-i*H*v;!w||(0===i||i===b-1)&&!j||y.push(a(String(t),{...e,position:e.layout},u,o))}));const W=f&&n(["left"===e.layout?S.width/2:G+(T-G)/2,(null!=(s=null==(o=y.at(-1))?void 0:o.top)?s:330)-H],{value:`${f}${m?"\n"+m:""}`,...l,...g}),X=new t.Group([...y,...W?[W]:[]],{objectCaching:!1,...r});h.value.add(X),X.sendToBack()})),function(){const e=new t.Rect({width:V-S.titleWidth,height:E-C+N,left:S.titleWidth,top:C,...i,originX:"left",originY:"top",...k});h.value.add(e);const n=c(Y),l=c(S.externalIconList||[]).map((t=>({...t,isExternal:!0})));let r=E;const s=S.titleWidth+15;l.concat(n.reverse()).forEach((t=>{r-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:s,top:r},icon:{leftX:s,topY:r,...t.isExternal?{evented:!1,selectable:!1}:{}}});var l;r-=i.height||30,(l=n).on("moving",(()=>{l.set("originX","center"),X(l)?(g(l),v(l)):m.show=!1})),l.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&X(l))if(b(j(),l.left,"key",2*P).includes(l.origin.key))W("repeat");else{const t={data:{time:x(l.left),value:y(l.origin.type,l.top)},...l.origin};f("add",t),w(t)}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(l)})),h.value.add(i,n)}))}(),h.value.add(new t.Rect({left:0,top:0,width:T-k.strokeWidth,height:M-k.strokeWidth,fill:"transparent",...k}))}export{h as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as l,defaultStyle as r}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function h(h,p,f,m,g,v,y,k){const{getYValue:w,getXValue:j}=s(p),{getEqualXTypes:x,handleAddPrevent:b,isGridLimit:W}=u(h,f,p),{originY:X,endY:C,borderStyle:E,left:S,itemList:Y,scaleValues:K,originX:L,endX:V,yCellHeight:G,markHeight:H,canvasWidth:N,canvasHeight:T,xCellWidth:M}=p;!function(){if(!S)return;const{title:t,titleWidth:i,titleStyle:o}=S,n=e({width:i,height:C-X+H,...E},{value:t.split("").join("\n"),...o||{}},{left:0,top:X},!0);h.value.add(n)}(),K.forEach(((e,i)=>{var o,s;const u="left"===e.layout?L-5:V+5,{range:c,spaceValue:p,title:f,unit:m,titleStyle:g,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:k}=e,w=[],j=d(c,p),x=j.length;j.forEach(((t,i)=>{const o=0===i?C-5:C-i*G*v;!y||(0===i||i===x-1)&&!k||w.push(a(String(t),{...e,position:e.layout},u,o))}));const b=f&&n(["left"===e.layout?S.width/2:V+(N-V)/2,(null!=(s=null==(o=w.at(-1))?void 0:o.top)?s:330)-G],{value:`${f}${m?"\n"+m:""}`,...l,...g}),W=new t.Group([...w,...b?[b]:[]],{objectCaching:!1,...r});h.value.add(W),W.sendToBack()})),function(){const e=new t.Rect({width:L-S.titleWidth,height:C-X+H,left:S.titleWidth,top:X,...i,originX:"left",originY:"top",...E});h.value.add(e);const n=c(Y),l=c(S.externalIconList||[]).map((t=>({...t,isExternal:!0})));let r=C;const s=S.titleWidth+15;l.concat(n.reverse()).forEach((t=>{r-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:s,top:r},icon:{leftX:s,topY:r,...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var l;r-=i.height||30,(l=n).on("moving",(()=>{l.set("originX","center"),W(l)?(g(l),v(l)):m.show=!1})),l.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&W(l)){const t=l.origin.linkKey||l.origin.key;if(x(k(),l.left,"key",2*M).includes(t))b("repeat");else{const e={data:{time:j(l.left),value:w(l.origin.type,l.top),...l.origin.linkKey?{key:l.origin.key}:{}},...l.origin};f("add",e),y({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(l)})),h.value.add(i,n)}))}(),h.value.add(new t.Rect({left:0,top:0,width:N-E.strokeWidth,height:T-E.strokeWidth,fill:"transparent",...E}))}export{h as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";function d(d,u,c,f,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(u),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,c,u),{other:P,yCellHeight:w,xCellWidth:j,endX:E,originX:z,originY:A,endY:C,markHeight:L,event:S,topGridYCellHeight:I}=u,H=new Map,M=l(P);function Y(){var o;if(!(null==(o=null==M?void 0:M.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=M;let a=A+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:u={},textStyle:c={},data:f}=o;let h=null;f.forEach(((o,f)=>{const{time:m,value:g}=o,p=x(m);if(!B(p))return;const v=e(s,{...u,left:p,top:a}),k=p+v.width/2+2,y=i([k,a],{value:g,...c,originX:"left"}),X=new t.Group([v,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:p,iconHalfWidth:v.width/2,origin:{type:"other",key:n,dataIndex:r,index:f,data:o,title:l},limitX:{x1:z,x2:E-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),H.get(n).push(X),d.value.add(X)})),a+=w}))}function T(){var t;if(!(null==(t=null==M?void 0:M.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=M;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=A+w/2;r.forEach(((t,r)=>{const a=e(String(t),{...n,lockMovementY:!0,left:l,originX:"left",top:s,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});s+=w,O(a),H.get(i).push(a),d.value.add(a)})),H.get(i).filter((t=>t.origin.dataIndex===o)).forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index))}))}))}function V(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=M[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}}W(t)}function W(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":Y();break;case"vertical":T();break;case"mark":G()}}function G(){if(!(null==P?void 0:P.mark)||!L)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([z-5,C+L/2],{value:t,...o,originX:"right"});d.value.add(a);const l=C+L,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=x(i);if(!B(r))return;let a=C;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),u=o.height;a+u<=l&&a>=C?(o.set("top",a+u/2),a+=u):(i||(a=C,i=!0),o.set("top",a-u/2),a-=u),s.push(o),O(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:z,x2:E};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(S.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{f.show=!1}))),!S.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);if("mark"===t.origin.key){t.top<A&&t.set("top",A);const e=C+L-t.height/2;t.top>e&&t.set("top",e)}t.originLeft&&t.iconHalfWidth&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(m(t),function(t){var e;if(!(null==(e=t.siblingPoints)?void 0:e.length))return;t.siblingPoints.forEach((e=>e.setCoords().set("left",t.left)))}(t)),S.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(f.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=k(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),c("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(h.point={x:t.left,y:t.top},h.show=!0,h.target=t,h.list=s.map((t=>({...t,renderItem:()=>t.label}))))}))}function q(t){var e;f.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+I/2},f.list=[`时间 ${k(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&f.list.unshift(t.origin.data.name+" "),f.show=!0}function B(t){return t>=z&&t<=E}return function(){var t;if(!(null==(t=null==M?void 0:M.horizontal)?void 0:t.length))return;const{horizontal:i}=M,o=z-5;let n=A+w/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var u;(u=s).on("moving",(()=>{u.set("originX","center"),b(u)?q(u):f.show=!1})),u.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&b(u))if(y(H.get("horizontal"),u.left,"key",j).includes(u.origin.key))X("repeat");else{const t={data:{time:k(u.left),value:u.origin.defaultAddValue},...u.origin};c("add",t),V(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),d.value.add(s),n+=w}))}(),Y(),T(),G(),n.on((()=>{const t="horizontal",e=g(H.get(t));e.length>0?p((()=>{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 Object.keys(e).map((t=>{const i=e[t];return M.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);W({key:t}),c("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};c(i,o),"remove"===i&&V(o,i)}}}export{d as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";function d(d,c,f,u,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(c),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,f,c),{other:P,yCellHeight:w,xCellWidth:j,endX:C,originX:E,originY:z,endY:A,markHeight:L,event:S,topGridYCellHeight:I}=c,H=new Map,M=l(P);function T(){var o;if(!(null==(o=null==M?void 0:M.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=M;let a=z+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:f={},data:u}=o;let h=null;u.forEach(((o,u)=>{const{time:m,value:g}=o,p=x(m);if(!B(p))return;const v=e(s,{...c,left:p,top:a}),k=p+v.width/2+2,y=i([k,a],{value:g,...f,originX:"left"}),X=new t.Group([v,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:p,iconHalfWidth:v.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:E,x2:C-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),H.get(n).push(X),d.value.add(X)})),a+=w}))}function W(){var t;if(!(null==(t=null==M?void 0:M.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=M;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=z+w/2;r.forEach(((t,r)=>{const a=e(String(t),{...n,lockMovementY:!0,left:l,originX:"left",top:s,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});s+=w,O(a),H.get(i).push(a),d.value.add(a)}));const c=H.get(i).filter((t=>t.origin.dataIndex===o)),f=Math.max(...c.map((t=>t.width))),u=l>C-f;c.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=f,u&&t.setCoords().set("originX","right")}))}))}function Y(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=M[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}}V(t)}function V(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":T();break;case"vertical":W();break;case"mark":G()}}function G(){if(!(null==P?void 0:P.mark)||!L)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([E-5,A+L/2],{value:t,...o,originX:"right"});d.value.add(a);const l=A+L,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=x(i);if(!B(r))return;let a=A;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),c=o.height;a+c<=l&&a>=A?(o.set("top",a+c/2),a+=c):(i||(a=A,i=!0),o.set("top",a-c/2),a-=c),s.push(o),O(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:E,x2:C};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(S.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{u.show=!1}))),!S.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);if("mark"===t.origin.key){t.top<z&&t.set("top",z);const e=A+L-t.height/2;t.top>e&&t.set("top",e)}t.originLeft&&t.iconHalfWidth&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(m(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)),S.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(u.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=k(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(h.point={x:t.left,y:t.top},h.show=!0,h.target=t,h.list=s.map((t=>({...t,renderItem:()=>t.label}))))}))}function q(t){var e;u.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+I/2},u.list=[`时间 ${k(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&u.list.unshift(t.origin.data.name+" "),u.show=!0}function B(t){return t>=E&&t<=C}return function(){var t;if(!(null==(t=null==M?void 0:M.horizontal)?void 0:t.length))return;const{horizontal:i}=M,o=E-5;let n=z+w/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),b(c)?q(c):u.show=!1})),c.on("mouseup:before",(t=>{if(u.show=!1,0===t.e.button&&b(c))if(y(H.get("horizontal"),c.left,"key",j).includes(c.origin.key))X("repeat");else{const t={data:{time:k(c.left),value:c.origin.defaultAddValue},...c.origin};f("add",t),Y(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),d.value.add(s),n+=w}))}(),T(),W(),G(),n.on((()=>{const t="horizontal",e=g(H.get(t));e.length>0?p((()=>{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 Object.keys(e).map((t=>{const i=e[t];return M.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);V({key:t}),f("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&Y(o,i)}}}export{d as useOther};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:x,endX:g,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=E(n,e,i);n&&(n.set(f),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<x||s>g)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,$(p),p}function $(t){I.hovered&&(t.on("mouseover",(()=>{D(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&D(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function D(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([g+(w-g)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[u,d]=f,m=u&&p(u),h=d&&p(d),v=M({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<x)&&(L||h>g)){X=l([v?m:x,o,L?h:g,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:x,x2:l?l.left:g};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:x,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=e([g+(w-g)/2,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle});o&&c.value.add(o)}(i)),s.push(o({width:a,height:u,...Y},v,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,d,u,m,h){const{cumputedX:p,getXValue:v}=a(d),{originX:g,endX:x,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=d,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=E(n,e,i);n&&(n.set(f),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<g||s>x)return;const{lineStyle:d}=C.data||{};let u;const m={left:s,top:c};u=i?r("circle",{fill:d.stroke,...m}):n?r(">",{fill:d.stroke,...m,fontSize:18}):l([s,a,s,c],d);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([u,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,$(p),p}function $(t){I.hovered&&(t.on("mouseover",(()=>{W(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&W(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};u("change",e)}})))}function W(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...d,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],d=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,d],{value:t.slice(11,16)}))}));const u=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;u&&c.value.add(u);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([x+(w-x)/2,d],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:d,left:u,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[d,u]=f,m=d&&p(d),h=u&&p(u),v=M({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<g)&&(L||h>x)){X=l([v?m:g,o,L?h:x,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:g,x2:l?l.left:x};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:g,x2:x};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=x+(w-x)/2,l=e([o,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle}),r=w-Y.strokeWidth;o+l.width>r&&l.set({originX:"right",left:r});l&&c.value.add(l)}(i)),s.push(o({width:a,height:d,...Y},v,{left:u,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"../useEvent.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],c=n[i-1],p=n[i+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(r.push(f),g()):g()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...s,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...i[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;k=r([e[0],t,i],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),j=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=r([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(n,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);n&&j&&!l.breakpoint&&(!w&&!E||O)&&n[0]!==j[0]&&(f=i([...n,...j],{...v}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:g,key:m||"",unit:s.unit,type:c,_type:d(g,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else n&&(R.leftLine=null,p=o(I,{left:n[0],top:w?n[1]-5:n[1],...R}));C.push(f),p&&(g.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),A.push(p),ie.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(I).then((i=>{L.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.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}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=g(i,[...x,...b]);r[`${e.type}`]=e.value,a(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function w(e){return"fixed"===e.position}export{L as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as g,deleteProperty as v}from"../../utils/index.js";import"../useEvent.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){r(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],c=n[i-1],p=n[i+1],d=o[r-1],f=o[r+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),v()}}else p?(l.push(p),v()):f?(s.push(f),v()):v()})),e}(),{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...T(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...r,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function se(e,t,r){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:g={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=r,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,r),X={};X.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(s),{obj:s,top:-z}}(R,u,T),function(e,t,r,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=r,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;k=s([e[0],t,i],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...v.line,...n}),j=o((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:l,...v.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,r),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=s([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(n,l,s,a,u){let p,f;const{pointAttr:h={},lineAttr:g={},title:v="",key:m,type:x="circle"}=a,b=e.list[s+1],j=ue(b,r),w=re(c,e.list[s].value),E=j&&re(c,b.value);n&&j&&!l.breakpoint&&(!w&&!E||O)&&n[0]!==j[0]&&(f=i([...n,...j],{...g}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[s-1],R={origin:{data:l,title:v,key:m||"",unit:r.unit,type:c,_type:d(v,c),dataIndex:t,index:s},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else n&&(R.leftLine=null,p=o(I,{left:n[0],top:w?n[1]-5:n[1],...R}));C.push(f),p&&(v.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),A.push(p),ie.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));Promise.all(I).then((i=>{L.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function re(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.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}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=v(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};S("change",r),pe(r,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function w(e){return"fixed"===e.position}export{L as useCenter};
@@ -6,4 +6,5 @@ export declare function useCommon(canvas: Ref<fabric.Canvas>, emits: Function, p
6
6
  getEqualXTypes: (points: any[], pointX: number, field: string, range?: any) => string[];
7
7
  handleAddPrevent: (type: 'repeat' | 'exceedMax' | 'exceedMin') => void;
8
8
  isGridLimit: (point: IObject) => boolean;
9
+ setPrevAndNextPoint: (pointList: any[]) => void;
9
10
  };
@@ -1 +1 @@
1
- const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,n,t,r=i.xCellWidth){const o=[],d=r/2;return e.forEach((e=>{e.origin&&!e.origin.isMenu&&Math.abs(n-e.left)<=d&&o.push(e.origin[t])})),[...new Set(o)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:r,endX:o,originY:d,endY:c}=i;return n>=r&&n<=o&&t>=d&&t<=c}}}export{n as useCommon};
1
+ const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,n,t,r=i.xCellWidth){const o=[],d=r/2;return e.forEach((e=>{e.origin&&!e.origin.isMenu&&Math.abs(n-e.left)<=d&&o.push(e.origin[t])})),[...new Set(o)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:r,endX:o,originY:d,endY:u}=i;return n>=r&&n<=o&&t>=d&&t<=u},setPrevAndNextPoint:function(e){e.reduce(((e,n)=>e&&n?(n.prevPoint=e,e.nextPoint=n,n):n||e),null)}}}export{n as useCommon};
@@ -158,7 +158,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
158
158
  handleFieldSave: () => void;
159
159
  onCancle: () => void;
160
160
  reset: () => void;
161
- isShowColumn: (column: import("../../../es/shared/types").AnyObject) => boolean;
161
+ getShowColumn: (column: import("../../../es/shared/types").AnyObject) => boolean;
162
162
  initFields: () => import("../../../es/shared/types").AnyObject[];
163
163
  handleGroup: (fields: import("../../../es/shared/types").AnyObject[]) => import("../../../es/shared/types").AnyObject[];
164
164
  getTableFields: () => import("lodash").Omit<never, "uuid">[];
@@ -160,7 +160,7 @@ declare const _default: import("vue").DefineComponent<{
160
160
  handleFieldSave: () => void;
161
161
  onCancle: () => void;
162
162
  reset: () => void;
163
- isShowColumn: (column: AnyObject) => boolean;
163
+ getShowColumn: (column: AnyObject) => boolean;
164
164
  initFields: () => AnyObject[];
165
165
  handleGroup: (fields: AnyObject[]) => AnyObject[];
166
166
  getTableFields: () => import("lodash").Omit<never, "uuid">[];
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as s,createBlock as r,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as v,createTextVNode as y,toDisplayString as b,createVNode as k,mergeProps as g,renderSlot as x}from"vue";import{useThemeVars as w,NInput as A,NCheckbox as _,NTooltip as S,NIcon as C,NPopconfirm as W,NButton as E}from"naive-ui";import q from"../../../shared/components/VueDraggable/src/vuedraggable.js";import F from"./components/Row.vue.js";import{isArray as N,cloneDeep as R,isString as j,omit as P}from"lodash-es";import{isDisable as B,setStyle as I,getGroupTree as U}from"./utils/index.js";import{uuidGenerator as D}from"../../../shared/utils/index.js";import{HelpCircleSharp as O}from"@vicons/ionicons5";const T={class:"c-field-set__table-header"},V=h("span",null,"数值越小,优先级越高",-1),K=["tabindex"],L={key:1,class:"c-field-set__table-footer"};var G=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1}},emits:["save","close","reset"],setup(e,{expose:G,emit:H}){const M=e,$={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},z=l(w().value.primaryColor),J=l(""),Q=l(),X=l([]),Y=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"}]),Z=t((()=>X.value.flat())),ee=i({columns:Y,fieldList:Z,onUpdateChecked:function({checked:e,column:l}){const t=!e||ue(l.field);l.checkedAll=!t}}),le={keyword:J.value,idx:0,startIdx:0},te=()=>{H("save",{tableFields:ae()})},ie=()=>{H("close")};function oe(){X.value=de(),ne(),H("reset")}function de(){const e=R(M.fields).map((e=>({...e,uuid:D()})));return Object.keys($).forEach((l=>{e.forEach((e=>{"old"==M.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[$[l]]=1==e[l]:e[$[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),function(e){if(M.groupSetting){return U(M.groupSetting,e).reduce(((t,i)=>{const o=j(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function ae(){let e=[];return e="old"==M.type?Z.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,...M.isEdit?{required:e.required,editable:e.editable}:{}}))):Z.value,e.map((e=>P(e,["uuid"])))}function se(){const e=le.keyword!==J.value;let l=J.value?Z.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(J.value))return!!e||t>le.idx})):0;-1!==l||e||(l=le.startIdx),Q.value.scrollTop=52*l,Object.assign(le,{keyword:J.value,idx:l},e?{startIdx:l}:{})}function re(e){var l;return!!J.value&&(null==(l=e.title)?void 0:l.includes(J.value))}function ne(){var e,l;if((null==(e=M.showColumnNames)?void 0:e.length)&&(Y.value=Y.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=M.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=M.customColumns)?void 0:l.length)&&Y.value.push(...M.customColumns),M.showSeq&&Y.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),!M.showSortPriority){const e=Y.value.findIndex((e=>"sortPriority"===e.field));Y.value.splice(e,1)}Y.value.forEach((e=>{if(function(e){const l=["editable","required"].includes(e.field);return l&&M.isEdit||!l}(e)&&(e.isShow=!0),"checkbox"===e.type){const l=X.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ue(e.field)&&!l}}))}function ue(e){return X.value.flat().some((l=>!B(l,e)&&!l[e]&&"0001"!=l.id))}return o([()=>M.fields,()=>{var e;return null==(e=M.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(X.value=de(),ne())}),{immediate:!0,deep:!0}),G({getTableFields:ae}),(l,t)=>(d(),a("div",{class:"c-field-set",style:s({"--row-height":"52px","--primary-color":z.value})},[e.showSearch?(d(),r(n(A),{key:0,class:"c-field-set__search-wrapper",value:J.value,"onUpdate:value":t[0]||(t[0]=e=>J.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(se,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",T,[(d(!0),a(p,null,m(Y.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:s(n(I)(e))},["checkbox"===e.type?(d(),r(n(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void Z.value.forEach((e=>{B(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:v((()=>[y(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])):f("v-if",!0),y(" "+b("checkbox"!==e.type?e.title:"")+" ",1),"sortPriority"===e.field?(d(),r(n(S),{key:1,trigger:"hover"},{trigger:v((()=>[k(n(C),{component:n(O),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[V])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Q},[k(n(q),{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=e=>X.value=e),animation:"150","item-key":"id",draggable:".item"},{item:v((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:"item",tabindex:l},[n(N)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),r(F,g(ee,{key:t,element:e,idx:l+1,"is-highlight":re(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),r(F,g({key:1},ee,{element:e,idx:l+1,"is-highlight":re(e)}),null,16,["element","idx","is-highlight"]))],8,K))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",L,[f(" 底部按钮插槽 "),x(l.$slots,"footer",{},(()=>[k(n(W),{onPositiveClick:oe},{trigger:v((()=>[k(n(E),{style:{"margin-right":"8px"}},{default:v((()=>[y("恢复默认设置")])),_:1})])),default:v((()=>[y(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(E),{style:{"margin-right":"8px"},onClick:ie},{default:v((()=>[y("取消")])),_:1}),k(n(E),{type:"primary",onClick:te},{default:v((()=>[y("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{G as default};
1
+ import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as r,createBlock as s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as y,createTextVNode as v,toDisplayString as b,createVNode as k,mergeProps as g,renderSlot as x}from"vue";import{useThemeVars as w,NInput as A,NCheckbox as _,NTooltip as S,NIcon as C,NPopconfirm as W,NButton as E}from"naive-ui";import P from"../../../shared/components/VueDraggable/src/vuedraggable.js";import q from"./components/Row.vue.js";import{isArray as F,cloneDeep as N,isString as R,omit as j}from"lodash-es";import{isDisable as B,setStyle as I,getGroupTree as U}from"./utils/index.js";import{uuidGenerator as D}from"../../../shared/utils/index.js";import{HelpCircleSharp as O}from"@vicons/ionicons5";const T={class:"c-field-set__table-header"},V=h("span",null,"数值越小,优先级越高",-1),K=["tabindex"],L={key:1,class:"c-field-set__table-footer"};var G=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1}},emits:["save","close","reset"],setup(e,{expose:G,emit:H}){const M=e,$={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},z=l(w().value.primaryColor),J=l(""),Q=l(),X=l([]),Y=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"}]),Z=t((()=>X.value.flat())),ee=i({columns:Y,fieldList:Z,onUpdateChecked:function({checked:e,column:l}){const t=!e||ue(l.field);l.checkedAll=!t}}),le={keyword:J.value,idx:0,startIdx:0},te=()=>{H("save",{tableFields:ae()})},ie=()=>{H("close")};function oe(){X.value=de(),ne(),H("reset")}function de(){const e=N(M.fields).map((e=>({...e,uuid:D()})));return Object.keys($).forEach((l=>{e.forEach((e=>{"old"==M.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[$[l]]=1==e[l]:e[$[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),function(e){if(M.groupSetting){return U(M.groupSetting,e).reduce(((t,i)=>{const o=R(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function ae(){let e=[];return e="old"==M.type?Z.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,sortPriority:e.sortPriority,...M.isEdit?{required:e.required,editable:e.editable}:{}}))):Z.value,e.map((e=>j(e,["uuid"])))}function re(){const e=le.keyword!==J.value;let l=J.value?Z.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(J.value))return!!e||t>le.idx})):0;-1!==l||e||(l=le.startIdx),Q.value.scrollTop=52*l,Object.assign(le,{keyword:J.value,idx:l},e?{startIdx:l}:{})}function se(e){var l;return!!J.value&&(null==(l=e.title)?void 0:l.includes(J.value))}function ne(){var e,l;(null==(e=M.showColumnNames)?void 0:e.length)&&(Y.value=Y.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=M.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=M.customColumns)?void 0:l.length)&&Y.value.push(...M.customColumns),M.showSeq&&Y.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),Y.value.forEach((e=>{if(e.isShow=function(e){return!(["editable","required"].includes(e.field)&&!M.isEdit||"sortPriority"===e.field&&!M.showSortPriority)}(e),"checkbox"===e.type){const l=X.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ue(e.field)&&!l}}))}function ue(e){return X.value.flat().some((l=>!B(l,e)&&!l[e]&&"0001"!=l.id))}return o([()=>M.fields,()=>{var e;return null==(e=M.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(X.value=de(),ne())}),{immediate:!0,deep:!0}),G({getTableFields:ae}),(l,t)=>(d(),a("div",{class:"c-field-set",style:r({"--row-height":"52px","--primary-color":z.value})},[e.showSearch?(d(),s(n(A),{key:0,class:"c-field-set__search-wrapper",value:J.value,"onUpdate:value":t[0]||(t[0]=e=>J.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(re,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",T,[(d(!0),a(p,null,m(Y.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:r(n(I)(e))},["checkbox"===e.type?(d(),s(n(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void Z.value.forEach((e=>{B(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:y((()=>[v(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])):f("v-if",!0),v(" "+b("checkbox"!==e.type?e.title:"")+" ",1),"sortPriority"===e.field?(d(),s(n(S),{key:1,trigger:"hover"},{trigger:y((()=>[k(n(C),{component:n(O),style:{top:"2px"}},null,8,["component"])])),default:y((()=>[V])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Q},[k(n(P),{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=e=>X.value=e),animation:"150","item-key":"id",draggable:".item"},{item:y((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:"item",tabindex:l},[n(F)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),s(q,g(ee,{key:t,element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),s(q,g({key:1},ee,{element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"]))],8,K))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",L,[f(" 底部按钮插槽 "),x(l.$slots,"footer",{},(()=>[k(n(W),{onPositiveClick:oe},{trigger:y((()=>[k(n(E),{style:{"margin-right":"8px"}},{default:y((()=>[v("恢复默认设置")])),_:1})])),default:y((()=>[v(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(E),{style:{"margin-right":"8px"},onClick:ie},{default:y((()=>[v("取消")])),_:1}),k(n(E),{type:"primary",onClick:te},{default:y((()=>[v("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{G as default};