cnhis-design-vue 3.2.10-beta.8 → 3.2.10-release.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/es/components/base-search/index.d.ts +3 -0
  2. package/es/components/base-search/src/index.vue.d.ts +3 -0
  3. package/es/components/button-print/src/utils/print.js +1 -1
  4. package/es/components/card-reader-sdk/src/insuranceSDK.js +1 -1
  5. package/es/components/card-reader-sdk/src/utils/index.js +1 -1
  6. package/es/components/classification/index.d.ts +1 -1
  7. package/es/components/classification/src/components/search-filter/index.vue.d.ts +1 -1
  8. package/es/components/classification/src/components/set-classification/index.vue.d.ts +1 -1
  9. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  10. package/es/components/classification/src/index.vue.d.ts +1 -1
  11. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  13. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  14. package/es/components/field-set/index.d.ts +13 -0
  15. package/es/components/field-set/src/FieldColor.vue.d.ts +72 -26
  16. package/es/components/field-set/src/FieldColor.vue2.js +1 -1
  17. package/es/components/field-set/src/FieldFilter.vue.d.ts +19 -4
  18. package/es/components/field-set/src/FieldFilter.vue2.js +1 -1
  19. package/es/components/field-set/src/FieldSet.vue.d.ts +5 -2
  20. package/es/components/field-set/src/Index.vue.d.ts +13 -0
  21. package/es/components/field-set/src/Index.vue2.js +1 -1
  22. package/es/components/field-set/src/components/condition.vue.d.ts +18 -4
  23. package/es/components/field-set/src/components/condition.vue2.js +1 -1
  24. package/es/components/field-set/src/components/edit-dialog.vue.d.ts +63 -22
  25. package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -1
  26. package/es/components/field-set/src/components/edit-filter.vue.d.ts +44 -44
  27. package/es/components/field-set/src/components/edit-filter.vue2.js +1 -1
  28. package/es/components/field-set/src/components/table-row.vue.d.ts +5 -2
  29. package/es/components/field-set/src/components/table-row.vue2.js +1 -1
  30. package/es/components/field-set/style/index.css +1 -1
  31. package/es/components/form-config/index.d.ts +3 -3
  32. package/es/components/form-config/src/FormConfig.vue.d.ts +3 -3
  33. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -3
  34. package/es/components/form-render/index.js +1 -1
  35. package/es/components/form-render/src/components/renderer/combination/combination.d.ts +1 -1
  36. package/es/components/form-render/src/components/renderer/combination/jsonCombination.d.ts +1 -1
  37. package/es/components/form-render/src/components/renderer/combination/tableCombination.d.ts +1 -1
  38. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +1 -1
  39. package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +1 -1
  40. package/es/components/form-render/src/components/renderer/text.d.ts +1 -1
  41. package/es/components/form-render/src/components/renderer/text.js +1 -1
  42. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  43. package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
  44. package/es/components/form-render/src/types/fieldItem.d.ts +1 -1
  45. package/es/components/form-render/src/types/index.d.ts +4 -3
  46. package/es/components/form-render/src/utils/index.d.ts +2 -0
  47. package/es/components/form-render/src/utils/index.js +1 -1
  48. package/es/components/iho-chat/index.d.ts +8 -8
  49. package/es/components/iho-chat/src/Index.vue.d.ts +8 -8
  50. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +1 -1
  51. package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +1 -1
  52. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +1 -1
  53. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  54. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +3 -3
  55. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +2 -2
  56. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  57. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +1 -1
  58. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  59. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +1 -1
  60. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  61. package/es/components/iho-chat/src/utils/index.d.ts +1 -1
  62. package/es/components/iho-chat/src/utils/index.js +1 -1
  63. package/es/components/iho-table/src/plugins/filterDaterangeRenderPlugin/index.js +1 -1
  64. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +1 -0
  65. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  66. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
  67. package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue.d.ts +30 -0
  68. package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue.js +1 -0
  69. package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue2.js +1 -0
  70. package/es/components/iho-table/src/plugins/filterTextPlugin/index.d.ts +1 -0
  71. package/es/components/iho-table/src/plugins/filterTextPlugin/index.js +1 -0
  72. package/es/components/iho-table/src/plugins/headerPlugin/index.js +1 -1
  73. package/es/components/iho-table/src/plugins/index.js +1 -1
  74. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin.js +1 -1
  75. package/es/components/iho-table/src/types/index.d.ts +1 -0
  76. package/es/components/iho-table/src/utils/index.d.ts +3 -1
  77. package/es/components/iho-table/src/utils/index.js +1 -1
  78. package/es/components/index.css +1 -1
  79. package/es/components/index.js +1 -1
  80. package/es/components/quick-search/index.d.ts +18 -0
  81. package/es/components/quick-search/src/index.vue.d.ts +18 -0
  82. package/es/components/quick-search/src/index.vue2.js +1 -1
  83. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  84. package/es/components/scale-view/src/components/formitem/standard-modal.d.ts +1 -1
  85. package/es/components/shortcut-setter/index.d.ts +1 -1
  86. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
  87. package/es/components/table-filter/src/components/bi-filter/helpers/options.d.ts +1 -7
  88. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +1 -1
  89. package/es/components/table-filter/src/components/classify-filter/components/SelectTreeDynamic.vue.d.ts +1 -1
  90. package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +1 -1
  91. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +1 -1
  92. package/es/components/table-filter/src/components/render-widget/components/SelectTreeDynamic.vue.d.ts +1 -1
  93. package/es/components/table-filter/src/components/render-widget/components/index.d.ts +1 -1
  94. package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.d.ts +3 -49
  95. package/es/components/table-filter/src/components/render-widget/helpers/enums.d.ts +1 -18
  96. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +1 -1
  97. package/es/components/table-filter/src/hooks/useAdvanced.d.ts +1 -0
  98. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  99. package/es/components/table-filter/src/hooks/useMixins.d.ts +1 -1
  100. package/es/components/table-filter/src/hooks/useRenderWidget.js +1 -1
  101. package/es/components/table-filter/src/types/index.d.ts +3 -0
  102. package/es/env.d.ts +25 -25
  103. package/es/shared/package.json.js +1 -1
  104. package/package.json +2 -2
@@ -75,6 +75,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
75
75
  advanceColWidth: number | null | undefined;
76
76
  accurateSearch: any;
77
77
  extendKey: string;
78
+ extendType: string;
78
79
  }[];
79
80
  transformParams: (paramsList: any[]) => any;
80
81
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -140,6 +141,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
140
141
  unit?: string | undefined;
141
142
  _extendData?: {
142
143
  _filterApiConfig: any;
144
+ _selectCriticalNum?: number | undefined;
143
145
  } | undefined;
144
146
  _frontId?: any;
145
147
  isRender?: boolean | undefined;
@@ -152,6 +154,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
152
154
  accurateSearch?: any;
153
155
  isAccurateSearchVal?: boolean | undefined;
154
156
  extendKey?: string | undefined;
157
+ extendType?: string | undefined;
155
158
  }[]>;
156
159
  filterChangeFnList: import("vue").Ref<any[]>;
157
160
  showQuickSearch: import("vue").ComputedRef<boolean>;
@@ -76,6 +76,7 @@ declare const _default: import("vue").DefineComponent<{
76
76
  advanceColWidth: number | null | undefined;
77
77
  accurateSearch: any;
78
78
  extendKey: string;
79
+ extendType: string;
79
80
  }[];
80
81
  transformParams: (paramsList: any[]) => any;
81
82
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -141,6 +142,7 @@ declare const _default: import("vue").DefineComponent<{
141
142
  unit?: string | undefined;
142
143
  _extendData?: {
143
144
  _filterApiConfig: any;
145
+ _selectCriticalNum?: number | undefined;
144
146
  } | undefined;
145
147
  _frontId?: any;
146
148
  isRender?: boolean | undefined;
@@ -153,6 +155,7 @@ declare const _default: import("vue").DefineComponent<{
153
155
  accurateSearch?: any;
154
156
  isAccurateSearchVal?: boolean | undefined;
155
157
  extendKey?: string | undefined;
158
+ extendType?: string | undefined;
156
159
  }[]>;
157
160
  filterChangeFnList: import("vue").Ref<any[]>;
158
161
  showQuickSearch: import("vue").ComputedRef<boolean>;
@@ -1 +1 @@
1
- import t from"axios";import{cloneDeep as e,isArray as i}from"lodash-es";import{IdentityVerificationDialog as r,PreviewDialog as s}from"./dialog.js";import{isIReport as a,getFileUrl as n,useBrowserPrint as o}from"./browserPrint.js";import{getCurrentInstance as l}from"vue";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import{format as h}from"date-fns";import{io as p}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,g=`${d}/fdp-api/print/assembly/printIReport`,y=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/printIReportForHex`,w=`${d}/bi-api/reprot/print/open/client/previewIReport`,v=`${d}/bi-api/reprot/print/open/client/getRemote`,P=`${d}/printService/file`;let _=null;class b{constructor(){var t,e,i;if(this.webview=null,this.dialog=new r,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._cancelCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,_)return _;_=this;const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(i=a.chrome)?void 0:i.webview}if(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","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:r,reject:s}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void r({result:(null==i?void 0:i.res)?"success":"fail"});r(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=p(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="","cancel"==(null==t?void 0:t.result)?this._cancelCallbackFn&&this._cancelCallbackFn(t):this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("ihoPrint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=c();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)})),new Promise(((e,r)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),r({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({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)}))}))}async resetPrinter(t,e){const i=a(t),r=this.getIReportFormatId(i,t);if(i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:r}}).then((({data:t})=>t.status?{type:"resetSuccess",result:"success",message:null==t?void 0:t.message}:{type:"resetError",result:"error",message:null==t?void 0:t.message})).catch((t=>({type:"resetError",result:"error",message:"重置打印机错误"}))):{type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:r}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:r}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).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:r(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[r]}).then((({data:t})=>t));function r(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,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:"error",errinfo:t}),!1}if("success"!==t.result){const r=t.message||t.Message;this._handleMonitorNotify(r);const s={type:"printError",message:r,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:r,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(s),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件",result:"error"}),!1)}async _handleEventQueryPrintData(t,e,i,r,s){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:r},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,s)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({result:"error",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,svrUpdateIp:i,params:r,paramsArr:s,cmdid:a,print:n,signature:o,copies:l,printdlgshow:c="0",nobillnode:p="1",btnprint:u="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:r,cmdid:a,nobillnode:p,printdlgshow:c,btnprint:u,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=h(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:r,messageTimeout:s=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:r,params:JSON.stringify(n),messageTimeout:s};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:v})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:g,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:y,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForBase16(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForPdf(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:w,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,r=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),s=r[r.length-2],a=r[r.length-1],l=await n(`${P}/${s}/${a}`),c=o(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let r=i.length;const s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new Blob([s],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,signature:c,btnprint:h,messageTimeout:p=0},m,d){const g=a(i),y=this.getIReportFormatId(g,i);if(g&&(u||2==t)){const t=await this._queryPrintForPdf(e,y,r,n);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const i=o(t,"preview");return this.instance||(this.instance=l()),this.showPreview(this.instance,i),null==m?void 0:m({result:"success",message:"",file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:y,params:r,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),i=this._handleResult(t,d);if(!i)return!1;if(this.isRemote){const t=await this._browserPrint(i,"preview");this.instance||(this.instance=l()),this.showPreview(this.instance,t)}await this.getPicAndUpload(i),null==m||m(i)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const r=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=c(),s=await this.messageCollect(t,{exec:"printA",data:r});if(s&&Array.isArray(s)){s.some((t=>"success"===t.res.result))?null==e||e(s):(null==i||i(s),this._handleMonitorNotify(s))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(s||""),null==i||i({type:"printError",message:t,result:"error",errinfo:t})}}catch(t){const e={error:t,result:"error",message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},y,f,w,v="printDirect"){const P=a(i),_=this.getIReportFormatId(P,i);if(P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w):f({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w))}await this._queryProxyOrigin();const b=await this._testConnection();if(!this._handleResultTest(b,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:_,params:r,paramsArr:s,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,messageTimeout:g}),i=this._handleResult(t,f,w);if(!i)return!1;d&&["downloadPDF"].includes(v)&&await this._browserPrint(i,v),null==y||y(i)}catch(t){const e="printDirect"===v?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:r},s,a,n){const o=await this._queryPrintForBase64(t,e,i,r);if(!o.success)return a({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=s,this._errorCallbackFn=a,n&&(this._cancelCallbackFn=n),this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:c,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,r,s){var n;const o=e(t);if(this.webview&&this.downloadPath&&(Reflect.has(o,"print")||Reflect.set(o,"print",{print:"1",type:"1"}),!o.print.filename)){const t=h(new Date,"yyyy-MM-dd"),e=c(),i=h(new Date,"yyyyMMddHHmmss")+e;o.print.filename=`${this.downloadPath}/${t}/${i}/${i}`.replace(/\\/g,"/")}const l=a(o.formatId);if(o.formatId=this.getIReportFormatId(l,o.formatId),l&&(u||2==o.iReportExecuteMode)){const t=await this._queryPrintForBase16(o.templateId||"",o.formatId,o.params||"",o.authorizationKey);return(null==t?void 0:t.success)?r({filebase64:null==(n=null==t?void 0:t.map)?void 0:n.hex,isIreport:!0}):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(o,(async t=>{t||s({result:"error",message:""});const e=this,a=await async function(t){const r=[],s=JSON.parse(t);if(!i(s))return await e._downloadPDF("");if(1===s.length)return await e._downloadPDF(s[0]||"");for(let t=0,i=s.length;t<i;t++)r.push(await e._downloadPDF(s[t]||""));return r}(t.filedir);r(a,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:r},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;s&&s(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,r,a);return!!o&&(s&&s(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,s);return!!o&&(r&&r(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,s);if(!o)return!1;r&&r(o)}}export{b as Print};
1
+ import t from"axios";import{cloneDeep as e,isArray as i}from"lodash-es";import{IdentityVerificationDialog as r,PreviewDialog as s}from"./dialog.js";import{isIReport as a,getFileUrl as n,useBrowserPrint as o}from"./browserPrint.js";import{getCurrentInstance as l}from"vue";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import{format as h}from"date-fns";import{io as p}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,g=`${d}/fdp-api/print/assembly/printIReport`,y=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/printIReportForHex`,w=`${d}/bi-api/reprot/print/open/client/previewIReport`,v=`${d}/bi-api/reprot/print/open/client/getRemote`,P=`${d}/printService/file`;let _=null;class b{constructor(){var t,e,i;if(this.webview=null,this.dialog=new r,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._cancelCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,_)return _;_=this;const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(i=a.chrome)?void 0:i.webview}if(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","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:r,reject:s}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void r({result:(null==i?void 0:i.res)?"success":"fail"});r(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=p(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="","cancel"==(null==t?void 0:t.result)?this._cancelCallbackFn&&this._cancelCallbackFn(t):this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("ihoPrint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=c();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)})),new Promise(((e,r)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),r({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({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)}))}))}async resetPrinter(t,e){const i=a(t),r=this.getIReportFormatId(i,t);if(i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:r}}).then((({data:t})=>t.status?{type:"resetSuccess",result:"success",message:null==t?void 0:t.message}:{type:"resetError",result:"error",message:null==t?void 0:t.message})).catch((t=>({type:"resetError",result:"error",message:"重置打印机错误"}))):{type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:r}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:r}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:this.printOrigin+"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).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:r(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[r]}).then((({data:t})=>t));function r(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,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:"error",errinfo:t}),!1}if("success"!==t.result){const r=t.message||t.Message;this._handleMonitorNotify(r);const s={type:"printError",message:r,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:r,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(s),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件",result:"error"}),!1)}async _handleEventQueryPrintData(t,e,i,r,s){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:r},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,s)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({result:"error",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,svrUpdateIp:i,params:r,paramsArr:s,cmdid:a,print:n,signature:o,copies:l,printdlgshow:c="0",nobillnode:p="1",btnprint:u="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:r,cmdid:a,nobillnode:p,printdlgshow:c,btnprint:u,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=h(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:r,messageTimeout:s=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:r,params:JSON.stringify(n),messageTimeout:s};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:v})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:g,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:y,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForBase16(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForPdf(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:w,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,r=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),s=r[r.length-2],a=r[r.length-1],l=await n(`${P}/${s}/${a}`),c=o(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let r=i.length;const s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new Blob([s],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,signature:c,btnprint:h,messageTimeout:p=0},m,d){const g=a(i),y=this.getIReportFormatId(g,i);if(g&&(u||2==t)){const t=await this._queryPrintForPdf(e,y,r,n);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const i=o(t,"preview");return this.instance||(this.instance=l()),this.showPreview(this.instance,i),null==m?void 0:m({result:"success",message:"",file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:y,params:r,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),i=this._handleResult(t,d);if(!i)return!1;if(this.isRemote){const t=await this._browserPrint(i,"preview");this.instance||(this.instance=l()),this.showPreview(this.instance,t)}await this.getPicAndUpload(i),null==m||m(i)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const r=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=c(),s=await this.messageCollect(t,{exec:"printA",data:r});if(s&&Array.isArray(s)){s.some((t=>"success"===t.res.result))?null==e||e(s):(null==i||i(s),this._handleMonitorNotify(s))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(s||""),null==i||i({type:"printError",message:t,result:"error",errinfo:t})}}catch(t){const e={error:t,result:"error",message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},y,f,w,v="printDirect"){const P=a(i),_=this.getIReportFormatId(P,i);if(P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w):f({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w))}await this._queryProxyOrigin();const b=await this._testConnection();if(!this._handleResultTest(b,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:_,params:r,paramsArr:s,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,messageTimeout:g}),i=this._handleResult(t,f,w);if(!i)return!1;d&&["downloadPDF"].includes(v)&&await this._browserPrint(i,v),null==y||y(i)}catch(t){const e="printDirect"===v?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:r},s,a,n){const o=await this._queryPrintForBase64(t,e,i,r);if(!o.success)return a({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=s,this._errorCallbackFn=a,n&&(this._cancelCallbackFn=n),this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:c,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,r,s){var n;const o=e(t);if(this.webview&&this.downloadPath&&(Reflect.has(o,"print")||Reflect.set(o,"print",{print:"1",type:"1"}),!o.print.filename)){const t=h(new Date,"yyyy-MM-dd"),e=c(),i=h(new Date,"yyyyMMddHHmmss")+e;o.print.filename=`${this.downloadPath}/${t}/${i}/${i}`.replace(/\\/g,"/")}const l=a(o.formatId);if(o.formatId=this.getIReportFormatId(l,o.formatId),l&&(u||2==o.iReportExecuteMode)){const t=await this._queryPrintForBase16(o.templateId||"",o.formatId,o.params||"",o.authorizationKey);return(null==t?void 0:t.success)?r({filebase64:null==(n=null==t?void 0:t.map)?void 0:n.hex,isIreport:!0}):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(o,(async t=>{t||s({result:"error",message:""});const e=this,a=await async function(t){const r=[],s=JSON.parse(t);if(!i(s))return await e._downloadPDF("");if(1===s.length)return await e._downloadPDF(s[0]||"");for(let t=0,i=s.length;t<i;t++)r.push(await e._downloadPDF(s[t]||""));return r}(t.filedir);r(a,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:r},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;s&&s(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,r,a);return!!o&&(s&&s(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,s);return!!o&&(r&&r(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,s);if(!o)return!1;r&&r(o)}}export{b as Print};
@@ -1 +1 @@
1
- import{jsonParse as e}from"../../../shared/utils/index.js";import s from"axios";import{isString as t,omit as r}from"lodash-es";import{INSURANCE_URL as i,CONFIG_MAP as n,TRANS_CMD as a}from"./constants/index.js";import{insuranceLog as o,getErrorMessageByType as d,getTranstime as l,getSerialNumber as u}from"./utils/index.js";var h;class m{constructor(e){var s,t;this.webview=null==(h=window.chrome)?void 0:h.webview,this.requestParams=null,this.currentMessageHandler=null,this.messageHandlerQueue=[],(null==e?void 0:e.selfWindow)&&(this.webview=null==(t=null==(s=null==e?void 0:e.selfWindow)?void 0:s.chrome)?void 0:t.webview),this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler))}messageHandler(s){const r=this.messageHandlerQueue.shift();if(!r)return Promise.reject(o("当前回执",s,"没有可用的handler"));const{resolve:i,transcmd:n}=r,a=t(s.data)?e(s.data)||{}:s.data;if(!a||!["hisyb","login"].includes(a.exec))return o("当前回执不是hisyb消息"),void this.messageHandlerQueue.unshift(r);const{transcmd:d}=a.res||{};if(n&&d&&`${n}`!=`${d}`)return o("交易命令不相等,当前transcmd",n,"返回transcmd",d),void this.messageHandlerQueue.unshift(r);i(a)}async postMessage(s){return this.webview&&s?new Promise(((t,r)=>{var i;this.messageHandlerQueue.push({resolve:t,reject:r,transcmd:null==(i=e(s.data))?void 0:i.transcmd}),this.webview.postMessage(s)})).then((e=>e&&e.result&&e.exec===s.exec?e:Promise.reject())):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=null)}login(){var e,s;return this.postMessage({exec:"login",data:null!=(s=null==(e=this.requestParams)?void 0:e.loginCode)?s:"7777"})}async HOInterfaceSvr(e){const{transcmd:t,needLogin:n}=this.requestParams||{};try{if(this.webview){n&&await this.login();return(await this.postMessage({exec:"hisyb",data:JSON.stringify(r(e,["needLogin"]))})).res}return(await s.post(i,JSON.stringify(r(e,["needLogin"])))).data}catch(e){return Promise.reject(d(t))}}initConfig(e){this.requestParams=Object.assign({},n,e)}initParams(){var e,s;return{...this.requestParams,transcmd:null!=(s=null==(e=this.requestParams)?void 0:e.transcmd)?s:a.NS_GETPERSONALINFO,transtime:l(),serialnumber:u()}}getInsuranceInfoPromise(e){return this.initConfig(e),this.HOInterfaceSvr(this.initParams())}}export{m as default};
1
+ import{jsonParse as e}from"../../../shared/utils/index.js";import s from"axios";import{isString as t,omit as r}from"lodash-es";import{INSURANCE_URL as i,CONFIG_MAP as n,TRANS_CMD as a}from"./constants/index.js";import{insuranceLog as o,getErrorMessageByType as d,getTranstime as l,getSerialNumber as u}from"./utils/index.js";var h;class m{constructor(e){var s,t;this.webview=null==(h=window.chrome)?void 0:h.webview,this.requestParams=null,this.currentMessageHandler=null,this.messageHandlerQueue=[],(null==e?void 0:e.selfWindow)&&(this.webview=null==(t=null==(s=null==e?void 0:e.selfWindow)?void 0:s.chrome)?void 0:t.webview),this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler))}messageHandler(s){const r=this.messageHandlerQueue.shift();if(!r)return o("当前回执",s,"没有可用的handler");const{resolve:i,transcmd:n}=r,a=t(s.data)?e(s.data)||{}:s.data;if(!a||!["hisyb","login"].includes(a.exec))return o("当前回执不是hisyb消息"),void this.messageHandlerQueue.unshift(r);const{transcmd:d}=a.res||{};if(n&&d&&`${n}`!=`${d}`)return o("交易命令不相等,当前transcmd",n,"返回transcmd",d),void this.messageHandlerQueue.unshift(r);i(a)}async postMessage(s){return this.webview&&s?new Promise(((t,r)=>{var i;this.messageHandlerQueue.push({resolve:t,reject:r,transcmd:null==(i=e(s.data))?void 0:i.transcmd}),this.webview.postMessage(s)})).then((e=>e&&e.result&&e.exec===s.exec?e:Promise.reject())):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=null)}login(){var e,s;return this.postMessage({exec:"login",data:null!=(s=null==(e=this.requestParams)?void 0:e.loginCode)?s:"7777"})}async HOInterfaceSvr(e){const{transcmd:t,needLogin:n}=this.requestParams||{};try{if(this.webview){n&&await this.login();return(await this.postMessage({exec:"hisyb",data:JSON.stringify(r(e,["needLogin"]))})).res}return(await s.post(i,JSON.stringify(r(e,["needLogin"])))).data}catch(e){return Promise.reject(d(t))}}initConfig(e){this.requestParams=Object.assign({},n,e)}initParams(){var e,s;return{...this.requestParams,transcmd:null!=(s=null==(e=this.requestParams)?void 0:e.transcmd)?s:a.NS_GETPERSONALINFO,transtime:l(),serialnumber:u()}}getInsuranceInfoPromise(e){return this.initConfig(e),this.HOInterfaceSvr(this.initParams())}}export{m as default};
@@ -1 +1 @@
1
- import{TRANS_CMD as t}from"../constants/index.js";function n(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}function e(){return o()+parseInt(1e3*Math.random()+"")}function r(t){return t<10?"0"+t:t}function o(){const t=new Date;return t.getFullYear().toString()+r(t.getMonth()+1)+r(t.getDate())+r(t.getHours())+r(t.getMinutes())+r(t.getSeconds())}function u(...t){return console.log("[INSURANCE-SDK]: ",...t),t.reduce(((t,n)=>t+n))}const c={[t.ID_CARD_READ]:"身份证读卡接口服务异常",[t.MEMBER_CARD_READ]:"会员读卡接口服务异常",[t.FAST_REPORT_OR_POS]:"打印或pos接口服务异常"};function i(t){return t&&c[t]||"请检查医保服务是否正常"}export{o as generateTimeRequestNumber,i as getErrorMessageByType,n as getSerialNumber,e as getTranstime,u as insuranceLog,r as pad2};
1
+ import{TRANS_CMD as t}from"../constants/index.js";function n(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}function r(){return o()+parseInt(1e3*Math.random()+"")}function e(t){return t<10?"0"+t:t}function o(){const t=new Date;return t.getFullYear().toString()+e(t.getMonth()+1)+e(t.getDate())+e(t.getHours())+e(t.getMinutes())+e(t.getSeconds())}function u(...t){return t.reduce(((t,n)=>t+n))}const i={[t.ID_CARD_READ]:"身份证读卡接口服务异常",[t.MEMBER_CARD_READ]:"会员读卡接口服务异常",[t.FAST_REPORT_OR_POS]:"打印或pos接口服务异常"};function c(t){return t&&i[t]||"请检查医保服务是否正常"}export{o as generateTimeRequestNumber,c as getErrorMessageByType,n as getSerialNumber,r as getTranstime,u as insuranceLog,e as pad2};
@@ -1746,7 +1746,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
1746
1746
  }>>;
1747
1747
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1748
1748
  emit: (event: "update:modelValue", ...args: any[]) => void;
1749
- options: import("vue").Ref<never[]>;
1749
+ options: import("vue").Ref<any[]>;
1750
1750
  filterApiConfig: import("../../shared/types").AnyObject;
1751
1751
  classifyFilterList: import("vue").Ref<import("../../shared/types").AnyObject[]>;
1752
1752
  optionSetting: import("vue").ComputedRef<any>;
@@ -1210,7 +1210,7 @@ declare const _default: import("vue").DefineComponent<{
1210
1210
  }>>;
1211
1211
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1212
1212
  emit: (event: "update:modelValue", ...args: any[]) => void;
1213
- options: import("vue").Ref<never[]>;
1213
+ options: import("vue").Ref<any[]>;
1214
1214
  filterApiConfig: import("../../../../../shared/types").AnyObject;
1215
1215
  classifyFilterList: import("vue").Ref<import("../../../../../shared/types").AnyObject[]>;
1216
1216
  optionSetting: import("vue").ComputedRef<any>;
@@ -1504,7 +1504,7 @@ declare const _default: import("vue").DefineComponent<{
1504
1504
  }>>;
1505
1505
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1506
1506
  emit: (event: "update:modelValue", ...args: any[]) => void;
1507
- options: import("vue").Ref<never[]>;
1507
+ options: import("vue").Ref<any[]>;
1508
1508
  filterApiConfig: import("../../../../../shared/types").AnyObject;
1509
1509
  classifyFilterList: import("vue").Ref<import("../../../../../shared/types").AnyObject[]>;
1510
1510
  optionSetting: import("vue").ComputedRef<any>;
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -1748,7 +1748,7 @@ declare const _default: import("vue").DefineComponent<{
1748
1748
  }>>;
1749
1749
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1750
1750
  emit: (event: "update:modelValue", ...args: any[]) => void;
1751
- options: import("vue").Ref<never[]>;
1751
+ options: import("vue").Ref<any[]>;
1752
1752
  filterApiConfig: AnyObject;
1753
1753
  classifyFilterList: import("vue").Ref<AnyObject[]>;
1754
1754
  optionSetting: import("vue").ComputedRef<any>;
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,drawArrow as o,drawText as n,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as s,defaultStyle as l,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as m,getTime as v,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as k,last as w}from"lodash-es";import"../temperature/useShadow.js";import"@vueuse/shared";import{format as x}from"date-fns";import"naive-ui";import"@vueuse/core";function b(b,j,P,C,E){const{computedX:S,computedY:G,getXValue:T,getYValue:L}=c(j),{getEqualXTypes:Y,handleAddPrevent:M,isGridLimit:A,setPrevAndNextPoint:X,getPointEventProps:I}=h(b,P,j),{xAxis:H,grid:W,originX:N,originY:O,xCellWidth:V,endY:D,startTime:R,leftAddAreaWidth:$,leftScales:B,rightScales:F,yCellHeight:q,endX:z,scaleValues:J,canvasWidth:K,borderStyle:Q,rightAddAreaWidth:U,event:Z,originYCervix:_,other:tt,canvasHeight:et}=j,ot=k(J),nt=new Set;function it(){ot.filter((t=>t.show)).forEach(((t,s)=>{var l;const a=[],u=[],c=[];null==(l=t.data)||l.forEach(((l,d)=>{!function(l,d,f){let p,h;const{pointAttr:g={},lineAttr:m={},title:v="",key:y,type:k="circle",childbirthStyle:w={}}=t,x=t.data[f+1],j=ut(x,t);if(l&&j&&!d.breakpoint)h=e([...l,...j],{...m});else if(l&&!j&&!d.breakpoint){const o=ut(x,t);h=o?e([...l,...o],{...m}):null}let E,S;if(d.childbirth){const t=l[1]+q;E=o([l[0],l[1],t],w),c.push(E),S=n([l[0]+V/2,t-q/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(S)}const G=u[f-1],Y={origin:{data:d,title:v,key:y||"",dataIndex:s,index:f},leftLine:G,rightLine:h,arrowGroup:E,arrowGroupText:S,...g,...I()};l&&(G||(Y.leftLine=null),p=r(k,{left:l[0],top:l[1],...Y}));u.push(h),p&&(!function(t){Z.hovered&&(t.on("mouseover",(()=>{at(t,"hover")})),t.on("mouseout",(()=>{C.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{lt(t),function(t){var e,o,n,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(o=t.rightLine)||o.setCoords().set({x1:t.left,y1:t.top}),null==(n=t.arrowGroup)||n.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+V/2,top:t.top+q/2})}(t),Z.hovered&&at(t)})),t.on("mouseup",(e=>{if(C.show=!1,1===e.button){const{key:e}=t.origin,o={...t.origin,data:{...t.origin.data,time:T(t.left),value:L(e,t.top)}};b.value.discardActiveObject(),P("change",o),rt(o,"change")}}))}(p),a.push(p),nt.add(p))}(ut(l,t),l,d)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));X(t),Promise.all(c).then((o=>{b.value.add(...e,...t,...o),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function rt(t,e="add"){const{dataIndex:o,data:n,index:i,key:r}=t,s=ot.find((t=>t.key===r));switch(e){case"remove":s.data.splice(i,1);break;case"change":s.data[i]=n;break;default:{const t=g(n.time,s.data);s.data.splice(t,0,n);break}}st()}function st(){var t;nt.size&&(null==(t=b.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}([...nt]))),nt.clear(),it()}function lt(t){const e=t.prevPoint?t.prevPoint.left:N,o=t.nextPoint?t.nextPoint.left:z;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<_&&t.set("top",_),t.top<O&&t.set("top",O),t.top>D&&t.set("top",D),t.left<e&&t.set("left",e),t.left>o&&t.set("left",o)}function at(t,e="moving"){const{title:o,key:n,data:i}=t.origin;C.point={x:t.left,y:t.top},C.list=[`${o} ${"hover"===e?i.value:L(n,t.top)}`,`时间 ${T(t.left).slice(-5)}`],C.show=!0}function ut(t,e){if(m(t)&&function(t){const e=R+864e5,o=v(t);return o>=R&&o<=e}(t.time)){const o=S(t.time),n=G(e.key,e.range,t.value);return[o,n<O?O:n>D?D:n]}}function ct(t,e){return t+1>e[1]?e[0]:t+1}return u(b,j),function(){const e=new t.Rect({...Q,width:K-$-U-1,height:D-1,left:$,top:0,fill:"transparent"});b.value.add(e)}(),function(){function e(e,o="left"){let r="left"===o?$:z;e.forEach(((e,o)=>{const{range:s,spaceValue:u,width:c,title:h,titleStyle:g,key:m,position:v="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=e,j=[],P=[],C=r+c/2,E=y(s,u),S=E.length,{lineXMain:G,lineXSub:T,textLeft:L}=d(v,r,c);E.forEach(((t,o)=>{const n=D-o*q*k,i=0===o?D-8:o!==E.length-1||O||_&&"FHR"!==m?n:O+8;!w||(0===o||o===S-1)&&!x||j.push(f(String(t),e,L,i)),P.push(...p(e,o,G,T,n,q,O,S,1))}));const Y=new t.Rect({...a,strokeWidth:.5,width:c,height:D,left:C,top:D/2}),M=n([C,O>0?O-q/2:q/2],{value:String(h),...i,...g}),A=new t.Group([...P,...j,Y,...M?[M]:[]],{objectCaching:!1,...l});b.value.add(A),A.sendToBack(),r+=c}))}e(B),e(F,"right")}(),function(){const{show:e,startTime:o,range:r=[0,23],position:s="top",style:a}=H.time,{show:u,range:c=[0,23],position:d,style:f}=H.processTime;if(e||u){const p=[],h=[],g=[],m=[],v=N+V/2,y=q/2;for(let t=0;t<W.mainXCell;t++){if(e){const e=0===t?+o.slice(11,13):ct(w(p),r);p.push(e);const l="top"===s?O-y:D+y;g.push(n([v+t*V,l],{value:String(e),...i,...a||{}}))}if(u){const e=0===t?c[0]:w(h)+1;h.push(e);const o="top"===d?y:et-y;m.push(n([v+t*V,o],{value:String(e),...i,...f||{}}))}}const k=new t.Group([...g,...m],{objectCaching:!1,...l});b.value.add(k),b.value.sendToBack(k)}}(),function(){var t;const o=Object.values(tt),n=[],i={},r=ot.find((t=>"cervix"===t.key&&t.show)),s=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function l(t,e){const{key:o,range:n}=r||{},i=G(o,n,10),s=[0,e],l=[-e/t,0],a=[(D-i-e)/t,D-i],u=[z-N,t*(z-N)+e];let c=[],d=[];function f([o,n]){return Math.abs(n-t*o-e)<=1}function p([t,e]){const[o,n]=[...h([t,e])];return o>=N&&o<=z&&n>=i&&n<=D}function h([t,e]){return[N+t,D-e]}return f(s)&&p(s)&&(c=h(s)),f(l)&&p(l)&&(c=h(l)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}o.forEach((t=>{if(!t.show)return;const{key:o}=t;switch(o){case"fetalPresentation":{const{range:i,show:r}=ot.find((t=>t.key===o));if(r){const r=G(o,i,0);n.push(e([N,r,z,r],{...t}))}break}case"alert":if(s){const{key:o,range:a}=r||{},u=216e5,c={time:x(new Date(v(s.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(s.time)-N,D-G(o,a,s.value)],[p,h]=[S(c.time)-N,D-G(o,a,c.value)],g=(h-f)/(p-d),m=f-d*g,y=l(g,m);y.length>0&&(n.push(e(y,{...t})),Object.assign(i,{k:g,b:m}))}break;case"handling":if(s){const{k:o,b:r}=i,a=144e5,u=l(o,r-(S(x(new Date(v(s.time)+a),"yyyy-MM-dd HH:mm"))-S(s.time))*o);u.length>0&&n.push(e(u,{...t}))}}})),b.value.add(...n)}(),it(),function(){function t(t,e){const o=ot.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:o,key:t.key},pointer:e}}j.event.evented&&b.value.on("mouse:up",(e=>{if(3===e.button){const{x:o=0,y:n=0}=e.pointer||{};o>=N&&o<=z&&n>=O&&n<=D&&(E.point={x:o,y:n},E.show=!0,e.target?(E.target=e.target,E.list=["删除节点"],[...nt].forEach((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&E.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(E.target=null,E.list=["新增节点"],ot.filter((t=>t.show)).forEach((i=>{if(!Y([...nt],o,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&n<_)return;E.list.push(t(i,e.pointer))}})),1===E.list.length&&(E.show=!1,M("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=K-U/2;function e(t,e){if(!t.length)return;let n=O;const i=[];t.forEach((t=>{const o=t.title.split("").join("\n"),r=J.findIndex((e=>e.key===t.key)),{text:l,icon:a}=s(o,t,{text:{originY:"top",left:e,top:n},icon:{left:e,topY:n,originY:"top",origin:{type:t.type,dataIndex:r},...j.event}},"vertical");var u;n+=l.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),A(u)?(lt(u),at(u)):C.show=!1})),u.on("mouseup:before",(t=>{if(C.show=!1,0===t.e.button&&A(u))if(Y([...nt],u.left,"key").includes(u.origin.key))M("repeat");else{const t={data:{time:T(u.left),value:L(u.origin.key,u.top)},...u.origin};P("add",t),rt(t)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(u)})),i.push(l,a)})),o(i),b.value.add(...i)}function o(t){const e=w(t),o=(D-O)/2,n=(e.height+e.top-O)/2;t.forEach((t=>{const e=t.top+o-n;t.set({top:e,originTop:e})}))}e(B,$/2),e(F,t)}(),{clickMenu:function({item:t,target:e}){const o={...t.origin};"remove"===t.mode?(P("remove",o),rt(o,"remove")):(Object.assign(o,{data:{time:T(t.pointer.x),value:L(t.origin.key,t.pointer.y)}}),P("add",o),rt(o))},redrawPoints:st}}export{b as useBirthProcess};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as m,getTime as v,getScaleNumberList as y}from"../../utils/index.js";import{cloneDeep as k,last as w,range as x}from"lodash-es";import"../temperature/useShadow.js";import"@vueuse/shared";import{format as b}from"date-fns";import"naive-ui";import"@vueuse/core";function j(j,C,P,S,E){const{computedX:X,computedY:G,getXValue:T,getYValue:A}=c(C),{getEqualXTypes:L,handleAddPrevent:Y,isGridLimit:M,setPrevAndNextPoint:I,getPointEventProps:H}=h(j,P,C),{xAxis:W,grid:D,originX:N,originY:O,xCellWidth:V,endY:R,startTime:$,leftAddAreaWidth:B,leftScales:F,rightScales:q,yCellHeight:z,endX:J,scaleValues:K,canvasWidth:Q,borderStyle:U,rightAddAreaWidth:Z,event:_,originYCervix:ee,other:te,canvasHeight:ne}=C,oe=k(K),ie=new Set;function re(){oe.filter((({showData:e=!0})=>e)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:m={},title:v="",key:y,type:k="circle",childbirthStyle:w={}}=e,x=e.data[f+1],b=ce(x,e);if(s&&b&&!d.breakpoint)h=t([...s,...b],{...m});else if(s&&!b&&!d.breakpoint){const n=ce(x,e);h=n?t([...s,...n],{...m}):null}let C,E;if(d.childbirth){const e=s[1]+z;C=n([s[0],s[1],e],w),c.push(C),E=o([s[0]+V/2,e-z/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(E)}const X=u[f-1],G={origin:{data:d,title:v,key:y||"",dataIndex:l,index:f},leftLine:X,rightLine:h,arrowGroup:C,arrowGroupText:E,...g,...H()};s&&(X||(G.leftLine=null),p=r(k,{left:s[0],top:s[1],...G}));u.push(h),p&&(!function(e){_.hovered&&(e.on("mouseover",(()=>{ue(e,"hover")})),e.on("mouseout",(()=>{S.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ae(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+V/2,top:e.top+z/2})}(e),_.hovered&&ue(e)})),e.on("mouseup",(t=>{if(S.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:T(e.left),value:A(t,e.top)}};j.value.discardActiveObject(),P("change",n),le(n,"change")}}))}(p),a.push(p),ie.add(p))}(ce(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));I(e),Promise.all(c).then((n=>{j.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function le(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=oe.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}se()}function se(){var e;ie.size&&(null==(e=j.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(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}([...ie]))),ie.clear(),re()}function ae(e){const t=e.prevPoint?e.prevPoint.left:N,n=e.nextPoint?e.nextPoint.left:J;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<ee&&e.set("top",ee),e.top<O&&e.set("top",O),e.top>R&&e.set("top",R),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function ue(e,t="moving"){const{title:n,key:o,data:i}=e.origin;S.point={x:e.left,y:e.top},S.list=[`${n} ${"hover"===t?i.value:A(o,e.top)}`,`时间 ${T(e.left).slice(-5)}`],S.show=!0}function ce(e,t){if(m(e)&&function(e){const t=$+864e5,n=v(e);return n>=$&&n<=t}(e.time)){const n=X(e.time),o=G(t.key,t.range,e.value);return[n,o<O?O:o>R?R:o]}}function de(e,t){return e+1>t[1]?t[0]:e+1}return u(j,C),function(){const t=new e.Rect({...U,width:Q-B-Z-1,height:R-1,left:B,top:0,fill:"transparent"});j.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?B:J;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:m,position:v="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=t,b=[],C=[],P=r+c/2,S=y(l,u),E=S.length,{lineXMain:X,lineXSub:G,textLeft:T}=d(v,r,c);S.forEach(((e,n)=>{const o=R-n*z*k,i=0===n?R-8:n!==S.length-1||O||ee&&"FHR"!==m?o:O+8;!w||(0===n||n===E-1)&&!x||b.push(f(String(e),t,T,i)),C.push(...p(t,n,X,G,o,z,O,E,1))}));const A=new e.Rect({...a,strokeWidth:.5,width:c,height:R,left:P,top:R/2}),L=o([P,O>0?O-z/2:z/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...b,A,...L?[L]:[]],{objectCaching:!1,...s});j.value.add(Y),Y.sendToBack(),r+=c}))}t(F),t(q,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=W.time,{show:u,range:c=[0,23],position:d,style:f={}}=W.processTime;if(t||u){const p=[],h=x(c[0],c[1]+1),g=[],m=[],v=z/2;for(let e=0;e<D.mainXCell;e++){if(t){const{textAlign:t="center"}=a,s=N+("center"===t?V/2:0),u=0===e&&"center"!==t?s+5:s,c=0===e?+n.slice(11,13):de(w(p),r);p.push(c);const d="top"===l?O-v:R+v;g.push(o([u+e*V,d],{value:String(c),...i,...a})),e===D.mainXCell-1&&"center"!==t&&g.push(o([J-1,d],{value:String(de(w(p),r)),...i,...a,originX:"center"!==t?"right":"center"}))}if(u&&e<=h.length){const{textAlign:t="center"}=f,n=N+("center"===t?V/2:0),r=0===e&&"center"!==t?n+5:n,l="top"===d?v:ne-v;m.push(o([r+e*V,l],{value:String(h[e]),...i,...f})),e===D.mainXCell-1&&"center"!==t&&m.push(o([J-1,l],{value:String(w(h)),...i,...a,originX:"center"!==t?"right":"center"}))}}const y=new e.Group([...g,...m],{objectCaching:!1,...s});j.value.add(y),j.value.sendToBack(y)}}(),function(){var e;const n=Object.values(te),o=[],i={},r=oe.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=G(n,o,10),l=[0,t],s=[-t/e,0],a=[(R-i-t)/e,R-i],u=[J-N,e*(J-N)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=N&&n<=J&&o>=i&&o<=R}function h([e,t]){return[N+e,R-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=oe.find((e=>e.key===n));if(r){const r=G(n,i,0);o.push(t([N,r,J,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:b(new Date(v(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[X(l.time)-N,R-G(n,a,l.value)],[p,h]=[X(c.time)-N,R-G(n,a,c.value)],g=(h-f)/(p-d),m=f-d*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-(X(b(new Date(v(l.time)+a),"yyyy-MM-dd HH:mm"))-X(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),j.value.add(...o)}(),re(),function(){function e(e,t){const n=oe.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}C.event.evented&&j.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=N&&n<=J&&o>=O&&o<=R&&(E.point={x:n,y:o},E.show=!0,t.target?(E.target=t.target,E.list=["删除节点"],[...ie].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&E.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(E.target=null,E.list=["新增节点"],oe.filter((e=>e.show)).forEach((i=>{if(!L([...ie],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<ee)return;E.list.push(e(i,t.pointer))}})),1===E.list.length&&(E.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=Q-Z/2;function t(e,t){if(!e.length)return;let o=O;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=K.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...C.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),M(u)?(ae(u),ue(u)):S.show=!1})),u.on("mouseup:before",(e=>{if(S.show=!1,0===e.e.button&&M(u))if(L([...ie],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:T(u.left),value:A(u.origin.key,u.top)},...u.origin};P("add",e),le(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),j.value.add(...i)}function n(e){const t=w(e),n=(R-O)/2,o=(t.height+t.top-O)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(F,B/2),t(q,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(P("remove",n),le(n,"remove")):(Object.assign(n,{data:{time:T(e.pointer.x),value:A(e.origin.key,e.pointer.y)}}),P("add",n),le(n))},redrawPoints:se}}export{j as useBirthProcess};
@@ -1 +1 @@
1
- import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as r}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useBirthProcess as i}from"./useBirthProcess.js";function s(s,n,d,o,v,c){const h=e({select:null,redrawPoints:null,clickMenu:null}),m=a((()=>n.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),p=a((()=>n.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),f=a((()=>{var e;return(null==(e=p.value)?void 0:e.length)?30:0})),g=a((()=>{var e;return 30+(null==(e=m.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),x=a((()=>{var e;const{width:a}=n.data,t=null==(e=p.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-f.value-t})),w=a((()=>n.data.grid.mainXCell)),y=a((()=>{const e=n.data.grid.mainYCell||14;return n.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),V=a((()=>(x.value-g.value)/w.value)),b=a((()=>{const{xAxis:e,height:a}=n.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(y.value+t)})),j=a((()=>{const{xAxis:e}=n.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return b.value*a})),A=a((()=>{var e;const{scaleValues:a}=n.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!j.value)return j.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],u=(null==t?void 0:t.spaceValue)||1;return k.value-l*u*b.value})),k=a((()=>{const{xAxis:e,height:a}=n.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-b.value*t})),C=a((()=>r(n.data.xAxis.time.startTime))),Y=a((()=>36e5/V.value)),S=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"cervix"===e.key));return b.value/((null==a?void 0:a.spaceValue)||1)})),H=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"FHR"===e.key));return b.value/((null==a?void 0:a.spaceValue)||10)})),P=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"fetalPresentation"===e.key));return b.value/((null==a?void 0:a.spaceValue)||1)})),X=a((()=>{var e;return(null==(e=n.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),F=e({canvasWidth:n.data.width,canvasHeight:n.data.height,borderStyle:{...u,...n.data.borderStyle||{}},selectionStyle:n.data.selectionStyle||{},grid:n.data.grid,other:n.data.other,originX:g.value,endX:x.value,originY:j.value,endY:k.value,xCellWidth:V.value,yCellHeight:b.value,gridXNumber:w.value,gridYNumber:y.value,xAxis:n.data.xAxis,leftScales:m.value,rightScales:p.value,leftAddAreaWidth:30,rightAddAreaWidth:f.value,startTime:C.value,timeXCell:Y.value,cervixYCell:S.value,FHRYCell:H.value,fetalPresentationYCell:P.value,scaleValues:n.data.scaleValues,event:X.value,originYCervix:A.value});return t((()=>s.value),(e=>{e&&function(){const{clickMenu:e,redrawPoints:a}=i(s,F,d,v,c);h.redrawPoints=a,h.clickMenu=e}()}),{immediate:!0}),{propItems:F,...l(h)}}export{s as useBirthProcessChart};
1
+ import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as r}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";import{useBirthProcess as i}from"./useBirthProcess.js";function s(s,n,d,o,v,c){const h=e({select:null,redrawPoints:null,clickMenu:null}),m=a((()=>n.data.scaleValues.filter((({layout:e="left",show:a=!0})=>"left"===e&&a)))),f=a((()=>n.data.scaleValues.filter((({layout:e="left",show:a=!0})=>"right"===e&&a)))),p=a((()=>{var e;return(null==(e=f.value)?void 0:e.length)?30:0})),g=a((()=>{var e;return 30+(null==(e=m.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),x=a((()=>{var e;const{width:a}=n.data,t=null==(e=f.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-p.value-t})),w=a((()=>n.data.grid.mainXCell)),y=a((()=>{const e=n.data.grid.mainYCell||14;return n.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),V=a((()=>(x.value-g.value)/w.value)),b=a((()=>{const{xAxis:e,height:a}=n.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(y.value+t)})),j=a((()=>{const{xAxis:e}=n.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return b.value*a})),A=a((()=>{var e;const{scaleValues:a}=n.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!j.value)return j.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],u=(null==t?void 0:t.spaceValue)||1;return k.value-l*u*b.value})),k=a((()=>{const{xAxis:e,height:a}=n.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-b.value*t})),C=a((()=>r(n.data.xAxis.time.startTime))),Y=a((()=>36e5/V.value)),S=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"cervix"===e.key));return b.value/((null==a?void 0:a.spaceValue)||1)})),H=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"FHR"===e.key));return b.value/((null==a?void 0:a.spaceValue)||10)})),P=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"fetalPresentation"===e.key));return b.value/((null==a?void 0:a.spaceValue)||1)})),X=a((()=>{var e;return(null==(e=n.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),F=e({canvasWidth:n.data.width,canvasHeight:n.data.height,borderStyle:{...u,...n.data.borderStyle||{}},selectionStyle:n.data.selectionStyle||{},grid:n.data.grid,other:n.data.other,originX:g.value,endX:x.value,originY:j.value,endY:k.value,xCellWidth:V.value,yCellHeight:b.value,gridXNumber:w.value,gridYNumber:y.value,xAxis:n.data.xAxis,leftScales:m.value,rightScales:f.value,leftAddAreaWidth:30,rightAddAreaWidth:p.value,startTime:C.value,timeXCell:Y.value,cervixYCell:S.value,FHRYCell:H.value,fetalPresentationYCell:P.value,scaleValues:n.data.scaleValues,event:X.value,originYCervix:A.value});return t((()=>s.value),(e=>{e&&function(){const{clickMenu:e,redrawPoints:a}=i(s,F,d,v,c);h.redrawPoints=a,h.clickMenu=e}()}),{immediate:!0}),{propItems:F,...l(h)}}export{s as useBirthProcessChart};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{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{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,C,P,R,A,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:W}=t(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:se}=$,re=new Set,ue=["xinmai","mai"],ae=new Map,ce=new Set,de=new Set,pe=new Set,fe=x(z.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(re.size&&E.value.remove(...re),re.clear(),ae.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ae.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ae)t.push(e[1]),e[0]===ue[0]&&e[1].forEach((e=>{(ae.get(ue[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)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ue[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...W(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),re.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),re.add(n)}))}E.value.add(...e)}re.add(l),E.value.add(l)}))}}function ge(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:C=!1}=j,R=[],I=[],X=[];let D=null;const W=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&xe(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const z=d(a)?L.find((e=>e.key===u.key)):e,F=be(W(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?be(W(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=z;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!F||!N||f(F[0],1)!==f(N[0],1))F&&D&&(F[0]=D),D=null;else{const e=F[0]-_/2;F[0]=e+_/4,N[0]=D=F[0]+_/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:W(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(F,u,z),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!xe(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,S,Y;if(t.noRise&&p.show){const i=M(p,t)?V(a,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&he.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(S=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(S)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+_/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(Y=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(Y))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:S,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:Y,top:(m?-q:0)-5}})}(F,u,z,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(F,u,z,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=ye(a,e.list[u].value),L=l&&ye(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:W(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||C)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:W(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:W(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w&&!ne[1]?n[1]-5:n[1],...V}));I.push(f),p&&(x===ue[1]?ce.add(p):W(s)||de.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=P(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),we(n,"change")}}))}(p),R.push(p),pe.add(p))}(F,N,u,j,z,K)})),"pulse"===a){const{key:t}=e;let i=null;ae.set(t,R.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-_/2;e.set("left",t+_/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+_/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const z=I.filter((e=>e));E.value.add(...z,...R,...X)}function ye(e,t){return"pain"===e&&0==t}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||C(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:P(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],A.show=!0}function xe(e){const[t]=F,i=j(F),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function be(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!xe(e.time))return;const n=T(e.time),o=V(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function je(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${C(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function we(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=fe.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ke()}function ke(){var e;pe.size&&(null==(e=E.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}([...pe]))),pe.clear(),Le()}function Le(e){ae.clear(),pe.clear(),ce.clear(),he.clear(),de.clear(),fe.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||ge(e,i,t)})))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>e.show&&"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({},S,z.overlap||{}),l=[];ce.size&&[...ce].forEach((e=>{[...de].forEach((t=>{if(t.origin&&p(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),l.push(o(r,{...i[e],...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-se.strokeWidth,height:ie-se.strokeWidth,fill:"transparent",...se});E.value.add(t)}(),Le((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...pe],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:R?R(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=je(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:C(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),we(r,"change")}else{const t={data:{time:C(e.pointer.x),value:P(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),we(t)}},setPopup:me,isAddPoint:je,updateData:we,redrawPoints:ke,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E 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 r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as m,getIndex as y}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,P,R,C,A,I){s(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:W}=t(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:re}=$,se=new Set,ue=["xinmai","mai"],ae=new Map,ce=new Set,de=new Set,pe=new Set,fe=x(z.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(se.size&&E.value.remove(...se),se.clear(),ae.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ae.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ae)t.push(e[1]),e[0]===ue[0]&&e[1].forEach((e=>{(ae.get(ue[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),u=n[i],a=o[s],c=n[i-1],d=n[i+1],p=o[s-1],f=o[s+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&r.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);r.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(r.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ue[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...W(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),se.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...s,originX:"center"});e.push(n),se.add(n)}))}E.value.add(...e)}se.add(l),E.value.add(l)}))}}function ge(e,t,s){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:m={},pacemaker:y={},upArrowStyle:b={},limitValueStyle:j={},nonePainPointStyle:w={},belowMinValueStyle:k={},respiratorStyle:L={},dataList:S=[],list:Y=[]}=s,{type:$,textStyle:P}=w,C=[],I=[],X=[];let D=null;const W=e=>"breathe"==a&&e.respirator&&L.type&&L.fixedValue&&!e.value&&ye(e.time);if(null==(u=e.list)||u.forEach(((u,w)=>{const z=d(a)?S.find((e=>e.key===u.key)):e,F=xe(W(u)?{...u,value:L.fixedValue}:u,s),G=e.list[w+1],N=G?xe(W(G)?{...G,value:L.fixedValue}:G,s):void 0,B=G?d(a)?S.find((e=>e.key===G.key)):e:{},{title:J=""}=z;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!F||!N||f(F[0],1)!==f(N[0],1))F&&D&&(F[0]=D),D=null;else{const e=F[0]-_/2;F[0]=e+_/4,N[0]=D=F[0]+_/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,r=l([e[0],o],{value:W(t)?L.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-q}}(F,u,z),function(e,t,s,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ye(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=s,{value:y}=u,x=T(t.time);let b,j,w,k,S,Y;if(t.noRise&&p.show){const i=M(p,t)?V(a,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(w);else if(t.value){w=r([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&he.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(k=l([x,e[1]-(y?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(k)),t.verified&&(S=l([x,e[1]-(y?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(S)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,null!=(d=t.physicsReduce)?d:t.drugReduce),r=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+_/2:x;b=i([...e,r,l],{...v,...m.line,...n}),j=o((null==(f=null==m?void 0:m.point)?void 0:f.type)||"circle",{left:r,top:l,...m.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(Y=o(L.type,{left:x,top:e[1]-(y?q:0)-5,originX:"center",originY:"bottom",...L.style}),X.push(Y))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:k,top:(y?-q:0)-5},verifiedText:{obj:S,top:(y?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:Y,top:(y?-q:0)-5}})}(F,u,z,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...Y),s=Math.min(...Y);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=r([e[0],i[0],i[1]],b,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...j};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<s&&(c=l([e[0],e[1]-q],i),X.push(c))}if(k.show&&+t.value<s){const t=e[1];if(k.text)d=l([e[0],e[1]+5],{value:k.text.split("").join("\n"),originY:"top",...k.style});else{const i=t+2*q;d=r([e[0],t,i],{...k.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:k.text?5:2*q,moveHide:!0}})}(F,u,z,K),function(n,l,r,u,c,d){let f,h;const{pointAttr:g={},lineAttr:m={},title:b="",key:j,type:w="circle"}=c,k=e.list[u+1];let S=x(n),Y=x(l);const M=function(e,t){return"pain"===e&&0==t}(a,e.list[u].value),D=()=>"pulse"==a&&r.pacemakerShow?y.value:W(r)?L.type:M&&"number"===$?0:w,z=e=>e&&p.show&&p.fixed&&ye(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(r.breakpoint)return!1;if("temperature"===a&&(n||z(r))&&(l||z(k))){const e=V(a,35);return n||(S=[T(r.time),e]),l||(Y=[T(k.time),e]),!0}return!!n&&!!l})()){h=i([...S,...Y],{...m});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if(n&&l&&(null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...m});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const F=D(),_=I[u-1],q={origin:{data:W(r)?{...r,value:L.fixedValue}:r,title:b,key:j||"",unit:s.unit,type:a,_type:v(b,a),dataIndex:t,index:u},leftLine:_,rightLine:h,otherObj:d,...r.pacemakerShow&&"pulse"==a?y.style:W(r)?L.style:g,lockMovementX:!0,...H(),...M?{selectable:!1,evented:!1,..."number"===$?P:{}}:{}};n&&(_?q.leftLine.set("x2",n[0]):q.leftLine=null,f=o(F,{left:n[0],top:M&&!ne[1]?n[1]-5:n[1],...q}));I.push(h),f&&(j===ue[1]?ce.add(f):W(r)||de.add(f),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:r=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),r&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=R(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),je(n,"change")}}))}(f),C.push(f),pe.add(f))}(F,N,u,w,z,K)})),"pulse"===a){const{key:t}=e;let i=null;ae.set(t,C.map(((e,t,n)=>{var o,l;const r=n[t+1];if(r&&f(e.left,1)===f(r.left,1)){const t=e.left-_/2;e.set("left",t+_/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+_/2,r.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const z=I.filter((e=>e));E.value.add(...z,...C,...X)}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:s,physicsReduce:u}=l||{},a="hover"===t?l.value:R(o,e.top);if(h(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(h(u))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),r],A.show=!0}function ye(e){const[t]=F,i=j(F),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function xe(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ye(e.time))return;const n=T(e.time),o=V(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function be(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${P(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function je(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=fe.find((e=>e.type===i));if("add"===t){const e=d(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;we()}function we(){var e;pe.size&&(null==(e=E.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}([...pe]))),pe.clear(),ke()}function ke(e){ae.clear(),pe.clear(),ce.clear(),he.clear(),de.clear(),fe.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||ge(e,i,t)})))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>e.show&&"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({},S,z.overlap||{}),l=[];ce.size&&[...ce].forEach((e=>{[...de].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),l.push(o(s,{...i[e],...r}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-re.strokeWidth,height:ie-re.strokeWidth,fill:"transparent",...re});E.value.add(t)}(),ke((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...pe],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:C?C(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=be(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=m(i,[...k,...L]);r[`${e.type}`]=e.value,r.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};O("change",s),je(s,"change")}else{const t={data:{time:P(e.pointer.x),value:R(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),je(t)}},setPopup:me,isAddPoint:be,updateData:je,redrawPoints:we,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -27,6 +27,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
27
27
  type: import("vue").PropType<import("./src/types").FilterSetItem[]>;
28
28
  default: () => never[];
29
29
  };
30
+ showFilterColumnNames: {
31
+ type: import("vue").PropType<("type" | "title" | "optionType" | "isShowSearch" | "filterExplicit" | "explicitRequired" | "defaultValue" | "customTitle" | "width")[]>;
32
+ default: () => never[];
33
+ };
30
34
  }, {
31
35
  attrs: {
32
36
  [x: string]: unknown;
@@ -58,6 +62,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
58
62
  type: import("vue").PropType<import("./src/types").FilterSetItem[]>;
59
63
  default: () => never[];
60
64
  };
65
+ showFilterColumnNames: {
66
+ type: import("vue").PropType<("type" | "title" | "optionType" | "isShowSearch" | "filterExplicit" | "explicitRequired" | "defaultValue" | "customTitle" | "width")[]>;
67
+ default: () => never[];
68
+ };
61
69
  }>> & {
62
70
  onSave?: ((...args: any[]) => any) | undefined;
63
71
  }>>;
@@ -109,6 +117,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
109
117
  type: import("vue").PropType<import("./src/types").FilterSetItem[]>;
110
118
  default: () => never[];
111
119
  };
120
+ showFilterColumnNames: {
121
+ type: import("vue").PropType<("type" | "title" | "optionType" | "isShowSearch" | "filterExplicit" | "explicitRequired" | "defaultValue" | "customTitle" | "width")[]>;
122
+ default: () => never[];
123
+ };
112
124
  }>> & {
113
125
  onSave?: ((...args: any[]) => any) | undefined;
114
126
  }, {
@@ -116,5 +128,6 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
116
128
  fieldColorList: import("./src/types").ColorSetItem[];
117
129
  highlightRowColorList: import("./src/types").ColorSetItem[];
118
130
  fieldFilterList: import("./src/types").FilterSetItem[];
131
+ showFilterColumnNames: ("type" | "title" | "optionType" | "isShowSearch" | "filterExplicit" | "explicitRequired" | "defaultValue" | "customTitle" | "width")[];
119
132
  }>>;
120
133
  export default FieldSet;