cnhis-design-vue 3.2.11-release.2 → 3.2.11-release.3

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 (56) hide show
  1. package/README.md +87 -87
  2. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  3. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  6. package/es/components/fabric-chart/src/utils/index.d.ts +2 -2
  7. package/es/components/fabric-chart/src/utils/index.js +1 -1
  8. package/es/components/form-config/index.d.ts +3 -3
  9. package/es/components/form-config/src/FormConfig.vue.d.ts +3 -3
  10. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -3
  11. package/es/components/form-render/src/types/fieldItem.d.ts +1 -1
  12. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  13. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +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/shortcut-setter/index.d.ts +1 -1
  17. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
  18. package/es/env.d.ts +25 -25
  19. package/es/shared/assets/img/ai__avatar.png.js +1 -1
  20. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  21. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  22. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  23. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  24. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  25. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  26. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  27. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  28. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  29. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  30. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  31. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  32. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  33. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  34. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  35. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  36. package/es/shared/assets/img/failure.png.js +1 -1
  37. package/es/shared/assets/img/logo.png.js +1 -1
  38. package/es/shared/assets/img/no-permission.png.js +1 -1
  39. package/es/shared/assets/img/nodata.png.js +1 -1
  40. package/es/shared/assets/img/notfound.png.js +1 -1
  41. package/es/shared/assets/img/qr.png.js +1 -1
  42. package/es/shared/assets/img/success.png.js +1 -1
  43. package/es/shared/assets/img/table_style_2.png.js +1 -1
  44. package/es/shared/assets/img/video.png.js +1 -1
  45. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  46. package/es/shared/assets/img/xb_big.png.js +1 -1
  47. package/es/shared/assets/img/xb_small.png.js +1 -1
  48. package/es/shared/package.json.js +1 -1
  49. package/package.json +2 -2
  50. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  51. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  52. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  53. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  54. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  55. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  56. package/es/shared/utils/tapable/index.d.ts +0 -139
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
+ ```
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -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 r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as m,getIndex as y}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,P,R,C,A,I){s(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:W}=t(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:re}=$,se=new Set,ue=["xinmai","mai"],ae=new Map,ce=new Set,de=new Set,pe=new Set,fe=x(z.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(se.size&&E.value.remove(...se),se.clear(),ae.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ae.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ae)t.push(e[1]),e[0]===ue[0]&&e[1].forEach((e=>{(ae.get(ue[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),u=n[i],a=o[s],c=n[i-1],d=n[i+1],p=o[s-1],f=o[s+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&r.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);r.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(r.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ue[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...W(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),se.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...s,originX:"center"});e.push(n),se.add(n)}))}E.value.add(...e)}se.add(l),E.value.add(l)}))}}function ge(e,t,s){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:m={},pacemaker:y={},upArrowStyle:b={},limitValueStyle:j={},nonePainPointStyle:w={},belowMinValueStyle:k={},respiratorStyle:L={},dataList:S=[],list:Y=[]}=s,{type:$,textStyle:P}=w,C=[],I=[],X=[];let D=null;const W=e=>"breathe"==a&&e.respirator&&L.type&&L.fixedValue&&!e.value&&ye(e.time);if(null==(u=e.list)||u.forEach(((u,w)=>{const z=d(a)?S.find((e=>e.key===u.key)):e,F=xe(W(u)?{...u,value:L.fixedValue}:u,s),G=e.list[w+1],N=G?xe(W(G)?{...G,value:L.fixedValue}:G,s):void 0,B=G?d(a)?S.find((e=>e.key===G.key)):e:{},{title:J=""}=z;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!F||!N||f(F[0],1)!==f(N[0],1))F&&D&&(F[0]=D),D=null;else{const e=F[0]-_/2;F[0]=e+_/4,N[0]=D=F[0]+_/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,r=l([e[0],o],{value:W(t)?L.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-q}}(F,u,z),function(e,t,s,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ye(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=s,{value:y}=u,x=T(t.time);let b,j,w,k,S,Y;if(t.noRise&&p.show){const i=M(p,t)?V(a,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(w);else if(t.value){w=r([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&he.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(k=l([x,e[1]-(y?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(k)),t.verified&&(S=l([x,e[1]-(y?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(S)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,null!=(d=t.physicsReduce)?d:t.drugReduce),r=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+_/2:x;b=i([...e,r,l],{...v,...m.line,...n}),j=o((null==(f=null==m?void 0:m.point)?void 0:f.type)||"circle",{left:r,top:l,...m.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(Y=o(L.type,{left:x,top:e[1]-(y?q:0)-5,originX:"center",originY:"bottom",...L.style}),X.push(Y))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:k,top:(y?-q:0)-5},verifiedText:{obj:S,top:(y?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:Y,top:(y?-q:0)-5}})}(F,u,z,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...Y),s=Math.min(...Y);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=r([e[0],i[0],i[1]],b,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...j};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<s&&(c=l([e[0],e[1]-q],i),X.push(c))}if(k.show&&+t.value<s){const t=e[1];if(k.text)d=l([e[0],e[1]+5],{value:k.text.split("").join("\n"),originY:"top",...k.style});else{const i=t+2*q;d=r([e[0],t,i],{...k.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:k.text?5:2*q,moveHide:!0}})}(F,u,z,K),function(n,l,r,u,c,d){let f,h;const{pointAttr:g={},lineAttr:m={},title:b="",key:j,type:w="circle"}=c,k=e.list[u+1];let S=x(n),Y=x(l);const M=function(e,t){return"pain"===e&&0==t}(a,e.list[u].value),D=()=>"pulse"==a&&r.pacemakerShow?y.value:W(r)?L.type:M&&"number"===$?0:w,z=e=>e&&p.show&&p.fixed&&ye(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(r.breakpoint)return!1;if("temperature"===a&&(n||z(r))&&(l||z(k))){const e=V(a,35);return n||(S=[T(r.time),e]),l||(Y=[T(k.time),e]),!0}return!!n&&!!l})()){h=i([...S,...Y],{...m});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if(n&&l&&(null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...m});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const F=D(),_=I[u-1],q={origin:{data:W(r)?{...r,value:L.fixedValue}:r,title:b,key:j||"",unit:s.unit,type:a,_type:v(b,a),dataIndex:t,index:u},leftLine:_,rightLine:h,otherObj:d,...r.pacemakerShow&&"pulse"==a?y.style:W(r)?L.style:g,lockMovementX:!0,...H(),...M?{selectable:!1,evented:!1,..."number"===$?P:{}}:{}};n&&(_?q.leftLine.set("x2",n[0]):q.leftLine=null,f=o(F,{left:n[0],top:M&&!ne[1]?n[1]-5:n[1],...q}));I.push(h),f&&(j===ue[1]?ce.add(f):W(r)||de.add(f),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:r=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),r&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=R(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),je(n,"change")}}))}(f),C.push(f),pe.add(f))}(F,N,u,w,z,K)})),"pulse"===a){const{key:t}=e;let i=null;ae.set(t,C.map(((e,t,n)=>{var o,l;const r=n[t+1];if(r&&f(e.left,1)===f(r.left,1)){const t=e.left-_/2;e.set("left",t+_/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+_/2,r.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const z=I.filter((e=>e));E.value.add(...z,...C,...X)}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:s,physicsReduce:u}=l||{},a="hover"===t?l.value:R(o,e.top);if(h(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(h(u))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),r],A.show=!0}function ye(e){const[t]=F,i=j(F),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function xe(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ye(e.time))return;const n=T(e.time),o=V(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function be(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${P(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function je(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=fe.find((e=>e.type===i));if("add"===t){const e=d(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;we()}function we(){var e;pe.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...pe]))),pe.clear(),ke()}function ke(e){ae.clear(),pe.clear(),ce.clear(),he.clear(),de.clear(),fe.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||ge(e,i,t)})))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>e.show&&"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,z.overlap||{}),l=[];ce.size&&[...ce].forEach((e=>{[...de].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),l.push(o(s,{...i[e],...r}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-re.strokeWidth,height:ie-re.strokeWidth,fill:"transparent",...re});E.value.add(t)}(),ke((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...pe],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:C?C(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=be(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=m(i,[...k,...L]);r[`${e.type}`]=e.value,r.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};O("change",s),je(s,"change")}else{const t={data:{time:P(e.pointer.x),value:R(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),je(t)}},setPopup:me,isAddPoint:be,updateData:je,redrawPoints:we,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as m,getIndex as y}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as L,PAIN_MENU as k,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,O,$,T,V,P,R,C,A,I){s(E,O);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,$,O),{createShadowLines:W}=t(),{left:z,xScaleList:F,xCellWidth:_,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne,iconsWidth:oe,canvasWidth:le,borderStyle:re}=O,se=new Set,ue=["xinmai","mai"],ae=new Map,ce=new Set,de=new Set,pe=new Set,fe=x(z.yScaleValue),he=new Set;function ve(t){var o;const l=fe.find((e=>e.show&&"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(se.size&&E.value.remove(...se),se.clear(),ae.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ae.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ae)t.push(e[1]),e[0]===ue[0]&&e[1].forEach((e=>{(ae.get(ue[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),u=n[i],a=o[s],c=n[i-1],d=n[i+1],p=o[s-1],f=o[s+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&r.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);r.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(r.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(pe).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ue[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{0==t?e.rightLine&&E.value.remove(e.rightLine):e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...W(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),se.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...s,originX:"center"});e.push(n),se.add(n)}))}E.value.add(...e)}se.add(l),E.value.add(l)}))}}function ge(e,t,s){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:m={},pacemaker:y={},upArrowStyle:b={},limitValueStyle:j={},nonePainPointStyle:w={},belowMinValueStyle:L={},respiratorStyle:k={},dataList:S=[],list:Y=[]}=s,{type:O,textStyle:P}=w,C=[],I=[],X=[];let D=null;const W=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ye(e.time),z=d(s);if(null==(u=e.list)||u.forEach(((u,d)=>{const w=z?S.find((e=>e.key===u.key)):e,F=xe(W(u)?{...u,value:k.fixedValue}:u,s),G=e.list[d+1],N=G?xe(W(G)?{...G,value:k.fixedValue}:G,s):void 0,B=G?z?S.find((e=>e.key===G.key)):e:{},{title:J=""}=w;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!F||!N||f(F[0],1)!==f(N[0],1))F&&D&&(F[0]=D),D=null;else{const e=F[0]-_/2;F[0]=e+_/4,N[0]=D=F[0]+_/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,r=l([e[0],o],{value:W(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(r),{obj:r,top:-q}}(F,u,w),function(e,t,s,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ye(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=s,{value:y}=u,x=T(t.time);let b,j,w,L,S,Y;if(t.noRise&&p.show){const i=M(p,t)?V(a,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||pe.add(w);else if(t.value){w=r([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&he.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(y?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(S=l([x,e[1]-(y?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(S)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,null!=(d=t.physicsReduce)?d:t.drugReduce),r=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+_/2:x;b=i([...e,r,l],{...v,...m.line,...n}),j=o((null==(f=null==m?void 0:m.point)?void 0:f.type)||"circle",{left:r,top:l,...m.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(Y=o(k.type,{left:x,top:e[1]-(y?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(Y))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(y?-q:0)-5},verifiedText:{obj:S,top:(y?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:Y,top:(y?-q:0)-5}})}(F,u,w,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...Y),s=Math.min(...Y);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=r([e[0],i[0],i[1]],b,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...j};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<s&&(c=l([e[0],e[1]-q],i),X.push(c))}if(L.show&&+t.value<s){const t=e[1];if(L.text)d=l([e[0],e[1]+5],{value:L.text.split("").join("\n"),originY:"top",...L.style});else{const i=t+2*q;d=r([e[0],t,i],{...L.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:L.text?5:2*q,moveHide:!0}})}(F,u,w,K),function(n,l,r,u,c,d){let f,h;const{pointAttr:g={},lineAttr:m={},title:b="",key:j,type:w="circle"}=c,L=e.list[u+1];let S=x(n),Y=x(l);const M=function(e,t){return"pain"===e&&0==t}(a,e.list[u].value),D=()=>"pulse"==a&&r.pacemakerShow?y.value:W(r)?k.type:M&&"number"===O?0:w,F=e=>e&&p.show&&p.fixed&&ye(e.time)&&e.noRise&&!e.value&&0!==e.value;if((()=>{if(r.breakpoint)return!1;if("temperature"===a&&(n||F(r))&&(l||F(L))){const e=V(a,35);return n||(S=[T(r.time),e]),l||(Y=[T(L.time),e]),!0}return!!n&&!!l})()){h=i([...S,...Y],{...m});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if(n&&l&&(null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...m});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const _=D(),q=I[u-1],G={origin:{data:W(r)?{...r,value:k.fixedValue}:r,title:b,key:j||"",unit:s.unit,type:a,_type:v(b,a),dataIndex:t,index:u,isOneLine:z},leftLine:q,rightLine:h,otherObj:d,...r.pacemakerShow&&"pulse"==a?y.style:W(r)?k.style:g,lockMovementX:!0,...H(),...M?{selectable:!1,evented:!1,..."number"===O?P:{}}:{}};n&&(q?G.leftLine.set("x2",n[0]):G.leftLine=null,f=o(_,{left:n[0],top:M&&!ne[1]?n[1]-5:n[1],...G}));I.push(h),f&&(j===ue[1]?ce.add(f):W(r)||de.add(f),function(e){Q.hovered&&(e.on("mouseover",(()=>{me(e,"hover")})),e.on("mouseout",(()=>{A.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:r=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),r&&(E.value.remove(i),delete e.otherObj.obj)))})),ve(e)}(e),Q.hovered&&me(e)})),e.on("mouseup",(t=>{if(A.show=!1,1===t.button){const{type:t}=e.origin,i=R(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),$("change",n),je(n,"change")}}))}(f),C.push(f),pe.add(f))}(F,N,u,d,w,K)})),"pulse"===a){let t=null;const i=e=>e.map(((e,i,n)=>{var o,l;const r=n[i+1];if(r&&f(e.left,1)===f(r.left,1)){const i=e.left-_/2;e.set("left",i+_/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+_/2,r.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]}));if(z){const e={};ue.forEach((t=>{e[t]=C.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t})),ae.set(t,i(e[t]))}))}else{const{key:t}=e;ae.set(t,i(C))}}const F=I.filter((e=>e));E.value.add(...F,...C,...X)}function me(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;A.point={x:e.left,y:e.top};let r=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;A.list=[function(){const{drugReduce:s,physicsReduce:u}=l||{},a="hover"===t?l.value:R(o,e.top);if(h(s))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(h(u))return r+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),r],A.show=!0}function ye(e){const[t]=F,i=j(F),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function xe(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ye(e.time))return;const n=T(e.time),o=V(t.type,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function be(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${P(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function je(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=fe.find((e=>e.type===i));if("add"===t){const e=d(s)?s.dataList.find((e=>e.enable)):s.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;we()}function we(){var e;pe.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...pe]))),pe.clear(),Le()}function Le(e){ae.clear(),pe.clear(),ce.clear(),he.clear(),de.clear(),fe.forEach((t=>{t.show&&(null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t)&&!e.enable||ge(e,i,t)})))})),ve(),[...pe].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=fe.find((e=>e.show&&"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,z.overlap||{}),l=[];ce.size&&[...ce].forEach((e=>{[...de].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),l.push(o(s,{...i[e],...r}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),pe.add(e)}))}))}()}return function(){const t=new e.Rect({left:oe,top:0,width:le-oe-re.strokeWidth,height:ie-re.strokeWidth,fill:"transparent",...re});E.value.add(t)}(),Le((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!O.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...L]),"pain"===o&&(I.list=[...k]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...pe],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:C?C(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key,isOneLine:i.isOneLine},pointer:n})}}));const i=be(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&$("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,isOneLine:o,dataIndex:l,index:r}=t.origin,s=m(i,[...L,...k]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),o&&(s.key=t.origin.key);const a={...t.origin,data:s};$("change",a),je(a,"change")}else{const t={data:{time:P(e.pointer.x),value:R(e.origin.type,e.pointer.y),...e.origin.isOneLine?{key:e.origin.key}:{}},...e.origin};$("add",t),je(t)}},setPopup:me,isAddPoint:be,updateData:je,redrawPoints:we,gridPoints:pe,fixedNoRisePoints:he}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import{last as u}from"lodash-es";import"../useEvent.js";import{getScaleInfo as a,drawScaleNumber as h,drawScaleLine as c}from"../useScaleColumn.js";import{useCommon as p}from"../useCommon.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function d(d,g,f,m,v,y,w,S,b,Y,x,j){var C,X;const{getEqualXTypes:N,handleAddPrevent:T,isGridLimit:V}=p(d,f,g),{originY:L,endY:E,originX:M,endX:G,xCellWidth:k,yCellHeight:I,left:O,vitalSignsOriginY:W,painOriginY:A,painHeight:H,iconsWidth:R,itemList:_,painIndex:B,right:J,canvasWidth:$,canvasHeight:q,getRightInfo:D,borderStyle:P,surplusCell:z,painSurplusCell:F}=g;function K(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let p=R,g=M;"right"===r&&(p=G,g=G+(null!=(s=null==J?void 0:J.width)?s:0));const f=[],m=H&&"right"!==r?o.length-1:o.length,v=(g-p)/m,y=v+(g-p)%m;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:u,position:c,showMaxMinNumber:p,style:g,title:f}=n,m=A.originY-F[0]*I,v=l({width:M-R,height:H+(F[0]+F[1])*I,...P},{value:`${f}`,...i,...g||{}},{left:R,top:m}),y=t([R,m,M,m],P),w=[];if(r||u){const{lineXMain:t,textLeft:i}=a(c,R,M-R),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*I*s;if(0===a&&0===F[1]&&(c=E-5),u&&(!(0===a||a===l-1)||p||0===a&&F[1]>0||a===l-1&&F[0]>0)&&w.push(h(o,n,i,c)),r&&(0!==a||F[1]>0)){const[i,n]=t,o=new e.Line([i,c,n,c],{...P,...g});w.push(o)}}))}d.value.add(y,v,...w),v.sendToBack()}(o);const g=[],m=0===s?y:v,w=0===s?p:y+p+(s-1)*v,S="right"===r?0:W.originY,b="right"===r?q:W.endY,Y=s>0?t([w,S,w,b],{objectCaching:!1,...P}):null;Y&&g.push(Y);const x=w+m/2,{list:j=[],spaceGridNumber:C=5,showScale:X,showNumber:N,position:T,showMaxMinNumber:V,detailedList:G=[],showdetailedScale:k,showRange:O=[]}=o;if(X||N){const{lineXMain:e,lineXSub:t,textLeft:i}=a(T,w,m),n=(j[1]-j[0])/2,l=k&&!G.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):k&&(null==G?void 0:G.length)?G:j,[s=l[0],r=u(l)]=O;l.forEach(((n,u)=>{if(s&&+n<+s)return;if(r&&+n>+r)return;const a=W.endY-u*I*(k?C/2:C),p=[s,r].includes(n);if(N&&(!p||V)){const e=0==u?a-5:a,t=h(n,o,i,e),l=W.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...c(o,u,e,t,a,I,W.originY,l.findIndex((e=>e==r))+1))}))}let _=o.title||"";o.unit&&(_+="\n"+o.unit);let J=W.originY+2;0!==B&&z[0]>0&&(J=L+2),_&&g.push(new e.Text(String(_),{...i,originY:"top",left:x,top:J,textAlign:"center",...o.style}));const $=new e.Group(g,{...n,objectCaching:!1});f.push($)}));const w=f.length>0?new e.Group([...f],{...n,objectCaching:!1}):null;w&&d.value.add(w),w&&w.sendToBack()}R&&function(){const e=JSON.parse(JSON.stringify(_));let t=E;const i=R-O.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:u}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{type:s(e.bigType),_type:e.bigType},...g.event}});var a;t-=l.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(e){if(e.left>=M&&e.left<=G){e.setCoords();const t="pain"===e.origin.type?A:W;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(a),V(a)?m(a):v.show=!1})),a.on("mouseup:before",(e=>{if(v.show=!1,0===e.e.button&&V(a)){const e=N([...j],a.left,"_type").includes(a.origin._type),t=Y(a.left);if(!t||e)e&&t&&T("repeat");else{const e={data:{time:S(a.left),value:b(a.origin.type,a.top),...r(a.origin.type)?{key:a.origin.key}:{}},...a.origin};f("add",e),x(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(a)})),d.value.add(l,u)}))}();const Q=O.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==J?void 0:J.width)&&"left"===(null==(C=null==J?void 0:J.yScaleValue)?void 0:C.layout)&&(null==(X=null==J?void 0:J.yScaleValue)?void 0:X.show)&&Q.push(D),B>0&&O.yScaleValue[B].show){const e=O.yScaleValue[B];0===B&&O.yScaleValue.length>1&&Q.unshift(e),B==O.yScaleValue.length-1&&Q.push(e)}const U=Q.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),Z=Q[U];return U>-1&&Q.splice(U,0,{...Z,title:(null==Z?void 0:Z.doubleTitle)||(null==Z?void 0:Z.title)}),K(Q),{drawScaleValue:K}}export{d as useLeft};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s}from"../../utils/index.js";import{last as r}from"lodash-es";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function p(p,d,g,f,m,v,y,w,S,b,Y,x){var j,C;const{getEqualXTypes:L,handleAddPrevent:X,isGridLimit:N}=c(p,g,d),{originY:T,endY:V,originX:O,endX:k,xCellWidth:E,yCellHeight:M,left:G,vitalSignsOriginY:I,painOriginY:W,painHeight:A,iconsWidth:H,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P,painSurplusCell:z}=d;function F(o){var s;if(!(null==o?void 0:o.length))return;const{layout:c}=o[0];let d=H,g=O;"right"===c&&(d=k,g=k+(null!=(s=null==B?void 0:B.width)?s:0));const f=[],m=A&&"right"!==c?o.length-1:o.length,v=(g-d)/m,y=v+(g-d)%m;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:d,style:g,title:f}=n,m=W.originY-z[0]*M,v=l({width:O-H,height:A+(z[0]+z[1])*M,...D},{value:`${f}`,...i,...g||{}},{left:H,top:m}),y=t([H,m,O,m],D),w=[];if(r||h){const{lineXMain:t,textLeft:i}=u(c,H,O-H),l=o.length;o.forEach(((o,u)=>{let c=W.endY-u*M*s;if(0===u&&0===z[1]&&(c=V-5),h&&(!(0===u||u===l-1)||d||0===u&&z[1]>0||u===l-1&&z[0]>0)&&w.push(a(o,n,i,c)),r&&(0!==u||z[1]>0)){const[i,n]=t,o=new e.Line([i,c,n,c],{...D,...g});w.push(o)}}))}p.value.add(y,v,...w),v.sendToBack()}(o);const g=[],m=0===s?y:v,w=0===s?d:y+d+(s-1)*v,S="right"===c?0:I.originY,b="right"===c?$:I.endY,Y=s>0?t([w,S,w,b],{objectCaching:!1,...D}):null;Y&&g.push(Y);const x=w+m/2,{list:j=[],spaceGridNumber:C=5,showScale:L,showNumber:X,position:N,showMaxMinNumber:k,detailedList:E=[],showdetailedScale:G,showRange:R=[]}=o;if(L||X){const{lineXMain:e,lineXSub:t,textLeft:i}=u(N,w,m),n=(j[1]-j[0])/2,l=G&&!E.length?j.reduce(((e,t,i)=>{const o=e[e.length-1];return 0===i?[t]:e.concat([o+n,o+2*n])}),[]):G&&(null==E?void 0:E.length)?E:j,[s=l[0],c=r(l)]=R;l.forEach(((n,r)=>{if(s&&+n<+s)return;if(c&&+n>+c)return;const u=I.endY-r*M*(G?C/2:C),p=[s,c].includes(n);if(X&&(!p||k)){const e=0==r?u-5:u,t=a(n,o,i,e),l=I.originY+t.height/2;e<l&&t.set({top:l}),g.push(t)}g.push(...h(o,r,e,t,u,M,I.originY,l.findIndex((e=>e==c))+1))}))}let B=o.title||"";o.unit&&(B+="\n"+o.unit);let J=I.originY+2;0!==_&&P[0]>0&&(J=T+2),B&&g.push(new e.Text(String(B),{...i,originY:"top",left:x,top:J,textAlign:"center",...o.style}));const q=new e.Group(g,{...n,objectCaching:!1});f.push(q)}));const w=f.length>0?new e.Group([...f],{...n,objectCaching:!1}):null;w&&p.value.add(w),w&&w.sendToBack()}H&&function(){const e=JSON.parse(JSON.stringify(R));let t=V;const i=H-G.icons.marginRight;e.reverse().forEach((e=>{t-=10;let n=e.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:r}=o(n,e,{text:{left:i-(e.pointAttr.width||10)-5,top:t,originX:"right"},icon:{originX:"right",left:i,topY:t,origin:{key:e.key,type:s(e.bigType),_type:e.bigType,isOneLine:e.isOneLine},...d.event}});var u;t-=l.height||30,(u=r).on("moving",(()=>{u.set("originX","center"),function(e){if(e.left>=O&&e.left<=k){e.setCoords();const t="pain"===e.origin.type?W:I;e.top<t.originY&&e.set("top",t.originY),e.top>t.endY&&e.set("top",t.endY)}}(u),N(u)?f(u):m.show=!1})),u.on("mouseup:before",(e=>{if(m.show=!1,0===e.e.button&&N(u)){const e=L([...x],u.left,"_type").includes(u.origin._type),t=b(u.left);if(!t||e)e&&t&&X("repeat");else{const e={data:{time:w(u.left),value:S(u.origin.type,u.top),...u.origin.isOneLine?{key:u.origin.key}:{}},...u.origin};g("add",e),Y(e)}}!function(e){e.setCoords().set({originX:"right",left:e.originLeft,top:e.originTop})}(u)})),p.value.add(l,r)}))}();const K=G.yScaleValue.filter((e=>"left"===e.layout&&"pain"!==e.type&&e.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&K.push(q),_>0&&G.yScaleValue[_].show){const e=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&K.unshift(e),_==G.yScaleValue.length-1&&K.push(e)}const Q=K.findIndex((e=>"pulse"===e.type&&e.show&&e.doubleShow)),U=K[Q];return Q>-1&&K.splice(Q,0,{...U,title:(null==U?void 0:U.doubleTitle)||(null==U?void 0:U.title)}),F(K),{drawScaleValue:F}}export{p as useLeft};
@@ -1 +1 @@
1
- import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import{flatten as s}from"lodash-es";import{format as v,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as h}from"./useLeft.js";import{useRight as p}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,S,w,b,Y,D){const x=15,C=e({select:null,redrawPoints:null,clickMenu:null}),j=a((()=>{const{painSurplusCell:e=[0,0]}=S.data.grid||{};return~J.value?e:[0,0]})),V=a((()=>{var e,a;const t=(null==(a=null==(e=S.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===J.value?t[0]=t[0]+j.value[1]:J.value>0&&(t[2]=t[2]+j.value[0]),t})),H=a((()=>0===J.value?[j.value[0],V.value[1],V.value[2],V.value[3]]:J.value>0?[V.value[0],V.value[1],j.value[1],V.value[3]]:V.value)),X=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||x)||0})),P=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),L=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),M=a((()=>{var e,a,t;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),I=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||x)||0})),N=a((()=>{var e;const{bottom:a}=S.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+V.value[1]+V.value[3]})),O=a((()=>{const{grid:e}=S.data,a=J.value>0?j.value[1]:j.value[0];return e.mainYCell*e.subYCell+V.value[0]+V.value[2]+a})),R=a((()=>{var e;const{width:a,right:t=null,top:l}=S.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),W=a((()=>R.value-V.value[1]*G.value)),$=a((()=>{const{top:e,left:a}=S.data;return e.titleWidth+A.value})),q=a((()=>{const{bottom:e=null,height:a}=S.data;if(!e)return a;return a-(e.height||30)})),z=a((()=>{var e;const{top:a}=S.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return X.value+t+l+P.value+L.value+I.value})),G=a((()=>(R.value-$.value)/k.value)),T=a((()=>(q.value-z.value)/O.value)),A=a((()=>{var e,a;const{left:t}=S.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),B=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=$.value-G.value;const r=t.date.startDate||v(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(v(d(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=G.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+G.value/2,scaleCell:(l-t)/G.value}}))));return s(o)})),E=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),F=a((()=>{const{left:e}=S.data;return s(e.yScaleValue.filter((e=>e.show)).map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t}))))))})),J=a((()=>{const{left:e}=S.data,a=e.yScaleValue.findIndex((e=>"pain"===e.type));return a>-1&&e.yScaleValue[a].show?a:-1})),K=a((()=>{const{grid:e}=S.data;return-1===J.value?0:T.value*e.subYCell})),Q=a((()=>{const{left:e}=S.data,a={originY:z.value+j.value[0]*T.value,endY:q.value-j.value[1]*T.value};return 0===J.value&&e.yScaleValue.length>1?a.endY=a.originY+K.value:J.value===e.yScaleValue.length-1&&(a.originY=a.endY-K.value),a})),U=a((()=>{const{left:e}=S.data,a={originY:z.value+V.value[0]*T.value,endY:q.value-V.value[2]*T.value};return 0===J.value&&e.yScaleValue.length>1?a.originY=Q.value.endY+V.value[0]*T.value:J.value===e.yScaleValue.length-1&&(a.endY=Q.value.originY-V.value[2]*T.value),a})),Z=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),_=a((()=>{var e;const{left:a,right:t}=S.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ee=e({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...u,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:P.value,operationDaysHeight:L.value,xScalevalueHeight:M.value,childbirthDaysHeight:I.value,topList:Z.value,breathingHeight:N.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:J.value,painHeight:K.value,painOriginY:Q.value,vitalSignsOriginY:U.value,gridXNumber:k.value,gridYNumber:O.value,iconsWidth:A.value,originX:$.value,originY:z.value,endX:R.value,endXLimit:W.value,endY:q.value,xCellWidth:G.value,yCellHeight:T.value,xScaleList:B.value,event:E.value,itemList:F.value,getRightInfo:_.value,config:S.data.config||{},surplusCell:V.value,painSurplusCell:j.value,mainSurplusCell:H.value}),{computedX:ae,computedY:te,getXValue:le,getYValue:ue}=i(ee);return t((()=>y.value),(e=>{e&&function(){c(y,ee);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=g(y,ee,w,ae,te,le,ue,S.addRenderItem,Y,D);C.redrawPoints=l,C.clickMenu=u;const{drawScaleValue:o}=h(y,ee,w,e,Y,ae,te,le,ue,a,t,i);p(y,ee,o),m(y,ee),f(y,ee,w,ae,te,r);const{select:s}=n(y,ee,w);C.select=s}()}),{immediate:!0}),{propItems:ee,...l(C)}}export{y as useTemperatureChart};
1
+ import{reactive as e,computed as a,watch as t,toRefs as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,isOneLine as o,getFloorNumber as s}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as d,addDays as c}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as h}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as g}from"./useRight.js";import{useCenter as m}from"./useCenter.js";import{useBottom as f}from"./useBottom.js";import{useOther as y}from"./useOther.js";function S(S,w,b,Y,D,x){const C=15,j=e({select:null,redrawPoints:null,clickMenu:null}),V=a((()=>{const{painSurplusCell:e=[0,0]}=w.data.grid||{};return~K.value?e:[0,0]})),H=a((()=>{var e,a;const t=(null==(a=null==(e=w.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===K.value?t[0]=t[0]+V.value[1]:K.value>0&&(t[2]=t[2]+V.value[0]),t})),X=a((()=>0===K.value?[V.value[0],H.value[1],H.value[2],H.value[3]]:K.value>0?[H.value[0],H.value[1],V.value[1],H.value[3]]:H.value)),L=a((()=>{const{top:e}=w.data;return e.date.show&&(e.date.height||C)||0})),P=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||C)||0})),M=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||C)||0})),I=a((()=>{var e,a,t;const{top:l}=w.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),N=a((()=>{var e;const{top:a}=w.data;return(null==(e=a.childbirthDays)?void 0:e.show)&&(a.childbirthDays.height||C)||0})),O=a((()=>{var e;const{bottom:a}=w.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),k=a((()=>{const{grid:e}=w.data;return e.mainXCell*e.subXCell+H.value[1]+H.value[3]})),R=a((()=>{const{grid:e}=w.data,a=K.value>0?V.value[1]:V.value[0];return e.mainYCell*e.subYCell+H.value[0]+H.value[2]+a})),W=a((()=>{var e;const{width:a,right:t=null,top:l}=w.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),$=a((()=>W.value-H.value[1]*T.value)),q=a((()=>{const{top:e,left:a}=w.data;return e.titleWidth+B.value})),z=a((()=>{const{bottom:e=null,height:a}=w.data;if(!e)return a;return a-(e.height||30)})),G=a((()=>{var e;const{top:a}=w.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||C)||0;return L.value+t+l+P.value+M.value+N.value})),T=a((()=>(W.value-q.value)/k.value)),A=a((()=>(z.value-G.value)/R.value)),B=a((()=>{var e,a;const{left:t}=w.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=q.value-T.value;const r=t.date.startDate||d(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(d(c(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=T.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+T.value/2,scaleCell:(l-t)/T.value}}))));return v(o)})),F=a((()=>{var e;return(null==(e=w.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),J=a((()=>{const{left:e}=w.data;return v(e.yScaleValue.filter((e=>e.show)).map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t,isOneLine:o(e)}))))))})),K=a((()=>{const{left:e}=w.data,a=e.yScaleValue.findIndex((e=>"pain"===e.type));return a>-1&&e.yScaleValue[a].show?a:-1})),Q=a((()=>{const{grid:e}=w.data;return-1===K.value?0:A.value*e.subYCell})),U=a((()=>{const{left:e}=w.data,a={originY:G.value+V.value[0]*A.value,endY:z.value-V.value[1]*A.value};return 0===K.value&&e.yScaleValue.length>1?a.endY=a.originY+Q.value:K.value===e.yScaleValue.length-1&&(a.originY=a.endY-Q.value),a})),Z=a((()=>{const{left:e}=w.data,a={originY:G.value+H.value[0]*A.value,endY:z.value-H.value[2]*A.value};return 0===K.value&&e.yScaleValue.length>1?a.originY=U.value.endY+H.value[0]*A.value:K.value===e.yScaleValue.length-1&&(a.endY=U.value.originY-H.value[2]*A.value),a})),_=a((()=>{var e,a;const{top:t,grid:l}=w.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),ee=a((()=>{var e;const{left:a,right:t}=w.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>s(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ae=e({canvasWidth:w.data.width,canvasHeight:w.data.height,borderStyle:{...u,...w.data.borderStyle||{}},selectionStyle:w.data.selectionStyle||{},dateHeight:L.value,hospitalDaysHeight:P.value,operationDaysHeight:M.value,xScalevalueHeight:I.value,childbirthDaysHeight:N.value,topList:_.value,breathingHeight:O.value,hospitalizationDate:w.data.hospitalizationDate,grid:w.data.grid,top:w.data.top,left:w.data.left,right:w.data.right,bottom:w.data.bottom,other:w.data.other,painIndex:K.value,painHeight:Q.value,painOriginY:U.value,vitalSignsOriginY:Z.value,gridXNumber:k.value,gridYNumber:R.value,iconsWidth:B.value,originX:q.value,originY:G.value,endX:W.value,endXLimit:$.value,endY:z.value,xCellWidth:T.value,yCellHeight:A.value,xScaleList:E.value,event:F.value,itemList:J.value,getRightInfo:ee.value,config:w.data.config||{},surplusCell:H.value,painSurplusCell:V.value,mainSurplusCell:X.value}),{computedX:te,computedY:le,getXValue:ue,getYValue:ie}=i(ae);return t((()=>S.value),(e=>{e&&function(){h(S,ae);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=m(S,ae,b,te,le,ue,ie,w.addRenderItem,D,x);j.redrawPoints=l,j.clickMenu=u;const{drawScaleValue:o}=p(S,ae,b,e,D,te,le,ue,ie,a,t,i);g(S,ae,o),f(S,ae),y(S,ae,b,te,le,r);const{select:s}=n(S,ae,b);j.select=s}()}),{immediate:!0}),{propItems:ae,...l(j)}}export{S as useTemperatureChart};
@@ -2,13 +2,13 @@ import { IPoint, ITreeItem } from '../interface';
2
2
  import { AnyObject } from '../../../../shared/types';
3
3
  export declare function isEffectiveNode(node: IPoint): string | number | boolean;
4
4
  export declare function deleteProperty(data: AnyObject, list: AnyObject[]): {};
5
- export declare function getIndex(time: string, list: AnyObject[]): number;
6
5
  /**
7
6
  * @description: 判断yScaleValue数组内的项类型是否可以连成一条折线,比如温度线
8
7
  * @param {string} type
9
8
  * @return {*}
10
9
  */
11
- export declare function isOneLine(type: string): boolean;
10
+ export declare function isOneLine(scaleItem: AnyObject): any;
11
+ export declare function getIndex(time: string, list: AnyObject[]): number;
12
12
  export declare function setOtherType(title: string, type: string): string;
13
13
  export declare function getType(type: string): string;
14
14
  export declare function isValidValue(value: number | string): boolean;
@@ -1 +1 @@
1
- import{isNull as n,isNumber as t}from"lodash-es";function e(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function r(n,t){const e={};for(const r in n)t.map((n=>n.type)).includes(r)||(e[r]=n[r]);return e}function u(n,t){const e=t.findIndex((t=>p(t.time)>p(n)));return~e?e:t.length}function o(n){return["temperature"].includes(n)}function i(n,t){return n.includes("心率")?"pulse_other":t}function l(n){return n.includes("_other")?n.split("_")[0]:n}function c(t){return!Number.isNaN(+t)&&!n(t)}function f(n,t){return a(n.left,1)===a(t.left,1)&&Math.abs(a(n.top,1)-a(t.top,1))<=2}function a(n,t=100){return Math.floor(n*t)/t}function s(n){let t=0;return n.forEach((n=>{var e;(null==(e=n.children)?void 0:e.length)?t+=s(n.children):t++})),t}function p(n){return n?t(n)?new Date(n).getTime():Date.parse(n.replace(/-/g,"/")):Date.now()}function d(n,t){const e=[],[r,u]=n;t=t||1;for(let n=r;t>0?n<=u:n>=u;n+=t)e.push(n);return e}function h(n){const{width:t,height:e,left:r,top:u}=n,o=t/2,i=e/2;return{minLeft:r-o,maxLeft:r+o,minTop:u-i,maxTop:u+i}}export{r as deleteProperty,s as getChildrenSize,a as getFloorNumber,u as getIndex,h as getPointRange,d as getScaleNumberList,p as getTime,l as getType,e as isEffectiveNode,o as isOneLine,f as isOverlapPoint,c as isValidValue,i as setOtherType};
1
+ import{isNull as t,isNumber as n}from"lodash-es";function e(t){return(null==t?void 0:t.time)&&((null==t?void 0:t.value)||0===(null==t?void 0:t.value))}function r(t,n){const e={};for(const r in t)n.map((t=>t.type)).includes(r)||(e[r]=t[r]);return e}function u(t){return["temperature","pulse"].includes(t.type)&&t.dataList.length&&!!t.dataList.find((t=>t.enable))}function o(t,n){const e=n.findIndex((n=>d(n.time)>d(t)));return~e?e:n.length}function i(t,n){return t.includes("心率")?"pulse_other":n}function l(t){return t.includes("_other")?t.split("_")[0]:t}function c(n){return!Number.isNaN(+n)&&!t(n)}function f(t,n){return a(t.left,1)===a(n.left,1)&&Math.abs(a(t.top,1)-a(n.top,1))<=2}function a(t,n=100){return Math.floor(t*n)/n}function s(t){let n=0;return t.forEach((t=>{var e;(null==(e=t.children)?void 0:e.length)?n+=s(t.children):n++})),n}function d(t){return t?n(t)?new Date(t).getTime():Date.parse(t.replace(/-/g,"/")):Date.now()}function p(t,n){const e=[],[r,u]=t;n=n||1;for(let t=r;n>0?t<=u:t>=u;t+=n)e.push(t);return e}function h(t){const{width:n,height:e,left:r,top:u}=t,o=n/2,i=e/2;return{minLeft:r-o,maxLeft:r+o,minTop:u-i,maxTop:u+i}}export{r as deleteProperty,s as getChildrenSize,a as getFloorNumber,o as getIndex,h as getPointRange,p as getScaleNumberList,d as getTime,l as getType,e as isEffectiveNode,u as isOneLine,f as isOverlapPoint,c as isValidValue,i as setOtherType};
@@ -1928,7 +1928,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1928
1928
  } | undefined;
1929
1929
  display?: "flex" | "grid" | undefined;
1930
1930
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
1931
- wrapperStyle?: Record<string, string> | undefined;
1931
+ wrapperStyle?: Record<string, string | number> | undefined;
1932
1932
  childFieldStrategy?: "checked" | "all" | undefined;
1933
1933
  childWidthMode?: "inner" | "outer" | undefined;
1934
1934
  validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -2176,7 +2176,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2176
2176
  } | undefined;
2177
2177
  display?: "flex" | "grid" | undefined;
2178
2178
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
2179
- wrapperStyle?: Record<string, string> | undefined;
2179
+ wrapperStyle?: Record<string, string | number> | undefined;
2180
2180
  childFieldStrategy?: "checked" | "all" | undefined;
2181
2181
  childWidthMode?: "inner" | "outer" | undefined;
2182
2182
  validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -2395,7 +2395,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2395
2395
  } | undefined;
2396
2396
  display?: "flex" | "grid" | undefined;
2397
2397
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
2398
- wrapperStyle?: Record<string, string> | undefined;
2398
+ wrapperStyle?: Record<string, string | number> | undefined;
2399
2399
  childFieldStrategy?: "checked" | "all" | undefined;
2400
2400
  childWidthMode?: "inner" | "outer" | undefined;
2401
2401
  validator?: ((value: unknown, fieldItem: import("..").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -1931,7 +1931,7 @@ declare const _default: import("vue").DefineComponent<{
1931
1931
  } | undefined;
1932
1932
  display?: "flex" | "grid" | undefined;
1933
1933
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
1934
- wrapperStyle?: Record<string, string> | undefined;
1934
+ wrapperStyle?: Record<string, string | number> | undefined;
1935
1935
  childFieldStrategy?: "checked" | "all" | undefined;
1936
1936
  childWidthMode?: "inner" | "outer" | undefined;
1937
1937
  validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -2179,7 +2179,7 @@ declare const _default: import("vue").DefineComponent<{
2179
2179
  } | undefined;
2180
2180
  display?: "flex" | "grid" | undefined;
2181
2181
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
2182
- wrapperStyle?: Record<string, string> | undefined;
2182
+ wrapperStyle?: Record<string, string | number> | undefined;
2183
2183
  childFieldStrategy?: "checked" | "all" | undefined;
2184
2184
  childWidthMode?: "inner" | "outer" | undefined;
2185
2185
  validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -2398,7 +2398,7 @@ declare const _default: import("vue").DefineComponent<{
2398
2398
  } | undefined;
2399
2399
  display?: "flex" | "grid" | undefined;
2400
2400
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
2401
- wrapperStyle?: Record<string, string> | undefined;
2401
+ wrapperStyle?: Record<string, string | number> | undefined;
2402
2402
  childFieldStrategy?: "checked" | "all" | undefined;
2403
2403
  childWidthMode?: "inner" | "outer" | undefined;
2404
2404
  validator?: ((value: unknown, fieldItem: import("../../../components/form-render").FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -417,7 +417,7 @@ declare const _default: import("vue").DefineComponent<{
417
417
  } | undefined;
418
418
  display?: "flex" | "grid" | undefined;
419
419
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
420
- wrapperStyle?: Record<string, string> | undefined;
420
+ wrapperStyle?: Record<string, string | number> | undefined;
421
421
  childFieldStrategy?: "checked" | "all" | undefined;
422
422
  childWidthMode?: "inner" | "outer" | undefined;
423
423
  validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -665,7 +665,7 @@ declare const _default: import("vue").DefineComponent<{
665
665
  } | undefined;
666
666
  display?: "flex" | "grid" | undefined;
667
667
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
668
- wrapperStyle?: Record<string, string> | undefined;
668
+ wrapperStyle?: Record<string, string | number> | undefined;
669
669
  childFieldStrategy?: "checked" | "all" | undefined;
670
670
  childWidthMode?: "inner" | "outer" | undefined;
671
671
  validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -884,7 +884,7 @@ declare const _default: import("vue").DefineComponent<{
884
884
  } | undefined;
885
885
  display?: "flex" | "grid" | undefined;
886
886
  slots?: Record<string, (...args: unknown[]) => unknown> | undefined;
887
- wrapperStyle?: Record<string, string> | undefined;
887
+ wrapperStyle?: Record<string, string | number> | undefined;
888
888
  childFieldStrategy?: "checked" | "all" | undefined;
889
889
  childWidthMode?: "inner" | "outer" | undefined;
890
890
  validator?: ((value: unknown, fieldItem: FieldItem, field: import("@formily/core").Field<any, any, any, any>) => string | void) | undefined;
@@ -151,7 +151,7 @@ export type FieldItem = {
151
151
  noDecorator: Boolean;
152
152
  display: 'grid' | 'flex';
153
153
  slots: Record<string, (...args: unknown[]) => unknown>;
154
- wrapperStyle: Record<string, string>;
154
+ wrapperStyle: Record<string, string | number>;
155
155
  childFieldStrategy?: 'checked' | 'all';
156
156
  childWidthMode?: 'inner' | 'outer';
157
157
  /**
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as r,unref as a,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as g,createElementVNode as v,createTextVNode as y,withModifiers as h,nextTick as T}from"vue";import{NImageGroup as M,NButton as k,NAvatar as _,NImage as x,NIcon as I,NSpace as C,NButtonGroup as w,NTooltip as S}from"naive-ui";import{format as j}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as L}from"../api/index.js";import{useState as b}from"../hooks/useState.js";import{useSession as A}from"../hooks/useSession.js";import{MESSAGE_TYPE as z}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as H,simplifyMessage as D,getAVTime as R,downloadFile as N}from"../utils/index.js";import{first as O,last as P,toString as q}from"lodash-es";import B from"./PersonProfile.vue.js";import J from"./MessageTemplate.vue.js";import{emojis as W}from"../utils/emoji.js";import U from"./ContextMenu.js";import X from"./ChatAdd.vue.js";import"../../../../shared/utils/index.js";import"@vueuse/core";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{CallOutline as F,VideocamOutline as G,DocumentSharp as K,ChatbubbleEllipsesOutline as Y,EllipsisHorizontal as $,ArrowDownSharp as Q}from"@vicons/ionicons5";import{useScrollLoading as V}from"../../../../shared/hooks/useScrollLoading.js";const Z={key:0,class:"tip-text"},ee={key:1,class:"tip-text"},te={key:2,class:"message-box"},ne={key:0,class:"content-box"},se={class:"name-box"},oe=["data-time"],ie=["onContextmenu"],re={key:0,class:"reference-content"},ae=["innerHTML"],ce=["src"],le=["innerHTML"],ue=["innerHTML"],me={style:{"margin-left":"8px"}},pe={class:"size"};var de=e({__name:"ChatMain",setup(e){const de=t(),{state:fe,setMsgList:ge,relayMessage:ve}=b(),{setCurrentSessionItem:ye,isGroupChat:he}=A(fe),Te=t(),Me=t(!1),ke=t({left:0,top:0}),_e=t(),xe=t(),Ie={page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")},Ce=n((()=>({"--c-tip-top":he.value?"1px":"-20px","--c-tip-gap":he.value?"10px":"0px"})));function we({nodes:e}){var t,n;const{_ctx:s}=null==(t=e.download)?void 0:t.children,o=s?null==(n=null==s?void 0:s.proxy)?void 0:n.previewSrc:"";return[e.prev,e.next,e.rotateCounterclockwise,e.rotateClockwise,e.resizeToOriginalSize,e.zoomOut,e.zoomIn,l(S,null,{trigger:()=>l(I,{style:"cursor: pointer",color:"rgba(255, 255, 255, 0.75",size:24,component:Q,onClick:()=>o&&N(o,"img")},null),default:()=>"下载"}),e.close]}async function Se(){try{if(!Ie.hasMore)return;Ie.page++;const e=await E({sessionKey:fe.currentSessionItem.sessionKey,page:Ie.page,lastSendTime:Ie.lastSendTime});if(!Array.isArray(e)||0===e.length)return Ie.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=O(e).id;Ie.lastSendTime=P(e).sendTime,ge(Ie.page>1?[...fe.msgList,...e]:e),1===Ie.page&&fe.currentSessionItem.unreadNum&&(await L({chatType:fe.currentSessionItem.chatType,messageIdSet:[t],receiver:fe.userInfo.id,sender:fe.currentSessionItem.receiver}),ye({unreadNum:0}))}catch(e){console.log(e)}}async function je(e,t){_e.value=t,async function(e){var t,n,s,o,i,r;Me.value=!0,await T();const{clientX:a,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=de.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=Te.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(r=null==(i=de.value)?void 0:i.scrollTop)?r:0,g=5,v={};a<=m+l/2?v.left=a-m+g+"px":v.right=m+l-a-g+"px";c-p<d/2?v.top=f+g+"px":p+u-c<=d/2?v.bottom=Math.abs(f)+g+"px":v.top=f+c-p-d/2+"px";ke.value=v}(e)}function Ee(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==z.TEMPLATE||!!n}function Le(e){const{chatMessageType:t}=e.content;return e.sender===fe.userInfo.id&&Date.now()-new Date(e.sendTime).getTime()<864e5&&[z.TEXT,z.EMOJI].includes(t)}function be(e){const{chatMessageType:t,msg:n=""}=e.content;if(t===z.BLEND){const e=q(n).match(/<img[^>]*>/gi);return!e||!e.length}return t&&[z.TEXT,z.EMOJI].includes(t)}function Ae(e){const{chatMessageType:t,msg:n=""}=e.content,s=q(n).match(/<img[^>]*>/gi);return t===z.BLEND&&s&&s.length}function ze(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===z.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function He(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===z.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function De(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=fe.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function Re(e){fe.currentReferenceMsg=e,fe.currentReferenceMsg.content.referenceContent=null,Object.assign(fe.currentReferenceMsg,{chatType:fe.currentSessionItem.chatType,receiver:fe.currentSessionItem.receiver,receiverAvatar:fe.currentSessionItem.avatar,receiverName:fe.currentSessionItem.name})}function Ne(e,t){var n;"reply"!==e?"relay"===e&&(null==(n=xe.value)||n.click()):Re(t)}function Oe(e,t){const n=fe.msgList.find((e=>e.id===_e.value));ve({checkedIds:e,remark:t,content:n.content})}return V(de,(()=>{Se()}),"top",(()=>{Me.value=!1})),s((()=>fe.id),(e=>{e&&(fe.currentReferenceMsg=null,Object.assign(Ie,{page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")}),Se())}),{immediate:!0}),s((()=>fe.isAppendMsg),(e=>{e&&(ge([fe.currentMsg,...fe.msgList]),async function(){var e;null==(e=de.value)||e.scrollTo({top:0,behavior:"auto"})}(),fe.isAppendMsg=!1)}),{immediate:!0}),(e,t)=>(o(),i("div",{class:r(["chat-main",{"home-bg":!a(fe).id}]),ref_key:"chatMainRef",ref:de,style:c(a(Ce))},[l(a(M),{"show-toolbar-tooltip":"","render-toolbar":we},{default:u((()=>[(o(!0),i(m,null,p(a(fe).msgList,((e,t)=>(o(),i(m,{key:e.id},[Ee(e)?(o(),i("div",{key:0,class:r(["message-item",{"message-item--mine":e.sender==a(fe).userInfo.id}])},[De(e,t)?(o(),i("p",Z,d(e.__sendTime),1)):f("v-if",!0),ze(e,"system")||"WITHDRAWN"===e.status?(o(),i(m,{key:1},[ze(e,"system")?(o(),g(J,{key:0,data:e},null,8,["data"])):f("v-if",!0),"WITHDRAWN"===e.status?(o(),i("p",ee,[v("span",null,d(e.sender==a(fe).userInfo.id?"你":e.senderName)+"撤回了一条消息",1),Le(e)?(o(),g(a(k),{key:0,size:"tiny",style:{color:"var(--c-primary-color)","margin-left":"5px"},text:"",onClick:()=>function(e){fe.currentReEditMsg=e}(e)},{default:u((()=>[y(" 重新编辑 ")])),_:2},1032,["onClick"])):f("v-if",!0)])):f("v-if",!0)],64)):(o(),i("div",te,[l(B,{"user-id":e.sender,placement:e.sender==a(fe).userInfo.id?"left":"right"},{trigger:u((()=>[l(a(_),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",ne,[v("div",se,[v("span",{class:"name","data-time":e.__time},d(a(he)?e.senderName:""),9,oe)]),v("div",{class:r(["content",{emoji:e.content.chatMessageType===a(z).EMOJI&&!e.content.referenceContent,template:e.content.chatMessageType===a(z).TEMPLATE,"template--3":He(e.content),"audio-video":a(H)(e.content),file:e.content.chatMessageType===a(z).FILE}]),onContextmenu:h((t=>je(t,e.id)),["prevent"])},[be(e)?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",re,[v("span",null,d(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:a(D)(e.content.referenceContent.content)},null,8,ae)])):f("v-if",!0),e.content.chatMessageType===a(z).EMOJI?(o(),i("img",{key:1,class:r([e.content.referenceContent?"emoji--min":"emoji--big"]),src:a(W).findEmoji(e.__content)},null,10,ce)):(o(),i("pre",{key:2,innerHTML:e.__content},null,8,le))],64)):f("v-if",!0),Ae(e)?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,ue)):f("v-if",!0),ze(e,"template")?(o(),g(J,{key:2,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===a(z).IMAGE?(o(),g(a(x),{key:3,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),a(H)(e.content)?(o(),i(m,{key:4},[l(a(I),{class:r({"is-audio":e.content.chatMessageType===a(z).AUDIO}),component:e.content.chatMessageType===a(z).AUDIO?a(F):a(G)},null,8,["class","component"]),v("span",me,d(a(R)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===a(z).FILE?(o(),g(a(C),{key:5,"wrap-item":!1},{default:u((()=>[l(a(I),{class:"icon-file",size:"40",component:a(K)},null,8,["component"]),l(a(C),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[v("span",null,d(e.__content),1),v("span",pe,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(a(w),{class:"quick-menu"},{default:u((()=>[a(H)(e.content)?f("v-if",!0):(o(),i(m,{key:0},[f(' <n-button quaternary size="tiny">\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(a(k),{quaternary:"",size:"tiny",onClick:()=>Re(e)},{icon:u((()=>[l(a(I),{size:"17",component:a(Y)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(a(k),{quaternary:"",size:"tiny",onClick:t=>je(t,e.id)},{icon:u((()=>[l(a(I),{size:"14",component:a($)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,ie)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(a(U),{ref_key:"contextmenuRef",ref:Te,show:Me.value,"onUpdate:show":t[0]||(t[0]=e=>Me.value=e),position:ke.value,"msg-id":_e.value,onSelect:Ne},null,8,["show","position","msg-id"]),l(X,{title:"转发消息",mode:"relay",onComfirm:Oe},{trigger:u((()=>[v("span",{style:{display:"none"},ref_key:"relayTriggerRef",ref:xe},"转发",512)])),_:1})],6))}});export{de as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as r,unref as a,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as g,createElementVNode as v,createTextVNode as y,withModifiers as h,nextTick as T}from"vue";import{NImageGroup as M,NButton as k,NAvatar as _,NImage as x,NIcon as I,NSpace as C,NButtonGroup as w,NTooltip as S}from"naive-ui";import{format as j}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as L}from"../api/index.js";import{useState as b}from"../hooks/useState.js";import{useSession as A}from"../hooks/useSession.js";import{MESSAGE_TYPE as z}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as H,simplifyMessage as D,getAVTime as R,downloadFile as N}from"../utils/index.js";import{first as O,last as P,toString as q}from"lodash-es";import B from"./PersonProfile.vue.js";import J from"./MessageTemplate.vue.js";import{emojis as W}from"../utils/emoji.js";import U from"./ContextMenu.js";import X from"./ChatAdd.vue.js";import"../../../../shared/utils/index.js";import"@vueuse/core";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{CallOutline as F,VideocamOutline as G,DocumentSharp as K,ChatbubbleEllipsesOutline as Y,EllipsisHorizontal as $,ArrowDownSharp as Q}from"@vicons/ionicons5";import{useScrollLoading as V}from"../../../../shared/hooks/useScrollLoading.js";const Z={key:0,class:"tip-text"},ee={key:1,class:"tip-text"},te={key:2,class:"message-box"},ne={key:0,class:"content-box"},se={class:"name-box"},oe=["data-time"],ie=["onContextmenu"],re={key:0,class:"reference-content"},ae=["innerHTML"],ce=["src"],le=["innerHTML"],ue=["innerHTML"],me={style:{"margin-left":"8px"}},pe={class:"size"};var de=e({__name:"ChatMain",setup(e){const de=t(),{state:fe,setMsgList:ge,relayMessage:ve}=b(),{setCurrentSessionItem:ye,isGroupChat:he}=A(fe),Te=t(),Me=t(!1),ke=t({left:0,top:0}),_e=t(),xe=t(),Ie={page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")},Ce=n((()=>({"--c-tip-top":he.value?"1px":"-20px","--c-tip-gap":he.value?"10px":"0px"})));function we({nodes:e}){var t,n;const{_ctx:s}=null==(t=e.download)?void 0:t.children,o=s?null==(n=null==s?void 0:s.proxy)?void 0:n.previewSrc:"";return[e.prev,e.next,e.rotateCounterclockwise,e.rotateClockwise,e.resizeToOriginalSize,e.zoomOut,e.zoomIn,l(S,null,{trigger:()=>l(I,{style:"cursor: pointer",color:"rgba(255, 255, 255, 0.75",size:24,component:Q,onClick:()=>o&&N(o,"img")},null),default:()=>"下载"}),e.close]}async function Se(){try{if(!Ie.hasMore)return;Ie.page++;const e=await E({sessionKey:fe.currentSessionItem.sessionKey,page:Ie.page,lastSendTime:Ie.lastSendTime});if(!Array.isArray(e)||0===e.length)return Ie.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=O(e).id;Ie.lastSendTime=P(e).sendTime,ge(Ie.page>1?[...fe.msgList,...e]:e),1===Ie.page&&fe.currentSessionItem.unreadNum&&(await L({chatType:fe.currentSessionItem.chatType,messageIdSet:[t],receiver:fe.userInfo.id,sender:fe.currentSessionItem.receiver}),ye({unreadNum:0}))}catch(e){console.log(e)}}async function je(e,t){_e.value=t,async function(e){var t,n,s,o,i,r;Me.value=!0,await T();const{clientX:a,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=de.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=Te.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(r=null==(i=de.value)?void 0:i.scrollTop)?r:0,g=5,v={};a<=m+l/2?v.left=a-m+g+"px":v.right=m+l-a-g+"px";c-p<d/2?v.top=f+g+"px":p+u-c<=d/2?v.bottom=Math.abs(f)+g+"px":v.top=f+c-p-d/2+"px";ke.value=v}(e)}function Ee(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==z.TEMPLATE||!!n}function Le(e){const{chatMessageType:t}=e.content;return e.sender===fe.userInfo.id&&Date.now()-new Date(e.sendTime).getTime()<864e5&&[z.TEXT,z.EMOJI].includes(t)}function be(e){const{chatMessageType:t,msg:n=""}=e.content;if(t===z.BLEND){const e=q(n).match(/<img[^>]*>/gi);return!e||!e.length}return t&&[z.TEXT,z.EMOJI].includes(t)}function Ae(e){const{chatMessageType:t,msg:n=""}=e.content,s=q(n).match(/<img[^>]*>/gi);return t===z.BLEND&&s&&s.length}function ze(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===z.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function He(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===z.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function De(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=fe.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function Re(e){fe.currentReferenceMsg=e,fe.currentReferenceMsg.content.referenceContent=null,Object.assign(fe.currentReferenceMsg,{chatType:fe.currentSessionItem.chatType,receiver:fe.currentSessionItem.receiver,receiverAvatar:fe.currentSessionItem.avatar,receiverName:fe.currentSessionItem.name})}function Ne(e,t){var n;"reply"!==e?"relay"===e&&(null==(n=xe.value)||n.click()):Re(t)}function Oe(e,t){const n=fe.msgList.find((e=>e.id===_e.value));ve({checkedIds:e,remark:t,content:n.content})}return V(de,(()=>{Se()}),"top",(()=>{Me.value=!1})),s((()=>fe.id),(e=>{e&&(fe.currentReferenceMsg=null,Object.assign(Ie,{page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")}),Se())}),{immediate:!0}),s((()=>fe.isAppendMsg),(e=>{e&&(ge([fe.currentMsg,...fe.msgList]),async function(){var e;null==(e=de.value)||e.scrollTo({top:0,behavior:"auto"})}(),fe.isAppendMsg=!1)}),{immediate:!0}),(e,t)=>(o(),i("div",{class:r(["chat-main",{"home-bg":!a(fe).id}]),ref_key:"chatMainRef",ref:de,style:c(a(Ce))},[l(a(M),{"show-toolbar-tooltip":"","render-toolbar":we},{default:u((()=>[(o(!0),i(m,null,p(a(fe).msgList,((e,t)=>(o(),i(m,{key:e.id},[Ee(e)?(o(),i("div",{key:0,class:r(["message-item",{"message-item--mine":e.sender==a(fe).userInfo.id}])},[De(e,t)?(o(),i("p",Z,d(e.__sendTime),1)):f("v-if",!0),ze(e,"system")||"WITHDRAWN"===e.status?(o(),i(m,{key:1},[ze(e,"system")?(o(),g(J,{key:0,data:e},null,8,["data"])):f("v-if",!0),"WITHDRAWN"===e.status?(o(),i("p",ee,[v("span",null,d(e.sender==a(fe).userInfo.id?"你":e.senderName)+"撤回了一条消息",1),Le(e)?(o(),g(a(k),{key:0,size:"tiny",style:{color:"var(--c-primary-color)","margin-left":"5px"},text:"",onClick:()=>function(e){fe.currentReEditMsg=e}(e)},{default:u((()=>[y(" 重新编辑 ")])),_:2},1032,["onClick"])):f("v-if",!0)])):f("v-if",!0)],64)):(o(),i("div",te,[l(B,{"user-id":e.sender,placement:e.sender==a(fe).userInfo.id?"left":"right"},{trigger:u((()=>[l(a(_),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",ne,[v("div",se,[v("span",{class:"name","data-time":e.__time},d(a(he)?e.senderName:""),9,oe)]),v("div",{class:r(["content",{emoji:e.content.chatMessageType===a(z).EMOJI&&!e.content.referenceContent,template:e.content.chatMessageType===a(z).TEMPLATE,"template--3":He(e.content),"audio-video":a(H)(e.content),file:e.content.chatMessageType===a(z).FILE}]),onContextmenu:h((t=>je(t,e.id)),["prevent"])},[be(e)?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",re,[v("span",null,d(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:a(D)(e.content.referenceContent.content)},null,8,ae)])):f("v-if",!0),e.content.chatMessageType===a(z).EMOJI?(o(),i("img",{key:1,class:r([e.content.referenceContent?"emoji--min":"emoji--big"]),src:a(W).findEmoji(e.__content)},null,10,ce)):(o(),i("pre",{key:2,innerHTML:e.__content},null,8,le))],64)):f("v-if",!0),Ae(e)?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,ue)):f("v-if",!0),ze(e,"template")?(o(),g(J,{key:2,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===a(z).IMAGE?(o(),g(a(x),{key:3,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),a(H)(e.content)?(o(),i(m,{key:4},[l(a(I),{class:r({"is-audio":e.content.chatMessageType===a(z).AUDIO}),component:e.content.chatMessageType===a(z).AUDIO?a(F):a(G)},null,8,["class","component"]),v("span",me,d(a(R)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===a(z).FILE?(o(),g(a(C),{key:5,"wrap-item":!1},{default:u((()=>[l(a(I),{class:"icon-file",size:"40",component:a(K)},null,8,["component"]),l(a(C),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[v("span",null,d(e.__content),1),v("span",pe,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(a(w),{class:"quick-menu"},{default:u((()=>[a(H)(e.content)?f("v-if",!0):(o(),i(m,{key:0},[f(' <n-button quaternary size="tiny">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(a(k),{quaternary:"",size:"tiny",onClick:()=>Re(e)},{icon:u((()=>[l(a(I),{size:"17",component:a(Y)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(a(k),{quaternary:"",size:"tiny",onClick:t=>je(t,e.id)},{icon:u((()=>[l(a(I),{size:"14",component:a($)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,ie)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(a(U),{ref_key:"contextmenuRef",ref:Te,show:Me.value,"onUpdate:show":t[0]||(t[0]=e=>Me.value=e),position:ke.value,"msg-id":_e.value,onSelect:Ne},null,8,["show","position","msg-id"]),l(X,{title:"转发消息",mode:"relay",onComfirm:Oe},{trigger:u((()=>[v("span",{style:{display:"none"},ref_key:"relayTriggerRef",ref:xe},"转发",512)])),_:1})],6))}});export{de as default};
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,reactive as a,computed as o,openBlock as l,createBlock as n,unref as s,withCtx as r,renderSlot as i,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,createCommentVNode as v,toDisplayString as f,createTextVNode as g,renderList as y,vShow as k}from"vue";import{NPopover as h,NAvatar as b,NButton as w,NIcon as j}from"naive-ui";import{ChatbubbleEllipses as C,EyeOffOutline as I,EyeOutline as _,Close as x}from"@vicons/ionicons5";import{useState as z}from"../hooks/useState.js";import{useSession as N}from"../hooks/useSession.js";import{CHAT_TYPE as S}from"../constants/index.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import"../../../../shared/utils/index.js";import{openSessionApi as $,getUserDetailApi as D}from"../api/index.js";const E={class:"person-profile-main"},L={class:"left"},P={class:"profile"},q={class:"profile__text"},B={class:"right"},G={class:"right__content"},O={class:"label"},T={class:"content"};var U=t({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:U}){const A=t,{state:F}=z(),{openSession:H}=N(F),J=e(!1),K=e(!1),M=e(!1),Q=a({}),R=[{label:"机构",value:"",key:"orgName"},{label:"姓名",value:"",key:"name"},{label:"归属科室",value:"",key:"deptName"},{label:"业务科室",value:"",key:"businessDeptNames"},{label:"手机号",value:"",key:"phone"},{label:"岗位",value:"",key:"post"},{label:"工号",value:"",key:"jobId"},{label:"性别",value:"",key:"orgName"}],V=o((()=>(Q.id&&R.forEach((t=>{const{key:e}=t;t.value=Q[e]})),R)));async function W(){J.value=!1;let t=F.sessionList.find((t=>t.receiver===A.userId));if(!t)try{t=await $({chatType:S.SINGLE,receiver:A.userId,sender:F.userInfo.id})}catch(t){console.log("error :>> ",t)}t&&H(t),U("close")}async function X(t){if(!t)return;const e=await D({userId:A.userId});(null==e?void 0:e.id)?Object.assign(Q,e):Q.id=""}function Y(t){const{key:e,value:a}=t;return"phone"!==e||M.value?a:(a||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}return(e,a)=>(l(),n(s(h),{raw:"",class:"person-profile-wrapper",show:J.value,"onUpdate:show":[a[3]||(a[3]=t=>J.value=t),X],trigger:t.disabled?"manual":"click","show-arrow":!1,to:"body",shift:""},{trigger:r((()=>[i(e.$slots,"trigger")])),default:r((()=>[Q.id?(l(),c(u,{key:0},[d(p("div",E,[p("div",L,[p("div",P,[m(s(b),{src:Q.avatar,bordered:"",round:"",size:100,onClickCapture:a[0]||(a[0]=t=>K.value=!0)},null,8,["src"]),v(' <n-upload abstract accept="image/*" @change="onChange">\n\t\t\t\t\t\t\t<n-upload-trigger #="{ handleClick }" abstract>\n\t\t\t\t\t\t\t\t<n-button\n\t\t\t\t\t\t\t\t\tcircle\n\t\t\t\t\t\t\t\t\tsecondary\n\t\t\t\t\t\t\t\t\tclass="edit-avatar"\n\t\t\t\t\t\t\t\t\tv-show="userDetail.id === state.userInfo.id"\n\t\t\t\t\t\t\t\t\t@click="handleClick"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t<n-icon size="16" color="#666666" :component="Camera" />\n\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t</n-button>\n\t\t\t\t\t\t\t</n-upload-trigger>\n\t\t\t\t\t\t</n-upload> '),p("div",q,[p("h4",null,f(Q.name),1),p("p",null,f(Q.orgName),1)]),m(s(w),{strong:"",secondary:"",onClick:W},{default:r((()=>[m(s(j),{size:"13",color:"#666666",component:s(C),style:{"margin-right":"6px"}},null,8,["component"]),g(" 发消息 ")])),_:1})])]),p("div",B,[p("div",G,[(l(!0),c(u,null,y(s(V),((t,e)=>(l(),c("div",{class:"info-item",key:e},[p("span",O,f(t.label),1),p("div",T,[p("span",null,f(Y(t)),1),"phone"===t.key&&Y(t)?(l(),n(s(j),{key:0,size:"16",color:"#666666",component:M.value?s(I):s(_),style:{"margin-left":"10px"},onClick:a[1]||(a[1]=t=>M.value=!M.value)},null,8,["component"])):v("v-if",!0)])])))),128))])])],512),[[k,!K.value]]),d(p("div",{class:"large-avatar",onClick:a[2]||(a[2]=t=>K.value=!1)},[m(s(w),{circle:"",size:"small",secondary:""},{icon:r((()=>[m(s(j),{size:24,component:s(x),color:"#fff"},null,8,["component"])])),_:1}),m(s(b),{size:310,round:"",src:Q.avatar},null,8,["src"])],512),[[k,K.value]])],64)):v("v-if",!0)])),_:3},8,["show","trigger"]))}});export{U as default};
1
+ import{defineComponent as t,ref as e,reactive as a,computed as o,openBlock as l,createBlock as r,unref as n,withCtx as s,renderSlot as i,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,createCommentVNode as v,toDisplayString as f,createTextVNode as g,renderList as y,vShow as k}from"vue";import{NPopover as h,NAvatar as b,NButton as w,NIcon as j}from"naive-ui";import{ChatbubbleEllipses as C,EyeOffOutline as I,EyeOutline as _,Close as x}from"@vicons/ionicons5";import{useState as z}from"../hooks/useState.js";import{useSession as N}from"../hooks/useSession.js";import{CHAT_TYPE as S}from"../constants/index.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import"../../../../shared/utils/index.js";import{openSessionApi as $,getUserDetailApi as D}from"../api/index.js";const E={class:"person-profile-main"},L={class:"left"},P={class:"profile"},q={class:"profile__text"},B={class:"right"},G={class:"right__content"},O={class:"label"},T={class:"content"};var U=t({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:U}){const A=t,{state:F}=z(),{openSession:H}=N(F),J=e(!1),K=e(!1),M=e(!1),Q=a({}),R=[{label:"机构",value:"",key:"orgName"},{label:"姓名",value:"",key:"name"},{label:"归属科室",value:"",key:"deptName"},{label:"业务科室",value:"",key:"businessDeptNames"},{label:"手机号",value:"",key:"phone"},{label:"岗位",value:"",key:"post"},{label:"工号",value:"",key:"jobId"},{label:"性别",value:"",key:"orgName"}],V=o((()=>(Q.id&&R.forEach((t=>{const{key:e}=t;t.value=Q[e]})),R)));async function W(){J.value=!1;let t=F.sessionList.find((t=>t.receiver===A.userId));if(!t)try{t=await $({chatType:S.SINGLE,receiver:A.userId,sender:F.userInfo.id})}catch(t){console.log("error :>> ",t)}t&&H(t),U("close")}async function X(t){if(!t)return;const e=await D({userId:A.userId});(null==e?void 0:e.id)?Object.assign(Q,e):Q.id=""}function Y(t){const{key:e,value:a}=t;return"phone"!==e||M.value?a:(a||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}return(e,a)=>(l(),r(n(h),{raw:"",class:"person-profile-wrapper",show:J.value,"onUpdate:show":[a[3]||(a[3]=t=>J.value=t),X],trigger:t.disabled?"manual":"click","show-arrow":!1,to:"body",shift:""},{trigger:s((()=>[i(e.$slots,"trigger")])),default:s((()=>[Q.id?(l(),c(u,{key:0},[d(p("div",E,[p("div",L,[p("div",P,[m(n(b),{src:Q.avatar,bordered:"",round:"",size:100,onClickCapture:a[0]||(a[0]=t=>K.value=!0)},null,8,["src"]),v(' <n-upload abstract accept="image/*" @change="onChange">\r\n\t\t\t\t\t\t\t<n-upload-trigger #="{ handleClick }" abstract>\r\n\t\t\t\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t\t\t\tcircle\r\n\t\t\t\t\t\t\t\t\tsecondary\r\n\t\t\t\t\t\t\t\t\tclass="edit-avatar"\r\n\t\t\t\t\t\t\t\t\tv-show="userDetail.id === state.userInfo.id"\r\n\t\t\t\t\t\t\t\t\t@click="handleClick"\r\n\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t<n-icon size="16" color="#666666" :component="Camera" />\r\n\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t</n-button>\r\n\t\t\t\t\t\t\t</n-upload-trigger>\r\n\t\t\t\t\t\t</n-upload> '),p("div",q,[p("h4",null,f(Q.name),1),p("p",null,f(Q.orgName),1)]),m(n(w),{strong:"",secondary:"",onClick:W},{default:s((()=>[m(n(j),{size:"13",color:"#666666",component:n(C),style:{"margin-right":"6px"}},null,8,["component"]),g(" 发消息 ")])),_:1})])]),p("div",B,[p("div",G,[(l(!0),c(u,null,y(n(V),((t,e)=>(l(),c("div",{class:"info-item",key:e},[p("span",O,f(t.label),1),p("div",T,[p("span",null,f(Y(t)),1),"phone"===t.key&&Y(t)?(l(),r(n(j),{key:0,size:"16",color:"#666666",component:M.value?n(I):n(_),style:{"margin-left":"10px"},onClick:a[1]||(a[1]=t=>M.value=!M.value)},null,8,["component"])):v("v-if",!0)])])))),128))])])],512),[[k,!K.value]]),d(p("div",{class:"large-avatar",onClick:a[2]||(a[2]=t=>K.value=!1)},[m(n(w),{circle:"",size:"small",secondary:""},{icon:s((()=>[m(n(j),{size:24,component:n(x),color:"#fff"},null,8,["component"])])),_:1}),m(n(b),{size:310,round:"",src:Q.avatar},null,8,["src"])],512),[[k,K.value]])],64)):v("v-if",!0)])),_:3},8,["show","trigger"]))}});export{U as default};
@@ -1 +1 @@
1
- import{defineComponent as e,reactive as o,ref as t,watch as a,nextTick as n,openBlock as s,createElementBlock as i,normalizeClass as l,unref as r,createCommentVNode as m,Fragment as c,createBlock as u,mergeProps as d,createElementVNode as p,normalizeStyle as f,createVNode as v,withCtx as g,renderList as h,toDisplayString as k,createTextVNode as y,resolveDynamicComponent as w,renderSlot as S}from"vue";import b from"./hooks/use-noData.js";import{ScaleViewProps as C}from"./hooks/scaleview-props.js";import{getScaleViewState as D}from"./hooks/scaleview-state.js";import{ScaleViewComputed as E}from"./hooks/scaleview-computed.js";import{ScaleViewInit as j}from"./hooks/scaleview-init.js";import{ScaleViewSubmit as _}from"./hooks/scaleview-submit.js";import{ScaleViewMethods as x}from"./hooks/scaleview-methods.js";import{handleQueryParams as F,isCollection as P}from"./utils/judge-types.js";import{useEvent as q}from"./hooks/use-event.js";import"xe-utils";import"moment";import L from"../../../shared/utils/vexutilsExpand.js";import N from"./components/NoData.vue.js";import R from"./components/EvaluateCountdown.vue.js";import A from"./components/EvaluatePage.vue.js";import M from"./components/AnswerParse.vue.js";import O from"./components/ScaleScore.js";import T from"./components/DescribeContent.vue.js";import{NForm as V,NFormItem as I,NButton as B}from"naive-ui";const J=["innerHTML"],G={key:0,class:"required-text"},W={key:1,class:"evalute-label"},H=["onClick"],Q=p("i",{class:"scale-view-iconfont icon-scale-view-dengpao"},null,-1),$={key:1,class:"footer"};var z=e({__name:"ScaleView",props:C,emits:["onCloseSetting","submitNoRequest","onSubmit","startWriteScale"],setup(e,{expose:C,emit:z}){const K=e,{ScaleViewState:U}=D(),X=o(U),Y=t(null),Z=t(null),ee=t(null),{noDataState:oe,setNoData:te,resetNodata:ae}=b(),ne=F(),{showEvatip:se,isFormBoldOpen:ie,scaleStyle:le,handlePageClass:re,isShowItem:me,handleShowQuestionNumber:ce,hasScore:ue,isPreviewScale:de,showEvaluateEntry:pe,showEvaluateCoundownPage:fe,showScaleFooter:ve,isCancelBtn:ge,isSaveBtn:he,showEvaluateLabel:ke,showAnswerParse:ye,propsConfig:we,evaluatePageProps:Se,evaluateCountdownProps:be,isEvaluetaResSituation:Ce,disableEdit:De,desStart:Ee,desEnd:je,desContent:_e}=E(K,X,{query:ne,scaleViewDom:Y}),{initForm:xe}=j(K,X,z,{query:ne}),{submitMethod:Fe,onSubmitData:Pe,onSubmitForm:qe,handleScoreJson:Le}=_(K,X,z,{query:ne,formRef:ee,countdownDom:Z}),{nextLogicEvent:Ne,handleDynamicDataRelation:Re}=q(K,X),{scaleChange:Ae,labelChange:Me,vodFileList:Oe,writeGuage:Te,closeEvaluateCountdown:Ve,showEvaTipModal:Ie}=x(K,X,z,{nextLogicEvent:Ne,handleDynamicDataRelation:Re,isPreviewScale:de,submitMethod:Fe,isEvaluetaResSituation:Ce,handleScoreJson:Le,disableEdit:De});(()=>{let{id:e}=ne;e&&(X.shareId=e)})();const Be=e=>{try{ae(),xe(e)}catch(e){console.log(e,"--error"),X.spinning=!1,X.hasFrontAddress=!1,te(!0,null==e?void 0:e.resultMsg,null==e?void 0:e.result)}};a((()=>K.ids),((e,o)=>{o?e.guage_id&&e.guage_id!=o.guage_id&&Be(e):e.guage_id&&Be(e)}),{immediate:!0}),a((()=>K.guageData),(e=>{if(!e||!Object.keys(e||{}).length)return;X.form={},X.formArray=[];const o=JSON.parse(JSON.stringify(e));n((()=>{xe(o)}))}),{immediate:!0});const Je=L.debounce(Pe,300),Ge=()=>{z("onCloseSetting")};return C({getScaleData:()=>({...X}),onSubmitForm:qe,cancel:Ge}),(e,o)=>(s(),i("div",{class:l(["c-scale-view-block",{"c-scale-view-block-hasfooter":r(ve)}]),ref_key:"scaleViewDom",ref:Y},[m(' <template v-if="state.spinning">\n <n-spin :show="state.spinning" description="加载中"></n-spin>\n </template> '),X.spinning||X.hasFrontAddress?m("v-if",!0):(s(),i(c,{key:0},[r(oe).noData?(s(),u(N,{key:0,noDataImg:r(oe).noDataImg,noDataTip:r(oe).noDataTip},null,8,["noDataImg","noDataTip"])):(s(),i(c,{key:1},[r(pe)?(s(),u(A,d({key:0},r(Se),{onWriteGuage:r(Te)}),null,16,["onWriteGuage"])):(s(),i(c,{key:1},[r(fe)?(s(),u(R,d({key:0,ref_key:"countdownDom",ref:Z},r(be),{onCloseEvaluateCountdown:r(Ve)}),null,16,["onCloseEvaluateCountdown"])):m("v-if",!0),p("div",{class:l(["scale-container",{"scale-container-nopadding":r(re),"scale-container-hasfooter":r(ve)}]),style:f(r(le))},[r(ue)?(s(),u(r(O),{key:0,config:X.config,maxScore:X.maxScore},null,8,["config","maxScore"])):m("v-if",!0),r(Ee)?(s(),u(T,{key:1,content:r(_e)},null,8,["content"])):m("v-if",!0),v(r(V),{ref_key:"formRef",ref:ee,model:X.form,rules:X.rules,"require-mark-placement":"left",class:"main"},{default:g((()=>[(s(!0),i(c,null,h(X.formArray,((e,o)=>(s(),i(c,{key:(e.id||e.seq)+o},[r(me)(e)?(s(),u(r(I),{key:0,path:e.val_key,"show-label":!r(P)(e.type),class:"c-scle-form-item"},{label:g((()=>[p("span",{class:l({"scale-label-required":r(ie)(e)}),innerHTML:r(ce)(e)},null,10,J),r(ie)(e)?(s(),i("span",G,"(必填)")):m("v-if",!0),r(ke)(e)?(s(),i("span",W,k(r(ke)(e)),1)):m("v-if",!0),r(se)(e)?(s(),i("span",{key:2,class:"evalute-tip",onClick:o=>r(Ie)(e)},[Q,y(" 查看提示 ")],8,H)):m("v-if",!0)])),default:g((()=>[(s(),u(w(e.renderCom),d(r(we)(e,o),{key:(e.id||e.seq)+o,onScaleChange:r(Ae),onOnChange:o=>r(Me)(o,e),onVodFileList:r(Oe)}),null,16,["onScaleChange","onOnChange","onVodFileList"])),r(ye)(e)?(s(),u(M,{key:0,item:e},null,8,["item"])):m("v-if",!0)])),_:2},1032,["path","show-label"])):m("v-if",!0)],64)))),128))])),_:1},8,["model","rules"]),r(je)?(s(),u(T,{key:2,content:r(_e)},null,8,["content"])):m("v-if",!0)],6),r(ve)?(s(),i("div",$,[m(" 分享的链接 隐藏取消按钮 "),r(ge)?(s(),u(r(B),{key:0,onClick:Ge},{default:g((()=>[y("取消")])),_:1})):m("v-if",!0),r(he)?(s(),u(r(B),{key:1,onClick:r(Je),disabled:X.banSubmit,type:"primary"},{default:g((()=>[y(" 保存 ")])),_:1},8,["onClick","disabled"])):m("v-if",!0),S(e.$slots,"extendBtn")])):m("v-if",!0)],64))],64))],64))],2))}});export{z as default};
1
+ import{defineComponent as e,reactive as o,ref as t,watch as a,nextTick as n,openBlock as s,createElementBlock as i,normalizeClass as l,unref as r,createCommentVNode as m,Fragment as c,createBlock as u,mergeProps as d,createElementVNode as p,normalizeStyle as f,createVNode as v,withCtx as g,renderList as h,toDisplayString as k,createTextVNode as y,resolveDynamicComponent as w,renderSlot as S}from"vue";import b from"./hooks/use-noData.js";import{ScaleViewProps as C}from"./hooks/scaleview-props.js";import{getScaleViewState as D}from"./hooks/scaleview-state.js";import{ScaleViewComputed as E}from"./hooks/scaleview-computed.js";import{ScaleViewInit as j}from"./hooks/scaleview-init.js";import{ScaleViewSubmit as _}from"./hooks/scaleview-submit.js";import{ScaleViewMethods as x}from"./hooks/scaleview-methods.js";import{handleQueryParams as F,isCollection as P}from"./utils/judge-types.js";import{useEvent as q}from"./hooks/use-event.js";import"xe-utils";import"moment";import L from"../../../shared/utils/vexutilsExpand.js";import N from"./components/NoData.vue.js";import R from"./components/EvaluateCountdown.vue.js";import A from"./components/EvaluatePage.vue.js";import M from"./components/AnswerParse.vue.js";import O from"./components/ScaleScore.js";import T from"./components/DescribeContent.vue.js";import{NForm as V,NFormItem as I,NButton as B}from"naive-ui";const J=["innerHTML"],G={key:0,class:"required-text"},W={key:1,class:"evalute-label"},H=["onClick"],Q=p("i",{class:"scale-view-iconfont icon-scale-view-dengpao"},null,-1),$={key:1,class:"footer"};var z=e({__name:"ScaleView",props:C,emits:["onCloseSetting","submitNoRequest","onSubmit","startWriteScale"],setup(e,{expose:C,emit:z}){const K=e,{ScaleViewState:U}=D(),X=o(U),Y=t(null),Z=t(null),ee=t(null),{noDataState:oe,setNoData:te,resetNodata:ae}=b(),ne=F(),{showEvatip:se,isFormBoldOpen:ie,scaleStyle:le,handlePageClass:re,isShowItem:me,handleShowQuestionNumber:ce,hasScore:ue,isPreviewScale:de,showEvaluateEntry:pe,showEvaluateCoundownPage:fe,showScaleFooter:ve,isCancelBtn:ge,isSaveBtn:he,showEvaluateLabel:ke,showAnswerParse:ye,propsConfig:we,evaluatePageProps:Se,evaluateCountdownProps:be,isEvaluetaResSituation:Ce,disableEdit:De,desStart:Ee,desEnd:je,desContent:_e}=E(K,X,{query:ne,scaleViewDom:Y}),{initForm:xe}=j(K,X,z,{query:ne}),{submitMethod:Fe,onSubmitData:Pe,onSubmitForm:qe,handleScoreJson:Le}=_(K,X,z,{query:ne,formRef:ee,countdownDom:Z}),{nextLogicEvent:Ne,handleDynamicDataRelation:Re}=q(K,X),{scaleChange:Ae,labelChange:Me,vodFileList:Oe,writeGuage:Te,closeEvaluateCountdown:Ve,showEvaTipModal:Ie}=x(K,X,z,{nextLogicEvent:Ne,handleDynamicDataRelation:Re,isPreviewScale:de,submitMethod:Fe,isEvaluetaResSituation:Ce,handleScoreJson:Le,disableEdit:De});(()=>{let{id:e}=ne;e&&(X.shareId=e)})();const Be=e=>{try{ae(),xe(e)}catch(e){console.log(e,"--error"),X.spinning=!1,X.hasFrontAddress=!1,te(!0,null==e?void 0:e.resultMsg,null==e?void 0:e.result)}};a((()=>K.ids),((e,o)=>{o?e.guage_id&&e.guage_id!=o.guage_id&&Be(e):e.guage_id&&Be(e)}),{immediate:!0}),a((()=>K.guageData),(e=>{if(!e||!Object.keys(e||{}).length)return;X.form={},X.formArray=[];const o=JSON.parse(JSON.stringify(e));n((()=>{xe(o)}))}),{immediate:!0});const Je=L.debounce(Pe,300),Ge=()=>{z("onCloseSetting")};return C({getScaleData:()=>({...X}),onSubmitForm:qe,cancel:Ge}),(e,o)=>(s(),i("div",{class:l(["c-scale-view-block",{"c-scale-view-block-hasfooter":r(ve)}]),ref_key:"scaleViewDom",ref:Y},[m(' <template v-if="state.spinning">\r\n <n-spin :show="state.spinning" description="加载中"></n-spin>\r\n </template> '),X.spinning||X.hasFrontAddress?m("v-if",!0):(s(),i(c,{key:0},[r(oe).noData?(s(),u(N,{key:0,noDataImg:r(oe).noDataImg,noDataTip:r(oe).noDataTip},null,8,["noDataImg","noDataTip"])):(s(),i(c,{key:1},[r(pe)?(s(),u(A,d({key:0},r(Se),{onWriteGuage:r(Te)}),null,16,["onWriteGuage"])):(s(),i(c,{key:1},[r(fe)?(s(),u(R,d({key:0,ref_key:"countdownDom",ref:Z},r(be),{onCloseEvaluateCountdown:r(Ve)}),null,16,["onCloseEvaluateCountdown"])):m("v-if",!0),p("div",{class:l(["scale-container",{"scale-container-nopadding":r(re),"scale-container-hasfooter":r(ve)}]),style:f(r(le))},[r(ue)?(s(),u(r(O),{key:0,config:X.config,maxScore:X.maxScore},null,8,["config","maxScore"])):m("v-if",!0),r(Ee)?(s(),u(T,{key:1,content:r(_e)},null,8,["content"])):m("v-if",!0),v(r(V),{ref_key:"formRef",ref:ee,model:X.form,rules:X.rules,"require-mark-placement":"left",class:"main"},{default:g((()=>[(s(!0),i(c,null,h(X.formArray,((e,o)=>(s(),i(c,{key:(e.id||e.seq)+o},[r(me)(e)?(s(),u(r(I),{key:0,path:e.val_key,"show-label":!r(P)(e.type),class:"c-scle-form-item"},{label:g((()=>[p("span",{class:l({"scale-label-required":r(ie)(e)}),innerHTML:r(ce)(e)},null,10,J),r(ie)(e)?(s(),i("span",G,"(必填)")):m("v-if",!0),r(ke)(e)?(s(),i("span",W,k(r(ke)(e)),1)):m("v-if",!0),r(se)(e)?(s(),i("span",{key:2,class:"evalute-tip",onClick:o=>r(Ie)(e)},[Q,y(" 查看提示 ")],8,H)):m("v-if",!0)])),default:g((()=>[(s(),u(w(e.renderCom),d(r(we)(e,o),{key:(e.id||e.seq)+o,onScaleChange:r(Ae),onOnChange:o=>r(Me)(o,e),onVodFileList:r(Oe)}),null,16,["onScaleChange","onOnChange","onVodFileList"])),r(ye)(e)?(s(),u(M,{key:0,item:e},null,8,["item"])):m("v-if",!0)])),_:2},1032,["path","show-label"])):m("v-if",!0)],64)))),128))])),_:1},8,["model","rules"]),r(je)?(s(),u(T,{key:2,content:r(_e)},null,8,["content"])):m("v-if",!0)],6),r(ve)?(s(),i("div",$,[m(" 分享的链接 隐藏取消按钮 "),r(ge)?(s(),u(r(B),{key:0,onClick:Ge},{default:g((()=>[y("取消")])),_:1})):m("v-if",!0),r(he)?(s(),u(r(B),{key:1,onClick:r(Je),disabled:X.banSubmit,type:"primary"},{default:g((()=>[y(" 保存 ")])),_:1},8,["onClick","disabled"])):m("v-if",!0),S(e.$slots,"extendBtn")])):m("v-if",!0)],64))],64))],64))],2))}});export{z as default};