cnhis-design-vue 3.1.47-release.0 → 3.1.47-release.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -87
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
- package/es/components/button-print/src/utils/print.d.ts +7 -5
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/useDraw.d.ts +4 -0
- package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
- package/es/components/fabric-chart/src/interface.d.ts +1 -0
- package/es/components/form-config/index.d.ts +9 -9
- package/es/components/form-config/src/FormConfig.vue.d.ts +9 -9
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +4 -4
- package/es/components/form-render/index.d.ts +1 -1
- package/es/components/form-render/src/FormRender.vue.d.ts +2 -1
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/levelSearchCascader.d.ts +2 -2
- package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
- package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +4 -4
- package/es/components/form-render/src/components/renderer/select.d.ts +2 -2
- package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
- package/es/components/form-render/src/hooks/useFormItemDeps.d.ts +1 -0
- package/es/components/form-render/src/hooks/useFormItemDeps.js +1 -1
- package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -1
- package/es/components/form-render/src/types/index.d.ts +59 -2
- package/es/components/form-render/src/utils/index.js +1 -1
- package/es/components/iho-table/src/constants/index.d.ts +1 -0
- package/es/components/iho-table/src/constants/index.js +1 -1
- package/es/components/iho-table/src/plugins/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/htmlRendererPlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/htmlRendererPlugin.js +1 -0
- package/es/components/iho-table/src/utils/index.js +1 -1
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +1 -1
- package/es/components/info-header/index.d.ts +2 -2
- package/es/components/info-header/src/InfoHeader.vue.d.ts +2 -2
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +1 -1
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +1 -1
- package/es/components/multi-chat/index.d.ts +1023 -0
- package/es/components/multi-chat/index.js +1 -0
- package/es/components/multi-chat/src/MultiChat.vue.d.ts +1005 -0
- package/es/components/multi-chat/src/MultiChat.vue.js +1 -0
- package/es/components/multi-chat/src/MultiChat.vue2.js +1 -0
- package/es/components/multi-chat/src/api/index.d.ts +8 -0
- package/es/components/multi-chat/src/api/index.js +1 -0
- package/es/components/multi-chat/src/components/ChatFooter.vue.d.ts +17 -0
- package/es/components/multi-chat/src/components/ChatFooter.vue.js +1 -0
- package/es/components/multi-chat/src/components/ChatFooter.vue2.js +1 -0
- package/es/components/multi-chat/src/components/ChatHeader.vue.d.ts +7 -0
- package/es/components/multi-chat/src/components/ChatHeader.vue.js +1 -0
- package/es/components/multi-chat/src/components/ChatHeader.vue2.js +1 -0
- package/es/components/multi-chat/src/components/ChatMain.vue.d.ts +13 -0
- package/es/components/multi-chat/src/components/ChatMain.vue.js +1 -0
- package/es/components/multi-chat/src/components/ChatMain.vue2.js +1 -0
- package/es/components/multi-chat/src/components/SiderList.vue.d.ts +41 -0
- package/es/components/multi-chat/src/components/SiderList.vue.js +1 -0
- package/es/components/multi-chat/src/components/SiderList.vue2.js +1 -0
- package/es/components/multi-chat/src/utils/chatSock.d.ts +28 -0
- package/es/components/multi-chat/src/utils/chatSock.js +1 -0
- package/es/components/multi-chat/style/index.css +1 -0
- package/es/components/scale-view/index.d.ts +28 -0
- package/es/components/scale-view/src/ScaleView.vue.d.ts +28 -0
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/scale-view/style/index.css +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/select-person/src/SearchMultiple.vue.d.ts +0 -6
- package/es/components/shortcut-setter/index.d.ts +2 -2
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +2 -2
- package/es/components/steps-wheel/index.d.ts +27 -0
- package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +27 -0
- package/es/components/steps-wheel/src/StepsWheel.vue2.js +1 -1
- package/es/components/steps-wheel/src/constants/index.js +1 -1
- package/es/components/steps-wheel/style/index.css +1 -1
- package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +3 -0
- package/es/env.d.ts +25 -25
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/fabricjs/index.d.ts +6823 -0
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/es/shared/utils/tapableLess.d.ts +28 -0
- package/es/shared/utils/tapableLess.js +1 -0
- package/package.json +4 -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
|
+
```
|
|
File without changes
|
|
@@ -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{defineComponent as t,reactive as e,computed as r,onMounted as a,
|
|
1
|
+
import{defineComponent as t,reactive as e,computed as r,onMounted as a,watch as n,openBlock as i,createElementBlock as o,Fragment as l,createVNode as s,unref as m,withCtx as p,renderSlot as d,withModifiers as u,createTextVNode as c,toDisplayString as f,mergeProps as v}from"vue";import{isObject as y}from"@vue/shared";import{useMessage as b,NDropdown as g,NButton as I,NIcon as P}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as h}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import k from"./components/IdentityVerification.vue.js";import{format as T}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as S}from"./api.js";var D=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})}},emits:["success","error","clickoutside"],setup(t,{expose:D,emit:O}){var j;const E=t,L=b();let M;const N={},V=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),C=e([{label:E.printText,key:"printText"},{label:E.previewText,key:"previewText"},{label:E.pdfLoadText,key:"downloadPdf"},{label:E.formatEditText,key:"formatEditText"},...(null==(j=E.externalOptionConfig)?void 0:j.options)||[]]),Y=r((()=>{if(!V.currentFormatId)return{};let t=V.currentFormatId;return V.formatList.find((e=>e.id===t))})),J=r((()=>{var t;return(null==(t=Y.value)?void 0:t.name)||"格式选择"})),U=r((()=>{let t=V.formatList.find((t=>t.id===V.currentFormatId));return null==t?void 0:t.templateId})),A=async t=>{if(E.directPrint){if(V.spinning)return;return"button"===t?void await nt():et()}return et()},B=t=>s("span",{class:{active:t.key===V.currentFormatId}},[t.label]),q=(t,e)=>{let r={type:e,formatId:V.currentFormatId,templateId:U.value};O("success",t,r)},R=t=>{O("error",t),y(t)&&"notInstalledApp"===t.type&&L.error(t.message)},_=t=>{O("error",{message:"前置条件执行错误",type:t,preExecution:!0})},z=(t=0)=>{var e;const r=(null==(e=E.printParams)?void 0:e.length)?E.printParams[t]:V.printParams[t];return JSON.stringify({...r||{},...E.token?{token:E.token}:{}})},H=()=>{var t,e;let r={},a={};if(null==(t=V.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(V.printParams[0].datasetData||{}))?void 0:e[0])||"",r=JSON.stringify(V.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=r}else Object.keys(V.printParams[0]).forEach((t=>{a[t]=[],V.printParams.forEach((e=>{a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(z(0)),a),JSON.stringify(r)},$=()=>{let t=V.printParams.length;const e=async e=>{try{--t<=0&&q(e,"print")}catch(t){console.log("error",t)}};E.prevFn("print").then((()=>{const t={formatId:V.currentFormatId,templateId:U.value,printdlgshow:E.printdlgshow};if("MULTI"===E.strategy)for(let r=0;r<V.printParams.length;r++)r>0&&(t.printdlgshow="0"),M.printDirect({...t,messageTimeout:0,params:z(r)},e,R);else M.printDirect({...t,messageTimeout:0,params:H()},(t=>{q(t,"print")}),R)})).catch((()=>{_("print")})).finally((()=>{V.visible=!1}))},G=async(t,e)=>{var r,a;switch(t){case"printText":$();break;case"previewText":(async()=>{E.prevFn("preview").then((()=>{const t="MULTI"===E.strategy?z():H(),e={formatId:V.currentFormatId,templateId:U.value,params:t,btnprint:E.btnprint};M.preview(e,(t=>{q(t,"preview")}),R)})).catch((()=>{_("preview")})).finally((()=>{V.visible=!1}))})();break;case"formatEditText":E.prevFn("edit").then((()=>{V.identityVerification.visible=!0})).catch((()=>{_("edit")})).finally((()=>{V.visible=!1}));break;case"downloadPdf":(async()=>{E.prevFn("download").then((()=>{const t="MULTI"===E.strategy?z():H(),e={formatId:V.currentFormatId,templateId:U.value,print:{print:"1",type:"1"},params:t};M.downloadPDF(e,(t=>q(t,"preview")),R)})).catch((()=>{_("download")})).finally((()=>{V.visible=!1}))})();break;default:{V.visible=!1;const n=V.formatList.find((e=>e.id===t))||{};if(Object.keys(n).length>0){V.currentFormatId=t;const[e]=C;e.label=(null==n?void 0:n.name)||e.label,await x({formatForms:[{...n}],name:N.name||n.templateName,number:N.number||n.number,templateId:N.templateId||n.templateId,...N.id?{id:N.id}:{}},{token:E.token})}else null==(a=null==(r=E.externalOptionConfig)?void 0:r.onSelect)||a.call(r,t,e);break}}},K=()=>{V.visible=!1,O("clickoutside")},Q=()=>(V.isInited=!1,V.spinning=!1,setTimeout((()=>{V.visible=!1}),0),!1),W=(t,e,r)=>{const a={};return e.forEach((e=>{let n=((t,e)=>{const r={DATE:"YYYY-MM-DD",DATETIME:"YYYY-MM-DD HH:mm:ss"};let a=e;return Object.keys(r).includes(t.type)&&e&&(a=T(e,r[t.type])),(null==t?void 0:t.defaultValue)||a})(e,t[e[r]]);t[e[r]]&&n&&(a[e[r]]=n)})),a},X=({customizeDataset:t=[],param:e=[]},r=[])=>r.map((r=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(W(r,e,"fieldName"))}})),a=Object.assign({},a,W(r,e,"key")),a})),Z=async t=>{var e;if(V.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],V.currentFormatId=await(async(t,e)=>{var r;if(!(null==t?void 0:t.length))return"";const{data:a}=await S({templateId:t[0].templateId},{token:E.token});if("SUCCESS"===a.result){const{formatForms:e=[]}=a.map||{};Object.assign(N,a.map||{});const n=null==(r=null==e?void 0:e[0])?void 0:r.id;if(n&&t.map((t=>t.id)).includes(n))return n}const n=t.find((t=>1==t[e]));return(null==n?void 0:n.id)||t[0].id})(V.formatList,"defaultFlag"),!V.currentFormatId)return L.error("获取打印格式失败,请联系管理员!"),Q();(()=>{const t=V.formatList.map((t=>({label:t.name,key:t.id})));C.unshift({label:J.value,key:"format",children:t})})();let r=null==(e=await E.queryTemplateParams())?void 0:e.obj;if(!r||!U.value)return L.error("获取打印模板失败,请联系管理员!"),Q();V.templateParams=r,V.printParams=X(V.templateParams,E.params)},tt=async()=>{if(V.isInited)return!0;V.isInited=!0,V.spinning=!0,(()=>{if(M)return!1;M=new h})();const t=await E.queryPrintFormatByNumber();return await Z(t),V.spinning=!1,!0},et=async(t=!0)=>{var e;if(await E.clickPrevFn())if(null==(e=E.params)?void 0:e.length){if(!V.visible){if(!await tt())return!1}t&&(V.visible=!V.visible)}else L.warning(E.noDataMsg)},rt=()=>{V.watchPrintParamsReformatFn&&V.watchPrintParamsReformatFn(),V.isInited?V.printParams=X(V.templateParams,E.params):V.watchPrintParamsReformatFn=()=>n((()=>V.isInited),(t=>{if(!t)return!1;rt()}))},at=t=>{if(V.identityVerification.visible=!1,F(V.currentFormatId))return q(null,"edit");const e={formatId:V.currentFormatId,templateId:U.value,params:z(),token:t};M.editPrintFormat(e,(t=>{q(t,"edit")}),R)};async function nt(){await et(!1),$()}return a((()=>{V.isInited=!1})),n((()=>E.params),(t=>{if(!(null==t?void 0:t.length))return!1;rt()}),{deep:!0}),D({directPrint:nt}),(e,r)=>(i(),o(l,null,[s(m(g),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:V.visible,onClickoutside:K,options:C,onSelect:G,"render-label":B},{default:p((()=>[d(e.$slots,"button",{handleClickPrintBtn:et,printSpinning:V.spinning,printbtnText:t.btnText,printVisible:V.visible},(()=>[s(m(I),{class:"dropdown-button",onClick:r[1]||(r[1]=u((()=>A("button")),["stop"]))},{default:p((()=>[c(f(t.btnText)+" ",1),s(m(P),{component:m(w),style:{"margin-left":"5px"},onClick:r[0]||(r[0]=u((()=>A("icon")),["stop"]))},null,8,["component"])])),_:1})]))])),_:3},8,["show","options"]),s(k,v(e.$attrs,{modelValue:V.identityVerification.visible,"onUpdate:modelValue":r[2]||(r[2]=t=>V.identityVerification.visible=t),formatId:V.currentFormatId,templateId:m(U),onSuccess:at}),null,16,["modelValue","formatId","templateId"])],64))}});export{D as default};
|
|
@@ -14,6 +14,8 @@ export declare class Print {
|
|
|
14
14
|
private readonly messageHandlerQueue;
|
|
15
15
|
private messageHandler;
|
|
16
16
|
private postMessage;
|
|
17
|
+
messageCollect(id: string, data: AnyObject): Promise<unknown>;
|
|
18
|
+
messageCollectAndNotifyFail(id: string, data: AnyObject, messageTimeout: number): Promise<unknown>;
|
|
17
19
|
destroy(): void;
|
|
18
20
|
/**
|
|
19
21
|
* @desc 调用实例方法打开弹窗
|
|
@@ -26,7 +28,7 @@ export declare class Print {
|
|
|
26
28
|
_handleMonitorNotify(message: string | unknown): void;
|
|
27
29
|
_handleResult(data: AnyObject, errorCallbackFn?: Func): false | AnyObject;
|
|
28
30
|
_handleResultTest(result: unknown, errorCallbackFn?: Func): boolean;
|
|
29
|
-
_handleEventQueryPrintData(templateId: string, formatId: string, params: AnyObject, errorCallbackFn?: Func): Promise<false | {
|
|
31
|
+
_handleEventQueryPrintData(templateId: string, formatId: string, params: AnyObject, messageTimeout: number, errorCallbackFn?: Func): Promise<false | {
|
|
30
32
|
file: any;
|
|
31
33
|
printerName: any;
|
|
32
34
|
pageCount: any;
|
|
@@ -38,20 +40,20 @@ export declare class Print {
|
|
|
38
40
|
pageCount: any;
|
|
39
41
|
formatId: string;
|
|
40
42
|
};
|
|
41
|
-
_handleEventDirect({ templateId, formatId, params, cmdid, print, printdlgshow, nobillnode, btnprint }: AnyObject): Promise<any>;
|
|
43
|
+
_handleEventDirect({ templateId, formatId, params, cmdid, print, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
|
|
42
44
|
_handleEventEditFormat({ templateId, formatId, params, token }: AnyObject): Promise<any>;
|
|
43
45
|
_queryProxyOrigin(): Promise<void>;
|
|
44
46
|
_queryPrintFile(formatId: string, params?: string): Promise<any>;
|
|
45
47
|
_browserPrint(result: AnyObject, mode: string): Promise<string | void>;
|
|
46
48
|
preview({ templateId, formatId, params, btnprint }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<any>;
|
|
47
|
-
printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode, isDownloadFile }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
|
|
49
|
+
printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
|
|
48
50
|
private _downloadPDF;
|
|
49
51
|
/**
|
|
50
52
|
* 下载pdf
|
|
51
53
|
*/
|
|
52
54
|
downloadPDF(params: AnyObject, onResolve: Func, onReject: Func): void;
|
|
53
|
-
print({ templateId, formatId, params }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
|
|
54
|
-
queryPrintData({ templateId, formatId, params }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | {
|
|
55
|
+
print({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
|
|
56
|
+
queryPrintData({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | {
|
|
55
57
|
file: any;
|
|
56
58
|
printerName: any;
|
|
57
59
|
pageCount: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as
|
|
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}),c=`${window.location.protocol}//${window.location.host}`,m=`${c}/fdp-api/print/assembly/printIReport`,u=`${c}/bi-api/reprot/print/open/client/getRemote`,p=`${c}/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=5e3){if(!this.webview)return Promise.reject();const i=l();return 0===e?this.messageCollect(i,t):this.messageCollectAndNotifyFail(i,t,e)}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=5e3}){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}){const n={};let r={};try{r=Object.assign({},n,JSON.parse(i))}catch(t){r=n}const a={templateId:t,formatId:e,cmdid:"9",token:s,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:m,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},n,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const s=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,s),void(null==n||n({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:s}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==n||n(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==l||l(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:s,printdlgshow:n,nobillnode:o,isDownloadFile:l=!0,messageTimeout:d=5e3},h,c,m="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,m),void(null==h||h({file:t}))):null==c?void 0:c("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,c))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,c);if(!a)return!1;l&&["downloadPDF"].includes(m)&&await this._browserPrint(a,m),null==h||h(a)}catch(t){const e="printDirect"===m?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==c||c(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=5e3},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=5e3},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},n,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:s}),l=this._handleResult(o,r);if(!l)return!1;n&&n(l)}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{w as Print};
|
package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as t,reactive as e,onMounted as i,nextTick as
|
|
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 o}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 d,range as u}from"lodash-es";import"../temperature/useShadow.js";import{useTop as p}from"./useTop.js";import{useCenter as h}from"./useCenter.js";function m(m,c,v,g){const f=t(),x=t(),w=t(),y=e({show:!1,point:{x:0,y:0},list:[]}),b=e({show:!1,point:{x:0,y:0},list:[],target:null}),C=a((()=>{var t;return null!=(t=c.data.left.width)?t:0})),H=a((()=>s(c.data.top.treeData))),Y=a((()=>{const{xAxis:t}=c.data;return"top"===t.position?t.height:0})),j=function(){const t=d(c.data.top.treeData);let e=0;const{cellWidth:a,cellHeight:r}=c.data.top.tree;return function t(i,l=0){i.forEach((i=>{var o;const n={top:e*r+Y.value,left:l*a,width:a,height:r};if(e++,null==(o=i.children)?void 0:o.length){e--;const a=s(i.children);n.height=a*r,t(i.children,l+1)}else n.width=C.value-n.left;Object.assign(i,n)}))}(t),t}();const D=a((()=>{const{grid:t}=c.data;return t.mainXCell*t.subXCell})),T=a((()=>c.data.top.tree.cellHeight)),M=a((()=>Y.value+T.value*H.value)),X=a((()=>{const t=d(c.data.xAxis),{position:e,spaceValue:a,spaceTimeStamp:r}=t,i=u(D.value/a+1).map((e=>0===e?t.startTime:n(new Date(E.value+e*a*r),"yyyy-MM-dd HH:mm:ss")));return{...t,list:i,left:C.value,top:"top"===e?0:M.value}})),A=a((()=>{const{grid:t}=c.data;return t.mainYCell*t.subYCell})),S=a((()=>{var t;const{width:e,right:a}=c.data;if(!a)return e;return e-(null!=(t=a.width)?t:0)})),G=a((()=>c.data.xAxis.height+T.value*H.value)),N=a((()=>{var t;const{bottom:e=null,height:a}=c.data;if(!e)return a;return a-(null!=(t=e.height)?t:0)})),P=a((()=>(S.value-C.value)/D.value)),W=a((()=>(N.value-G.value)/A.value)),E=a((()=>{var t;return Date.parse((null==(t=c.data.xAxis)?void 0:t.startTime)||n(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=a((()=>X.value.spaceTimeStamp/P.value)),k=e({canvasWidth:c.data.width,canvasHeight:c.data.height,borderStyle:{...o,...c.data.borderStyle||{}},grid:c.data.grid,top:c.data.top,other:c.data.other,topGridYNumber:r(H),topGridYCellHeight:r(T),topGridOriginY:r(Y),topGridEndY:r(M),treeData:j,xAxis:r(X),startTime:r(E),timeXCell:r(O),gridXNumber:r(D),gridYNumber:r(A),xCellWidth:r(P),yCellHeight:r(W),originX:r(C),endX:r(S),originY:r(G),endY:r(N)});return i((async()=>{await l(),p(m,k),h(m,k)})),{propItems:k,redrawPoints:x,select:f,pointTipProps:y,pointMenuProps:b,clickMenu:w}}export{m as useSurgicalAnesthesiaChart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
2
|
import { fabric } from '../../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { AnyObject } from '../../../../../../es/shared/types';
|
|
4
|
-
export declare function useTop(canvas: Ref<fabric.Canvas>, propItems: AnyObject): void;
|
|
4
|
+
export declare function useTop(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,drawTextGroup as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"
|
|
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:L,endX:p,xCellWidth:m,gridXNumber:x,top:h,topList:g,canvasWidth:X,borderStyle:v,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<L||s>p)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}),X=new t.Group([d,g],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,lockMovementY:!0});var v;return X.isLeft=r,X.isCustomIcon=i,(v=X).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)}(v),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)}}(v)})),v.on("mouseup",(t=>{1===t.button&&function(t){t.isLeft?(t.preLine&&(t.preLine.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))}(v)})),X}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}),X=k({...f,x:h},{isCustomIcon:!1,isContinue:!!r});let v,C,y;if((g||x<L)&&(X||h>p)){v=o([g?x:L,s,X?h:p,s],e)}c.push({startLine:g,centerLine:v,endLine:X}),function(t,e){const{startLine:i,centerLine:n,endLine:o}=e[t],{startLine:l,endLine:r}=e[t-1]||{};if(i){const t={x1:L,x2:o?o.left:p};r?(t.x1=r.left,r.limitX.x2=i.left,i.preLine=r,r.nextLine=i):l&&(t.x1=l.left,l.limitX.x2=i.left,i.preLine=l,l.nextLine=i),i.limitX=t,n&&(i.centerLine=n)}if(o){const t={x1:i?i.left:L,x2:p};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)),v&&j.add(v),g&&j.add(g),X&&j.add(X),C&&j.add(C),y&&j.add(y)}))}(e)),r.push(n({width:s,height:f,...v},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 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as w}from"../../constants/index.js";function j(j,L,k,Y,S,E,$,M,P,O){r(j,L);const{getEqualXTypes:T,handleAddPrevent:A}=y(j,k),{createShadowLines:I}=t(),{left:C,xScaleList:R,xCellWidth:X,yCellHeight:z,originX:D,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=L,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=m(C.yScaleValue);function ne(t){var i;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(N.size&&j.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],c=n[i-1],p=n[i+1],d=o[r-1],f=o[r+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var i,l,s,r,a,u;const c=t.map((e=>({x:e[0],y:e[1]}))),p=new e.Polygon(c,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){p.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=I(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),j.value.add(...e)}N.add(p),j.value.add(p)}))}}function oe(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},w,C.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{j.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,t,r){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:w=[]}=r,Y=[],E=[],M=[];null==(u=e.list)||u.forEach(((u,O)=>{const T=a(c)?w.find((e=>e.key===u.key)):e,A=ae(u,r),I={};I.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return M.push(s),{obj:s,top:-z}}(A,u,T),function(e,t,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=a,{value:x}=u;let b,w,j,L,k,Y;if(t.noRise&&h.show)if(h.text)j=l([e[0],e[1]+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),M.push(j);else{const t=e[1]+2*z;L=s([e[0],e[1],t],h.style||{}),M.push(L)}t.rise&&f.show&&f.text&&(k=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),M.push(k));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),M.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=S(c,r.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===K?"bottom":"center"}),b&&M.push(b),w&&M.push(w)}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5},arrowGroup:{obj:L,top:2*z},riseText:{obj:k,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:w,type:"reduce"}})}(A,u,T,I),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=s([e[0],i[0],i[1]],m,"up"),M.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),M.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-z],i),M.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(A,u,T,I),function(n,l,s,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,w=e.list[s+1],S=ae(w,r),M=se(c,e.list[s].value),O=S&&se(c,w.value);!n||!S||l.breakpoint||M||O||n[0]===S[0]||(f=i([...n,...S],{...v}));const T=l.pacemakerShow&&"pulse"==c?y.value:M?0:x,A=E[s-1],I={origin:{data:l,title:g,key:m||"",unit:r.unit,type:c,_type:d(g,c),dataIndex:t,index:s},leftLine:A,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...L.event.hovered?L.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:L.event,...M?{selectable:!1,evented:!1,...b}:{}};if(A){const e=A.get("y2");p=o(T,{left:A.get("x2"),top:M?e-5:e,...I})}else n&&(I.leftLine=null,p=o(T,{left:n[0],top:M?n[1]-5:n[1],...I}));E.push(f),p&&(g.includes("脉搏")?Z.add(p):ee.add(p),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};j.value.discardActiveObject(),k("change",n),ce(n,"change")}}))}(p),Y.push(p),te.add(p))}(A,u,O,T,I)})),"pulse"===c&&Q.forEach((e=>{U.set(e,Y.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(Y).then((e=>{const t=E.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(M).then((i=>{j.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&j.value.remove(e.leftLine),e.rightLine&&j.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||E(e.left)).slice(-5)}`],P.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(f(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=S(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${E(e)}:00`);return B&&l<h(B)?(A("exceedMin"),!1):!(l>o)||(A("exceedMax"),!1)}function ce(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;pe()}function pe(){var e;te.size&&(null==(e=j.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=S(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);j.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),L.event.evented&&j.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=F&&n<=_){O.point={x:i,y:n},O.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(O.list=[...x]),"pain"===o&&(O.list=[...b]),O.target=e.target;else{O.target=null,O.list=["新增节点"],G.forEach((t=>{if(!T(i,"_type",X).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&O.list.push({renderItem:M?M(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==O.list.length||(O.show=!1,1===O.list.length&&t&&A("repeat"))}}}})),{pointTipProps:P,pointMenuProps:O,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=g(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};k("change",r),ce(r,"change")}else{const t={data:{time:E(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};k("add",t),ce(t)}},setPopup:re,isAddPoint:ue,updateData:ce,redrawPoints:pe}}export{j as useCenter};
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as p,isValidValue as d,setOtherType as c,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as w}from"../../constants/index.js";function j(j,k,Y,S,E,$,M,P,O,T){r(j,k);const{getEqualXTypes:A,handleAddPrevent:I}=y(j,Y),{createShadowLines:C}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:q,vitalSignsOriginY:W,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var i;const o=ne.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(Q.size&&j.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],p=n[i-1],d=n[i+1],c=o[r-1],f=o[r+1];if(p&&c){if(p[0]!==c[0]){const e=Math.max(p[0],c[0]);l.push([p,c].find((t=>t[0]===e)))}}else p?l.push(p):c&&s.push(c);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var i,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),d=new e.Polygon(p,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){d.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=C(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),Q.add(e)})),j.value.add(...e)}Q.add(d),j.value.add(d)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},w,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{j.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function se(e,t,r){var u;const{type:p,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:w=[]}=r,S=[],$=[],P=[];null==(u=e.list)||u.forEach(((u,T)=>{const A=a(p)?w.find((e=>e.key===u.key)):e,I=ue(u,r),C={};C.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=W.originY+z?e[1]+z:e[1]-z,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return P.push(s),{obj:s,top:-z}}(I,u,A),function(e,t,r,a,u){var c,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(p))return;const{lineAttr:m={}}=r,{value:x}=a;let b,w,j,k,Y,S;if(t.noRise&&h.show){const t=L(h)?E(u.type,u.list,35):e[1];if(h.text)j=l([e[0],L(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),P.push(j);else{const i=t+2*z;k=s([e[0],t,i],h.style||{}),P.push(k)}}t.rise&&f.show&&f.text&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),P.push(Y));t.verified&&(S=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),P.push(S));if(d(t.physicsReduce)||d(t.drugReduce)){const l=E(p,u.list,null!=(c=t.physicsReduce)?c:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),b&&P.push(b),w&&P.push(w)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5,isFixed:L(h)},arrowGroup:{obj:k,top:2*z,isFixed:L(h)},riseText:{obj:Y,top:(x?-z:0)-5},verifiedText:{obj:S,top:(x?-z:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,u,A,C,r),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(p))return;let o,a;const{upArrowShow:u=!1,limitValueShow:d=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<W.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=s([e[0],i[0],i[1]],m,"up"),P.push(o)}if(d){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),P.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-z],i),P.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(I,u,A,C),function(n,l,s,a,u){let d,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,w=e.list[s+1],L=ue(w,r),E=re(p,e.list[s].value),P=L&&re(p,w.value);!n||!L||l.breakpoint||E||P||n[0]===L[0]||(f=i([...n,...L],{...v}));const T=l.pacemakerShow&&"pulse"==p?y.value:E?0:x,A=$[s-1],I={origin:{data:l,title:g,key:m||"",unit:r.unit,type:p,_type:c(g,p),dataIndex:t,index:s},leftLine:A,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==p?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...E?{selectable:!1,evented:!1,...b}:{}};if(A){const e=A.get("y2");d=o(T,{left:A.get("x2"),top:E?e-5:e,...I})}else n&&(I.leftLine=null,d=o(T,{left:n[0],top:E?n[1]-5:n[1],...I}));$.push(f),d&&(g.includes("脉搏")?ee.add(d):te.add(d),function(e){q.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{O.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:W;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),q.hovered&&ae(e)})),e.on("mouseup",(t=>{if(O.show=!1,1===t.button){const{type:t}=e.origin,i=M(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};j.value.discardActiveObject(),Y("change",n),de(n,"change")}}))}(d),S.push(d),ie.add(d))}(I,u,T,A,C)})),"pulse"===p&&U.forEach((e=>{Z.set(e,S.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(S).then((e=>{const t=$.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(P).then((i=>{j.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&j.value.remove(e.leftLine),e.rightLine&&j.value.remove(e.rightLine))}}(t,e)}))}))}))}function re(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;O.point={x:e.left,y:e.top},O.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:M(o,e.top);if(d(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(d(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||$(e.left)).slice(-5)}`],O.show=!0}function ue(e,t){const i="pain"===t.type?B:W;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=S(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function pe(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${$(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function de(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;ie.size&&(null==(e=j.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);j.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le(),k.event.evented&&j.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){T.point={x:i,y:n},T.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(T.list=[...x]),"pain"===o&&(T.list=[...b]),T.target=e.target;else{T.target=null,T.list=["新增节点"],H.forEach((t=>{if(!A(i,"_type",F).includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:W;n>=i.originY&&n<=i.endY&&T.list.push({renderItem:P?P(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=pe(i);t&&1!==T.list.length||(T.show=!1,1===T.list.length&&t&&I("repeat"))}}}})),{pointTipProps:O,pointMenuProps:T,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=g(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};Y("change",r),de(r,"change")}else{const t={data:{time:$(e.pointer.x),value:M(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};Y("add",t),de(t)}},setPopup:ae,isAddPoint:pe,updateData:de,redrawPoints:ce}}function L(e){return"fixed"===e.position}export{j as useCenter};
|
|
@@ -9,6 +9,7 @@ export declare const defaultBorderStyle: {
|
|
|
9
9
|
selectable: boolean;
|
|
10
10
|
stroke: string;
|
|
11
11
|
strokeWidth: number;
|
|
12
|
+
strokeUniform: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare const defaultLineStyle: {
|
|
14
15
|
evented: boolean;
|
|
@@ -16,6 +17,7 @@ export declare const defaultLineStyle: {
|
|
|
16
17
|
stroke: string;
|
|
17
18
|
strokeWidth: number;
|
|
18
19
|
strokeDashArray: number[];
|
|
20
|
+
strokeUniform: boolean;
|
|
19
21
|
};
|
|
20
22
|
export declare const defaultRectStyle: {
|
|
21
23
|
evented: boolean;
|
|
@@ -26,6 +28,7 @@ export declare const defaultRectStyle: {
|
|
|
26
28
|
originX: string;
|
|
27
29
|
originY: string;
|
|
28
30
|
objectCaching: boolean;
|
|
31
|
+
strokeUniform: boolean;
|
|
29
32
|
};
|
|
30
33
|
export declare const defaultTextStyle: {
|
|
31
34
|
evented: boolean;
|
|
@@ -38,6 +41,7 @@ export declare const defaultTextStyle: {
|
|
|
38
41
|
originY: string;
|
|
39
42
|
lineHeight: number;
|
|
40
43
|
objectCaching: boolean;
|
|
44
|
+
strokeUniform: boolean;
|
|
41
45
|
};
|
|
42
46
|
export declare function drawLine(points: number[], style: Partial<ILineOptions>): fabric.Line;
|
|
43
47
|
export declare function drawText([x, y]: [x: number, y: number], style: ITextOptions): fabric.Text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},r={stroke:"#000",strokeWidth:1,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},i={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,...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,{...n,...r})}function s([t,r],n){return new e.Text(String(n.value),{...o,left:t,top:r,...n})}function
|
|
1
|
+
import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},r={stroke:"#000",strokeWidth:1,strokeUniform:!0,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],strokeUniform:!0,...t},i={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,strokeUniform:!0,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,strokeUniform:!0,...t};function c(t,r){return new e.Line(t,{...n,...r})}function s([t,r],n){return new e.Text(String(n.value),{...o,left:t,top:r,...n})}function a([r,n,i],o,a="down"){const l=c([r,n,r,i],{strokeWidth:1,stroke:o.fill}),g=s([r+.5,"up"===a?i-3:i+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===a?180:0,objectCaching:!1,...o});return new e.Group([l,g],{...t,originX:"center",originY:"top",objectCaching:!1})}function l(r,n,c,s=!1){const a=new e.Rect({...i,...r,...s?{}:{stroke:"transparent"}}),{value:l="标题",textAlign:g="center",verticalAlign:u="center"}=n,h=r.width/2,f=r.height/2,d=new e.Text(String(l),{...o,...n,..."left"==g||"right"==g?{originX:g,left:"left"==g?-h:h}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-f:f}:{}});return new e.Group([a,d],{objectCaching:!1,...t,...c})}function g(t="circle",r){const n={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},i=()=>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,...n});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...n});case"image":return new e.Image(r.element,{...n,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),n={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},i=new e.Line([0,t/2,t,t/2],n),o=new e.Line([t/2,0,t/2,t],n);return new e.Group([i,o])};return new e.Group([i(),t()],{scale:1,...n})}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([i(),o],{scale:1,...n})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...n})}}export{r as defaultBorderStyle,n as defaultLineStyle,i as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,a as drawArrow,c as drawLine,g as drawPoint,s as drawText,l as drawTextGroup};
|
|
@@ -141,7 +141,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
141
141
|
level_key?: string | undefined;
|
|
142
142
|
link_key?: string | undefined;
|
|
143
143
|
link_key_split?: string | undefined;
|
|
144
|
-
show_key?: string[] | undefined;
|
|
144
|
+
show_key?: string | string[] | undefined;
|
|
145
145
|
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
146
146
|
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
147
147
|
setting?: {
|
|
@@ -1861,7 +1861,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1861
1861
|
level_key?: string | undefined;
|
|
1862
1862
|
link_key?: string | undefined;
|
|
1863
1863
|
link_key_split?: string | undefined;
|
|
1864
|
-
show_key?: string[] | undefined;
|
|
1864
|
+
show_key?: string | string[] | undefined;
|
|
1865
1865
|
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
1866
1866
|
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
1867
1867
|
setting?: {
|
|
@@ -3590,7 +3590,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3590
3590
|
level_key?: string | undefined;
|
|
3591
3591
|
link_key?: string | undefined;
|
|
3592
3592
|
link_key_split?: string | undefined;
|
|
3593
|
-
show_key?: string[] | undefined;
|
|
3593
|
+
show_key?: string | string[] | undefined;
|
|
3594
3594
|
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
3595
3595
|
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
3596
3596
|
setting?: {
|
|
@@ -5310,7 +5310,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
5310
5310
|
level_key?: string | undefined;
|
|
5311
5311
|
link_key?: string | undefined;
|
|
5312
5312
|
link_key_split?: string | undefined;
|
|
5313
|
-
show_key?: string[] | undefined;
|
|
5313
|
+
show_key?: string | string[] | undefined;
|
|
5314
5314
|
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
5315
5315
|
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
5316
5316
|
setting?: {
|
|
@@ -7483,7 +7483,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
7483
7483
|
validate(path?: string): Promise<void>;
|
|
7484
7484
|
getFormValues(needCombineExtendKey?: boolean): any;
|
|
7485
7485
|
setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
|
|
7486
|
-
setFieldState(path: string,
|
|
7486
|
+
setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
|
|
7487
7487
|
match: (pattern: import("@formily/path").Pattern) => boolean;
|
|
7488
7488
|
validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
|
|
7489
7489
|
data: any;
|
|
@@ -8006,7 +8006,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
8006
8006
|
level_key?: string | undefined;
|
|
8007
8007
|
link_key?: string | undefined;
|
|
8008
8008
|
link_key_split?: string | undefined;
|
|
8009
|
-
show_key?: string[] | undefined;
|
|
8009
|
+
show_key?: string | string[] | undefined;
|
|
8010
8010
|
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
8011
8011
|
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
8012
8012
|
setting?: {
|
|
@@ -9737,7 +9737,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
9737
9737
|
level_key?: string | undefined;
|
|
9738
9738
|
link_key?: string | undefined;
|
|
9739
9739
|
link_key_split?: string | undefined;
|
|
9740
|
-
show_key?: string[] | undefined;
|
|
9740
|
+
show_key?: string | string[] | undefined;
|
|
9741
9741
|
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
9742
9742
|
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
9743
9743
|
setting?: {
|
|
@@ -11441,7 +11441,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
11441
11441
|
level_key?: string | undefined;
|
|
11442
11442
|
link_key?: string | undefined;
|
|
11443
11443
|
link_key_split?: string | undefined;
|
|
11444
|
-
show_key?: string[] | undefined;
|
|
11444
|
+
show_key?: string | string[] | undefined;
|
|
11445
11445
|
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
11446
11446
|
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
11447
11447
|
setting?: {
|
|
@@ -13532,7 +13532,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
13532
13532
|
validate(path?: string): Promise<void>;
|
|
13533
13533
|
getFormValues(needCombineExtendKey?: boolean): any;
|
|
13534
13534
|
setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
|
|
13535
|
-
setFieldState(path: string,
|
|
13535
|
+
setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
|
|
13536
13536
|
match: (pattern: import("@formily/path").Pattern) => boolean;
|
|
13537
13537
|
validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
|
|
13538
13538
|
data: any;
|