cnhis-design-vue 3.1.47-beta.17 → 3.1.47-beta.19

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 (35) hide show
  1. package/README.md +87 -87
  2. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  3. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  4. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  5. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  6. package/es/components/button-print/src/utils/print.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  9. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  10. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  11. package/es/components/index.css +1 -1
  12. package/es/components/info-header/src/InfoHeader.vue2.js +1 -1
  13. package/es/components/info-header/style/index.css +1 -1
  14. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  15. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  16. package/es/components/select-person/src/SearchMultiple.vue.d.ts +0 -6
  17. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +3 -0
  18. package/es/env.d.ts +25 -25
  19. package/es/shared/assets/img/failure.png.js +1 -1
  20. package/es/shared/assets/img/no-permission.png.js +1 -1
  21. package/es/shared/assets/img/nodata.png.js +1 -1
  22. package/es/shared/assets/img/notfound.png.js +1 -1
  23. package/es/shared/assets/img/qr.png.js +1 -1
  24. package/es/shared/assets/img/success.png.js +1 -1
  25. package/es/shared/assets/img/video.png.js +1 -1
  26. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  27. package/es/shared/assets/img/xb_big.png.js +1 -1
  28. package/es/shared/assets/img/xb_small.png.js +1 -1
  29. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  30. package/es/shared/package.json.js +1 -1
  31. package/es/shared/utils/fabricjs/index.d.ts +6823 -0
  32. package/es/shared/utils/tapable/index.d.ts +139 -0
  33. package/es/shared/utils/tapableLess.d.ts +28 -0
  34. package/es/shared/utils/tapableLess.js +1 -0
  35. package/package.json +2 -2
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -0,0 +1 @@
1
+ declare module 'bpmn-js/lib/Viewer';
@@ -0,0 +1 @@
1
+ declare module 'bpmn-js/lib/features/modeling';
@@ -0,0 +1 @@
1
+ declare module 'diagram-js/lib/navigation/movecanvas';
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as n,useBrowserPrint as a,isIReport as r}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as d}from"date-fns";const h=t.create({timeout:1e3,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,c=`${m}/fdp-api/print/assembly/printIReport`,u=`${m}/bi-api/reprot/print/open/client/getRemote`,p=`${m}/printService/file`;let f=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],f)return f;f=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:n}=e;try{s(i.res||"")}catch(t){n(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{h({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const s={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(s),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,n){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},r=await this._queryServicesPrint(a);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:s,print:n,printdlgshow:a="0",nobillnode:r="1",btnprint:o="1",messageTimeout:l=0}){const h={templateId:t,formatId:e,params:i,cmdid:s,nobillnode:r,printdlgshow:a,btnprint:o,messageTimeout:l};if(n){try{n=JSON.parse(n)}catch(t){}h.print=n}else if(this.isRemote){const t=d(new Date,"yyyyMMddHHmmss");h.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(h)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:n=0}){const a={};let r={};try{r=Object.assign({},a,JSON.parse(i))}catch(t){r=a}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(r),messageTimeout:n};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({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,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),r=s[s.length-2],o=s[s.length-1],l=await n(`${p}/${r}/${o}`),d=a(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:s,messageTimeout:n=0},l,d){if(r(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==d?void 0:d("获取文件失败!");const s=a(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,s),void(null==l||l({file:t}))}await this._queryProxyOrigin();const h=await this._testConnection();if(!this._handleResultTest(h,d))return!1;try{const a=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:s,messageTimeout:n}),r=this._handleResult(a,d);if(!r)return!1;if(this.isRemote){const t=await this._browserPrint(r,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==l||l(r)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==d||d(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:s,printdlgshow:n,nobillnode:o,isDownloadFile:l=!0,messageTimeout:d=0},h,m,c="printDirect"){if(r(e)){const t=await this._queryPrintFile(e,i);return t?(a(t,c),void(null==h||h({file:t}))):null==m?void 0:m("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,m))return!1;try{const a=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:s,printdlgshow:n,nobillnode:o,messageTimeout:d}),r=this._handleResult(a,m);if(!r)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(r,c),null==h||h(r)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==m||m(i),this._handleMonitorNotify(i)}}_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,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=d(new Date,"yyyy-MM-dd"),i=l(),s=d(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}this.printDirect(t,(async n=>{if(n||s(null),r(t.formatId))return i(n);const a=this,o=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await a._downloadPDF("");if(1===s.length)return await a._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await a._downloadPDF(s[t]||""));return i}(n.filedir);i(o,n)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,a){const r=await this._testConnection();if(!this._handleResultTest(r,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},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;n&&n(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,a){const r=await this._testConnection();if(!this._handleResultTest(r,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,a);return!!o&&(n&&n(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const r=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(r,n);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n=0},a,r){const o=await this._testConnection();if(!this._handleResultTest(o,r))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n}),d=this._handleResult(l,r);if(!d)return!1;a&&a(d)}async addPrintFormat({templateId:t,params:e,token:i},s,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const r=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(r,n);if(!o)return!1;s&&s(o)}}export{w as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as n,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as d}from"date-fns";const h=t.create({timeout:1e3,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,c=`${m}/fdp-api/print/assembly/printIReport`,u=`${m}/bi-api/reprot/print/open/client/getRemote`,p=`${m}/printService/file`;let w=null;class f{constructor(){var t,e,n;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],w)return w;w=this;const r=window;this.CMonitor=r.$CMonitor;try{this.webview=r.top?null==(t=r.top.chrome)?void 0:t.webview:null==(e=r.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(n=r.chrome)?void 0:n.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"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:n}=e;try{s(i.res||"")}catch(t){n(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{h({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const s={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(s),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,n){const r={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(r);return this._handleQueryPrintDataResult(a,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:s,print:n,printdlgshow:r="0",nobillnode:a="1",btnprint:o="1",messageTimeout:l=0}){const h={templateId:t,formatId:e,params:i,cmdid:s,nobillnode:a,printdlgshow:r,btnprint:o,messageTimeout:l};if(n){try{n=JSON.parse(n)}catch(t){}h.print=n}else if(this.isRemote){const t=d(new Date,"yyyyMMddHHmmss");h.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(h)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:n=0}){const r={};let a={};try{a=Object.assign({},r,JSON.parse(i))}catch(t){a=r}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:n};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({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,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await n(`${p}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:s,messageTimeout:n=0},l,d){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==d?void 0:d("获取文件失败!");const s=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,s),void(null==l||l({file:t}))}await this._queryProxyOrigin();const h=await this._testConnection();if(!this._handleResultTest(h,d))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:s,messageTimeout:n}),a=this._handleResult(r,d);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==l||l(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==d||d(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:s,printdlgshow:n,nobillnode:o,isDownloadFile:l=!0,messageTimeout:d=0},h,m,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==h||h({file:t}))):null==m?void 0:m("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,m))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:s,printdlgshow:n,nobillnode:o,messageTimeout:d}),a=this._handleResult(r,m);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==h||h(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==m||m(i),this._handleMonitorNotify(i)}}_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,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=d(new Date,"yyyy-MM-dd"),i=l(),s=d(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}this.printDirect(t,(async n=>{if(n||s(null),a(t.formatId))return i(n);const r=this,o=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(n.filedir);i(o,n)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,r);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,r);if(!l)return!1;n&&n(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,r);return!!o&&(n&&n(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,n);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n=0},r,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n}),d=this._handleResult(l,a);if(!d)return!1;r&&r(d)}async addPrintFormat({templateId:t,params:e,token:i},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,n);if(!o)return!1;s&&s(o)}}export{f as Print};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,drawTextAndIconGroup as i,drawText as o,defaultTextStyle as l,defaultStyle as n}from"../useDraw.js";import"date-fns";import{getScaleNumberList as r}from"../../utils/index.js";import"@vueuse/core";import{drawScaleNumber as s}from"../useScaleColumn.js";import"vue";import"lodash-es";import"../temperature/useShadow.js";function a(a,u,c){const{originY:d,endY:h,borderStyle:p,left:f,itemList:m,scaleValues:v,originX:g,endX:w,yCellHeight:j,canvasWidth:y,canvasHeight:S}=u;!function(){if(!f)return;const{title:t,titleWidth:i,titleStyle:o}=f,l=e({width:i,height:h-d,...p},{value:t.split("").join("\n"),...o||{}},{left:0,top:d},!0);a.value.add(l)}(),v.forEach(((e,i)=>{var u,c;const d="left"===e.layout?g-5:w+5,{range:p,spaceValue:m,title:v,unit:S,titleStyle:b,spaceGridNumber:x=1,showNumber:N,showMaxMinNumber:W}=e,k=[],C=r(p,m),E=C.length;C.forEach(((t,i)=>{const o=0===i?h-5:h-i*j*x;!N||(0===i||i===E-1)&&!W||k.push(s(String(t),{...e,position:e.layout},d,o))}));const X=v&&o(["left"===e.layout?f.width/2:w+(y-w)/2,(null!=(c=null==(u=k.at(-1))?void 0:u.top)?c:330)-j],{value:`${v}${S?"\n"+S:""}`,...l,...b}),Y=new t.Group([...k,...X?[X]:[]],{objectCaching:!1,...n});a.value.add(Y),Y.sendToBack()})),function(){const t=JSON.parse(JSON.stringify(m));let e=h;const o=f.titleWidth+15;t.reverse().forEach((t=>{e-=10;const l=t.title,{text:n,icon:r}=i(l,t,{text:{left:o,top:e},icon:{leftX:o,topY:e}});e-=n.height||30,a.value.add(n,r)}))}(),a.value.add(new t.Rect({left:0,top:0,width:y-p.strokeWidth,height:S-p.strokeWidth,fill:"transparent",...p}))}export{a as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as l,defaultTextStyle as n,defaultStyle as r}from"../useDraw.js";import"date-fns";import{getScaleNumberList as a}from"../../utils/index.js";import"@vueuse/core";import{drawScaleNumber as s}from"../useScaleColumn.js";import"vue";import"lodash-es";import"../temperature/useShadow.js";function u(u,d,h){const{originY:c,endY:p,borderStyle:f,left:m,itemList:g,scaleValues:v,originX:w,endX:j,yCellHeight:y,markHeight:S,canvasWidth:W,canvasHeight:b}=d;!function(){if(!m)return;const{title:t,titleWidth:i,titleStyle:o}=m,l=e({width:i,height:p-c+S,...f},{value:t.split("").join("\n"),...o||{}},{left:0,top:c},!0);u.value.add(l)}(),v.forEach(((e,i)=>{var o,d;const h="left"===e.layout?w-5:j+5,{range:c,spaceValue:f,title:g,unit:v,titleStyle:S,spaceGridNumber:b=1,showNumber:x,showMaxMinNumber:N}=e,k=[],X=a(c,f),Y=X.length;X.forEach(((t,i)=>{const o=0===i?p-5:p-i*y*b;!x||(0===i||i===Y-1)&&!N||k.push(s(String(t),{...e,position:e.layout},h,o))}));const C=g&&l(["left"===e.layout?m.width/2:j+(W-j)/2,(null!=(d=null==(o=k.at(-1))?void 0:o.top)?d:330)-y],{value:`${g}${v?"\n"+v:""}`,...n,...S}),E=new t.Group([...k,...C?[C]:[]],{objectCaching:!1,...r});u.value.add(E),E.sendToBack()})),function(){const e=new t.Rect({width:w-m.titleWidth,height:p-c+S,left:m.titleWidth,top:c,...i,originX:"left",originY:"top",...f});u.value.add(e);const l=JSON.parse(JSON.stringify(g));let n=p;const r=m.titleWidth+15;l.reverse().forEach((t=>{n-=10;const e=t.title,{text:i,icon:l}=o(e,t,{text:{left:r,top:n},icon:{leftX:r,topY:n}});n-=i.height||30,u.value.add(i,l)}))}(),u.value.add(new t.Rect({left:0,top:0,width:W-f.strokeWidth,height:b-f.strokeWidth,fill:"transparent",...f}))}export{u as useLeft};
@@ -1 +1 @@
1
- import{ref as t,reactive as e,computed as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as s}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as o}from"date-fns";import{getChildrenSize as n}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as u,range as d}from"lodash-es";import"../temperature/useShadow.js";import{useTop as p}from"./useTop.js";import{useLeft as m}from"./useLeft.js";import{useCenter as c}from"./useCenter.js";import{useOther as h}from"./useOther.js";function v(v,f,g,y){const x=t(),w=t(),b=t(),C=e({show:!1,point:{x:0,y:0},list:[]}),Y=e({show:!1,point:{x:0,y:0},list:[],target:null}),j=a((()=>{var t;return null!=(t=f.data.left.width)?t:0})),H=a((()=>n(f.data.top.treeData))),T=a((()=>{const{xAxis:t}=f.data;return"top"===t.position?t.height:0})),V=function(){const t=u(f.data.top.treeData);let e=0;const{cellWidth:a,cellHeight:r}=f.data.top.tree;return function t(i,l=0){i.forEach((i=>{var s;const o={top:e*r+T.value,left:l*a,width:a,height:r};if(e++,null==(s=i.children)?void 0:s.length){e--;const a=n(i.children);o.height=a*r,t(i.children,l+1)}else o.width=j.value-o.left;Object.assign(i,o)}))}(t),t}();const D=a((()=>{const{grid:t}=f.data;return t.mainXCell*t.subXCell})),M=a((()=>f.data.top.tree.cellHeight)),X=a((()=>T.value+M.value*H.value)),A=a((()=>{const t=u(f.data.xAxis),{position:e,spaceValue:a,spaceTimeStamp:r}=t,i=d(D.value/a+1).map((e=>0===e?t.startTime:o(new Date(W.value+e*a*r),"yyyy-MM-dd HH:mm:ss")));return{...t,list:i,left:j.value,top:"top"===e?0:X.value}})),S=a((()=>{const{grid:t}=f.data;return t.mainYCell*t.subYCell})),G=a((()=>{var t;const{width:e,right:a}=f.data;if(!a)return e;return e-(null!=(t=a.width)?t:0)})),L=a((()=>f.data.xAxis.height+M.value*H.value)),N=a((()=>{var t;const{bottom:e=null,height:a}=f.data;if(!e)return a;return a-(null!=(t=e.height)?t:0)})),O=a((()=>(G.value-j.value)/D.value)),P=a((()=>(N.value-L.value)/S.value)),W=a((()=>{var t;return Date.parse((null==(t=f.data.xAxis)?void 0:t.startTime)||o(new Date,"yyyy-MM-dd HH:mm:ss"))})),E=a((()=>A.value.spaceTimeStamp/O.value)),I=a((()=>{const{scaleValues:t}=f.data;return t.map((t=>t.dataList.filter((t=>t.show)).map(((e,a)=>({...e,bigType:t.type,unit:t.unit,dataIndex:a}))))).flat()})),k=a((()=>{const{scaleValues:t}=f.data,e=t.find((t=>"pulse"===t.type));return((null==e?void 0:e.spaceValue)||20)/P.value})),q=a((()=>{const{scaleValues:t}=f.data,e=t.find((t=>"temperature"===t.type));return((null==e?void 0:e.spaceValue)||2)/P.value})),z=a((()=>{var t;return(null==(t=f.data.grid)?void 0:t.event)||{selectable:!0,evented:!0,hovered:!0}})),B=e({canvasWidth:f.data.width,canvasHeight:f.data.height,borderStyle:{...s,...f.data.borderStyle||{}},grid:f.data.grid,top:f.data.top,left:f.data.left,other:f.data.other,topGridYNumber:r(H),topGridYCellHeight:r(M),topGridOriginY:r(T),topGridEndY:r(X),treeData:V,xAxis:r(A),startTime:r(W),timeXCell:r(E),gridXNumber:r(D),gridYNumber:r(S),xCellWidth:r(O),yCellHeight:r(P),originX:r(j),endX:r(G),originY:r(L),endY:r(N),itemList:r(I),scaleValues:f.data.scaleValues,pulseYCell:r(k),temperatureYCell:r(q),event:r(z)});return i((async()=>{await l(),p(v,B),m(v,B),h(v,B),c(v,B)})),{propItems:B,redrawPoints:w,select:x,pointTipProps:C,pointMenuProps:Y,clickMenu:b}}export{v as useSurgicalAnesthesiaChart};
1
+ import{ref as e,reactive as t,computed as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as n}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as o,range as d}from"lodash-es";import"../temperature/useShadow.js";import{useTop as p}from"./useTop.js";import{useLeft as c}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as m}from"./useOther.js";function v(v,f,g,y){const x=e(),w=e(),b=e(),Y=t({show:!1,point:{x:0,y:0},list:[]}),j=t({show:!1,point:{x:0,y:0},list:[],target:null}),C=a((()=>f.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),H=a((()=>{var e;return null!=(e=f.data.left.width)?e:0})),T=a((()=>{const{grid:e}=f.data;return e.mainXCell*e.subXCell})),V=a((()=>{const{grid:e}=f.data;return e.mainYCell*e.subYCell})),A=a((()=>s(f.data.top.treeData))),D=a((()=>f.data.top.tree.cellHeight)),X=a((()=>D.value*A.value)),M=a((()=>Z(R("drug")||"top"))),S=a((()=>M.value+X.value)),G=a((()=>{var e;return Date.parse((null==(e=f.data.xAxis)?void 0:e.startTime)||n(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=a((()=>{const e=o(f.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=d(T.value/t+1).map((r=>0===r?e.startTime:n(new Date(G.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:H.value}})),k=function(){const e=o(f.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=f.data.top.tree;return function e(i,l=0){i.forEach((i=>{var u;const n={top:t*r+M.value,left:l*a,width:a,height:r};if(t++,null==(u=i.children)?void 0:u.length){t--;const a=s(i.children);n.height=a*r,e(i.children,l+1)}else n.width=H.value-n.left;Object.assign(i,n)}))}(e),e}(),L=a((()=>Z(R("xAxis")||"center"))),N=a((()=>{var e;const{width:t,right:a}=f.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),P=a((()=>Z(R("intraoperatively")||"bottom"))),W=a((()=>{var e;const{show:t=!0,height:a}=(null==(e=f.data.other)?void 0:e.mark)||{};return t&&a?a:0})),E=a((()=>P.value+(f.data.height-X.value-O.value.height-W.value))),I=a((()=>(N.value-H.value)/T.value)),q=a((()=>(E.value-P.value)/V.value)),z=a((()=>O.value.spaceTimeStamp/I.value)),B=a((()=>{const{scaleValues:e}=f.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),F=a((()=>{const{scaleValues:e}=f.data,t=e.find((e=>"pulse"===e.type));return((null==t?void 0:t.spaceValue)||20)/q.value})),J=a((()=>{const{scaleValues:e}=f.data,t=e.find((e=>"temperature"===e.type));return((null==t?void 0:t.spaceValue)||2)/q.value})),K=a((()=>{var e;return(null==(e=f.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=t({canvasWidth:f.data.width,canvasHeight:f.data.height,borderStyle:{...u,...f.data.borderStyle||{}},grid:f.data.grid,top:f.data.top,left:f.data.left,other:f.data.other,topGridYNumber:r(A),topGridYCellHeight:r(D),topGridOriginY:r(M),topGridEndY:r(S),treeData:k,xAxis:r(O),originYXAxis:r(L),startTime:r(G),timeXCell:r(z),gridXNumber:r(T),gridYNumber:r(V),xCellWidth:r(I),yCellHeight:r(q),originX:r(H),endX:r(N),originY:r(P),endY:r(E),markHeight:r(W),itemList:r(B),scaleValues:f.data.scaleValues,pulseYCell:r(F),temperatureYCell:r(J),event:r(K)});function R(e){let t="";return Object.entries(C.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function U(e){const t=C.value[e],a=O.value.height;switch(t){case"drug":return X.value;case"xAxis":return a;default:return f.data.height-X.value-a}}function Z(e){switch(e){case"top":return 0;case"center":return U("top");default:return U("top")+U("center")}}return i((async()=>{await l(),p(v,Q),c(v,Q),m(v,Q),h(v,Q)})),{propItems:Q,redrawPoints:w,select:x,pointTipProps:Y,pointMenuProps:j,clickMenu:b}}export{v as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,drawTextGroup as n,drawLine as o,drawPoint as l}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";function f(f,c,a){const{cumputedX:u}=s(c),{grid:d,originX:p,endX:L,xCellWidth:m,gridXNumber:x,top:h,topList:g,canvasWidth:v,borderStyle:X,treeData:C,xAxis:y,topGridYNumber:w,topGridOriginY:S,topGridYCellHeight:Y,topGridEndY:b}=c,j=new Set;function G(t,i,n){let o;const{content:l}=t.value||{};if(l){const{lineStyle:t,textStyle:r,totalStyle:s}=h.data||{},{startLine:f,centerLine:c,endLine:a}=i;o=e([0,0],{...r,value:l,backgroundColor:"#fff"});const u=I(o,i,n);o&&(o.set(u),f&&(f.text=o),a&&(a.text=o))}return o}function I(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function k(e,{isCustomIcon:i,isContinue:n,isLeft:r}){const{x:s,y1:f,y2:c,halfY:a}=e;if(!s||s<p||s>L)return;const{lineStyle:u}=h.data||{};let d;const x={left:s,top:a};d=i?l("circle",{fill:u.stroke,...x}):n?l(">",{fill:u.stroke,...x,fontSize:18}):o([s,f,s,a],u);const g=new t.Rect({width:m,height:Y,fill:"transparent",left:s-m/2,top:f}),v=new t.Group([d,g],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});var X;return v.isLeft=r,v.isCustomIcon=i,(X=v).on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1),t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(X),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=I(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(X)})),X.on("mouseup",(t=>{1===t.button&&function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(X)})),v}r(f,{...c,gridYNumber:w,originY:S,yCellHeight:Y,endY:b}),function(){const{height:n,list:o,left:l,top:r,spaceValue:s}=y,c=[],a=r+n/2;o.forEach(((t,i)=>{const n=l+i*m*s;c.push(e([n,a],{value:t.slice(11,16)}))}));const u=c.length>0?new t.Group([...c],{...i,objectCaching:!1}):null;u&&f.value.add(u)}(),function(){var e;const l=(null==(e=null==h?void 0:h.tree)?void 0:e.textStyle)||{},r=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:f,left:c,top:a,title:d=""}=e,m={value:d,...l};(null==(i=e.children)?void 0:i.length)?(m.value=d.split("").join("\n"),t(e.children)):(m.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=h.data||{},l=t.top,r=l+Y,s=r-Y/2,f={y1:l,y2:r,halfY:s},c=[];t.data.forEach(((t,i,n)=>{const{time:l,continue:r,value:a}=t,[d,m]=l,x=d&&u(d),h=m&&u(m),g=k({...f,x:x},{isCustomIcon:!h&&!r,isContinue:!1,isLeft:!0}),v=k({...f,x:h},{isCustomIcon:!1,isContinue:!!r});let X,C,y;if((g||x<p)&&(v||h>L)){X=o([g?x:p,s,v?h:L,s],e)}c.push({startLine:g,centerLine:X,endLine:v}),function(t,e){const{startLine:i,centerLine:n,endLine:o}=e[t],{startLine:l,endLine:r}=e[t-1]||{};if(i){const t={x1:p,x2:o?o.left:L};r?(t.x1=r.left,r.limitX.x2=i.left,i.prevLine=r,r.nextLine=i):l&&(t.x1=l.left,l.limitX.x2=i.left,i.prevLine=l,l.nextLine=i),i.limitX=t,n&&(i.centerLine=n)}if(o){const t={x1:i?i.left:p,x2:L};o.limitX=t,n&&(o.centerLine=n)}i&&o&&(i.nearLine=o,o.nearLine=i)}(i,c),n[i-1]&&(C=G(n[i-1],c[i-1],s)),i===n.length-1&&(y=G(t,c[i],s)),X&&j.add(X),g&&j.add(g),v&&j.add(v),C&&j.add(C),y&&j.add(y)}))}(e)),r.push(n({width:s,height:f,...X},m,{left:c,top:a},!0))}))}(C);const s=r.length>0?new t.Group([...r],{...i,objectCaching:!1}):null;s&&f.value.add(s),j.size&&f.value.add(...j)}()}export{f as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as f}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";function c(c,a,u){const{cumputedX:d}=f(a),{originX:p,endX:h,xCellWidth:L,originYXAxis:x,top:m,topList:g,canvasWidth:v,borderStyle:X,treeData:C,xAxis:w,topGridYNumber:y,topGridOriginY:Y,topGridYCellHeight:S,topGridEndY:j}=a,b=new Set;function G(t,i,n){let o;const{content:l}=t.value||{};if(l){const{lineStyle:t,textStyle:r,totalStyle:s}=m.data||{},{startLine:f,centerLine:c,endLine:a}=i;o=e([0,0],{...r,value:l,backgroundColor:"#fff"});const u=I(o,i,n);o&&(o.set(u),f&&(f.text=o),a&&(a.text=o))}return o}function I(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function A(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:f,y2:c,halfY:a}=e;if(!s||s<p||s>h)return;const{lineStyle:u}=m.data||{};let d;const x={left:s,top:a};d=i?r("circle",{fill:u.stroke,...x}):n?r(">",{fill:u.stroke,...x,fontSize:18}):l([s,f,s,a],u);const g=new t.Rect({width:L,height:S,fill:"transparent",left:s-L/2,top:f}),v=new t.Group([d,g],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});var X;return v.isLeft=o,v.isCustomIcon=i,(X=v).on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1),t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(X),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=I(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(X)})),X.on("mouseup",(t=>{1===t.button&&function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(X)})),v}s(c,{...a,gridYNumber:y,originY:Y,yCellHeight:S,endY:j}),function(){const{height:o,list:l,left:r,spaceValue:s}=w;if(!o)return;const f=[],a=x+o/2;l.forEach(((t,i)=>{const n=r+i*L*s;f.push(e([n,a],{value:t.slice(11,16)}))}));const u=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;u&&c.value.add(u);const d=new t.Rect({width:v,height:o,left:0,top:x,...n,originX:"left",originY:"top",...X});c.value.add(d)}(),function(){var e;const n=(null==(e=null==m?void 0:m.tree)?void 0:e.textStyle)||{},r=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:f,left:c,top:a,title:u=""}=e,L={value:u,...n};(null==(i=e.children)?void 0:i.length)?(L.value=u.split("").join("\n"),t(e.children)):(L.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=m.data||{},o=t.top,r=o+S,s=r-S/2,f={y1:o,y2:r,halfY:s},c=[];t.data.forEach(((t,i,n)=>{const{time:o,continue:r,value:a}=t,[u,L]=o,x=u&&d(u),m=L&&d(L),g=A({...f,x:x},{isCustomIcon:!m&&!r,isContinue:!1,isLeft:!0}),v=A({...f,x:m},{isCustomIcon:!1,isContinue:!!r});let X,C,w;if((g||x<p)&&(v||m>h)){X=l([g?x:p,s,v?m:h,s],e)}c.push({startLine:g,centerLine:X,endLine:v}),function(t,e){const{startLine:i,centerLine:n,endLine:o}=e[t],{startLine:l,endLine:r}=e[t-1]||{};if(i){const t={x1:p,x2:o?o.left:h};r?(t.x1=r.left,r.limitX.x2=i.left,i.prevLine=r,r.nextLine=i):l&&(t.x1=l.left,l.limitX.x2=i.left,i.prevLine=l,l.nextLine=i),i.limitX=t,n&&(i.centerLine=n)}if(o){const t={x1:i?i.left:p,x2:h};o.limitX=t,n&&(o.centerLine=n)}i&&o&&(i.nearLine=o,o.nearLine=i)}(i,c),n[i-1]&&(C=G(n[i-1],c[i-1],s)),i===n.length-1&&(w=G(t,c[i],s)),X&&b.add(X),g&&b.add(g),v&&b.add(v),C&&b.add(C),w&&b.add(w)}))}(e)),r.push(o({width:s,height:f,...X},L,{left:c,top:a},!0))}))}(C);const s=r.length>0?new t.Group([...r],{...i,objectCaching:!1}):null;s&&c.value.add(s),b.size&&c.value.add(...b)}()}export{c as useTop};
@@ -1 +1 @@
1
- import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isArray as a,isFunction as s}from"lodash-es";import{nextTick as m}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as f,NESTED_FORM_ITEM_TYPE as u}from"../constants/index.js";import{queryDecoratorByAddress as l,queryInput as d,queryDecoratorByFieldKey as c,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as g,combineExtendKey as v,splitExtendKey as y}from"../utils/index.js";import{getParentLinebar as h}from"../utils/schema.js";function x({formModel:t,formRenderRef:n,formUUID:s,getFieldList:u,formItemDepsCollector:p}){return{validate(r="*"){return t.validate(r).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(o,[]):e)));function o(t,r){if(!i(r))return t;let o=!1;return a(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(m)),o=!0)})),!o&&t.push(m(r)),t}function m(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),a=e.messages.map((e=>function(e,t){var r;return t&&i(t.fieldItem)?g(null!=(r=t.fieldItem.defined_error_msg)?r:e,t.fieldItem):e}(e,r.get("decoratorProps")))),m=l(e.address,n.value,s);return{...e,messages:a,title:o,decoratorElement:m,...d(m)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=v(u(),r)),r},setFormValues(e,i=!0,n=!0){i&&(e=y(u(),e)),t.setFieldState("*",(t=>{r(t)&&(n||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))}))},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return a();const o=c(e,t,s);if(o)return a(o);const i=h(e,r);return i?(p.trigger(f+i,!0),await m(),a(c(e,t,s))):a();function a(e){return{decoratorElement:e,...d(e)}}}(e,n.value,u()):null}}function I({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(a){var m;if(e.enterToNextWidget&&a.target){if("TEXTAREA"===a.target.tagName&&!a.ctrlKey)return;a.preventDefault()}if(await n(0),Reflect.get(a,"stopCapture")||!e.enterToNextWidget||!r.value)return;const f=t(a.target,(e=>e.classList.contains("form-render__formItem")));if(!f)return;const l=`.form-render__formItem${u.map((e=>`:not([widget-type=${e}])`)).join("")}`,d=Array.from(r.value.querySelectorAll(l)),c=d.findIndex((e=>e.id===f.id));if(!~c)return;const{widget:g,field:v}=p(d,c,a.target);if(g)if(s(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(m=t.decoratorProps)?void 0:m.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{I as useFormDomEvent,x as useFormExposeEvent};
1
+ import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isArray as s,isString as a,isFunction as m}from"lodash-es";import{nextTick as f}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as u,NESTED_FORM_ITEM_TYPE as l}from"../constants/index.js";import{queryDecoratorByAddress as d,queryInput as c,queryDecoratorByFieldKey as p,findNextWidget as g}from"../utils/dom.js";import{validateMessageParser as v,combineExtendKey as y,splitExtendKey as h}from"../utils/index.js";import{getParentLinebar as x}from"../utils/schema.js";function I({formModel:t,formRenderRef:n,formUUID:m,getFieldList:l,formItemDepsCollector:g}){return{validate(r="*"){return t.validate(r).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(o,[]):e)));function o(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(f)),o=!0)})),!o&&t.push(f(r)),t}function f(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),s=e.messages.map((e=>function(e,t){if(!t||!i(t.fieldItem))return e;const r=t.fieldItem.defined_error_msg;return v(r&&a(r)?r:e,t.fieldItem)}(e,r.get("decoratorProps")))),f=d(e.address,n.value,m);return{...e,messages:s,title:o,decoratorElement:f,...c(f)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=y(l(),r)),r},setFormValues(e,i=!0,n=!0){i&&(e=h(l(),e)),t.setFieldState("*",(t=>{r(t)&&(n||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))}))},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return s();const o=p(e,t,m);if(o)return s(o);const i=x(e,r);return i?(g.trigger(u+i,!0),await f(),s(p(e,t,m))):s();function s(e){return{decoratorElement:e,...c(e)}}}(e,n.value,l()):null}}function j({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(s){var a;if(e.enterToNextWidget&&s.target){if("TEXTAREA"===s.target.tagName&&!s.ctrlKey)return;s.preventDefault()}if(await n(0),Reflect.get(s,"stopCapture")||!e.enterToNextWidget||!r.value)return;const f=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!f)return;const u=`.form-render__formItem${l.map((e=>`:not([widget-type=${e}])`)).join("")}`,d=Array.from(r.value.querySelectorAll(u)),c=d.findIndex((e=>e.id===f.id));if(!~c)return;const{widget:p,field:v}=g(d,c,s.target);if(p)if(m(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(a=t.decoratorProps)?void 0:a.fieldItem)?y():i({target:p})}else y();async function y(){await n(0),p.focus()}}}}export{j as useFormDomEvent,I as useFormExposeEvent};