cnhis-design-vue 3.1.46-beta.3 → 3.1.46-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/es/components/button-print/index.d.ts +1 -1
  2. package/es/components/button-print/src/ButtonPrint.vue.d.ts +1 -1
  3. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  4. package/es/components/button-print/src/utils/print.js +1 -1
  5. package/es/components/classification/index.d.ts +1 -1
  6. package/es/components/classification/src/index.vue.d.ts +1 -1
  7. package/es/components/classification/src/index.vue2.js +1 -1
  8. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  9. package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
  10. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  11. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  13. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  14. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  16. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +1 -1
  17. package/es/components/fabric-chart/src/utils/index.d.ts +1 -0
  18. package/es/components/fabric-chart/src/utils/index.js +1 -1
  19. package/es/components/form-config/index.d.ts +23 -1
  20. package/es/components/form-config/src/FormConfig.vue.d.ts +23 -1
  21. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  22. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +11 -0
  23. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +11 -0
  24. package/es/components/form-config/src/hooks/useDataNormalize.d.ts +1 -1
  25. package/es/components/form-config/src/hooks/useDataNormalize.js +1 -1
  26. package/es/components/form-config/src/types/index.d.ts +1 -1
  27. package/es/components/form-render/index.d.ts +11 -0
  28. package/es/components/form-render/src/FormRender.vue.d.ts +12 -1
  29. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  30. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +11 -0
  31. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  32. package/es/components/form-render/src/hooks/useOperationalForm.d.ts +7 -0
  33. package/es/components/form-render/src/hooks/useOperationalForm.js +1 -0
  34. package/es/components/form-render/src/types/index.d.ts +2 -1
  35. package/es/components/iho-table/index.d.ts +14 -0
  36. package/es/components/iho-table/src/IhoTable.vue.d.ts +14 -0
  37. package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.d.ts +1 -0
  38. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +2 -0
  39. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.js +1 -1
  40. package/es/components/iho-table/src/hooks/tapHooks/useSetupHooks.d.ts +1 -1
  41. package/es/components/iho-table/src/hooks/tapHooks/useSetupHooks.js +1 -1
  42. package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +1 -1
  43. package/es/components/iho-table/src/plugins/filterDaterangeRenderPlugin/filter.vue.d.ts +2 -2
  44. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +1 -1
  45. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  46. package/es/components/iho-table/src/plugins/index.js +1 -1
  47. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
  48. package/es/components/iho-table/src/plugins/operationalFormPlugin/index.d.ts +1 -0
  49. package/es/components/iho-table/src/plugins/operationalFormPlugin/index.js +1 -0
  50. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +1 -1
  51. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
  52. package/es/components/iho-table/src/types/index.d.ts +3 -1
  53. package/es/components/iho-table/src/types/pluginType.d.ts +2 -0
  54. package/es/components/iho-table/style/index.css +1 -1
  55. package/es/components/index.css +1 -1
  56. package/es/components/index.d.ts +2 -1
  57. package/es/components/index.js +1 -1
  58. package/es/components/info-header/index.d.ts +26 -0
  59. package/es/components/info-header/src/InfoHeader.vue.d.ts +26 -0
  60. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +11 -0
  61. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +11 -0
  62. package/es/components/quick-search/src/index.vue2.js +1 -1
  63. package/es/components/scale-view/index.d.ts +8 -8
  64. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  65. package/es/components/scale-view/src/components/formitem/r-checkbox.d.ts +4 -4
  66. package/es/components/scale-view/src/components/formitem/r-checkbox.js +1 -1
  67. package/es/components/scale-view/src/components/formitem/r-radio.d.ts +4 -4
  68. package/es/components/scale-view/src/components/formitem/r-radio.js +1 -1
  69. package/es/components/scale-view/src/hooks/use-component.d.ts +16 -16
  70. package/es/components/scale-view/style/index.css +1 -1
  71. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  72. package/es/components/select-person/index.d.ts +123 -0
  73. package/es/components/select-person/src/SearchOrgAndStaff.vue.d.ts +88 -0
  74. package/es/components/select-person/src/SearchOrgAndStaff.vue.js +1 -0
  75. package/es/components/select-person/src/SearchOrgAndStaff.vue2.js +1 -0
  76. package/es/components/select-person/src/SelectPerson.vue.d.ts +123 -0
  77. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  78. package/es/components/select-person/src/types/enums.d.ts +4 -0
  79. package/es/components/select-person/src/types/enums.js +1 -0
  80. package/es/components/select-person/src/utils/index.d.ts +1 -1
  81. package/es/components/select-person/src/utils/index.js +1 -1
  82. package/es/components/select-person/style/index.css +1 -1
  83. package/es/components/shortcut-setter/index.d.ts +11 -0
  84. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +11 -0
  85. package/es/components/table-export-field/index.d.ts +1057 -0
  86. package/es/components/table-export-field/index.js +1 -0
  87. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +270 -0
  88. package/es/components/table-export-field/src/components/ExportModal.vue.js +1 -0
  89. package/es/components/table-export-field/src/components/ExportModal.vue2.js +1 -0
  90. package/es/components/table-export-field/src/components/SaveProjectModal.vue.d.ts +700 -0
  91. package/es/components/table-export-field/src/components/SaveProjectModal.vue.js +1 -0
  92. package/es/components/table-export-field/src/components/SaveProjectModal.vue2.js +1 -0
  93. package/es/components/table-export-field/src/constants/index.d.ts +3 -0
  94. package/es/components/table-export-field/src/constants/index.js +1 -0
  95. package/es/components/table-export-field/src/hooks/useAsyncData.d.ts +6 -0
  96. package/es/components/table-export-field/src/hooks/useAsyncData.js +1 -0
  97. package/es/components/table-export-field/src/index.vue.d.ts +1058 -0
  98. package/es/components/table-export-field/src/index.vue.js +1 -0
  99. package/es/components/table-export-field/src/index.vue2.js +1 -0
  100. package/es/components/table-export-field/src/tool.d.ts +1 -0
  101. package/es/components/table-export-field/src/tool.js +1 -0
  102. package/es/components/table-export-field/src/types/index.d.ts +6 -0
  103. package/es/components/table-export-field/src/types/index.js +1 -0
  104. package/es/components/table-export-field/style/index.css +1 -0
  105. package/es/components/table-filter/src/components/classify-filter/components/SelectDynamic.vue2.js +1 -1
  106. package/es/components/table-filter/src/components/render-widget/components/DateQuickBtn/index.vue2.js +1 -1
  107. package/es/components/table-filter/src/hooks/useAdvanced.d.ts +1 -1
  108. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  109. package/es/shared/hooks/useDateTime.d.ts +1 -1
  110. package/es/shared/hooks/useDateTime.js +1 -1
  111. package/es/shared/package.json.js +1 -1
  112. package/es/shared/types/business.d.ts +6 -0
  113. package/es/shared/types/index.d.ts +1 -0
  114. package/es/shared/utils/business.d.ts +6 -1
  115. package/es/shared/utils/business.js +1 -1
  116. package/es/shared/utils/fabricjs/index.js +1 -1
  117. package/es/shared/utils/index.js +1 -1
  118. package/es/shared/utils/tapableLess.d.ts +28 -0
  119. package/es/shared/utils/tapableLess.js +1 -0
  120. package/package.json +2 -2
  121. package/es/components/form-render/src/components/renderer/dist/levelSearchCascader.d.ts +0 -77
  122. package/es/components/form-render/src/components/renderer/dist/searchCascade.d.ts +0 -93
  123. package/es/components/iho-table/src/plugins/dist/highLightSetPlugin.d.ts +0 -3
  124. package/es/components/iho-table/src/plugins/filterRenderPlugin/dist/index.d.ts +0 -3
  125. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/dist/index.d.ts +0 -3
  126. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/defaultRendererPlugin.d.ts +0 -3
  127. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/seqRendererPlugin.d.ts +0 -3
  128. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/dist/index.d.ts +0 -3
  129. package/es/components/iho-table/src/utils/dist/index.d.ts +0 -44
  130. package/es/components/scale-view/src/components/formitem/dist/r-address.d.ts +0 -36
  131. package/es/components/scale-view/src/components/formitem/dist/r-sign.d.ts +0 -36
  132. package/es/components/scale-view/src/components/formitem/dist/standard-modal.d.ts +0 -82
  133. package/es/components/search-cascader/src/components/dist/SearchMenu.d.ts +0 -57
  134. package/es/components/search-cascader/src/components/dist/SearchMenu1.d.ts +0 -57
@@ -181,7 +181,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
181
181
  renderLabel: (option: import("../../../es/shared/types").AnyObject) => JSX.Element;
182
182
  callLocalServicesSuccessCb: (res: any, type: any) => void;
183
183
  callLocalServicesErrorCb: (res: unknown) => void;
184
- prevFnError: () => void;
184
+ prevFnError: (type: string) => void;
185
185
  getPrintParams: (index?: number) => string;
186
186
  getOnceParams: () => string;
187
187
  handleClickPrint: () => void;
@@ -188,7 +188,7 @@ declare const _default: import("vue").DefineComponent<{
188
188
  renderLabel: (option: AnyObject) => JSX.Element;
189
189
  callLocalServicesSuccessCb: (res: any, type: any) => void;
190
190
  callLocalServicesErrorCb: (res: unknown) => void;
191
- prevFnError: () => void;
191
+ prevFnError: (type: string) => void;
192
192
  getPrintParams: (index?: number) => string;
193
193
  getOnceParams: () => string;
194
194
  handleClickPrint: () => void;
@@ -1 +1 @@
1
- import{defineComponent as t,reactive as e,computed as r,onMounted as a,onUnmounted as n,watch as i,openBlock as o,createElementBlock as s,Fragment as l,createVNode as m,unref as d,withCtx as p,renderSlot as u,withModifiers as c,createTextVNode as f,toDisplayString as v,mergeProps as y}from"vue";import{isObject as b}from"@vue/shared";import{useMessage as g,NDropdown as P,NButton as I,NIcon as h}from"naive-ui";import{ChevronDown as F}from"@vicons/ionicons5";import{Print as w}from"./utils/print.js";import{isIReport as k}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as x}from"date-fns";import{savePrivateFormatApi as S,getPrivateFormatApi as j}from"./api.js";var D=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})}},emits:["success","error","clickoutside"],setup(t,{expose:D,emit:O}){var L;const E=t,M=g();let N;const V={},C=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),Y=e([{label:E.printText,key:"printText"},{label:E.previewText,key:"previewText"},{label:E.pdfLoadText,key:"downloadPdf"},{label:E.formatEditText,key:"formatEditText"},...(null==(L=E.externalOptionConfig)?void 0:L.options)||[]]),J=r((()=>{if(!C.currentFormatId)return{};let t=C.currentFormatId;return C.formatList.find((e=>e.id===t))})),U=r((()=>{var t;return(null==(t=J.value)?void 0:t.name)||"格式选择"})),A=r((()=>{let t=C.formatList.find((t=>t.id===C.currentFormatId));return null==t?void 0:t.templateId})),B=async t=>{if(E.directPrint){if(C.spinning)return;return"button"===t?void await it():rt()}return rt()},q=t=>m("span",{class:{active:t.key===C.currentFormatId}},[t.label]),R=(t,e)=>{let r={type:e,formatId:C.currentFormatId,templateId:A.value};O("success",t,r)},_=t=>{O("error",t),b(t)&&"notInstalledApp"===t.type&&M.error(t.message)},z=()=>{O("error",{message:"前置条件执行错误"})},H=(t=0)=>{var e;const r=(null==(e=E.printParams)?void 0:e.length)?E.printParams[t]:C.printParams[t];return JSON.stringify({...r||{},...E.token?{token:E.token}:{}})},$=()=>{var t,e;let r={},a={};if(null==(t=C.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(C.printParams[0].datasetData||{}))?void 0:e[0])||"",r=JSON.stringify(C.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=r}else Object.keys(C.printParams[0]).forEach((t=>{a[t]=[],C.printParams.forEach((e=>{a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(H(0)),a),JSON.stringify(r)},G=()=>{let t=C.printParams.length;const e=async e=>{try{--t<=0&&R(e,"print")}catch(t){console.log("error",t)}};E.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{const t={formatId:C.currentFormatId,templateId:A.value,printdlgshow:E.printdlgshow};if("MULTI"===E.strategy)for(let r=0;r<C.printParams.length;r++)r>0&&(t.printdlgshow="0"),N.printDirect({...t,params:H(r)},e,_);else N.printDirect({...t,params:$()},(t=>{R(t,"print")}),_)})).finally((()=>{C.visible=!1}))},K=async(t,e)=>{var r,a;switch(t){case"printText":G();break;case"previewText":(async()=>{E.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{const t="MULTI"===E.strategy?H():$(),e={formatId:C.currentFormatId,templateId:A.value,params:t,btnprint:E.btnprint};N.preview(e,(t=>{R(t,"preview")}),_)})).finally((()=>{C.visible=!1}))})();break;case"formatEditText":E.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{C.identityVerification.visible=!0})).finally((()=>{C.visible=!1}));break;case"downloadPdf":(async()=>{E.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{const t="MULTI"===E.strategy?H():$(),e={formatId:C.currentFormatId,templateId:A.value,print:{print:"1",type:"1"},params:t};N.downloadPDF(e,(t=>R(t,"preview")),_)})).finally((()=>{C.visible=!1}))})();break;default:{C.visible=!1;const n=C.formatList.find((e=>e.id===t))||{};if(Object.keys(n).length>0){C.currentFormatId=t;const[e]=Y;e.label=(null==n?void 0:n.name)||e.label,await S({formatForms:[{...n}],name:V.name||n.templateName,number:V.number||n.number,templateId:V.templateId||n.templateId,...V.id?{id:V.id}:{}},{token:E.token})}else null==(a=null==(r=E.externalOptionConfig)?void 0:r.onSelect)||a.call(r,t,e);break}}},Q=()=>{C.visible=!1,O("clickoutside")},W=()=>(C.isInited=!1,C.spinning=!1,setTimeout((()=>{C.visible=!1}),0),!1),X=(t,e,r)=>{const a={};return e.forEach((e=>{let n=((t,e)=>{const r={DATE:"YYYY-MM-DD",DATETIME:"YYYY-MM-DD HH:mm:ss"};let a=e;return Object.keys(r).includes(t.type)&&e&&(a=x(e,r[t.type])),(null==t?void 0:t.defaultValue)||a})(e,t[e[r]]);t[e[r]]&&n&&(a[e[r]]=n)})),a},Z=({customizeDataset:t=[],param:e=[]},r=[])=>r.map((r=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(X(r,e,"fieldName"))}})),a=Object.assign({},a,X(r,e,"key")),a})),tt=async t=>{var e;if(C.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],C.currentFormatId=await(async(t,e)=>{var r;if(!(null==t?void 0:t.length))return"";const{data:a}=await j({templateId:t[0].templateId},{token:E.token});if("SUCCESS"===a.result){const{formatForms:e=[]}=a.map||{};Object.assign(V,a.map||{});const n=null==(r=null==e?void 0:e[0])?void 0:r.id;if(n&&t.map((t=>t.id)).includes(n))return n}const n=t.find((t=>1==t[e]));return(null==n?void 0:n.id)||t[0].id})(C.formatList,"defaultFlag"),!C.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),W();(()=>{const t=C.formatList.map((t=>({label:t.name,key:t.id})));Y.unshift({label:U.value,key:"format",children:t})})();let r=null==(e=await E.queryTemplateParams())?void 0:e.obj;if(!r||!A.value)return M.error("获取打印模板失败,请联系管理员!"),W();C.templateParams=r,C.printParams=Z(C.templateParams,E.params)},et=async()=>{if(C.isInited)return!0;C.isInited=!0,C.spinning=!0,(()=>{if(N)return!1;N=new w})();const t=await E.queryPrintFormatByNumber();return await tt(t),C.spinning=!1,!0},rt=async(t=!0)=>{var e;if(await E.clickPrevFn())if(null==(e=E.params)?void 0:e.length){if(!C.visible){if(!await et())return!1}t&&(C.visible=!C.visible)}else M.warning(E.noDataMsg)},at=()=>{C.watchPrintParamsReformatFn&&C.watchPrintParamsReformatFn(),C.isInited?C.printParams=Z(C.templateParams,E.params):C.watchPrintParamsReformatFn=()=>i((()=>C.isInited),(t=>{if(!t)return!1;at()}))},nt=t=>{if(C.identityVerification.visible=!1,k(C.currentFormatId))return R(null,"edit");const e={formatId:C.currentFormatId,templateId:A.value,params:H(),token:t};N.editPrintFormat(e,(t=>{R(t,"edit")}),_)};async function it(){await rt(!1),G()}return a((()=>{C.isInited=!1})),n((()=>{null==N||N.destroy()})),i((()=>E.params),(t=>{if(!(null==t?void 0:t.length))return!1;at()}),{deep:!0}),D({directPrint:it}),(e,r)=>(o(),s(l,null,[m(d(P),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:C.visible,onClickoutside:Q,options:Y,onSelect:K,"render-label":q},{default:p((()=>[u(e.$slots,"button",{handleClickPrintBtn:rt,printSpinning:C.spinning,printbtnText:t.btnText,printVisible:C.visible},(()=>[m(d(I),{class:"dropdown-button",onClick:r[1]||(r[1]=c((()=>B("button")),["stop"]))},{default:p((()=>[f(v(t.btnText)+" ",1),m(d(h),{component:d(F),style:{"margin-left":"5px"},onClick:r[0]||(r[0]=c((()=>B("icon")),["stop"]))},null,8,["component"])])),_:1})]))])),_:3},8,["show","options"]),m(T,y(e.$attrs,{modelValue:C.identityVerification.visible,"onUpdate:modelValue":r[2]||(r[2]=t=>C.identityVerification.visible=t),formatId:C.currentFormatId,templateId:d(A),onSuccess:nt}),null,16,["modelValue","formatId","templateId"])],64))}});export{D as default};
1
+ import{defineComponent as t,reactive as e,computed as r,onMounted as a,onUnmounted as n,watch as i,openBlock as l,createElementBlock as o,Fragment as s,createVNode as m,unref as d,withCtx as p,renderSlot as u,withModifiers as c,createTextVNode as f,toDisplayString as v,mergeProps as y}from"vue";import{isObject as b}from"@vue/shared";import{useMessage as g,NDropdown as I,NButton as P,NIcon as w}from"naive-ui";import{ChevronDown as h}from"@vicons/ionicons5";import{Print as F}from"./utils/print.js";import{isIReport as k}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as x}from"date-fns";import{savePrivateFormatApi as S,getPrivateFormatApi as D}from"./api.js";var O=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})}},emits:["success","error","clickoutside"],setup(t,{expose:O,emit:j}){var E;const L=t,M=g();let N;const V={},C=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),Y=e([{label:L.printText,key:"printText"},{label:L.previewText,key:"previewText"},{label:L.pdfLoadText,key:"downloadPdf"},{label:L.formatEditText,key:"formatEditText"},...(null==(E=L.externalOptionConfig)?void 0:E.options)||[]]),J=r((()=>{if(!C.currentFormatId)return{};let t=C.currentFormatId;return C.formatList.find((e=>e.id===t))})),U=r((()=>{var t;return(null==(t=J.value)?void 0:t.name)||"格式选择"})),A=r((()=>{let t=C.formatList.find((t=>t.id===C.currentFormatId));return null==t?void 0:t.templateId})),B=async t=>{if(L.directPrint){if(C.spinning)return;return"button"===t?void await it():rt()}return rt()},q=t=>m("span",{class:{active:t.key===C.currentFormatId}},[t.label]),R=(t,e)=>{let r={type:e,formatId:C.currentFormatId,templateId:A.value};j("success",t,r)},_=t=>{j("error",t),b(t)&&"notInstalledApp"===t.type&&M.error(t.message)},z=t=>{j("error",{message:"前置条件执行错误",type:t,preExecution:!0})},H=(t=0)=>{var e;const r=(null==(e=L.printParams)?void 0:e.length)?L.printParams[t]:C.printParams[t];return JSON.stringify({...r||{},...L.token?{token:L.token}:{}})},$=()=>{var t,e;let r={},a={};if(null==(t=C.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(C.printParams[0].datasetData||{}))?void 0:e[0])||"",r=JSON.stringify(C.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=r}else Object.keys(C.printParams[0]).forEach((t=>{a[t]=[],C.printParams.forEach((e=>{a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(H(0)),a),JSON.stringify(r)},G=()=>{let t=C.printParams.length;const e=async e=>{try{--t<=0&&R(e,"print")}catch(t){console.log("error",t)}};L.prevFn("print").then((()=>{const t={formatId:C.currentFormatId,templateId:A.value,printdlgshow:L.printdlgshow};if("MULTI"===L.strategy)for(let r=0;r<C.printParams.length;r++)r>0&&(t.printdlgshow="0"),N.printDirect({...t,params:H(r)},e,_);else N.printDirect({...t,params:$()},(t=>{R(t,"print")}),_)})).catch((()=>{z("print")})).finally((()=>{C.visible=!1}))},K=async(t,e)=>{var r,a;switch(t){case"printText":G();break;case"previewText":(async()=>{L.prevFn("preview").then((()=>{const t="MULTI"===L.strategy?H():$(),e={formatId:C.currentFormatId,templateId:A.value,params:t,btnprint:L.btnprint};N.preview(e,(t=>{R(t,"preview")}),_)})).catch((()=>{z("preview")})).finally((()=>{C.visible=!1}))})();break;case"formatEditText":L.prevFn("edit").then((()=>{C.identityVerification.visible=!0})).catch((()=>{z("edit")})).finally((()=>{C.visible=!1}));break;case"downloadPdf":(async()=>{L.prevFn("download").then((()=>{const t="MULTI"===L.strategy?H():$(),e={formatId:C.currentFormatId,templateId:A.value,print:{print:"1",type:"1"},params:t};N.downloadPDF(e,(t=>R(t,"preview")),_)})).catch((()=>{z("download")})).finally((()=>{C.visible=!1}))})();break;default:{C.visible=!1;const n=C.formatList.find((e=>e.id===t))||{};if(Object.keys(n).length>0){C.currentFormatId=t;const[e]=Y;e.label=(null==n?void 0:n.name)||e.label,await S({formatForms:[{...n}],name:V.name||n.templateName,number:V.number||n.number,templateId:V.templateId||n.templateId,...V.id?{id:V.id}:{}},{token:L.token})}else null==(a=null==(r=L.externalOptionConfig)?void 0:r.onSelect)||a.call(r,t,e);break}}},Q=()=>{C.visible=!1,j("clickoutside")},W=()=>(C.isInited=!1,C.spinning=!1,setTimeout((()=>{C.visible=!1}),0),!1),X=(t,e,r)=>{const a={};return e.forEach((e=>{let n=((t,e)=>{const r={DATE:"YYYY-MM-DD",DATETIME:"YYYY-MM-DD HH:mm:ss"};let a=e;return Object.keys(r).includes(t.type)&&e&&(a=x(e,r[t.type])),(null==t?void 0:t.defaultValue)||a})(e,t[e[r]]);t[e[r]]&&n&&(a[e[r]]=n)})),a},Z=({customizeDataset:t=[],param:e=[]},r=[])=>r.map((r=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(X(r,e,"fieldName"))}})),a=Object.assign({},a,X(r,e,"key")),a})),tt=async t=>{var e;if(C.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],C.currentFormatId=await(async(t,e)=>{var r;if(!(null==t?void 0:t.length))return"";const{data:a}=await D({templateId:t[0].templateId},{token:L.token});if("SUCCESS"===a.result){const{formatForms:e=[]}=a.map||{};Object.assign(V,a.map||{});const n=null==(r=null==e?void 0:e[0])?void 0:r.id;if(n&&t.map((t=>t.id)).includes(n))return n}const n=t.find((t=>1==t[e]));return(null==n?void 0:n.id)||t[0].id})(C.formatList,"defaultFlag"),!C.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),W();(()=>{const t=C.formatList.map((t=>({label:t.name,key:t.id})));Y.unshift({label:U.value,key:"format",children:t})})();let r=null==(e=await L.queryTemplateParams())?void 0:e.obj;if(!r||!A.value)return M.error("获取打印模板失败,请联系管理员!"),W();C.templateParams=r,C.printParams=Z(C.templateParams,L.params)},et=async()=>{if(C.isInited)return!0;C.isInited=!0,C.spinning=!0,(()=>{if(N)return!1;N=new F})();const t=await L.queryPrintFormatByNumber();return await tt(t),C.spinning=!1,!0},rt=async(t=!0)=>{var e;if(await L.clickPrevFn())if(null==(e=L.params)?void 0:e.length){if(!C.visible){if(!await et())return!1}t&&(C.visible=!C.visible)}else M.warning(L.noDataMsg)},at=()=>{C.watchPrintParamsReformatFn&&C.watchPrintParamsReformatFn(),C.isInited?C.printParams=Z(C.templateParams,L.params):C.watchPrintParamsReformatFn=()=>i((()=>C.isInited),(t=>{if(!t)return!1;at()}))},nt=t=>{if(C.identityVerification.visible=!1,k(C.currentFormatId))return R(null,"edit");const e={formatId:C.currentFormatId,templateId:A.value,params:H(),token:t};N.editPrintFormat(e,(t=>{R(t,"edit")}),_)};async function it(){await rt(!1),G()}return a((()=>{C.isInited=!1})),n((()=>{null==N||N.destroy()})),i((()=>L.params),(t=>{if(!(null==t?void 0:t.length))return!1;at()}),{deep:!0}),O({directPrint:it}),(e,r)=>(l(),o(s,null,[m(d(I),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:C.visible,onClickoutside:Q,options:Y,onSelect:K,"render-label":q},{default:p((()=>[u(e.$slots,"button",{handleClickPrintBtn:rt,printSpinning:C.spinning,printbtnText:t.btnText,printVisible:C.visible},(()=>[m(d(P),{class:"dropdown-button",onClick:r[1]||(r[1]=c((()=>B("button")),["stop"]))},{default:p((()=>[f(v(t.btnText)+" ",1),m(d(w),{component:d(h),style:{"margin-left":"5px"},onClick:r[0]||(r[0]=c((()=>B("icon")),["stop"]))},null,8,["component"])])),_:1})]))])),_:3},8,["show","options"]),m(T,y(e.$attrs,{modelValue:C.identityVerification.visible,"onUpdate:modelValue":r[2]||(r[2]=t=>C.identityVerification.visible=t),formatId:C.currentFormatId,templateId:d(A),onSuccess:nt}),null,16,["modelValue","formatId","templateId"])],64))}});export{O as default};
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],m)return m;m=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){this._handleMonitorNotify("当前浏览器版本不支持获取配置接口"),console.log("非封装浏览器或者当前版本不支持获取配置接口")}}}messageHandler(t){var e;if(!t)return console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(t){console.log("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=e;try{n(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t)return this._handleMonitorNotify("打印命令未返回信息"),null==e||e({type:"printError",message:"打印命令未返回信息",result:!1,errinfo:"打印命令未返回信息"}),!1;if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const n={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(n),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${u}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==s||s(a)}catch(t){const e="预览失败";null==l||l(e),this._handleMonitorNotify(e)}}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o}),a=this._handleResult(r,h);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==d||d(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败";null==h||h(e),this._handleMonitorNotify(e)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,u=`${h}/bi-api/reprot/print/open/client/getRemote`,m=`${h}/printService/file`;let p=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],p)return p;p=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=e;try{n(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t){if(!this.webview)return Promise.reject();const e=Date.now().toString();return Promise.race([new Promise(((i,n)=>{this.messageHandlerQueue.push({resolve:i,reject:n,id:e}),this.webview.postMessage(t)})),new Promise(((t,i)=>{setTimeout((()=>{const t=this.messageHandlerQueue.findIndex((t=>t.id===e));t>-1&&this.messageHandlerQueue.splice(t,1),i({type:"timeout"})}),5e3)}))])}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const n={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(n),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${m}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==s||s(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==l||l(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,h))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o}),a=this._handleResult(r,h);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==d||d(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==h||h(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){let e=l(new Date,"yyyyMMddHHmmss");t.customFileName&&(e=`${e}${t.customFileName}`),t.print.filename=`${this.downloadPath}/${e}`.replace(/\\/g,"/")}this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
@@ -45,7 +45,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
45
45
  };
46
46
  }, {
47
47
  handleGetConfigApi: (params: any, key: string, config: {} | undefined, filterApiConfigVal: any) => Promise<any>;
48
- transformClassifyChild: (conObjList: any) => {};
48
+ transformClassifyChild: (conObjList: any, searchFieldList: any[]) => {};
49
49
  attrs: any;
50
50
  $message: import("naive-ui").MessageApi;
51
51
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -46,7 +46,7 @@ declare const _default: import("vue").DefineComponent<{
46
46
  };
47
47
  }, {
48
48
  handleGetConfigApi: (params: any, key: string, config: {} | undefined, filterApiConfigVal: any) => Promise<any>;
49
- transformClassifyChild: (conObjList: any) => {};
49
+ transformClassifyChild: (conObjList: any, searchFieldList: any[]) => {};
50
50
  attrs: any;
51
51
  $message: import("naive-ui").MessageApi;
52
52
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as i,ref as n,provide as l,computed as t,onMounted as a,nextTick as s,watch as o,openBlock as d,createElementBlock as c,normalizeClass as r,unref as h,normalizeStyle as u,withDirectives as f,createVNode as p,createTextVNode as m,toDisplayString as g,createCommentVNode as v,createElementVNode as C,Fragment as y,renderList as k,createBlock as S,withCtx as b}from"vue";import{useMessage as x,NIcon as O,NTooltip as _}from"naive-ui";import{Repeat as w,SettingsOutline as I,ChevronDown as L,ChevronForward as N,Checkmark as z,Close as j,ChevronUp as B}from"@vicons/ionicons5";import P from"./components/set-classification/index.vue.js";import J from"./directive/flexibleResize.js";import{InjectionFilterApiConfig as M}from"../../table-filter/src/constants/index.js";import{root_isShowResetButton as A}from"./const/index.js";import E from"../../table-filter/src/hooks/useMixins.js";import T from"../../table-filter/src/hooks/useAdvanced.js";const R={key:0,class:"header"},F={class:"tree"},W=["onClick"],q=["onClick"],G=["onClick"],Q={class:"child-item-name"},$={key:1,class:"tree-type-footer"},D={class:"selected-num"},V=C("i",{class:"iconfont-table-filter icon-table-filter-menzhenyishengzhananniushanchu2"},null,-1),H={key:0,class:"tile-type classify-1"},K={key:0,class:"header"},U={class:"right-setting"},X=["onClick"],Y={class:"parent ellips"},Z={class:"children"},ee=["onClick"],ie={key:1,class:"selected-list"},ne={class:"selected-num"},le=C("i",{class:"iconfont-table-filter icon-table-filter-menzhenyishengzhananniushanchu2"},null,-1),te={class:"name"},ae={class:"name"},se={key:0,class:"main-wrapper"},oe=["onClick"],de={class:"tree-footer"},ce=["onClick"],re=["onClick"],he={key:0,class:"select-type-footer"},ue={class:"selected-num"},fe=C("i",{class:"iconfont-table-filter icon-table-filter-menzhenyishengzhananniushanchu2"},null,-1);var pe=e({__name:"index",props:{tableId:{type:String,default:""},searchFieldList:{type:Array,default:()=>[]},conditionMap:{type:Object,default:()=>({})},conditionSid:{type:Array,default:()=>["all_data"]},curClassificationIndex:{type:Number,default:0},curClassificationWidth:{type:Number},hideConditionChangeBtn:{type:Number,default:0},hideConditionChangeSetting:{type:Number,default:0},hideClearConditionChange:{type:Number,default:1},isShowResetButton:{type:Boolean,default:!0},filterApiConfig:{type:Object,default:()=>({})}},emits:["changeSearch","setClassificationIndex","getQuickSearchListObj"],setup(e,{emit:pe}){const me=e,{handleGetConfigApi:ge}=E(),{transformClassifyChild:ve}=T(),Ce=i(),ye=x(),ke=n(null);let Se=n(150),be=n(!1),xe=n([]),Oe=n([]),_e=n([]),we=n(2),Ie=n({name:"全部数据",sid:"all_data"}),Le=n([]),Ne=n(""),ze=n(!1),je=n("全部数据");l(A,me.isShowResetButton),l(M,me.filterApiConfig);let Be=t((()=>0===we.value?{marginRight:"8px"}:2===we.value?{display:"inline-block"}:{})),Pe=t((()=>{let e=Oe.value.filter((e=>-1!==me.conditionSid.indexOf(e.sid)));if(-1!==me.conditionSid.indexOf("all_data"))return"全部数据";{let i=[];return e.map((e=>{i.push(e.name)})),i.join(",")}})),Je=t((()=>function(e){let i=0===e.digital?"(0)":e.digital?`(${e.digital})`:"";const{name:n,isPublic:l}=e;return Ue(n,l)+i}));function Me(e){e.open?e.open=!1:e.open=!0}function Ae(e,i,n){je.value=e.name;let l=function(e){let i=[];return xe.value.forEach((n=>{n.children?n.children.forEach((n=>{-1!==e.indexOf(n.sid)?(n.selected=!0,i.push(n)):n.selected=!1})):-1!==e.indexOf(n.sid)?(n.selected=!0,i.push(n)):n.selected=!1})),i}(function(e,i,n){let l=JSON.parse(JSON.stringify(i));l="all_data"===e||-1!==l.indexOf(e)?["all_data"]:[e];return l}(e.sid,me.conditionSid));We(!1);const t=ve(null==e?void 0:e.conObj);pe("changeSearch",Boolean("all_data"===e.sid),e,t,n,l)}function Ee(){let e="";if(2===we.value)e=0;else{let i=we.value;e=++i}Se.value=150,Te(e)}async function Te(e,i){let n={tableId:me.tableId,setting:JSON.stringify({classificationIndex:e,classificationWidth:i})};try{await ge(n,"requestSaveListPersonaSetting",{},me.filterApiConfig)&&pe("setClassificationIndex",e)}catch(e){console.log(e)}}function Re(){ze.value=!0,We(!1)}function Fe(e){ze.value=e}function We(e){be.value=void 0===e?!be.value:e}function qe(){if(!me.tableId)return ye.warning("请传入tableId");xe.value=[];let{displayCategoryList:e=[],conditionList:i=[]}=me.conditionMap;Le.value=JSON.parse(JSON.stringify(e))||[],_e.value=JSON.parse(JSON.stringify(i)),Oe.value=JSON.parse(JSON.stringify([{name:"全部数据",sid:"all_data"},...i]));let n=[];var l;0===Le.value.length&&(Le.value=["未分类"]),Le.value.forEach((e=>{let i={name:e,children:[]};Oe.value.forEach((n=>{if(n.displayCategory===e||!n.displayCategory&&"未分类"===e&&"all_data"!==n.sid){if(-1!==me.conditionSid.indexOf(n.sid)){n.selected=!0,i.open=!0;const e=ve(null==n?void 0:n.conObj);pe("changeSearch",!1,n,e)}n.isShow&&i.children.push(n)}})),i.children.length>0&&n.push(i)})),n.unshift({name:"全部数据",sid:"all_data"}),xe.value=n,0===we.value&&(l=!0,xe.value.forEach((e=>{e.children&&e.children.length&&(e.open=l)})))}function Ge({distance:e}){const i=Se.value+e;Se.value=Math.min(Math.max(i,50),650)}function Qe(){Te(we.value,Se.value)}async function $e(){await Ke(me.tableId),Ve()}async function De(e){await Ke(me.tableId),He()}function Ve(e){He(e).then((e=>({})))}function He(e,i={}){if(!me.tableId)return new Promise((e=>e(!1)));let n=Object.keys(i).length>0?i:JSON.parse(JSON.stringify(me.conditionMap));return new Promise(((i,l)=>{var t,a,s,o,d,c;if(Object.keys(n).length>0){_e.value=n.conditionList||[],Le.value=n.displayCategoryList||[];let l={conditionList:_e.value,displayCategoryList:Le.value};pe("getQuickSearchListObj",l),Ne.value=n.settingId;const r=_e.value.find((e=>e.isDefault))||{name:"全部数据",sid:"all_data"};(null==(a=null==(t=Ce.tableOptions)?void 0:t.filterCondition)?void 0:a.displayCategory)&&e&&i({name:null==(o=null==(s=Ce.tableOptions)?void 0:s.filterCondition)?void 0:o.name,sid:null==(c=null==(d=Ce.tableOptions)?void 0:d.filterCondition)?void 0:c.displayCategory}),i(r)}else i({})}))}async function Ke(e){try{if(!e)return new Promise((e=>e(!1)));let i={tableId:e},n=await ge(i,"requestTableCondiTionList",{},me.filterApiConfig);return Promise.resolve(n)}catch(e){return Promise.resolve(!1)}}function Ue(e,i){return i&&e&&"1"===i?e.replace(/\(公共\)$/,""):e}return a((()=>{document.addEventListener("click",(e=>{s((()=>{let i=e.composedPath&&e.composedPath();ke.value&&i.includes(ke.value)||We(!1)}))}))})),o((()=>me.tableId),(e=>{e&&Ve(!0)}),{immediate:!0,deep:!0}),o((()=>me.curClassificationIndex),(e=>{void 0!==e&&(we.value=e)}),{immediate:!0,deep:!0}),o((()=>me.curClassificationWidth),(e=>{e&&(Se.value=Number(e)||150)}),{immediate:!0}),o((()=>me.conditionMap),(e=>{!async function(){try{await qe()}catch(e){console.log(e)}}()}),{immediate:!0,deep:!0}),(i,n)=>(d(),c("div",{class:r(["classification-block","classificationIndex-"+h(we)]),style:u(h(Be))},[0===h(we)?f((d(),c("div",{key:0,class:"tree-type classify-0",style:u({width:h(Se)+"px",paddingBottom:1!=e.hideClearConditionChange?"80px":0,position:"relative"})},[1!=e.hideConditionChangeBtn||1!=e.hideConditionChangeSetting?(d(),c("div",R,[1!=e.hideConditionChangeBtn?(d(),c("span",{key:0,class:"header-1",onClick:Ee},[p(h(O),{component:h(w),size:"16"},null,8,["component"]),m(" "+g("切换"))])):v("v-if",!0),1!=e.hideConditionChangeSetting?(d(),c("span",{key:1,class:"header-1",onClick:Re},[p(h(O),{component:h(I),size:"16"},null,8,["component"]),m(" "+g("设置"))])):v("v-if",!0)])):v("v-if",!0),C("ul",F,[(d(!0),c(y,null,k(h(xe),((i,n)=>(d(),c(y,null,[0===n||!i.children||0===i.children.length||i.children&&0!==i.children.filter((e=>e.isShow)).length?(d(),c("li",{key:n,class:r(["tree-item",{"tree-header":0===n||!i.children||0===i.children.length}])},[0!==n&&i.children&&0!==i.children.length?(d(),c(y,{key:1},[C("span",{class:r(["parent",{open:i.open}]),onClick:e=>Me(i)},[C("span",null,g(i.name),1),p(h(O),{component:i.open?h(L):h(N)},null,8,["component"])],10,q),i.open?(d(!0),c(y,{key:0},k(i.children.filter((e=>e.isShow)),((e,n)=>(d(),c("div",{key:n,class:"children",onClick:n=>Ae(e,0,i)},[e.isShow?(d(),S(h(_),{key:0,trigger:"hover",placement:"right"},{trigger:b((()=>[C("span",{class:r(["child-item",{selected:e.selected}])},[C("span",Q,g(Ue(e.name,null==e?void 0:e.isPublic)),1),e.selected?(d(),S(h(O),{key:0,component:h(z),size:"20"},null,8,["component"])):v("v-if",!0)],2)])),default:b((()=>[C("span",null,g(h(Je)(e)),1)])),_:2},1024)):v("v-if",!0)],8,G)))),128)):v("v-if",!0)],64)):(d(),c("span",{key:0,class:r(["child-item header-item",{selected:i.selected||-1!==e.conditionSid.indexOf("all_data")}]),onClick:e=>Ae(i)},g(i.name),11,W))],2)):v("v-if",!0)],64)))),256))]),1!=e.hideClearConditionChange?(d(),c("div",$,[C("div",D,"已选择"+g(e.conditionSid.filter((e=>"all_data"!==e)).length)+"项",1),C("div",{class:"selected-item-del",onClick:n[0]||(n[0]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[V,m(" 清空筛选 ")])])):v("v-if",!0)],4)),[[h(J),{mode:"VR",onMove:Ge,onEnd:Qe}]]):v("v-if",!0),1===h(we)?(d(),c(y,{key:1},[1!=e.hideConditionChangeBtn||1!=e.hideConditionChangeSetting||1!=e.hideConditionChangeSetting||h(_e).filter((e=>e.isShow)).length>0?(d(),c("div",H,[1!=e.hideConditionChangeBtn||1!=e.hideConditionChangeSetting?(d(),c("div",K,[C("span",{class:r(["all-data",{selected:-1!==e.conditionSid.indexOf("all_data")}]),onClick:n[1]||(n[1]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[m(" 全部数据 "),h(Ie).digital||0===h(Ie).digital?(d(),c(y,{key:0},[m(" ("+g(h(Ie).digital||0)+") ",1)],64)):v("v-if",!0)],2),C("div",U,[1!=e.hideConditionChangeBtn?(d(),c("span",{key:0,class:"setting-1",onClick:Ee,style:{"margin-right":"30px"}},[p(h(O),{component:h(w),size:"16"},null,8,["component"]),m(" "+g("切换"))])):v("v-if",!0),1!=e.hideConditionChangeSetting?(d(),c("span",{key:1,class:"setting-1",onClick:Re},[p(h(O),{component:h(I),size:"16"},null,8,["component"]),m(" "+g("设置"))])):v("v-if",!0)])])):v("v-if",!0),C("ul",{class:"tile",style:u({borderBottom:1!=e.hideClearConditionChange?"1px solid #d5d5d5":0})},[(d(!0),c(y,null,k(h(xe).slice(1),((e,i)=>(d(),c(y,null,[e.children&&e.children.length>0?(d(),c("li",{class:"tile-item",key:i},[e.children&&0!==e.children.length?(d(),c(y,{key:1},[C("span",Y,g(e.name),1),C("div",Z,[(d(!0),c(y,null,k(e.children,((i,n)=>(d(),c(y,null,[i.isShow?(d(),c("span",{key:n,class:r(["child-item",{selected:i.selected}]),onClick:n=>Ae(i,0,e)},g(Ue(i.name,null==i?void 0:i.isPublic)),11,ee)):v("v-if",!0)],64)))),256))])],64)):(d(),c("span",{key:0,class:r(["child-item",{selected:e.selected}]),style:{"padding-left":"17px"},onClick:i=>Ae(e)},g(e.name)+" "+g(e.digital),11,X))])):v("v-if",!0)],64)))),256))],4),1!=e.hideClearConditionChange?(d(),c("div",ie,[C("div",ne,"已选择"+g(e.conditionSid.filter((e=>"all_data"!==e)).length)+"项",1),(d(!0),c(y,null,k(h(xe).slice(1),(e=>(d(),c(y,null,[e.children&&0!==e.children.length?(d(!0),c(y,{key:1},k(e.children,((i,n)=>(d(),c(y,null,[i.selected?(d(),c("div",{class:"selected-item",key:i.sid},[m(g(i.name)+" ",1),p(h(O),{component:h(j),onClick:n=>Ae(i,0,e)},null,8,["component","onClick"])])):v("v-if",!0)],64)))),256)):(d(),c("div",{class:"selected-item",key:e.sid},[m(g(e.name)+" ",1),p(h(O),{component:h(j),onClick:i=>Ae(e)},null,8,["component","onClick"])]))],64)))),256)),C("div",{class:"selected-item-del",onClick:n[2]||(n[2]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[le,m(" 清空筛选 ")])])):v("v-if",!0)])):v("v-if",!0)],64)):v("v-if",!0),2===h(we)?(d(),c("div",{key:2,class:"select-type classify-2",ref_key:"selectType",ref:ke},[C("span",{class:"title",onClick:n[3]||(n[3]=()=>We())},[p(h(_),{trigger:"hover",placement:"top"},{trigger:b((()=>[C("span",te,g(h(Pe)),1)])),default:b((()=>[C("span",ae,g(h(Pe)),1)])),_:1}),p(h(O),{component:h(be)?h(B):h(L)},null,8,["component"])]),h(be)?(d(),c("div",se,[C("ul",{class:"tree",style:u({padding:1!=e.hideClearConditionChange?"40px 0":"40px 0 0"})},[(d(!0),c(y,null,k(h(xe),((i,n)=>(d(),c(y,null,[0===n||!i.children||0===i.children.length||i.children&&0!==i.children.filter((e=>e.isShow)).length?(d(),c("li",{key:n,class:r(["tree-item",{"tree-header":0===n||!i.children||0===i.children.length}])},[0!==n&&i.children&&0!==i.children.length?(d(),c(y,{key:1},[0!==i.children.filter((e=>e.isShow)).length?(d(),c("span",{key:0,class:r(["parent",{open:i.open}]),onClick:e=>Me(i)},[m(g(i.name)+g(i.digital||0===i.digital?"("+i.digital+")":"")+" ",1),p(h(O),{component:i.open?h(L):h(N)},null,8,["component"])],10,ce)):v("v-if",!0),i.open?(d(!0),c(y,{key:1},k(i.children.filter((e=>e.isShow)),((e,n)=>(d(),c("div",{key:n,class:"children",onClick:n=>Ae(e,0,i)},[e.isShow?(d(),S(h(_),{key:0,placement:"right",trigger:"hover","z-index":1e4},{trigger:b((()=>[C("span",{class:r(["child-item",{selected:e.selected}])},[C("span",null,g(Ue(e.name,null==e?void 0:e.isPublic)),1),e.selected?(d(),S(h(O),{key:0,component:h(z),size:"20"},null,8,["component"])):v("v-if",!0)],2)])),default:b((()=>[C("span",null,g(h(Je)(e)),1)])),_:2},1024)):v("v-if",!0)],8,re)))),128)):v("v-if",!0)],64)):(d(),c(y,{key:0},[C("span",{class:r(["child-item child-header header-item",{selected:i.selected||-1!==e.conditionSid.indexOf("all_data")}]),onClick:e=>Ae(i)},g(i.name),11,oe),C("div",de,[1!=e.hideConditionChangeBtn?(d(),c("span",{key:0,class:"tree-footer-icon",onClick:Ee},[p(h(O),{component:h(w),size:"16"},null,8,["component"]),m(" "+g("切换"))])):v("v-if",!0),1!=e.hideConditionChangeSetting?(d(),c("span",{key:1,class:"tree-footer-icon",onClick:Re},[p(h(O),{component:h(I),size:"16"},null,8,["component"]),m(" "+g("设置"))])):v("v-if",!0)])],64))],2)):v("v-if",!0)],64)))),256))],4),1!=e.hideClearConditionChange?(d(),c("div",he,[C("div",ue,"已选择"+g(e.conditionSid.filter((e=>"all_data"!==e)).length)+"项",1),C("div",{class:"selected-item-del",onClick:n[4]||(n[4]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[fe,m(" 清空筛选 ")])])):v("v-if",!0)])):v("v-if",!0)],512)):v("v-if",!0),v(" 弹出弹窗 "),p(P,{ref:"search",searchFieldList:e.searchFieldList,conditionList:h(_e),displayCategoryList:h(Le),settingId:h(Ne),tableId:e.tableId,classifyModal:h(ze),onSaveGetTableCondiTionList:De,onCondiTionListInit:$e,onSetClassifyModal:Fe},null,8,["searchFieldList","conditionList","displayCategoryList","settingId","tableId","classifyModal"])],6))}});export{pe as default};
1
+ import{defineComponent as e,useAttrs as i,ref as n,provide as l,computed as t,onMounted as a,nextTick as s,watch as o,openBlock as d,createElementBlock as c,normalizeClass as r,unref as h,normalizeStyle as u,withDirectives as f,createVNode as p,createTextVNode as m,toDisplayString as g,createCommentVNode as v,createElementVNode as C,Fragment as y,renderList as k,createBlock as S,withCtx as b}from"vue";import{useMessage as x,NIcon as O,NTooltip as _}from"naive-ui";import{Repeat as w,SettingsOutline as I,ChevronDown as L,ChevronForward as N,Checkmark as z,Close as j,ChevronUp as B}from"@vicons/ionicons5";import P from"./components/set-classification/index.vue.js";import J from"./directive/flexibleResize.js";import{InjectionFilterApiConfig as M}from"../../table-filter/src/constants/index.js";import{root_isShowResetButton as A}from"./const/index.js";import E from"../../table-filter/src/hooks/useMixins.js";import F from"../../table-filter/src/hooks/useAdvanced.js";const T={key:0,class:"header"},R={class:"tree"},W=["onClick"],q=["onClick"],G=["onClick"],Q={class:"child-item-name"},$={key:1,class:"tree-type-footer"},D={class:"selected-num"},V=C("i",{class:"iconfont-table-filter icon-table-filter-menzhenyishengzhananniushanchu2"},null,-1),H={key:0,class:"tile-type classify-1"},K={key:0,class:"header"},U={class:"right-setting"},X=["onClick"],Y={class:"parent ellips"},Z={class:"children"},ee=["onClick"],ie={key:1,class:"selected-list"},ne={class:"selected-num"},le=C("i",{class:"iconfont-table-filter icon-table-filter-menzhenyishengzhananniushanchu2"},null,-1),te={class:"name"},ae={class:"name"},se={key:0,class:"main-wrapper"},oe=["onClick"],de={class:"tree-footer"},ce=["onClick"],re=["onClick"],he={key:0,class:"select-type-footer"},ue={class:"selected-num"},fe=C("i",{class:"iconfont-table-filter icon-table-filter-menzhenyishengzhananniushanchu2"},null,-1);var pe=e({__name:"index",props:{tableId:{type:String,default:""},searchFieldList:{type:Array,default:()=>[]},conditionMap:{type:Object,default:()=>({})},conditionSid:{type:Array,default:()=>["all_data"]},curClassificationIndex:{type:Number,default:0},curClassificationWidth:{type:Number},hideConditionChangeBtn:{type:Number,default:0},hideConditionChangeSetting:{type:Number,default:0},hideClearConditionChange:{type:Number,default:1},isShowResetButton:{type:Boolean,default:!0},filterApiConfig:{type:Object,default:()=>({})}},emits:["changeSearch","setClassificationIndex","getQuickSearchListObj"],setup(e,{emit:pe}){const me=e,{handleGetConfigApi:ge}=E(),{transformClassifyChild:ve}=F(),Ce=i(),ye=x(),ke=n(null);let Se=n(150),be=n(!1),xe=n([]),Oe=n([]),_e=n([]),we=n(2),Ie=n({name:"全部数据",sid:"all_data"}),Le=n([]),Ne=n(""),ze=n(!1),je=n("全部数据");l(A,me.isShowResetButton),l(M,me.filterApiConfig);let Be=t((()=>0===we.value?{marginRight:"8px"}:2===we.value?{display:"inline-block"}:{})),Pe=t((()=>{let e=Oe.value.filter((e=>-1!==me.conditionSid.indexOf(e.sid)));if(-1!==me.conditionSid.indexOf("all_data"))return"全部数据";{let i=[];return e.map((e=>{i.push(e.name)})),i.join(",")}})),Je=t((()=>function(e){let i=0===e.digital?"(0)":e.digital?`(${e.digital})`:"";const{name:n,isPublic:l}=e;return Ue(n,l)+i}));function Me(e){e.open?e.open=!1:e.open=!0}function Ae(e,i,n){je.value=e.name;let l=function(e){let i=[];return xe.value.forEach((n=>{n.children?n.children.forEach((n=>{-1!==e.indexOf(n.sid)?(n.selected=!0,i.push(n)):n.selected=!1})):-1!==e.indexOf(n.sid)?(n.selected=!0,i.push(n)):n.selected=!1})),i}(function(e,i,n){let l=JSON.parse(JSON.stringify(i));l="all_data"===e||-1!==l.indexOf(e)?["all_data"]:[e];return l}(e.sid,me.conditionSid));We(!1);const t=ve(null==e?void 0:e.conObj,me.searchFieldList);pe("changeSearch",Boolean("all_data"===e.sid),e,t,n,l)}function Ee(){let e="";if(2===we.value)e=0;else{let i=we.value;e=++i}Se.value=150,Fe(e)}async function Fe(e,i){let n={tableId:me.tableId,setting:JSON.stringify({classificationIndex:e,classificationWidth:i})};try{await ge(n,"requestSaveListPersonaSetting",{},me.filterApiConfig)&&pe("setClassificationIndex",e)}catch(e){console.log(e)}}function Te(){ze.value=!0,We(!1)}function Re(e){ze.value=e}function We(e){be.value=void 0===e?!be.value:e}function qe(){if(!me.tableId)return ye.warning("请传入tableId");xe.value=[];let{displayCategoryList:e=[],conditionList:i=[]}=me.conditionMap;Le.value=JSON.parse(JSON.stringify(e))||[],_e.value=JSON.parse(JSON.stringify(i)),Oe.value=JSON.parse(JSON.stringify([{name:"全部数据",sid:"all_data"},...i]));let n=[];var l;0===Le.value.length&&(Le.value=["未分类"]),Le.value.forEach((e=>{let i={name:e,children:[]};Oe.value.forEach((n=>{if(n.displayCategory===e||!n.displayCategory&&"未分类"===e&&"all_data"!==n.sid){if(-1!==me.conditionSid.indexOf(n.sid)){n.selected=!0,i.open=!0;const e=ve(null==n?void 0:n.conObj,me.searchFieldList);pe("changeSearch",!1,n,e)}n.isShow&&i.children.push(n)}})),i.children.length>0&&n.push(i)})),n.unshift({name:"全部数据",sid:"all_data"}),xe.value=n,0===we.value&&(l=!0,xe.value.forEach((e=>{e.children&&e.children.length&&(e.open=l)})))}function Ge({distance:e}){const i=Se.value+e;Se.value=Math.min(Math.max(i,50),650)}function Qe(){Fe(we.value,Se.value)}async function $e(){await Ke(me.tableId),Ve()}async function De(e){await Ke(me.tableId),He()}function Ve(e){He(e).then((e=>({})))}function He(e,i={}){if(!me.tableId)return new Promise((e=>e(!1)));let n=Object.keys(i).length>0?i:JSON.parse(JSON.stringify(me.conditionMap));return new Promise(((i,l)=>{var t,a,s,o,d,c,r;if(Object.keys(n).length>0){_e.value=n.conditionList||[],Le.value=n.displayCategoryList||[];let l={conditionList:_e.value,displayCategoryList:Le.value};pe("getQuickSearchListObj",l),Ne.value=null!=(t=n.settingId)?t:"";const h=_e.value.find((e=>e.isDefault))||{name:"全部数据",sid:"all_data"};(null==(s=null==(a=Ce.tableOptions)?void 0:a.filterCondition)?void 0:s.displayCategory)&&e&&i({name:null==(d=null==(o=Ce.tableOptions)?void 0:o.filterCondition)?void 0:d.name,sid:null==(r=null==(c=Ce.tableOptions)?void 0:c.filterCondition)?void 0:r.displayCategory}),i(h)}else i({})}))}async function Ke(e){try{if(!e)return new Promise((e=>e(!1)));let i={tableId:e},n=await ge(i,"requestTableCondiTionList",{},me.filterApiConfig);return Promise.resolve(n)}catch(e){return Promise.resolve(!1)}}function Ue(e,i){return i&&e&&"1"===i?e.replace(/\(公共\)$/,""):e}return a((()=>{document.addEventListener("click",(e=>{s((()=>{let i=e.composedPath&&e.composedPath();ke.value&&i.includes(ke.value)||We(!1)}))}))})),o((()=>me.tableId),(e=>{e&&Ve(!0)}),{immediate:!0,deep:!0}),o((()=>me.curClassificationIndex),(e=>{void 0!==e&&(we.value=e)}),{immediate:!0,deep:!0}),o((()=>me.curClassificationWidth),(e=>{e&&(Se.value=Number(e)||150)}),{immediate:!0}),o((()=>me.conditionMap),(e=>{!async function(){try{await qe()}catch(e){console.log(e)}}()}),{immediate:!0,deep:!0}),(i,n)=>(d(),c("div",{class:r(["classification-block","classificationIndex-"+h(we)]),style:u(h(Be))},[0===h(we)?f((d(),c("div",{key:0,class:"tree-type classify-0",style:u({width:h(Se)+"px",paddingBottom:1!=e.hideClearConditionChange?"80px":0,position:"relative"})},[1!=e.hideConditionChangeBtn||1!=e.hideConditionChangeSetting?(d(),c("div",T,[1!=e.hideConditionChangeBtn?(d(),c("span",{key:0,class:"header-1",onClick:Ee},[p(h(O),{component:h(w),size:"16"},null,8,["component"]),m(" "+g("切换"))])):v("v-if",!0),1!=e.hideConditionChangeSetting?(d(),c("span",{key:1,class:"header-1",onClick:Te},[p(h(O),{component:h(I),size:"16"},null,8,["component"]),m(" "+g("设置"))])):v("v-if",!0)])):v("v-if",!0),C("ul",R,[(d(!0),c(y,null,k(h(xe),((i,n)=>(d(),c(y,null,[0===n||!i.children||0===i.children.length||i.children&&0!==i.children.filter((e=>e.isShow)).length?(d(),c("li",{key:n,class:r(["tree-item",{"tree-header":0===n||!i.children||0===i.children.length}])},[0!==n&&i.children&&0!==i.children.length?(d(),c(y,{key:1},[C("span",{class:r(["parent",{open:i.open}]),onClick:e=>Me(i)},[C("span",null,g(i.name),1),p(h(O),{component:i.open?h(L):h(N)},null,8,["component"])],10,q),i.open?(d(!0),c(y,{key:0},k(i.children.filter((e=>e.isShow)),((e,n)=>(d(),c("div",{key:n,class:"children",onClick:n=>Ae(e,0,i)},[e.isShow?(d(),S(h(_),{key:0,trigger:"hover",placement:"right"},{trigger:b((()=>[C("span",{class:r(["child-item",{selected:e.selected}])},[C("span",Q,g(Ue(e.name,null==e?void 0:e.isPublic)),1),e.selected?(d(),S(h(O),{key:0,component:h(z),size:"20"},null,8,["component"])):v("v-if",!0)],2)])),default:b((()=>[C("span",null,g(h(Je)(e)),1)])),_:2},1024)):v("v-if",!0)],8,G)))),128)):v("v-if",!0)],64)):(d(),c("span",{key:0,class:r(["child-item header-item",{selected:i.selected||-1!==e.conditionSid.indexOf("all_data")}]),onClick:e=>Ae(i)},g(i.name),11,W))],2)):v("v-if",!0)],64)))),256))]),1!=e.hideClearConditionChange?(d(),c("div",$,[C("div",D,"已选择"+g(e.conditionSid.filter((e=>"all_data"!==e)).length)+"项",1),C("div",{class:"selected-item-del",onClick:n[0]||(n[0]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[V,m(" 清空筛选 ")])])):v("v-if",!0)],4)),[[h(J),{mode:"VR",onMove:Ge,onEnd:Qe}]]):v("v-if",!0),1===h(we)?(d(),c(y,{key:1},[1!=e.hideConditionChangeBtn||1!=e.hideConditionChangeSetting||1!=e.hideConditionChangeSetting||h(_e).filter((e=>e.isShow)).length>0?(d(),c("div",H,[1!=e.hideConditionChangeBtn||1!=e.hideConditionChangeSetting?(d(),c("div",K,[C("span",{class:r(["all-data",{selected:-1!==e.conditionSid.indexOf("all_data")}]),onClick:n[1]||(n[1]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[m(" 全部数据 "),h(Ie).digital||0===h(Ie).digital?(d(),c(y,{key:0},[m(" ("+g(h(Ie).digital||0)+") ",1)],64)):v("v-if",!0)],2),C("div",U,[1!=e.hideConditionChangeBtn?(d(),c("span",{key:0,class:"setting-1",onClick:Ee,style:{"margin-right":"30px"}},[p(h(O),{component:h(w),size:"16"},null,8,["component"]),m(" "+g("切换"))])):v("v-if",!0),1!=e.hideConditionChangeSetting?(d(),c("span",{key:1,class:"setting-1",onClick:Te},[p(h(O),{component:h(I),size:"16"},null,8,["component"]),m(" "+g("设置"))])):v("v-if",!0)])])):v("v-if",!0),C("ul",{class:"tile",style:u({borderBottom:1!=e.hideClearConditionChange?"1px solid #d5d5d5":0})},[(d(!0),c(y,null,k(h(xe).slice(1),((e,i)=>(d(),c(y,null,[e.children&&e.children.length>0?(d(),c("li",{class:"tile-item",key:i},[e.children&&0!==e.children.length?(d(),c(y,{key:1},[C("span",Y,g(e.name),1),C("div",Z,[(d(!0),c(y,null,k(e.children,((i,n)=>(d(),c(y,null,[i.isShow?(d(),c("span",{key:n,class:r(["child-item",{selected:i.selected}]),onClick:n=>Ae(i,0,e)},g(Ue(i.name,null==i?void 0:i.isPublic)),11,ee)):v("v-if",!0)],64)))),256))])],64)):(d(),c("span",{key:0,class:r(["child-item",{selected:e.selected}]),style:{"padding-left":"17px"},onClick:i=>Ae(e)},g(e.name)+" "+g(e.digital),11,X))])):v("v-if",!0)],64)))),256))],4),1!=e.hideClearConditionChange?(d(),c("div",ie,[C("div",ne,"已选择"+g(e.conditionSid.filter((e=>"all_data"!==e)).length)+"项",1),(d(!0),c(y,null,k(h(xe).slice(1),(e=>(d(),c(y,null,[e.children&&0!==e.children.length?(d(!0),c(y,{key:1},k(e.children,((i,n)=>(d(),c(y,null,[i.selected?(d(),c("div",{class:"selected-item",key:i.sid},[m(g(i.name)+" ",1),p(h(O),{component:h(j),onClick:n=>Ae(i,0,e)},null,8,["component","onClick"])])):v("v-if",!0)],64)))),256)):(d(),c("div",{class:"selected-item",key:e.sid},[m(g(e.name)+" ",1),p(h(O),{component:h(j),onClick:i=>Ae(e)},null,8,["component","onClick"])]))],64)))),256)),C("div",{class:"selected-item-del",onClick:n[2]||(n[2]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[le,m(" 清空筛选 ")])])):v("v-if",!0)])):v("v-if",!0)],64)):v("v-if",!0),2===h(we)?(d(),c("div",{key:2,class:"select-type classify-2",ref_key:"selectType",ref:ke},[C("span",{class:"title",onClick:n[3]||(n[3]=()=>We())},[p(h(_),{trigger:"hover",placement:"top"},{trigger:b((()=>[C("span",te,g(h(Pe)),1)])),default:b((()=>[C("span",ae,g(h(Pe)),1)])),_:1}),p(h(O),{component:h(be)?h(B):h(L)},null,8,["component"])]),h(be)?(d(),c("div",se,[C("ul",{class:"tree",style:u({padding:1!=e.hideClearConditionChange?"40px 0":"40px 0 0"})},[(d(!0),c(y,null,k(h(xe),((i,n)=>(d(),c(y,null,[0===n||!i.children||0===i.children.length||i.children&&0!==i.children.filter((e=>e.isShow)).length?(d(),c("li",{key:n,class:r(["tree-item",{"tree-header":0===n||!i.children||0===i.children.length}])},[0!==n&&i.children&&0!==i.children.length?(d(),c(y,{key:1},[0!==i.children.filter((e=>e.isShow)).length?(d(),c("span",{key:0,class:r(["parent",{open:i.open}]),onClick:e=>Me(i)},[m(g(i.name)+g(i.digital||0===i.digital?"("+i.digital+")":"")+" ",1),p(h(O),{component:i.open?h(L):h(N)},null,8,["component"])],10,ce)):v("v-if",!0),i.open?(d(!0),c(y,{key:1},k(i.children.filter((e=>e.isShow)),((e,n)=>(d(),c("div",{key:n,class:"children",onClick:n=>Ae(e,0,i)},[e.isShow?(d(),S(h(_),{key:0,placement:"right",trigger:"hover","z-index":1e4},{trigger:b((()=>[C("span",{class:r(["child-item",{selected:e.selected}])},[C("span",null,g(Ue(e.name,null==e?void 0:e.isPublic)),1),e.selected?(d(),S(h(O),{key:0,component:h(z),size:"20"},null,8,["component"])):v("v-if",!0)],2)])),default:b((()=>[C("span",null,g(h(Je)(e)),1)])),_:2},1024)):v("v-if",!0)],8,re)))),128)):v("v-if",!0)],64)):(d(),c(y,{key:0},[C("span",{class:r(["child-item child-header header-item",{selected:i.selected||-1!==e.conditionSid.indexOf("all_data")}]),onClick:e=>Ae(i)},g(i.name),11,oe),C("div",de,[1!=e.hideConditionChangeBtn?(d(),c("span",{key:0,class:"tree-footer-icon",onClick:Ee},[p(h(O),{component:h(w),size:"16"},null,8,["component"]),m(" "+g("切换"))])):v("v-if",!0),1!=e.hideConditionChangeSetting?(d(),c("span",{key:1,class:"tree-footer-icon",onClick:Te},[p(h(O),{component:h(I),size:"16"},null,8,["component"]),m(" "+g("设置"))])):v("v-if",!0)])],64))],2)):v("v-if",!0)],64)))),256))],4),1!=e.hideClearConditionChange?(d(),c("div",he,[C("div",ue,"已选择"+g(e.conditionSid.filter((e=>"all_data"!==e)).length)+"项",1),C("div",{class:"selected-item-del",onClick:n[4]||(n[4]=e=>Ae({sid:"all_data",name:"全部数据",digital:h(Ie).digital}))},[fe,m(" 清空筛选 ")])])):v("v-if",!0)])):v("v-if",!0)],512)):v("v-if",!0),v(" 弹出弹窗 "),p(P,{ref:"search",searchFieldList:e.searchFieldList,conditionList:h(_e),displayCategoryList:h(Le),settingId:h(Ne),tableId:e.tableId,classifyModal:h(ze),onSaveGetTableCondiTionList:De,onCondiTionListInit:$e,onSetClassifyModal:Re},null,8,["searchFieldList","conditionList","displayCategoryList","settingId","tableId","classifyModal"])],6))}});export{pe as default};
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as t,ref as n,computed as l,openBlock as u,createBlock as a,unref as o,mergeProps as r,createSlots as i,renderList as s,withCtx as d,renderSlot as p,nextTick as v}from"vue";import{NDatePicker as f}from"naive-ui";import"../../../shared/utils/index.js";import"lodash-es";import{useDateTime as c}from"../../../shared/hooks/useDateTime.js";import{format as y}from"date-fns";var m=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function}},setup(e,{expose:m}){const h=e,g=t(),M=n(null),R=n(null),k=l((()=>{const e=Reflect.get(g,"type")||"";return["datetime","datetimerange"].includes(e)})),$=l((()=>{if(Reflect.get(g,"format"))return g.format;const e=g.type||"";return k.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),w=l((()=>k.value?$.value.split(" "):"")),{focus:E,blur:I}=c(M,$,g);function _(e){e&&k.value&&v((()=>{var e;R.value=null==(e=M.value)?void 0:e.panelInstRef,c(R,w,g)}))}function x(...e){var t,n,l,u,a;null==(t=h.onConfirm)||t.call(h,...e);const o=Reflect.get(g,"type")||"",r=null==(a=null==(u=null==(l=null==(n=M.value)?void 0:n.inputInstRef)?void 0:l.$el)?void 0:u.querySelector)?void 0:a.call(u,"input");if(!(null==r?void 0:r.value)||!h.updateUnchangedValue||o.includes("range"))return;const i=r.value;r.value=y(new Date,$.value),r.dispatchEvent(new InputEvent("input")),r.value=i,r.dispatchEvent(new InputEvent("input"))}return m({$datePicker:M,focus:E,blur:I}),(e,t)=>(u(),a(o(f),r({ref_key:"datePickerRef",ref:M},e.$attrs,{"onUpdate:show":_,onConfirm:x}),i({_:2},[s(e.$slots,((t,n)=>({name:n,fn:d((()=>[p(e.$slots,n)]))})))]),1040))}});export{m as default};
1
+ import{defineComponent as e,useAttrs as t,ref as n,computed as l,openBlock as u,createBlock as a,unref as o,mergeProps as r,createSlots as i,renderList as s,withCtx as d,renderSlot as p,nextTick as v}from"vue";import{NDatePicker as f}from"naive-ui";import"../../../shared/utils/index.js";import"lodash-es";import{useDateTime as c}from"../../../shared/hooks/useDateTime.js";import{format as y}from"date-fns";var m=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function}},setup(e,{expose:m}){const h=e,g=t(),M=n(null),R=n(null),k=l((()=>{const e=Reflect.get(g,"type")||"";return["datetime","datetimerange"].includes(e)})),$=l((()=>{if(Reflect.get(g,"format"))return g.format;const e=g.type||"";return k.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),w=l((()=>k.value?$.value.split(" "):"")),{focus:E,blur:I}=c(M,$,g);function _(e){e&&k.value&&v((()=>{var e;R.value=null==(e=M.value)?void 0:e.panelInstRef,c(R,w,g,!0)}))}function x(...e){var t,n,l,u,a;null==(t=h.onConfirm)||t.call(h,...e);const o=Reflect.get(g,"type")||"",r=null==(a=null==(u=null==(l=null==(n=M.value)?void 0:n.inputInstRef)?void 0:l.$el)?void 0:u.querySelector)?void 0:a.call(u,"input");if(!(null==r?void 0:r.value)||!h.updateUnchangedValue||o.includes("range"))return;const i=r.value;r.value=y(new Date,$.value),r.dispatchEvent(new InputEvent("input")),r.value=i,r.dispatchEvent(new InputEvent("input"))}return m({$datePicker:M,focus:E,blur:I}),(e,t)=>(u(),a(o(f),r({ref_key:"datePickerRef",ref:M},e.$attrs,{"onUpdate:show":_,onConfirm:x}),i({_:2},[s(e.$slots,((t,n)=>({name:n,fn:d((()=>[p(e.$slots,n)]))})))]),1040))}});export{m as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,onMounted as t,onBeforeUnmount as s,openBlock as o,createElementBlock as a,Fragment as i,createElementVNode as n,createBlock as p,mergeProps as u,unref as c,createCommentVNode as l}from"vue";import{fabric as m}from"../../../shared/utils/fabricjs/index.js";import h from"./components/PopupTip.vue.js";import f from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import{useBirthProcessChart as d}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as v}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";var w=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:w,emit:C}){const g=e,j=r(null),P=r(),{propItems:y,redrawPoints:b,select:I,pointTipProps:M,pointMenuProps:x,clickMenu:A}=function(){const e=[P,g,C,j];switch(g.type){case"birthProcess":return d(...e);case"surgicalAnesthesia":return k(...e);default:return v(...e)}}();return t((()=>{P.value=new m.Canvas(j.value,{width:y.canvasWidth,height:y.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",fireRightClick:!0})})),s((()=>{P.value.off(),P.value.clear()})),w({redrawPoints:b,select:I,canvas:P}),(e,r)=>(o(),a(i,null,[n("canvas",{ref_key:"canvasRef",ref:j},null,512),P.value?(o(),p(h,u({key:0,propItems:c(y)},c(M)),null,16,["propItems"])):l("v-if",!0),P.value?(o(),p(c(f),u({key:1,propItems:c(y)},c(x),{show:c(x).show,"onUpdate:show":r[0]||(r[0]=e=>c(x).show=e),onClickMenu:c(A)}),null,16,["propItems","show","onClickMenu"])):l("v-if",!0)],64))}});export{w as default};
1
+ import{defineComponent as e,ref as r,onMounted as t,onBeforeUnmount as s,openBlock as o,createElementBlock as a,Fragment as i,createElementVNode as n,createBlock as p,mergeProps as u,unref as c,createCommentVNode as l}from"vue";import{fabric as m}from"../../../shared/utils/fabricjs/index.js";import h from"./components/PopupTip.vue.js";import f from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import{useBirthProcessChart as d}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as v}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";var w=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:w,emit:g}){const C=e,j=r(null),P=r(),{propItems:y,redrawPoints:b,select:I,pointTipProps:M,pointMenuProps:T,clickMenu:x}=function(){const e=[P,C,g,j];switch(C.type){case"birthProcess":return d(...e);case"surgicalAnesthesia":return k(...e);default:return v(...e)}}();return t((()=>{P.value=new m.Canvas(j.value,{width:y.canvasWidth,height:y.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",fireRightClick:!0,allowTouchScrolling:!0})})),s((()=>{P.value.off(),P.value.clear()})),w({redrawPoints:b,select:I,canvas:P}),(e,r)=>(o(),a(i,null,[n("canvas",{ref_key:"canvasRef",ref:j},null,512),P.value?(o(),p(h,u({key:0,propItems:c(y)},c(M)),null,16,["propItems"])):l("v-if",!0),P.value?(o(),p(c(f),u({key:1,propItems:c(y)},c(T),{show:c(T).show,"onUpdate:show":r[0]||(r[0]=e=>c(T).show=e),onClickMenu:c(x)}),null,16,["propItems","show","onClickMenu"])):l("v-if",!0)],64))}});export{w as default};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,defaultStyle as l,defaultRectStyle as s}from"../useDraw.js";import{useGrid as a}from"../useGrid.js";import{useBirthProcessCumputedPoint as u}from"../useCumputedPoint.js";import"@vueuse/core";import{getScaleInfo as c,drawScaleNumber as f,drawScaleLine as d}from"../useScaleColumn.js";import{useCommon as p}from"../useCommon.js";import"vue";import{getIndex as h,isEffectiveNode as g}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as m}from"lodash-es";import{format as v}from"date-fns";function y(y,k,w,x,b){const{cumputedX:T,cumputedY:j,getXValue:S,getYValue:C}=u(k),{getEqualXTypes:M,handleAddPrevent:P}=p(y,w),{xAxis:E,grid:G,originX:L,originY:Y,xCellWidth:X,endY:A,startTime:H,leftAddAreaWidth:I,leftScales:D,rightScales:O,yCellHeight:W,endX:V,scaleValues:N,canvasWidth:R,borderStyle:$,rightAddAreaWidth:B,event:F,originYCervix:q,other:z,canvasHeight:J}=k,K=m(N),Q=new Set;function U(){K.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,f)=>{!function(s,f,d){let p,h;const{pointAttr:g={},lineAttr:m={},title:v="",key:b,type:T="circle",childbirthStyle:j={}}=e,M=e.data[d+1],P=ne(M,e);if(s&&P&&!f.breakpoint)h=t([...s,...P],{...m});else if(s&&!P&&!f.breakpoint){const n=ne(M,e);h=n?t([...s,...n],{...m}):null}let E,G;if(f.childbirth){const e=s[1]+W;E=n([s[0],s[1],e],j),c.push(E),G=o([s[0]+X/2,e-W/2],{value:String(f.childbirth),...i,originX:"left",originY:"center",...j}),c.push(G)}const L=u[d-1],Y={origin:{data:f,title:v,key:b||"",dataIndex:l,index:d},leftLine:L,rightLine:h,arrowGroup:E,arrowGroupText:G,...g,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:k.event};L?p=r(T,{left:L.get("x2"),top:L.get("y2"),...Y}):s&&(Y.leftLine=null,p=r(T,{left:s[0],top:s[1],...Y}));u.push(h),p&&(!function(e){F.hovered&&(e.on("mouseover",(()=>{te(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ee(e),function(e){var t,n,o,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+X/2,top:e.top+W/2})}(e),F.hovered&&te(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:S(e.left),value:C(t,e.top)}};y.value.discardActiveObject(),w("change",n),Z(n,"change")}}))}(p),a.push(p),Q.add(p))}(ne(s,e),s,f)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{y.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function Z(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=K.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=h(o.time,l.data);l.data.splice(e,0,o);break}}_()}function _(){var e;Q.size&&(null==(e=y.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}([...Q]))),Q.clear(),U()}function ee(e){const t=e.prevPoint?e.prevPoint.left:L,n=e.nextPoint?e.nextPoint.left:V;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<q&&e.set("top",q),e.top<Y&&e.set("top",Y),e.top>A&&e.set("top",A),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function te(e,t="moving"){const{title:n,key:o,data:i}=e.origin;x.point={x:e.left,y:e.top},x.list=[`${n} ${"hover"===t?i.value:C(o,e.top)}`,`时间 ${S(e.left).slice(-5)}`],x.show=!0}function ne(e,t){if(g(e)&&function(e){const t=H+864e5,n=new Date(e).getTime();return n>=H&&n<=t}(e.time)){const n=T(e.time),o=j(t.key,t.range,e.value);return[n,o<Y?Y:o>A?A:o]}}function oe(e,t){return e+1>t[1]?t[0]:e+1}return a(y,k),function(){const t=new e.Rect({...$,width:R-I-B-1,height:A-1,left:I,top:0,fill:"transparent"});y.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?I:V;t.forEach(((t,n)=>{const{range:a,spaceValue:u,width:p,title:h,titleStyle:g,key:m,position:v="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=t,b=[],T=[],j=r+p/2,S=function(e,t){const n=[],[o,i]=e;for(let e=o;t>0?e<=i:e>=i;e+=t)n.push(e);return n}(a,u),C=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=c(v,r,p),s=A-n*W*k,a=0===n?A-8:n!==S.length-1||Y||q&&"FHR"!==m?s:Y+8;!w||(0===n||n===C-1)&&!x||b.push(f(String(e),t,l,a)),T.push(...d(t,n,o,i,s,W,Y,C))}));const M=new e.Rect({...s,strokeWidth:.5,width:p,height:A,left:j,top:A/2}),P=o([j,Y>0?Y-W/2:W/2],{value:String(h),...i,...g}),E=new e.Group([...T,...b,M,...P?[P]:[]],{objectCaching:!1,...l});y.value.add(E),E.sendToBack(),r+=p}))}t(D),t(O,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:s="top",style:a}=E.time,{show:u,range:c=[0,23],position:f,style:d}=E.processTime;if(t||u){const p=[],h=[],g=[],m=[],v=L+X/2,k=W/2;for(let e=0;e<G.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):oe(p.at(-1),r);p.push(t);const l="top"===s?Y-k:A+k;g.push(o([v+e*X,l],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===f?k:J-k;m.push(o([v+e*X,n],{value:String(t),...i,...d||{}}))}}const w=new e.Group([...g,...m],{objectCaching:!1,...l});y.value.add(w),y.value.sendToBack(w)}}(),function(){var e;const n=Object.values(z),o=[],i={},r=K.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:n,range:o}=r||{},i=j(n,o,10),l=[0,t],s=[-t/e,0],a=[(A-i-t)/e,A-i],u=[V-L,e*(V-L)+t];let c=[],f=[];function d([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=L&&n<=V&&o>=i&&o<=A}function h([e,t]){return[L+e,A-t]}return d(l)&&p(l)&&(c=h(l)),d(s)&&p(s)&&(c=h(s)),d(a)&&p(a)&&(f=h(a)),d(u)&&p(u)&&(f=h(u)),[...c,...f]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=K.find((e=>e.key===n));if(r){const r=j(n,i,0);o.push(t([L,r,V,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:v(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[T(l.time)-L,A-j(n,a,l.value)],[p,h]=[T(c.time)-L,A-j(n,a,c.value)],g=(h-d)/(p-f),m=d-f*g,y=s(g,m);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:m}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(T(v(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-T(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),y.value.add(...o)}(),U(),function(){function e(e,t){const n=K.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}k.event.evented&&y.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=L&&n<=V&&o>=Y&&o<=A&&(b.point={x:n,y:o},b.show=!0,t.target?(b.target=t.target,b.list=["删除节点"],y.value.forEachObject((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&b.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(b.target=null,b.list=["新增节点"],K.filter((e=>e.show)).forEach((i=>{if(!M(n,"key",X).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;b.list.push(e(i,t.pointer))}})),1===b.list.length&&(b.show=!1,P("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=R-B/2;function n(t,n){if(!t.length)return;let l=Y;const s=[];t.forEach((t=>{const o=t.title.split("").join("\n"),a=N.findIndex((e=>e.key===t.key)),u=new e.Text(String(o),{...i,...t.titleStyle||{},originY:"top",left:n,top:l,lineHeight:1}),c=r(t.type,{left:n,top:l+u.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:a,key:t.key,isMenu:!0},originLeft:n,originTop:l+u.height+3,...k.event});l+=u.height+c.height+15,function(e){function t(e){const{left:t,top:n}=e;return t>=L&&t<=V&&n>=Y&&n<=A}e.on("moving",(()=>{e.set("originY","center"),t(e)?(ee(e),te(e)):x.show=!1})),e.on("mouseup:before",(n=>{if(x.show=!1,0===n.e.button&&t(e))if(M(e.left,"key",X).includes(e.origin.key))P("repeat");else{const t={data:{time:S(e.left),value:C(e.origin.key,e.top)},...e.origin};w("add",t),Z(t)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(e)}))}(c),s.push(u,c)})),o(s),y.value.add(...s)}function o(e){const t=e.at(-1),n=(A-Y)/2,o=(t.height+t.top-Y)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}n(D,I/2),n(O,t)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(w("remove",n),Z(n,"remove")):(Object.assign(n,{data:{time:S(e.pointer.x),value:C(e.origin.key,e.pointer.y)}}),w("add",n),Z(n))},redrawPoints:_}}export{y as useBirthProcess};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,defaultStyle as l,defaultRectStyle as s}from"../useDraw.js";import{useGrid as a}from"../useGrid.js";import{useBirthProcessCumputedPoint as u}from"../useCumputedPoint.js";import"@vueuse/core";import{getScaleInfo as c,drawScaleNumber as f,drawScaleLine as d}from"../useScaleColumn.js";import{useCommon as p}from"../useCommon.js";import"vue";import{getIndex as h,isEffectiveNode as g,getTime as v}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as m}from"lodash-es";import{format as y}from"date-fns";function k(k,w,x,b,j){const{cumputedX:S,cumputedY:C,getXValue:T,getYValue:M}=u(w),{getEqualXTypes:P,handleAddPrevent:E}=p(k,x),{xAxis:G,grid:L,originX:Y,originY:X,xCellWidth:A,endY:H,startTime:I,leftAddAreaWidth:O,leftScales:W,rightScales:V,yCellHeight:D,endX:N,scaleValues:R,canvasWidth:$,borderStyle:B,rightAddAreaWidth:F,event:q,originYCervix:z,other:J,canvasHeight:K}=w,Q=m(R),U=new Set;function Z(){Q.filter((t=>t.show)).forEach(((t,l)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,d){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:j="circle",childbirthStyle:S={}}=t,C=t.data[d+1],P=ot(C,t);if(s&&P&&!f.breakpoint)h=e([...s,...P],{...v});else if(s&&!P&&!f.breakpoint){const n=ot(C,t);h=n?e([...s,...n],{...v}):null}let E,G;if(f.childbirth){const t=s[1]+D;E=n([s[0],s[1],t],S),c.push(E),G=o([s[0]+A/2,t-D/2],{value:String(f.childbirth),...i,originX:"left",originY:"center",...S}),c.push(G)}const L=u[d-1],Y={origin:{data:f,title:m,key:y||"",dataIndex:l,index:d},leftLine:L,rightLine:h,arrowGroup:E,arrowGroupText:G,...g,...w.event.hovered?w.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:w.event};L?p=r(j,{left:L.get("x2"),top:L.get("y2"),...Y}):s&&(Y.leftLine=null,p=r(j,{left:s[0],top:s[1],...Y}));u.push(h),p&&(!function(t){q.hovered&&(t.on("mouseover",(()=>{nt(t,"hover")})),t.on("mouseout",(()=>{b.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{et(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+A/2,top:t.top+D/2})}(t),q.hovered&&nt(t)})),t.on("mouseup",(e=>{if(b.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:T(t.left),value:M(e,t.top)}};k.value.discardActiveObject(),x("change",n),_(n,"change")}}))}(p),a.push(p),U.add(p))}(ot(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{k.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function _(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=Q.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=h(o.time,l.data);l.data.splice(t,0,o);break}}tt()}function tt(){var t;U.size&&(null==(t=k.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...U]))),U.clear(),Z()}function et(t){const e=t.prevPoint?t.prevPoint.left:Y,n=t.nextPoint?t.nextPoint.left:N;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<z&&t.set("top",z),t.top<X&&t.set("top",X),t.top>H&&t.set("top",H),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function nt(t,e="moving"){const{title:n,key:o,data:i}=t.origin;b.point={x:t.left,y:t.top},b.list=[`${n} ${"hover"===e?i.value:M(o,t.top)}`,`时间 ${T(t.left).slice(-5)}`],b.show=!0}function ot(t,e){if(g(t)&&function(t){const e=I+864e5,n=v(t);return n>=I&&n<=e}(t.time)){const n=S(t.time),o=C(e.key,e.range,t.value);return[n,o<X?X:o>H?H:o]}}function it(t,e){return t+1>e[1]?e[0]:t+1}return a(k,w),function(){const e=new t.Rect({...B,width:$-O-F-1,height:H-1,left:O,top:0,fill:"transparent"});k.value.add(e)}(),function(){function e(e,n="left"){let r="left"===n?O:N;e.forEach(((e,n)=>{const{range:a,spaceValue:u,width:p,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:y=1,showNumber:w,showMaxMinNumber:x}=e,b=[],j=[],S=r+p/2,C=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(a,u),T=C.length;C.forEach(((t,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=c(m,r,p),s=H-n*D*y,a=0===n?H-8:n!==C.length-1||X||z&&"FHR"!==v?s:X+8;!w||(0===n||n===T-1)&&!x||b.push(f(String(t),e,l,a)),j.push(...d(e,n,o,i,s,D,X,T))}));const M=new t.Rect({...s,strokeWidth:.5,width:p,height:H,left:S,top:H/2}),P=o([S,X>0?X-D/2:D/2],{value:String(h),...i,...g}),E=new t.Group([...j,...b,M,...P?[P]:[]],{objectCaching:!1,...l});k.value.add(E),E.sendToBack(),r+=p}))}e(W),e(V,"right")}(),function(){const{show:e,startTime:n,range:r=[0,23],position:s="top",style:a}=G.time,{show:u,range:c=[0,23],position:f,style:d}=G.processTime;if(e||u){const p=[],h=[],g=[],v=[],m=Y+A/2,y=D/2;for(let t=0;t<L.mainXCell;t++){if(e){const e=0===t?+n.slice(11,13):it(p.at(-1),r);p.push(e);const l="top"===s?X-y:H+y;g.push(o([m+t*A,l],{value:String(e),...i,...a||{}}))}if(u){const e=0===t?c[0]:h.at(-1)+1;h.push(e);const n="top"===f?y:K-y;v.push(o([m+t*A,n],{value:String(e),...i,...d||{}}))}}const w=new t.Group([...g,...v],{objectCaching:!1,...l});k.value.add(w),k.value.sendToBack(w)}}(),function(){var t;const n=Object.values(J),o=[],i={},r=Q.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=C(n,o,10),l=[0,e],s=[-e/t,0],a=[(H-i-e)/t,H-i],u=[N-Y,t*(N-Y)+e];let c=[],f=[];function d([n,o]){return Math.abs(o-t*n-e)<=1}function p([t,e]){const[n,o]=[...h([t,e])];return n>=Y&&n<=N&&o>=i&&o<=H}function h([t,e]){return[Y+t,H-e]}return d(l)&&p(l)&&(c=h(l)),d(s)&&p(s)&&(c=h(s)),d(a)&&p(a)&&(f=h(a)),d(u)&&p(u)&&(f=h(u)),[...c,...f]}n.forEach((t=>{if(!t.show)return;const{key:n}=t;switch(n){case"fetalPresentation":{const{range:i,show:r}=Q.find((t=>t.key===n));if(r){const r=C(n,i,0);o.push(e([Y,r,N,r],{...t}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:y(new Date(v(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[S(l.time)-Y,H-C(n,a,l.value)],[p,h]=[S(c.time)-Y,H-C(n,a,c.value)],g=(h-d)/(p-f),m=d-f*g,k=s(g,m);k.length>0&&(o.push(e(k,{...t})),Object.assign(i,{k:g,b:m}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(y(new Date(v(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(e(u,{...t}))}}})),k.value.add(...o)}(),Z(),function(){function t(t,e){const n=Q.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}w.event.evented&&k.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=Y&&n<=N&&o>=X&&o<=H&&(j.point={x:n,y:o},j.show=!0,e.target?(j.target=e.target,j.list=["删除节点"],k.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&j.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(j.target=null,j.list=["新增节点"],Q.filter((t=>t.show)).forEach((i=>{if(!P(n,"key",A).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<z)return;j.list.push(t(i,e.pointer))}})),1===j.list.length&&(j.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=$-F/2;function n(e,n){if(!e.length)return;let l=X;const s=[];e.forEach((e=>{const o=e.title.split("").join("\n"),a=R.findIndex((t=>t.key===e.key)),u=new t.Text(String(o),{...i,...e.titleStyle||{},originY:"top",left:n,top:l,lineHeight:1}),c=r(e.type,{left:n,top:l+u.height+3,...e.pointAttr,originY:"top",origin:{title:e.title,unit:e.unit,type:e.type,dataIndex:a,key:e.key,isMenu:!0},originLeft:n,originTop:l+u.height+3,...w.event});l+=u.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=Y&&e<=N&&n>=X&&n<=H}t.on("moving",(()=>{t.set("originY","center"),e(t)?(et(t),nt(t)):b.show=!1})),t.on("mouseup:before",(n=>{if(b.show=!1,0===n.e.button&&e(t))if(P(t.left,"key",A).includes(t.origin.key))E("repeat");else{const e={data:{time:T(t.left),value:M(t.origin.key,t.top)},...t.origin};x("add",e),_(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),s.push(u,c)})),o(s),k.value.add(...s)}function o(t){const e=t.at(-1),n=(H-X)/2,o=(e.height+e.top-X)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}n(W,O/2),n(V,e)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(x("remove",n),_(n,"remove")):(Object.assign(n,{data:{time:T(t.pointer.x),value:M(t.origin.key,t.pointer.y)}}),x("add",n),_(n))},redrawPoints:tt}}export{k as useBirthProcess};
@@ -1 +1 @@
1
- import{ref as e,reactive as a,computed 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"lodash-es";import{useEvent as i,useCanvasEvent as s}from"../useEvent.js";import"../temperature/useShadow.js";import{useBirthProcess as n}from"./useBirthProcess.js";function o(o,d,v,c){const h=e(),p=e(),m=e(),g=a({show:!1,point:{x:0,y:0},list:[]}),f=a({show:!1,point:{x:0,y:0},list:[],target:null}),x=t((()=>d.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),w=t((()=>d.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=t((()=>{var e;return(null==(e=w.value)?void 0:e.length)?30:0})),V=t((()=>{var e;return 30+(null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),b=t((()=>{var e;const{width:a}=d.data,t=null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-y.value-t})),A=t((()=>d.data.grid.mainXCell)),j=t((()=>{const e=d.data.grid.mainYCell||14;return d.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),C=t((()=>(b.value-V.value)/A.value)),k=t((()=>{const{xAxis:e,height:a}=d.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+t)})),Y=t((()=>{const{xAxis:e}=d.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return k.value*a})),P=t((()=>{var e;const{scaleValues:a}=d.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 S.value-l*r*k.value})),S=t((()=>{const{xAxis:e,height:a}=d.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-k.value*t})),H=t((()=>new Date(d.data.xAxis.time.startTime).getTime())),X=t((()=>36e5/C.value)),F=t((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/k.value})),R=t((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/k.value})),T=t((()=>{const{scaleValues:e}=d.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/k.value})),W=t((()=>{var e;return(null==(e=d.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),M=a({canvasWidth:d.data.width,canvasHeight:d.data.height,borderStyle:{...u,...d.data.borderStyle||{}},selectionStyle:d.data.selectionStyle||{},grid:d.data.grid,other:d.data.other,originX:V.value,endX:b.value,originY:Y.value,endY:S.value,xCellWidth:C.value,yCellHeight:k.value,gridXNumber:A.value,gridYNumber:j.value,xAxis:d.data.xAxis,leftScales:x.value,rightScales:w.value,leftAddAreaWidth:30,rightAddAreaWidth:y.value,startTime:H.value,timeXCell:X.value,cervixYCell:F.value,FHRYCell:R.value,fetalPresentationYCell:T.value,scaleValues:d.data.scaleValues,event:W.value,originYCervix:P.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=n(o,M,v,g,f);p.value=a,m.value=e,i(c.value);const{select:t}=s(o,M,v);h.value=t}))})),{propItems:M,redrawPoints:p,select:h,pointTipProps:g,pointMenuProps:f,clickMenu:m}}export{o as useBirthProcessChart};
1
+ import{ref as e,reactive as a,computed as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{useEvent as s,useCanvasEvent as n}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import{useBirthProcess as o}from"./useBirthProcess.js";function d(d,v,c,h){const p=e(),m=e(),f=e(),x=a({show:!1,point:{x:0,y:0},list:[]}),g=a({show:!1,point:{x:0,y:0},list:[],target:null}),w=t((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=t((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=t((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),b=t((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),j=t((()=>{var e;const{width:a}=v.data,t=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-t})),A=t((()=>v.data.grid.mainXCell)),C=t((()=>{const e=v.data.grid.mainYCell||14;return v.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),k=t((()=>(j.value-b.value)/A.value)),Y=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(C.value+t)})),P=t((()=>{const{xAxis:e}=v.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return Y.value*a})),S=t((()=>{var e;const{scaleValues:a}=v.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!P.value)return P.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*Y.value})),H=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-Y.value*t})),X=t((()=>i(v.data.xAxis.time.startTime))),F=t((()=>36e5/k.value)),R=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),W=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/Y.value})),M=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),O=t((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),T=a({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...u,...v.data.borderStyle||{}},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:b.value,endX:j.value,originY:P.value,endY:H.value,xCellWidth:k.value,yCellHeight:Y.value,gridXNumber:A.value,gridYNumber:C.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:X.value,timeXCell:F.value,cervixYCell:R.value,FHRYCell:W.value,fetalPresentationYCell:M.value,scaleValues:v.data.scaleValues,event:O.value,originYCervix:S.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=o(d,T,c,x,g);m.value=a,f.value=e,s(h.value);const{select:t}=n(d,T,c);p.value=t}))})),{propItems:T,redrawPoints:m,select:p,pointTipProps:x,pointMenuProps:g,clickMenu:f}}export{d as useBirthProcessChart};
@@ -1 +1 @@
1
- import{ref as t,reactive as e,onMounted as i,nextTick as r}from"vue";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as n}from"date-fns";import{getChildrenSize as a}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as s,range as l}from"lodash-es";import"../temperature/useShadow.js";import{useTop as d}from"./useTop.js";import{useCenter as p}from"./useCenter.js";function u(u,c,h,m){var g;const f=t(),x=t(),w=t(),b=e({show:!1,point:{x:0,y:0},list:[]}),y=e({show:!1,point:{x:0,y:0},list:[],target:null}),v=null!=(g=c.data.left.width)?g:0,Y=a(c.data.top.treeData),j=function(){const{xAxis:t}=c.data;return"top"===t.position?t.height:0}(),C=function(){console.log(v);const t=s(c.data.top.treeData);let e=0;const{cellWidth:i,cellHeight:r}=c.data.top.tree;return function t(o,n=0){o.forEach((o=>{var s;const l={top:e*r+j,left:n*i,width:i,height:r};if(e++,null==(s=o.children)?void 0:s.length){e--;const i=a(o.children);l.height=i*r,t(o.children,n+1)}else l.width=v-l.left;Object.assign(o,l)}))}(t),t}();console.log(C);const H=function(){const{grid:t}=c.data;return t.mainXCell*t.subXCell}(),D=c.data.top.tree.cellHeight,X=j+D*Y,A=function(){const t=s(c.data.xAxis),{position:e,startTime:i,spaceValue:r,spaceTimeStamp:o}=t,a=Date.parse(i),d=l(H/r+1).map((t=>0===t?i:n(new Date(a+t*o),"yyyy-MM-dd HH:mm:ss")));return{...t,list:d,left:v,top:"top"===e?0:X}}(),G=function(){const{grid:t}=c.data;return t.mainYCell*t.subYCell}(),M=function(){var t;const{width:e,right:i}=c.data;if(!i)return e;return e-(null!=(t=i.width)?t:0)}(),S=c.data.xAxis.height+D*Y,T=function(){var t;const{bottom:e=null,height:i}=c.data;if(!e)return i;return i-(null!=(t=e.height)?t:0)}(),N=(M-v)/H,P=(T-S)/G,W=e({canvasWidth:c.data.width,canvasHeight:c.data.height,borderStyle:{...o,...c.data.borderStyle||{}},grid:c.data.grid,top:c.data.top,other:c.data.other,topGridYNumber:Y,topGridYCellHeight:D,topGridOriginY:j,topGridEndY:X,treeData:C,xAxis:A,gridXNumber:H,gridYNumber:G,xCellWidth:N,yCellHeight:P,originX:v,endX:M,originY:S,endY:T});return i((async()=>{await r(),d(u,W),p(u,W)})),{propItems:W,redrawPoints:x,select:f,pointTipProps:b,pointMenuProps:y,clickMenu:w}}export{u as useSurgicalAnesthesiaChart};
1
+ import{ref as t,reactive as e,onMounted as i,nextTick as r}from"vue";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as a}from"date-fns";import{getChildrenSize as n}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as s,range as d}from"lodash-es";import"../temperature/useShadow.js";import{useTop as l}from"./useTop.js";import{useCenter as p}from"./useCenter.js";function u(u,h,c,m){var f,g;const x=t(),w=t(),y=t(),b=e({show:!1,point:{x:0,y:0},list:[]}),v=e({show:!1,point:{x:0,y:0},list:[],target:null}),C=null!=(f=h.data.left.width)?f:0,H=n(h.data.top.treeData),Y=function(){const{xAxis:t}=h.data;return"top"===t.position?t.height:0}(),j=function(){const t=s(h.data.top.treeData);let e=0;const{cellWidth:i,cellHeight:r}=h.data.top.tree;return function t(o,a=0){o.forEach((o=>{var s;const d={top:e*r+Y,left:a*i,width:i,height:r};if(e++,null==(s=o.children)?void 0:s.length){e--;const i=n(o.children);d.height=i*r,t(o.children,a+1)}else d.width=C-d.left;Object.assign(o,d)}))}(t),t}();console.log(j);const D=function(){const{grid:t}=h.data;return t.mainXCell*t.subXCell}(),M=h.data.top.tree.cellHeight,T=Y+M*H,X=function(){const t=s(h.data.xAxis),{position:e,startTime:i,spaceValue:r,spaceTimeStamp:o}=t,n=Date.parse(i),l=d(D/r+1).map((t=>0===t?i:a(new Date(n+t*o),"yyyy-MM-dd HH:mm:ss")));return{...t,list:l,left:C,top:"top"===e?0:T}}(),A=function(){const{grid:t}=h.data;return t.mainYCell*t.subYCell}(),G=function(){var t;const{width:e,right:i}=h.data;if(!i)return e;return e-(null!=(t=i.width)?t:0)}(),S=h.data.xAxis.height+M*H,N=function(){var t;const{bottom:e=null,height:i}=h.data;if(!e)return i;return i-(null!=(t=e.height)?t:0)}(),P=(G-C)/D,W=(N-S)/A,E=Date.parse((null==(g=h.data.xAxis)?void 0:g.startTime)||a(new Date,"yyyy-MM-dd HH:mm:ss")),O=36e5/P,k=e({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...o,...h.data.borderStyle||{}},grid:h.data.grid,top:h.data.top,other:h.data.other,topGridYNumber:H,topGridYCellHeight:M,topGridOriginY:Y,topGridEndY:T,treeData:j,xAxis:X,startTime:E,timeXCell:O,gridXNumber:D,gridYNumber:A,xCellWidth:P,yCellHeight:W,originX:C,endX:G,originY:S,endY:N});return i((async()=>{await r(),l(u,k),p(u,k)})),{propItems:k,redrawPoints:w,select:x,pointTipProps:b,pointMenuProps:v,clickMenu:y}}export{u as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as o}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"../temperature/useShadow.js";function r(r,i){const{grid:s,originX:a,endX:n,xCellWidth:u,gridXNumber:p,top:c,topList:l,canvasWidth:d,borderStyle:h,treeData:m,xAxis:f}=i;!function(){const{height:i,list:s,left:a,top:n,spaceValue:p}=f,c=[],l=n+i/2;s.forEach(((t,o)=>{const r=a+o*u*p;c.push(e([r,l],{value:t.slice(11,16)}))}));const d=c.length>0?new t.Group([...c],{...o,objectCaching:!1}):null;d&&r.value.add(d)}()}export{r as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,drawTextGroup as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"../temperature/useShadow.js";function n(n,l){const{grid:d,originX:s,endX:u,xCellWidth:a,gridXNumber:h,top:p,topList:c,canvasWidth:g,borderStyle:f,treeData:m,xAxis:v,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:x,topGridEndY:G}=l;r(n,{...l,gridYNumber:j,originY:b,yCellHeight:x,endY:G}),function(){const{height:o,list:r,left:l,top:d,spaceValue:s}=v,u=[],h=d+o/2;r.forEach(((t,i)=>{const o=l+i*a*s;u.push(e([o,h],{value:t.slice(11,16)}))}));const p=u.length>0?new t.Group([...u],{...i,objectCaching:!1}):null;p&&n.value.add(p)}(),function(){var e;const r=(null==(e=null==p?void 0:p.tree)?void 0:e.textStyle)||{},l=[];!function t(e){e.forEach((e=>{var i;const{width:n,height:d,left:s,top:u,title:a=""}=e,h={value:a,...r};(null==(i=e.children)?void 0:i.length)?(h.value=a.split("").join("\n"),t(e.children)):h.textAlign="left",l.push(o({width:n,height:d,...f},h,{left:s,top:u},!0))}))}(m);const d=l.length>0?new t.Group([...l],{...i,objectCaching:!1}):null;d&&n.value.add(d)}()}export{n as useTop};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as 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,getIndex as h,deleteProperty as v}from"../../utils/index.js";import"@vueuse/core";import{useCommon as g}from"../useCommon.js";import"vue";import{cloneDeep as y}from"lodash-es";import{TEMPERATURE_MENU as m,PAIN_MENU as x,OVERLAP as b}from"../../constants/index.js";function w(w,j,L,k,Y,S,E,$,M,T){r(w,j);const{getEqualXTypes:P,handleAddPrevent:O}=g(w,L),{createShadowLines:A}=t(),{left:I,xScaleList:C,xCellWidth:D,yCellHeight:R,originX:X,endX:z,originY:V,endY:F,itemList:_,event:G,vitalSignsOriginY:H,painOriginY:q,hospitalizationDate:W,config:B,canvasHeight:J}=j,K=new Set,N=["xinmai","mai"],Q=new Map,U=new Set,Z=new Set,ee=new Set,te=y(I.yScaleValue);function ie(t){var i;const o=te.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(K.size&&w.value.remove(...K),K.clear(),Q.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Q.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of Q)t.push(e[1]),e[0]===N[0]&&e[1].forEach((e=>{(Q.get(N[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})().forEach((t=>{var i,l,s,r,a,u;const c=t.map((e=>({x:e[0],y:e[1]}))),p=new e.Polygon(c,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){p.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),K.add(e)})),w.value.add(...e)}K.add(p),w.value.add(p)}))}}function ne(){var e;const t=te.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({},b,I.overlap||{}),l=[];U.size&&[...U].forEach((e=>{[...Z].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(),ee.add(e)}))}))}function oe(e,t,r){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:k=[]}=r,S=[],$=[],T=[];null==(u=e.list)||u.forEach(((u,P)=>{const O=a(c)?k.find((e=>e.key===u.key)):e,A=re(u,r),I={};I.value=function(e,t,i){if(!(null==e?void 0:e.length)||!B.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=H.originY+R?e[1]+R:e[1]-R,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return T.push(s),{obj:s,top:-R}}(A,u,O),function(e,t,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=a,{value:x}=u;let b,w,j,L,k,S;if(t.noRise&&h.show)if(h.text)j=l([e[0],e[1]+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),T.push(j);else{const t=e[1]+2*R;L=s([e[0],e[1],t],h.style||{}),T.push(L)}t.rise&&f.show&&f.text&&(k=l([e[0],e[1]-(x?R:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),T.push(k));t.verified&&(S=l([e[0],e[1]-(x?R:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),T.push(S));if(p(t.physicsReduce)||p(t.drugReduce)){const l=Y(c,r.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===J?"bottom":"center"}),b&&T.push(b),w&&T.push(w)}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5},arrowGroup:{obj:L,top:2*R},riseText:{obj:k,top:(x?-R:0)-5},verifiedText:{obj:S,top:(x?-R:0)-5},reducePoint:{obj:w,type:"reduce"}})}(A,u,O,I),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*R,i=[e[1]-R/2,t];t<H.originY&&(t=e[1]+2.5*R,i=[t,e[1]+R/2]),o=s([e[0],i[0],i[1]],m,"up"),T.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+R/2+o.height:e[1]+R;a=l([e[0],t],i),T.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-R],i),T.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-R}})}(A,u,O,I),function(n,l,s,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,k=e.list[s+1],Y=re(k,r),T=le(c,e.list[s].value),P=Y&&le(c,k.value);!n||!Y||l.breakpoint||T||P||n[0]===Y[0]||(f=i([...n,...Y],{...v}));const O=l.pacemakerShow&&"pulse"==c?y.value:T?0:x,A=$[s-1],I={origin:{data:l,title:g,key:m||"",unit:r.unit,type:c,_type:d(g,c),dataIndex:t,index:s},leftLine:A,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...j.event.hovered?j.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:j.event,...T?{selectable:!1,evented:!1,...b}:{}};if(A){const e=A.get("y2");p=o(O,{left:A.get("x2"),top:T?e-5:e,...I})}else n&&(I.leftLine=null,p=o(O,{left:n[0],top:T?n[1]-5:n[1],...I}));$.push(f),p&&(g.includes("脉搏")?U.add(p):Z.add(p),function(e){G.hovered&&(e.on("mouseover",(()=>{se(e,"hover")})),e.on("mouseout",(()=>{M.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?q:H;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}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ie(e)}(e),G.hovered&&se(e)})),e.on("mouseup",(t=>{if(M.show=!1,1===t.button){const{type:t}=e.origin,i=E(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};w.value.discardActiveObject(),L("change",n),ue(n,"change")}}))}(p),S.push(p),ee.add(p))}(A,u,P,O,I)})),"pulse"===c&&N.forEach((e=>{Q.set(e,S.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(S).then((e=>{const t=$.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(T).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 le(e,t){return"pain"===e&&0==t}function se(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;M.point={x:e.left,y:e.top},M.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:E(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)||S(e.left)).slice(-5)}`],M.show=!0}function re(e,t){const i="pain"===t.type?q:H;if(f(e)&&function(e){const[t]=C,i=C.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=k(e.time),o=Y(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ae(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${S(e)}:00`).getTime();return W&&l<new Date(W).getTime()?(O("exceedMin"),!1):!(l>o)||(O("exceedMax"),!1)}function ue(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=te.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=h(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;ee.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}([...ee]))),Q.clear(),ee.clear(),U.clear(),Z.clear(),te.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||oe(t,i,e)}))})),ie(),ne()}return Q.clear(),U.clear(),Z.clear(),te.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=Y(e.type,e.list,e.positionLine.value),n=i([X,t,z,t],e.positionLine);w.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||oe(t,i,e)}))})),ie(),ne(),j.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>=X&&i<=z&&n>=V&&n<=F){T.point={x:i,y:n},T.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(T.list=[...m]),"pain"===o&&(T.list=[...x]),T.target=e.target;else{T.target=null,T.list=["新增节点"],_.forEach((t=>{if(!P(i,"_type",D).includes(t.bigType)){const i=["pain"].includes(t.bigType)?q:H;n>=i.originY&&n<=i.endY&&T.list.push({renderItem:$?$(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=ae(i);t&&1!==T.list.length||(T.show=!1,1===T.list.length&&t&&O("repeat"))}}}})),{pointTipProps:M,pointMenuProps:T,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=v(i,[...m,...x]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};L("change",r),ue(r,"change")}else{const t={data:{time:S(e.pointer.x),value:E(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};L("add",t),ue(t)}},setPopup:se,isAddPoint:ae,updateData:ue,redrawPoints:ce}}export{w as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as w}from"../../constants/index.js";function j(j,L,k,Y,S,E,$,M,P,O){r(j,L);const{getEqualXTypes:T,handleAddPrevent:A}=y(j,k),{createShadowLines:I}=t(),{left:C,xScaleList:R,xCellWidth:X,yCellHeight:z,originX:D,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=L,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=m(C.yScaleValue);function ne(t){var i;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(N.size&&j.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[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})().forEach((t=>{var i,l,s,r,a,u;const c=t.map((e=>({x:e[0],y:e[1]}))),p=new e.Polygon(c,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){p.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=I(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),j.value.add(...e)}N.add(p),j.value.add(p)}))}}function oe(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},w,C.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].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((()=>{j.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,t,r){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:w=[]}=r,Y=[],E=[],M=[];null==(u=e.list)||u.forEach(((u,O)=>{const T=a(c)?w.find((e=>e.key===u.key)):e,A=ae(u,r),I={};I.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return M.push(s),{obj:s,top:-z}}(A,u,T),function(e,t,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=a,{value:x}=u;let b,w,j,L,k,Y;if(t.noRise&&h.show)if(h.text)j=l([e[0],e[1]+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),M.push(j);else{const t=e[1]+2*z;L=s([e[0],e[1],t],h.style||{}),M.push(L)}t.rise&&f.show&&f.text&&(k=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),M.push(k));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),M.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=S(c,r.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===K?"bottom":"center"}),b&&M.push(b),w&&M.push(w)}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5},arrowGroup:{obj:L,top:2*z},riseText:{obj:k,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:w,type:"reduce"}})}(A,u,T,I),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=s([e[0],i[0],i[1]],m,"up"),M.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),M.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-z],i),M.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(A,u,T,I),function(n,l,s,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,w=e.list[s+1],S=ae(w,r),M=se(c,e.list[s].value),O=S&&se(c,w.value);!n||!S||l.breakpoint||M||O||n[0]===S[0]||(f=i([...n,...S],{...v}));const T=l.pacemakerShow&&"pulse"==c?y.value:M?0:x,A=E[s-1],I={origin:{data:l,title:g,key:m||"",unit:r.unit,type:c,_type:d(g,c),dataIndex:t,index:s},leftLine:A,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...L.event.hovered?L.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:L.event,...M?{selectable:!1,evented:!1,...b}:{}};if(A){const e=A.get("y2");p=o(T,{left:A.get("x2"),top:M?e-5:e,...I})}else n&&(I.leftLine=null,p=o(T,{left:n[0],top:M?n[1]-5:n[1],...I}));E.push(f),p&&(g.includes("脉搏")?Z.add(p):ee.add(p),function(e){H.hovered&&(e.on("mouseover",(()=>{re(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?W: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}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(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}};j.value.discardActiveObject(),k("change",n),ce(n,"change")}}))}(p),Y.push(p),te.add(p))}(A,u,O,T,I)})),"pulse"===c&&Q.forEach((e=>{U.set(e,Y.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(Y).then((e=>{const t=E.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(M).then((i=>{j.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&j.value.remove(e.leftLine),e.rightLine&&j.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(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)||E(e.left)).slice(-5)}`],P.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(f(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=S(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${E(e)}:00`);return B&&l<h(B)?(A("exceedMin"),!1):!(l>o)||(A("exceedMax"),!1)}function ce(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;pe()}function pe(){var e;te.size&&(null==(e=j.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=S(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);j.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),L.event.evented&&j.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=F&&n<=_){O.point={x:i,y:n},O.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(O.list=[...x]),"pain"===o&&(O.list=[...b]),O.target=e.target;else{O.target=null,O.list=["新增节点"],G.forEach((t=>{if(!T(i,"_type",X).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&O.list.push({renderItem:M?M(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=ue(i);t&&1!==O.list.length||(O.show=!1,1===O.list.length&&t&&A("repeat"))}}}})),{pointTipProps:P,pointMenuProps:O,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};k("change",r),ce(r,"change")}else{const t={data:{time:E(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};k("add",t),ce(t)}},setPopup:re,isAddPoint:ue,updateData:ce,redrawPoints:pe}}export{j as useCenter};
@@ -1 +1 @@
1
- import{ref as e,reactive as t,computed as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useEvent as n,useCanvasEvent as o}from"../useEvent.js";import{setOtherType as s,getFloorNumber as d}from"../../utils/index.js";import"lodash-es";import{format as v,addDays as c}from"date-fns";import{useTop as p}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function Y(Y,S,b,w){const C=15,x=e(),D=e(),j=e(),V=t({show:!1,point:{x:0,y:0},list:[]}),X=t({show:!1,point:{x:0,y:0},list:[],target:null}),H=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||C)||0})),L=a((()=>{var e;const{top:t}=S.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||C)||0})),M=a((()=>{var e;const{top:t}=S.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||C)||0})),P=a((()=>{var e,t,a;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),I=a((()=>{var e;const{bottom:t}=S.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),N=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+e.surplusXCell})),O=a((()=>{const{grid:e}=S.data;return e.mainYCell*e.subYCell+e.surplusYCell})),W=a((()=>{var e;const{width:t,right:a=null,top:l}=S.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),$=a((()=>{const{grid:e}=S.data;return W.value-e.surplusXCell*q.value})),k=a((()=>{const{top:e,left:t}=S.data;return e.titleWidth+A.value})),G=a((()=>{const{bottom:e=null,height:t}=S.data;if(!e)return t;return t-(e.height||30)})),R=a((()=>{var e;const{top:t}=S.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||C)||0;return H.value+a+l+L.value+M.value})),T=a((()=>{const{grid:e}=S.data;return R.value+e.surplusYCell*z.value})),q=a((()=>(W.value-k.value)/N.value)),z=a((()=>(G.value-R.value)/O.value)),A=a((()=>{var e,t;const{left:a}=S.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),B=a((()=>{var e,t;const{top:a,grid:l}=S.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let r=k.value-q.value;const n=a.date.startDate||v(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(v(c(new Date(n),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()})),E=a((()=>ie("breathe"))),F=a((()=>ie("pulse"))),J=a((()=>ie("temperature"))),K=a((()=>ie("pain"))),Q=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=a((()=>{const{left:e}=S.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:s(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=a((()=>{const{left:e}=S.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),_=a((()=>{const{grid:e}=S.data;return-1===Z.value?0:z.value*e.subYCell})),ee=a((()=>{const{left:e}=S.data,t={originY:G.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=T.value,t.endY=T.value+_.value):Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value,t.endY=G.value),t})),te=a((()=>{const{left:e}=S.data,t={originY:R.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=T.value+_.value,t.endY=G.value):Z.value===e.yScaleValue.length-1&&(t.originY=T.value,t.endY=G.value-_.value),t})),ae=a((()=>{var e,t;const{top:a,grid:l}=S.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),le=a((()=>{var e;const{left:t,right:a}=S.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>d(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ue=t({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...i,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:L.value,operationDaysHeight:M.value,xScalevalueHeight:P.value,topList:ae.value,breathingHeight:I.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:N.value,gridYNumber:O.value,iconsWidth:A.value,originX:k.value,originY:R.value,originYLimit:T.value,endX:W.value,endXLimit:$.value,endY:G.value,xCellWidth:q.value,yCellHeight:z.value,xScaleList:B.value,breatheYCell:E.value,pulseYCell:F.value,temperatureYCell:J.value,painYCell:K.value,event:Q.value,itemList:U.value,getRightInfo:le.value,config:S.data.config||{}});function ie(e){const{yScaleValue:t}=S.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?z.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:re,cumputedY:ne,getXValue:oe,getYValue:se}=r(ue);return l((()=>{u((()=>{p(Y,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u}=m(Y,ue,b,re,ne,oe,se,S.addRenderItem,V,X);D.value=l,j.value=u;const{drawScaleValue:i}=h(Y,ue,b,e,V,re,ne,oe,se,t,a);g(Y,ue,i),f(Y,ue),y(Y,ue,re),n(w.value);const{select:r}=o(Y,ue,b);x.value=r}))})),{propItems:ue,redrawPoints:D,select:x,pointTipProps:V,pointMenuProps:X,clickMenu:j}}export{Y as useTemperatureChart};
1
+ import{ref as e,reactive as t,computed as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useEvent as n,useCanvasEvent as o}from"../useEvent.js";import{setOtherType as s,getFloorNumber as d}from"../../utils/index.js";import"lodash-es";import{format as v,addDays as c}from"date-fns";import{useTop as p}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function Y(Y,S,b,w){const C=15,x=e(),D=e(),j=e(),V=t({show:!1,point:{x:0,y:0},list:[]}),X=t({show:!1,point:{x:0,y:0},list:[],target:null}),H=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||C)||0})),L=a((()=>{var e;const{top:t}=S.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||C)||0})),M=a((()=>{var e;const{top:t}=S.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||C)||0})),P=a((()=>{var e,t,a;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),I=a((()=>{var e;const{bottom:t}=S.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),N=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+e.surplusXCell})),O=a((()=>{const{grid:e}=S.data;return e.mainYCell*e.subYCell+e.surplusYCell})),W=a((()=>{var e;const{width:t,right:a=null,top:l}=S.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),$=a((()=>{const{grid:e}=S.data;return W.value-e.surplusXCell*q.value})),k=a((()=>{const{top:e,left:t}=S.data;return e.titleWidth+A.value})),G=a((()=>{const{bottom:e=null,height:t}=S.data;if(!e)return t;return t-(e.height||30)})),R=a((()=>{var e;const{top:t}=S.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||C)||0;return H.value+a+l+L.value+M.value})),T=a((()=>{const{grid:e}=S.data;return R.value+e.surplusYCell*z.value})),q=a((()=>(W.value-k.value)/N.value)),z=a((()=>(G.value-R.value)/O.value)),A=a((()=>{var e,t;const{left:a}=S.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),B=a((()=>{var e,t;const{top:a,grid:l}=S.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let r=k.value-q.value;const n=a.date.startDate||v(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(v(c(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=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()})),E=a((()=>ie("breathe"))),F=a((()=>ie("pulse"))),J=a((()=>ie("temperature"))),K=a((()=>ie("pain"))),Q=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),U=a((()=>{const{left:e}=S.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:s(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Z=a((()=>{const{left:e}=S.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),_=a((()=>{const{grid:e}=S.data;return-1===Z.value?0:z.value*e.subYCell})),ee=a((()=>{const{left:e}=S.data,t={originY:G.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=T.value,t.endY=T.value+_.value):Z.value===e.yScaleValue.length-1&&(t.originY=G.value-_.value,t.endY=G.value),t})),te=a((()=>{const{left:e}=S.data,t={originY:R.value,endY:G.value};return 0===Z.value&&e.yScaleValue.length>1?(t.originY=T.value+_.value,t.endY=G.value):Z.value===e.yScaleValue.length-1&&(t.originY=T.value,t.endY=G.value-_.value),t})),ae=a((()=>{var e,t;const{top:a,grid:l}=S.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),le=a((()=>{var e;const{left:t,right:a}=S.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>d(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ue=t({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...i,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:H.value,hospitalDaysHeight:L.value,operationDaysHeight:M.value,xScalevalueHeight:P.value,topList:ae.value,breathingHeight:I.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:Z.value,painHeight:_.value,painOriginY:ee.value,vitalSignsOriginY:te.value,gridXNumber:N.value,gridYNumber:O.value,iconsWidth:A.value,originX:k.value,originY:R.value,originYLimit:T.value,endX:W.value,endXLimit:$.value,endY:G.value,xCellWidth:q.value,yCellHeight:z.value,xScaleList:B.value,breatheYCell:E.value,pulseYCell:F.value,temperatureYCell:J.value,painYCell:K.value,event:Q.value,itemList:U.value,getRightInfo:le.value,config:S.data.config||{}});function ie(e){const{yScaleValue:t}=S.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?z.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:re,cumputedY:ne,getXValue:oe,getYValue:se}=r(ue);return l((()=>{u((()=>{p(Y,ue);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u}=m(Y,ue,b,re,ne,oe,se,S.addRenderItem,V,X);D.value=l,j.value=u;const{drawScaleValue:i}=h(Y,ue,b,e,V,re,ne,oe,se,t,a);g(Y,ue,i),f(Y,ue),y(Y,ue,re),n(w.value);const{select:r}=o(Y,ue,b);x.value=r}))})),{propItems:ue,redrawPoints:D,select:x,pointTipProps:V,pointMenuProps:X,clickMenu:j}}export{Y as useTemperatureChart};
@@ -1 +1 @@
1
- import{format as n}from"date-fns";import{getFloorNumber as e}from"../utils/index.js";function t(t){const{xScaleList:i,originX:r,endY:u,xCellWidth:l,left:c,vitalSignsOriginY:o,painOriginY:a,canvasWidth:d}=t;return{cumputedX:function(n,e=!1){const t=new Date(n).getTime(),[r]=i,u=i.at(-1);if(t<r.start)return 0;if(t>u.end)return d;const l=i.findIndex((n=>n.end>=t));if(l>-1){return i[l].center}},cumputedY:function(n,e,i){const r=t[`${n}YCell`],u=+i-Math.min(...e);return("pain"===n?a.endY:o.endY)-r*u},getXValue:function(e){const t=i.findIndex((n=>n.left+l>=e));if(t>-1){const r=i[t],u=e-r.left,l=r.scaleCell*u,c=r.start+l;return n(new Date(c),"yyyy-MM-dd HH:mm")}},getYValue:function(n,i){var r;const u=t[`${n}YCell`],l=(null==(r=c.yScaleValue.find((e=>e.type===n)))?void 0:r.list)||[],d=l.length?Math.min(...l):0,f="pain"===n?a.endY:o.endY;return e((f-i)/u+d)}}}function i(t){const{xAxis:i,originX:r,originY:u,xCellWidth:l,endY:c,timeXCell:o,startTime:a,scaleValues:d}=t;return{cumputedX:function(n){return(new Date(n).getTime()-a)/o+r},cumputedY:function(n,e,i){const[r]=e;return c-(+i-r)/t[`${n}YCell`]},getXValue:function(e){return n(new Date((e-r)*o+a),"yyyy-MM-dd HH:mm")},getYValue:function(n,i){const r=d.find((e=>n===e.key)),[u]=(null==r?void 0:r.range)||[0],l=(c-i)*t[`${n}YCell`]+u;return e(l)}}}export{i as useBirthProcessCumputedPoint,t as useCumputedPoint};
1
+ import{format as n}from"date-fns";import{getTime as t,getFloorNumber as e}from"../utils/index.js";function i(i){const{xScaleList:r,xCellWidth:u,left:l,vitalSignsOriginY:c,painOriginY:o,canvasWidth:d}=i;return{cumputedX:function(n,e=!1){const i=t(n),[u]=r,l=r.at(-1);if(i<u.start)return 0;if(i>l.end)return d;const c=r.findIndex((n=>n.end>=i));if(c>-1){return r[c].center}},cumputedY:function(n,t,e){const r=i[`${n}YCell`],u=+e-Math.min(...t);return("pain"===n?o.endY:c.endY)-r*u},getXValue:function(t){const e=r.findIndex((n=>n.left+u>=t));if(e>-1){const i=r[e],u=t-i.left,l=i.scaleCell*u,c=i.start+l;return n(new Date(c),"yyyy-MM-dd HH:mm")}},getYValue:function(n,t){var r;const u=i[`${n}YCell`],d=(null==(r=l.yScaleValue.find((t=>t.type===n)))?void 0:r.list)||[],a=d.length?Math.min(...d):0,f="pain"===n?o.endY:c.endY;return e((f-t)/u+a)}}}function r(i){const{xAxis:r,originX:u,originY:l,xCellWidth:c,endY:o,timeXCell:d,startTime:a,scaleValues:f}=i;return{cumputedX:function(n){return(t(n)-a)/d+u},cumputedY:function(n,t,e){const[r]=t;return o-(+e-r)/i[`${n}YCell`]},getXValue:function(t){return n(new Date((t-u)*d+a),"yyyy-MM-dd HH:mm")},getYValue:function(n,t){const r=f.find((t=>n===t.key)),[u]=(null==r?void 0:r.range)||[0],l=(o-t)*i[`${n}YCell`]+u;return e(l)}}}export{r as useBirthProcessCumputedPoint,i as useCumputedPoint};
@@ -15,3 +15,4 @@ export declare function isValidValue(value: number | string): boolean;
15
15
  export declare function isOverlapPoint(pointObj1: any, pointObj2: any): boolean;
16
16
  export declare function getFloorNumber(value: number, n?: number): number;
17
17
  export declare function getChildrenSize(treeData: ITreeItem[]): number;
18
+ export declare function getTime(value: number | string): number;
@@ -1 +1 @@
1
- import{isNull as n}from"lodash-es";function t(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function e(n,t){const e={};for(const r in n)t.map((n=>n.type)).includes(r)||(e[r]=n[r]);return e}function r(n,t){const e=t.findIndex((t=>new Date(t.time).getTime()>new Date(n).getTime()));return~e?e:t.length}function u(n){return["temperature","pulse"].includes(n)}function i(n,t){return n.includes("心率")?"pulse_other":t}function o(n){return n.includes("_other")?n.split("_")[0]:n}function l(t){return!Number.isNaN(+t)&&!n(t)}function c(n,t){return f(n.left,1)===f(t.left,1)&&Math.abs(f(n.top,1)-f(t.top,1))<=2}function f(n,t=100){return Math.floor(n*t)/t}function s(n){let t=0;return n.forEach((n=>{var e;(null==(e=n.children)?void 0:e.length)?t+=s(n.children):t++})),t}export{e as deleteProperty,s as getChildrenSize,f as getFloorNumber,r as getIndex,o as getType,t as isEffectiveNode,u as isOneLine,c as isOverlapPoint,l as isValidValue,i as setOtherType};
1
+ import{isNull as n,isNumber as t}from"lodash-es";function e(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function r(n,t){const e={};for(const r in n)t.map((n=>n.type)).includes(r)||(e[r]=n[r]);return e}function u(n,t){const e=t.findIndex((t=>d(t.time)>d(n)));return~e?e:t.length}function o(n){return["temperature","pulse"].includes(n)}function i(n,t){return n.includes("心率")?"pulse_other":t}function l(n){return n.includes("_other")?n.split("_")[0]:n}function c(t){return!Number.isNaN(+t)&&!n(t)}function f(n,t){return a(n.left,1)===a(t.left,1)&&Math.abs(a(n.top,1)-a(t.top,1))<=2}function a(n,t=100){return Math.floor(n*t)/t}function s(n){let t=0;return n.forEach((n=>{var e;(null==(e=n.children)?void 0:e.length)?t+=s(n.children):t++})),t}function d(n){return n?t(n)?new Date(n).getTime():Date.parse(n.replace(/-/g,"/")):Date.now()}export{r as deleteProperty,s as getChildrenSize,a as getFloorNumber,u as getIndex,d as getTime,l as getType,e as isEffectiveNode,o as isOneLine,f as isOverlapPoint,c as isValidValue,i as setOtherType};