cnhis-design-vue 3.1.50 → 3.1.51-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -87
- package/es/components/base-search/index.d.ts +13 -8
- package/es/components/base-search/src/index.vue.d.ts +13 -8
- package/es/components/base-search/src/index.vue2.js +1 -1
- package/es/components/classification/index.d.ts +57 -15
- package/es/components/classification/src/components/search-filter/index.vue.d.ts +57 -15
- package/es/components/classification/src/components/set-classification/index.vue.d.ts +57 -15
- package/es/components/classification/src/index.vue.d.ts +57 -15
- package/es/components/expand-field/src/components/form.vue2.js +1 -1
- package/es/components/expand-field/src/index.vue2.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCommon.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/useCommon.js +1 -1
- package/es/components/field-set/index.d.ts +1 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/form-config/index.d.ts +174 -25
- package/es/components/form-config/src/FormConfig.vue.d.ts +175 -26
- package/es/components/form-config/src/FormConfig.vue2.js +1 -1
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +4 -4
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +13 -10
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +121 -0
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.js +1 -0
- package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -0
- package/es/components/form-config/src/constants/index.d.ts +19 -1
- package/es/components/form-config/src/constants/index.js +1 -1
- package/es/components/form-config/src/hooks/useDataNormalize.d.ts +1 -1
- package/es/components/form-config/src/hooks/useDataNormalize.js +1 -1
- package/es/components/form-config/src/types/index.d.ts +7 -3
- package/es/components/form-config/style/index.css +1 -1
- package/es/components/form-render/index.d.ts +4 -4
- package/es/components/form-render/src/FormRender.vue.d.ts +2 -2
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +4 -4
- package/es/components/form-render/src/components/renderer/select.d.ts +10 -1
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +2 -2
- package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
- package/es/components/form-render/src/hooks/useLowCodeReactions.d.ts +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +2 -1
- package/es/components/form-render/src/types/index.d.ts +1 -19
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +1 -1
- package/es/components/iho-table/src/types/index.d.ts +2 -1
- package/es/components/index.css +1 -1
- package/es/components/info-header/index.d.ts +13 -13
- package/es/components/info-header/src/InfoHeader.vue.d.ts +13 -13
- package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +1 -1
- package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +1 -1
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +5 -5
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +4 -4
- package/es/components/quick-search/index.d.ts +13 -8
- package/es/components/quick-search/src/index.vue.d.ts +13 -8
- package/es/components/quick-search/src/index.vue2.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
- package/es/components/shortcut-setter/index.d.ts +6 -5
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -5
- package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +0 -3
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +52 -7
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue2.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/InputFilter.vue.d.ts +34 -2
- package/es/components/table-filter/src/components/classify-filter/components/InputFilter.vue2.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +36 -4
- package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.d.ts +1 -6
- package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +57 -15
- package/es/components/table-filter/src/components/classify-filter/index.vue2.js +1 -1
- package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue.d.ts +58 -0
- package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue.js +1 -0
- package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue2.js +1 -0
- package/es/components/table-filter/src/components/render-widget/components/index.d.ts +56 -1
- package/es/components/table-filter/src/components/render-widget/components/index.js +1 -1
- package/es/components/table-filter/src/components/render-widget/index.vue.d.ts +4 -1
- package/es/components/table-filter/src/components/render-widget/index.vue.js +1 -1
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +55 -1
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
- package/es/components/table-filter/src/hooks/useAdvanced.d.ts +2 -0
- package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
- package/es/components/table-filter/src/hooks/useRenderWidget.d.ts +1 -7
- package/es/components/table-filter/src/hooks/useRenderWidget.js +1 -1
- package/es/components/table-filter/src/tool/transformData.d.ts +1 -6
- package/es/components/table-filter/src/tool/transformData.js +1 -1
- package/es/components/table-filter/src/types/index.d.ts +16 -1
- package/es/env.d.ts +25 -25
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/components/InputNumberSlash/InputNumberSlash.d.ts +19 -1
- package/es/shared/components/InputNumberSlash/InputNumberSlash.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/es/shared/types/business.d.ts +20 -0
- package/es/shared/utils/business.d.ts +1 -2
- package/es/shared/utils/index.d.ts +3 -3
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- package/es/shared/utils/fabricjs/index.d.ts +0 -6823
- package/es/shared/utils/tapable/index.d.ts +0 -139
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as i,createElementVNode as n,createCommentVNode as o,createVNode as s,unref as
|
|
1
|
+
import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as i,createElementVNode as n,createCommentVNode as o,createVNode as s,unref as r,withCtx as d,Fragment as c,renderList as u,createTextVNode as m,toDisplayString as p,createBlock as f,withModifiers as v}from"vue";import{useMessage as h,NGrid as _,NGridItem as g,NTooltip as y,NIcon as k,NPopconfirm as C,NButton as x}from"naive-ui";import{Brush as D}from"@vicons/ionicons5";import w from"./components/form.vue.js";import I from"./hooks/useAsyncData.js";import{InjectionExpandFieldApiConfig as N}from"./constants/index.js";const b={class:"tableset-expand-field"},M={class:"list"},z={class:"table-modal-list"},A={class:"list-content"},S=n("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[n("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),n("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),j={class:"footer"};var F=t({__name:"index",props:{id:{type:String,default:""},expandFieldApiConfig:{type:Object},tableData:{type:Array,default:()=>[]},orgId:{type:String,default:""}},emits:["closeModal"],setup(t,{emit:F}){const O=t,V=h(),{deleteExtendFieldById:B}=I();e(N,O.expandFieldApiConfig);const E=[{title:"字段标题",columnName:"name",span:3},{title:"字段键名",columnName:"code",span:3},{title:"字段类型",columnName:"html_type",span:3},{title:"问号提示",columnName:"remark",span:4},{title:"创建时间",columnName:"createdDate",span:4},{title:"修改时间",columnName:"updatedDate",span:4},{title:"操作",columnName:"operator",span:3}],P=l(!1),L=l("add"),U=l({});function q(){F("closeModal")}function G(){P.value=!0,L.value="add",U.value={}}function H(){P.value=!1}return(e,l)=>(a(),i("div",b,[n("div",M,[n("div",z,[o(' <div class="list-title">\r\n\t\t\t\t\t<span class="list-title-item" v-for="titleItem in filedList" :key="titleItem.columnName">\r\n\t\t\t\t\t\t{{ titleItem.title }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</div> '),s(r(_),{cols:24,class:"list-title"},{default:d((()=>[(a(),i(c,null,u(E,(t=>s(r(g),{span:t.span,class:"list-title-item",key:t.columnName},{default:d((()=>[m(p(t.title),1)])),_:2},1032,["span"]))),64))])),_:1}),n("div",A,[(a(!0),i(c,null,u(t.tableData,((t,e)=>(a(),f(r(_),{key:e,class:"list-content-block"},{default:d((()=>[s(r(g),{span:3,title:t.name,class:"list-content-item"},{default:d((()=>[m(p(t.name),1)])),_:2},1032,["title"]),s(r(g),{span:3,title:t.code,class:"list-content-item"},{default:d((()=>[m(p(t.code),1)])),_:2},1032,["title"]),s(r(g),{span:3,title:t.html_type,class:"list-content-item"},{default:d((()=>[m(p(t.html_type),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.remark,class:"list-content-item"},{default:d((()=>[m(p(t.remark),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.createdDate,class:"list-content-item"},{default:d((()=>[m(p(t.createdDate),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.updatedDate,class:"list-content-item"},{default:d((()=>[m(p(t.updatedDate),1)])),_:2},1032,["title"]),s(r(g),{span:3,class:"list-content-item"},{default:d((()=>[s(r(y),{duration:0},{trigger:d((()=>[s(r(k),{component:r(D),onClick:v((e=>{return l=t,P.value=!0,L.value="edit",void(U.value={...l});var l}),["prevent","stop"])},null,8,["component","onClick"])])),default:d((()=>[m(" 编辑 ")])),_:2},1024),s(r(y),{duration:0},{trigger:d((()=>[s(r(C),{onPositiveClick:e=>async function(t){try{const e=await B(t,O.expandFieldApiConfig);if("SUCCESS"!==(null==e?void 0:e.result))return void V.error((null==e?void 0:e.resultMsg)||"删除失败");V.success("删除成功")}catch(t){V.error(t)}}(t)},{trigger:d((()=>[s(r(k),null,{default:d((()=>[S])),_:1})])),default:d((()=>[m(" 是否确认删除? ")])),_:2},1032,["onPositiveClick"])])),default:d((()=>[m(" 删除 ")])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])]),n("div",j,[s(r(x),{onClick:q},{default:d((()=>[m("取消")])),_:1}),s(r(x),{type:"info",onClick:G},{default:d((()=>[m("增加字段")])),_:1})])]),s(w,{visible:P.value,formItemData:U.value,formOntype:L.value,id:t.id,orgId:t.orgId,onCancelModal:H},null,8,["visible","formItemData","formOntype","id","orgId"])]))}});export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as
|
|
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"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";import"@vueuse/core";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:E,getXValue:G,getYValue:M}=c(b),{getEqualXTypes:T,handleAddPrevent:Y,isGridLimit:L,setPrevAndNextPoint:X}=h(x,j,b),{xAxis:A,grid:I,originX:H,originY:W,xCellWidth:N,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:R,rightScales:$,yCellHeight:B,endX:F,scaleValues:q,canvasWidth:z,borderStyle:J,rightAddAreaWidth:K,event:Q,originYCervix:U,other:Z,canvasHeight:_}=b,ee=k(q),te=new Set;function oe(){ee.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=se(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const o=se(P,e);h=o?t([...s,...o],{...v}):null}let E,T;if(d.childbirth){const e=s[1]+B;E=o([s[0],s[1],e],w),c.push(E),T=n([s[0]+N/2,e-B/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(T)}const Y=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:Y,rightLine:h,arrowGroup:E,arrowGroupText:T,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};Y?p=r(k,{left:Y.get("x2"),top:Y.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){Q.hovered&&(e.on("mouseover",(()=>{le(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{re(e),function(e){var t,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+N/2,top:e.top+B/2})}(e),Q.hovered&&le(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,o={...e.origin,data:{...e.origin.data,time:G(e.left),value:M(t,e.top)}};x.value.discardActiveObject(),j("change",o),ne(o,"change")}}))}(p),a.push(p),te.add(p))}(se(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));X(e),Promise.all(c).then((o=>{x.value.add(...t,...e,...o),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:o,data:n,index:i,key:r}=e,l=ee.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=n;break;default:{const e=g(n.time,l.data);l.data.splice(e,0,n);break}}ie()}function ie(){var e;te.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...te]))),te.clear(),oe()}function re(e){const t=e.prevPoint?e.prevPoint.left:H,o=e.nextPoint?e.nextPoint.left:F;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<U&&e.set("top",U),e.top<W&&e.set("top",W),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>o&&e.set("left",o)}function le(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:M(n,e.top)}`,`时间 ${G(e.left).slice(-5)}`],C.show=!0}function se(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=E(t.key,t.range,e.value);return[o,n<W?W:n>O?O:n]}}function ae(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...J,width:z-D-K-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,o="left"){let r="left"===o?D:F;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),E=S.length;S.forEach(((e,o)=>{const{lineXMain:n,lineXSub:i,textLeft:l}=d(m,r,c),s=O-o*B*k,a=0===o?O-8:o!==S.length-1||W||U&&"FHR"!==v?s:W+8;!w||(0===o||o===E-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,o,n,i,s,B,W,E))}));const G=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),M=n([P,W>0?W-B/2:B/2],{value:String(h),...i,...g}),T=new e.Group([...C,...j,G,...M?[M]:[]],{objectCaching:!1,...s});x.value.add(T),T.sendToBack(),r+=c}))}t(R),t($,"right")}(),function(){const{show:t,startTime:o,range:r=[0,23],position:l="top",style:a}=A.time,{show:u,range:c=[0,23],position:d,style:f}=A.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=H+N/2,y=B/2;for(let e=0;e<I.mainXCell;e++){if(t){const t=0===e?+o.slice(11,13):ae(p.at(-1),r);p.push(t);const s="top"===l?W-y:O+y;g.push(n([m+e*N,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const o="top"===d?y:_-y;v.push(n([m+e*N,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(Z),n=[],i={},r=ee.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:o,range:n}=r||{},i=E(o,n,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[F-H,e*(F-H)+t];let c=[],d=[];function f([o,n]){return Math.abs(n-e*o-t)<=1}function p([e,t]){const[o,n]=[...h([e,t])];return o>=H&&o<=F&&n>=i&&n<=O}function h([e,t]){return[H+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}o.forEach((e=>{if(!e.show)return;const{key:o}=e;switch(o){case"fetalPresentation":{const{range:i,show:r}=ee.find((e=>e.key===o));if(r){const r=E(o,i,0);n.push(t([H,r,F,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)-H,O-E(o,a,l.value)],[p,h]=[S(c.time)-H,O-E(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)}(),oe(),function(){function e(e,t){const o=ee.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>=H&&o<=F&&n>=W&&n<=O&&(P.point={x:o,y:n},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...te].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],ee.filter((e=>e.show)).forEach((i=>{if(!T([...te],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<U)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=z-K/2;function t(e,t){if(!e.length)return;let n=W;const i=[];e.forEach((e=>{const o=e.title.split("").join("\n"),r=q.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)?(re(u),le(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(T([...te],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:G(u.left),value:M(u.origin.key,u.top)},...u.origin};j("add",e),ne(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-W)/2,n=(t.height+t.top-W)/2;e.forEach((e=>{const t=e.top+o-n;e.set({top:t,originTop:t})}))}t(R,D/2),t($,e)}(),{clickMenu:function({item:e,target:t}){const o={...e.origin};"remove"===e.mode?(j("remove",o),ne(o,"remove")):(Object.assign(o,{data:{time:G(e.pointer.x),value:M(e.origin.key,e.pointer.y)}}),j("add",o),ne(o))},redrawPoints:ie}}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{useCanvasEvent as s}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import"naive-ui";import{useBirthProcess as d}from"./useBirthProcess.js";function n(n,o,v,c,h,m){const f=e(),p=e(),g=e(),x=a((()=>o.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),w=a((()=>o.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=a((()=>{var e;return(null==(e=w.value)?void 0:e.length)?30:0})),V=a((()=>{var e;return 30+(null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),b=a((()=>{var e;const{width:a}=o.data,t=null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-y.value-t})),j=a((()=>o.data.grid.mainXCell)),A=a((()=>{const e=o.data.grid.mainYCell||14;return o.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),C=a((()=>(b.value-V.value)/j.value)),k=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(A.value+t)})),Y=a((()=>{const{xAxis:e}=o.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return k.value*a})),S=a((()=>{var e;const{scaleValues:a}=o.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!Y.value)return Y.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 H.value-l*r*k.value})),H=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-k.value*t})),P=a((()=>i(o.data.xAxis.time.startTime))),X=a((()=>36e5/C.value)),F=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"cervix"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),R=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"FHR"===e.key));return k.value/((null==a?void 0:a.spaceValue)||10)})),W=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"fetalPresentation"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),O=a((()=>{var e;return(null==(e=o.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),M=t({canvasWidth:o.data.width,canvasHeight:o.data.height,borderStyle:{...u,...o.data.borderStyle||{}},selectionStyle:o.data.selectionStyle||{},grid:o.data.grid,other:o.data.other,originX:V.value,endX:b.value,originY:Y.value,endY:H.value,xCellWidth:C.value,yCellHeight:k.value,gridXNumber:j.value,gridYNumber:A.value,xAxis:o.data.xAxis,leftScales:x.value,rightScales:w.value,leftAddAreaWidth:30,rightAddAreaWidth:y.value,startTime:P.value,timeXCell:X.value,cervixYCell:F.value,FHRYCell:R.value,fetalPresentationYCell:W.value,scaleValues:o.data.scaleValues,event:O.value,originYCervix:S.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=d(n,M,v,h,m);p.value=a,g.value=e;const{select:t}=s(n,M,v);f.value=t}))})),{propItems:M,redrawPoints:p,select:f,clickMenu:g}}export{n 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{useCanvasEvent as s}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import"naive-ui";import"@vueuse/core";import{useBirthProcess as d}from"./useBirthProcess.js";function n(n,o,v,c,h,m){const f=e(),p=e(),g=e(),x=a((()=>o.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),w=a((()=>o.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=a((()=>{var e;return(null==(e=w.value)?void 0:e.length)?30:0})),V=a((()=>{var e;return 30+(null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),b=a((()=>{var e;const{width:a}=o.data,t=null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-y.value-t})),j=a((()=>o.data.grid.mainXCell)),A=a((()=>{const e=o.data.grid.mainYCell||14;return o.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),C=a((()=>(b.value-V.value)/j.value)),k=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(A.value+t)})),Y=a((()=>{const{xAxis:e}=o.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return k.value*a})),S=a((()=>{var e;const{scaleValues:a}=o.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!Y.value)return Y.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 H.value-l*r*k.value})),H=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-k.value*t})),P=a((()=>i(o.data.xAxis.time.startTime))),X=a((()=>36e5/C.value)),F=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"cervix"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),R=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"FHR"===e.key));return k.value/((null==a?void 0:a.spaceValue)||10)})),W=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"fetalPresentation"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),O=a((()=>{var e;return(null==(e=o.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),M=t({canvasWidth:o.data.width,canvasHeight:o.data.height,borderStyle:{...u,...o.data.borderStyle||{}},selectionStyle:o.data.selectionStyle||{},grid:o.data.grid,other:o.data.other,originX:V.value,endX:b.value,originY:Y.value,endY:H.value,xCellWidth:C.value,yCellHeight:k.value,gridXNumber:j.value,gridYNumber:A.value,xAxis:o.data.xAxis,leftScales:x.value,rightScales:w.value,leftAddAreaWidth:30,rightAddAreaWidth:y.value,startTime:P.value,timeXCell:X.value,cervixYCell:F.value,FHRYCell:R.value,fetalPresentationYCell:W.value,scaleValues:o.data.scaleValues,event:O.value,originYCervix:S.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=d(n,M,v,h,m);p.value=a,g.value=e;const{select:t}=s(n,M,v);f.value=t}))})),{propItems:M,redrawPoints:p,select:f,clickMenu:g}}export{n as useBirthProcessChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as o,drawPoint as i}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as u,isEffectiveNode as c,getTime as p}from"../../utils/index.js";import{cloneDeep as d,omit as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function y(y,g,h,k,x){const{cumputedX:L,cumputedY:P,getXValue:w,getYValue:b}=r(g),{xCellWidth:A,pointSelectionStyle:C,originX:K,endX:j,originY:E,endY:I,event:T,scaleValues:M,xAxis:S,startTime:V,timeXCell:X,itemList:$,dialog:O}=g,Y=new Map,D=new Set,_=d(M);let N=[],z=null;const G=new Set;l(y,g);const{getEqualXTypes:J,handleAddPrevent:q,setPrevAndNextPoint:F}=s(y,h,g),{pause:R,resume:W}=v((()=>{!function(){for(const e of G)e.set("opacity",1===e.opacity?.5:1),y.value.renderAll()}()}),800);function B(){_.forEach((e=>{e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:i,lineStyle:l}){if(!e||!n)return;const r=P(t.type,t.range,n),a=o([K,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{k.point={...e||{x:a.left,y:a.top}},k.list=[`${i} ${n}${t.unit||""}`],k.show=!0})),a.on("mouseout",(()=>{k.show=!1}))),y.value.add(a)}a(n),a(i),a(l),a(r)}(t,e),Z(t,n,e))}))}))}function H(e=[]){if(!(null==z?void 0:z.areaPos))return[];const{startPos:t,endPos:n}=z.areaPos,[o,i]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:ae()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function Q(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),U()},onNegativeClick:()=>U(),onClose:()=>U()})}function U(){z&&y.value.remove(z),z=null}function Z(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];Y.set(e.key,[]),function(e,t){G.size&&[...G].forEach((n=>{const{dataIndex:o,type:i}=n.origin;o===t&&i===e&&G.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let d,v,x=c;l.key&&(x=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:C="",key:K,type:j="circle"}=x,E=re(c.list[u+1],n);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(v=o([...e,...E],P));const I=f[u-1],M={origin:{data:l,title:C,key:c.key,selfKey:K,unit:a,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:I,rightLine:v,...L,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};I?d=i(j,{left:I.get("x2"),top:I.get("y2"),...M}):e&&(M.leftLine=null,d=i(j,{left:e[0],top:e[1],...M}));f.push(v),d&&(d.originLeft=d.left,d.originTop=d.top,function(e){T.hovered&&(e.on("mouseover",(()=>{ie(e,"hover")})),e.on("mouseout",(()=>{k.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{le(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),T.hovered&&ie(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/A);if(o>t+A&&!e.nextPoint){if(0===N.length){ee(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+A*r;if(N.every((e=>e.left!==o))){const t=w(o),n=b(l.type,i);N.push({data:{time:t,value:n,...l.selfKey!==l.key?{key:l.selfKey}:{}},left:o,top:i}),ee(e,[...e.prevPointer,o,i])}N.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+A*l,r=N.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=N.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=N[l-1]||{left:n,top:o},f=~~((r.left-(t-A))/A),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:w(t),value:b(i.type,a.top),...i.selfKey!==i.key?{key:i.selfKey}:{}},N.splice(l,0,a),ee(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(N.length>0&&o<N[N.length-1].left){for(const e of D)e.left>o&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(N=N.filter((e=>e.left<=o)),0===N.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of D)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(N.length>0){const t=N.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(k.show=!1,1===t.button){const{type:t,selfKey:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:w(e.left),value:b(t,e.top)}};if(y.value.discardActiveObject(),N.length>0){const e=N.map((e=>e.data)),i=_.find((e=>e.type===t)),l=i.dataList.findIndex((e=>e.key===n));h("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:l,key:n,data:e}),te({...o,data:e})}else h("change",{...m(o,["selfKey","lineAttr"]),key:n}),te(o,"change")}}))}(d),null==(p=Y.get(c.key))||p.push(d))}(re(l,n),l,u,e)})),Promise.all(Y.get(e.key)).then((t=>{const n=f.filter((e=>e));F(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:o={}}=t.panicValue||{},{max:i={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:o},i){!t&&n&&o&&e.forEach((e=>{const t=e.origin.data.value;"max"===i&&t<n||"min"===i&&t>n||G.add(e)}))}r(n,"max"),r(o,"min"),r(i,"max"),r(l,"min")}(t,e)}))}function ee(e,t){const[,,n,i]=t;e.clone((l=>{l.set({left:n,top:i}),e.prevPointer=[n,i];const r=o(t,e.origin.lineAttr);l.leftLine=r,D.add(l),y.value.add(r,l)}))}function te(e,t="add",n=1){const{data:o,index:i,key:l,type:r}=e;let{dataIndex:a}=e;const s=_.find((e=>e.type===r)),f=s.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":f.list.splice(i,n);break;case"change":f.list[i]=o;break;default:{const e=Array.isArray(o)?o[0].time:o.time,t=u(e,f.list),n=Array.isArray(o)?o:[o];f.list.splice(t,0,...n);break}}ne({dataIndex:a,scaleValue:s})}function ne(e){var t,n,o;if(D.size&&(null==(t=y.value)||t.remove(...oe([...D]))),D.clear(),N=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=y.value)||n.remove(...oe(Y.get(i.key))),Y.delete(i.key),Z(i,t,o)}else Y.size&&(null==(o=y.value)||o.remove(...oe(ae()))),Y.clear(),B()}function oe(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 ie(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;k.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:b(o,e.top)}`;k.list=[`${n} ${r}${l||""}`,`时间 ${w(e.left).slice(-5)}`],k.show=!0}function le(e){e.setCoords();const t=6e4/X,n=e.prevPoint?e.prevPoint.left+t:K,o=e.nextPoint?e.nextPoint.left-t:j;e.top<E&&e.set("top",E),e.top>I&&e.set("top",I),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function re(e,t){if(c(e)&&function(e){const t=Date.parse(S.list.at(-1)),n=p(e);return n>=V&&n<=t}(e.time)){const n=L(e.time),o=P(t.type,t.range,e.value);return[n,o<E?E:o>I?I:o]}}function ae(){return Array.from(Y.values()).flat()}return e((()=>{R()})),B(),function(){if(!T.evented)return;let e=!1,o={x:0,y:0};y.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=j&&n>=E&&n<=I)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=f(e.target);ae().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&x.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===x.list.length&&(x.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),$.forEach((n=>{J(ae(),t,"key",2*A).includes(n.linkKey||n.key)||x.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===x.list.length&&(x.show=!1,q("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(x,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=H();t.length>0?Q((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return te(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);h("remove",e)})):a.emit(z)}})),y.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,o=t.pointer)})),y.value.on("mouse:move",(i=>{if(!e)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;z&&y.value.remove(z),z=new t.Rect({...n,fill:"#CAF982",opacity:.4,...C,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),z.areaPos={startPos:o,endPos:i.pointer},y.value.add(z)}))}(),{redrawPoints:ne,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(h("remove",n),te(n,"remove")):(Object.assign(n,{data:{time:w(e.pointer.x),value:b(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),h("add",n),te({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:le,setPopup:ie,updateData:te,getGridPoints:ae,getContainPoints:H,showDialog:Q,removeCurrentSelection:U}}export{y as useCenter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as r,defaultStyle as l}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function p(p,h,f,m,g,v,y,k){const{getYValue:w,getXValue:j}=s(h),{getEqualXTypes:x,handleAddPrevent:b,isGridLimit:W}=u(p,f,h),{originY:X,endY:C,borderStyle:E,left:S,itemList:Y,scaleValues:K,originX:L,endX:V,yCellHeight:G,markHeight:H,canvasWidth:N,canvasHeight:T,xCellWidth:M}=h;!function(){if(!S)return;const{title:t,titleWidth:i,titleStyle:o}=S,n=e({width:i,height:C-X+H,...E},{value:t.split("").join("\n"),...o||{}},{left:0,top:X},!0);p.value.add(n)}(),K.forEach(((e,i)=>{var o,s;const u="left"===e.layout?L-5:V+5,{range:c,spaceValue:h,title:f,unit:m,titleStyle:g,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:k}=e,w=[],j=d(c,h),x=j.length;j.forEach(((t,i)=>{const o=0===i?C-5:C-i*G*v;!y||(0===i||i===x-1)&&!k||w.push(a(String(t),{...e,position:e.layout},u,o))}));const b=f&&n(["left"===e.layout?S.width/2:V+(N-V)/2,(null!=(s=null==(o=w.at(-1))?void 0:o.top)?s:330)-G],{value:`${f}${m?"\n"+m:""}`,...r,...g}),W=new t.Group([...w,...b?[b]:[]],{objectCaching:!1,...l});p.value.add(W),W.sendToBack()})),function(){const e=new t.Rect({width:L-S.titleWidth,height:C-X+H,left:S.titleWidth,top:X,...i,originX:"left",originY:"top",...E});p.value.add(e);const n=c(Y),r=c(S.externalIconList||[]).map((t=>({...t,isExternal:!0})));let l=C;const s=S.titleWidth+15;r.concat(n.reverse()).forEach((t=>{l-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:s,top:l},icon:{leftX:s,topY:l,...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var r;l-=i.height||30,(r=n).on("moving",(()=>{r.set("originX","center"),W(r)?(g(r),v(r)):m.show=!1})),r.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&W(r)){const t=r.origin.linkKey||r.origin.key;if(x(k(),r.left,"key",2*M).includes(t))b("repeat");else{const e={data:{time:j(r.left),value:w(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin};f("add",e),y({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),p.value.add(i,n)}))}(),p.value.add(new t.Rect({left:0,top:0,width:N-E.strokeWidth,height:T-E.strokeWidth,fill:"transparent",...E}))}export{p as useLeft};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";function d(d,u,
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";function d(d,c,u,f,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(c),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,u,c),{other:P,yCellHeight:w,xCellWidth:j,endX:C,originX:E,originY:z,endY:A,markHeight:L,event:S,topGridYCellHeight:I}=c,H=new Map,M=l(P);function T(){var o;if(!(null==(o=null==M?void 0:M.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=M;let a=z+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:u={},data:f}=o;let h=null;f.forEach(((o,f)=>{const{time:m,value:g}=o,p=x(m);if(!B(p))return;const v=e(s,{...c,left:p,top:a}),k=p+v.width/2+2,y=i([k,a],{value:g,...u,originX:"left"}),X=new t.Group([v,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:p,iconHalfWidth:v.width/2,origin:{type:"other",key:n,dataIndex:r,index:f,data:o,title:l},limitX:{x1:E,x2:C-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),H.get(n).push(X),d.value.add(X)})),a+=w}))}function W(){var t;if(!(null==(t=null==M?void 0:M.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=M;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=z+w/2;r.forEach(((t,r)=>{const a=e(String(t),{...n,lockMovementY:!0,left:l,originX:"left",top:s,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});s+=w,O(a),H.get(i).push(a),d.value.add(a)}));const c=H.get(i).filter((t=>t.origin.dataIndex===o)),u=Math.max(...c.map((t=>t.width))),f=l>C-u;c.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=u,f&&t.setCoords().set("originX","right")}))}))}function Y(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=M[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}V(t)}function V(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":T();break;case"vertical":W();break;case"mark":G()}}function G(){if(!(null==P?void 0:P.mark)||!L)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([E-5,A+L/2],{value:t,...o,originX:"right"});d.value.add(a);const l=A+L,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=x(i);if(!B(r))return;let a=A;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),c=o.height;a+c<=l&&a>=A?(o.set("top",a+c/2),a+=c):(i||(a=A,i=!0),o.set("top",a-c/2),a-=c),s.push(o),O(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:E,x2:C};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(S.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{f.show=!1}))),!S.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);if("mark"===t.origin.key){t.top<z&&t.set("top",z);const e=A+L-t.height/2;t.top>e&&t.set("top",e)}t.originLeft&&t.iconHalfWidth&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(m(t),function(t){const e=t.left+t.maxTextWidth>C?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),S.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(f.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=k(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),u("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(h.point={x:t.left,y:t.top},h.show=!0,h.target=t,h.list=s.map((t=>({...t,renderItem:()=>t.label}))))}))}function q(t){var e;f.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+I/2},f.list=[`时间 ${k(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&f.list.unshift(t.origin.data.name+" "),f.show=!0}function B(t){return t>=E&&t<=C}return function(){var t;if(!(null==(t=null==M?void 0:M.horizontal)?void 0:t.length))return;const{horizontal:i}=M,o=E-5;let n=z+w/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),b(c)?q(c):f.show=!1})),c.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&b(c))if(y(H.get("horizontal"),c.left,"key",j).includes(c.origin.key))X("repeat");else{const t={data:{time:k(c.left),value:c.origin.defaultAddValue},...c.origin};u("add",t),Y(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),d.value.add(s),n+=w}))}(),T(),W(),G(),n.on((()=>{const t="horizontal",e=g(H.get(t));e.length>0?p((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return Object.keys(e).map((t=>{const i=e[t];return M.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);V({key:t}),u("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};u(i,o),"remove"===i&&Y(o,i)}}}export{d as useOther};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:g,endX:x,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=E(n,e,i);n&&(n.set(f),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<g||s>x)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,$(p),p}function $(t){I.hovered&&(t.on("mouseover",(()=>{W(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&W(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function W(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([x+(w-x)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[u,d]=f,m=u&&p(u),h=d&&p(d),v=M({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<g)&&(L||h>x)){X=l([v?m:g,o,L?h:x,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:g,x2:l?l.left:x};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:g,x2:x};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=x+(w-x)/2,l=e([o,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle}),r=w-Y.strokeWidth;o+l.width>r&&l.set({originX:"right",left:r});l&&c.value.add(l)}(i)),s.push(o({width:a,height:u,...Y},v,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
|
|
@@ -1 +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"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";function o(o,s){const{xScaleList:
|
|
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"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function o(o,s){const{xScaleList:r,originX:a,endX:l,endY:c,xCellWidth:h,canvasWidth:d,canvasHeight:u,bottom:p,breathingHeight:g,iconsWidth:m,borderStyle:v}=s;!function(){var s,d,u;if(!g||!p){const e=new t.Line([m,c-1,l,c-1],v);return o.value.add(e),e.sendToBack(),!1}const f=g,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let j=!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=j?{top:-(f/2-10)}:{top:f/2-10};s&&(j=!j);const l=e({width:h,height:f,...v},Object.assign({},{text:String(s),...i},s?r:{}),{left:o,top:c});w.push(l)}));const x=e({width:l,height:f,...v},{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(x);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 r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"../useEvent.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],c=n[i-1],p=n[i+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(r.push(f),g()):g()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...s,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...i[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;k=r([e[0],t,i],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),j=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=r([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(n,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);n&&j&&!l.breakpoint&&(!w&&!E||O)&&n[0]!==j[0]&&(f=i([...n,...j],{...v}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:g,key:m||"",unit:s.unit,type:c,_type:d(g,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else n&&(R.leftLine=null,p=o(I,{left:n[0],top:w?n[1]-5:n[1],...R}));C.push(f),p&&(g.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),A.push(p),ie.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(I).then((i=>{L.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=g(i,[...x,...b]);r[`${e.type}`]=e.value,a(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function w(e){return"fixed"===e.position}export{L as useCenter};
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"../useEvent.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function w(w,k,S,Y,E,M,$,O,P,A){r(w,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(w,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:V,yCellHeight:z,originX:D,endX:F,originY:H,endY:_,itemList:W,event:q,vitalSignsOriginY:G,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&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])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],c=n[i-1],p=n[i+1],d=o[r-1],f=o[r+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const 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(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(s.push(f),g()):g()})),e}(),{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...T(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...r,originX:"center"});e.push(n),Q.add(n)}))}w.value.add(...e)}Q.add(l),w.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{w.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function se(e,t,r){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},belowMinValueStyle:j={},dataList:Y=[],list:M=[]}=r,{type:O,textStyle:A,showConnectLine:C=!1}=b,I=[],T=[],R=[];null==(u=e.list)||u.forEach(((u,b)=>{const X=a(c)?Y.find((e=>e.key===u.key)):e,V=ue(u,r),D={};D.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=G.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 R.push(s),{obj:s,top:-z}}(V,u,X),function(e,t,r,a){var u,d;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:y={}}=r,{value:m}=a;let x,b,j,w,k;if(t.noRise&&h.show){const t=L(h)?E(c,M,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});else{const i=t+2*z;j=s([e[0],t,i],{...h.style})}R.push(j)}t.rise&&f.show&&f.text&&(w=l([e[0],e[1]-(m?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style}),R.push(w));t.verified&&(k=l([e[0],e[1]-(m?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),R.push(k));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,M,null!=(u=t.physicsReduce)?u:t.drugReduce);x=i([...e,e[0],l],{...y,...g.line,...n}),b=o((null==(d=null==g?void 0:g.point)?void 0:d.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),x&&R.push(x),b&&R.push(b)}Object.assign(a,{reduceLine:{obj:x,type:"line"},noRiseText:{obj:j,top:h.text?5:2*z,isFixed:L(h)},riseText:{obj:w,top:(m?-z:0)-5},verifiedText:{obj:k,top:(m?-z:0)-5},reducePoint:{obj:b,type:"reduce"}})}(V,u,X,D),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;const o=Math.max(...M),r=Math.min(...M);let a,u,p;const{upArrowShow:d=!1,limitValueShow:f=!1}=i;if(d&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<G.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),a=s([e[0],i[0],i[1]],m,"up"),R.push(a)}if(f){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>o){const t=a?e[1]+z/2+a.height:e[1]+z;u=l([e[0],t],i),R.push(u)}+t.value<r&&(u=l([e[0],e[1]-z],i),R.push(u))}if(j.show&&+t.value<r){const t=e[1];if(j.text)p=l([e[0],e[1]+5],{value:j.text.split("").join("\n"),originY:"top",...j.style});else{const i=t+2*z;p=s([e[0],t,i],{...j.style})}R.push(p)}Object.assign(n,{upArrow:{obj:a},limitValue:{obj:u,top:-z},belowMinValue:{obj:p,top:j.text?5:2*z,moveHide:!0}})}(V,u,X,D),function(n,l,s,a,u){let p,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(c,e.list[s].value),Y=j&&re(c,b.value);n&&j&&!l.breakpoint&&(!L&&!Y||C)&&n[0]!==j[0]&&(f=i([...n,...j],{...v}));const E=l.pacemakerShow&&"pulse"==c?y.value:L&&"number"===O?0:x,M=T[s-1],R={origin:{data:l,title:g,key:m||"",unit:r.unit,type:c,_type:d(g,c),dataIndex:t,index:s},leftLine:M,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...L?{selectable:!1,evented:!1,..."number"===O?A:{}}:{}};if(M){const e=M.get("y2");p=o(E,{left:M.get("x2"),top:L?e-5:e,...R})}else n&&(R.leftLine=null,p=o(E,{left:n[0],top:L?n[1]-5:n[1],...R}));T.push(f),p&&(g.includes("脉搏")?ee.add(p):te.add(p),function(e){q.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:G;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(w.value.remove(i),delete e.otherObj.obj)))})),oe(e)}(e),q.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};w.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),I.push(p),ie.add(p))}(V,u,b,X,D)})),"pulse"===c&&U.forEach((e=>{Z.set(e,I.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(I).then((e=>{const t=T.filter((e=>e));Promise.all(R).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;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:G;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=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,F,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<=F&&n>=H&&n<=_){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=["新增节点"],W.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:G;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=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),pe(r,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function L(e){return"fixed"===e.position}export{w 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"../useEvent.js";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"naive-ui";function p(p,g,d,f,m,y,
|
|
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"../useEvent.js";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"naive-ui";import"@vueuse/core";function p(p,g,d,f,m,v,y,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(p,d,g),{originY:V,endY:k,originX:E,endX:L,xCellWidth:M,yCellHeight:W,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=E;"right"===r&&(c=L,g=L+(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,v=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:E-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),v=e([I,A.originY,E,A.originY],D),y=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,I,E-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*W*s;if(0===a&&(c=k-5),!h||(0===a||a===l-1)&&!g||y.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});y.push(o)}}))}p.value.add(v,m,...y),m.sendToBack()}(o);const g=[],f=0===s?v:m,y=0===s?c:v+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([y,w,y,S],{objectCaching:!1,...D}):null;Y&&g.push(Y);const b=y+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,y,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*W*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,W,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+W*j/2,textAlign:"center",...o.style}));const L=new t.Group(g,{...n,objectCaching:!1});d.push(L)}));const y=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;y&&p.value.add(y),y&&y.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>=E&&t.left<=L){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 +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"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";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"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";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 +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{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as o,getFloorNumber as s}from"../../utils/index.js";import"lodash-es";import{format as d,addDays as v}from"date-fns";import"naive-ui";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,Y,S,b,w,C){const x=15,D=e(),j=e(),V=e(),X=t((()=>{const{top:e}=Y.data;return e.date.show&&(e.date.height||x)||0})),H=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||x)||0})),L=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||x)||0})),I=t((()=>{var e,t,a;const{top:l}=Y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),M=t((()=>{var e;const{bottom:t}=Y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),P=t((()=>{const{grid:e}=Y.data;return e.mainXCell*e.subXCell+e.surplusXCell})),N=t((()=>{const{grid:e}=Y.data;return e.mainYCell*e.subYCell+e.surplusYCell})),O=t((()=>{var e;const{width:t,right:a=null,top:l}=Y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>{const{grid:e}=Y.data;return O.value-e.surplusXCell*q.value})),$=t((()=>{const{top:e,left:t}=Y.data;return e.titleWidth+T.value})),k=t((()=>{const{bottom:e=null,height:t}=Y.data;if(!e)return t;return t-(e.height||30)})),G=t((()=>{var e;const{top:t}=Y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||x)||0;return X.value+a+l+H.value+L.value})),R=t((()=>{const{grid:e}=Y.data;return G.value+e.surplusYCell*z.value})),q=t((()=>(O.value-$.value)/P.value)),z=t((()=>(k.value-G.value)/N.value)),T=t((()=>{var e,t;const{left:a}=Y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),A=t((()=>{var e,t;const{top:a,grid:l}=Y.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=$.value-q.value;const n=a.date.startDate||d(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(d(v(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=q.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+q.value/2,scaleCell:(l-a)/q.value}})))).flat()})),B=t((()=>ue("breathe"))),E=t((()=>ue("pulse"))),F=t((()=>ue("temperature"))),J=t((()=>ue("pain"))),K=t((()=>{var e;return(null==(e=Y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=t((()=>{const{left:e}=Y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:o(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),U=t((()=>{const{left:e}=Y.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),Z=t((()=>{const{grid:e}=Y.data;return-1===U.value?0:z.value*e.subYCell})),_=t((()=>{const{left:e}=Y.data,t={originY:k.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value,t.endY=R.value+Z.value):U.value===e.yScaleValue.length-1&&(t.originY=k.value-Z.value,t.endY=k.value),t})),ee=t((()=>{const{left:e}=Y.data,t={originY:G.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value+Z.value,t.endY=k.value):U.value===e.yScaleValue.length-1&&(t.originY=R.value,t.endY=k.value-Z.value),t})),te=t((()=>{var e,t;const{top:a,grid:l}=Y.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))})),ae=t((()=>{var e;const{left:t,right:a}=Y.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=>s(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),le=a({canvasWidth:Y.data.width,canvasHeight:Y.data.height,borderStyle:{...i,...Y.data.borderStyle||{}},selectionStyle:Y.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:H.value,operationDaysHeight:L.value,xScalevalueHeight:I.value,topList:te.value,breathingHeight:M.value,hospitalizationDate:Y.data.hospitalizationDate,grid:Y.data.grid,top:Y.data.top,left:Y.data.left,right:Y.data.right,bottom:Y.data.bottom,other:Y.data.other,painIndex:U.value,painHeight:Z.value,painOriginY:_.value,vitalSignsOriginY:ee.value,gridXNumber:P.value,gridYNumber:N.value,iconsWidth:T.value,originX:$.value,originY:G.value,originYLimit:R.value,endX:O.value,endXLimit:W.value,endY:k.value,xCellWidth:q.value,yCellHeight:z.value,xScaleList:A.value,breatheYCell:B.value,pulseYCell:E.value,temperatureYCell:F.value,painYCell:J.value,event:K.value,itemList:Q.value,getRightInfo:ae.value,config:Y.data.config||{}});function ue(e){const{yScaleValue:t}=Y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?z.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ie,cumputedY:re,getXValue:ne,getYValue:oe}=r(le);return l((()=>{u((()=>{c(y,le);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=g(y,le,S,ie,re,ne,oe,Y.addRenderItem,w,C);j.value=l,V.value=u;const{drawScaleValue:r}=p(y,le,S,e,w,ie,re,ne,oe,t,a,i);h(y,le,r),m(y,le),f(y,le,ie);const{select:o}=n(y,le,S);D.value=o}))})),{propItems:le,redrawPoints:j,select:D,clickMenu:V}}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{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as o,getFloorNumber as s}from"../../utils/index.js";import"lodash-es";import{format as d,addDays as v}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,Y,S,b,w,C){const x=15,D=e(),j=e(),V=e(),X=t((()=>{const{top:e}=Y.data;return e.date.show&&(e.date.height||x)||0})),H=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||x)||0})),L=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||x)||0})),I=t((()=>{var e,t,a;const{top:l}=Y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),M=t((()=>{var e;const{bottom:t}=Y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),P=t((()=>{const{grid:e}=Y.data;return e.mainXCell*e.subXCell+e.surplusXCell})),N=t((()=>{const{grid:e}=Y.data;return e.mainYCell*e.subYCell+e.surplusYCell})),O=t((()=>{var e;const{width:t,right:a=null,top:l}=Y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>{const{grid:e}=Y.data;return O.value-e.surplusXCell*q.value})),$=t((()=>{const{top:e,left:t}=Y.data;return e.titleWidth+T.value})),k=t((()=>{const{bottom:e=null,height:t}=Y.data;if(!e)return t;return t-(e.height||30)})),G=t((()=>{var e;const{top:t}=Y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||x)||0;return X.value+a+l+H.value+L.value})),R=t((()=>{const{grid:e}=Y.data;return G.value+e.surplusYCell*z.value})),q=t((()=>(O.value-$.value)/P.value)),z=t((()=>(k.value-G.value)/N.value)),T=t((()=>{var e,t;const{left:a}=Y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),A=t((()=>{var e,t;const{top:a,grid:l}=Y.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=$.value-q.value;const n=a.date.startDate||d(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(d(v(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=q.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+q.value/2,scaleCell:(l-a)/q.value}})))).flat()})),B=t((()=>ue("breathe"))),E=t((()=>ue("pulse"))),F=t((()=>ue("temperature"))),J=t((()=>ue("pain"))),K=t((()=>{var e;return(null==(e=Y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=t((()=>{const{left:e}=Y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:o(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),U=t((()=>{const{left:e}=Y.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),Z=t((()=>{const{grid:e}=Y.data;return-1===U.value?0:z.value*e.subYCell})),_=t((()=>{const{left:e}=Y.data,t={originY:k.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value,t.endY=R.value+Z.value):U.value===e.yScaleValue.length-1&&(t.originY=k.value-Z.value,t.endY=k.value),t})),ee=t((()=>{const{left:e}=Y.data,t={originY:G.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value+Z.value,t.endY=k.value):U.value===e.yScaleValue.length-1&&(t.originY=R.value,t.endY=k.value-Z.value),t})),te=t((()=>{var e,t;const{top:a,grid:l}=Y.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))})),ae=t((()=>{var e;const{left:t,right:a}=Y.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=>s(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),le=a({canvasWidth:Y.data.width,canvasHeight:Y.data.height,borderStyle:{...i,...Y.data.borderStyle||{}},selectionStyle:Y.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:H.value,operationDaysHeight:L.value,xScalevalueHeight:I.value,topList:te.value,breathingHeight:M.value,hospitalizationDate:Y.data.hospitalizationDate,grid:Y.data.grid,top:Y.data.top,left:Y.data.left,right:Y.data.right,bottom:Y.data.bottom,other:Y.data.other,painIndex:U.value,painHeight:Z.value,painOriginY:_.value,vitalSignsOriginY:ee.value,gridXNumber:P.value,gridYNumber:N.value,iconsWidth:T.value,originX:$.value,originY:G.value,originYLimit:R.value,endX:O.value,endXLimit:W.value,endY:k.value,xCellWidth:q.value,yCellHeight:z.value,xScaleList:A.value,breatheYCell:B.value,pulseYCell:E.value,temperatureYCell:F.value,painYCell:J.value,event:K.value,itemList:Q.value,getRightInfo:ae.value,config:Y.data.config||{}});function ue(e){const{yScaleValue:t}=Y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?z.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ie,cumputedY:re,getXValue:ne,getYValue:oe}=r(le);return l((()=>{u((()=>{c(y,le);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=g(y,le,S,ie,re,ne,oe,Y.addRenderItem,w,C);j.value=l,V.value=u;const{drawScaleValue:r}=p(y,le,S,e,w,ie,re,ne,oe,t,a,i);h(y,le,r),m(y,le),f(y,le,ie);const{select:o}=n(y,le,S);D.value=o}))})),{propItems:le,redrawPoints:j,select:D,clickMenu:V}}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 i,defaultTextStyle as s}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";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=i({width:d,height:u,...m},{value:c,...s,...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=i({width:n-f,height:d,...m},{value:p.xScalevalue.title,...s,...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=i({width:c,height:v,...m},{value:u.value,...s,...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=i({width:n-f,height:a,...m},{value:t.title,...s,...(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=i({width:p,height:a,...m},{value:u,...s,...(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 i,defaultTextStyle as s}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";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=i({width:d,height:u,...m},{value:c,...s,...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=i({width:n-f,height:d,...m},{value:p.xScalevalue.title,...s,...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=i({width:c,height:v,...m},{value:u.value,...s,...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=i({width:n-f,height:a,...m},{value:t.title,...s,...(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=i({width:p,height:a,...m},{value:u,...s,...(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};
|
|
@@ -6,4 +6,5 @@ export declare function useCommon(canvas: Ref<fabric.Canvas>, emits: Function, p
|
|
|
6
6
|
getEqualXTypes: (points: any[], pointX: number, field: string, range?: any) => string[];
|
|
7
7
|
handleAddPrevent: (type: 'repeat' | 'exceedMax' | 'exceedMin') => void;
|
|
8
8
|
isGridLimit: (point: IObject) => boolean;
|
|
9
|
+
setPrevAndNextPoint: (pointList: any[]) => void;
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,n,t,r=i.xCellWidth){const o=[],d=r/2;return e.forEach((e=>{e.origin&&!e.origin.isMenu&&Math.abs(n-e.left)<=d&&o.push(e.origin[t])})),[...new Set(o)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:r,endX:o,originY:d,endY:
|
|
1
|
+
const e={repeat:"该时段已存在数值不能新增",exceedMax:"未来时间不允许录入",exceedMin:"不允许小于入院时间"};function n(n,t,i){return{getEqualXTypes:function(e,n,t,r=i.xCellWidth){const o=[],d=r/2;return e.forEach((e=>{e.origin&&!e.origin.isMenu&&Math.abs(n-e.left)<=d&&o.push(e.origin[t])})),[...new Set(o)]},handleAddPrevent:function(n){t("add:prevent",{type:n,message:e[n]})},isGridLimit:function(e){const{left:n,top:t}=e,{originX:r,endX:o,originY:d,endY:u}=i;return n>=r&&n<=o&&t>=d&&t<=u},setPrevAndNextPoint:function(e){e.reduce(((e,n)=>e&&n?(n.prevPoint=e,e.nextPoint=n,n):n||e),null)}}}export{n as useCommon};
|
|
@@ -158,7 +158,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
158
158
|
handleFieldSave: () => void;
|
|
159
159
|
onCancle: () => void;
|
|
160
160
|
reset: () => void;
|
|
161
|
-
|
|
161
|
+
getShowColumn: (column: import("../../../es/shared/types").AnyObject) => boolean;
|
|
162
162
|
initFields: () => import("../../../es/shared/types").AnyObject[];
|
|
163
163
|
handleGroup: (fields: import("../../../es/shared/types").AnyObject[]) => import("../../../es/shared/types").AnyObject[];
|
|
164
164
|
getTableFields: () => import("lodash").Omit<never, "uuid">[];
|
|
@@ -160,7 +160,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
160
160
|
handleFieldSave: () => void;
|
|
161
161
|
onCancle: () => void;
|
|
162
162
|
reset: () => void;
|
|
163
|
-
|
|
163
|
+
getShowColumn: (column: AnyObject) => boolean;
|
|
164
164
|
initFields: () => AnyObject[];
|
|
165
165
|
handleGroup: (fields: AnyObject[]) => AnyObject[];
|
|
166
166
|
getTableFields: () => import("lodash").Omit<never, "uuid">[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as
|
|
1
|
+
import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as r,createBlock as s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as y,createTextVNode as v,toDisplayString as b,createVNode as k,mergeProps as g,renderSlot as x}from"vue";import{useThemeVars as w,NInput as A,NCheckbox as _,NTooltip as S,NIcon as C,NPopconfirm as W,NButton as E}from"naive-ui";import P from"../../../shared/components/VueDraggable/src/vuedraggable.js";import q from"./components/Row.vue.js";import{isArray as F,cloneDeep as N,isString as R,omit as j}from"lodash-es";import{isDisable as B,setStyle as I,getGroupTree as U}from"./utils/index.js";import{uuidGenerator as D}from"../../../shared/utils/index.js";import{HelpCircleSharp as O}from"@vicons/ionicons5";const T={class:"c-field-set__table-header"},V=h("span",null,"数值越小,优先级越高",-1),K=["tabindex"],L={key:1,class:"c-field-set__table-footer"};var G=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1}},emits:["save","close","reset"],setup(e,{expose:G,emit:H}){const M=e,$={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},z=l(w().value.primaryColor),J=l(""),Q=l(),X=l([]),Y=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"}]),Z=t((()=>X.value.flat())),ee=i({columns:Y,fieldList:Z,onUpdateChecked:function({checked:e,column:l}){const t=!e||ue(l.field);l.checkedAll=!t}}),le={keyword:J.value,idx:0,startIdx:0},te=()=>{H("save",{tableFields:ae()})},ie=()=>{H("close")};function oe(){X.value=de(),ne(),H("reset")}function de(){const e=N(M.fields).map((e=>({...e,uuid:D()})));return Object.keys($).forEach((l=>{e.forEach((e=>{"old"==M.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[$[l]]=1==e[l]:e[$[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),function(e){if(M.groupSetting){return U(M.groupSetting,e).reduce(((t,i)=>{const o=R(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function ae(){let e=[];return e="old"==M.type?Z.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,sortPriority:e.sortPriority,...M.isEdit?{required:e.required,editable:e.editable}:{}}))):Z.value,e.map((e=>j(e,["uuid"])))}function re(){const e=le.keyword!==J.value;let l=J.value?Z.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(J.value))return!!e||t>le.idx})):0;-1!==l||e||(l=le.startIdx),Q.value.scrollTop=52*l,Object.assign(le,{keyword:J.value,idx:l},e?{startIdx:l}:{})}function se(e){var l;return!!J.value&&(null==(l=e.title)?void 0:l.includes(J.value))}function ne(){var e,l;(null==(e=M.showColumnNames)?void 0:e.length)&&(Y.value=Y.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=M.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=M.customColumns)?void 0:l.length)&&Y.value.push(...M.customColumns),M.showSeq&&Y.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),Y.value.forEach((e=>{if(e.isShow=function(e){return!(["editable","required"].includes(e.field)&&!M.isEdit||"sortPriority"===e.field&&!M.showSortPriority)}(e),"checkbox"===e.type){const l=X.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ue(e.field)&&!l}}))}function ue(e){return X.value.flat().some((l=>!B(l,e)&&!l[e]&&"0001"!=l.id))}return o([()=>M.fields,()=>{var e;return null==(e=M.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(X.value=de(),ne())}),{immediate:!0,deep:!0}),G({getTableFields:ae}),(l,t)=>(d(),a("div",{class:"c-field-set",style:r({"--row-height":"52px","--primary-color":z.value})},[e.showSearch?(d(),s(n(A),{key:0,class:"c-field-set__search-wrapper",value:J.value,"onUpdate:value":t[0]||(t[0]=e=>J.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(re,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",T,[(d(!0),a(p,null,m(Y.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:r(n(I)(e))},["checkbox"===e.type?(d(),s(n(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void Z.value.forEach((e=>{B(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:y((()=>[v(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])):f("v-if",!0),v(" "+b("checkbox"!==e.type?e.title:"")+" ",1),"sortPriority"===e.field?(d(),s(n(S),{key:1,trigger:"hover"},{trigger:y((()=>[k(n(C),{component:n(O),style:{top:"2px"}},null,8,["component"])])),default:y((()=>[V])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Q},[k(n(P),{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=e=>X.value=e),animation:"150","item-key":"id",draggable:".item"},{item:y((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:"item",tabindex:l},[n(F)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),s(q,g(ee,{key:t,element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),s(q,g({key:1},ee,{element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"]))],8,K))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",L,[f(" 底部按钮插槽 "),x(l.$slots,"footer",{},(()=>[k(n(W),{onPositiveClick:oe},{trigger:y((()=>[k(n(E),{style:{"margin-right":"8px"}},{default:y((()=>[v("恢复默认设置")])),_:1})])),default:y((()=>[v(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(E),{style:{"margin-right":"8px"},onClick:ie},{default:y((()=>[v("取消")])),_:1}),k(n(E),{type:"primary",onClick:te},{default:y((()=>[v("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{G as default};
|