cnhis-design-vue 3.1.48-beta.14 → 3.1.48-beta.15

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 (31) hide show
  1. package/es/components/card-reader-sdk/src/cardReaderSDK.d.ts +5 -1
  2. package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
  3. package/es/components/card-reader-sdk/src/components/readCardDialog.vue.d.ts +19 -0
  4. package/es/components/card-reader-sdk/src/components/readCardDialog.vue2.js +1 -1
  5. package/es/components/card-reader-sdk/src/utils/readHealthCard.d.ts +6 -1
  6. package/es/components/card-reader-sdk/src/utils/readHealthCard.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  9. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.d.ts +7 -1
  10. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  11. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  13. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  14. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
  16. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  17. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  18. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  19. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  20. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  21. package/es/components/scale-view/index.d.ts +2 -0
  22. package/es/components/scale-view/src/ScaleView.vue.d.ts +2 -0
  23. package/es/components/scale-view/src/components/EvaluateCountdown.vue.d.ts +2 -0
  24. package/es/components/scale-view/src/components/EvaluateCountdown.vue2.js +1 -1
  25. package/es/components/scale-view/src/components/formitem/r-datetime.js +1 -1
  26. package/es/components/scale-view/src/hooks/scaleview-init.js +1 -1
  27. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  28. package/es/components/scale-view/src/utils/judge-types.d.ts +9 -1
  29. package/es/components/scale-view/src/utils/judge-types.js +1 -1
  30. package/es/shared/package.json.js +1 -1
  31. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { AnyObject } from '../../../../es/shared/types';
1
2
  import { ComponentInternalInstance } from 'vue';
2
3
  import { TRANS_CMD } from './constants';
3
4
  import { InsuranceType } from './types';
@@ -14,7 +15,10 @@ export default class CardReaderSDK {
14
15
  private createParams;
15
16
  private checkLoading;
16
17
  private checkResCodeAndLoading;
17
- readHealthCard(instance?: ComponentInternalInstance): Promise<string>;
18
+ readHealthCard(instance?: ComponentInternalInstance, options?: {
19
+ inputProps?: AnyObject;
20
+ modalProps?: AnyObject;
21
+ }): Promise<string>;
18
22
  readIdCard(params?: InsuranceType.CardReadParams): Promise<Partial<{
19
23
  personinfo: Record<"sex" | "age" | "address" | "birthday" | "location" | "cardnum" | "cardpwd" | "folk" | "idnumber" | "ownpay" | "ptname" | "pttype" | "recordid" | "updateflag", string>;
20
24
  cardinfo: Partial<Record<"name" | "sex" | "age" | "address" | "birthday" | "idnumber" | "cardno" | "cardid" | "sex_code" | "nation_name" | "nation_code" | "idtype" | "issuer" | "issuedate" | "expirydate" | "hasphoto" | "telphone" | "companyname" | "age_code" | "age_name" | "ages", string>>;
@@ -1 +1 @@
1
- import{isFunction as e}from"lodash-es";import{TRANS_CMD as a}from"./constants/index.js";import t from"./insuranceSDK.js";import{ReadHealthCard as r}from"./utils/readHealthCard.js";const s=class{constructor(e){this.options=e,this.loading=!1,this.readHealthCardDialog=new r,this.insurance=new t}get basicParamsRes(){return e(this.options.basicParams)?this.options.basicParams():this.options.basicParams}static create(e={}){return new s(e)}destroy(){this.insurance.destroy()}createParams(e,a,t){var r,s;const{operatorname:n,operatorcode:i,...c}=this.basicParamsRes||{};return{transcmd:e,operatorname:null!=(r=a.operatorname)?r:n,operatorcode:null!=(s=a.operatorcode)?s:i,...c,...t}}checkLoading(){if(this.loading)return Promise.reject("请勿重复操作")}async checkResCodeAndLoading(e){try{this.loading=!0;const a=await e;return 3===a.returncode?Promise.reject(`${a.returnmsg||"操作失败"}`):a.returndata}finally{this.loading=!1}}async readHealthCard(e){return await this.checkLoading(),this.readHealthCardDialog.show(e)}async readIdCard(e={}){await this.checkLoading();const t=this.createParams(a.ID_CARD_READ,e,{transtype:"IDCARD",interfaceid:"0",transdata:{readtype:"2"}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async readMemberCard(e={}){await this.checkLoading();const t=this.createParams(a.MEMBER_CARD_READ,e,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",transdata:{readtype:"1"}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async writeMemberCard(e={}){await this.checkLoading();const t=this.createParams(a.MEMBER_CARD_WRITE,e,{transsystem:"10",transtype:"IDCARD",interfaceid:"0"});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async readInsuranceCard(e={}){await this.checkLoading();const t=this.createParams(a.NS_GETPERSONALINFO,e,{transchannel:"101",interfaceid:e.interfaceid,transtype:"YB0000"});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async generalRequest(e={}){await this.checkLoading();const t=this.createParams(a.NS_GETPERSONALINFO,e);return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}};let n=s;n.TRANS_CMD=a;export{n as default};
1
+ import{isFunction as e}from"lodash-es";import{TRANS_CMD as a}from"./constants/index.js";import t from"./insuranceSDK.js";import{ReadHealthCard as r}from"./utils/readHealthCard.js";const s=class{constructor(e){this.options=e,this.loading=!1,this.readHealthCardDialog=new r,this.insurance=new t}get basicParamsRes(){return e(this.options.basicParams)?this.options.basicParams():this.options.basicParams}static create(e={}){return new s(e)}destroy(){this.insurance.destroy()}createParams(e,a,t){var r,s;const{operatorname:n,operatorcode:i,...c}=this.basicParamsRes||{};return{transcmd:e,operatorname:null!=(r=a.operatorname)?r:n,operatorcode:null!=(s=a.operatorcode)?s:i,...c,...t}}checkLoading(){if(this.loading)return Promise.reject("请勿重复操作")}async checkResCodeAndLoading(e){try{this.loading=!0;const a=await e;return 3===a.returncode?Promise.reject(`${a.returnmsg||"操作失败"}`):a.returndata}finally{this.loading=!1}}async readHealthCard(e,a){return await this.checkLoading(),this.readHealthCardDialog.show({instance:e,...a})}async readIdCard(e={}){await this.checkLoading();const t=this.createParams(a.ID_CARD_READ,e,{transtype:"IDCARD",interfaceid:"0",transdata:{readtype:"2"}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async readMemberCard(e={}){await this.checkLoading();const t=this.createParams(a.MEMBER_CARD_READ,e,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",transdata:{readtype:"1"}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async writeMemberCard(e={}){await this.checkLoading();const t=this.createParams(a.MEMBER_CARD_WRITE,e,{transsystem:"10",transtype:"IDCARD",interfaceid:"0"});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async readInsuranceCard(e={}){await this.checkLoading();const t=this.createParams(a.NS_GETPERSONALINFO,e,{transchannel:"101",interfaceid:e.interfaceid,transtype:"YB0000"});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async generalRequest(e={}){await this.checkLoading();const t=this.createParams(a.NS_GETPERSONALINFO,e);return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}};let n=s;n.TRANS_CMD=a;export{n as default};
@@ -1,11 +1,22 @@
1
+ import { AnyObject } from '../../../../../es/shared/types';
1
2
  declare const _default: import("vue").DefineComponent<{
2
3
  show: {
3
4
  type: BooleanConstructor;
4
5
  required: true;
5
6
  };
7
+ inputProps: {
8
+ type: null;
9
+ required: true;
10
+ };
11
+ modalProps: {
12
+ type: null;
13
+ required: true;
14
+ };
6
15
  }, {
7
16
  props: {
8
17
  show: boolean;
18
+ inputProps: AnyObject;
19
+ modalProps: AnyObject;
9
20
  };
10
21
  inputRef: import("vue").Ref<{
11
22
  focus: () => void;
@@ -21,6 +32,14 @@ declare const _default: import("vue").DefineComponent<{
21
32
  type: BooleanConstructor;
22
33
  required: true;
23
34
  };
35
+ inputProps: {
36
+ type: null;
37
+ required: true;
38
+ };
39
+ modalProps: {
40
+ type: null;
41
+ required: true;
42
+ };
24
43
  }>> & {
25
44
  onClose?: ((...args: any[]) => any) | undefined;
26
45
  onConfirm?: ((...args: any[]) => any) | undefined;
@@ -1 +1 @@
1
- import{defineComponent as e,watch as o,nextTick as t,ref as a,openBlock as s,createBlock as l,unref as i,withCtx as n,createVNode as u}from"vue";import{NModal as r,NInput as c}from"naive-ui";var p=e({__name:"readCardDialog",props:{show:{type:Boolean}},emits:["update:show","confirm","close"],setup(e,{emit:p}){const v=e;o((()=>v.show),(async e=>{var o;e&&(await t(),null==(o=f.value)||o.focus())}));const f=a(),m=a("");function w(){p("update:show",!1),p("close")}function d(){p("confirm",m.value)}return(o,t)=>(s(),l(i(r),{preset:"dialog",title:"扫码电子健康卡",show:e.show,"close-on-esc":!1,"show-icon":!1,"positive-text":"确认",onClose:w,onPositiveClick:d},{default:n((()=>[u(i(c),{value:m.value,"onUpdate:value":t[0]||(t[0]=e=>m.value=e),ref_key:"inputRef",ref:f},null,8,["value"])])),_:1},8,["show"]))}});export{p as default};
1
+ import{defineComponent as o,watch as e,nextTick as l,ref as a,openBlock as s,createBlock as t,unref as n,mergeProps as u,withCtx as i,createVNode as r}from"vue";import{NModal as p,NInput as c}from"naive-ui";var v=o({__name:"readCardDialog",props:{show:{type:Boolean},inputProps:null,modalProps:null},emits:["update:show","confirm","close"],setup(o,{emit:v}){const f=o;e((()=>f.show),(async o=>{var e;o&&(await l(),null==(e=d.value)||e.focus())}));const d=a(),m=a("");function h(){v("update:show",!1),v("close")}function w(){v("confirm",m.value)}return(e,l)=>(s(),t(n(p),u({preset:"dialog",title:"扫码电子健康卡",show:o.show,"close-on-esc":!1,"show-icon":!1,"positive-text":"确认"},o.modalProps,{onClose:h,onPositiveClick:w}),{default:i((()=>[r(n(c),u({value:m.value,"onUpdate:value":l[0]||(l[0]=o=>m.value=o),ref_key:"inputRef",ref:d,placeholder:"请输入健康卡号"},o.inputProps),null,16,["value"])])),_:1},16,["show"]))}});export{v as default};
@@ -1,6 +1,11 @@
1
+ import { AnyObject } from '../../../../../es/shared/types';
1
2
  import { ComponentInternalInstance } from 'vue';
2
3
  export declare class ReadHealthCard {
3
4
  rendered: boolean;
4
5
  static createMsg(message: string): string;
5
- show(instance?: ComponentInternalInstance): Promise<string>;
6
+ show({ instance, inputProps, modalProps }?: {
7
+ instance?: ComponentInternalInstance;
8
+ inputProps?: AnyObject;
9
+ modalProps?: AnyObject;
10
+ }): Promise<string>;
6
11
  }
@@ -1 +1 @@
1
- import{ref as e,render as r,createVNode as t,withCtx as n,nextTick as o}from"vue";import{createProviderWrapper as a}from"../../../../shared/utils/index.js";import s from"../components/readCardDialog.vue.js";class d{constructor(){this.rendered=!1}static createMsg(e){return`[ReadHealthCardDialog] ${e}`}show(i){return this.rendered?Promise.reject(d.createMsg("请勿重复打开弹窗")):new Promise(((l,u)=>{this.rendered=!0;const c=document.createElement("div"),m=e(!1),h=a(i);var f;function p(){u(d.createMsg("弹窗关闭"))}function v(e){l(e),m.value=!1}r(t(h,null,{default:n((()=>t(s,{show:m.value,"onUpdate:show":e=>m.value=e,onConfirm:v,onClose:p,onAfterLeave:()=>function(e){if(!e.parentElement)return;C.rendered=!1,e.parentElement.removeChild(e)}(c)},null)),i)}),c),f=c,document.body.appendChild(f),o((()=>m.value=!0));const C=this}))}}export{d as ReadHealthCard};
1
+ import{ref as e,render as r,createVNode as t,withCtx as n,mergeProps as o,nextTick as s}from"vue";import{createProviderWrapper as a}from"../../../../shared/utils/index.js";import d from"../components/readCardDialog.vue.js";class i{constructor(){this.rendered=!1}static createMsg(e){return`[ReadHealthCardDialog] ${e}`}show({instance:l,inputProps:u,modalProps:c}={}){return this.rendered?Promise.reject(i.createMsg("请勿重复打开弹窗")):new Promise(((m,p)=>{this.rendered=!0;const h=document.createElement("div"),f=e(!1),v=a(l);var C;function P(){p(i.createMsg("弹窗关闭"))}function g(e){m(e),f.value=!1}r(t(v,null,{default:n((()=>t(d,o({show:f.value,"onUpdate:show":e=>f.value=e,onConfirm:g,onClose:P,onAfterLeave:()=>function(e){if(!e.parentElement)return;w.rendered=!1,e.parentElement.removeChild(e)}(h)},{inputProps:u,modalProps:c}),null)),l)}),h),C=h,document.body.appendChild(C),s((()=>f.value=!0));const w=this}))}}export{i as ReadHealthCard};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawText as n,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"@vueuse/core";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"../../../../../shared/utils/index.js";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:G,getXValue:M,getYValue:T}=c(b),{getEqualXTypes:Y,handleAddPrevent:E,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 o=le(P,e);h=o?t([...s,...o],{...v}):null}let G,Y;if(d.childbirth){const e=s[1]+$;G=o([s[0],s[1],e],w),c.push(G),Y=n([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(Y)}const E=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:E,rightLine:h,arrowGroup:G,arrowGroupText:Y,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};E?p=r(k,{left:E.get("x2"),top:E.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,o,n,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),null==(n=e.arrowGroup)||n.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,o={...e.origin,data:{...e.origin.data,time:M(e.left),value:T(t,e.top)}};x.value.discardActiveObject(),j("change",o),oe(o,"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 o=null;e=e.filter((e=>(e&&o&&(o.nextPoint=e,e.prevPoint=o),o=e||o,e))),Promise.all(c).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function oe(e,t="add"){const{dataIndex:o,data:n,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]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ne()}function ne(){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,o=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>o&&e.set("left",o)}function re(e,t="moving"){const{title:o,key:n,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${o} ${"hover"===t?i.value:T(n,e.top)}`,`时间 ${M(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,o=m(e);return o>=V&&o<=t}(e.time)){const o=S(e.time),n=G(t.key,t.range,e.value);return[o,n<H?H:n>O?O:n]}}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,o="left"){let r="left"===o?D:B;t.forEach(((t,o)=>{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),G=S.length;S.forEach(((e,o)=>{const{lineXMain:n,lineXSub:i,textLeft:l}=d(m,r,c),s=O-o*$*k,a=0===o?O-8:o!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===o||o===G-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,o,n,i,s,$,H,G))}));const M=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),T=n([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...j,M,...T?[T]:[]],{objectCaching:!1,...s});x.value.add(Y),Y.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:o,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?+o.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(n([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 o="top"===d?y:Z-y;v.push(n([m+e*W,o],{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 o=Object.values(U),n=[],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:o,range:n}=r||{},i=G(o,n,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([o,n]){return Math.abs(n-e*o-t)<=1}function p([e,t]){const[o,n]=[...h([e,t])];return o>=I&&o<=B&&n>=i&&n<=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]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===o));if(r){const r=G(o,i,0);n.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:o,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-G(o,a,l.value)],[p,h]=[S(c.time)-I,O-G(o,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,u=s(o,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*o);u.length>0&&n.push(t(u,{...e}))}}})),x.value.add(...n)}(),te(),function(){function e(e,t){const o=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:o=0,y:n=0}=t.pointer||{};o>=I&&o<=B&&n>=H&&n<=O&&(P.point={x:o,y:n},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(!Y([...ee],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let n=H;const i=[];e.forEach((e=>{const o=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(o,e,{text:{originY:"top",left:t,top:n},icon:{left:t,topY:n,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;n+=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(Y([...ee],u.left,"key").includes(u.origin.key))E("repeat");else{const e={data:{time:M(u.left),value:T(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)})),o(i),x.value.add(...i)}function o(e){const t=e.at(-1),o=(O-H)/2,n=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(j("remove",o),oe(o,"remove")):(Object.assign(o,{data:{time:M(e.pointer.x),value:T(e.origin.key,e.pointer.y)}}),j("add",o),oe(o))},redrawPoints:ne}}export{x as useBirthProcess};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as o,drawText as n,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"@vueuse/core";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";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:G,getXValue:M,getYValue:T}=c(b),{getEqualXTypes:Y,handleAddPrevent:E,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 o=le(P,e);h=o?t([...s,...o],{...v}):null}let G,Y;if(d.childbirth){const e=s[1]+$;G=o([s[0],s[1],e],w),c.push(G),Y=n([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(Y)}const E=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:E,rightLine:h,arrowGroup:G,arrowGroupText:Y,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};E?p=r(k,{left:E.get("x2"),top:E.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,o,n,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(o=e.rightLine)||o.setCoords().set({x1:e.left,y1:e.top}),null==(n=e.arrowGroup)||n.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,o={...e.origin,data:{...e.origin.data,time:M(e.left),value:T(t,e.top)}};x.value.discardActiveObject(),j("change",o),oe(o,"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 o=null;e=e.filter((e=>(e&&o&&(o.nextPoint=e,e.prevPoint=o),o=e||o,e))),Promise.all(c).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function oe(e,t="add"){const{dataIndex:o,data:n,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]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ne()}function ne(){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,o=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>o&&e.set("left",o)}function re(e,t="moving"){const{title:o,key:n,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${o} ${"hover"===t?i.value:T(n,e.top)}`,`时间 ${M(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,o=m(e);return o>=V&&o<=t}(e.time)){const o=S(e.time),n=G(t.key,t.range,e.value);return[o,n<H?H:n>O?O:n]}}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,o="left"){let r="left"===o?D:B;t.forEach(((t,o)=>{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),G=S.length;S.forEach(((e,o)=>{const{lineXMain:n,lineXSub:i,textLeft:l}=d(m,r,c),s=O-o*$*k,a=0===o?O-8:o!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===o||o===G-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,o,n,i,s,$,H,G))}));const M=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),T=n([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...j,M,...T?[T]:[]],{objectCaching:!1,...s});x.value.add(Y),Y.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:o,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?+o.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(n([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 o="top"===d?y:Z-y;v.push(n([m+e*W,o],{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 o=Object.values(U),n=[],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:o,range:n}=r||{},i=G(o,n,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([o,n]){return Math.abs(n-e*o-t)<=1}function p([e,t]){const[o,n]=[...h([e,t])];return o>=I&&o<=B&&n>=i&&n<=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]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===o));if(r){const r=G(o,i,0);n.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:o,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-G(o,a,l.value)],[p,h]=[S(c.time)-I,O-G(o,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(n.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:o,b:r}=i,a=144e5,u=s(o,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*o);u.length>0&&n.push(t(u,{...e}))}}})),x.value.add(...n)}(),te(),function(){function e(e,t){const o=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:o,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:o=0,y:n=0}=t.pointer||{};o>=I&&o<=B&&n>=H&&n<=O&&(P.point={x:o,y:n},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(!Y([...ee],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let n=H;const i=[];e.forEach((e=>{const o=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(o,e,{text:{originY:"top",left:t,top:n},icon:{left:t,topY:n,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;n+=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(Y([...ee],u.left,"key").includes(u.origin.key))E("repeat");else{const e={data:{time:M(u.left),value:T(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)})),o(i),x.value.add(...i)}function o(e){const t=e.at(-1),o=(O-H)/2,n=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(j("remove",o),oe(o,"remove")):(Object.assign(o,{data:{time:M(e.pointer.x),value:T(e.origin.key,e.pointer.y)}}),j("add",o),oe(o))},redrawPoints:ne}}export{x as useBirthProcess};
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{useEvent as s,useCanvasEvent as d}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import"../../../../../shared/utils/index.js";import{useBirthProcess as n}from"./useBirthProcess.js";function o(o,v,c,h,m,f){const p=e(),x=e(),g=e(),w=a((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=a((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=a((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),j=a((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),b=a((()=>{var e;const{width:a}=v.data,t=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-t})),A=a((()=>v.data.grid.mainXCell)),C=a((()=>{const e=v.data.grid.mainYCell||14;return v.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),k=a((()=>(b.value-j.value)/A.value)),Y=a((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(C.value+t)})),S=a((()=>{const{xAxis:e}=v.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return Y.value*a})),H=a((()=>{var e;const{scaleValues:a}=v.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!S.value)return S.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],r=(null==t?void 0:t.spaceValue)||1;return P.value-l*r*Y.value})),P=a((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-Y.value*t})),X=a((()=>i(v.data.xAxis.time.startTime))),F=a((()=>36e5/k.value)),R=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return Y.value/((null==a?void 0:a.spaceValue)||1)})),W=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return Y.value/((null==a?void 0:a.spaceValue)||10)})),O=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return Y.value/((null==a?void 0:a.spaceValue)||1)})),M=a((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),N=t({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...u,...v.data.borderStyle||{}},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:j.value,endX:b.value,originY:S.value,endY:P.value,xCellWidth:k.value,yCellHeight:Y.value,gridXNumber:A.value,gridYNumber:C.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:X.value,timeXCell:F.value,cervixYCell:R.value,FHRYCell:W.value,fetalPresentationYCell:O.value,scaleValues:v.data.scaleValues,event:M.value,originYCervix:H.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=n(o,N,c,m,f);x.value=a,g.value=e,s(h.value);const{select:t}=d(o,N,c);p.value=t}))})),{propItems:N,redrawPoints:x,select:p,clickMenu:g}}export{o as useBirthProcessChart};
1
+ import{ref as e,computed as a,reactive as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{useEvent as s,useCanvasEvent as d}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import{useBirthProcess as n}from"./useBirthProcess.js";function o(o,v,c,h,m,f){const g=e(),p=e(),x=e(),w=a((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=a((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=a((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),b=a((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),j=a((()=>{var e;const{width:a}=v.data,t=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-t})),A=a((()=>v.data.grid.mainXCell)),C=a((()=>{const e=v.data.grid.mainYCell||14;return v.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),k=a((()=>(j.value-b.value)/A.value)),Y=a((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(C.value+t)})),S=a((()=>{const{xAxis:e}=v.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return Y.value*a})),H=a((()=>{var e;const{scaleValues:a}=v.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!S.value)return S.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],r=(null==t?void 0:t.spaceValue)||1;return P.value-l*r*Y.value})),P=a((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-Y.value*t})),X=a((()=>i(v.data.xAxis.time.startTime))),F=a((()=>36e5/k.value)),R=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return Y.value/((null==a?void 0:a.spaceValue)||1)})),W=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return Y.value/((null==a?void 0:a.spaceValue)||10)})),O=a((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return Y.value/((null==a?void 0:a.spaceValue)||1)})),M=a((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),N=t({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...u,...v.data.borderStyle||{}},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:b.value,endX:j.value,originY:S.value,endY:P.value,xCellWidth:k.value,yCellHeight:Y.value,gridXNumber:A.value,gridYNumber:C.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:X.value,timeXCell:F.value,cervixYCell:R.value,FHRYCell:W.value,fetalPresentationYCell:O.value,scaleValues:v.data.scaleValues,event:M.value,originYCervix:H.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=n(o,N,c,m,f);p.value=a,x.value=e,s(h.value);const{select:t}=d(o,N,c);g.value=t}))})),{propItems:N,redrawPoints:p,select:g,clickMenu:x}}export{o as useBirthProcessChart};
@@ -2,4 +2,10 @@ import { type Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { AnyObject } from '../../../../../../es/shared/types';
4
4
  import { IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
5
- export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): void;
5
+ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): {
6
+ redrawPoints: (ItemObj?: AnyObject) => void;
7
+ clickMenu: ({ item, target }: {
8
+ item: any;
9
+ target: any;
10
+ }) => void;
11
+ };
@@ -1 +1 @@
1
- import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"@vueuse/core";import"../../../../../shared/utils/fabricjs/index.js";import"vue";import{getIndex as o,isEffectiveNode as l,getTime as r}from"../../utils/index.js";import{cloneDeep as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{uuidGenerator as a}from"../../../../../shared/utils/index.js";function f(f,u,c,p,d){const{cumputedX:v,cumputedY:m,getXValue:g,getYValue:h}=i(u),{xCellWidth:y,yCellHeight:L,originX:x,endX:k,originY:A,endY:P,event:b,scaleValues:j,xAxis:w,startTime:C,timeXCell:X}=u,M=new Map,Y=new Set,V=s(j);let $=[];function E(){V.forEach((e=>{e.dataList.forEach(((t,n)=>{I(t,n,e)}))}))}function I(n,i,o){var l;const{type:r,unit:s,dataList:d=[]}=o,v=[],m=a();M.set(m,[]),null==(l=n.list)||l.forEach(((l,a)=>{!function(n,l,a,d){var L;let j,w;const{pointAttr:C={},lineAttr:V={},title:E="",key:I,type:T="circle"}=d,J=D(d.list[a+1],o);n&&J&&!l.breakpoint&&n[0]!==J[0]&&(w=e([...n,...J],V));const N=v[a-1],G={origin:{data:l,title:E,key:I||"",unit:s,type:r,dataIndex:i,index:a,lineAttr:V},uuid:m,leftLine:N,rightLine:w,...C,...u.event.hovered?u.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:u.event};N?j=t(T,{left:N.get("x2"),top:N.get("y2"),...G}):n&&(G.leftLine=null,j=t(T,{left:n[0],top:n[1],...G}));v.push(w),j&&(j.originLeft=j.left,j.originTop=j.top,function(e){b.hovered&&(e.on("mouseover",(()=>{z(e,"hover")})),e.on("mouseout",(()=>{p.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t=6e4/X,n=e.prevPoint?e.prevPoint.left+t:x,i=e.nextPoint?e.nextPoint.left-t:k;e.top<A&&e.set("top",A),e.top>P&&e.set("top",P),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}(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),b.hovered&&z(e),function(e){const{originLeft:t,originTop:n,left:i,top:o,origin:l}=e,r=~~((i-t)/y);if(i>t+y&&!e.nextPoint){if(0===$.length){O(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const i=t+y*r;if($.every((e=>e.left!==i))){const t=g(i),n=h(l.type,o);$.push({data:{time:t,value:n},left:i,top:o}),O(e,[...e.prevPointer,i,o])}$.length<r&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+y*l,r=$.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=$.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=$[l-1]||{left:n,top:i},f=~~((r.left-(t-y))/y),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:g(t),value:h(o.type,s.top)},$.splice(l,0,s),O(e,[a.left,a.top,s.left,s.top])}}l++}}(e,r)}if($.length>0&&i<$[$.length-1].left){for(const e of Y)e.left>i&&(e.leftLine&&f.value.remove(e.leftLine),f.value.remove(e));if($=$.filter((e=>e.left<=i)),0===$.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of Y)e.leftLine&&f.value.remove(e.leftLine),f.value.remove(e)}if($.length>0){const t=$.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(p.show=!1,1===t.button){const{key:t,type:n}=e.origin,i={...e.origin,data:{...e.origin.data,time:g(e.left),value:h(n,e.top)}};f.value.discardActiveObject();const o=Object.assign({},i,{uuid:e.uuid});if($.length>0){const e=$.map((e=>e.data));c("add",{...i,data:e}),S({...o,data:e},"add")}else c("change",i),S(o,"change")}}))}(j),null==(L=M.get(m))||L.push(j))}(D(l,o),l,a,n)})),Promise.all(M.get(m)).then((e=>{const t=v.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),f.value.add(...t,...e)}))}function O(t,n){const[i,o,l,r]=n;t.clone((i=>{i.set({left:l,top:r}),t.prevPointer=[l,r];const o=e(n,t.origin.lineAttr);i.leftLine=o,Y.add(i),f.value.add(o,i)}))}function S(e,t="add"){const{dataIndex:n,data:i,index:l,key:r,type:s,uuid:a}=e,u=V.find((e=>e.type===s)),c=u.dataList.find((e=>e.key===r));switch(t){case"remove":c.list.splice(l,1);break;case"change":c.list[l]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=o(e,c.list),n=Array.isArray(i)?i:[i];c.list.splice(t,0,...n);break}}!function(e){var t,n,i;if(Y.size&&(null==(t=f.value)||t.remove(...T([...Y]))),Y.clear(),$=[],e){const{uuid:t,item:i,dataIndex:o,scaleValue:l}=e;null==(n=f.value)||n.remove(...T(M.get(t))),M.delete(t),I(i,o,l)}else{const e=Array.from(M.values()).flat();M.size&&(null==(i=f.value)||i.remove(...T(e))),M.clear(),E()}}({item:c,dataIndex:n,scaleValue:u,uuid:a})}function T(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:i,data:o,unit:l}=e.origin;p.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:h(i,e.top)}`;p.list=[`${n} ${r}${l||""}`,`时间 ${g(e.left).slice(-5)}`],p.show=!0}function D(e,t){if(l(e)&&function(e){const t=Date.parse(w.list.at(-1)),n=r(e);return n>=C&&n<=t}(e.time)){const n=v(e.time),i=m(t.type,t.range,e.value);return[n,i<A?A:i>P?P:i]}}n(f,u),E()}export{f as useCenter};
1
+ import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"@vueuse/core";import"../../../../../shared/utils/fabricjs/index.js";import{useCommon as o}from"../useCommon.js";import"vue";import{getIndex as l,isEffectiveNode as r,getTime as a}from"../../utils/index.js";import{cloneDeep as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function f(f,u,p,c,d){const{cumputedX:v,cumputedY:m,getXValue:g,getYValue:h}=i(u),{xCellWidth:y,yCellHeight:L,originX:x,endX:k,originY:P,endY:b,event:A,scaleValues:w,xAxis:j,startTime:C,timeXCell:I,itemList:X}=u,E=new Map,M=new Set,T=s(w);let Y=[];n(f,u);const{getEqualXTypes:V,handleAddPrevent:$}=o(f,p,u);function O(){T.forEach((e=>{e.dataList.forEach(((t,n)=>{S(t,n,e)}))})),function(){if(!A.evented)return;f.value.on("mouse:up",(e=>{if(3===e.button){const{x:t=0,y:n=0}=e.pointer||{};t>=x&&t<=k&&n>=P&&n<=b&&(d.point={x:t,y:n},d.show=!0,e.target?(d.target=e.target,d.list=["删除节点"],H().forEach((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&d.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(d.target=null,d.list=["新增节点"],X.forEach((n=>{V(H(),t,"key").includes(n.key)||d.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===d.list.length&&(d.show=!1,$("repeat"),console.log("当前时间段内无可新增节点"))))}}))}()}function S(n,i,o){var l;const{type:r,unit:a,dataList:s=[]}=o,d=[];E.set(n.key,[]),null==(l=n.list)||l.forEach(((l,s)=>{!function(n,l,s,v){var m;let L,w;const{pointAttr:j={},lineAttr:C={},title:X="",key:T,type:V="circle"}=v,$=G(v.list[s+1],o);n&&$&&!l.breakpoint&&n[0]!==$[0]&&(w=e([...n,...$],C));const O=d[s-1],S={origin:{data:l,title:X,key:T||"",unit:a,type:r,dataIndex:i,index:s,lineAttr:C},leftLine:O,rightLine:w,...j,...u.event.hovered?u.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:u.event};O?L=t(V,{left:O.get("x2"),top:O.get("y2"),...S}):n&&(S.leftLine=null,L=t(V,{left:n[0],top:n[1],...S}));d.push(w),L&&(L.originLeft=L.left,L.originTop=L.top,function(e){A.hovered&&(e.on("mouseover",(()=>{q(e,"hover")})),e.on("mouseout",(()=>{c.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t=6e4/I,n=e.prevPoint?e.prevPoint.left+t:x,i=e.nextPoint?e.nextPoint.left-t:k;e.top<P&&e.set("top",P),e.top>b&&e.set("top",b),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}(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),A.hovered&&q(e),function(e){const{originLeft:t,originTop:n,left:i,top:o,origin:l}=e,r=~~((i-t)/y);if(i>t+y&&!e.nextPoint){if(0===Y.length){z(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const i=t+y*r;if(Y.every((e=>e.left!==i))){const t=g(i),n=h(l.type,o);Y.push({data:{time:t,value:n},left:i,top:o}),z(e,[...e.prevPointer,i,o])}Y.length<r&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+y*l,r=Y.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=Y.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=Y[l-1]||{left:n,top:i},f=~~((r.left-(t-y))/y),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:g(t),value:h(o.type,a.top)},Y.splice(l,0,a),z(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(Y.length>0&&i<Y[Y.length-1].left){for(const e of M)e.left>i&&(e.leftLine&&f.value.remove(e.leftLine),f.value.remove(e));if(Y=Y.filter((e=>e.left<=i)),0===Y.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of M)e.leftLine&&f.value.remove(e.leftLine),f.value.remove(e)}if(Y.length>0){const t=Y.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(c.show=!1,1===t.button){const{key:t,type:n}=e.origin,i={...e.origin,data:{...e.origin.data,time:g(e.left),value:h(n,e.top)}};if(f.value.discardActiveObject(),Y.length>0){const e=Y.map((e=>e.data));p("add",{...i,data:e}),D({...i,data:e})}else p("change",i),D(i,"change")}}))}(L),null==(m=E.get(T))||m.push(L))}(G(l,o),l,s,n)})),Promise.all(E.get(n.key)).then((e=>{const t=d.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),f.value.add(...t,...e)}))}function z(t,n){const[i,o,l,r]=n;t.clone((i=>{i.set({left:l,top:r}),t.prevPointer=[l,r];const o=e(n,t.origin.lineAttr);i.leftLine=o,M.add(i),f.value.add(o,i)}))}function D(e,t="add"){const{dataIndex:n,data:i,index:o,key:r,type:a}=e,s=T.find((e=>e.type===a)),f=s.dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(o,1);break;case"change":f.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=l(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}J({dataIndex:n,scaleValue:s})}function J(e){var t,n,i;if(M.size&&(null==(t=f.value)||t.remove(...N([...M]))),M.clear(),Y=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=f.value)||n.remove(...N(E.get(o.key))),E.delete(o.key),S(o,t,i)}else E.size&&(null==(i=f.value)||i.remove(...N(H()))),E.clear(),O()}function N(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:i,data:o,unit:l}=e.origin;c.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:h(i,e.top)}`;c.list=[`${n} ${r}${l||""}`,`时间 ${g(e.left).slice(-5)}`],c.show=!0}function G(e,t){if(r(e)&&function(e){const t=Date.parse(j.list.at(-1)),n=a(e);return n>=C&&n<=t}(e.time)){const n=v(e.time),i=m(t.type,t.range,e.value);return[n,i<P?P:i>b?b:i]}}function H(){return Array.from(E.values()).flat()}return O(),{redrawPoints:J,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(p("remove",n),D(n,"remove")):(Object.assign(n,{data:{time:g(e.pointer.x),value:h(e.origin.type,e.pointer.y)}}),p("add",n),D(n))}}}export{f 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 l,defaultTextStyle as n,defaultStyle as r}from"../useDraw.js";import"date-fns";import{getScaleNumberList as s}from"../../utils/index.js";import"@vueuse/core";import{drawScaleNumber as a}from"../useScaleColumn.js";import"vue";import"lodash-es";import"../temperature/useShadow.js";import"../../../../../shared/utils/index.js";function d(d,u,h){const{originY:c,endY:p,borderStyle:f,left:m,itemList:g,scaleValues:v,originX:w,endX:j,yCellHeight:y,markHeight:S,canvasWidth:x,canvasHeight:W}=u;!function(){if(!m)return;const{title:t,titleWidth:i,titleStyle:o}=m,l=e({width:i,height:p-c+S,...f},{value:t.split("").join("\n"),...o||{}},{left:0,top:c},!0);d.value.add(l)}(),v.forEach(((e,i)=>{var o,u;const h="left"===e.layout?w-5:j+5,{range:c,spaceValue:f,title:g,unit:v,titleStyle:S,spaceGridNumber:W=1,showNumber:b,showMaxMinNumber:N}=e,k=[],X=s(c,f),Y=X.length;X.forEach(((t,i)=>{const o=0===i?p-5:p-i*y*W;!b||(0===i||i===Y-1)&&!N||k.push(a(String(t),{...e,position:e.layout},h,o))}));const C=g&&l(["left"===e.layout?m.width/2:j+(x-j)/2,(null!=(u=null==(o=k.at(-1))?void 0:o.top)?u:330)-y],{value:`${g}${v?"\n"+v:""}`,...n,...S}),E=new t.Group([...k,...C?[C]:[]],{objectCaching:!1,...r});d.value.add(E),E.sendToBack()})),function(){const e=new t.Rect({width:w-m.titleWidth,height:p-c+S,left:m.titleWidth,top:c,...i,originX:"left",originY:"top",...f});d.value.add(e);const l=JSON.parse(JSON.stringify(g));let n=p;const r=m.titleWidth+15;l.reverse().forEach((t=>{n-=10;const e=t.title,{text:i,icon:l}=o(e,t,{text:{left:r,top:n},icon:{leftX:r,topY:n}});n-=i.height||30,d.value.add(i,l)}))}(),d.value.add(new t.Rect({left:0,top:0,width:x-f.strokeWidth,height:W-f.strokeWidth,fill:"transparent",...f}))}export{d 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 l,defaultTextStyle as n,defaultStyle as r}from"../useDraw.js";import"date-fns";import{getScaleNumberList as a}from"../../utils/index.js";import"@vueuse/core";import{drawScaleNumber as s}from"../useScaleColumn.js";import"vue";import"lodash-es";import"../temperature/useShadow.js";function u(u,d,h){const{originY:c,endY:p,borderStyle:f,left:m,itemList:g,scaleValues:v,originX:w,endX:j,yCellHeight:y,markHeight:S,canvasWidth:W,canvasHeight:b}=d;!function(){if(!m)return;const{title:t,titleWidth:i,titleStyle:o}=m,l=e({width:i,height:p-c+S,...f},{value:t.split("").join("\n"),...o||{}},{left:0,top:c},!0);u.value.add(l)}(),v.forEach(((e,i)=>{var o,d;const h="left"===e.layout?w-5:j+5,{range:c,spaceValue:f,title:g,unit:v,titleStyle:S,spaceGridNumber:b=1,showNumber:x,showMaxMinNumber:N}=e,k=[],X=a(c,f),Y=X.length;X.forEach(((t,i)=>{const o=0===i?p-5:p-i*y*b;!x||(0===i||i===Y-1)&&!N||k.push(s(String(t),{...e,position:e.layout},h,o))}));const C=g&&l(["left"===e.layout?m.width/2:j+(W-j)/2,(null!=(d=null==(o=k.at(-1))?void 0:o.top)?d:330)-y],{value:`${g}${v?"\n"+v:""}`,...n,...S}),E=new t.Group([...k,...C?[C]:[]],{objectCaching:!1,...r});u.value.add(E),E.sendToBack()})),function(){const e=new t.Rect({width:w-m.titleWidth,height:p-c+S,left:m.titleWidth,top:c,...i,originX:"left",originY:"top",...f});u.value.add(e);const l=JSON.parse(JSON.stringify(g));let n=p;const r=m.titleWidth+15;l.reverse().forEach((t=>{n-=10;const e=t.title,{text:i,icon:l}=o(e,t,{text:{left:r,top:n},icon:{leftX:r,topY:n}});n-=i.height||30,u.value.add(i,l)}))}(),u.value.add(new t.Rect({left:0,top:0,width:W-f.strokeWidth,height:b-f.strokeWidth,fill:"transparent",...f}))}export{u as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as o,drawText as e}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../../../../shared/utils/index.js";function n(n,r,l,s){const{cumputedX:a,getXValue:u}=i(r),{other:c,yCellHeight:f,endX:d,originX:m,originY:h,endY:v,markHeight:p,event:g}=r;function x(t){const{name:o}=t.origin;s.point={x:t.left,y:t.top},s.list=[`${o}`,`时间 ${u(t.left).slice(-5)}`],s.show=!0}function X(t){return t>=m&&t<=d}!function(){if(!(null==c?void 0:c.horizontal))return;const{horizontal:i}=c,r=m-5;let l=h+f/2;i.forEach((i=>{const{title:s,titleStyle:u={},type:c,pointAttr:d={},textStyle:m={},data:h}=i,v=s&&o(s,{...u,originX:"right",left:r,top:l});n.value.add(v),h.forEach((i=>{const{time:r,value:s}=i,u=a(r);if(!X(u))return;const f=o(c,{...d,left:u,top:l}),h=u+f.width/2+2,v=e([h,l],{value:s,...m,originX:"left"}),p=new t.Group([f,v],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});n.value.add(p)})),l+=f}))}(),function(){if(!(null==c?void 0:c.vertical))return;const{vertical:t}=c;t.forEach((t=>{const{textStyle:e={},data:i,time:r}=t,l=a(r);if(!X(l))return;let s=h+f/2;i.forEach((t=>{const i=o(String(t),{...e,lockMovementX:!0,lockMovementY:!0,left:l,originX:"left",top:s});s+=f,n.value.add(i)}))}))}(),function(){if(!(null==c?void 0:c.mark)||!p)return;const{title:t,titleStyle:i,pointAttr:r,dataList:f}=c.mark,S=e([m-5,v+p/2],{value:t,...i,originX:"right"});n.value.add(S);const k=v+p,P=[];f.forEach((t=>{const{time:e,list:i=[]}=t,c=a(e);if(!X(c))return;let f=v;i.forEach((t=>{let e=!1;const i=o("circleAndText",{...r,text:t.text,left:c,top:f,origin:t}),a=i.height;f+a<=k&&f>=v?(i.set("top",f+a/2),f+=a):(e||(f=v,e=!0),i.set("top",f-a/2),f-=a),P.push(i),function(t){g.hovered&&(t.on("mouseover",(()=>{x(t)})),t.on("mouseout",(()=>{s.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;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.top<h&&t.set("top",h);const o=v+p-t.height/2;t.top>o&&t.set("top",o)}(t),g.hovered&&x(t)})),t.on("mouseup",(o=>{if(s.show=!1,1===o.button){!function(t){var o;if((null==(o=t.origin)?void 0:o.isStart)&&t.otherPoints)t.otherPoints.forEach((o=>{o.limitX.x1=t.left}));else{const o=t.startPoint.otherPoints.map((t=>t.left));console.log(o);const e=Math.min(...o);console.log(e,t.startPoint),t.startPoint.limitX.x2=e}}(t);const o={type:"mark",time:u(t.left),data:t.origin};n.value.discardActiveObject(),l("change",o)}}))}(i),n.value.add(i)}))})),function(t){const o=t.find((t=>{var o;return null==(o=t.origin)?void 0:o.isStart})),e=t.find((t=>{var e;return!(null==(e=t.origin)?void 0:e.isStart)&&t.left>o.left})),i=t.filter((t=>{var o;return!(null==(o=t.origin)?void 0:o.isStart)}));t.forEach((t=>{var n;const r={x1:m,x2:d};(null==(n=t.origin)?void 0:n.isStart)?(r.x2=e.left,t.otherPoints=i):(r.x1=o.left,t.startPoint=o),t.limitX=r}))}(P)}()}export{n as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as o,drawText as e}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";function n(n,r,l,s){const{cumputedX:a,getXValue:u}=i(r),{other:c,yCellHeight:f,endX:m,originX:d,originY:h,endY:v,markHeight:p,event:g}=r;function x(t){const{name:o}=t.origin;s.point={x:t.left,y:t.top},s.list=[`${o}`,`时间 ${u(t.left).slice(-5)}`],s.show=!0}function X(t){return t>=d&&t<=m}!function(){if(!(null==c?void 0:c.horizontal))return;const{horizontal:i}=c,r=d-5;let l=h+f/2;i.forEach((i=>{const{title:s,titleStyle:u={},type:c,pointAttr:m={},textStyle:d={},data:h}=i,v=s&&o(s,{...u,originX:"right",left:r,top:l});n.value.add(v),h.forEach((i=>{const{time:r,value:s}=i,u=a(r);if(!X(u))return;const f=o(c,{...m,left:u,top:l}),h=u+f.width/2+2,v=e([h,l],{value:s,...d,originX:"left"}),p=new t.Group([f,v],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});n.value.add(p)})),l+=f}))}(),function(){if(!(null==c?void 0:c.vertical))return;const{vertical:t}=c;t.forEach((t=>{const{textStyle:e={},data:i,time:r}=t,l=a(r);if(!X(l))return;let s=h+f/2;i.forEach((t=>{const i=o(String(t),{...e,lockMovementX:!0,lockMovementY:!0,left:l,originX:"left",top:s});s+=f,n.value.add(i)}))}))}(),function(){if(!(null==c?void 0:c.mark)||!p)return;const{title:t,titleStyle:i,pointAttr:r,dataList:f}=c.mark,S=e([d-5,v+p/2],{value:t,...i,originX:"right"});n.value.add(S);const k=v+p,P=[];f.forEach((t=>{const{time:e,list:i=[]}=t,c=a(e);if(!X(c))return;let f=v;i.forEach((t=>{let e=!1;const i=o("circleAndText",{...r,text:t.text,left:c,top:f,origin:t}),a=i.height;f+a<=k&&f>=v?(i.set("top",f+a/2),f+=a):(e||(f=v,e=!0),i.set("top",f-a/2),f-=a),P.push(i),function(t){g.hovered&&(t.on("mouseover",(()=>{x(t)})),t.on("mouseout",(()=>{s.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;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.top<h&&t.set("top",h);const o=v+p-t.height/2;t.top>o&&t.set("top",o)}(t),g.hovered&&x(t)})),t.on("mouseup",(o=>{if(s.show=!1,1===o.button){!function(t){var o;if((null==(o=t.origin)?void 0:o.isStart)&&t.otherPoints)t.otherPoints.forEach((o=>{o.limitX.x1=t.left}));else{const o=t.startPoint.otherPoints.map((t=>t.left));console.log(o);const e=Math.min(...o);console.log(e,t.startPoint),t.startPoint.limitX.x2=e}}(t);const o={type:"mark",time:u(t.left),data:t.origin};n.value.discardActiveObject(),l("change",o)}}))}(i),n.value.add(i)}))})),function(t){const o=t.find((t=>{var o;return null==(o=t.origin)?void 0:o.isStart})),e=t.find((t=>{var e;return!(null==(e=t.origin)?void 0:e.isStart)&&t.left>o.left})),i=t.filter((t=>{var o;return!(null==(o=t.origin)?void 0:o.isStart)}));t.forEach((t=>{var n;const r={x1:d,x2:m};(null==(n=t.origin)?void 0:n.isStart)?(r.x2=e.left,t.otherPoints=i):(r.x1=o.left,t.startPoint=o),t.limitX=r}))}(P)}()}export{n as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as n}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as o,range as d}from"lodash-es";import"../temperature/useShadow.js";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useCenter as m}from"./useCenter.js";import{useOther as h}from"./useOther.js";function v(v,f,g,x,y,w){const b=e(),Y=e(),j=e(),C=t((()=>f.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),H=t((()=>{var e;return null!=(e=f.data.left.width)?e:0})),A=t((()=>{const{grid:e}=f.data;return e.mainXCell*e.subXCell})),D=t((()=>{const{grid:e}=f.data;return e.mainYCell*e.subYCell})),T=t((()=>s(f.data.top.treeData))),X=t((()=>f.data.top.tree.cellHeight)),V=t((()=>X.value*T.value)),G=t((()=>Z(R("drug")||"top"))),M=t((()=>G.value+V.value)),S=t((()=>{var e;return Date.parse((null==(e=f.data.xAxis)?void 0:e.startTime)||n(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=o(f.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=d(A.value/t+1).map((r=>0===r?e.startTime:n(new Date(S.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:H.value}})),O=function(){const e=o(f.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=f.data.top.tree;return function e(i,l=0){i.forEach((i=>{var u;const n={top:t*r+G.value,left:l*a,width:a,height:r};if(t++,null==(u=i.children)?void 0:u.length){t--;const a=s(i.children);n.height=a*r,e(i.children,l+1)}else n.width=H.value-n.left;Object.assign(i,n)}))}(e),e}(),k=t((()=>Z(R("xAxis")||"center"))),L=t((()=>{var e;const{width:t,right:a}=f.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>Z(R("intraoperatively")||"bottom"))),E=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=f.data.other)?void 0:e.mark)||{};return t&&a?a:0})),I=t((()=>W.value+(f.data.height-V.value-N.value.height-E.value))),P=t((()=>(L.value-H.value)/A.value)),q=t((()=>(I.value-W.value)/D.value)),z=t((()=>N.value.spaceTimeStamp/P.value)),B=t((()=>{const{scaleValues:e}=f.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),F=t((()=>$("pulse"))),J=t((()=>$("temperature"))),K=t((()=>{var e;return(null==(e=f.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=a({canvasWidth:f.data.width,canvasHeight:f.data.height,borderStyle:{...u,...f.data.borderStyle||{}},grid:f.data.grid,top:f.data.top,left:f.data.left,other:f.data.other,topGridYNumber:r(T),topGridYCellHeight:r(X),topGridOriginY:r(G),topGridEndY:r(M),treeData:O,xAxis:r(N),originYXAxis:r(k),startTime:r(S),timeXCell:r(z),gridXNumber:r(A),gridYNumber:r(D),xCellWidth:r(P),yCellHeight:r(q),originX:r(H),endX:r(L),originY:r(W),endY:r(I),markHeight:r(E),itemList:r(B),scaleValues:f.data.scaleValues,pulseYCell:r(F),temperatureYCell:r(J),event:r(K)});function R(e){let t="";return Object.entries(C.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function U(e){const t=C.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return f.data.height-V.value-a}}function Z(e){switch(e){case"top":return 0;case"center":return U("top");default:return U("top")+U("center")}}function $(e){const{scaleValues:t}=f.data,a=t.find((t=>t.type===e));return q.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),c(v,Q,g,y),p(v,Q),h(v,Q,g,y),m(v,Q,g,y)})),{propItems:Q,redrawPoints:Y,select:b,clickMenu:j}}export{v as useSurgicalAnesthesiaChart};
1
+ import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as n}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{useEvent as o}from"../useEvent.js";import{cloneDeep as d,range as c}from"lodash-es";import"../temperature/useShadow.js";import{useTop as m}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useCenter as v}from"./useCenter.js";import{useOther as h}from"./useOther.js";function f(f,g,x,y,w,b){const j=e(),Y=e(),C=e(),H=t((()=>g.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=g.data.left.width)?e:0})),D=t((()=>{const{grid:e}=g.data;return e.mainXCell*e.subXCell})),T=t((()=>{const{grid:e}=g.data;return e.mainYCell*e.subYCell})),X=t((()=>s(g.data.top.treeData))),M=t((()=>g.data.top.tree.cellHeight)),V=t((()=>M.value*X.value)),G=t((()=>$(U("drug")||"top"))),S=t((()=>G.value+V.value)),k=t((()=>{var e;return Date.parse((null==(e=g.data.xAxis)?void 0:e.startTime)||n(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=d(g.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(D.value/t+1).map((r=>0===r?e.startTime:n(new Date(k.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),O=function(){const e=d(g.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=g.data.top.tree;return function e(i,l=0){i.forEach((i=>{var u;const n={top:t*r+G.value,left:l*a,width:a,height:r};if(t++,null==(u=i.children)?void 0:u.length){t--;const a=s(i.children);n.height=a*r,e(i.children,l+1)}else n.width=A.value-n.left;Object.assign(i,n)}))}(e),e}(),E=t((()=>$(U("xAxis")||"center"))),L=t((()=>{var e;const{width:t,right:a}=g.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>$(U("intraoperatively")||"bottom"))),I=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=g.data.other)?void 0:e.mark)||{};return t&&a?a:0})),P=t((()=>W.value+(g.data.height-V.value-N.value.height-I.value))),q=t((()=>(L.value-A.value)/D.value)),z=t((()=>(P.value-W.value)/T.value)),B=t((()=>N.value.spaceTimeStamp/q.value)),F=t((()=>{const{scaleValues:e}=g.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),J=t((()=>_("pulse"))),K=t((()=>_("temperature"))),Q=t((()=>{var e;return(null==(e=g.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),R=a({canvasWidth:g.data.width,canvasHeight:g.data.height,borderStyle:{...u,...g.data.borderStyle||{}},grid:g.data.grid,top:g.data.top,left:g.data.left,other:g.data.other,topGridYNumber:r(X),topGridYCellHeight:r(M),topGridOriginY:r(G),topGridEndY:r(S),treeData:O,xAxis:r(N),originYXAxis:r(E),startTime:r(k),timeXCell:r(B),gridXNumber:r(D),gridYNumber:r(T),xCellWidth:r(q),yCellHeight:r(z),originX:r(A),endX:r(L),originY:r(W),endY:r(P),markHeight:r(I),itemList:r(F),scaleValues:g.data.scaleValues,pulseYCell:r(J),temperatureYCell:r(K),event:r(Q)});function U(e){let t="";return Object.entries(H.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function Z(e){const t=H.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return g.data.height-V.value-a}}function $(e){switch(e){case"top":return 0;case"center":return Z("top");default:return Z("top")+Z("center")}}function _(e){const{scaleValues:t}=g.data,a=t.find((t=>t.type===e));return z.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),m(f,R,x,w),p(f,R),h(f,R,x,w);const{redrawPoints:e,clickMenu:t}=v(f,R,x,w,b);Y.value=e,C.value=t,o(y.value)})),{propItems:R,redrawPoints:Y,select:j,clickMenu:C}}export{f as useSurgicalAnesthesiaChart};
@@ -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 f}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"../../../../../shared/utils/index.js";function a(a,d,u,m,h){const{cumputedX:p,getXValue:x}=f(d),{originX:L,endX:g,xCellWidth:v,originYXAxis:X,top:C,topList:w,canvasWidth:y,borderStyle:Y,treeData:S,xAxis:j,topGridYNumber:b,topGridOriginY:k,topGridYCellHeight:G,topGridEndY:I,event:z}=d,A=new Set;function M(t,e,i){let n;const{content:o}=t.value||{};if(o){const{lineStyle:l,textStyle:s,totalStyle:f}=C.data||{},{startLine:c,centerLine:a,endLine:d}=e;n=r(o,{fontSize:12,...s,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const u=$(n,e,i);n&&(n.set(u),n.origin={data:t},D(n),c&&(c.text=n),d&&(d.text=n))}return n}function $(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 E(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:f,y2:c,halfY:a}=e;if(!s||s<L||s>g)return;const{lineStyle:d}=C.data||{};let u;const m={left:s,top:a};u=i?r("circle",{fill:d.stroke,...m}):n?r(">",{fill:d.stroke,...m,fontSize:18}):l([s,f,s,a],d);const h=new t.Rect({width:v,height:G,fill:"transparent",left:s-v/2,top:f}),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,D(p),p}function D(t){z.hovered&&(t.on("mouseover",(()=>{H(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=$(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),z.hovered&&H(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 H(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=x(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(a,{...d,gridYNumber:b,originY:k,yCellHeight:G,endY:I}),function(){const{height:o,list:l,left:r,spaceValue:s}=j;if(!o)return;const f=[],c=X+o/2;l.forEach(((t,i)=>{const n=r+i*v*s;f.push(e([n,c],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&a.value.add(d);const u=new t.Rect({width:y,height:o,left:0,top:X,...n,originX:"left",originY:"top",...Y});a.value.add(u)}(),function(){var e;const n=(null==(e=null==C?void 0:C.tree)?void 0:e.textStyle)||{},r=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:f,left:a,top:d,title:u=""}=e,m={value:u,...n};(null==(i=e.children)?void 0:i.length)?(m.value=u.split("").join("\n"),t(e.children)):(m.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=C.data||{},o=t.top,r=o+G,s=r-G/2,f={y1:o,y2:r,halfY:s},a=[],d=c(t);delete d.data,t.data.forEach(((t,i,n)=>{const{time:o,continue:r}=t,[c,u]=o,m=c&&p(c),h=u&&p(u),x=E({...f,x:m},{isCustomIcon:!h&&!r,isContinue:!1,isLeft:!0}),v=E({...f,x:h},{isCustomIcon:!1,isContinue:!!r});let X,C,w;if((x||m<L)&&(v||h>g)){X=l([x?m:L,s,v?h:g,s],e)}a.push({startLine:x,centerLine:X,endLine:v}),function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e[t],{startLine:r,endLine:s}=e[t-1]||{};if(n){n.origin=i;const t={x1:L,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:L,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(i,a,Object.assign({},d,{data:t,index:i})),n[i-1]&&(C=M(n[i-1],a[i-1],s)),i===n.length-1&&(w=M(t,a[i],s)),X&&A.add(X),x&&A.add(x),v&&A.add(v),C&&A.add(C),w&&A.add(w)}))}(e)),r.push(o({width:s,height:f,...Y},m,{left:a,top:d},!0))}))}(S);const s=r.length>0?new t.Group([...r],{...i,objectCaching:!1}):null;s&&a.value.add(s),A.size&&a.value.add(...A)}()}export{a 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 f}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function a(a,u,d,m,h){const{cumputedX:p,getXValue:x}=f(u),{originX:L,endX:g,xCellWidth:v,originYXAxis:X,top:C,topList:w,canvasWidth:y,borderStyle:Y,treeData:S,xAxis:j,topGridYNumber:b,topGridOriginY:k,topGridYCellHeight:G,topGridEndY:I,event:z}=u,A=new Set;function M(t,e,i){let n;const{content:o}=t.value||{};if(o){const{lineStyle:l,textStyle:s,totalStyle:f}=C.data||{},{startLine:c,centerLine:a,endLine:u}=e;n=r(o,{fontSize:12,...s,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const d=$(n,e,i);n&&(n.set(d),n.origin={data:t},D(n),c&&(c.text=n),u&&(u.text=n))}return n}function $(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 E(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:f,y2:c,halfY:a}=e;if(!s||s<L||s>g)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:a};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,f,s,a],u);const h=new t.Rect({width:v,height:G,fill:"transparent",left:s-v/2,top:f}),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,D(p),p}function D(t){z.hovered&&(t.on("mouseover",(()=>{H(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=$(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),z.hovered&&H(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 H(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=x(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(a,{...u,gridYNumber:b,originY:k,yCellHeight:G,endY:I}),function(){const{height:o,list:l,left:r,spaceValue:s}=j;if(!o)return;const f=[],c=X+o/2;l.forEach(((t,i)=>{const n=r+i*v*s;f.push(e([n,c],{value:t.slice(11,16)}))}));const u=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;u&&a.value.add(u);const d=new t.Rect({width:y,height:o,left:0,top:X,...n,originX:"left",originY:"top",...Y});a.value.add(d)}(),function(){var e;const n=(null==(e=null==C?void 0:C.tree)?void 0:e.textStyle)||{},r=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:f,left:a,top:u,title:d=""}=e,m={value:d,...n};(null==(i=e.children)?void 0:i.length)?(m.value=d.split("").join("\n"),t(e.children)):(m.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=C.data||{},o=t.top,r=o+G,s=r-G/2,f={y1:o,y2:r,halfY:s},a=[],u=c(t);delete u.data,t.data.forEach(((t,i,n)=>{const{time:o,continue:r}=t,[c,d]=o,m=c&&p(c),h=d&&p(d),x=E({...f,x:m},{isCustomIcon:!h&&!r,isContinue:!1,isLeft:!0}),v=E({...f,x:h},{isCustomIcon:!1,isContinue:!!r});let X,C,w;if((x||m<L)&&(v||h>g)){X=l([x?m:L,s,v?h:g,s],e)}a.push({startLine:x,centerLine:X,endLine:v}),function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e[t],{startLine:r,endLine:s}=e[t-1]||{};if(n){n.origin=i;const t={x1:L,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:L,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(i,a,Object.assign({},u,{data:t,index:i})),n[i-1]&&(C=M(n[i-1],a[i-1],s)),i===n.length-1&&(w=M(t,a[i],s)),X&&A.add(X),x&&A.add(x),v&&A.add(v),C&&A.add(C),w&&A.add(w)}))}(e)),r.push(o({width:s,height:f,...Y},m,{left:a,top:u},!0))}))}(S);const s=r.length>0?new t.Group([...r],{...i,objectCaching:!1}):null;s&&a.value.add(s),A.size&&a.value.add(...A)}()}export{a as useTop};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";import"../../../../../shared/utils/index.js";function o(o,s){const{xScaleList:r,originX:a,endX:l,endY:d,xCellWidth:h,canvasWidth:c,canvasHeight:u,bottom:p,breathingHeight:g,iconsWidth:m,borderStyle:f}=s;!function(){var s,c,u;if(!g||!p){const e=new t.Line([m,d-1,l,d-1],f);return o.value.add(e),e.sendToBack(),!1}const v=g,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let x=!0;r.forEach(((t,n)=>{const o=a+n*h;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const r=x?{top:-(v/2-10)}:{top:v/2-10};s&&(x=!x);const l=e({width:h,height:v,...f},Object.assign({},{text:String(s),...i},s?r:{}),{left:o,top:d});w.push(l)}));const j=e({width:l,height:v,...f},{text:String((null==(c=p.breathing)?void 0:c.title)+(null==(u=p.breathing)?void 0:u.unit)),...i,left:-(l-a)/2},{left:0,top:d});w.push(j);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";function o(o,s){const{xScaleList:r,originX:a,endX:l,endY:c,xCellWidth:h,canvasWidth:d,canvasHeight:u,bottom:p,breathingHeight:g,iconsWidth:f,borderStyle:m}=s;!function(){var s,d,u;if(!g||!p){const e=new t.Line([f,c-1,l,c-1],m);return o.value.add(e),e.sendToBack(),!1}const v=g,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let x=!0;r.forEach(((t,n)=>{const o=a+n*h;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const r=x?{top:-(v/2-10)}:{top:v/2-10};s&&(x=!x);const l=e({width:h,height:v,...m},Object.assign({},{text:String(s),...i},s?r:{}),{left:o,top:c});w.push(l)}));const j=e({width:l,height:v,...m},{text:String((null==(d=p.breathing)?void 0:d.title)+(null==(u=p.breathing)?void 0:u.unit)),...i,left:-(l-a)/2},{left:0,top:c});w.push(j);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as d,isValidValue as c,setOtherType as p,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"../../../../../shared/utils/index.js";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function w(w,k,S,Y,E,$,M,P,O,A){r(w,k);const{getEqualXTypes:I,handleAddPrevent:T}=y(w,S,k),{createShadowLines:C}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:q,vitalSignsOriginY:W,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 i;const o=ne.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(Q.size&&w.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])}}(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],d=n[i-1],c=n[i+1],p=o[r-1],f=o[r+1];if(d&&p){if(d[0]!==p[0]){const e=Math.max(d[0],p[0]);l.push([d,p].find((t=>t[0]===e)))}}else d?l.push(d):p&&s.push(p);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{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(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var i,l,s,r,a,u;const d=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(d,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=C(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),Q.add(e)})),w.value.add(...e)}Q.add(c),w.value.add(c)}))}}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&&d(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((()=>{w.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function se(e,t,r){var u;const{type:d,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=r,{type:Y,textStyle:$}=b,P=[],A=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(d)?j.find((e=>e.key===u.key)):e,C=ue(u,r),R={};R.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=W.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}}(C,u,T),function(e,t,r,a,u){var p,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(d))return;const{lineAttr:m={}}=r,{value:x}=a;let b,j,w,k,S,Y;if(t.noRise&&h.show){const t=L(h)?E(u.type,u.list,35):e[1];if(h.text)w=l([e[0],L(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(w);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",...v}),I.push(Y));if(c(t.physicsReduce)||c(t.drugReduce)){const l=E(d,u.list,null!=(p=t.physicsReduce)?p: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:w,top:5,isFixed:L(h)},arrowGroup:{obj:k,top:2*z,isFixed:L(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(C,u,T,R,r),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(d))return;let o,a;const{upArrowShow:u=!1,limitValueShow:c=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<W.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(c){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}})}(C,u,T,R),function(n,l,s,a,u){let c,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,b=e.list[s+1],j=ue(b,r),L=re(d,e.list[s].value),E=j&&re(d,b.value);!n||!j||l.breakpoint||L||E||n[0]===j[0]||(f=i([...n,...j],{...v}));const I=l.pacemakerShow&&"pulse"==d?y.value:L&&"number"===Y?0:x,T=A[s-1],C={origin:{data:l,title:g,key:m||"",unit:r.unit,type:d,_type:p(g,d),dataIndex:t,index:s},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==d?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...L?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};if(T){const e=T.get("y2");c=o(I,{left:T.get("x2"),top:L?e-5:e,...C})}else n&&(C.leftLine=null,c=o(I,{left:n[0],top:L?n[1]-5:n[1],...C}));A.push(f),c&&(g.includes("脉搏")?ee.add(c):te.add(c),function(e){q.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{O.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:W;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),q.hovered&&ae(e)})),e.on("mouseup",(t=>{if(O.show=!1,1===t.button){const{type:t}=e.origin,i=M(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};w.value.discardActiveObject(),S("change",n),ce(n,"change")}}))}(c),P.push(c),ie.add(c))}(C,u,b,T,R)})),"pulse"===d&&U.forEach((e=>{Z.set(e,P.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(P).then((e=>{const t=A.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=>{w.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&&w.value.remove(e.leftLine),e.rightLine&&w.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;O.point={x:e.left,y:e.top},O.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:M(o,e.top);if(c(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(c(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||$(e.left)).slice(-5)}`],O.show=!0}function ue(e,t){const i="pain"===t.type?B:W;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 de(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(`${$(e)}:00`);return J&&l<h(J)?(T("exceedMin"),!1):!(l>o)||(T("exceedMax"),!1)}function ce(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=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;pe()}function pe(){var e;ie.size&&(null==(e=w.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);w.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le(),k.event.evented&&w.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(!I([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:W;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:P?P(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=de(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&T("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=g(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};S("change",r),ce(r,"change")}else{const t={data:{time:$(e.pointer.x),value:M(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),ce(t)}},setPopup:ae,isAddPoint:de,updateData:ce,redrawPoints:pe,gridPoints:ie}}function L(e){return"fixed"===e.position}export{w 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 d,isValidValue as c,setOtherType as p,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as w}from"../../constants/index.js";function j(j,k,S,Y,E,$,M,P,O,A){r(j,k);const{getEqualXTypes:I,handleAddPrevent:T}=y(j,S,k),{createShadowLines:C}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:q,vitalSignsOriginY:W,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 i;const o=ne.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(Q.size&&j.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])}}(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],d=n[i-1],c=n[i+1],p=o[r-1],f=o[r+1];if(d&&p){if(d[0]!==p[0]){const e=Math.max(d[0],p[0]);l.push([d,p].find((t=>t[0]===e)))}}else d?l.push(d):p&&s.push(p);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{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(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var i,l,s,r,a,u;const d=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(d,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=C(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),Q.add(e)})),j.value.add(...e)}Q.add(c),j.value.add(c)}))}}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({},w,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&d(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((()=>{j.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function se(e,t,r){var u;const{type:d,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:w=[]}=r,{type:Y,textStyle:$}=b,P=[],A=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(d)?w.find((e=>e.key===u.key)):e,C=ue(u,r),R={};R.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=W.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}}(C,u,T),function(e,t,r,a,u){var p,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(d))return;const{lineAttr:m={}}=r,{value:x}=a;let b,w,j,k,S,Y;if(t.noRise&&h.show){const t=L(h)?E(u.type,u.list,35):e[1];if(h.text)j=l([e[0],L(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(j);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",...v}),I.push(Y));if(c(t.physicsReduce)||c(t.drugReduce)){const l=E(d,u.list,null!=(p=t.physicsReduce)?p:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=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),w&&I.push(w)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5,isFixed:L(h)},arrowGroup:{obj:k,top:2*z,isFixed:L(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:w,type:"reduce"}})}(C,u,T,R,r),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(d))return;let o,a;const{upArrowShow:u=!1,limitValueShow:c=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<W.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(c){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}})}(C,u,T,R),function(n,l,s,a,u){let c,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,b=e.list[s+1],w=ue(b,r),L=re(d,e.list[s].value),E=w&&re(d,b.value);!n||!w||l.breakpoint||L||E||n[0]===w[0]||(f=i([...n,...w],{...v}));const I=l.pacemakerShow&&"pulse"==d?y.value:L&&"number"===Y?0:x,T=A[s-1],C={origin:{data:l,title:g,key:m||"",unit:r.unit,type:d,_type:p(g,d),dataIndex:t,index:s},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==d?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...L?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};if(T){const e=T.get("y2");c=o(I,{left:T.get("x2"),top:L?e-5:e,...C})}else n&&(C.leftLine=null,c=o(I,{left:n[0],top:L?n[1]-5:n[1],...C}));A.push(f),c&&(g.includes("脉搏")?ee.add(c):te.add(c),function(e){q.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{O.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:W;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),q.hovered&&ae(e)})),e.on("mouseup",(t=>{if(O.show=!1,1===t.button){const{type:t}=e.origin,i=M(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};j.value.discardActiveObject(),S("change",n),ce(n,"change")}}))}(c),P.push(c),ie.add(c))}(C,u,b,T,R)})),"pulse"===d&&U.forEach((e=>{Z.set(e,P.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(P).then((e=>{const t=A.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=>{j.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&&j.value.remove(e.leftLine),e.rightLine&&j.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;O.point={x:e.left,y:e.top},O.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:M(o,e.top);if(c(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(c(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||$(e.left)).slice(-5)}`],O.show=!0}function ue(e,t){const i="pain"===t.type?B:W;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 de(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(`${$(e)}:00`);return J&&l<h(J)?(T("exceedMin"),!1):!(l>o)||(T("exceedMax"),!1)}function ce(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=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;pe()}function pe(){var e;ie.size&&(null==(e=j.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);j.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le(),k.event.evented&&j.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(!I([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:W;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:P?P(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=de(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&T("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=g(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};S("change",r),ce(r,"change")}else{const t={data:{time:$(e.pointer.x),value:M(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),ce(t)}},setPopup:ae,isAddPoint:de,updateData:ce,redrawPoints:pe,gridPoints:ie}}function L(e){return"fixed"===e.position}export{j as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import"@vueuse/core";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";import"../../../../../shared/utils/index.js";function p(p,g,d,f,m,y,v,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(p,d,g),{originY:V,endY:k,originX:L,endX:M,xCellWidth:W,yCellHeight:E,left:G,vitalSignsOriginY:O,painOriginY:A,painHeight:H,iconsWidth:I,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D}=g;function P(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=I,g=L;"right"===r&&(c=M,g=M+(null!=(s=null==B?void 0:B.width)?s:0));const d=[],f=H&&"right"!==r?o.length-1:o.length,m=(g-c)/f,y=m+(g-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:g,style:d,title:f}=n,m=l({width:L-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),y=e([I,A.originY,L,A.originY],D),v=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,I,L-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*E*s;if(0===a&&(c=k-5),!h||(0===a||a===l-1)&&!g||v.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});v.push(o)}}))}p.value.add(y,m,...v),m.sendToBack()}(o);const g=[],f=0===s?y:m,v=0===s?c:y+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...D}):null;Y&&g.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*E*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=u(l,o,i,t),n=O.originY+e.height/2;t<n&&e.set({top:n}),g.push(e)}g.push(...h(o,s,t,e,r,E,O.originY))}))}let V=o.title||"";o.unit&&(V+="\n"+o.unit),V&&g.push(new t.Text(String(V),{...i,left:b,top:O.originY+E*j/2,textAlign:"center",...o.style}));const M=new t.Group(g,{...n,objectCaching:!1});d.push(M)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&p.value.add(v),v&&v.sendToBack()}I&&function(){const t=JSON.parse(JSON.stringify(R));let e=k;const i=I-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...g.event}});var u;e-=l.height||30,(u=a).on("moving",(()=>{u.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?A:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(u)){const t=C([...x],u.left,"_type").includes(u.origin._type),e=Y(u.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(u.left),value:S(u.origin.type,u.top),...r(u.origin.type)?{key:u.origin.key}:{}},...u.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),p.value.add(l,a)}))}();const z=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(X=null==B?void 0:B.yScaleValue)?void 0:X.show)&&z.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&z.unshift(t),_==G.yScaleValue.length-1&&z.push(t)}const F=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=z[F];return F>-1&&z.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),P(z),p.value.add(new t.Rect({left:I,top:0,width:J-I-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:P}}export{p as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import"@vueuse/core";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";function g(g,p,d,f,m,y,v,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(g,d,p),{originY:V,endY:k,originX:L,endX:M,xCellWidth:W,yCellHeight:E,left:G,vitalSignsOriginY:O,painOriginY:A,painHeight:H,iconsWidth:I,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D}=p;function P(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=I,p=L;"right"===r&&(c=M,p=M+(null!=(s=null==B?void 0:B.width)?s:0));const d=[],f=H&&"right"!==r?o.length-1:o.length,m=(p-c)/f,y=m+(p-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:p,style:d,title:f}=n,m=l({width:L-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),y=e([I,A.originY,L,A.originY],D),v=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,I,L-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*E*s;if(0===a&&(c=k-5),!h||(0===a||a===l-1)&&!p||v.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});v.push(o)}}))}g.value.add(y,m,...v),m.sendToBack()}(o);const p=[],f=0===s?y:m,v=0===s?c:y+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...D}):null;Y&&p.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*E*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=u(l,o,i,t),n=O.originY+e.height/2;t<n&&e.set({top:n}),p.push(e)}p.push(...h(o,s,t,e,r,E,O.originY))}))}let V=o.title||"";o.unit&&(V+="\n"+o.unit),V&&p.push(new t.Text(String(V),{...i,left:b,top:O.originY+E*j/2,textAlign:"center",...o.style}));const M=new t.Group(p,{...n,objectCaching:!1});d.push(M)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&g.value.add(v),v&&v.sendToBack()}I&&function(){const t=JSON.parse(JSON.stringify(R));let e=k;const i=I-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...p.event}});var u;e-=l.height||30,(u=a).on("moving",(()=>{u.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?A:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(u)){const t=C([...x],u.left,"_type").includes(u.origin._type),e=Y(u.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(u.left),value:S(u.origin.type,u.top),...r(u.origin.type)?{key:u.origin.key}:{}},...u.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),g.value.add(l,a)}))}();const z=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(X=null==B?void 0:B.yScaleValue)?void 0:X.show)&&z.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&z.unshift(t),_==G.yScaleValue.length-1&&z.push(t)}const F=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=z[F];return F>-1&&z.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),P(z),g.value.add(new t.Rect({left:I,top:0,width:J-I-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:P}}export{g as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";import"../../../../../shared/utils/index.js";function i(i,n,o){const{other:r,vitalSignsOriginY:l,xCellWidth:s,yCellHeight:a,endX:u}=n;let c=0;function h(i,n,o){const r=[];String(i.value).split("").forEach(((n,o)=>{const l=new t.Text(n,{left:0,top:a*o,originX:"center",...e,objectCaching:!1,...i.style||{}});c=(a-(l.height||0))/2,r.push(l)}));const l={originX:"center",left:n,top:o+c,baseTop:(i.baseTop||0)*a,trueLeft:n,trueHeight:r.length*a,objectCaching:!1};return new t.Group(r,l)}!function(){if(!(null==r?void 0:r.list))return!1;const n=[],c=[];r.list.forEach(((t,e)=>{const i=0===e?"vertical":t.align||"vertical",n=o(t.time,!0);if(n>u)return;const r=c.find((t=>t.left==n));if(r)r[i].push(t);else{const e={left:n,vertical:[],horizontal:[]};e[i].push(t),c.push(e)}})),c.forEach((t=>{let e=l.originY,i=t.left;t.vertical.forEach(((o,r)=>{var u,c;const f=(o.baseTop||0)*a,g=(null==(u=n.at(-1))?void 0:u.left)||0;0===r&&t.left<=g&&(i=g+s);if(n.filter((t=>t.trueLeft===i)).length){const t=String(o.value).length*a,r=(null==(c=n.at(-1))?void 0:c.trueHeight)||0;e+=r,e+t+f>l.endY&&(e=l.originY,i+=s)}e+=f,String(o.value).length&&n.push(h(o,i,e))})),t.horizontal.forEach(((e,o)=>{var r;const u=l.originY+(e.baseTop||0)*a,c=(null==(r=n.at(-1))?void 0:r.left)||0;t.left<=c&&(i=c+s),String(e.value).length&&n.push(h(e,i,u))}))}));const f=n.length>0?new t.Group([...n],{...e,objectCaching:!1}):null;f&&i.value.add(f)}()}export{i as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";function i(i,n,o){const{other:r,vitalSignsOriginY:l,xCellWidth:s,yCellHeight:a,endX:c}=n;let u=0;function h(i,n,o){const r=[];String(i.value).split("").forEach(((n,o)=>{const l=new t.Text(n,{left:0,top:a*o,originX:"center",...e,objectCaching:!1,...i.style||{}});u=(a-(l.height||0))/2,r.push(l)}));const l={originX:"center",left:n,top:o+u,baseTop:(i.baseTop||0)*a,trueLeft:n,trueHeight:r.length*a,objectCaching:!1};return new t.Group(r,l)}!function(){if(!(null==r?void 0:r.list))return!1;const n=[],u=[];r.list.forEach(((t,e)=>{const i=0===e?"vertical":t.align||"vertical",n=o(t.time,!0);if(n>c)return;const r=u.find((t=>t.left==n));if(r)r[i].push(t);else{const e={left:n,vertical:[],horizontal:[]};e[i].push(t),u.push(e)}})),u.forEach((t=>{let e=l.originY,i=t.left;t.vertical.forEach(((o,r)=>{var c,u;const f=(o.baseTop||0)*a,g=(null==(c=n.at(-1))?void 0:c.left)||0;0===r&&t.left<=g&&(i=g+s);if(n.filter((t=>t.trueLeft===i)).length){const t=String(o.value).length*a,r=(null==(u=n.at(-1))?void 0:u.trueHeight)||0;e+=r,e+t+f>l.endY&&(e=l.originY,i+=s)}e+=f,String(o.value).length&&n.push(h(o,i,e))})),t.horizontal.forEach(((e,o)=>{var r;const c=l.originY+(e.baseTop||0)*a,u=(null==(r=n.at(-1))?void 0:r.left)||0;t.left<=u&&(i=u+s),String(e.value).length&&n.push(h(e,i,c))}))}));const f=n.length>0?new t.Group([...n],{...e,objectCaching:!1}):null;f&&i.value.add(f)}()}export{i as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useEvent as n,useCanvasEvent as o}from"../useEvent.js";import{setOtherType as s,getFloorNumber as d}from"../../utils/index.js";import"lodash-es";import{format as v,addDays as c}from"date-fns";import"../../../../../shared/utils/index.js";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function Y(Y,S,b,w,C,x){const D=15,j=e(),V=e(),X=e(),H=t((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||D)||0})),L=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||D)||0})),I=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||D)||0})),M=t((()=>{var e,t,a;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||D)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),P=t((()=>{var e;const{bottom:t}=S.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),N=t((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+e.surplusXCell})),O=t((()=>{const{grid:e}=S.data;return e.mainYCell*e.subYCell+e.surplusYCell})),W=t((()=>{var e;const{width:t,right:a=null,top:l}=S.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),$=t((()=>{const{grid:e}=S.data;return W.value-e.surplusXCell*z.value})),k=t((()=>{const{top:e,left:t}=S.data;return e.titleWidth+A.value})),G=t((()=>{const{bottom:e=null,height:t}=S.data;if(!e)return t;return t-(e.height||30)})),R=t((()=>{var e;const{top:t}=S.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||D)||0;return H.value+a+l+L.value+I.value})),q=t((()=>{const{grid:e}=S.data;return R.value+e.surplusYCell*T.value})),z=t((()=>(W.value-k.value)/N.value)),T=t((()=>(G.value-R.value)/O.value)),A=t((()=>{var e,t;const{left:a}=S.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),B=t((()=>{var e,t;const{top:a,grid:l}=S.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let r=k.value-z.value;const n=a.date.startDate||v(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(v(c(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=z.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+z.value/2,scaleCell:(l-a)/z.value}})))).flat()})),E=t((()=>ie("breathe"))),F=t((()=>ie("pulse"))),J=t((()=>ie("temperature"))),K=t((()=>ie("pain"))),Q=t((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=t((()=>{const{left:e}=S.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:s(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=t((()=>{const{left:e}=S.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),_=t((()=>{const{grid:e}=S.data;return-1===Z.value?0:T.value*e.subYCell})),ee=t((()=>{const{left:e}=S.data,t={originY:G.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value,t.endY=q.value+_.value):Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value,t.endY=G.value),t})),te=t((()=>{const{left:e}=S.data,t={originY:R.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value+_.value,t.endY=G.value):Z.value===e.yScaleValue.length-1&&(t.originY=q.value,t.endY=G.value-_.value),t})),ae=t((()=>{var e,t;const{top:a,grid:l}=S.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),le=t((()=>{var e;const{left:t,right:a}=S.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>d(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ue=a({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...i,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:L.value,operationDaysHeight:I.value,xScalevalueHeight:M.value,topList:ae.value,breathingHeight:P.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:N.value,gridYNumber:O.value,iconsWidth:A.value,originX:k.value,originY:R.value,originYLimit:q.value,endX:W.value,endXLimit:$.value,endY:G.value,xCellWidth:z.value,yCellHeight:T.value,xScaleList:B.value,breatheYCell:E.value,pulseYCell:F.value,temperatureYCell:J.value,painYCell:K.value,event:Q.value,itemList:U.value,getRightInfo:le.value,config:S.data.config||{}});function ie(e){const{yScaleValue:t}=S.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?T.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:re,cumputedY:ne,getXValue:oe,getYValue:se}=r(ue);return l((()=>{u((()=>{h(Y,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=m(Y,ue,b,re,ne,oe,se,S.addRenderItem,C,x);V.value=l,X.value=u;const{drawScaleValue:r}=p(Y,ue,b,e,C,re,ne,oe,se,t,a,i);g(Y,ue,r),f(Y,ue),y(Y,ue,re),n(w.value);const{select:s}=o(Y,ue,b);j.value=s}))})),{propItems:ue,redrawPoints:V,select:j,clickMenu:X}}export{Y as useTemperatureChart};
1
+ import{ref as e,computed as t,reactive as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useEvent as n,useCanvasEvent as o}from"../useEvent.js";import{setOtherType as s,getFloorNumber as d}from"../../utils/index.js";import"lodash-es";import{format as v,addDays as c}from"date-fns";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function Y(Y,S,b,w,C,x){const D=15,j=e(),V=e(),X=e(),H=t((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||D)||0})),L=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||D)||0})),I=t((()=>{var e;const{top:t}=S.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||D)||0})),M=t((()=>{var e,t,a;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||D)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),P=t((()=>{var e;const{bottom:t}=S.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),N=t((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+e.surplusXCell})),O=t((()=>{const{grid:e}=S.data;return e.mainYCell*e.subYCell+e.surplusYCell})),W=t((()=>{var e;const{width:t,right:a=null,top:l}=S.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),$=t((()=>{const{grid:e}=S.data;return W.value-e.surplusXCell*z.value})),k=t((()=>{const{top:e,left:t}=S.data;return e.titleWidth+A.value})),G=t((()=>{const{bottom:e=null,height:t}=S.data;if(!e)return t;return t-(e.height||30)})),R=t((()=>{var e;const{top:t}=S.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||D)||0;return H.value+a+l+L.value+I.value})),q=t((()=>{const{grid:e}=S.data;return R.value+e.surplusYCell*T.value})),z=t((()=>(W.value-k.value)/N.value)),T=t((()=>(G.value-R.value)/O.value)),A=t((()=>{var e,t;const{left:a}=S.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),B=t((()=>{var e,t;const{top:a,grid:l}=S.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let r=k.value-z.value;const n=a.date.startDate||v(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(v(c(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=z.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+z.value/2,scaleCell:(l-a)/z.value}})))).flat()})),E=t((()=>ie("breathe"))),F=t((()=>ie("pulse"))),J=t((()=>ie("temperature"))),K=t((()=>ie("pain"))),Q=t((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=t((()=>{const{left:e}=S.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:s(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=t((()=>{const{left:e}=S.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),_=t((()=>{const{grid:e}=S.data;return-1===Z.value?0:T.value*e.subYCell})),ee=t((()=>{const{left:e}=S.data,t={originY:G.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value,t.endY=q.value+_.value):Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value,t.endY=G.value),t})),te=t((()=>{const{left:e}=S.data,t={originY:R.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=q.value+_.value,t.endY=G.value):Z.value===e.yScaleValue.length-1&&(t.originY=q.value,t.endY=G.value-_.value),t})),ae=t((()=>{var e,t;const{top:a,grid:l}=S.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),le=t((()=>{var e;const{left:t,right:a}=S.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>d(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ue=a({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...i,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:L.value,operationDaysHeight:I.value,xScalevalueHeight:M.value,topList:ae.value,breathingHeight:P.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:N.value,gridYNumber:O.value,iconsWidth:A.value,originX:k.value,originY:R.value,originYLimit:q.value,endX:W.value,endXLimit:$.value,endY:G.value,xCellWidth:z.value,yCellHeight:T.value,xScaleList:B.value,breatheYCell:E.value,pulseYCell:F.value,temperatureYCell:J.value,painYCell:K.value,event:Q.value,itemList:U.value,getRightInfo:le.value,config:S.data.config||{}});function ie(e){const{yScaleValue:t}=S.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?T.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:re,cumputedY:ne,getXValue:oe,getYValue:se}=r(ue);return l((()=>{u((()=>{h(Y,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=m(Y,ue,b,re,ne,oe,se,S.addRenderItem,C,x);V.value=l,X.value=u;const{drawScaleValue:r}=p(Y,ue,b,e,C,re,ne,oe,se,t,a,i);g(Y,ue,r),f(Y,ue),y(Y,ue,re),n(w.value);const{select:s}=o(Y,ue,b);j.value=s}))})),{propItems:ue,redrawPoints:V,select:j,clickMenu:X}}export{Y as useTemperatureChart};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as s,defaultTextStyle as i}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";import"../../../../../shared/utils/index.js";function o(o,u){const{grid:h,originX:n,endX:a,xCellWidth:c,gridXNumber:r,top:p,xScalevalueHeight:d,iconsWidth:f,topList:v,endXLimit:g,canvasWidth:y,borderStyle:m}=u;!function(){const S=[];g&&S.push(new t.Line([g,0,y,0],m));let w=0;v.forEach(((t,l)=>{if(l>0&&(w+=u[`${v[l-1].key}Height`]),"xScalevalue"==t.key)!function(t,l,o){const u=p.dayHeight;if(!u)return;l.push(e([n,o+u,a,o+u],m));const d=c*h.subSecondXCell,f=(r-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<f;h++){const a=n+h*d,c=h%2==0?"上午":"下午",r=s({width:d,height:u,...m},{value:c,...i,...t.style||{}},{left:a,top:o});l.push(r),l.push(e([a+d,o,a+d,o+u],m))}}(t,S,w),function(t,l,o){var u;const r=p.xScalevalue.show&&null!=(u=p.dayHeight)?u:0,v=d-r;if(!v)return;l.push(e([f,o+d,a,o+d],m));const g=s({width:n-f,height:d,...m},{value:p.xScalevalue.title,...i,...t.style||{},...t.titleStyle||{}},{left:f,top:o});l.push(g),l.push(e([n,o,n,o+d],m));const y=[];for(let t=0;t<h.mainXCell;t++)y.push(p.xScalevalue.list);y.flat().forEach(((u,h)=>{const a=n+h*c,p=s({width:c,height:v,...m},{value:u.value,...i,...t.style||{},...u.style||{}},{left:a,top:o+r});l.push(p),l.push(e([a+c,o+r,a+c,o+r+v],m))}))}(t,S,w);else{if(!u[`${t.key}Height`])return;const o=u[`${v[l].key}Height`];!function(t,l,o){const a=u[`${t.key}Height`],r=s({width:n-f,height:a,...m},{value:t.title,...i,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:f,top:o});l.push(r);const p=c*h.subXCell;t.list.forEach(((u,h)=>{const c=n+h*p,r=s({width:p,height:a,...m},{value:u,...i,...(null==t?void 0:t.style)||{}},{left:c,top:o});l.push(e([c+p,o,c+p,o+a],m)),l.push(r)}))}(t,S,w),S.push(e([f,w+o,a,w+o],m)),S.push(e([n,w,n,w+o],m))}}));const x=S.length>0?new t.Group([...S],{...l,objectCaching:!1}):null;x&&x.sendToBack(),x&&o.value.add(x)}()}export{o as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as s,defaultTextStyle as i}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";function o(o,u){const{grid:h,originX:n,endX:a,xCellWidth:c,gridXNumber:r,top:p,xScalevalueHeight:d,iconsWidth:f,topList:v,endXLimit:g,canvasWidth:y,borderStyle:m}=u;!function(){const S=[];g&&S.push(new t.Line([g,0,y,0],m));let w=0;v.forEach(((t,l)=>{if(l>0&&(w+=u[`${v[l-1].key}Height`]),"xScalevalue"==t.key)!function(t,l,o){const u=p.dayHeight;if(!u)return;l.push(e([n,o+u,a,o+u],m));const d=c*h.subSecondXCell,f=(r-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<f;h++){const a=n+h*d,c=h%2==0?"上午":"下午",r=s({width:d,height:u,...m},{value:c,...i,...t.style||{}},{left:a,top:o});l.push(r),l.push(e([a+d,o,a+d,o+u],m))}}(t,S,w),function(t,l,o){var u;const r=p.xScalevalue.show&&null!=(u=p.dayHeight)?u:0,v=d-r;if(!v)return;l.push(e([f,o+d,a,o+d],m));const g=s({width:n-f,height:d,...m},{value:p.xScalevalue.title,...i,...t.style||{},...t.titleStyle||{}},{left:f,top:o});l.push(g),l.push(e([n,o,n,o+d],m));const y=[];for(let t=0;t<h.mainXCell;t++)y.push(p.xScalevalue.list);y.flat().forEach(((u,h)=>{const a=n+h*c,p=s({width:c,height:v,...m},{value:u.value,...i,...t.style||{},...u.style||{}},{left:a,top:o+r});l.push(p),l.push(e([a+c,o+r,a+c,o+r+v],m))}))}(t,S,w);else{if(!u[`${t.key}Height`])return;const o=u[`${v[l].key}Height`];!function(t,l,o){const a=u[`${t.key}Height`],r=s({width:n-f,height:a,...m},{value:t.title,...i,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:f,top:o});l.push(r);const p=c*h.subXCell;t.list.forEach(((u,h)=>{const c=n+h*p,r=s({width:p,height:a,...m},{value:u,...i,...(null==t?void 0:t.style)||{}},{left:c,top:o});l.push(e([c+p,o,c+p,o+a],m)),l.push(r)}))}(t,S,w),S.push(e([f,w+o,a,w+o],m)),S.push(e([n,w,n,w+o],m))}}));const X=S.length>0?new t.Group([...S],{...l,objectCaching:!1}):null;X&&X.sendToBack(),X&&o.value.add(X)}()}export{o as useTop};
@@ -451,6 +451,8 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
451
451
  }>> & {
452
452
  onCloseEvaluateCountdown?: ((...args: any[]) => any) | undefined;
453
453
  }>>;
454
+ useFormArray: import("vue").ComputedRef<unknown[]>;
455
+ curShowTotalLen: import("vue").ComputedRef<number>;
454
456
  calcShowEvaluateCountdown: import("vue").ComputedRef<boolean>;
455
457
  toggleIcon: import("vue").ComputedRef<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
456
458
  hasEva: import("vue").ComputedRef<unknown>;
@@ -449,6 +449,8 @@ declare const _default: import("vue").DefineComponent<{
449
449
  }>> & {
450
450
  onCloseEvaluateCountdown?: ((...args: any[]) => any) | undefined;
451
451
  }>>;
452
+ useFormArray: import("vue").ComputedRef<unknown[]>;
453
+ curShowTotalLen: import("vue").ComputedRef<number>;
452
454
  calcShowEvaluateCountdown: import("vue").ComputedRef<boolean>;
453
455
  toggleIcon: import("vue").ComputedRef<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
454
456
  hasEva: import("vue").ComputedRef<unknown>;
@@ -83,6 +83,8 @@ declare const _default: import("vue").DefineComponent<{
83
83
  }>> & {
84
84
  onCloseEvaluateCountdown?: ((...args: any[]) => any) | undefined;
85
85
  }>>;
86
+ useFormArray: import("vue").ComputedRef<unknown[]>;
87
+ curShowTotalLen: import("vue").ComputedRef<number>;
86
88
  calcShowEvaluateCountdown: import("vue").ComputedRef<boolean>;
87
89
  toggleIcon: import("vue").ComputedRef<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
88
90
  hasEva: import("vue").ComputedRef<unknown>;
@@ -1 +1 @@
1
- import{defineComponent as e,reactive as t,computed as a,onMounted as o,watch as n,openBlock as l,createElementBlock as s,normalizeClass as r,unref as u,createBlock as i,createCommentVNode as d,createElementVNode as c,toDisplayString as v,createTextVNode as f,Fragment as w,normalizeStyle as m}from"vue";import{NIcon as p}from"naive-ui";import{ChevronUpSharp as y,ChevronDownSharp as b}from"@vicons/ionicons5";import"xe-utils";import S from"moment";import C from"../../../../shared/utils/vexutilsExpand.js";import{useEvaluate as R}from"../hooks/use-evaluate.js";const g=c("i",{class:"scale-view-iconfont icon-scale-view-shijian"},null,-1),j={class:"answered-wrap"},E={class:"answered-num"},h={class:"answered-blod"},A={class:"answered-blue"},O={class:"answered-blod"},k={class:"answered-blue"},T={key:0};var x=e({__name:"EvaluateCountdown",props:{formArray:{type:Array,default:()=>[]},evaluateResultConfig:{type:Object,default:()=>({})},evaluateResultSetting:{type:Object,default:()=>({})},form:{type:Object,default:()=>({})},currentTime:{default:(new Date).getTime()},showEvaluateCountdown:{type:Boolean,default:!1},isEvaluetaResSituation:{type:Boolean,default:!1},evaResultObj:{type:Object,default:()=>({})},skipCover:{type:Boolean,default:!1}},emits:["closeEvaluateCountdown"],setup(e,{expose:x,emit:L}){const _=e,B=t({source:"countdown",setAnswered:0,unfold:!0,answeredScore:0,totalScore:0,answeredRes:"",answeredColor:"#212121"}),U=a((()=>_.showEvaluateCountdown&&!_.skipCover)),V=a((()=>B.unfold?y:b)),D=a((()=>_.formArray.find((e=>e.type.includes("EVALUATE_"))))),N=a((()=>!!D.value&&(_.isEvaluetaResSituation&&B.unfold))),{evaluateState:W,evaluateStartTime:q,showCountdown:z,getTotalLen:F,countdown:G,clearTimer:H}=R(_,B,{emit:L}),I=e=>{if(!D.value||!_.isEvaluetaResSituation)return;let{evaluateResultColor:t,evaluateResult:a,totalScore:o}=e;if(B.answeredScore=o||0,!a)return B.answeredRes="",void(B.answeredColor="#212121");t&&"string"==typeof t&&t.startsWith("#")||(t="#212121"),B.answeredRes=a,B.answeredColor=t},J=()=>{D.value&&(()=>{let e=0,t=_.formArray.filter((e=>e.type.includes("EVALUATE_")));if(!t.length)return B.totalScore=e,e;t.forEach((t=>{var a;const o=t.scoreConfigs?+(null==(a=t.scoreConfigs)?void 0:a.maxScore):0;e=C.add(e,o)})),B.totalScore=e})(),F();let{evaluateTime:e}=_.evaluateResultSetting;if(!z.value||!e||!U.value)return;let t=(q.value?S(q.value):S()).add(e,"minutes");H(),G(t)},K=()=>{B.unfold=!B.unfold};o((()=>{J()})),n((()=>_.form),(e=>{(e||Object.keys(e).length)&&(e=>{var t;let a=null==(t=_.formArray)?void 0:t.filter((e=>!W.filterArr.includes(e.type)));if(!a||!a.length)return;let o={};a.forEach((t=>{const a=t.databaseTitle||t.title;o[a]=e[a]}));let n=0;for(let e in o){let t=o[e],a=(l=t,Object.prototype.toString.call(l));"[object Object]"==a?t&&Object.keys(t).length&&n++:"[object Array]"==a?t&&t.length&&n++:"[object Number]"==a?(t||0===t)&&n++:t&&n++}var l;B.setAnswered=n})(e)}),{immediate:!0,deep:!0}),n((()=>_.evaResultObj),(e=>{(e||Object.keys(e).length)&&I(e)}),{immediate:!0,deep:!0});return x({getCountdownObj:()=>({setAnswered:B.setAnswered,totalLen:W.totalLen})}),(e,t)=>(l(),s("div",{class:r(["c-evaluateCountdown",{"evaluateCountdown-hasTime":u(U),"evaluateCountdown-EvaluetaResSituation":_.isEvaluetaResSituation}])},[_.isEvaluetaResSituation?(l(),i(u(p),{key:0,class:"evaluate-toggle-icon",component:u(V),onClick:K},null,8,["component"])):d("v-if",!0),u(U)?(l(),s("div",{key:1,class:r(["countdown",{"countdown-red":u(W).countdownRed}])},[c("span",null,v(u(W).countdownStr),1),g],2)):d("v-if",!0),c("div",j,[c("div",E,[f(" 作答数量:"),c("span",h,v(B.setAnswered),1),f("/"),c("span",A,v(u(W).totalLen),1)]),u(N)?(l(),s(w,{key:0},[c("div",null,[f("作答分数:"),c("span",O,v(B.answeredScore),1),f("/"),c("span",k,v(B.totalScore),1)]),B.answeredRes?(l(),s("div",T,[f("作答结果:"),c("span",{style:m({color:B.answeredColor})},v(B.answeredRes),5)])):d("v-if",!0)],64)):d("v-if",!0)])],2))}});export{x as default};
1
+ import{defineComponent as e,reactive as t,computed as a,onMounted as o,watch as l,openBlock as n,createElementBlock as s,normalizeClass as r,unref as u,createBlock as i,createCommentVNode as d,createElementVNode as c,toDisplayString as v,createTextVNode as f,Fragment as w,normalizeStyle as m}from"vue";import{NIcon as p}from"naive-ui";import{ChevronUpSharp as y,ChevronDownSharp as S}from"@vicons/ionicons5";import"xe-utils";import b from"moment";import C from"../../../../shared/utils/vexutilsExpand.js";import{useEvaluate as g}from"../hooks/use-evaluate.js";const h=c("i",{class:"scale-view-iconfont icon-scale-view-shijian"},null,-1),R={class:"answered-wrap"},j={class:"answered-num"},E={class:"answered-blod"},A={class:"answered-blue"},O={class:"answered-blod"},k={class:"answered-blue"},T={key:0};var x=e({__name:"EvaluateCountdown",props:{formArray:{type:Array,default:()=>[]},evaluateResultConfig:{type:Object,default:()=>({})},evaluateResultSetting:{type:Object,default:()=>({})},form:{type:Object,default:()=>({})},currentTime:{default:(new Date).getTime()},showEvaluateCountdown:{type:Boolean,default:!1},isEvaluetaResSituation:{type:Boolean,default:!1},evaResultObj:{type:Object,default:()=>({})},skipCover:{type:Boolean,default:!1}},emits:["closeEvaluateCountdown"],setup(e,{expose:x,emit:L}){const _=e,B=t({source:"countdown",setAnswered:0,unfold:!0,answeredScore:0,totalScore:0,answeredRes:"",answeredColor:"#212121"}),U=a((()=>_.formArray.filter((e=>!z.filterArr.includes(e.type)&&!e.hide&&e.isShow)))),V=a((()=>{var e;return null==(e=U.value)?void 0:e.length})),D=a((()=>_.showEvaluateCountdown&&!_.skipCover)),N=a((()=>B.unfold?y:S)),W=a((()=>_.formArray.find((e=>e.type.includes("EVALUATE_"))))),q=a((()=>!!W.value&&(_.isEvaluetaResSituation&&B.unfold))),{evaluateState:z,evaluateStartTime:F,showCountdown:G,getTotalLen:H,countdown:I,clearTimer:J}=g(_,B,{emit:L}),K=e=>{if(!W.value||!_.isEvaluetaResSituation)return;let{evaluateResultColor:t,evaluateResult:a,totalScore:o}=e;if(B.answeredScore=o||0,!a)return B.answeredRes="",void(B.answeredColor="#212121");t&&"string"==typeof t&&t.startsWith("#")||(t="#212121"),B.answeredRes=a,B.answeredColor=t},M=()=>{W.value&&(()=>{let e=0,t=_.formArray.filter((e=>e.type.includes("EVALUATE_")));if(!t.length)return B.totalScore=e,e;t.forEach((t=>{var a;const o=t.scoreConfigs?+(null==(a=t.scoreConfigs)?void 0:a.maxScore):0;e=C.add(e,o)})),B.totalScore=e})(),H();let{evaluateTime:e}=_.evaluateResultSetting;if(!G.value||!e||!D.value)return;let t=(F.value?b(F.value):b()).add(e,"minutes");J(),I(t)},P=()=>{B.unfold=!B.unfold};o((()=>{M()})),l((()=>_.form),(e=>{(e||Object.keys(e).length)&&(e=>{if(!U.value||!U.value.length)return;let t={};U.value.forEach((a=>{const o=a.databaseTitle||a.title;t[o]=e[o]}));let a=0;for(let e in t){let l=t[e],n=(o=l,Object.prototype.toString.call(o));"[object Object]"==n?l&&Object.keys(l).length&&a++:"[object Array]"==n?l&&l.length&&a++:"[object Number]"==n?(l||0===l)&&a++:l&&a++}var o;B.setAnswered=a})(e)}),{immediate:!0,deep:!0}),l((()=>_.evaResultObj),(e=>{(e||Object.keys(e).length)&&K(e)}),{immediate:!0,deep:!0});return x({getCountdownObj:()=>({setAnswered:B.setAnswered,totalLen:V.value})}),(e,t)=>(n(),s("div",{class:r(["c-evaluateCountdown",{"evaluateCountdown-hasTime":u(D),"evaluateCountdown-EvaluetaResSituation":_.isEvaluetaResSituation}])},[_.isEvaluetaResSituation?(n(),i(u(p),{key:0,class:"evaluate-toggle-icon",component:u(N),onClick:P},null,8,["component"])):d("v-if",!0),u(D)?(n(),s("div",{key:1,class:r(["countdown",{"countdown-red":u(z).countdownRed}])},[c("span",null,v(u(z).countdownStr),1),h],2)):d("v-if",!0),c("div",R,[c("div",j,[f(" 作答数量:"),c("span",E,v(B.setAnswered),1),f("/"),c("span",A,v(u(V)),1)]),u(q)?(n(),s(w,{key:0},[c("div",null,[f("作答分数:"),c("span",O,v(B.answeredScore),1),f("/"),c("span",k,v(B.totalScore),1)]),B.answeredRes?(n(),s("div",T,[f("作答结果:"),c("span",{style:m({color:B.answeredColor})},v(B.answeredRes),5)])):d("v-if",!0)],64)):d("v-if",!0)])],2))}});export{x as default};
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,reactive as a,createVNode as r,resolveComponent as u,createTextVNode as l}from"vue";import{NTimePicker as n,NDatePicker as i}from"naive-ui";import"xe-utils";import o from"moment";import s from"../../../../../shared/utils/vexutilsExpand.js";import{formatMap as d}from"../../utils/judge-types.js";var m=e({name:"RDatetime",components:{NTimePicker:n,NDatePicker:i},props:{form:{type:Object,default:()=>({})},item:{type:Object,default:()=>({})},isLock:{type:Boolean,default:!1}},emits:["scaleChange"],setup(e,n){var i,m,c,p,f;const v=null==(i=e.item)?void 0:i.type,g=null==(c=null==(m=e.item)?void 0:m.setting)?void 0:c.startToStop,b="DATE"===v?"date":null==(f=null==(p=e.item)?void 0:p.setting)?void 0:f.dateType,D=t((()=>d[b])),V=t((()=>"datehour"===b?"datetime":b)),N=t((()=>"datehour"===b?"HH:mm":"HH:mm:ss")),k=a({rangeValue:[null,null],dateValue:null}),w=t((()=>"datetime"==b||"datehour"==b?"datetimerange":"daterange")),y=e=>["time","hour"].includes(e),H=e=>{const t=k.rangeValue[1];if(!t)return!1;return e>Number(new Date(t).getHours())},h=(e,t)=>{if(null===t)return!1;const a=k.rangeValue[1];if(!a)return!1;const r=Number(new Date(a).getHours()),u=Number(new Date(a).getMinutes());return!(t<r)&&e>u},S=(e,t,a)=>{if(null===a||null===t)return!1;const r=k.rangeValue[1];if(!r)return!1;const u=Number(new Date(r).getHours()),l=Number(new Date(r).getMinutes()),n=Number(new Date(r).getSeconds());return!(a<u)&&(!(t<l)&&e>=n)},M=e=>{const t=k.rangeValue[0];if(!t)return!1;return e<Number(new Date(t).getHours())},O=(e,t)=>{if(null===t)return!1;const a=k.rangeValue[0];if(!a)return!1;const r=Number(new Date(a).getHours()),u=Number(new Date(a).getMinutes());return!(t>r)&&e<u},U=(e,t,a)=>{if(null===a||null===t)return!1;const r=k.rangeValue[0];if(!r)return!1;const u=Number(new Date(r).getHours()),l=Number(new Date(r).getMinutes()),n=Number(new Date(r).getSeconds());return!(a>u)&&(!(t>l)&&e<=n)},L=(t,a,r)=>{const u="start"===r?1:0;let l=k.rangeValue[u];l&&(l=o(l).format(D.value)),"start"!==r?n.emit("scaleChange",[l||"",a],e.item):n.emit("scaleChange",[a,l||""],e.item)},T=(t,a)=>{n.emit("scaleChange",a,e.item)};return(e=>{if(s.isJSON(e)&&(e=JSON.parse(e)),!e||s.isEmpty(e))return;const t=JSON.parse(JSON.stringify(e));if("TIME"===v||y(b)){if(1!=g)return void(k.dateValue=e);if(!Array.isArray(t)||!t.length)return;const a=t[0]?o(t[0],D.value).valueOf():"",r=t[1]?o(t[1],D.value).valueOf():"",u=a&&s.isValidDate(new Date(a))?a:null,l=r&&s.isValidDate(new Date(r))?r:null;k.rangeValue=[u,l]}else k.dateValue=e})(e.form[e.item.val_key]),()=>"TIME"===v||y(b)?1==g?r("div",{class:"c-time-range"},[r(u("n-time-picker"),{value:k.rangeValue[0],"onUpdate:value":[e=>k.rangeValue[0]=e,(e,t)=>L(0,t,"start")],clearable:!0,disabled:e.isLock,format:D.value,isHourDisabled:H,isMinuteDisabled:h,isSecondDisabled:S},null),l("  -  "),r(u("n-time-picker"),{value:k.rangeValue[1],"onUpdate:value":[e=>k.rangeValue[1]=e,(e,t)=>L(0,t,"end")],clearable:!0,disabled:e.isLock,format:D.value,isHourDisabled:M,isMinuteDisabled:O,isSecondDisabled:U},null)]):r(u("n-time-picker"),{"formatted-value":k.dateValue,"onUpdate:formatted-value":e=>k.dateValue=e,clearable:!0,disabled:e.isLock,"onUpdate:value":T,format:D.value},null):["date","datetime","datehour"].includes(b)&&1==g?r(u("n-date-picker"),{"formatted-value":k.dateValue,"onUpdate:formatted-value":e=>k.dateValue=e,type:w.value,clearable:!0,disabled:e.isLock,format:D.value,"time-picker-props":{format:N.value},"onUpdate:value":T},null):r(u("n-date-picker"),{"formatted-value":k.dateValue,"onUpdate:formatted-value":e=>k.dateValue=e,type:V.value,clearable:!0,disabled:e.isLock,format:D.value,"time-picker-props":{format:N.value},"onUpdate:value":T},null)}});export{m as default};
1
+ import{defineComponent as e,reactive as t,computed as a,createVNode as r,resolveComponent as l,createTextVNode as u}from"vue";import{NTimePicker as n,NDatePicker as i}from"naive-ui";import"xe-utils";import o from"moment";import s from"../../../../../shared/utils/vexutilsExpand.js";import{formatMap as d,valueReg as m,transDbvalueFormat as c}from"../../utils/judge-types.js";var v=e({name:"RDatetime",components:{NTimePicker:n,NDatePicker:i},props:{form:{type:Object,default:()=>({})},item:{type:Object,default:()=>({})},isLock:{type:Boolean,default:!1}},emits:["scaleChange"],setup(e,n){var i,v,f,p,g;const y=null==(i=e.item)?void 0:i.type,D=null==(f=null==(v=e.item)?void 0:v.setting)?void 0:f.startToStop,b="DATE"===y?"date":null==(g=null==(p=e.item)?void 0:p.setting)?void 0:g.dateType,V=t({rangeValue:[null,null],dateValue:null,calcDateType:""}),k=a((()=>V.calcDateType||b)),N=a((()=>d[k.value]||"yyyy-MM-dd")),h=a((()=>"datehour"===k.value?"datetime":k.value)),w=a((()=>"datehour"===k.value?"HH:mm":"HH:mm:ss")),H=a((()=>"datetime"==k.value||"datehour"==k.value?"datetimerange":"daterange")),M=e=>["time","hour"].includes(e),T=(e,t)=>{const a=o(e,t).valueOf();let r=e;1==D&&["time","hour"].includes(k.value)&&(r=a);return s.isValidDate(new Date(a))?r:null},S=t=>{var a,r;const l=m[k.value];if(V.calcDateType="",!t||"object"==typeof t)return null;const u=null==(a=N.value)?void 0:a.replace(/yyyy/,"YYYY").replace(/dd/,"DD");if(t&&l.test(t))return T(t,u);const n=(e=>{let t="";for(const a in m)if(m[a].test(e)){t=a;break}return t})(t);if(e.isLock&&n){V.calcDateType=n;const e=null==(r=N.value)?void 0:r.replace(/yyyy/,"YYYY").replace(/dd/,"DD");return T(t,e)}const i=c.get(n);if(!(null==i?void 0:i.length)||!i.includes(k.value))return null;if("time"===k.value&&"hour"==n){t=`${o().format("yyyy-MM-DD")} ${t}`}const s=o(t).format(u);return T(s,u)},U=e=>{const t=V.rangeValue[1];if(!t)return!1;return e>Number(new Date(t).getHours())},Y=(e,t)=>{if(null===t)return!1;const a=V.rangeValue[1];if(!a)return!1;const r=Number(new Date(a).getHours()),l=Number(new Date(a).getMinutes());return!(t<r)&&e>l},A=(e,t,a)=>{if(null===a||null===t)return!1;const r=V.rangeValue[1];if(!r)return!1;const l=Number(new Date(r).getHours()),u=Number(new Date(r).getMinutes()),n=Number(new Date(r).getSeconds());return!(a<l)&&(!(t<u)&&e>=n)},L=e=>{const t=V.rangeValue[0];if(!t)return!1;return e<Number(new Date(t).getHours())},O=(e,t)=>{if(null===t)return!1;const a=V.rangeValue[0];if(!a)return!1;const r=Number(new Date(a).getHours()),l=Number(new Date(a).getMinutes());return!(t>r)&&e<l},j=(e,t,a)=>{if(null===a||null===t)return!1;const r=V.rangeValue[0];if(!r)return!1;const l=Number(new Date(r).getHours()),u=Number(new Date(r).getMinutes()),n=Number(new Date(r).getSeconds());return!(a>l)&&(!(t>u)&&e<=n)},E=(t,a,r)=>{const l="start"===r?1:0;let u=V.rangeValue[l];u&&(u=o(u).format(N.value)),"start"!==r?n.emit("scaleChange",[u||"",a],e.item):n.emit("scaleChange",[a,u||""],e.item)},x=(t,a)=>{n.emit("scaleChange",a,e.item)};return(e=>{if(s.isJSON(e)&&(e=JSON.parse(e)),!e||s.isEmpty(e))return;const t=JSON.parse(JSON.stringify(e)),a=(e=>{if(1==D&&!Array.isArray(e))return null;if(1!=D&&"string"!=typeof e)return null;if(e&&Array.isArray(e))return e.length&&2==e.length?[S(e[0]),S(e[1])]:null;return S(e)})(e);if("TIME"===y||M(k.value)){if(1!=D)return void(V.dateValue=a);if(!Array.isArray(t)||!t.length)return;V.rangeValue=a}else V.dateValue=a})(e.form[e.item.val_key]),()=>{return"TIME"===y||M(k.value)?1==D?r("div",{class:"c-time-range"},[r(l("n-time-picker"),{value:V.rangeValue[0],"onUpdate:value":[e=>V.rangeValue[0]=e,(e,t)=>E(0,t,"start")],clearable:!0,disabled:e.isLock,format:N.value,isHourDisabled:U,isMinuteDisabled:Y,isSecondDisabled:A},null),u("  -  "),r(l("n-time-picker"),{value:V.rangeValue[1],"onUpdate:value":[e=>V.rangeValue[1]=e,(e,t)=>E(0,t,"end")],clearable:!0,disabled:e.isLock,format:N.value,isHourDisabled:L,isMinuteDisabled:O,isSecondDisabled:j},null)]):r(l("n-time-picker"),{"formatted-value":V.dateValue,"onUpdate:formatted-value":e=>V.dateValue=e,clearable:!0,disabled:e.isLock,"onUpdate:value":x,format:N.value},null):(t=k.value,["date","datetime","datehour"].includes(t)&&1==D?r(l("n-date-picker"),{"formatted-value":V.dateValue,"onUpdate:formatted-value":e=>V.dateValue=e,type:H.value,clearable:!0,disabled:e.isLock,format:N.value,"time-picker-props":{format:w.value},"onUpdate:value":x,"default-time":["00:00:00","23:59:59"]},null):r(l("n-date-picker"),{"formatted-value":V.dateValue,"onUpdate:formatted-value":e=>V.dateValue=e,type:h.value,clearable:!0,disabled:e.isLock,format:N.value,"time-picker-props":{format:w.value},"onUpdate:value":x},null));var t}}});export{v as default};
@@ -1 +1 @@
1
- import{handleQueryParams as e,getQueryVariable as t,formatMap as a}from"../utils/judge-types.js";import i from"./use-noData.js";import"xe-utils";import n from"moment";import s from"../../../../shared/utils/vexutilsExpand.js";import{componentMap as l}from"./use-component.js";import{useEvent as r}from"./use-event.js";import{ScaleViewComputed as o}from"./scaleview-computed.js";import{ScaleViewValidate as u}from"./scaleview-validate.js";import{useDialog as v}from"naive-ui";const c=(c,f,d,p)=>{const m=n(),g=v(),{setNoData:S}=i(),{hasEvaluateResultSetting:E,hasparamsEvaluate:y,hasDefault:C,formKey:O}=o(c,f,p),{formatRules:A}=u(c,f,p),{nextLogicEvent:R}=r(c,f),h=e=>{const t=null==e?void 0:e.evaluateStartTime;t&&!s.isValidDate(new Date(t))&&s.isValidDate(new Date(Number(t)))&&(e.evaluateStartTime=Number(t))},L=()=>{var t;if(!E.value)return!!C.value&&("evaluateResultSetting"in f.config||(f.config.evaluateResultSetting={}),(t=>{let a=e();if(y.value&&(a=f.paramsEvaluate),a.evaname&&(t.evaluateName=a.evaname),a.evadesc&&(t.evaluateExplain=a.evadesc),a.evast&&(t.evaluateStartTime=a.evast),a.evadur&&(t.evaluateTime=a.evadur),a.evaan){const e="true"===a.evaan||1==a.evaan;t.evaluateAnswer=e}if(a.evasit&&(t.evaluetaResSituation=!!a.evasit),a.evaztip){const e=1==a.evaan;t.evaluateZeroTip=e}h(t)})(f.config.evaluateResultSetting),f.showEvaluatePage=!0,void(f.showEvaluateCountdownWrap=!0));const{evaluateResultSetting:a={}}=f.config;if(!a||!Object.keys(a).length)return;f.showEvaluateCountdownWrap=!0;const{evaluateStartTime:i}=a,{evaluateName:n}=(null==(t=f.originConfig)?void 0:t.evaluateResultSetting)||{};if(i)return!(!s.isValidDate(new Date(i))&&!n)&&void(f.showEvaluatePage=!0);f.showEvaluatePage=!0},T=(e,t)=>{const a=e.find((e=>t===e.value));return a?a.key:t},N=(e,t)=>{if(["RADIO_BLOCK","CHECKBOX_BLOCK"].includes(t)&&e&&(e&&s.isJSON(e)&&(e=JSON.parse(e)),e.length))return!0},b=t=>{var a,i;if(!t||!t.length)return;const n=e();if((null==c?void 0:c.noBtn)||(null==n?void 0:n.noBtn))return;const l=t.find((e=>"FRONT_ADDRESS"===e.type));if(!l||!Object.keys(l).length)return;let r;if(l.setting&&s.isJSON(l.setting)&&(r=JSON.parse(l.setting)),!r||!Object.keys(r).length)return;if(1==(null==n?void 0:n.redirect)||1==(null==(a=c.params)?void 0:a.redirect)||3==n.isEdit||3==(null==(i=c.params)?void 0:i.isEdit))return;const{frontAddress:o}=r;if(o){const e=window.location.href;let t="?";o.includes("?")&&(t="&");return`${o}${t}redirect_url=${encodeURIComponent(e)}`}},D=e=>{const t=["evaname","evadesc","evast","evadur","evaan","evasit","evaztip"],a={};for(const i in e){const n=e[i];t.includes(i)&&n&&(a[i]=n)}return a},w=t=>{if(!t||!Object.keys(t).length)return;let a=e()||{};y.value&&(a=f.paramsEvaluate);const i={evaluateName:"evaname",evaluateExplain:"evadesc",evaluateStartTime:"evast",evaluateTime:"evadur",evaluateAnswer:"evaan",evaluetaResSituation:"evasit",evaluateZeroTip:"evaztip"},n=["evaluateAnswer","evaluetaResSituation","evaluateZeroTip"];for(const e in t){const s=t[e];if(s&&"evaluateAnswer"!=e&&"string"==typeof s&&s.includes("${")&&"string"==typeof s){const i=s.replace(/\$\{([^}]+)\}/g,((e,t)=>{let i;return t.startsWith("form.")&&(i=a[t.split(".")[1]]),i||""}));t[e]=i}else{let s=a[i[e]];n.includes(e)&&(s="true"===s||1==s),a[i[e]]&&(t[e]=s)}}if(C.value){const e={evaname:"evaluateName",evadesc:"evaluateExplain",evast:"evaluateStartTime",evadur:"evaluateTime",evaan:"evaluateAnswer",evasit:"evaluetaResSituation",evaztip:"evaluateZeroTip"},i=["evaan","evasit","evaztip"];["evaname","evadesc","evast","evadur","evaan","evasit","evaztip"].forEach((n=>{const s=e[n];if(!t[s]){let e=a[n];i.includes(n)&&(e="true"===e||1==e),a[n]&&(t[s]=e)}}))}h(t)},k=e=>{let t=1;return e.map((a=>{const i=O(a);(i||"").replace(/\n/g,""),a.showTitle=a.title,a.val_key=i,a.renderCom=l[a.type],a.isShow=!0,Object.keys(a).forEach((e=>{s.isJSON(a[e])&&"LOCATION"!=a.type&&(a[e]=JSON.parse(a[e]))}));var n;return["LINEBAR","TITLE","PROMPT","IMGCARD","RICH_TEXT"].indexOf(a.type)<0&&!a.hide&&(a.softcode=t++),("SELECT"==(n=a.type)||"RADIO_BLOCK"==n||"CHECKBOX_BLOCK"==n||"SEARCH_CASCADE"==n||"EVALUATE_RADIO_BLOCK"==n||"EVALUATE_CHECKBOX_BLOCK"==n||"EVALUATE_SELECT"==n)&&(((e,t)=>{N(e,t)&&e.forEach(((e,t)=>{"other"!==e.key&&(e.key=t+1),(e.prefix||e.suffix)&&(e.value=e.prefix||e.suffix)}))})(a.options,a.type),"SEARCH_CASCADE"!=a.type&&(a.dbValue?R(a.dbValue,a,e):a.setting.defaultValue&&R(a.setting.defaultValue,a,e))),a})).map((t=>(((e,t)=>{const a=s.isString(t.relationLogic)?JSON.parse(t.relationLogic):t.relationLogic,{condition:i}=a||{};i&&i.length&&(i.forEach((t=>{const a=e.find((e=>e.seq==t.subject_seq));if(!a)return;if(!N(a.options,a.type))return;let i=t.value;Array.isArray(i)?(i=i.map((e=>T(a.options,e))),t.value=i):t.value=T(a.options,i)})),t.relationLogic=a)})(e,t),(e=>{const{nextLogic:t,options:a,type:i}=e||{};if(!t||!N(a,i))return;const{condition:n}=t||{};n&&n.length&&n.forEach((e=>{let t=e.value;Array.isArray(t)?(t=t.map((e=>T(a,e))),e.value=t):e.value=T(a,t)}))})(t),"CHECKBOX_BLOCK"===t.type&&t.dbValue&&!Array.isArray(t.dbValue)&&"customList"===c.type&&(t.dbValue=t.dbValue.split(",").filter((e=>!!e))),t)))},_=e=>{const i={};let n;return e.forEach((e=>{var l,r,o,u;const v=e.val_key,{type:d}=e;let p;if(e.dbValue)p=e.dbValue;else{const{defValType:i,dateType:n}=e.setting||{};if(3==i){const a=null==(r=null==(l=e.setting)?void 0:l.outDefaultValue)?void 0:r.urlKey;if(a){const i=a.split(",");if(i.length>1){const e=i.map((e=>{const a=t(e,f,c.params);return a?decodeURIComponent(a):null})).filter(Boolean);e.length&&(p=e)}else{let a=t(i[0],f,c.params);a&&(a=decodeURIComponent(a),p="CHECKBOX_BLOCK"==e.type?a.split():a)}}}if("DATETIME"===d&&4==i){const e=(null==(o=a[n])?void 0:o.replace("-dd","-DD"))||"yyyy-MM-DD HH:mm:ss";p=m.format(e)}}switch(d){case"LOCATION":i[v]=p||"";break;case"SEARCH_CASCADE":case"UPFILE":case"UPPICTURE":i[v]=p||[];break;case"ADDRESS":i[v]=p||"",f.defaultAddress=p||{};break;case"LABEL":i[v]=p||{},s.isObject(p)?f.labelSelectedList=(null==p?void 0:p.labels)||[]:Array.isArray(p)?f.labelSelectedList=p:f.labelSelectedList=[];break;case"TITLE":i[v]=e.title;break;case"IMGCARD":i[v]=(null==(u=e.setting)?void 0:u.imgUrl)||"";break;case"CHECKBOX_BLOCK":p&&!Array.isArray(p)&&"customList"===c.type?i[v]=p.split(",").filter((e=>!!e)):(n=p||e.setting.defaultValue,s.isJSON(n)&&(n=JSON.parse(n)),i[v]=n);break;default:n=p||e.setting.defaultValue,s.isJSON(n)&&(n=JSON.parse(n)),i[v]=n}})),i};return{initForm:e=>{var t;let{list:a=[],map:i={},isFinished:n=!1}=e;const l=b(a);if(l)return void(window.location.href=l);if(i.maxScore&&(f.maxScore=i.maxScore),f.isFinished=n,e.isNotFilled)return f.spinning=!1,f.hasFrontAddress=!1,void S(!0,"未查询到量表填写记录");if(e.isLackCustomer&&g.info({title:"已设置填写次数限制",content:"请在包含用户信息的环境中打开此量表",maskClosable:!1,onPositiveClick(){d("onCloseSetting")}}),f.config=i,"evaluateResultConfig"in i&&s.isJSON(i.evaluateResultConfig)&&(f.config.evaluateResultConfig=JSON.parse(i.evaluateResultConfig)),"evaluateResultSetting"in i&&s.isJSON(i.evaluateResultSetting)&&(f.config.evaluateResultSetting=JSON.parse(i.evaluateResultSetting),(null==(t=f.config)?void 0:t.randomId)&&f.config.evaluateResultSetting&&(f.config.evaluateResultSetting.evaluateName=f.config.name,f.config.evaluateResultSetting.evaluateExplain=f.config.remark)),f.originConfig=JSON.parse(JSON.stringify(f.config)),c.params&&Object.keys(c.params).length){const e=D(c.params);e&&Object.keys(e).length&&(f.paramsEvaluate=e)}w(f.config.evaluateResultSetting),L(),f.defaultFormArray=JSON.parse(JSON.stringify(a));const r=f.filterArr;a=a.filter((e=>!r.includes(e.type))),f.formArray=k(a||[]),f.form=_(f.formArray),f.rules=A(f.formArray),f.fontSize=e.fontSize,f.spinning=!1,f.hasFrontAddress=!1}}};export{c as ScaleViewInit};
1
+ import{handleQueryParams as e,getQueryVariable as t,formatMap as a}from"../utils/judge-types.js";import i from"./use-noData.js";import"xe-utils";import n from"moment";import s from"../../../../shared/utils/vexutilsExpand.js";import{componentMap as l}from"./use-component.js";import{useEvent as r}from"./use-event.js";import{ScaleViewComputed as o}from"./scaleview-computed.js";import{ScaleViewValidate as u}from"./scaleview-validate.js";import{useDialog as v}from"naive-ui";const c=(c,f,d,p)=>{const m=n(),g=v(),{setNoData:S}=i(),{hasEvaluateResultSetting:E,hasparamsEvaluate:y,hasDefault:C,formKey:O}=o(c,f,p),{formatRules:A}=u(c,f,p),{nextLogicEvent:R}=r(c,f),h=e=>{const t=null==e?void 0:e.evaluateStartTime;t&&!s.isValidDate(new Date(t))&&s.isValidDate(new Date(Number(t)))&&(e.evaluateStartTime=Number(t))},T=()=>{var t;if(!E.value)return!!C.value&&("evaluateResultSetting"in f.config||(f.config.evaluateResultSetting={}),(t=>{let a=e();if(y.value&&(a=f.paramsEvaluate),a.evaname&&(t.evaluateName=a.evaname),a.evadesc&&(t.evaluateExplain=a.evadesc),a.evast&&(t.evaluateStartTime=a.evast),a.evadur&&(t.evaluateTime=a.evadur),a.evaan){const e="true"===a.evaan||1==a.evaan;t.evaluateAnswer=e}if(a.evasit&&(t.evaluetaResSituation=!!a.evasit),a.evaztip){const e=1==a.evaan;t.evaluateZeroTip=e}h(t)})(f.config.evaluateResultSetting),f.showEvaluatePage=!0,void(f.showEvaluateCountdownWrap=!0));const{evaluateResultSetting:a={}}=f.config;if(!a||!Object.keys(a).length)return;f.showEvaluateCountdownWrap=!0;const{evaluateStartTime:i}=a,{evaluateName:n}=(null==(t=f.originConfig)?void 0:t.evaluateResultSetting)||{};if(i)return!(!s.isValidDate(new Date(i))&&!n)&&void(f.showEvaluatePage=!0);f.showEvaluatePage=!0},L=(e,t)=>{const a=e.find((e=>t===e.value));return a?a.key:t},N=(e,t)=>{if(["RADIO_BLOCK","CHECKBOX_BLOCK"].includes(t)&&e&&(e&&s.isJSON(e)&&(e=JSON.parse(e)),e.length))return!0},b=t=>{var a,i;if(!t||!t.length)return;const n=e();if((null==c?void 0:c.noBtn)||(null==n?void 0:n.noBtn))return;const l=t.find((e=>"FRONT_ADDRESS"===e.type));if(!l||!Object.keys(l).length)return;let r;if(l.setting&&s.isJSON(l.setting)&&(r=JSON.parse(l.setting)),!r||!Object.keys(r).length)return;if(1==(null==n?void 0:n.redirect)||1==(null==(a=c.params)?void 0:a.redirect)||3==n.isEdit||3==(null==(i=c.params)?void 0:i.isEdit))return;const{frontAddress:o}=r;if(o){const e=window.location.href;let t="?";o.includes("?")&&(t="&");return`${o}${t}redirect_url=${encodeURIComponent(e)}`}},D=e=>{const t=["evaname","evadesc","evast","evadur","evaan","evasit","evaztip"],a={};for(const i in e){const n=e[i];t.includes(i)&&n&&(a[i]=n)}return a},w=t=>{if(!t||!Object.keys(t).length)return;let a=e()||{};y.value&&(a=f.paramsEvaluate);const i={evaluateName:"evaname",evaluateExplain:"evadesc",evaluateStartTime:"evast",evaluateTime:"evadur",evaluateAnswer:"evaan",evaluetaResSituation:"evasit",evaluateZeroTip:"evaztip"},n=["evaluateAnswer","evaluetaResSituation","evaluateZeroTip"];for(const e in t){const s=t[e];if(s&&"evaluateAnswer"!=e&&"string"==typeof s&&s.includes("${")&&"string"==typeof s){const i=s.replace(/\$\{([^}]+)\}/g,((e,t)=>{let i;return t.startsWith("form.")&&(i=a[t.split(".")[1]]),i||""}));t[e]=i}else{let s=a[i[e]];n.includes(e)&&(s="true"===s||1==s),a[i[e]]&&(t[e]=s)}}if(C.value){const e={evaname:"evaluateName",evadesc:"evaluateExplain",evast:"evaluateStartTime",evadur:"evaluateTime",evaan:"evaluateAnswer",evasit:"evaluetaResSituation",evaztip:"evaluateZeroTip"},i=["evaan","evasit","evaztip"];["evaname","evadesc","evast","evadur","evaan","evasit","evaztip"].forEach((n=>{const s=e[n];if(!t[s]){let e=a[n];i.includes(n)&&(e="true"===e||1==e),a[n]&&(t[s]=e)}}))}h(t)},k=e=>{let t=1;return e.map((a=>{const i=O(a);(i||"").replace(/\n/g,""),a.showTitle=a.title,a.val_key=i,a.renderCom=l[a.type],a.isShow=!0,Object.keys(a).forEach((e=>{s.isJSON(a[e])&&"LOCATION"!=a.type&&(a[e]=JSON.parse(a[e]))}));var n;return["LINEBAR","TITLE","PROMPT","IMGCARD","RICH_TEXT"].indexOf(a.type)<0&&!a.hide&&(a.softcode=t++),("SELECT"==(n=a.type)||"RADIO_BLOCK"==n||"CHECKBOX_BLOCK"==n||"SEARCH_CASCADE"==n||"EVALUATE_RADIO_BLOCK"==n||"EVALUATE_CHECKBOX_BLOCK"==n||"EVALUATE_SELECT"==n)&&(((e,t)=>{N(e,t)&&e.forEach(((e,t)=>{"other"!==e.key&&(e.key=t+1),(e.prefix||e.suffix)&&(e.value=e.prefix||e.suffix)}))})(a.options,a.type),"SEARCH_CASCADE"!=a.type&&(a.dbValue?R(a.dbValue,a,e):a.setting.defaultValue&&R(a.setting.defaultValue,a,e))),a})).map((t=>(((e,t)=>{const a=s.isString(t.relationLogic)?JSON.parse(t.relationLogic):t.relationLogic,{condition:i}=a||{};i&&i.length&&(i.forEach((t=>{const a=e.find((e=>e.seq==t.subject_seq));if(!a)return;if(!N(a.options,a.type))return;let i=t.value;Array.isArray(i)?(i=i.map((e=>L(a.options,e))),t.value=i):t.value=L(a.options,i)})),t.relationLogic=a)})(e,t),(e=>{const{nextLogic:t,options:a,type:i}=e||{};if(!t||!N(a,i))return;const{condition:n}=t||{};n&&n.length&&n.forEach((e=>{let t=e.value;Array.isArray(t)?(t=t.map((e=>L(a,e))),e.value=t):e.value=L(a,t)}))})(t),"CHECKBOX_BLOCK"===t.type&&t.dbValue&&!Array.isArray(t.dbValue)&&"customList"===c.type&&(t.dbValue=t.dbValue.split(",").filter((e=>!!e))),t)))},_=e=>{const i={};let l;return e.forEach((e=>{var r,o,u,v,d;const p=e.val_key,{type:g}=e;let S;if(e.dbValue)S=e.dbValue;else{const{defValType:i,dateType:s}=e.setting||{};if(3==i){const a=null==(o=null==(r=e.setting)?void 0:r.outDefaultValue)?void 0:o.urlKey;if(a){const i=a.split(",");if(i.length>1){const e=i.map((e=>{const a=t(e,f,c.params);return a?decodeURIComponent(a):null})).filter(Boolean);e.length&&(S=e)}else{let a=t(i[0],f,c.params);a&&(a=decodeURIComponent(a),S="CHECKBOX_BLOCK"==e.type?a.split():a)}}}if("DATETIME"===g&&4==i){const t=(null==(u=a[s])?void 0:u.replace("-dd","-DD"))||"yyyy-MM-DD HH:mm:ss",i=m.format(t);if(1==(null==(v=e.setting)?void 0:v.startToStop)){S=[i,n().endOf("day").format(t)]}else S=i}}switch(g){case"LOCATION":i[p]=S||"";break;case"SEARCH_CASCADE":case"UPFILE":case"UPPICTURE":i[p]=S||[];break;case"ADDRESS":i[p]=S||"",f.defaultAddress=S||{};break;case"LABEL":i[p]=S||{},s.isObject(S)?f.labelSelectedList=(null==S?void 0:S.labels)||[]:Array.isArray(S)?f.labelSelectedList=S:f.labelSelectedList=[];break;case"TITLE":i[p]=e.title;break;case"IMGCARD":i[p]=(null==(d=e.setting)?void 0:d.imgUrl)||"";break;case"CHECKBOX_BLOCK":S&&!Array.isArray(S)&&"customList"===c.type?i[p]=S.split(",").filter((e=>!!e)):(l=S||e.setting.defaultValue,s.isJSON(l)&&(l=JSON.parse(l)),i[p]=l);break;default:l=S||e.setting.defaultValue,s.isJSON(l)&&(l=JSON.parse(l)),i[p]=l}})),i};return{initForm:e=>{var t;let{list:a=[],map:i={},isFinished:n=!1}=e;const l=b(a);if(l)return void(window.location.href=l);if(i.maxScore&&(f.maxScore=i.maxScore),f.isFinished=n,e.isNotFilled)return f.spinning=!1,f.hasFrontAddress=!1,void S(!0,"未查询到量表填写记录");if(e.isLackCustomer&&g.info({title:"已设置填写次数限制",content:"请在包含用户信息的环境中打开此量表",maskClosable:!1,onPositiveClick(){d("onCloseSetting")}}),f.config=i,"evaluateResultConfig"in i&&s.isJSON(i.evaluateResultConfig)&&(f.config.evaluateResultConfig=JSON.parse(i.evaluateResultConfig)),"evaluateResultSetting"in i&&s.isJSON(i.evaluateResultSetting)&&(f.config.evaluateResultSetting=JSON.parse(i.evaluateResultSetting),(null==(t=f.config)?void 0:t.randomId)&&f.config.evaluateResultSetting&&(f.config.evaluateResultSetting.evaluateName=f.config.name,f.config.evaluateResultSetting.evaluateExplain=f.config.remark)),f.originConfig=JSON.parse(JSON.stringify(f.config)),c.params&&Object.keys(c.params).length){const e=D(c.params);e&&Object.keys(e).length&&(f.paramsEvaluate=e)}w(f.config.evaluateResultSetting),T(),f.defaultFormArray=JSON.parse(JSON.stringify(a));const r=f.filterArr;a=a.filter((e=>!r.includes(e.type))),f.formArray=k(a||[]),f.form=_(f.formArray),f.rules=A(f.formArray),f.fontSize=e.fontSize,f.spinning=!1,f.hasFrontAddress=!1}}};export{c as ScaleViewInit};
@@ -1 +1 @@
1
- import{h as t}from"vue";import{isSortItem as e,isOnlyOptions as i,isEvaluation as o,getQueryVariable as n}from"../utils/judge-types.js";import"xe-utils";import s from"moment";import r from"../../../../shared/utils/vexutilsExpand.js";import{ScaleViewComputed as a}from"./scaleview-computed.js";import{useDialog as l,useMessage as u}from"naive-ui";const f=(f,d,m,p)=>{const c=l(),v=u(),{formRef:g,countdownDom:y}=p,{showEvent:C,formKey:h,showEvaluateEntry:b,scaleEdit:O,showEvaluateCoundownPage:A,skipCover:S}=a(f,d,p),T=()=>{const t=d.defaultFormArray.find((t=>"SPREAD_PARAMS"===t.type));if(t){r.isJSON(t.setting)&&(t.setting=JSON.parse(t.setting));const e=h(t);d.submitForm[e]=t.setting.spreadParams.domains.map((t=>{const e={};return"1"==t.valueType?e[t.name]=t.value:"2"==t.valueType&&(e[t.name]=n(t.value,d,f.params)),e}))}const e=d.defaultFormArray.find((t=>"CHECKBOX_BLOCK"==t.type));e&&Array.isArray(d.form[e.title])&&"customList"===f.type&&(d.form[e.title]=d.form[e.title].join(","));const i=x();let o;if("customList"===f.type)o={definedListId:f.ids.guage_id,dbId:f.ids.db_id,scoreJson:JSON.stringify(i)};else{const{guageId:t,randomId:e}=d.config;o=Object.assign(f.params,{guageId:t,scoreJson:JSON.stringify(i),randomId:e})}d.shareId&&(o.shareId=d.shareId);const s=d.defaultFormArray.find((t=>"SUCCESS_TIP"===t.type));if(s){const t=r.isJSON(s.setting)?JSON.parse(s.setting):s.setting;o.tipSetting=JSON.stringify({tipMode:t.tipMode,tipType:t.tipType,tipText:t.tipText,tipApi:t.tipApi})}const a=d.defaultFormArray.find((t=>"CALLBACK_INTERFACE"===t.type));let l=!1;a&&(l=C(a,!0));return{params:o,hasCallbackItem:a,isCallback:l}},E=(t,e)=>{if(!e.length)return e;const{type:o,options:n,scoreConfigs:s}=t;let r=n;if("EVALUATE_CHECKBOX_BLOCK"===o&&(r=(null==s?void 0:s.scoreRules)||[]),!r.length)return e;const a=i(o)?"key":"value",l=[];return r.forEach((t=>{const i=t[a];e.includes(i)&&l.push(i)})),l},x=()=>{const t=Object.assign({},d.form,d.submitForm),o={};if(!Object.keys(t).length)return{};for(const n in t){const r=d.formArray.find((t=>h(t)==n));if(n&&r){let a=n,l=t[n]?t[n]:null;if(r&&r.databaseTitle&&(a=r.databaseTitle),"customList"==f.type&&r&&r.setting&&1!=r.setting.startToStop&&t[n]&&"DATETIME"==r.type&&(r.setting&&"time"==r.setting.dateType&&t[n]&&(t[n]=s().format("YYYY-MM-DD ")+t[n]),r.setting&&"date"==r.setting.dateType&&t[n]&&(t[n]=s(t[n]).format("YYYY-MM-DD ")+s().format("HH:mm:ss"))),e(r)&&l&&(l=E(r,l),l=(null==l?void 0:l.length)?l:null),i(r.type)&&l){const{options:t}=r,e=r.val_key,i=d.choiceComObj[e];if("RADIO_BLOCK"===r.type&&l&&(l=I(l,t,i)),"CHECKBOX_BLOCK"===r.type&&(null==l?void 0:l.length)){l=w(l,t,i)}}o[a]=l}else o[n]=t[n]}return o},w=(t,e,i)=>{const o=[];let n,s=0;for(;s<t.length;s++){n=t[s];const r=e.find(((t,e)=>e+1===n));if(r&&!r.prefix&&!r.suffix){o.push(r.value);continue}const a=I(n,e,i);o.push(a)}return o},I=(t,e,i)=>{const{othersText:o,optionsPreSuffixObj:n={}}=i||{};if("other"===t)return o||"其他";const s=e.find(((e,i)=>i+1===t));if(!s)return;if(!s.prefix&&!s.suffix)return s.value;let r=n[t]||"";return s.prefix?r=s.prefix+r:r+=s.suffix,r},j=()=>new Promise((t=>{var e;null==(e=g.value)||e.validate((e=>{var i;if(e){console.log(e);const o=(null==(i=e[0])?void 0:i[0])||{};let n=o.field;const s=o.message,r=d.formArray.find((t=>t.databaseTitle===n));return r&&(n=r.title),v.error(n+s),t(!1),!1}{const e=T();t(e)}}))})),L=e=>{c.warning({title:"温馨提示",content:()=>t("div",{style:{paddingLeft:"30px"}},e),positiveText:"确定",negativeText:"取消",maskClosable:!1,closable:!1,positiveButtonProps:{type:"primary"},onPositiveClick:async()=>{const t=await j();m("onSubmit",t)},onNegativeClick(){}})};return{submitMethod:T,confirmSubmit:L,onSubmitForm:j,onSubmitData:()=>{var t;if(!d.formArray.find((t=>o(t.type))))return void L("确认要提交吗?");const{evaluateResultSetting:e}=d.config;if(!e||!Object.keys(e).length&&!b.value||O.value)return void L("确认要结束测评吗?");if("formIframe"==f.openType&&b.value)return void m("submitNoRequest");let i="确定要提前结束测评吗?";if(A.value&&(null==(t=y.value)?void 0:t.getCountdownObj)){const t=y.value.getCountdownObj(),{setAnswered:e,totalLen:o}=t;e<o?i="存在未作答的题目,确定要提前结束测评吗?":!(null==d?void 0:d.showEvaluateCountdown)&&(i="确认要结束测评吗?")}S.value&&!(null==d?void 0:d.showEvaluateCountdown)&&(i="确认要结束测评吗?"),L(i)},handleScoreJson:x}};export{f as ScaleViewSubmit};
1
+ import{h as t}from"vue";import{isSortItem as e,isOnlyOptions as i,isEvaluation as o,getQueryVariable as n}from"../utils/judge-types.js";import"xe-utils";import s from"moment";import r from"../../../../shared/utils/vexutilsExpand.js";import{ScaleViewComputed as a}from"./scaleview-computed.js";import{useDialog as l,useMessage as u}from"naive-ui";const f=(f,d,m,p)=>{const c=l(),g=u(),{formRef:v,countdownDom:y}=p,{showEvent:C,formKey:h,showEvaluateEntry:b,scaleEdit:O,showEvaluateCoundownPage:A,skipCover:S,hasScore:T}=a(f,d,p),E=()=>{const t=d.defaultFormArray.find((t=>"SPREAD_PARAMS"===t.type));if(t){r.isJSON(t.setting)&&(t.setting=JSON.parse(t.setting));const e=h(t);d.submitForm[e]=t.setting.spreadParams.domains.map((t=>{const e={};return"1"==t.valueType?e[t.name]=t.value:"2"==t.valueType&&(e[t.name]=n(t.value,d,f.params)),e}))}const e=d.defaultFormArray.find((t=>"CHECKBOX_BLOCK"==t.type));e&&Array.isArray(d.form[e.title])&&"customList"===f.type&&(d.form[e.title]=d.form[e.title].join(","));const i=I();let o;if("customList"===f.type)o={definedListId:f.ids.guage_id,dbId:f.ids.db_id,scoreJson:JSON.stringify(i)};else{const{guageId:t,randomId:e}=d.config;o=Object.assign(f.params,{guageId:t,scoreJson:JSON.stringify(i),randomId:e})}d.shareId&&(o.shareId=d.shareId);const s=d.defaultFormArray.find((t=>"SUCCESS_TIP"===t.type));if(s){const t=r.isJSON(s.setting)?JSON.parse(s.setting):s.setting;o.tipSetting=JSON.stringify({tipMode:t.tipMode,tipType:t.tipType,tipText:t.tipText,tipApi:t.tipApi})}const a=d.defaultFormArray.find((t=>"CALLBACK_INTERFACE"===t.type));let l=!1;a&&(l=C(a,!0));return{params:o,hasCallbackItem:a,isCallback:l}},x=(t,e)=>{if(!e.length)return e;const{type:o,options:n,scoreConfigs:s}=t;let r=n;if("EVALUATE_CHECKBOX_BLOCK"===o&&(r=(null==s?void 0:s.scoreRules)||[]),!r.length)return e;const a=i(o)?"key":"value",l=[];return r.forEach((t=>{const i=t[a];e.includes(i)&&l.push(i)})),l},I=()=>{const t=Object.assign({},d.form,d.submitForm),o={};if(!Object.keys(t).length)return{};for(const n in t){const r=d.formArray.find((t=>h(t)==n));if(n&&r){let a=n,l=t[n]?t[n]:null;if(r&&r.databaseTitle&&(a=r.databaseTitle),"customList"==f.type&&r&&r.setting&&1!=r.setting.startToStop&&t[n]&&"DATETIME"==r.type&&(r.setting&&"time"==r.setting.dateType&&t[n]&&(t[n]=s().format("YYYY-MM-DD ")+t[n]),r.setting&&"date"==r.setting.dateType&&t[n]&&(t[n]=s(t[n]).format("YYYY-MM-DD ")+s().format("HH:mm:ss"))),e(r)&&l&&(l=x(r,l),l=(null==l?void 0:l.length)?l:null),i(r.type)&&l){const{options:t}=r,e=r.val_key,i=d.choiceComObj[e];if("RADIO_BLOCK"===r.type&&l&&(l=j(l,t,i)),"CHECKBOX_BLOCK"===r.type&&(null==l?void 0:l.length)){l=w(l,t,i)}}o[a]=l}else o[n]=t[n]}return o},w=(t,e,i)=>{const o=[];let n,s=0;for(;s<t.length;s++){n=t[s];const r=e.find(((t,e)=>e+1===n));if(r&&!r.prefix&&!r.suffix){o.push(r.value);continue}const a=j(n,e,i);o.push(a)}return o},j=(t,e,i)=>{const{othersText:o,optionsPreSuffixObj:n={}}=i||{};if("other"===t)return o||"其他";const s=e.find(((e,i)=>i+1===t));if(!s)return;if(!s.prefix&&!s.suffix)return s.value;let r=n[t]||"";return s.prefix?r=s.prefix+r:r+=s.suffix,r},L=()=>new Promise((t=>{var e;null==(e=v.value)||e.validate((e=>{var i;if(e){console.log(e);const o=(null==(i=e[0])?void 0:i[0])||{};let n=o.field;const s=o.message,r=d.formArray.find((t=>t.databaseTitle===n));return r&&(n=r.title),g.error(n+s),t(!1),!1}{const e=E();t(e)}}))})),_=e=>{c.warning({title:"温馨提示",content:()=>t("div",{style:{paddingLeft:"30px"}},e),positiveText:"确定",negativeText:"取消",maskClosable:!1,closable:!1,positiveButtonProps:{type:"primary"},onPositiveClick:async()=>{const t=await L();m("onSubmit",t)},onNegativeClick(){}})};return{submitMethod:E,confirmSubmit:_,onSubmitForm:L,onSubmitData:()=>{var t;if(!d.formArray.find((t=>o(t.type))))return void _("确认要提交吗?");const{evaluateResultSetting:e}=d.config;if(!e||!Object.keys(e).length&&!b.value||O.value)return void _("确认要结束测评吗?");if("formIframe"==f.openType&&b.value)return void m("submitNoRequest");let i="确定要提前结束测评吗?";if(A.value&&(null==(t=y.value)?void 0:t.getCountdownObj)){const t=y.value.getCountdownObj(),{setAnswered:e,totalLen:o}=t;if(e<o)i="存在未作答的题目,确定要提前结束测评吗?";else{!(d.showEvaluateCountdown&&!S.value)&&(i="确认要结束测评吗?")}}S.value&&T.value&&(i="确认要结束测评吗?"),_(i)},handleScoreJson:I}};export{f as ScaleViewSubmit};
@@ -6,8 +6,16 @@ export declare const handleQueryParams: () => {};
6
6
  export declare const getQueryVariable: (variable: any, state: any, params: any) => any;
7
7
  export declare const formatMap: {
8
8
  datetime: string;
9
+ datehour: string;
9
10
  date: string;
10
11
  time: string;
11
12
  hour: string;
12
- datehour: string;
13
13
  };
14
+ export declare const valueReg: {
15
+ datetime: RegExp;
16
+ datehour: RegExp;
17
+ date: RegExp;
18
+ time: RegExp;
19
+ hour: RegExp;
20
+ };
21
+ export declare const transDbvalueFormat: Map<string, string[]>;
@@ -1 +1 @@
1
- const e=e=>["RADIO_BLOCK","CHECKBOX_BLOCK"].includes(e),t=e=>{const{type:t,targetSource:o}=e;return!!["CHECKBOX_BLOCK","EVALUATE_CHECKBOX_BLOCK"].includes(t)||"SELECT"===t&&!(null==o?void 0:o.target_id)},o=e=>["TITLE","LINEBAR","PROMPT","IMGCARD","RICH_TEXT"].includes(e),n=e=>["EVALUATE_RADIO_BLOCK","EVALUATE_CHECKBOX_BLOCK","EVALUATE_SELECT","EVALUATE_INPUT"].includes(e),r=()=>{var e,t;const o={};let n=(null==(e=window.location.search.split("?"))?void 0:e[1])||(null==(t=window.location.hash.split("?"))?void 0:t[1]);if(!n)return{};n=n.replace(/\+/g,"%20");for(const[e,t]of new URLSearchParams(n).entries())o[e]=decodeURIComponent(t);return o},d=(e,t,o)=>{let n={};return n="layout"==t.source?o:r()||{},n&&n[e]||!1},E={datetime:"yyyy-MM-dd HH:mm:ss",date:"yyyy-MM-dd",time:"HH:mm:ss",hour:"HH:mm",datehour:"yyyy-MM-dd HH:mm"};export{E as formatMap,d as getQueryVariable,r as handleQueryParams,o as isCollection,n as isEvaluation,e as isOnlyOptions,t as isSortItem};
1
+ const e=e=>["RADIO_BLOCK","CHECKBOX_BLOCK"].includes(e),d=e=>{const{type:d,targetSource:t}=e;return!!["CHECKBOX_BLOCK","EVALUATE_CHECKBOX_BLOCK"].includes(d)||"SELECT"===d&&!(null==t?void 0:t.target_id)},t=e=>["TITLE","LINEBAR","PROMPT","IMGCARD","RICH_TEXT"].includes(e),o=e=>["EVALUATE_RADIO_BLOCK","EVALUATE_CHECKBOX_BLOCK","EVALUATE_SELECT","EVALUATE_INPUT"].includes(e),r=()=>{var e,d;const t={};let o=(null==(e=window.location.search.split("?"))?void 0:e[1])||(null==(d=window.location.hash.split("?"))?void 0:d[1]);if(!o)return{};o=o.replace(/\+/g,"%20");for(const[e,d]of new URLSearchParams(o).entries())t[e]=decodeURIComponent(d);return t},a=(e,d,t)=>{let o={};return o="layout"==d.source?t:r()||{},o&&o[e]||!1},i={datetime:"yyyy-MM-dd HH:mm:ss",datehour:"yyyy-MM-dd HH:mm",date:"yyyy-MM-dd",time:"HH:mm:ss",hour:"HH:mm"},u={datetime:/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,datehour:/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})$/,date:/^(\d{4})-(\d{2})-(\d{2})$/,time:/^(\d{2}):(\d{2}):(\d{2})$/,hour:/^(\d{2}):(\d{2})$/},n=new Map([["datetime",["datetime","datehour","date","time","hour"]],["datehour",["datetime","datehour","date","time","hour"]],["date",["date"]],["time",["time","hour"]],["hour",["time","hour"]]]);export{i as formatMap,a as getQueryVariable,r as handleQueryParams,t as isCollection,o as isEvaluation,e as isOnlyOptions,d as isSortItem,n as transDbvalueFormat,u as valueReg};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.1.48-beta.14",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.48-beta.14",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
1
+ var e="@cnhis-design-vue/shared",i="3.1.48-beta.15",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.48-beta.15",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.48-beta.14",
3
+ "version": "3.1.48-beta.15",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -63,5 +63,5 @@
63
63
  "iOS 7",
64
64
  "last 3 iOS versions"
65
65
  ],
66
- "gitHead": "f26db2176840ea9b0b7f1080dc31c0026c718905"
66
+ "gitHead": "71a6e8c386b0c5d79271eb00d54a6c2a8b3fe7ab"
67
67
  }