cnhis-design-vue 3.1.41-release.5 → 3.1.41-release.6

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 (130) hide show
  1. package/es/components/button-print/src/utils/print.js +1 -1
  2. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
  3. package/es/components/fabric-chart/src/hooks/useDraw.d.ts +1 -0
  4. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/useOther.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/useTop.js +1 -1
  8. package/es/components/field-set/index.d.ts +8 -0
  9. package/es/components/field-set/src/FieldSet.vue.d.ts +5 -0
  10. package/es/components/field-set/src/FieldSet.vue.js +1 -1
  11. package/es/components/field-set/style/index.css +1 -1
  12. package/es/components/form-config/index.d.ts +6755 -44
  13. package/es/components/form-config/src/FormConfig.vue.d.ts +6897 -185
  14. package/es/components/form-config/src/FormConfig.vue.js +1 -1
  15. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -1
  16. package/es/components/form-config/src/components/FormConfigCreator.vue.js +1 -1
  17. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.d.ts +4 -4
  18. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.js +1 -1
  19. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3410 -58
  20. package/es/components/form-config/src/components/FormConfigEdit.vue.js +1 -1
  21. package/es/components/form-config/src/components/FormConfigMaterialItem.d.ts +2 -2
  22. package/es/components/form-config/src/components/FormConfigMaterialItem.js +1 -1
  23. package/es/components/form-config/src/components/renderer/CloseButton.vue.d.ts +3 -3
  24. package/es/components/form-config/src/components/renderer/CloseButton.vue.js +1 -1
  25. package/es/components/form-config/src/components/renderer/ComplexNode.vue.d.ts +10 -10
  26. package/es/components/form-config/src/components/renderer/ComplexNode.vue.js +1 -1
  27. package/es/components/form-config/src/components/renderer/DefaultNode.vue.d.ts +6 -6
  28. package/es/components/form-config/src/components/renderer/DefaultNode.vue.js +1 -1
  29. package/es/components/form-config/src/hooks/useConfigurationField.d.ts +2 -3
  30. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  31. package/es/components/form-config/src/hooks/useDataNormalize.d.ts +4 -2
  32. package/es/components/form-config/src/hooks/useDataNormalize.js +1 -1
  33. package/es/components/form-config/src/hooks/usePresetRenderer.d.ts +1 -1
  34. package/es/components/form-config/src/types/index.d.ts +8 -2
  35. package/es/components/form-config/src/utils/index.d.ts +4 -1
  36. package/es/components/form-config/src/utils/index.js +1 -1
  37. package/es/components/form-config/style/index.css +1 -1
  38. package/es/components/form-render/index.d.ts +1 -1
  39. package/es/components/form-render/src/FormRender.vue.js +1 -1
  40. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +21 -20
  41. package/es/components/form-render/src/FormRenderWrapper.vue.js +1 -1
  42. package/es/components/form-render/src/constants/index.d.ts +0 -12
  43. package/es/components/form-render/src/constants/index.js +1 -1
  44. package/es/components/form-render/src/hooks/useLowCodeReactions.js +1 -1
  45. package/es/components/form-render/src/types/index.d.ts +4 -2
  46. package/es/components/iho-table/index.d.ts +2 -2
  47. package/es/components/iho-table/src/IhoTable.vue.d.ts +2 -2
  48. package/es/components/iho-table/src/IhoTable.vue.js +1 -1
  49. package/es/components/iho-table/src/plugins/{filterPlugin → filterRenderPlugin}/filter.vue.d.ts +15 -74
  50. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.js +1 -0
  51. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.d.ts +1 -0
  52. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -0
  53. package/es/components/iho-table/src/plugins/index.js +1 -1
  54. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +85 -0
  55. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.js +1 -0
  56. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/{timeRendererPlugin.d.ts → timeRendererPlugin/index.d.ts} +1 -1
  57. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/index.js +1 -0
  58. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/timeUtils.d.ts +2 -0
  59. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/timeUtils.js +1 -0
  60. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  61. package/es/components/iho-table/src/types/index.d.ts +20 -11
  62. package/es/components/iho-table/src/utils/index.js +1 -1
  63. package/es/components/iho-table/style/index.css +1 -1
  64. package/es/components/index.css +1 -1
  65. package/es/components/info-header/index.d.ts +289 -155
  66. package/es/components/info-header/src/InfoHeader.vue.d.ts +293 -160
  67. package/es/components/info-header/src/InfoHeader.vue.js +1 -1
  68. package/es/components/info-header/src/components/index.d.ts +3 -0
  69. package/es/components/info-header/src/components/index.js +1 -0
  70. package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.js +1 -0
  71. package/es/components/info-header/src/components/infoDescription/InfoEllipsis.vue.js +1 -0
  72. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +266 -0
  73. package/es/components/info-header/src/components/infoDescription/index.vue.js +1 -0
  74. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +38 -0
  75. package/es/components/info-header/src/components/patientInfo/index.vue.js +1 -0
  76. package/es/components/info-header/src/types/index.d.ts +29 -0
  77. package/es/components/scale-view/index.d.ts +1 -2
  78. package/es/components/scale-view/src/ScaleView.vue.d.ts +1 -5
  79. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  80. package/es/components/scale-view/src/hooks/scaleview-computed.d.ts +1 -0
  81. package/es/components/scale-view/src/hooks/scaleview-computed.js +1 -1
  82. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  83. package/es/components/scale-view/src/utils/judge-types.js +1 -1
  84. package/es/components/scale-view/style/index.css +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/index.d.ts +12 -77
  88. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.d.ts +4 -2
  89. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.js +1 -1
  90. package/es/components/table-filter/src/classification/Classification-com.vue.d.ts +4 -22
  91. package/es/components/table-filter/src/classification/Classification-com.vue.js +1 -1
  92. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +2 -2
  93. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +2 -2
  94. package/es/components/table-filter/src/components/classify-filter/index.vue.js +1 -1
  95. package/es/components/table-filter/src/components/search-filter/index.vue.d.ts +2 -2
  96. package/es/components/table-filter/src/components/search-filter/index.vue.js +1 -1
  97. package/es/components/table-filter/src/components/set-classification/index.vue.d.ts +4 -20
  98. package/es/components/table-filter/src/components/set-classification/index.vue.js +1 -1
  99. package/es/components/table-filter/src/components/table-modal/index.vue.js +1 -1
  100. package/es/components/table-filter/src/hooks/useMixins.js +1 -1
  101. package/es/components/table-filter/src/quick-search/QuickSearch.vue.d.ts +4 -53
  102. package/es/components/table-filter/src/quick-search/QuickSearch.vue.js +1 -1
  103. package/es/components/table-filter/style/index.css +1 -1
  104. package/es/shared/components/no-data/NoData.vue.d.ts +5 -0
  105. package/es/shared/components/no-data/NoData.vue.js +1 -1
  106. package/es/shared/utils/index.d.ts +16 -0
  107. package/es/shared/utils/index.js +1 -1
  108. package/package.json +1 -1
  109. package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.js +0 -1
  110. package/es/components/iho-table/src/plugins/filterPlugin/index.d.ts +0 -1
  111. package/es/components/iho-table/src/plugins/filterPlugin/index.js +0 -1
  112. package/es/components/iho-table/src/plugins/filterPlugin/types.d.ts +0 -7
  113. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +0 -1
  114. package/es/components/info-header/src/HiddenContent.vue.js +0 -1
  115. package/es/components/info-header/src/InfoEllipsis.vue.js +0 -1
  116. package/es/components/table-filter/src/components/age-com/index.vue.d.ts +0 -119
  117. package/es/components/table-filter/src/components/button-group/ButtonGroup.vue.d.ts +0 -199
  118. package/es/components/table-filter/src/components/button-icon/getBtnIcon.d.ts +0 -2
  119. package/es/components/table-filter/src/components/button-icon/getBtnIcon.js +0 -1
  120. package/es/components/table-filter/src/components/c-tree-select/tree-select.vue.d.ts +0 -90
  121. package/es/components/table-filter/src/components/multi-select/multi-select.vue.d.ts +0 -113
  122. package/es/components/table-filter/src/components/out-quick-search/out-quick-search.vue.d.ts +0 -266
  123. package/es/components/table-filter/src/components/range-age/index.vue.d.ts +0 -248
  124. package/es/components/table-filter/src/const/dataOptions.d.ts +0 -12
  125. package/es/components/table-filter/src/const/dataOptions.js +0 -1
  126. package/es/components/table-filter/src/directive/preventReClick.d.ts +0 -4
  127. package/es/components/table-filter/src/directive/preventReClick.js +0 -1
  128. package/es/components/info-header/src/{HiddenContent.vue.d.ts → components/infoDescription/HiddenContent.vue.d.ts} +2 -2
  129. package/es/components/info-header/src/{InfoEllipsis.vue.d.ts → components/infoDescription/InfoEllipsis.vue.d.ts} +1 -1
  130. /package/es/components/{iho-table/src/plugins/filterPlugin/types.js → info-header/src/types/index.js} +0 -0
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=t.create({withCredentials:!1}),c=`${window.location.protocol}//${window.location.host}`,p=`${c}/fdp-api/print/assembly/printIReport`,u=`${c}/bi-api/reprot/print/open/client/getRemote`,m=`${c}/printService/file`;let w=null;class f{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],w)return w;w=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):h({url:this.printOrigin+"/services/print",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:n(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else this.isRemote&&(d.print={print:"1",type:"6",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${l(new Date,"yyyyMMddHHmmss")}`});return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=c+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({method:"post",url:p,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-1],o=await s(`${m}/${a}`),l=r(null,e,o);if("preview"===e)return l}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),d&&d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):h.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{f as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],m)return m;m=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:this.printOrigin+"/services/print",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:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${u}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),d&&d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
@@ -1 +1 @@
1
- import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultRectStyle as s}from"./useDraw.js";import{fabric as a}from"../utils/index.js";import{getIndex as u,isEffectiveNode as c}from"../utils/utils.js";import{cloneDeep as f}from"lodash-es";import{format as p}from"date-fns";function d(d,h,g,v,m,y){const{cumputedX:k,cumputedY:w,getXValue:x,getYValue:b}=t(h),{getEqualXTypes:T,repeatTip:E}=y,{xAxis:P,grid:S,originX:j,originY:C,xCellWidth:G,endY:L,startTime:Y,leftAddAreaWidth:A,leftScales:I,rightScales:M,yCellHeight:X,endX:D,scaleValues:H,canvasWidth:O,borderStyle:V,rightAddAreaWidth:W,event:$,originYCervix:R,other:q}=h,z=f(H),B=new Set;function F(){z.forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,p){let m,y;const{pointAttr:k={},lineAttr:w={},title:T="",key:E,type:P="circle",childbirth:S={}}=t,j=t.data[p+1],C=Q(j,t);if(s&&C&&!f.breakpoint)y=n([...s,...C],{...w});else if(s&&!C&&!f.breakpoint){const e=Q(j,t);y=e?n([...s,...e],{...w}):null}let L,Y;if(f.childbirth){const t=s[1]+X;L=o([s[0],s[1],t],S.style||{}),c.push(L),S.text&&(Y=i([s[0]+G/2,t-X/2],{value:String(S.text),...r,originX:"left",originY:"center",...S.style||{}}),c.push(Y))}const A=u[p-1],I={origin:{data:f,title:T,key:E||"",dataIndex:e,index:p},leftLine:A,rightLine:y,arrowGroup:L,arrowGroupText:Y,...k,...h.event};A?m=l(P,{left:A.get("x2"),top:A.get("y2"),...I}):s&&(I.leftLine=null,m=l(P,{left:s[0],top:s[1],...I}));u.push(y),m&&(!function(t){$.hovered&&(t.on("mouseover",(()=>{N(t)})),t.on("mouseout",(()=>{v.show=!1})));t.on("moving",(()=>{K(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+G/2,top:t.top+X/2})}(t),$.hovered&&N(t)})),t.on("mouseup",(e=>{if(v.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:x(t.left),value:b(e,t.top)}};d.value.discardActiveObject(),g("change",n),J(n,"change")}}))}(m),a.push(m),B.add(m))}(Q(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{d.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function J(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=z.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=u(o.time,l.data);l.data.splice(t,0,o);break}}var s;B.size&&(null==(s=d.value)||s.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}([...B]))),B.clear(),F()}function K(t){const e=t.prevPoint?t.prevPoint.left:j,n=t.nextPoint?t.nextPoint.left:D;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<R&&t.set("top",R),t.top<C&&t.set("top",C),t.top>L&&t.set("top",L),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function N(t){const{title:e,key:n}=t.origin;v.point={x:t.left,y:t.top},v.list=[`${e} ${b(n,t.top)}`,`时间 ${x(t.left).slice(-5)}`],v.show=!0}function Q(t,e){if(c(t)&&function(t){const e=Y+864e5,n=new Date(t).getTime();return n>=Y&&n<=e}(t.time)){const n=k(t.time),o=w(e.key,e.range,t.value);return[n,o<C?C:o>L?L:o]}}function U(t,e){return t+1>e[1]?e[0]:t+1}return e(d,h,!0),function(){const t=new a.Rect({...V,width:O-A-W,height:L,left:A,top:0,fill:"transparent"});d.value.add(t)}(),function(){let t=A;[...I,...M].forEach(((e,n)=>{const{range:o,spaceValue:l,width:u,title:c,titleStyle:f,layout:p}=e,h=[];"right"===p&&(t=D);const g=t+u/2,v=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l);v.forEach(((t,e)=>{const n=0===e?L-8:L-e*X;h.push(i([g,n],{value:String(t),...r}))}));const m=new a.Rect({...s,width:u,height:L,left:g,top:L/2}),y=C>0?i([g,C-X/2],{value:String(c),...r,...f}):null,k=new a.Group([...h,m,...y?[y]:[]],{evented:!1,selectable:!1});d.value.add(k),t+=u}))}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=P.time,{show:s,range:u=[0,23],style:c}=P.processTime;if(t||s){const f=[],p=[],h=[],g=[],v=j+G/2;for(let a=0;a<S.mainXCell;a++){if(t){const t=0===a?+e.slice(11,13):U(f.at(-1),n);f.push(t);const s="top"==o?C-15:L+15;h.push(i([v+a*G,s],{value:String(t),...r,...l||{}}))}if(s){const t=0===a?u[0]:p.at(-1)+1;p.push(t);const e="top"==o?L+15:C-15;g.push(i([v+a*G,e],{value:String(t),...r,...c||{}}))}}const m=new a.Group([...h,...g],{evented:!1,selectable:!1});d.value.add(m),d.value.sendToBack(m)}}(),function(){const t=Object.values(q),e=[],o={},i=z.find((t=>"cervix"===t.key)),r=i.data.find((t=>3==+t.value));function l(t,e){const{key:n,range:o}=i||{},r=w(n,o,10),l=[0,e],s=[-e/t,0],a=[(L-r-e)/t,L-r],u=[D-j,t*(D-j)+e];let c=[],f=[];function p([n,o]){return Math.abs(o-t*n-e)<=1}function d([t,e]){const[n,o]=[...h([t,e])];return n>=j&&n<=D&&o>=r&&o<=L}function h([t,e]){return[j+t,L-e]}return p(l)&&d(l)&&(c=h(l)),p(s)&&d(s)&&(c=h(s)),p(a)&&d(a)&&(f=h(a)),p(u)&&d(u)&&(f=h(u)),[...c,...f]}t.forEach((t=>{if(!t.show)return;const{key:s}=t;switch(s){case"fetalPresentation":{const{range:o}=z.find((t=>t.key===s)),i=w(s,o,0);e.push(n([j,i,D,i],{...t}));break}case"alert":if(r){const{key:s,range:a}=i||{},u=216e5,c={time:p(new Date(new Date(r.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[k(r.time)-j,L-w(s,a,r.value)],[h,g]=[k(c.time)-j,L-w(s,a,c.value)],v=(g-d)/(h-f),m=d-f*v,y=l(v,m);y.length>0&&(e.push(n(y,{...t})),Object.assign(o,{k:v,b:m}))}break;case"handling":if(r){const{k:i,b:s}=o,a=144e5,u=l(i,s-(k(p(new Date(new Date(r.time).getTime()+a),"yyyy-MM-dd HH:mm"))-k(r.time))*i);u.length>0&&e.push(n(u,{...t}))}}})),d.value.add(...e)}(),F(),function(){function t(t,e){const n=z.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}h.event.evented&&d.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=j&&n<=D&&o>=C&&o<=L&&(m.point={x:n,y:o},m.show=!0,e.target?(m.target=e.target,m.list=["删除节点"],d.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&m.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(m.target=null,m.list=["新增节点"],z.forEach((i=>{if(!T(n,"key",G).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<R)return;m.list.push(t(i,e.pointer))}})),1===m.list.length&&(m.show=!1,E(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=O-W/2;function e(t,e){if(!t.length)return;let o=C;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=H.findIndex((e=>e.key===t.key)),u=new a.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=l(t.type,{left:e,top:o+u.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+u.height+3,...h.event});o+=u.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=j&&e<=D&&n>=C&&n<=L}t.on("moving",(()=>{t.set("originY","center"),e(t)?(K(t),N(t)):v.show=!1})),t.on("mouseup:before",(n=>{if(v.show=!1,0===n.e.button&&e(t))if(T(t.left,"key",G).includes(t.origin.key))E();else{const e={data:{time:x(t.left),value:b(t.origin.key,t.top)},...t.origin};g("add",e),J(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(u,c)})),n(i),d.value.add(...i)}function n(t){const e=t.at(-1),n=(L-C)/2,o=(e.height+e.top-C)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(I,A/2),e(M,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(g("remove",n),J(n,"remove")):(Object.assign(n,{data:{time:x(t.pointer.x),value:b(t.origin.key,t.pointer.y)}}),g("add",n),J(n))}}}export{d as useBirthProcess};
1
+ import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{fabric as u}from"../utils/index.js";import{getIndex as c,isEffectiveNode as f}from"../utils/utils.js";import{cloneDeep as p}from"lodash-es";import{format as d}from"date-fns";function h(h,g,m,v,y,k){const{cumputedX:w,cumputedY:x,getXValue:b,getYValue:T}=t(g),{getEqualXTypes:j,repeatTip:C}=k,{xAxis:E,grid:P,originX:S,originY:G,xCellWidth:L,endY:Y,startTime:A,leftAddAreaWidth:I,leftScales:M,rightScales:X,yCellHeight:D,endX:H,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:$,event:R,originYCervix:q,other:z}=g,B=p(O),F=new Set;function J(){B.forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,p){let d,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:j,type:C="circle",childbirth:E={}}=t,P=t.data[p+1],S=U(P,t);if(s&&S&&!f.breakpoint)y=n([...s,...S],{...w});else if(s&&!S&&!f.breakpoint){const e=U(P,t);y=e?n([...s,...e],{...w}):null}let G,Y;if(f.childbirth){const t=s[1]+D;G=o([s[0],s[1],t],E.style||{}),c.push(G),E.text&&(Y=i([s[0]+L/2,t-D/2],{value:String(E.text),...r,originX:"left",originY:"center",...E.style||{}}),c.push(Y))}const A=u[p-1],I={origin:{data:f,title:x,key:j||"",dataIndex:e,index:p},leftLine:A,rightLine:y,arrowGroup:G,arrowGroupText:Y,...k,...g.event};A?d=l(C,{left:A.get("x2"),top:A.get("y2"),...I}):s&&(I.leftLine=null,d=l(C,{left:s[0],top:s[1],...I}));u.push(y),d&&(!function(t){R.hovered&&(t.on("mouseover",(()=>{Q(t)})),t.on("mouseout",(()=>{v.show=!1})));t.on("moving",(()=>{N(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+L/2,top:t.top+D/2})}(t),R.hovered&&Q(t)})),t.on("mouseup",(e=>{if(v.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:b(t.left),value:T(e,t.top)}};h.value.discardActiveObject(),m("change",n),K(n,"change")}}))}(d),a.push(d),F.add(d))}(U(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{h.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function K(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=B.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=c(o.time,l.data);l.data.splice(t,0,o);break}}var s;F.size&&(null==(s=h.value)||s.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}([...F]))),F.clear(),J()}function N(t){const e=t.prevPoint?t.prevPoint.left:S,n=t.nextPoint?t.nextPoint.left:H;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<q&&t.set("top",q),t.top<G&&t.set("top",G),t.top>Y&&t.set("top",Y),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function Q(t){const{title:e,key:n}=t.origin;v.point={x:t.left,y:t.top},v.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],v.show=!0}function U(t,e){if(f(t)&&function(t){const e=A+864e5,n=new Date(t).getTime();return n>=A&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<G?G:o>Y?Y:o]}}function Z(t,e){return t+1>e[1]?e[0]:t+1}return e(h,g,!0),function(){const t=new u.Rect({...W,width:V-I-$,height:Y,left:I,top:0,fill:"transparent"});h.value.add(t)}(),function(){let t=I;[...M,...X].forEach(((e,n)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:p,layout:d}=e,g=[];"right"===d&&(t=H);const m=t+c/2,v=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l);v.forEach(((t,e)=>{const n=0===e?Y-8:Y-e*D;g.push(i([m,n],{value:String(t),...r}))}));const y=new u.Rect({...a,width:c,height:Y,left:m,top:Y/2}),k=G>0?i([m,G-D/2],{value:String(f),...r,...p}):null,w=new u.Group([...g,y,...k?[k]:[]],{objectCaching:!1,...s});h.value.add(w),t+=c}))}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:c=[0,23],style:f}=E.processTime;if(t||a){const p=[],d=[],g=[],m=[],v=S+L/2;for(let s=0;s<P.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):Z(p.at(-1),n);p.push(t);const a="top"==o?G-15:Y+15;g.push(i([v+s*L,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:d.at(-1)+1;d.push(t);const e="top"==o?Y+15:G-15;m.push(i([v+s*L,e],{value:String(t),...r,...f||{}}))}}const y=new u.Group([...g,...m],{objectCaching:!1,...s});h.value.add(y),h.value.sendToBack(y)}}(),function(){const t=Object.values(z),e=[],o={},i=B.find((t=>"cervix"===t.key)),r=i.data.find((t=>3==+t.value));function l(t,e){const{key:n,range:o}=i||{},r=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(Y-r-e)/t,Y-r],u=[H-S,t*(H-S)+e];let c=[],f=[];function p([n,o]){return Math.abs(o-t*n-e)<=1}function d([t,e]){const[n,o]=[...h([t,e])];return n>=S&&n<=H&&o>=r&&o<=Y}function h([t,e]){return[S+t,Y-e]}return p(l)&&d(l)&&(c=h(l)),p(s)&&d(s)&&(c=h(s)),p(a)&&d(a)&&(f=h(a)),p(u)&&d(u)&&(f=h(u)),[...c,...f]}t.forEach((t=>{if(!t.show)return;const{key:s}=t;switch(s){case"fetalPresentation":{const{range:o}=B.find((t=>t.key===s)),i=x(s,o,0);e.push(n([S,i,H,i],{...t}));break}case"alert":if(r){const{key:s,range:a}=i||{},u=216e5,c={time:d(new Date(new Date(r.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,p]=[w(r.time)-S,Y-x(s,a,r.value)],[h,g]=[w(c.time)-S,Y-x(s,a,c.value)],m=(g-p)/(h-f),v=p-f*m,y=l(m,v);y.length>0&&(e.push(n(y,{...t})),Object.assign(o,{k:m,b:v}))}break;case"handling":if(r){const{k:i,b:s}=o,a=144e5,u=l(i,s-(w(d(new Date(new Date(r.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(r.time))*i);u.length>0&&e.push(n(u,{...t}))}}})),h.value.add(...e)}(),J(),function(){function t(t,e){const n=B.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}g.event.evented&&h.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=S&&n<=H&&o>=G&&o<=Y&&(y.point={x:n,y:o},y.show=!0,e.target?(y.target=e.target,y.list=["删除节点"],h.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&y.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(y.target=null,y.list=["新增节点"],B.forEach((i=>{if(!j(n,"key",L).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;y.list.push(t(i,e.pointer))}})),1===y.list.length&&(y.show=!1,C(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=V-$/2;function e(t,e){if(!t.length)return;let o=G;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=O.findIndex((e=>e.key===t.key)),a=new u.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...g.event});o+=a.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=S&&e<=H&&n>=G&&n<=Y}t.on("moving",(()=>{t.set("originY","center"),e(t)?(N(t),Q(t)):v.show=!1})),t.on("mouseup:before",(n=>{if(v.show=!1,0===n.e.button&&e(t))if(j(t.left,"key",L).includes(t.origin.key))C();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};m("add",e),K(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(a,c)})),n(i),h.value.add(...i)}function n(t){const e=t.at(-1),n=(Y-G)/2,o=(e.height+e.top-G)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(M,I/2),e(X,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(m("remove",n),K(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),m("add",n),K(n))}}}export{h as useBirthProcess};
@@ -36,6 +36,7 @@ export declare const defaultTextStyle: {
36
36
  originX: string;
37
37
  originY: string;
38
38
  lineHeight: number;
39
+ objectCaching: boolean;
39
40
  };
40
41
  export declare function drawLine(points: number[], style: Partial<ILineOptions>): fabric.Line;
41
42
  export declare function drawText([x, y]: [x: number, y: number], style: ITextOptions): fabric.Text;
@@ -1 +1 @@
1
- import{fabric as e}from"../utils/index.js";const t={evented:!1,selectable:!1},r={stroke:"#999",strokeWidth:1,...t},i={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},n={fill:"transparent",stroke:"#999",strokeWidth:1,originX:"center",originY:"center",...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,...t};function c(t,r){return new e.Line(t,{...i,...r})}function s([t,r],i){return new e.Text(String(i.value),{...o,left:t,top:r,...i})}function l([r,i,n],o,l="down"){const a=c([r,i,r,n],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?n-3:n+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,i,c){const s=new e.Rect({...n,...r}),{value:l="标题",textAlign:a="center",verticalAlign:u="center"}=i,g=r.width/2,d=r.height/2,f=new e.Text(String(l),{...o,...i,..."left"==a||"right"==a?{originX:a,left:"left"==a?-g:g}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-d:d}:{}});return new e.Group([s,f],{...t,...c})}function u(t="circle",r){const i={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...r},n=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...i});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...i});case"image":return new e.Image(r.element,{...i,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),i={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},n=new e.Line([0,t/2,t,t/2],i),o=new e.Line([t/2,0,t/2,t],i);return new e.Group([n,o])};return new e.Group([n(),t()],{scale:1,...i})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([n(),o],{scale:1,...i})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...i})}}export{r as defaultBorderStyle,i as defaultLineStyle,n as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
1
+ import{fabric as e}from"../utils/index.js";const t={evented:!1,selectable:!1},r={stroke:"#999",strokeWidth:1,...t},i={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},n={fill:"transparent",stroke:"#999",strokeWidth:1,originX:"center",originY:"center",...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,...t};function c(t,r){return new e.Line(t,{...i,...r})}function s([t,r],i){return new e.Text(String(i.value),{...o,left:t,top:r,...i})}function l([r,i,n],o,l="down"){const a=c([r,i,r,n],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?n-3:n+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,i,c){const s=new e.Rect({...n,...r}),{value:l="标题",textAlign:a="center",verticalAlign:u="center"}=i,g=r.width/2,h=r.height/2,d=new e.Text(String(l),{...o,...i,..."left"==a||"right"==a?{originX:a,left:"left"==a?-g:g}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function u(t="circle",r){const i={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},n=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...i});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...i});case"image":return new e.Image(r.element,{...i,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),i={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},n=new e.Line([0,t/2,t,t/2],i),o=new e.Line([t/2,0,t/2,t],i);return new e.Group([n,o])};return new e.Group([n(),t()],{scale:1,...i})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([n(),o],{scale:1,...i})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...i})}}export{r as defaultBorderStyle,i as defaultLineStyle,n as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,defaultRectStyle as o,drawPoint as l,drawTextGroup as r}from"./useDraw.js";import{getType as s,isOneLine as u}from"../utils/utils.js";function h(h,a,g,c,p,f,d,y,w,v,S,m){var Y,b;const{getEqualXTypes:x,repeatTip:X}=m,{originY:N,endY:T,originX:L,endX:M,xCellWidth:V,yCellHeight:k,left:E,vitalSignsOriginY:C,painOriginY:G,painHeight:H,iconsWidth:I,itemList:O,painIndex:R,right:W,canvasWidth:j,canvasHeight:A,getRightInfo:_}=a;function B(e,n,o,l){const{position:r}=n;return new t.Text(String(e),{...i,originX:"left"==r?"right":"right"==r?"left":"center",left:o,top:l,...n.style})}function J(t="center",e,i){let n=e+i/2,o=[n-4.5,n+4.5],l=[n-2.5,n+2.5],r=n;return"right"===t&&(n=e,o=[n,n+9],l=[n,n+5],r=o[1]),"left"===t&&(n=e+i,o=[n-9,n],l=[n-5,n],r=o[0]),{lineXMain:o,lineXSub:l,textLeft:r}}function $(l){var s;if(!(null==l?void 0:l.length))return;const{layout:u}=l[0];let a=I,g=L;"right"===u&&(a=M,g=M+(null!=(s=null==W?void 0:W.width)?s:0));const c=[],p=H&&"right"!==u?l.length-1:l.length,f=(g-a)/p,d=f+(g-a)%p;l.forEach(((l,s)=>{var u,g;if("pain"===l.type)return void function(n){const l=r({width:L-I,height:H,...o},{value:`${n.title}`,...i,...n.style||{}},{left:I,top:G.originY}),s=[];if(n.showScale||n.showNumber){const{lineXMain:i,textLeft:o}=J(n.position,I,L-I),l=n.list.length;n.list.forEach(((r,u)=>{let h=G.endY-u*k*n.spaceGridNumber;0===u&&(h=T-5);const a=0===u||u===l-1;if(!n.showNumber||a&&!n.showMaxMinNumber||s.push(B(r,n,o,h)),n.showScale&&0!==u){const[o,l]=i,r=new t.Line([o,h,l,h],{...e,...n.style});s.push(r)}}))}h.value.add(l,...s),l.sendToBack()}(l);const p=[];function y(i){const n=new t.Line(i,{...e,...l.style});p.push(n)}const w=0===s?d:f,v=0===s?a:d+a+(s-1)*f,S=s>0?new t.Line([v,C.originY,v,C.endY],{...e}):null;S&&p.push(S);const m=v+w/2,Y=l.spaceGridNumber||5;if(l.showScale||l.showNumber){const t=Y*k/5,e=l.position||"center",{lineXMain:i,lineXSub:n,textLeft:o}=J(l.position,v,w),r=null==(u=l.list)?void 0:u.length;null==(g=null==l?void 0:l.list)||g.forEach(((s,u)=>{const h=C.endY-u*k*Y,a=0===u||u===r-1;if(l.showNumber&&(!a||l.showMaxMinNumber)){const t=0==u?h-5:h,e=B(s,l,o,t),i=C.originY+e.height/2;t<i&&e.set({top:i}),p.push(e)}if(l.showScale&&u!==r-1)for(let o=0;o<5;o++)if(o>0||!l.showNumber||"center"!==e){const e=0==o?i[0]:n[0],l=0==o?i[1]:n[1],s=h-o*t;s>C.originY&&(y([e,s,l,s]),u==r-2&&4==o&&y([i[0],s-t,i[1],s-t]))}}))}let b=l.title||"";l.unit&&(b+="\n"+l.unit),b&&p.push(new t.Text(String(b),{...i,left:m,top:C.originY+k*Y/2,textAlign:"center",...l.style}));const x=new t.Group(p,n);c.push(x)})),c.push(new t.Rect({...o,width:"right"===u?g-a-1:g-a,height:"right"===u?T-N-1:T-N,left:a,top:N,originX:"left",originY:"top"}));const y=c.length>0?new t.Group([...c],{...n}):null;y&&h.value.add(y),y&&y.sendToBack()}function q(t){return t.left>=L&&t.left<M&&t.top>=N&&t.top<=T}I&&function(){const e=JSON.parse(JSON.stringify(O));let i=T;const o=I-E.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const f=new t.Text(String(r),{...n,...e.titleStyle||{},originX:"right",originY:"bottom",left:o-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),d=l(e.type,{left:o,top:i-(f.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:s(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:o,originTop:i-(f.height||30)/2-1,...a.event});var m;i-=f.height||30,(m=d).on("moving",(()=>{m.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?G:C;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(m),q(m)?c(m):p.show=!1})),m.on("mouseup:before",(t=>{if(p.show=!1,0===t.e.button&&q(m)){const t=x(m.left,"_type",V).includes(m.origin._type),e=v(m.left);if(!e||t)t&&e&&X();else{const t={data:{time:y(m.left),value:w(m.origin.type,m.top),...u(m.origin.type)?{key:m.origin.key}:{}},...m.origin};g("add",t),S(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(m)})),h.value.add(f,d)}))}();const z=E.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==W?void 0:W.width)&&"left"===(null==(Y=null==W?void 0:W.yScaleValue)?void 0:Y.layout)&&(null==(b=null==W?void 0:W.yScaleValue)?void 0:b.show)&&z.push(_),R>0&&E.yScaleValue[R].show){const t=E.yScaleValue[R];0===R&&E.yScaleValue.length>1&&z.unshift(t),R==E.yScaleValue.length-1&&z.push(t)}return $(z),h.value.add(new t.Rect({left:I,top:0,width:j-I-1,height:A-1,fill:"transparent",...e})),{drawScaleValue:$}}export{h as useLeft};
1
+ import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,defaultRectStyle as o,drawPoint as l,drawTextGroup as r}from"./useDraw.js";import{getType as s,isOneLine as h}from"../utils/utils.js";function u(u,a,g,c,p,f,d,y,w,v,S,m){var b,Y;const{getEqualXTypes:x,repeatTip:X}=m,{originY:N,endY:T,originX:L,endX:M,xCellWidth:V,yCellHeight:C,left:j,vitalSignsOriginY:k,painOriginY:E,painHeight:G,iconsWidth:H,itemList:I,painIndex:O,right:R,canvasWidth:W,canvasHeight:A,getRightInfo:_}=a;function B(e,n,o,l){const{position:r}=n;return new t.Text(String(e),{...i,originX:"left"==r?"right":"right"==r?"left":"center",left:o,top:l,...n.style})}function J(t="center",e,i){let n=e+i/2,o=[n-4.5,n+4.5],l=[n-2.5,n+2.5],r=n;return"right"===t&&(n=e,o=[n,n+9],l=[n,n+5],r=o[1]),"left"===t&&(n=e+i,o=[n-9,n],l=[n-5,n],r=o[0]),{lineXMain:o,lineXSub:l,textLeft:r}}function $(l){var s;if(!(null==l?void 0:l.length))return;const{layout:h}=l[0];let a=H,g=L;"right"===h&&(a=M,g=M+(null!=(s=null==R?void 0:R.width)?s:0));const c=[],p=G&&"right"!==h?l.length-1:l.length,f=(g-a)/p,d=f+(g-a)%p;l.forEach(((l,s)=>{var h,g;if("pain"===l.type)return void function(n){const l=r({width:L-H,height:G,...o},{value:`${n.title}`,...i,...n.style||{}},{left:H,top:E.originY}),s=[];if(n.showScale||n.showNumber){const{lineXMain:i,textLeft:o}=J(n.position,H,L-H),l=n.list.length;n.list.forEach(((r,h)=>{let u=E.endY-h*C*n.spaceGridNumber;0===h&&(u=T-5);const a=0===h||h===l-1;if(!n.showNumber||a&&!n.showMaxMinNumber||s.push(B(r,n,o,u)),n.showScale&&0!==h){const[o,l]=i,r=new t.Line([o,u,l,u],{...e,...n.style});s.push(r)}}))}u.value.add(l,...s),l.sendToBack()}(l);const p=[];function y(i){const n=new t.Line(i,{...e,...l.style});p.push(n)}const w=0===s?d:f,v=0===s?a:d+a+(s-1)*f,S=s>0?new t.Line([v,k.originY,v,k.endY],{...e}):null;S&&p.push(S);const m=v+w/2,b=l.spaceGridNumber||5;if(l.showScale||l.showNumber){const t=b*C/5,e=l.position||"center",{lineXMain:i,lineXSub:n,textLeft:o}=J(l.position,v,w),r=null==(h=l.list)?void 0:h.length;null==(g=null==l?void 0:l.list)||g.forEach(((s,h)=>{const u=k.endY-h*C*b,a=0===h||h===r-1;if(l.showNumber&&(!a||l.showMaxMinNumber)){const t=0==h?u-5:u,e=B(s,l,o,t),i=k.originY+e.height/2;t<i&&e.set({top:i}),p.push(e)}if(l.showScale&&h!==r-1)for(let o=0;o<5;o++)if(o>0||!l.showNumber||"center"!==e){const e=0==o?i[0]:n[0],l=0==o?i[1]:n[1],s=u-o*t;s>k.originY&&(y([e,s,l,s]),h==r-2&&4==o&&y([i[0],s-t,i[1],s-t]))}}))}let Y=l.title||"";l.unit&&(Y+="\n"+l.unit),Y&&p.push(new t.Text(String(Y),{...i,left:m,top:k.originY+C*b/2,textAlign:"center",...l.style}));const x=new t.Group(p,{...n,objectCaching:!1});c.push(x)})),c.push(new t.Rect({...o,width:"right"===h?g-a-1:g-a,height:"right"===h?T-N-1:T-N,left:a,top:N,originX:"left",originY:"top"}));const y=c.length>0?new t.Group([...c],{...n,objectCaching:!1}):null;y&&u.value.add(y),y&&y.sendToBack()}function q(t){return t.left>=L&&t.left<M&&t.top>=N&&t.top<=T}H&&function(){const e=JSON.parse(JSON.stringify(I));let i=T;const o=H-j.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const f=new t.Text(String(r),{...n,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:o-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),d=l(e.type,{left:o,top:i-(f.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:s(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:o,originTop:i-(f.height||30)/2-1,...a.event});var m;i-=f.height||30,(m=d).on("moving",(()=>{m.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?E:k;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(m),q(m)?c(m):p.show=!1})),m.on("mouseup:before",(t=>{if(p.show=!1,0===t.e.button&&q(m)){const t=x(m.left,"_type",V).includes(m.origin._type),e=v(m.left);if(!e||t)t&&e&&X();else{const t={data:{time:y(m.left),value:w(m.origin.type,m.top),...h(m.origin.type)?{key:m.origin.key}:{}},...m.origin};g("add",t),S(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(m)})),u.value.add(f,d)}))}();const z=j.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==R?void 0:R.width)&&"left"===(null==(b=null==R?void 0:R.yScaleValue)?void 0:b.layout)&&(null==(Y=null==R?void 0:R.yScaleValue)?void 0:Y.show)&&z.push(_),O>0&&j.yScaleValue[O].show){const t=j.yScaleValue[O];0===O&&j.yScaleValue.length>1&&z.unshift(t),O==j.yScaleValue.length-1&&z.push(t)}return $(z),u.value.add(new t.Rect({left:H,top:0,width:W-H-1,height:A-1,fill:"transparent",...e})),{drawScaleValue:$}}export{u as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultStyle as e}from"./useDraw.js";function n(n,l,i){const{other:o,vitalSignsOriginY:r,xCellWidth:s,yCellHeight:a}=l;let u=0;function f(n,l,i){const o=[];String(n.value).split("").forEach(((l,i)=>{const r=new t.Text(l,{left:0,top:a*i,originX:"center",...e,...n.style||{}});u=(a-(r.height||0))/2,o.push(r)}));const r={originX:"center",left:l,top:i+u,baseTop:(n.baseTop||0)*a,trueLeft:l,trueHeight:o.length*a};return new t.Group(o,r)}!function(){if(!(null==o?void 0:o.list))return!1;const l=[],u=[];o.list.forEach(((t,e)=>{const n=0===e?"vertical":t.align||"vertical",l=i(t.time,!0),o=u.find((t=>t.left==l));if(o)o[n].push(t);else{const e={left:l,vertical:[],horizontal:[]};e[n].push(t),u.push(e)}})),u.forEach((t=>{let e=r.originY,n=t.left;t.vertical.forEach(((i,o)=>{var u,h;const c=(i.baseTop||0)*a,g=(null==(u=l.at(-1))?void 0:u.left)||0;0===o&&t.left<=g&&(n=g+s);if(l.filter((t=>t.trueLeft===n)).length){const t=String(i.value).length*a,o=(null==(h=l.at(-1))?void 0:h.trueHeight)||0;e+=o,e+t+c>r.endY&&(e=r.originY,n+=s)}e+=c,String(i.value).length&&l.push(f(i,n,e))})),t.horizontal.forEach(((e,i)=>{var o;const u=r.originY+(e.baseTop||0)*a,h=(null==(o=l.at(-1))?void 0:o.left)||0;t.left<=h&&(n=h+s),String(e.value).length&&l.push(f(e,n,u))}))}));const h=l.length>0?new t.Group([...l],{...e}):null;h&&n.value.add(h)}()}export{n as useOther};
1
+ import{fabric as t}from"../utils/index.js";import{defaultStyle as e}from"./useDraw.js";function n(n,i,l){const{other:o,vitalSignsOriginY:r,xCellWidth:a,yCellHeight:c}=i;let s=0;function h(n,i,l){const o=[];String(n.value).split("").forEach(((i,l)=>{const r=new t.Text(i,{left:0,top:c*l,originX:"center",...e,objectCaching:!1,...n.style||{}});s=(c-(r.height||0))/2,o.push(r)}));const r={originX:"center",left:i,top:l+s,baseTop:(n.baseTop||0)*c,trueLeft:i,trueHeight:o.length*c,objectCaching:!1};return new t.Group(o,r)}!function(){if(!(null==o?void 0:o.list))return!1;const i=[],s=[];o.list.forEach(((t,e)=>{const n=0===e?"vertical":t.align||"vertical",i=l(t.time,!0),o=s.find((t=>t.left==i));if(o)o[n].push(t);else{const e={left:i,vertical:[],horizontal:[]};e[n].push(t),s.push(e)}})),s.forEach((t=>{let e=r.originY,n=t.left;t.vertical.forEach(((l,o)=>{var s,u;const f=(l.baseTop||0)*c,g=(null==(s=i.at(-1))?void 0:s.left)||0;0===o&&t.left<=g&&(n=g+a);if(i.filter((t=>t.trueLeft===n)).length){const t=String(l.value).length*c,o=(null==(u=i.at(-1))?void 0:u.trueHeight)||0;e+=o,e+t+f>r.endY&&(e=r.originY,n+=a)}e+=f,String(l.value).length&&i.push(h(l,n,e))})),t.horizontal.forEach(((e,l)=>{var o;const s=r.originY+(e.baseTop||0)*c,u=(null==(o=i.at(-1))?void 0:o.left)||0;t.left<=u&&(n=u+a),String(e.value).length&&i.push(h(e,n,s))}))}));const u=i.length>0?new t.Group([...i],{...e,objectCaching:!1}):null;u&&n.value.add(u)}()}export{n as useOther};
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultStyle as l,drawTextGroup as i,defaultTextStyle as o,defaultRectStyle as s}from"./useDraw.js";function n(n,u){const{grid:h,originX:a,xCellWidth:c,gridXNumber:d,top:r,xScalevalueHeight:f,iconsWidth:p,topList:g,endXLimit:v,canvasWidth:y}=u;!function(){const w=[];v&&w.push(new t.Line([v,0,y,0],e));let S=0;g.forEach(((t,e)=>{e>0&&(S+=u[`${g[e-1].key}Height`]),"xScalevalue"==t.key?(function(t,e,l){if(!r.dayHeight)return!1;const s=r.dayHeight,n=c*h.subSecondXCell,u=(d-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<u;h++){const u=a+h*n,c=i({width:n,height:s},{value:h%2==0?"上午":"下午",...o,...t.style||{}},{left:u,top:l});e.push(c)}}(t,w,S),function(t,e,l){var n;const u=r.xScalevalue.show&&null!=(n=r.dayHeight)?n:0,d=f-u,g=i({width:a-p,height:f,...s},{value:r.xScalevalue.title,...o,...t.style||{},...t.titleStyle||{}},{left:p,top:l});e.push(g);const v=[];for(let t=0;t<h.mainXCell;t++)v.push(r.xScalevalue.list);v.flat().forEach(((s,n)=>{const h=a+n*c,r=i({width:c,height:d},{value:s.value,...o,...t.style||{},...s.style||{}},{left:h,top:l+u});e.push(r)}))}(t,w,S)):u[`${t.key}Height`]&&function(t,e,l){const n=u[`${t.key}Height`],d=i({width:a-p,height:n,...s},{value:t.title,...o,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:p,top:l});e.push(d);const r=c*h.subXCell;t.list.forEach(((s,u)=>{const h=a+u*r,c=i({width:r,height:n},{value:s,...o,...(null==t?void 0:t.style)||{}},{left:h,top:l});e.push(c)}))}(t,w,S)}));const x=w.length>0?new t.Group([...w],{...l}):null;x&&x.sendToBack(),x&&n.value.add(x)}()}export{n as useTop};
1
+ import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultStyle as l,drawTextGroup as i,defaultTextStyle as o,defaultRectStyle as n}from"./useDraw.js";function s(s,h){const{grid:u,originX:a,xCellWidth:c,gridXNumber:d,top:r,xScalevalueHeight:f,iconsWidth:p,topList:g,endXLimit:v,canvasWidth:y}=h;!function(){const w=[];v&&w.push(new t.Line([v,0,y,0],e));let S=0;g.forEach(((t,e)=>{e>0&&(S+=h[`${g[e-1].key}Height`]),"xScalevalue"==t.key?(function(t,e,l){if(!r.dayHeight)return!1;const n=r.dayHeight,s=c*u.subSecondXCell,h=(d-u.surplusXCell)/u.subSecondXCell;for(let u=0;u<h;u++){const h=a+u*s,c=i({width:s,height:n},{value:u%2==0?"上午":"下午",...o,...t.style||{}},{left:h,top:l});e.push(c)}}(t,w,S),function(t,e,l){var s;const h=r.xScalevalue.show&&null!=(s=r.dayHeight)?s:0,d=f-h,g=i({width:a-p,height:f,...n},{value:r.xScalevalue.title,...o,...t.style||{},...t.titleStyle||{}},{left:p,top:l});e.push(g);const v=[];for(let t=0;t<u.mainXCell;t++)v.push(r.xScalevalue.list);v.flat().forEach(((n,s)=>{const u=a+s*c,r=i({width:c,height:d},{value:n.value,...o,...t.style||{},...n.style||{}},{left:u,top:l+h});e.push(r)}))}(t,w,S)):h[`${t.key}Height`]&&function(t,e,l){const s=h[`${t.key}Height`],d=i({width:a-p,height:s,...n},{value:t.title,...o,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:p,top:l});e.push(d);const r=c*u.subXCell;t.list.forEach(((n,h)=>{const u=a+h*r,c=i({width:r,height:s},{value:n,...o,...(null==t?void 0:t.style)||{}},{left:u,top:l});e.push(c)}))}(t,w,S)}));const x=w.length>0?new t.Group([...w],{...l,objectCaching:!1}):null;x&&x.sendToBack(),x&&s.value.add(x)}()}export{s as useTop};
@@ -19,6 +19,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
19
19
  }, {
20
20
  fieldsMapping: Record<string, string>;
21
21
  selectOptions: Record<string, string>[];
22
+ sortOptions: {
23
+ label: string;
24
+ value: string;
25
+ }[];
22
26
  emit: (event: "onSave" | "onClose" | "reset", ...args: any[]) => void;
23
27
  settingView: any;
24
28
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -56,6 +60,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
56
60
  name: string;
57
61
  show: boolean;
58
62
  sort: boolean;
63
+ sortDirection: "NONE" | "ASC" | "DESC";
59
64
  title: string;
60
65
  alias: string;
61
66
  fixedShow: boolean;
@@ -76,6 +81,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
76
81
  name: string;
77
82
  show: boolean;
78
83
  sort: boolean;
84
+ sortDirection: "NONE" | "ASC" | "DESC";
79
85
  title: string;
80
86
  alias: string;
81
87
  fixedShow: boolean;
@@ -103,6 +109,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
103
109
  name: string;
104
110
  show: boolean;
105
111
  sort: boolean;
112
+ sortDirection: "NONE" | "ASC" | "DESC";
106
113
  title: string;
107
114
  alias: string;
108
115
  fixedShow: boolean;
@@ -120,6 +127,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
120
127
  name: string;
121
128
  show: boolean;
122
129
  sort: boolean;
130
+ sortDirection: "NONE" | "ASC" | "DESC";
123
131
  title: string;
124
132
  alias: string;
125
133
  fixedShow: boolean;
@@ -4,6 +4,7 @@ declare type Ifields = {
4
4
  name: string;
5
5
  show: boolean;
6
6
  sort: boolean;
7
+ sortDirection: 'NONE' | 'ASC' | 'DESC';
7
8
  title: string;
8
9
  alias: string;
9
10
  fixedShow: boolean;
@@ -46,6 +47,10 @@ declare const _default: import("vue").DefineComponent<{
46
47
  }, {
47
48
  fieldsMapping: Record<string, string>;
48
49
  selectOptions: Record<string, string>[];
50
+ sortOptions: {
51
+ label: string;
52
+ value: string;
53
+ }[];
49
54
  emit: (event: "onSave" | "onClose" | "reset", ...args: any[]) => void;
50
55
  settingView: any;
51
56
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as c,unref as n,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as k,withDirectives as y,vShow as v,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as x,NInput as S,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import F from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const q={class:"fields-set-content"},C={class:"fields-table"},N=r("span",{class:"width-show",style:{width:"4%"}},null,-1),P=r("span",{class:"width-large"},"所有字段",-1),j={class:"width-show"},R={key:0,class:"width-show"},I={key:1,class:"width-show"},L={class:"width-show"},T={class:"width-show"},D=r("span",{class:"width-showed"},"固定",-1),z=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),A={class:"width-show"},K={key:0,class:"width-show"},M={key:1,class:"width-show"},Q={class:"width-show"},X={class:"width-show"},Y={class:"width-showed"},Z={class:"width-word"},ee={class:"width-showed"},le={key:0,class:"check-options"},te={class:"btn-operate"};var ie=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:ie}){const se=e,de={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ae=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],oe=l(null);function ce(){const e=se.fields?JSON.parse(JSON.stringify(se.fields)):[];return Object.keys(de).forEach((l=>{e.forEach((e=>{"old"==se.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[de[l]]=1==e[l]:e[de[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),e}const ne=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),he=e=>ne.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),re=()=>{if("old"==se.type){let e=[];return ne.fields.length>0&&ne.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,...se.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ne.fields},ue=()=>{ie("onSave",{tableFields:re()})},pe=()=>{ie("onClose")};function fe(){ne.fields=ce(),ie("reset")}const we=e=>!!ne.fields.length&&ne.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ye(l,e))||l[e])),ke=(e,l)=>{const t=e,i=ne.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ye(e,l)&&(e[l]=t),e)));ne.fields=i};function ye(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]}return i((()=>se.fields),(e=>{(null==e?void 0:e.length)>0&&(ne.fields=ce())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=oe.value)||e.style.setProperty("margin","auto"),se.isEdit&&(ne.widthShow="8%",ne.widthLarge="13%")})),O({getTableFields:re}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:oe,class:"c-field-set",style:o({"--width-show":ne.widthShow,"--width-large":ne.widthLarge})},[c(n(g),{show:ne.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",q,[r("div",C,[r("div",{class:u(["setting-title",{"seting-title-api":!ne.isCustomSearch}])},[N,p(" 字段名称 "),P,p(" 显示 "),r("span",j,[he("show")?(d(),f(n(m),{key:0,checked:we("show"),"onUpdate:checked":t[0]||(t[0]=e=>ke(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",R,[he("editable")?(d(),f(n(m),{key:0,checked:we("editable"),"onUpdate:checked":t[1]||(t[1]=e=>ke(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",I,[he("required")?(d(),f(n(m),{key:0,checked:we("required"),"onUpdate:checked":t[2]||(t[2]=e=>ke(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",L,[he("sort")?(d(),f(n(m),{key:0,checked:we("sort"),"onUpdate:checked":t[3]||(t[3]=e=>ke(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",T,[c(n(m),{checked:we("bold"),"onUpdate:checked":t[4]||(t[4]=e=>ke(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 固定 "),D,p(" 自定义标题 "),z,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ne.isCustomSearch}])},[c(n(F),{list:ne.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ne.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ne.clickItem=t);var t}},[r("span",H,[c(n(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,k(l.title),1)],2),p(" 显示 "),r("span",A,[y(c(n(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[v,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",K,[y(c(n(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[v,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",M,[y(c(n(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[v,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",Q,[y(c(n(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[v,"0001"!=l.id]])]),p(" 加粗 "),r("span",X,[y(c(n(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[v,"0001"!=l.id]])]),p(" 固定 "),r("span",Y,[c(n(x),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ae,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",Z,[y(c(n(S),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[v,"0001"!=l.id]])]),p(" 列宽 "),r("span",ee,[c(n(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,style:{width:"120px"},clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),se.footerFlag?(d(),a("div",le,[r("div",te,[b(l.$slots,"footer",{},(()=>[c(n(_),{onPositiveClick:fe},{trigger:h((()=>[c(n(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),c(n(W),{style:{"margin-right":"8px"},onClick:pe},{default:h((()=>[w("取消")])),_:1}),c(n(W),{type:"primary",onClick:ue},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{ie as default};
1
+ import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as n,unref as c,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as v,withDirectives as k,vShow as y,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as S,NInput as x,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import C from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const F={class:"fields-set-content"},q={class:"fields-table"},D=r("span",{class:"width-show",style:{width:"4%"}},null,-1),N=r("span",{class:"width-large"},"所有字段",-1),P={class:"width-show"},j={key:0,class:"width-show"},R={key:1,class:"width-show"},I={class:"width-show"},L={class:"width-show"},T=r("span",{class:"width-showed"},"默认排序",-1),z=r("span",{class:"width-showed"},"固定",-1),A=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),K={class:"width-show"},M={key:0,class:"width-show"},Q={key:1,class:"width-show"},X={class:"width-show"},Y={class:"width-show"},Z={class:"width-showed"},ee={class:"width-showed"},le={class:"width-word"},te={class:"width-showed"},ie={key:0,class:"check-options"},se={class:"btn-operate"};var de=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:de}){const ae=e,oe={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ne=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],ce=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],he=l(null);function re(){const e=ae.fields?JSON.parse(JSON.stringify(ae.fields)):[];return Object.keys(oe).forEach((l=>{e.forEach((e=>{"old"==ae.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[oe[l]]=1==e[l]:e[oe[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),e}const ue=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),pe=e=>ue.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),fe=()=>{if("old"==ae.type){let e=[];return ue.fields.length>0&&ue.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,sortDirection:l.sortDirection,...ae.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ue.fields},we=()=>{de("onSave",{tableFields:fe()})},ve=()=>{de("onClose")};function ke(){ue.fields=re(),de("reset")}const ye=e=>!!ue.fields.length&&ue.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ge(l,e))||l[e])),be=(e,l)=>{const t=e,i=ue.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ge(e,l)&&(e[l]=t),e)));ue.fields=i};function ge(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]||["sort"].includes(l)&&1==e.notParticipatingSort}return i((()=>ae.fields),(e=>{(null==e?void 0:e.length)>0&&(ue.fields=re())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=he.value)||e.style.setProperty("margin","auto"),ae.isEdit&&(ue.widthShow="8%",ue.widthLarge="13%")})),O({getTableFields:fe}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:he,class:"c-field-set",style:o({"--width-show":ue.widthShow,"--width-large":ue.widthLarge})},[n(c(g),{show:ue.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",F,[r("div",q,[r("div",{class:u(["setting-title",{"seting-title-api":!ue.isCustomSearch}])},[D,p(" 字段名称 "),N,p(" 显示 "),r("span",P,[pe("show")?(d(),f(c(m),{key:0,checked:ye("show"),"onUpdate:checked":t[0]||(t[0]=e=>be(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",j,[pe("editable")?(d(),f(c(m),{key:0,checked:ye("editable"),"onUpdate:checked":t[1]||(t[1]=e=>be(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",R,[pe("required")?(d(),f(c(m),{key:0,checked:ye("required"),"onUpdate:checked":t[2]||(t[2]=e=>be(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",I,[pe("sort")?(d(),f(c(m),{key:0,checked:ye("sort"),"onUpdate:checked":t[3]||(t[3]=e=>be(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",L,[n(c(m),{checked:ye("bold"),"onUpdate:checked":t[4]||(t[4]=e=>be(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 默认排序 "),T,p(" 固定 "),z,p(" 自定义标题 "),A,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ue.isCustomSearch}])},[n(c(C),{list:ue.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ue.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ue.clickItem=t);var t}},[r("span",H,[n(c(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,v(l.title),1)],2),p(" 显示 "),r("span",K,[k(n(c(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",M,[k(n(c(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",Q,[k(n(c(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",X,[k(n(c(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[y,"0001"!=l.id]])]),p(" 加粗 "),r("span",Y,[k(n(c(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 默认排序 "),r("span",Z,[k(n(c(S),{value:l.sortDirection,"onUpdate:value":e=>l.sortDirection=e,options:ce,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 固定 "),r("span",ee,[n(c(S),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ne,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",le,[k(n(c(x),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 列宽 "),r("span",te,[n(c(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),ae.footerFlag?(d(),a("div",ie,[r("div",se,[b(l.$slots,"footer",{},(()=>[n(c(_),{onPositiveClick:ke},{trigger:h((()=>[n(c(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),n(c(W),{style:{"margin-right":"8px"},onClick:ve},{default:h((()=>[w("取消")])),_:1}),n(c(W),{type:"primary",onClick:we},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{de as default};
@@ -1 +1 @@
1
- .c-field-set{height:100%;position:relative}.c-field-set ul{margin:0;padding:0}.c-field-set .fields-set-content{display:flex;flex-direction:column;height:100%;overflow:hidden}.c-field-set .fields-set-content .fields-table{display:flex;flex:1;flex-direction:column;overflow:auto}.c-field-set .n-spin-container{height:100%;width:100%}.c-field-set .n-spin-content{height:100%}.c-field-set .setting-title{background:#f2f2f4;border:1px solid #f2f2f2;height:52px;line-height:52px}.c-field-set .setting-title span{display:inline-block}.c-field-set .setting-title.seting-title-api .width-large{width:15%}.c-field-set .set-show{min-height:100px;overflow-y:auto}.c-field-set .set-show.set-show-api .width-large{width:15%}.c-field-set .set-show .left-style.sortable-chosen{background:#fafafa;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .set-show li{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:52px;line-height:52px;padding:5px 0}.c-field-set .set-show .is-sort-style{border:1px solid #d5d5d5;border-radius:4px;color:#38454f;height:32px;margin-right:5px;outline:none;text-indent:6px;width:87px}.c-field-set .set-show .is-sort-style:disabled{background:#f5f5f5;cursor:not-allowed}.c-field-set .set-show .col-width-style{width:70px}.c-field-set .set-show .title-item{align-items:center;display:inline-flex;justify-content:flex-start;text-align:left}.c-field-set .set-show .title-item>span{display:inline-block;max-width:calc(100% - 20px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-field-set .alias-style{border:1px solid #d4dee5;border-radius:4px;color:#38454f;height:32px;outline:none;text-indent:16px}.c-field-set .btn-operate{border-top:1px solid #d5d5d5;padding:12px 0}.c-field-set .width-show{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-show)}.c-field-set .drag-icon-wrap{cursor:pointer;text-align:center;width:5%!important}.c-field-set .width-showed{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:15%}.c-field-set .width-showed select{width:90%!important}.c-field-set .width-word{display:inline-block;line-height:52px;overflow:hidden;white-space:nowrap;width:var(--width-large)}.c-field-set .width-word input{width:90%!important}.c-field-set .width-large{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-large)}
1
+ .c-field-set{height:100%;position:relative}.c-field-set ul{margin:0;padding:0}.c-field-set .fields-set-content{display:flex;flex-direction:column;height:100%;overflow:hidden}.c-field-set .fields-set-content .fields-table{display:flex;flex:1;flex-direction:column;overflow:auto}.c-field-set .n-spin-container{height:100%;width:100%}.c-field-set .n-spin-content{height:100%}.c-field-set .setting-title{background:#f2f2f4;border:1px solid #f2f2f2;height:52px;line-height:52px}.c-field-set .setting-title span{display:inline-block}.c-field-set .setting-title.seting-title-api .width-large{width:15%}.c-field-set .set-show{min-height:100px;overflow-y:auto}.c-field-set .set-show.set-show-api .width-large{width:15%}.c-field-set .set-show .left-style.sortable-chosen{background:#fafafa;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .set-show li{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:52px;line-height:52px;padding:5px 0}.c-field-set .set-show .is-sort-style{border:1px solid #d5d5d5;border-radius:4px;color:#38454f;height:32px;margin-right:5px;outline:none;text-indent:6px;width:87px}.c-field-set .set-show .is-sort-style:disabled{background:#f5f5f5;cursor:not-allowed}.c-field-set .set-show .col-width-style{width:70px}.c-field-set .set-show .title-item{align-items:center;display:inline-flex;justify-content:flex-start;text-align:left}.c-field-set .set-show .title-item>span{display:inline-block;max-width:calc(100% - 20px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-field-set .alias-style{border:1px solid #d4dee5;border-radius:4px;color:#38454f;height:32px;outline:none;text-indent:16px}.c-field-set .btn-operate{border-top:1px solid #d5d5d5;padding:12px 0}.c-field-set .width-show{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-show)}.c-field-set .drag-icon-wrap{cursor:pointer;text-align:center;width:5%!important}.c-field-set .width-showed{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-field-set .width-showed select{width:90%!important}.c-field-set span.width-showed{width:10%}.c-field-set .width-word{display:inline-block;line-height:52px;overflow:hidden;white-space:nowrap;width:var(--width-large)}.c-field-set .width-word input{width:90%!important}.c-field-set .width-large{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:var(--width-large)}