cnhis-design-vue 3.2.7-beta.0 → 3.2.7-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) 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/field-set/src/FieldSet.vue.d.ts +1 -1
  5. package/es/components/form-render/src/components/renderer/combination/tableCombination.js +1 -1
  6. package/es/components/iho-chat/index.d.ts +0 -1
  7. package/es/components/iho-chat/src/Index.vue.d.ts +0 -1
  8. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  9. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +1 -2
  10. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  11. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  12. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  13. package/es/components/iho-chat/src/hooks/useState.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/env.d.ts +25 -25
  17. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  18. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  19. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  20. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  21. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  22. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  23. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  24. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  25. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  26. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  27. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  28. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  29. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  30. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  31. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  32. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  33. package/es/shared/assets/img/failure.png.js +1 -1
  34. package/es/shared/assets/img/no-permission.png.js +1 -1
  35. package/es/shared/assets/img/nodata.png.js +1 -1
  36. package/es/shared/assets/img/notfound.png.js +1 -1
  37. package/es/shared/assets/img/qr.png.js +1 -1
  38. package/es/shared/assets/img/success.png.js +1 -1
  39. package/es/shared/assets/img/table_style_2.png.js +1 -1
  40. package/es/shared/assets/img/video.png.js +1 -1
  41. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  42. package/es/shared/assets/img/xb_big.png.js +1 -1
  43. package/es/shared/assets/img/xb_small.png.js +1 -1
  44. package/es/shared/package.json.js +1 -1
  45. package/package.json +2 -2
  46. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  47. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  48. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  49. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  50. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  51. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  52. 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 s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,P,V,C,A,R,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie}=$,ne=new Set,oe=["xinmai","mai"],le=new Map,se=new Set,re=new Set,ue=new Set,ae=x(F.yScaleValue),ce=new Set;function de(t){var o;const l=ae.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ne.size&&E.value.remove(...ne),ne.clear(),le.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=le.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 le)t.push(e[1]),e[0]===oe[0]&&e[1].forEach((e=>{(le.get(oe[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ue).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)===oe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ne.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),ne.add(n)}))}E.value.add(...e)}ne.add(l),E.value.add(l)}))}}function pe(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:V=!1}=j,A=[],I=[],X=[];let D=null;const z=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ve(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const F=d(a)?L.find((e=>e.key===u.key)):e,_=ge(z(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?ge(z(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=F;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!_||!N||f(_[0],1)!==f(N[0],1))_&&D&&(_[0]=D),D=null;else{const e=_[0]-W/2;_[0]=e+W/4,N[0]=D=_[0]+W/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:z(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(_,u,F),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ve(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,Y,E;if(t.noRise&&p.show){const i=M(p,t)?P(a,S,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||ue.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&ce.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(Y=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(Y)),h(t.physicsReduce)||h(t.drugReduce)){const l=P(a,S,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(E=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(E))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:Y,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:E,top:(m?-q:0)-5}})}(_,u,F,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(_,u,F,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=fe(a,e.list[u].value),L=l&&fe(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:z(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||V)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],P={origin:{data:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:z(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?P.leftLine.set("x2",n[0]):P.leftLine=null,p=o(M,{left:n[0],top:w?n[1]-5:n[1],...P}));I.push(f),p&&(x===oe[1]?se.add(p):re.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{he(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),de(e)}(e),Q.hovered&&he(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),me(n,"change")}}))}(p),A.push(p),ue.add(p))}(_,N,u,j,F,K)})),"pulse"===a){const{key:t}=e;let i=null;le.set(t,A.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const F=I.filter((e=>e));E.value.add(...F,...A,...X)}function fe(e,t){return"pain"===e&&0==t}function he(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||V(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:C(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ve(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function ge(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ve(e.time))return;const n=T(e.time),o=P(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(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(`${V(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function me(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ae.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;xe()}function xe(){var e;ue.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}([...ue]))),ue.clear(),be()}function be(e){le.clear(),ue.clear(),se.clear(),ce.clear(),re.clear(),ae.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||pe(e,i,t)}))})),de(),[...ue].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ae.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];se.size&&[...se].forEach((e=>{[...re].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ue.add(e)}))}))}()}return be((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=P(e.type,e.list,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([...ue],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(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:V(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),me(r,"change")}else{const t={data:{time:V(e.pointer.x),value:C(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),me(t)}},setPopup:he,isAddPoint:ye,updateData:me,redrawPoints:xe,gridPoints:ue,fixedNoRisePoints:ce}}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 s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,P,C,A,R,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie}=$,ne=new Set,oe=["xinmai","mai"],le=new Map,se=new Set,re=new Set,ue=new Set,ae=x(F.yScaleValue),ce=new Set;function de(t){var o;const l=ae.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ne.size&&E.value.remove(...ne),ne.clear(),le.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=le.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 le)t.push(e[1]),e[0]===oe[0]&&e[1].forEach((e=>{(le.get(oe[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ue).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)===oe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ne.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),ne.add(n)}))}E.value.add(...e)}ne.add(l),E.value.add(l)}))}}function pe(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:P=!1}=j,A=[],I=[],X=[];let D=null;const z=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ve(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const F=d(a)?L.find((e=>e.key===u.key)):e,_=ge(z(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?ge(z(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=F;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!_||!N||f(_[0],1)!==f(N[0],1))_&&D&&(_[0]=D),D=null;else{const e=_[0]-W/2;_[0]=e+W/4,N[0]=D=_[0]+W/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:z(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(_,u,F),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ve(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,Y,E;if(t.noRise&&p.show){const i=M(p,t)?V(a,S,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||ue.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&ce.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(Y=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(Y)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,S,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(E=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(E))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:Y,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:E,top:(m?-q:0)-5}})}(_,u,F,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(_,u,F,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=fe(a,e.list[u].value),L=l&&fe(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:z(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||P)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:z(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:z(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w?n[1]-5:n[1],...V}));I.push(f),p&&(x===oe[1]?se.add(p):re.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{he(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),de(e)}(e),Q.hovered&&he(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),me(n,"change")}}))}(p),A.push(p),ue.add(p))}(_,N,u,j,F,K)})),"pulse"===a){const{key:t}=e;let i=null;le.set(t,A.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const F=I.filter((e=>e));E.value.add(...F,...A,...X)}function fe(e,t){return"pain"===e&&0==t}function he(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:C(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ve(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function ge(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ve(e.time))return;const n=T(e.time),o=V(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(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 me(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ae.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;xe()}function xe(){var e;ue.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}([...ue]))),ue.clear(),be()}function be(e){le.clear(),ue.clear(),se.clear(),ce.clear(),re.clear(),ae.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||pe(e,i,t)}))})),de(),[...ue].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ae.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];se.size&&[...se].forEach((e=>{[...re].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ue.add(e)}))}))}()}return be((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.list,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([...ue],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(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,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),me(r,"change")}else{const t={data:{time:P(e.pointer.x),value:C(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),me(t)}},setPopup:he,isAddPoint:ye,updateData:me,redrawPoints:xe,gridPoints:ue,fixedNoRisePoints:ce}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -725,8 +725,8 @@ declare const _default: import("vue").DefineComponent<{
725
725
  showSeq: boolean;
726
726
  footerFlag: boolean;
727
727
  fieldDescribeMode: "column" | "tooltip";
728
- showSearch: boolean;
729
728
  customColumns: FieldSetColumnItem[];
729
+ showSearch: boolean;
730
730
  showSortPriority: boolean;
731
731
  showHeadFilter: boolean;
732
732
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,onMounted as a,createVNode as t}from"vue";import{arrayed as l}from"../../../../../../shared/utils/index.js";import{isField as u}from"@formily/core";import{connect as i,mapProps as r}from"@formily/vue";import{isArray as n,property as m}from"lodash-es";import"../../../../index.js";import"../../../../../iho-table/index.js";import s from"../../../../../iho-table/src/IhoTable.vue.js";import{useCombination as p}from"./hooks/useCombination.js";import{assignUpdateValue as f}from"../../../utils/schema.js";import{useColumnConfigAdaptor as d}from"../../../../../iho-table/src/hooks/useColumnConfigAdaptor.js";import{useFormField as v}from"../../../hooks/useFormField.js";const c=i(e({name:"FormTableCombination",props:{title:{type:String,default:""},value:{type:Array},maxGroupNum:{type:Number},minGroupNum:{type:Number,default:1},disabled:{type:Boolean},properties:{type:Array,default:()=>[]},combinationItemDeletable:{type:[Boolean,Function],default:!0},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:i}){const{formConfigLikeAdaptor:r}=d(),{fieldList:f,editRules:c}=r({fieldList:e.properties}),{currentGroupNum:b,renderRemoveBtn:h,renderHeader:y}=p(e),j=o({editRules:c}),g=o(e.value);async function C(){b.value++,n(g.value)?g.value.push({}):(g.value=[{}],i("update:value",g.value))}const N=f.concat({alias:"操作",columnName:"operation",width:60,isFixed:2,align:"center",slots:{default:({rowIndex:e})=>h({onClick:()=>async function(e){if(n(g.value))if(b.value>1)b.value--,g.value.splice(e,1);else if(1===g.value.length){const e=g.value[0];f.forEach((o=>{o.columnName&&(o.defaultValue?e[o.columnName]=o.defaultValue:Reflect.deleteProperty(e,o.columnName))}))}}(e)},e)}});a((()=>{if(!n(g.value))return g.value=[{}],void i("update:value",g.value);g.value.length||g.value.push({})}));const{field:x}=v(),k=o();async function F(){if(k.value)return Object.values(await k.value.$table.validate(!0)).map((e=>e.map(m("rule.message")))).join(",")}return a((()=>{if(!u(x.value))return;const e=x.value.validator;x.value.validator=[{validator:F},...e?l(e):[]]})),()=>t("section",{class:"form-render__combination"},[y({onClick:C}),t(s,{ref:k,fieldList:N,tableConfig:j.value,tableData:g.value},null)])}}),r(f));export{c as TABLE_COMBINATION};
1
+ import{defineComponent as e,ref as o,onMounted as a,createVNode as t}from"vue";import{arrayed as l}from"../../../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{connect as u,mapProps as i}from"@formily/vue";import{isArray as n,property as m}from"lodash-es";import"../../../../index.js";import"../../../../../iho-table/index.js";import s from"../../../../../iho-table/src/IhoTable.vue.js";import{useCombination as p}from"./hooks/useCombination.js";import{assignUpdateValue as f}from"../../../utils/schema.js";import{useColumnConfigAdaptor as d}from"../../../../../iho-table/src/hooks/useColumnConfigAdaptor.js";import{useFormField as v}from"../../../hooks/useFormField.js";const c=u(e({name:"FormTableCombination",props:{title:{type:String,default:""},value:{type:Array},maxGroupNum:{type:Number},minGroupNum:{type:Number,default:1},disabled:{type:Boolean},properties:{type:Array,default:()=>[]},combinationItemDeletable:{type:[Boolean,Function],default:!0},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:u}){const{formConfigLikeAdaptor:i}=d(),{fieldList:f,editRules:c}=i({fieldList:e.properties}),{currentGroupNum:b,renderRemoveBtn:h,renderHeader:y}=p(e),j=o({editRules:c}),g=o(e.value);async function C(){b.value++,n(g.value)?g.value.push({}):(g.value=[{}],u("update:value",g.value))}const N=f.concat({alias:"操作",columnName:"operation",width:60,isFixed:2,align:"center",slots:{default:({rowIndex:e})=>h({onClick:()=>async function(e){if(n(g.value))if(b.value>1)b.value--,g.value.splice(e,1);else if(1===g.value.length){const e=g.value[0];f.forEach((o=>{o.columnName&&(o.defaultValue?e[o.columnName]=o.defaultValue:Reflect.deleteProperty(e,o.columnName))}))}}(e)},e)}});a((()=>{if(!n(g.value))return g.value=[{}],void u("update:value",g.value);g.value.length||g.value.push({})}));const{field:x}=v(),k=o();async function F(){if(!k.value)return;const e=await k.value.$table.validate(!0);return e?Object.values(e).map((e=>e.map(m("rule.message")))).join(","):""}return a((()=>{if(!r(x.value))return;const e=x.value.validator;x.value.validator=[{validator:F},...e?l(e):[]]})),()=>t("section",{class:"form-render__combination"},[y({onClick:C}),t(s,{ref:k,fieldList:N,tableConfig:j.value,tableData:g.value},null)])}}),i(f));export{c as TABLE_COMBINATION};
@@ -774,7 +774,6 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
774
774
  }, {
775
775
  show: boolean;
776
776
  }>;
777
- formatTime: typeof import("./src/utils").formatTime;
778
777
  downloadFile: typeof import("./src/utils").downloadFile;
779
778
  simplifyMessage: typeof import("./src/utils").simplifyMessage;
780
779
  isAudioOrVideoMessage: typeof import("./src/utils").isAudioOrVideoMessage;
@@ -779,7 +779,6 @@ declare const _default: import("vue").DefineComponent<{
779
779
  }, {
780
780
  show: boolean;
781
781
  }>;
782
- formatTime: typeof import("./utils").formatTime;
783
782
  downloadFile: typeof import("./utils").downloadFile;
784
783
  simplifyMessage: typeof import("./utils").simplifyMessage;
785
784
  isAudioOrVideoMessage: typeof isAudioOrVideoMessage;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[d(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
1
+ import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[d(' <span>最近使用</span>\r\n\t\t\t\t\t<div class="list-box">\r\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\r\n\t\t\t\t\t\t\t<i>\r\n\t\t\t\t\t\t\t\t<img :src="img" />\r\n\t\t\t\t\t\t\t</i>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t</div> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
@@ -1,5 +1,5 @@
1
1
  import { AnyObject } from '../../../../shared/types';
2
- import { formatTime, downloadFile, simplifyMessage, isAudioOrVideoMessage, getAVTime } from '../utils';
2
+ import { downloadFile, simplifyMessage, isAudioOrVideoMessage, getAVTime } from '../utils';
3
3
  import { MESSAGE_TYPE } from '../constants';
4
4
  declare const _default: import("vue").DefineComponent<{}, {
5
5
  chatMainRef: import("vue").Ref<HTMLElement | undefined>;
@@ -199,7 +199,6 @@ declare const _default: import("vue").DefineComponent<{}, {
199
199
  }, {
200
200
  show: boolean;
201
201
  }>;
202
- formatTime: typeof formatTime;
203
202
  downloadFile: typeof downloadFile;
204
203
  simplifyMessage: typeof simplifyMessage;
205
204
  isAudioOrVideoMessage: typeof isAudioOrVideoMessage;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as m,Fragment as u,renderList as p,toDisplayString as d,createCommentVNode as v,createBlock as f,createElementVNode as y,withModifiers as g}from"vue";import{NImageGroup as T,NAvatar as h,NImage as M,NIcon as k,NButtonGroup as _,NButton as I}from"naive-ui";import{format as S}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as j}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as x}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{formatTime as C,isAudioOrVideoMessage as b,simplifyMessage as H,getAVTime as w,downloadFile as O}from"../utils/index.js";import{first as z,last as D,isNumber as P}from"lodash-es";import q from"./PersonProfile.vue.js";import N from"./MessageTemplate.vue.js";import{emojis as U}from"../utils/emoji.js";import R from"./ContextMenu.js";import{useScrollLoading as G}from"../hooks/useScrollLoading.js";import{CallOutline as J,VideocamOutline as K,ChatbubbleEllipsesOutline as F,EllipsisHorizontal as X}from"@vicons/ionicons5";const B={key:0,class:"time"},Q={key:2,class:"message-box"},V={key:0,class:"content-box"},W={class:"name-box"},Y=["data-time"],Z={key:0,class:"reference-content"},$=["innerHTML"],ee=["innerHTML"],te=["src"],ne={style:{"margin-left":"8px"}},se=["href","onClick"],oe=y("i",{class:"chat--iconfont chat--icon-face"},null,-1);var ie=e({__name:"ChatMain",setup(e){const ie=t(),{state:ae,setMsgList:re}=L(),{setCurrentSessionItem:ce,isGroupChat:le}=x(ae),me=t(!1),ue={page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")},pe=n((()=>({"--c-tip-top":le.value?"1px":"-20px","--c-tip-gap":le.value?"10px":"0px"})));async function de(){try{if(!ue.hasMore)return;ue.page++;const e=await E({sessionKey:ae.currentSessionItem.sessionKey,page:ue.page,lastSendTime:ue.lastSendTime});if(!Array.isArray(e)||0===e.length)return ue.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=z(e).id;ue.lastSendTime=D(e).sendTime,re(ue.page>1?[...e,...ae.msgList]:e),1===ue.page&&ae.currentSessionItem.unreadNum&&(await j({chatType:ae.currentSessionItem.chatType,messageIdSet:[t],receiver:ae.userInfo.id,sender:ae.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}function ve(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function fe(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===A.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 ye(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===A.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function ge(e,t){var n;const s=P(e.sendTime)?e.sendTime:Date.parse(e.sendTime),o=null==(n=ae.msgList[t-1])?void 0:n.sendTime;return s-(0===t?0:P(o)?o:Date.parse(o))>3e5}return G(ie,(()=>{de()}),"top"),s((()=>ae.id),(e=>{e&&(Object.assign(ue,{page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")}),de())}),{immediate:!0}),s((()=>ae.isAppendMsg),(e=>{e&&(re([...ae.msgList,ae.currentMsg]),ae.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ie.value)?void 0:e.scrollHeight)?t:0;null==(n=ie.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(ae).id}]),ref_key:"chatMainRef",ref:ie,style:c(r(pe))},[l(r(T),{"show-toolbar-tooltip":""},{default:m((()=>[(o(!0),i(u,null,p(r(ae).msgList,((e,n)=>(o(),i(u,{key:n},[ve(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ae).userInfo.id}])},[ge(e,n)?(o(),i("p",B,d(r(C)(e.sendTime).recordTime),1)):v("v-if",!0),fe(e,"system")?(o(),f(N,{key:1,data:e},null,8,["data"])):(o(),i("div",Q,[l(q,{"user-id":e.sender},{trigger:m((()=>[l(r(h),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",V,[y("div",W,[y("span",{class:"name","data-time":e.__time},d(r(le)?e.senderName:""),9,Y)]),y("div",{class:a(["content",{emoji:e.content.chatMessageType===r(A).EMOJI,template:e.content.chatMessageType===r(A).TEMPLATE,"template--3":ye(e.content),"audio-video":r(b)(e.content)}]),onContextmenu:t[0]||(t[0]=g((e=>me.value=!0),["prevent"]))},[e.content.chatMessageType===r(A).TEXT?(o(),i(u,{key:0},[e.content.referenceContent?(o(),i("div",Z,[y("span",null,d(e.content.referenceContent.senderName)+":",1),y("pre",{innerHTML:r(H)(e.content.referenceContent.content)},null,8,$)])):v("v-if",!0),y("pre",{innerHTML:e.__content},null,8,ee)],64)):v("v-if",!0),e.content.chatMessageType===r(A).EMOJI?(o(),i("img",{key:1,src:r(U).findEmoji(e.__content)},null,8,te)):v("v-if",!0),fe(e,"template")?(o(),f(N,{key:2,data:e},null,8,["data"])):v("v-if",!0),e.content.chatMessageType===r(A).IMAGE?(o(),f(r(M),{key:3,width:"240",src:e.__content},null,8,["src"])):v("v-if",!0),r(b)(e.content)?(o(),i(u,{key:4},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(A).AUDIO}),component:e.content.chatMessageType===r(A).AUDIO?r(J):r(K)},null,8,["class","component"]),y("span",ne,d(r(w)(e.__content)),1)],64)):v("v-if",!0),e.content.chatMessageType===r(A).FILE?(o(),i("a",{key:5,href:e.content.fileUrl,onClick:g((()=>r(O)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,se)):v("v-if",!0),v(' <div class="quick-menu">\n\t\t\t\t\t\t\t\t\t<n-icon :component="AddCircleOutline" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="ChatbubbleEllipsesOutline" @click="() => setReferenceMsg(item)" />\n\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\n\t\t\t\t\t\t\t\t</div> '),l(r(_),{class:"quick-menu"},{default:m((()=>[l(r(I),{quaternary:"",size:"tiny"},{icon:m((()=>[oe])),_:1}),l(r(I),{quaternary:"",size:"tiny",onClick:()=>{return t=e,ae.currentReferenceMsg=t,void Object.assign(ae.currentReferenceMsg,{chatType:ae.currentSessionItem.chatType,receiver:ae.currentSessionItem.receiver,receiverAvatar:ae.currentSessionItem.avatar,receiverName:ae.currentSessionItem.name});var t}},{icon:m((()=>[l(r(k),{size:"17",component:r(F)},null,8,["component"])])),_:2},1032,["onClick"]),l(r(I),{quaternary:"",size:"tiny"},{icon:m((()=>[l(r(k),{component:r(X)},null,8,["component"])])),_:1})])),_:2},1024)],34)])):v("v-if",!0)]))],2)):v("v-if",!0)],64)))),128))])),_:1}),l(r(R),{show:me.value,"onUpdate:show":t[1]||(t[1]=e=>me.value=e)},null,8,["show"])],6))}});export{ie as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as i,createElementBlock as o,normalizeClass as r,unref as a,normalizeStyle as c,createVNode as l,withCtx as m,Fragment as u,renderList as p,toDisplayString as d,createCommentVNode as v,createBlock as f,createElementVNode as y,withModifiers as g}from"vue";import{NImageGroup as T,NAvatar as h,NImage as M,NIcon as k,NButtonGroup as _,NButton as I}from"naive-ui";import{format as S}from"date-fns";import{getHistoryRecordApi as E,readMessageApi as j}from"../api/index.js";import{useState as L}from"../hooks/useState.js";import{useSession as x}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as C,simplifyMessage as b,getAVTime as w,downloadFile as H}from"../utils/index.js";import{first as O,last as z}from"lodash-es";import D from"./PersonProfile.vue.js";import P from"./MessageTemplate.vue.js";import{emojis as q}from"../utils/emoji.js";import N from"./ContextMenu.js";import{useScrollLoading as U}from"../hooks/useScrollLoading.js";import{CallOutline as R,VideocamOutline as G,ChatbubbleEllipsesOutline as J,EllipsisHorizontal as K}from"@vicons/ionicons5";const F={key:0,class:"time"},X={key:2,class:"message-box"},B={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W={key:0,class:"reference-content"},Y=["innerHTML"],Z=["innerHTML"],$=["src"],ee={style:{"margin-left":"8px"}},te=["href","onClick"],ne=y("i",{class:"chat--iconfont chat--icon-face"},null,-1);var se=e({__name:"ChatMain",setup(e){const se=t(),{state:ie,setMsgList:oe}=L(),{setCurrentSessionItem:re,isGroupChat:ae}=x(ie),ce=t(!1),le={page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")},me=n((()=>({"--c-tip-top":ae.value?"1px":"-20px","--c-tip-gap":ae.value?"10px":"0px"})));async function ue(){try{if(!le.hasMore)return;le.page++;const e=await E({sessionKey:ie.currentSessionItem.sessionKey,page:le.page,lastSendTime:le.lastSendTime});if(!Array.isArray(e)||0===e.length)return le.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=O(e).id;le.lastSendTime=z(e).sendTime,oe(le.page>1?[...e,...ie.msgList]:e),1===le.page&&ie.currentSessionItem.unreadNum&&(await j({chatType:ie.currentSessionItem.chatType,messageIdSet:[t],receiver:ie.userInfo.id,sender:ie.currentSessionItem.receiver}),re({unreadNum:0}))}catch(e){console.log(e)}}function pe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function de(e,t){var n,s;const{chatMessageType:i,messageTemplate:o}=e.content;if(i===A.TEMPLATE)return"system"===t?2==(null==(n=null==o?void 0:o.setting)?void 0:n.style.id):2!=(null==(s=null==o?void 0:o.setting)?void 0:s.style.id)}function ve(e){var t,n;const{chatMessageType:s,messageTemplate:i}=e;return s===A.TEMPLATE&&3==(null==(n=null==(t=null==i?void 0:i.setting)?void 0:t.style)?void 0:n.id)}function fe(e,t){var n;const s=new Date(e.sendTime).getTime(),i=null==(n=ie.msgList[t+1])?void 0:n.sendTime;if(i){return s-new Date(i).getTime()>3e5}return!0}return U(se,(()=>{ue()}),"top"),s((()=>ie.id),(e=>{e&&(Object.assign(le,{page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")}),ue())}),{immediate:!0}),s((()=>ie.isAppendMsg),(e=>{e&&(oe([...ie.msgList,ie.currentMsg]),ie.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=se.value)?void 0:e.scrollHeight)?t:0;null==(n=se.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(i(),o("div",{class:r(["chat-main",{"home-bg":!a(ie).id}]),ref_key:"chatMainRef",ref:se,style:c(a(me))},[l(a(T),{"show-toolbar-tooltip":""},{default:m((()=>[(i(!0),o(u,null,p(a(ie).msgList,((e,n)=>(i(),o(u,{key:e.id},[pe(e)?(i(),o("div",{key:0,class:r(["message-item",{"message-item--mine":e.sender==a(ie).userInfo.id}])},[fe(e,n)?(i(),o("p",F,d(e.__sendTime),1)):v("v-if",!0),de(e,"system")?(i(),f(P,{key:1,data:e},null,8,["data"])):(i(),o("div",X,[l(D,{"user-id":e.sender},{trigger:m((()=>[l(a(h),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(i(),o("div",B,[y("div",Q,[y("span",{class:"name","data-time":e.__time},d(a(ae)?e.senderName:""),9,V)]),y("div",{class:r(["content",{emoji:e.content.chatMessageType===a(A).EMOJI,template:e.content.chatMessageType===a(A).TEMPLATE,"template--3":ve(e.content),"audio-video":a(C)(e.content)}]),onContextmenu:t[0]||(t[0]=g((e=>ce.value=!0),["prevent"]))},[e.content.chatMessageType===a(A).TEXT?(i(),o(u,{key:0},[e.content.referenceContent?(i(),o("div",W,[y("span",null,d(e.content.referenceContent.senderName)+":",1),y("pre",{innerHTML:a(b)(e.content.referenceContent.content)},null,8,Y)])):v("v-if",!0),y("pre",{innerHTML:e.__content},null,8,Z)],64)):v("v-if",!0),e.content.chatMessageType===a(A).EMOJI?(i(),o("img",{key:1,src:a(q).findEmoji(e.__content)},null,8,$)):v("v-if",!0),de(e,"template")?(i(),f(P,{key:2,data:e},null,8,["data"])):v("v-if",!0),e.content.chatMessageType===a(A).IMAGE?(i(),f(a(M),{key:3,width:"240",src:e.__content},null,8,["src"])):v("v-if",!0),a(C)(e.content)?(i(),o(u,{key:4},[l(a(k),{class:r({"is-audio":e.content.chatMessageType===a(A).AUDIO}),component:e.content.chatMessageType===a(A).AUDIO?a(R):a(G)},null,8,["class","component"]),y("span",ee,d(a(w)(e.__content)),1)],64)):v("v-if",!0),e.content.chatMessageType===a(A).FILE?(i(),o("a",{key:5,href:e.content.fileUrl,onClick:g((()=>a(H)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,te)):v("v-if",!0),v(' <div class="quick-menu">\r\n\t\t\t\t\t\t\t\t\t<n-icon :component="AddCircleOutline" />\r\n\t\t\t\t\t\t\t\t\t<n-icon :component="ChatbubbleEllipsesOutline" @click="() => setReferenceMsg(item)" />\r\n\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\r\n\t\t\t\t\t\t\t\t</div> '),l(a(_),{class:"quick-menu"},{default:m((()=>[l(a(I),{quaternary:"",size:"tiny"},{icon:m((()=>[ne])),_:1}),l(a(I),{quaternary:"",size:"tiny",onClick:()=>{return t=e,ie.currentReferenceMsg=t,void Object.assign(ie.currentReferenceMsg,{chatType:ie.currentSessionItem.chatType,receiver:ie.currentSessionItem.receiver,receiverAvatar:ie.currentSessionItem.avatar,receiverName:ie.currentSessionItem.name});var t}},{icon:m((()=>[l(a(k),{size:"17",component:a(J)},null,8,["component"])])),_:2},1032,["onClick"]),l(a(I),{quaternary:"",size:"tiny"},{icon:m((()=>[l(a(k),{component:a(K)},null,8,["component"])])),_:1})])),_:2},1024)],34)])):v("v-if",!0)]))],2)):v("v-if",!0)],64)))),128))])),_:1}),l(a(N),{show:ce.value,"onUpdate:show":t[1]||(t[1]=e=>ce.value=e)},null,8,["show"])],6))}});export{se as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as n,openBlock as t,createElementBlock as s,createElementVNode as i,withDirectives as c,toDisplayString as l,unref as r,vShow as a,createVNode as u,withCtx as d,Fragment as p,renderList as m,createCommentVNode as f,createTextVNode as v,nextTick as E}from"vue";import{NButton as g,NIcon as _}from"naive-ui";import V from"./ChatAdd.vue.js";import{Close as T,Mic as I,MicOff as A,Videocam as h,VideocamOff as R,Call as M,PersonAdd as k}from"@vicons/ionicons5";import"date-fns";import{xor as y}from"lodash-es";import{CHAT_TYPE as w,SUBSCRIBE_MESSAGE_TYPE as b}from"../constants/index.js";import"../utils/emoji.js";import"../api/index.js";import{useVideo as O}from"../hooks/useVideo.js";import N from"trtc-sdk-v5";const x={class:"video-wrapper video-wrapper--multiple"},L={class:"video-header"},C={key:0,class:"video-main"},S={class:"video-main__left"},U=["data-name"],j={class:"video-bottom"},D={class:"btn-group"},$={class:"btn"},z=i("span",{class:"text"},"静音",-1),B={class:"btn"},H=i("span",{class:"text"},"摄像头",-1),P=i("span",{class:"text"},"结束会诊",-1),X={class:"btn"},Y=i("span",{class:"text"},"添加参会人",-1),q={class:"video-main__right"},G=["id","data-name"],F={class:"user"},J={class:"name"},K={key:0,class:"tip"},Q={key:0,class:"calling-box"},W={class:"btn-box"},Z={key:1,class:"opt-btn"},ee={class:"btn"},oe=i("span",null,"拒接",-1),ne={class:"btn"},te=i("span",null,"接听",-1);var se=e({__name:"MultipleVideo",setup(e){const se=o(),ie=o([]),{state:ce,sendMessage:le,trtc:re,voiceOpen:ae,isAudio:ue,isCall:de,startTimer:pe,resetTimer:me,toggleAudio:fe,messageTypeText:ve,timing:Ee,toggleVideo:ge,videocamOpen:_e}=O(),Ve=o(!1),Te=n((()=>de.value?ce.userInfo.name:ce.currentAVMsg.sendName)),Ie=n((()=>{if(!Ve.value)return"";const e=de.value?`(${ie.value.length+1}/${ce.currentAVMsg.checkedIds.length+1})`:"";return`${Te.value}发起的${ve.value}会诊${e} ${Ee.value}`}));function Ae(e){console.log("checkedIds :>> ",e),ce.currentAVMsg.checkedIds.push(...e),he()}function he(){var e;(null==(e=ce.currentAVMsg.checkedIds)?void 0:e.length)&&ce.currentAVMsg.checkedIds.forEach((e=>{le({chatType:w.SINGLE,content:{msg:ce.currentAVMsg.chatMessageType+","+ce.currentAVMsg.strRoomId,chatMessageType:b.AV_STATUS},receiver:e})})),Ve.value||Re()}async function Re(){const e=await N.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(ce.showMultipleVideo=!1);try{if(await re.enterRoom({strRoomId:ce.currentAVMsg.strRoomId,sdkAppId:parseInt(ce.userInfo.sdkAppID),userId:ce.userInfo.id,userSig:ce.userInfo.userSig}),Ve.value=!0,pe(),function(){if(re.on(N.EVENT.ERROR,Oe),re.on(N.EVENT.REMOTE_USER_ENTER,we),re.on(N.EVENT.REMOTE_AUDIO_AVAILABLE,ye),re.on(N.EVENT.REMOTE_USER_EXIT,be),ue.value)return;re.on(N.EVENT.REMOTE_VIDEO_AVAILABLE,ke)}(),await re.startLocalAudio(),ue.value)return;await re.startLocalVideo({view:se.value})}catch(e){console.log("error :>> ",e),ce.showMultipleVideo=!1}}async function Me(){try{if(ce.showMultipleVideo=!1,function(){if(re.off(N.EVENT.ERROR,Oe),re.off(N.EVENT.REMOTE_USER_ENTER,we),re.off(N.EVENT.REMOTE_AUDIO_AVAILABLE,ye),re.off(N.EVENT.REMOTE_USER_EXIT,be),ue.value)return;re.off(N.EVENT.REMOTE_VIDEO_AVAILABLE,ke)}(),await re.exitRoom(),await re.stopLocalAudio(),ue.value)return;await re.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ke(e){const{userId:o,streamType:n}=e;try{n===N.TYPE.STREAM_TYPE_MAIN&&(await E(),await re.startRemoteVideo({userId:o,streamType:n,view:o}))}catch(e){console.log("error :>> ",e)}}function ye(e){const{userId:o}=e;ie.value.includes(o)||ie.value.push(o)}function we(e){const{userId:o}=e;ie.value.push(o),pe()}function be(e){console.log("event :>> 退房",e);const{userId:o}=e;ie.value=y(ie.value,[o])}function Oe(e){console.log("error :>> ",e),ce.showMultipleVideo=!1}return(e,o)=>(t(),s("div",x,[i("div",L,[c(i("span",{class:"title"},l(r(Ie)),513),[[a,Ve.value]]),u(r(g),{quaternary:"",circle:"",color:"#ffffffcc",onClick:Me},{icon:d((()=>[u(r(_),{component:r(T)},null,8,["component"])])),_:1})]),Ve.value?(t(),s("div",C,[i("div",S,[i("div",{ref_key:"selfVideoRef",ref:se,class:"video-view","data-name":r(ce).userInfo.name},null,8,U),i("div",j,[i("div",D,[i("div",$,[u(r(g),{text:"",color:r(ae)?"#fff":"#000",onClick:r(fe)},{icon:d((()=>[u(r(_),{component:r(ae)?r(I):r(A)},null,8,["component"])])),_:1},8,["color","onClick"]),z]),i("div",B,[u(r(g),{text:"",color:r(_e)?"#fff":"#000",disabled:r(ue),onClick:r(ge)},{icon:d((()=>[u(r(_),{component:r(_e)?r(h):r(R)},null,8,["component"])])),_:1},8,["color","disabled","onClick"]),H]),i("div",{class:"btn",onClick:Me},[u(r(g),{circle:"",color:"#f17568",class:"btn--rotate"},{icon:d((()=>[u(r(_),{component:r(M)},null,8,["component"])])),_:1}),P]),u(V,{onComfirm:Ae},{trigger:d((()=>[i("div",X,[u(r(g),{text:"",color:"#fff"},{icon:d((()=>[u(r(_),{component:r(k)},null,8,["component"])])),_:1}),Y])])),_:1})])])]),i("div",q,[(t(!0),s(p,null,m(ie.value,(e=>{return t(),s("div",{key:e,id:e,class:"video-view","data-name":(o=e,(null==(n=ce.userList.find((e=>e.id===o)))?void 0:n.name)||"二狗子")},null,8,G);var o,n})),128))])])):(t(),s(p,{key:1},[i("div",F,[i("span",J,l(r(Te))+"发起的"+l(r(ve))+"会议",1),r(de)?f("v-if",!0):(t(),s("span",K,"邀请你加入"+l(r(ve))+"会议",1))]),r(de)?(t(),s("div",Q,[u(V,{onComfirm:Ae},{trigger:d((()=>[u(r(g),{size:"large",circle:"",color:"#000"},{icon:d((()=>[u(r(_),{component:r(k)},null,8,["component"])])),_:1})])),_:1}),i("p",null,"已邀请共"+l(r(ce).currentAVMsg.checkedIds.length)+"人",1),u(r(g),{size:"large",strong:"",round:"",type:"primary",onClick:he},{default:d((()=>[v("开始会诊")])),_:1}),i("div",W,[u(r(g),{color:"#000",round:""},{icon:d((()=>[u(r(_),{component:r(I)},null,8,["component"])])),_:1}),u(r(g),{color:"#000",round:""},{icon:d((()=>[u(r(_),{component:r(h)},null,8,["component"])])),_:1})])])):(t(),s("div",Z,[i("div",ee,[u(r(g),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>r(ce).showMultipleVideo=!1)},{icon:d((()=>[u(r(_),{size:"30",component:r(M)},null,8,["component"])])),_:1}),oe]),i("div",ne,[u(r(g),{circle:"",color:"#2ac98b",onClick:Re},{icon:d((()=>[u(r(_),{size:"30",component:r(M)},null,8,["component"])])),_:1}),te])]))],64))]))}});export{se as default};
1
+ import{defineComponent as e,ref as o,computed as n,openBlock as t,createElementBlock as s,createElementVNode as i,withDirectives as c,toDisplayString as l,unref as r,vShow as a,createVNode as u,withCtx as d,Fragment as p,renderList as m,createCommentVNode as v,createTextVNode as f,nextTick as E}from"vue";import{NButton as g,NIcon as _}from"naive-ui";import V from"./ChatAdd.vue.js";import{Close as T,Mic as I,MicOff as A,Videocam as h,VideocamOff as R,Call as M,PersonAdd as k}from"@vicons/ionicons5";import{xor as y}from"lodash-es";import"date-fns";import{CHAT_TYPE as w,SUBSCRIBE_MESSAGE_TYPE as b}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import"../api/index.js";import{useVideo as O}from"../hooks/useVideo.js";import N from"trtc-sdk-v5";const x={class:"video-wrapper video-wrapper--multiple"},L={class:"video-header"},C={key:0,class:"video-main"},S={class:"video-main__left"},U=["data-name"],j={class:"video-bottom"},D={class:"btn-group"},$={class:"btn"},z=i("span",{class:"text"},"静音",-1),B={class:"btn"},H=i("span",{class:"text"},"摄像头",-1),P=i("span",{class:"text"},"结束会诊",-1),X={class:"btn"},Y=i("span",{class:"text"},"添加参会人",-1),q={class:"video-main__right"},G=["id","data-name"],F={class:"user"},J={class:"name"},K={key:0,class:"tip"},Q={key:0,class:"calling-box"},W={class:"btn-box"},Z={key:1,class:"opt-btn"},ee={class:"btn"},oe=i("span",null,"拒接",-1),ne={class:"btn"},te=i("span",null,"接听",-1);var se=e({__name:"MultipleVideo",setup(e){const se=o(),ie=o([]),{state:ce,sendMessage:le,trtc:re,voiceOpen:ae,isAudio:ue,isCall:de,startTimer:pe,resetTimer:me,toggleAudio:ve,messageTypeText:fe,timing:Ee,toggleVideo:ge,videocamOpen:_e}=O(),Ve=o(!1),Te=n((()=>de.value?ce.userInfo.name:ce.currentAVMsg.sendName)),Ie=n((()=>{if(!Ve.value)return"";const e=de.value?`(${ie.value.length+1}/${ce.currentAVMsg.checkedIds.length+1})`:"";return`${Te.value}发起的${fe.value}会诊${e} ${Ee.value}`}));function Ae(e){console.log("checkedIds :>> ",e),ce.currentAVMsg.checkedIds.push(...e),he()}function he(){var e;(null==(e=ce.currentAVMsg.checkedIds)?void 0:e.length)&&ce.currentAVMsg.checkedIds.forEach((e=>{le({chatType:w.SINGLE,content:{msg:ce.currentAVMsg.chatMessageType+","+ce.currentAVMsg.strRoomId,chatMessageType:b.AV_STATUS},receiver:e})})),Ve.value||Re()}async function Re(){const e=await N.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(ce.showMultipleVideo=!1);try{if(await re.enterRoom({strRoomId:ce.currentAVMsg.strRoomId,sdkAppId:parseInt(ce.userInfo.sdkAppID),userId:ce.userInfo.id,userSig:ce.userInfo.userSig}),Ve.value=!0,pe(),function(){if(re.on(N.EVENT.ERROR,Oe),re.on(N.EVENT.REMOTE_USER_ENTER,we),re.on(N.EVENT.REMOTE_AUDIO_AVAILABLE,ye),re.on(N.EVENT.REMOTE_USER_EXIT,be),ue.value)return;re.on(N.EVENT.REMOTE_VIDEO_AVAILABLE,ke)}(),await re.startLocalAudio(),ue.value)return;await re.startLocalVideo({view:se.value})}catch(e){console.log("error :>> ",e),ce.showMultipleVideo=!1}}async function Me(){try{if(ce.showMultipleVideo=!1,function(){if(re.off(N.EVENT.ERROR,Oe),re.off(N.EVENT.REMOTE_USER_ENTER,we),re.off(N.EVENT.REMOTE_AUDIO_AVAILABLE,ye),re.off(N.EVENT.REMOTE_USER_EXIT,be),ue.value)return;re.off(N.EVENT.REMOTE_VIDEO_AVAILABLE,ke)}(),await re.exitRoom(),await re.stopLocalAudio(),ue.value)return;await re.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ke(e){const{userId:o,streamType:n}=e;try{n===N.TYPE.STREAM_TYPE_MAIN&&(await E(),await re.startRemoteVideo({userId:o,streamType:n,view:o}))}catch(e){console.log("error :>> ",e)}}function ye(e){const{userId:o}=e;ie.value.includes(o)||ie.value.push(o)}function we(e){const{userId:o}=e;ie.value.push(o),pe()}function be(e){console.log("event :>> 退房",e);const{userId:o}=e;ie.value=y(ie.value,[o])}function Oe(e){console.log("error :>> ",e),ce.showMultipleVideo=!1}return(e,o)=>(t(),s("div",x,[i("div",L,[c(i("span",{class:"title"},l(r(Ie)),513),[[a,Ve.value]]),u(r(g),{quaternary:"",circle:"",color:"#ffffffcc",onClick:Me},{icon:d((()=>[u(r(_),{component:r(T)},null,8,["component"])])),_:1})]),Ve.value?(t(),s("div",C,[i("div",S,[i("div",{ref_key:"selfVideoRef",ref:se,class:"video-view","data-name":r(ce).userInfo.name},null,8,U),i("div",j,[i("div",D,[i("div",$,[u(r(g),{text:"",color:r(ae)?"#fff":"#000",onClick:r(ve)},{icon:d((()=>[u(r(_),{component:r(ae)?r(I):r(A)},null,8,["component"])])),_:1},8,["color","onClick"]),z]),i("div",B,[u(r(g),{text:"",color:r(_e)?"#fff":"#000",disabled:r(ue),onClick:r(ge)},{icon:d((()=>[u(r(_),{component:r(_e)?r(h):r(R)},null,8,["component"])])),_:1},8,["color","disabled","onClick"]),H]),i("div",{class:"btn",onClick:Me},[u(r(g),{circle:"",color:"#f17568",class:"btn--rotate"},{icon:d((()=>[u(r(_),{component:r(M)},null,8,["component"])])),_:1}),P]),u(V,{onComfirm:Ae},{trigger:d((()=>[i("div",X,[u(r(g),{text:"",color:"#fff"},{icon:d((()=>[u(r(_),{component:r(k)},null,8,["component"])])),_:1}),Y])])),_:1})])])]),i("div",q,[(t(!0),s(p,null,m(ie.value,(e=>{return t(),s("div",{key:e,id:e,class:"video-view","data-name":(o=e,(null==(n=ce.userList.find((e=>e.id===o)))?void 0:n.name)||"二狗子")},null,8,G);var o,n})),128))])])):(t(),s(p,{key:1},[i("div",F,[i("span",J,l(r(Te))+"发起的"+l(r(fe))+"会议",1),r(de)?v("v-if",!0):(t(),s("span",K,"邀请你加入"+l(r(fe))+"会议",1))]),r(de)?(t(),s("div",Q,[u(V,{onComfirm:Ae},{trigger:d((()=>[u(r(g),{size:"large",circle:"",color:"#000"},{icon:d((()=>[u(r(_),{component:r(k)},null,8,["component"])])),_:1})])),_:1}),i("p",null,"已邀请共"+l(r(ce).currentAVMsg.checkedIds.length)+"人",1),u(r(g),{size:"large",strong:"",round:"",type:"primary",onClick:he},{default:d((()=>[f("开始会诊")])),_:1}),i("div",W,[u(r(g),{color:"#000",round:""},{icon:d((()=>[u(r(_),{component:r(I)},null,8,["component"])])),_:1}),u(r(g),{color:"#000",round:""},{icon:d((()=>[u(r(_),{component:r(h)},null,8,["component"])])),_:1})])])):(t(),s("div",Z,[i("div",ee,[u(r(g),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>r(ce).showMultipleVideo=!1)},{icon:d((()=>[u(r(_),{size:"30",component:r(M)},null,8,["component"])])),_:1}),oe]),i("div",ne,[u(r(g),{circle:"",color:"#2ac98b",onClick:Re},{icon:d((()=>[u(r(_),{size:"30",component:r(M)},null,8,["component"])])),_:1}),te])]))],64))]))}});export{se as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as n,watch as s,openBlock as t,createElementBlock as r,withDirectives as a,createElementVNode as i,vShow as c,createVNode as l,unref as u,toDisplayString as d,Fragment as E,normalizeClass as v,withCtx as m}from"vue";import{NAvatar as f,NButton as p,NIcon as I}from"naive-ui";import{Mic as T,MicOffCircle as V,Call as A}from"@vicons/ionicons5";import"date-fns";import"lodash-es";import{AV_STATUS as R,CHAT_TYPE as g}from"../constants/index.js";import"../utils/emoji.js";import{avFinishApi as _}from"../api/index.js";import{useVideo as M}from"../hooks/useVideo.js";import y from"trtc-sdk-v5";const N={class:"video-wrapper"},S={class:"user"},w={class:"name"},O={class:"tip"},k={class:"opt-btn"},L={class:"btn"},h=i("span",null,"静音",-1),D=i("span",null,"拒接",-1),C={class:"btn"},b=i("span",null,"挂断",-1),x=i("span",null,"接听",-1);var U=e({__name:"Video",setup(e){const{sendMessage:U,state:j,trtc:z,timing:H,voiceOpen:B,isAudio:F,isCall:X,startTimer:G,resetTimer:J,toggleAudio:P,messageTypeText:$,time:q}=M(),K=o(),Q=o(),W=o(!1);let Y=null;const Z=n((()=>{var e,o,n;return X.value?{avatar:j.currentSessionItem.avatar,name:j.currentSessionItem.name,userId:j.currentSessionItem.receiver}:{avatar:null==(e=j.currentAVMsg.currentMsg)?void 0:e.senderAvatar,name:null==(o=j.currentAVMsg.currentMsg)?void 0:o.senderName,userId:null==(n=j.currentAVMsg.currentMsg)?void 0:n.sender}})),ee=n((()=>W.value?F.value?H.value:"":X.value?"正在呼叫...":`邀请你${$.value}问诊...`)),oe=n((()=>{var e,o;return null==(o=null==(e=j.currentAVMsg.currentMsg)?void 0:e.content)?void 0:o.avStatus}));async function ne(e=R.FINISHED){U({chatType:g.SINGLE,content:{msg:e===R.FINISHED?""+q.seconds:"s",chatMessageType:j.currentAVMsg.chatMessageType,avStatus:e},receiver:Z.value.userId}),await _({recordId:j.currentAVMsg.currentMsg.id,status:e,duration:e===R.FINISHED?q.seconds:0})}async function se(){const e=await y.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(j.showVideo=!1);try{if(await z.enterRoom({strRoomId:j.currentAVMsg.strRoomId,sdkAppId:parseInt(j.userInfo.sdkAppID),userId:j.userInfo.id,userSig:j.userInfo.userSig}),X.value||(W.value=!0,G()),function(){if(z.on(y.EVENT.ERROR,ue),z.on(y.EVENT.REMOTE_USER_ENTER,ce),z.on(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.on(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.on(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.startLocalAudio(),F.value)return;await z.startLocalVideo({view:Q.value})}catch(e){console.log("error :>> ",e),j.showVideo=!1}}function te(){X.value&&!W.value?ne(R.CANCELED):ne()}async function re(){try{if(j.showVideo=!1,function(){if(z.off(y.EVENT.ERROR,ue),z.off(y.EVENT.REMOTE_USER_ENTER,ce),z.off(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.off(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.off(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.exitRoom(),await z.stopLocalAudio(),F.value)return;await z.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ae(e){const{userId:o,streamType:n}=e;try{await z.startRemoteVideo({userId:o,streamType:n,view:K.value})}catch(e){console.log("error :>> ",e)}}function ie(e){}function ce(){W.value=!0,G()}function le(e){console.log("event :>> 对方已挂断",e),re()}function ue(e){console.log("error :>> ",e),j.showVideo=!1}return s((()=>oe.value),(e=>{j.showVideo&&(e===R.IN_CALL?async function(){X.value?se():(Y&&clearTimeout(Y),Y=setTimeout((async()=>{W.value||ne(R.NO_RESPONSE)}),6e4))}():re())}),{immediate:!0}),(e,o)=>(t(),r("div",N,[a(i("div",{class:"video-box",ref_key:"videoRef",ref:K},null,512),[[c,W.value]]),a(i("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:Q},null,512),[[c,W.value]]),a(i("div",S,[l(u(f),{size:58,round:"",src:u(Z).avatar},null,8,["src"]),i("span",w,d(u(Z).name),1),i("span",O,d(u(ee)),1)],512),[[c,u(F)||!W.value]]),i("div",k,[i("div",L,[u(X)&&!W.value||W.value?(t(),r(E,{key:0},[l(u(p),{circle:"",onClick:u(P),class:v({bordered:u(B)})},{icon:m((()=>[l(u(I),{size:"30",color:u(B)?"#fff":"#626262",component:u(B)?u(T):u(V)},null,8,["color","component"])])),_:1},8,["onClick","class"]),h],64)):(t(),r(E,{key:1},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>ne(u(R).REJECTED))},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),D],64))]),i("div",C,[u(X)&&!W.value||W.value?(t(),r(E,{key:0},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:te},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),b],64)):(t(),r(E,{key:1},[l(u(p),{circle:"",color:"#2ac98b",onClick:se},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),x],64))])])]))}});export{U as default};
1
+ import{defineComponent as e,ref as o,computed as n,watch as s,openBlock as t,createElementBlock as r,withDirectives as a,createElementVNode as i,vShow as c,createVNode as l,unref as u,toDisplayString as d,Fragment as v,normalizeClass as E,withCtx as m}from"vue";import{NAvatar as f,NButton as p,NIcon as I}from"naive-ui";import{Mic as T,MicOffCircle as V,Call as A}from"@vicons/ionicons5";import"lodash-es";import"date-fns";import{AV_STATUS as R,CHAT_TYPE as g}from"../constants/index.js";import"../utils/emoji.js";import"@vueuse/core";import{avFinishApi as _}from"../api/index.js";import{useVideo as M}from"../hooks/useVideo.js";import y from"trtc-sdk-v5";const N={class:"video-wrapper"},S={class:"user"},w={class:"name"},O={class:"tip"},k={class:"opt-btn"},L={class:"btn"},h=i("span",null,"静音",-1),D=i("span",null,"拒接",-1),C={class:"btn"},b=i("span",null,"挂断",-1),x=i("span",null,"接听",-1);var U=e({__name:"Video",setup(e){const{sendMessage:U,state:j,trtc:z,timing:H,voiceOpen:B,isAudio:F,isCall:X,startTimer:G,resetTimer:J,toggleAudio:P,messageTypeText:$,time:q}=M(),K=o(),Q=o(),W=o(!1);let Y=null;const Z=n((()=>{var e,o,n;return X.value?{avatar:j.currentSessionItem.avatar,name:j.currentSessionItem.name,userId:j.currentSessionItem.receiver}:{avatar:null==(e=j.currentAVMsg.currentMsg)?void 0:e.senderAvatar,name:null==(o=j.currentAVMsg.currentMsg)?void 0:o.senderName,userId:null==(n=j.currentAVMsg.currentMsg)?void 0:n.sender}})),ee=n((()=>W.value?F.value?H.value:"":X.value?"正在呼叫...":`邀请你${$.value}问诊...`)),oe=n((()=>{var e,o;return null==(o=null==(e=j.currentAVMsg.currentMsg)?void 0:e.content)?void 0:o.avStatus}));async function ne(e=R.FINISHED){U({chatType:g.SINGLE,content:{msg:e===R.FINISHED?""+q.seconds:"s",chatMessageType:j.currentAVMsg.chatMessageType,avStatus:e},receiver:Z.value.userId}),await _({recordId:j.currentAVMsg.currentMsg.id,status:e,duration:e===R.FINISHED?q.seconds:0})}async function se(){const e=await y.isSupported();if(!e.result||!e.detail.isH264EncodeSupported||!e.detail.isH264DecodeSupported)return console.log("checkResult :>> ",e),void(j.showVideo=!1);try{if(await z.enterRoom({strRoomId:j.currentAVMsg.strRoomId,sdkAppId:parseInt(j.userInfo.sdkAppID),userId:j.userInfo.id,userSig:j.userInfo.userSig}),X.value||(W.value=!0,G()),function(){if(z.on(y.EVENT.ERROR,ue),z.on(y.EVENT.REMOTE_USER_ENTER,ce),z.on(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.on(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.on(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.startLocalAudio(),F.value)return;await z.startLocalVideo({view:Q.value})}catch(e){console.log("error :>> ",e),j.showVideo=!1}}function te(){X.value&&!W.value?ne(R.CANCELED):ne()}async function re(){try{if(j.showVideo=!1,function(){if(z.off(y.EVENT.ERROR,ue),z.off(y.EVENT.REMOTE_USER_ENTER,ce),z.off(y.EVENT.REMOTE_AUDIO_AVAILABLE,ie),z.off(y.EVENT.REMOTE_USER_EXIT,le),F.value)return;z.off(y.EVENT.REMOTE_VIDEO_AVAILABLE,ae)}(),await z.exitRoom(),await z.stopLocalAudio(),F.value)return;await z.stopLocalVideo()}catch(e){console.log("error :>> ",e)}}async function ae(e){const{userId:o,streamType:n}=e;try{await z.startRemoteVideo({userId:o,streamType:n,view:K.value})}catch(e){console.log("error :>> ",e)}}function ie(e){}function ce(){W.value=!0,G()}function le(e){console.log("event :>> 对方已挂断",e),re()}function ue(e){console.log("error :>> ",e),j.showVideo=!1}return s((()=>oe.value),(e=>{j.showVideo&&(e===R.IN_CALL?async function(){X.value?se():(Y&&clearTimeout(Y),Y=setTimeout((async()=>{W.value||ne(R.NO_RESPONSE)}),6e4))}():re())}),{immediate:!0}),(e,o)=>(t(),r("div",N,[a(i("div",{class:"video-box",ref_key:"videoRef",ref:K},null,512),[[c,W.value]]),a(i("div",{class:"video-box--self",ref_key:"selfVideoRef",ref:Q},null,512),[[c,W.value]]),a(i("div",S,[l(u(f),{size:58,round:"",src:u(Z).avatar},null,8,["src"]),i("span",w,d(u(Z).name),1),i("span",O,d(u(ee)),1)],512),[[c,u(F)||!W.value]]),i("div",k,[i("div",L,[u(X)&&!W.value||W.value?(t(),r(v,{key:0},[l(u(p),{circle:"",onClick:u(P),class:E({bordered:u(B)})},{icon:m((()=>[l(u(I),{size:"30",color:u(B)?"#fff":"#626262",component:u(B)?u(T):u(V)},null,8,["color","component"])])),_:1},8,["onClick","class"]),h],64)):(t(),r(v,{key:1},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:o[0]||(o[0]=()=>ne(u(R).REJECTED))},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),D],64))]),i("div",C,[u(X)&&!W.value||W.value?(t(),r(v,{key:0},[l(u(p),{circle:"",color:"#f17568",class:"btn--rotate",onClick:te},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),b],64)):(t(),r(v,{key:1},[l(u(p),{circle:"",color:"#2ac98b",onClick:se},{icon:m((()=>[l(u(I),{size:"30",component:u(A)},null,8,["component"])])),_:1}),x],64))])])]))}});export{U as default};
@@ -1 +1 @@
1
- import{inject as e}from"vue";import{formatTime as t,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as s,InjectionIChatStompClient as i,InjectionIChatEmits as o}from"../types/index.js";import{MESSAGE_TYPE as r}from"../constants/index.js";function m(){const m=e(s),c=e(i),a=e(o);return{state:m,setMsgList:function(e=[]){m.msgList=e.map((e=>{var s,i,o;return Object.assign(e,{__time:t(e.sendTime).msgTime,__content:(o=e.content.chatMessageType,[r.TEXT,r.TEXT].includes(o)?n(null==(s=e.content)?void 0:s.msg):null==(i=e.content)?void 0:i.msg)}),e})).sort(((e,t)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime()))},stompClient:c,emit:a,sendMessage:async function(e){try{c.value.send("/app/chat/send",{},JSON.stringify({chatType:m.currentSessionItem.chatType,receiver:m.currentSessionItem.receiver,...e}))}catch(e){console.log("error :>> ",e)}}}}export{m as useState};
1
+ import{inject as e}from"vue";import{cloneDeep as t}from"lodash-es";import{formatTime as s,transformMessage as n}from"../utils/index.js";import{InjectionIChatState as i,InjectionIChatStompClient as m,InjectionIChatEmits as o}from"../types/index.js";import{MESSAGE_TYPE as r}from"../constants/index.js";import{useIntervalFn as c}from"@vueuse/core";function a(){const a=e(i),T=e(m),d=e(o),{pause:u,resume:g,isActive:p}=c((()=>{const e=t(a.msgList);e.some((e=>{const{sendTime:t}=e;return!(Date.now()-new Date(t).getTime()>=36e5)&&(e.__sendTime=s(t).recordTime,!0)})),a.msgList=e,l()||u()}),6e4,{immediate:!1});function l(){return!!a.msgList.length&&a.msgList.some((e=>Date.now()-new Date(e.sendTime).getTime()<36e5))}return{state:a,setMsgList:function(e=[]){u(),a.msgList=e.map((e=>{var t,i,m;return Object.assign(e,{__time:s(e.sendTime).msgTime,__content:(m=e.content.chatMessageType,[r.TEXT,r.TEXT].includes(m)?n(null==(t=e.content)?void 0:t.msg):null==(i=e.content)?void 0:i.msg),__sendTime:s(e.sendTime).recordTime}),e})).sort(((e,t)=>new Date(t.sendTime).getTime()-new Date(e.sendTime).getTime())),l()&&g()},stompClient:T,emit:d,sendMessage:async function(e){try{T.value.send("/app/chat/send",{},JSON.stringify({chatType:a.currentSessionItem.chatType,receiver:a.currentSessionItem.receiver,...e}))}catch(e){console.log("error :>> ",e)}}}}export{a as useState};
@@ -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 v,createVNode as f,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 I,NFormItem as B,NButton as J}from"naive-ui";const V=["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),{noDataState:ee,setNoData:oe,resetNodata:te}=b(),ae=F(),{showEvatip:ne,isFormBoldOpen:se,scaleStyle:ie,handlePageClass:le,isShowItem:re,handleShowQuestionNumber:me,hasScore:ce,isPreviewScale:ue,showEvaluateEntry:de,showEvaluateCoundownPage:pe,showScaleFooter:ve,isCancelBtn:fe,isSaveBtn:ge,showEvaluateLabel:he,showAnswerParse:ke,propsConfig:ye,evaluatePageProps:we,evaluateCountdownProps:Se,isEvaluetaResSituation:be,disableEdit:Ce,desStart:De,desEnd:Ee,desContent:je}=E(K,X,{query:ae}),{initForm:_e}=j(K,X,z,{query:ae}),{submitMethod:xe,onSubmitData:Fe,onSubmitForm:Pe,handleScoreJson:qe}=_(K,X,z,{query:ae,formRef:Z,countdownDom:Y}),{nextLogicEvent:Le,handleDynamicDataRelation:Ne}=q(K,X),{scaleChange:Re,labelChange:Ae,vodFileList:Me,writeGuage:Oe,closeEvaluateCountdown:Te,showEvaTipModal:Ie}=x(K,X,z,{nextLogicEvent:Le,handleDynamicDataRelation:Ne,isPreviewScale:ue,submitMethod:xe,isEvaluetaResSituation:be,handleScoreJson:qe,disableEdit:Ce});(()=>{let{id:e}=ae;e&&(X.shareId=e)})();const Be=e=>{try{te(),_e(e)}catch(e){console.log(e,"--error"),X.spinning=!1,X.hasFrontAddress=!1,oe(!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((()=>{_e(o)}))}),{immediate:!0});const Je=L.debounce(Fe,300),Ve=()=>{z("onCloseSetting")};return C({getScaleData:()=>({...X}),onSubmitForm:Pe,cancel:Ve}),(e,o)=>(s(),i("div",{class:l(["c-scale-view-block",{"c-scale-view-block-hasfooter":r(ve)}])},[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(ee).noData?(s(),u(N,{key:0,noDataImg:r(ee).noDataImg,noDataTip:r(ee).noDataTip},null,8,["noDataImg","noDataTip"])):(s(),i(c,{key:1},[r(de)?(s(),u(A,d({key:0},r(we),{onWriteGuage:r(Oe)}),null,16,["onWriteGuage"])):(s(),i(c,{key:1},[r(pe)?(s(),u(R,d({key:0,ref_key:"countdownDom",ref:Y},r(Se),{onCloseEvaluateCountdown:r(Te)}),null,16,["onCloseEvaluateCountdown"])):m("v-if",!0),p("div",{class:l(["scale-container",{"scale-container-nopadding":r(le),"scale-container-hasfooter":r(ve)}]),style:v(r(ie))},[r(ce)?(s(),u(r(O),{key:0,config:X.config,maxScore:X.maxScore},null,8,["config","maxScore"])):m("v-if",!0),r(De)?(s(),u(T,{key:1,content:r(je)},null,8,["content"])):m("v-if",!0),f(r(I),{ref_key:"formRef",ref:Z,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(re)(e)?(s(),u(r(B),{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(se)(e)}),innerHTML:r(me)(e)},null,10,V),r(se)(e)?(s(),i("span",G,"(必填)")):m("v-if",!0),r(he)(e)?(s(),i("span",W,k(r(he)(e)),1)):m("v-if",!0),r(ne)(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(ye)(e,o),{key:(e.id||e.seq)+o,onScaleChange:r(Re),onOnChange:o=>r(Ae)(o,e),onVodFileList:r(Me)}),null,16,["onScaleChange","onOnChange","onVodFileList"])),r(ke)(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(Ee)?(s(),u(T,{key:2,content:r(je)},null,8,["content"])):m("v-if",!0)],6),r(ve)?(s(),i("div",$,[m(" 分享的链接 隐藏取消按钮 "),r(fe)?(s(),u(r(J),{key:0,onClick:Ve},{default:g((()=>[y("取消")])),_:1})):m("v-if",!0),r(ge)?(s(),u(r(J),{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 v,createVNode as f,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 I,NFormItem as B,NButton as J}from"naive-ui";const V=["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),{noDataState:ee,setNoData:oe,resetNodata:te}=b(),ae=F(),{showEvatip:ne,isFormBoldOpen:se,scaleStyle:ie,handlePageClass:le,isShowItem:re,handleShowQuestionNumber:me,hasScore:ce,isPreviewScale:ue,showEvaluateEntry:de,showEvaluateCoundownPage:pe,showScaleFooter:ve,isCancelBtn:fe,isSaveBtn:ge,showEvaluateLabel:he,showAnswerParse:ke,propsConfig:ye,evaluatePageProps:we,evaluateCountdownProps:Se,isEvaluetaResSituation:be,disableEdit:Ce,desStart:De,desEnd:Ee,desContent:je}=E(K,X,{query:ae}),{initForm:_e}=j(K,X,z,{query:ae}),{submitMethod:xe,onSubmitData:Fe,onSubmitForm:Pe,handleScoreJson:qe}=_(K,X,z,{query:ae,formRef:Z,countdownDom:Y}),{nextLogicEvent:Le,handleDynamicDataRelation:Ne}=q(K,X),{scaleChange:Re,labelChange:Ae,vodFileList:Me,writeGuage:Oe,closeEvaluateCountdown:Te,showEvaTipModal:Ie}=x(K,X,z,{nextLogicEvent:Le,handleDynamicDataRelation:Ne,isPreviewScale:ue,submitMethod:xe,isEvaluetaResSituation:be,handleScoreJson:qe,disableEdit:Ce});(()=>{let{id:e}=ae;e&&(X.shareId=e)})();const Be=e=>{try{te(),_e(e)}catch(e){console.log(e,"--error"),X.spinning=!1,X.hasFrontAddress=!1,oe(!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((()=>{_e(o)}))}),{immediate:!0});const Je=L.debounce(Fe,300),Ve=()=>{z("onCloseSetting")};return C({getScaleData:()=>({...X}),onSubmitForm:Pe,cancel:Ve}),(e,o)=>(s(),i("div",{class:l(["c-scale-view-block",{"c-scale-view-block-hasfooter":r(ve)}])},[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(ee).noData?(s(),u(N,{key:0,noDataImg:r(ee).noDataImg,noDataTip:r(ee).noDataTip},null,8,["noDataImg","noDataTip"])):(s(),i(c,{key:1},[r(de)?(s(),u(A,d({key:0},r(we),{onWriteGuage:r(Oe)}),null,16,["onWriteGuage"])):(s(),i(c,{key:1},[r(pe)?(s(),u(R,d({key:0,ref_key:"countdownDom",ref:Y},r(Se),{onCloseEvaluateCountdown:r(Te)}),null,16,["onCloseEvaluateCountdown"])):m("v-if",!0),p("div",{class:l(["scale-container",{"scale-container-nopadding":r(le),"scale-container-hasfooter":r(ve)}]),style:v(r(ie))},[r(ce)?(s(),u(r(O),{key:0,config:X.config,maxScore:X.maxScore},null,8,["config","maxScore"])):m("v-if",!0),r(De)?(s(),u(T,{key:1,content:r(je)},null,8,["content"])):m("v-if",!0),f(r(I),{ref_key:"formRef",ref:Z,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(re)(e)?(s(),u(r(B),{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(se)(e)}),innerHTML:r(me)(e)},null,10,V),r(se)(e)?(s(),i("span",G,"(必填)")):m("v-if",!0),r(he)(e)?(s(),i("span",W,k(r(he)(e)),1)):m("v-if",!0),r(ne)(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(ye)(e,o),{key:(e.id||e.seq)+o,onScaleChange:r(Re),onOnChange:o=>r(Ae)(o,e),onVodFileList:r(Me)}),null,16,["onScaleChange","onOnChange","onVodFileList"])),r(ke)(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(Ee)?(s(),u(T,{key:2,content:r(je)},null,8,["content"])):m("v-if",!0)],6),r(ve)?(s(),i("div",$,[m(" 分享的链接 隐藏取消按钮 "),r(fe)?(s(),u(r(J),{key:0,onClick:Ve},{default:g((()=>[y("取消")])),_:1})):m("v-if",!0),r(ge)?(s(),u(r(J),{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 +1 @@
1
- import{defineComponent as t,ref as e,reactive as l,computed as a,watch as i,openBlock as n,createElementBlock as s,unref as d,createCommentVNode as o,withDirectives as r,createElementVNode as c,normalizeClass as b,createVNode as u,withCtx as p,Fragment as f,renderList as h,createBlock as y,createTextVNode as v,toDisplayString as m,vShow as g,nextTick as C}from"vue";import{useMessage as L,NAnchor as I,NAnchorLink as S}from"naive-ui";import E from"./components/label-classify.vue.js";import{handleLabelColor as w}from"../../../shared/utils/vexutils.js";import x from"../../../shared/utils/vexutilsExpand.js";const A={key:0,class:"label-disable-wrap"},O=[c("p",{class:"label-disable-title"},"无可选标签",-1),c("p",{class:"label-disable-desc"},"请联系管理员进行标签管理设置",-1)],K={style:{height:"100%"}},j={class:"label-wrap"},k=["id"],T={class:"edit-label-type"};var B=t({__name:"LabelFormContent",props:{item:{default:()=>({})},isEdit:{type:Boolean,default:!0},isLock:{type:Boolean,default:!1},labelSelectedList:null,isChangeWindow:{type:Boolean},getLabelList:{type:Function,default:()=>Promise.resolve({rows:[]})},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})},labelOptions:null,sourceType:{default:""},explicit:{type:Boolean,default:!1}},emits:["explicitOnChange","change","updateLabelData"],setup(t,{expose:B,emit:D}){const V=t,F=L(),P=e(null),_=l({editLabelItem:{},inited:!1,labelSelectedEdit:[],labelAnchorKey:"",cacheAnchorKey:"",labelConfig:{}});let N=e(0);const W=a((()=>{if(!_.inited)return!1;let t=_.labelConfig;return!t||Object.keys(t).every((e=>!t[e].itemList))})),$=a((()=>{let t=[].concat(..._.labelSelectedEdit,...V.labelSelectedList);return J(t,"labelId")})),q=a((()=>{const t=$.value||[];return Array.isArray(t)?t.map((t=>t.labelId)):[]})),J=(t,e)=>{let l={};return t.reduce(((t,a)=>(!l[a[e]]&&(l[a[e]]=t.push(a)),t)),[])},R=()=>{if(_.labelSelectedEdit=$.value,"object"==typeof _.labelConfig){Object.keys(_.labelConfig||{}).forEach((t=>{var e;let l=(null==(e=_.labelConfig[t])?void 0:e.itemList)||[];l.length&&l.forEach((t=>{q.value.includes(t.labelId)&&(t.isSelect=!0)}))}))}},z=(t,e)=>{if(!t)return;let l=Object.keys(t)||[];if(!l.length)return;let a=t[l[0]].curKey;if(e&&"string"==typeof e){let[i]=e.split("~"),n=l.find((e=>t[e]&&t[e].curKey&&t[e].curKey.includes(i)));n&&(a=t[n].curKey)}a&&Y(a)},G=(t,e)=>{e.showAdd=!0;const l=t.target.nextElementSibling;C((()=>{var t;null==(t=null==l?void 0:l.firstChild)||t.focus()}))},H=(t,e)=>{setTimeout((()=>{e.addVal?Q(e):e.showAdd=!1}),150)},M=(t,e)=>{e.addVal="",e.showAdd=!1},Q=async t=>{var e;if(!!t.itemList.filter((t=>!(t.isPublic&&1==t.isPublic))).find((e=>e.labelName===t.addVal)))return F.error("标签名称重复!"),!1;let l="";l=(null==(e=t.itemList)?void 0:e.length)?t.itemList[0].parentColor||t.parentColor||"":(null==t?void 0:t.parentColor)||"";const a={type:t.typeId,name:t.addVal,parentColor:l},{status:i}=await V.saveLabelItem(a,t);i&&(F.success("添加成功!"),D("updateLabelData"),t.showAdd=!1)},U=(t,e,l,a)=>{var i;const n=l.itemList,s=l.multipleChoice;let d=(null==(i=_.labelSelectedEdit)?void 0:i.length)&&x.clone(_.labelSelectedEdit,!0)||[];if(t){if(d.some((t=>t.labelId==e.labelId)))return;if(2==s){const{typeId:t,labelId:l}=e;d=d.filter((e=>e.typeId!==t)),n.forEach((t=>{t.labelId!==l&&(t.isSelect=!1)}))}d.push(e)}else{const t=d.findIndex((t=>t.labelId==e.labelId));-1!=t&&d.splice(t,1)}_.labelSelectedEdit=[...d],N.value++,V.explicit&&D("explicitOnChange",[..._.labelSelectedEdit])},X=async t=>{const{status:e}=await V.deleteLabel(t,V.item);if(e){F.success("删除成功!");for(const e in _.labelConfig){const l=_.labelConfig[e].itemList.findIndex((e=>e.labelId==t.labelId));-1!=l&&_.labelConfig[e].itemList.splice(l,1)}const e=_.labelSelectedEdit||[],l=V.labelSelectedList||[];if(e&&e.length){const l=e.findIndex((e=>e.labelId==t.labelId));-1!=l&&e.splice(l,1)}if(l&&l.length){const e=l.findIndex((e=>e.labelId==t.labelId));-1!=e&&l.splice(e,1),D("change",[...l],V.item)}D("updateLabelData")}else F.warning("删除失败")},Y=t=>{t&&setTimeout((()=>{let e,l="#"+t;e=P.value.querySelector("a[href='"+l+"']"),e&&e.click(),_.labelAnchorKey=t}),32)},Z=t=>{t.preventDefault()},tt=t=>{if(!t)return;let e=t.slice(1);_.cacheAnchorKey=e},et=()=>{var t;return null==(t=P.value)?void 0:t.querySelector(".right-label-wrap")};return i((()=>V.labelOptions),(t=>{t&&(()=>{var t;if(V.isLock)return;const e=JSON.parse(JSON.stringify(V.labelOptions));for(let l in e){let a=(null==(t=e[l])?void 0:t.typeId)||"";Object.assign(e[l],{curKey:`${l}_${a}}`})}_.labelConfig=e,C((()=>{let t;R(),V.explicit&&_.inited&&(t=_.labelAnchorKey),z(_.labelConfig,t),_.inited=!0}))})()}),{immediate:!0,deep:!0}),B({resetShowAdd:()=>{let{labelObj:t}=_.editLabelItem;if(t&&Object.keys(t).length)for(let e in t){let l=t[e];Object.assign(l,{showAdd:!1})}},handleLabelForm:t=>{t([..._.labelSelectedEdit||[]])},handleResetOptions:()=>{},hanldeSetLabelItem:(t,e)=>{if("object"==typeof _.labelConfig){Object.keys(_.labelConfig||{}).forEach((l=>{var a;let i=(null==(a=_.labelConfig[l])?void 0:a.itemList)||[];i.length&&i.forEach((l=>{t==l.labelId&&(l.isSelect=e)}))}))}if(!1===e&&Array.isArray(_.labelSelectedEdit)){const e=_.labelSelectedEdit.findIndex((e=>e.labelId==t));-1!=e&&_.labelSelectedEdit.splice(e,1)}}}),(e,l)=>(n(),s("div",{class:"c-label-form-content",ref_key:"labelFormContent",ref:P},[d(W)?(n(),s("div",A,O)):o("v-if",!0),r(c("div",K,[c("div",j,[o(" 表单内嵌打开标签组件的样式 "),o(' <div v-if="explicit" class="explicit-continer">\n\t\t\t\t\t<n-tabs :value="state.labelAnchorKey" type="card" @change="labelAnchorTabsOnChange" tab-position="top">\n\t\t\t\t\t\t<template v-for="(v, i) in state.labelConfig">\n\t\t\t\t\t\t\t<n-tab-pane :name="v.curKey">\n\t\t\t\t\t\t\t\t<span slot="tab">\n\t\t\t\t\t\t\t\t\t{{ i }}\n\t\t\t\t\t\t\t\t\t<span class="edit-label-type">({{ v.multipleChoice == 2 ? \'单\' : \'多\' }}选)</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<div class="explicit-label-wrap left-label-wrap">\n\t\t\t\t\t\t\t\t\t<div class="edit-label-content">\n\t\t\t\t\t\t\t\t\t\t<labelClassify\n\t\t\t\t\t\t\t\t\t\t\t:classifyItem="v"\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelChange="handleLabelChange"\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelColor="handleLabelColor"\n\t\t\t\t\t\t\t\t\t\t\t:handleDelLabel="handleDelLabel"\n\t\t\t\t\t\t\t\t\t\t\t:hanldeBlur="hanldeBlur"\n\t\t\t\t\t\t\t\t\t\t\t:handleAddLabel="handleAddLabel"\n\t\t\t\t\t\t\t\t\t\t\t:clearaddVal="clearaddVal"\n\t\t\t\t\t\t\t\t\t\t\t:isEdit="isEdit"\n\t\t\t\t\t\t\t\t\t\t\t:sourceType="sourceType"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</n-tab-pane>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</n-tabs>\n\t\t\t\t</div> '),o("\n\t\t\t\t\t普通标签样式\n\t\t\t\t\tv-else\n\t\t\t\t\texplicit\n\t\t\t\t "),c("div",{class:b(["left-label-wrap",{"total-left-label-wrap":t.isChangeWindow}])},[u(d(I),{"offset-target":et,type:"block",onClick:Z,onChange:tt},{default:p((()=>[(n(!0),s(f,null,h(_.labelConfig,((t,e)=>(n(),y(d(S),{href:`#${t.curKey}`,title:String(e)},null,8,["href","title"])))),256))])),_:1})],2),o(' v-if="!explicit" '),c("div",{class:b(["right-label-wrap",{"total-right-label-wrap":t.isChangeWindow}])},[(n(!0),s(f,null,h(_.labelConfig,((e,l)=>(n(),s("div",{key:l,class:"edit-label-content"},[c("div",{class:"edit-label",id:e.curKey},[v(m(l)+" ",1),c("span",T,"("+m(2==e.multipleChoice?"单":"多")+"选)",1)],8,k),u(E,{classifyItem:e,handleLabelChange:U,handleLabelColor:d(w),handleDelLabel:X,hanldeBlur:H,handleAddLabel:G,clearaddVal:M,isEdit:t.isEdit,sourceType:t.sourceType},null,8,["classifyItem","handleLabelColor","isEdit","sourceType"])])))),128))],2)])],512),[[g,!d(W)]])],512))}});export{B as default};
1
+ import{defineComponent as t,ref as e,reactive as l,computed as a,watch as i,openBlock as n,createElementBlock as s,unref as r,createCommentVNode as d,withDirectives as o,createElementVNode as c,normalizeClass as b,createVNode as u,withCtx as p,Fragment as f,renderList as h,createBlock as y,createTextVNode as v,toDisplayString as m,vShow as g,nextTick as C}from"vue";import{useMessage as L,NAnchor as I,NAnchorLink as S}from"naive-ui";import E from"./components/label-classify.vue.js";import{handleLabelColor as w}from"../../../shared/utils/vexutils.js";import x from"../../../shared/utils/vexutilsExpand.js";const A={key:0,class:"label-disable-wrap"},O=[c("p",{class:"label-disable-title"},"无可选标签",-1),c("p",{class:"label-disable-desc"},"请联系管理员进行标签管理设置",-1)],K={style:{height:"100%"}},j={class:"label-wrap"},k=["id"],T={class:"edit-label-type"};var B=t({__name:"LabelFormContent",props:{item:{default:()=>({})},isEdit:{type:Boolean,default:!0},isLock:{type:Boolean,default:!1},labelSelectedList:null,isChangeWindow:{type:Boolean},getLabelList:{type:Function,default:()=>Promise.resolve({rows:[]})},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})},labelOptions:null,sourceType:{default:""},explicit:{type:Boolean,default:!1}},emits:["explicitOnChange","change","updateLabelData"],setup(t,{expose:B,emit:D}){const V=t,F=L(),P=e(null),_=l({editLabelItem:{},inited:!1,labelSelectedEdit:[],labelAnchorKey:"",cacheAnchorKey:"",labelConfig:{}});let N=e(0);const W=a((()=>{if(!_.inited)return!1;let t=_.labelConfig;return!t||Object.keys(t).every((e=>!t[e].itemList))})),$=a((()=>{let t=[].concat(..._.labelSelectedEdit,...V.labelSelectedList);return J(t,"labelId")})),q=a((()=>{const t=$.value||[];return Array.isArray(t)?t.map((t=>t.labelId)):[]})),J=(t,e)=>{let l={};return t.reduce(((t,a)=>(!l[a[e]]&&(l[a[e]]=t.push(a)),t)),[])},R=()=>{if(_.labelSelectedEdit=$.value,"object"==typeof _.labelConfig){Object.keys(_.labelConfig||{}).forEach((t=>{var e;let l=(null==(e=_.labelConfig[t])?void 0:e.itemList)||[];l.length&&l.forEach((t=>{q.value.includes(t.labelId)&&(t.isSelect=!0)}))}))}},z=(t,e)=>{if(!t)return;let l=Object.keys(t)||[];if(!l.length)return;let a=t[l[0]].curKey;if(e&&"string"==typeof e){let[i]=e.split("~"),n=l.find((e=>t[e]&&t[e].curKey&&t[e].curKey.includes(i)));n&&(a=t[n].curKey)}a&&Y(a)},G=(t,e)=>{e.showAdd=!0;const l=t.target.nextElementSibling;C((()=>{var t;null==(t=null==l?void 0:l.firstChild)||t.focus()}))},H=(t,e)=>{setTimeout((()=>{e.addVal?Q(e):e.showAdd=!1}),150)},M=(t,e)=>{e.addVal="",e.showAdd=!1},Q=async t=>{var e;if(!!t.itemList.filter((t=>!(t.isPublic&&1==t.isPublic))).find((e=>e.labelName===t.addVal)))return F.error("标签名称重复!"),!1;let l="";l=(null==(e=t.itemList)?void 0:e.length)?t.itemList[0].parentColor||t.parentColor||"":(null==t?void 0:t.parentColor)||"";const a={type:t.typeId,name:t.addVal,parentColor:l},{status:i}=await V.saveLabelItem(a,t);i&&(F.success("添加成功!"),D("updateLabelData"),t.showAdd=!1)},U=(t,e,l,a)=>{var i;const n=l.itemList,s=l.multipleChoice;let r=(null==(i=_.labelSelectedEdit)?void 0:i.length)&&x.clone(_.labelSelectedEdit,!0)||[];if(t){if(r.some((t=>t.labelId==e.labelId)))return;if(2==s){const{typeId:t,labelId:l}=e;r=r.filter((e=>e.typeId!==t)),n.forEach((t=>{t.labelId!==l&&(t.isSelect=!1)}))}r.push(e)}else{const t=r.findIndex((t=>t.labelId==e.labelId));-1!=t&&r.splice(t,1)}_.labelSelectedEdit=[...r],N.value++,V.explicit&&D("explicitOnChange",[..._.labelSelectedEdit])},X=async t=>{const{status:e}=await V.deleteLabel(t,V.item);if(e){F.success("删除成功!");for(const e in _.labelConfig){const l=_.labelConfig[e].itemList.findIndex((e=>e.labelId==t.labelId));-1!=l&&_.labelConfig[e].itemList.splice(l,1)}const e=_.labelSelectedEdit||[],l=V.labelSelectedList||[];if(e&&e.length){const l=e.findIndex((e=>e.labelId==t.labelId));-1!=l&&e.splice(l,1)}if(l&&l.length){const e=l.findIndex((e=>e.labelId==t.labelId));-1!=e&&l.splice(e,1),D("change",[...l],V.item)}D("updateLabelData")}else F.warning("删除失败")},Y=t=>{t&&setTimeout((()=>{let e,l="#"+t;e=P.value.querySelector("a[href='"+l+"']"),e&&e.click(),_.labelAnchorKey=t}),32)},Z=t=>{t.preventDefault()},tt=t=>{if(!t)return;let e=t.slice(1);_.cacheAnchorKey=e},et=()=>{var t;return null==(t=P.value)?void 0:t.querySelector(".right-label-wrap")};return i((()=>V.labelOptions),(t=>{t&&(()=>{var t;if(V.isLock)return;const e=JSON.parse(JSON.stringify(V.labelOptions));for(let l in e){let a=(null==(t=e[l])?void 0:t.typeId)||"";Object.assign(e[l],{curKey:`${l}_${a}}`})}_.labelConfig=e,C((()=>{let t;R(),V.explicit&&_.inited&&(t=_.labelAnchorKey),z(_.labelConfig,t),_.inited=!0}))})()}),{immediate:!0,deep:!0}),B({resetShowAdd:()=>{let{labelObj:t}=_.editLabelItem;if(t&&Object.keys(t).length)for(let e in t){let l=t[e];Object.assign(l,{showAdd:!1})}},handleLabelForm:t=>{t([..._.labelSelectedEdit||[]])},handleResetOptions:()=>{},hanldeSetLabelItem:(t,e)=>{if("object"==typeof _.labelConfig){Object.keys(_.labelConfig||{}).forEach((l=>{var a;let i=(null==(a=_.labelConfig[l])?void 0:a.itemList)||[];i.length&&i.forEach((l=>{t==l.labelId&&(l.isSelect=e)}))}))}if(!1===e&&Array.isArray(_.labelSelectedEdit)){const e=_.labelSelectedEdit.findIndex((e=>e.labelId==t));-1!=e&&_.labelSelectedEdit.splice(e,1)}}}),(e,l)=>(n(),s("div",{class:"c-label-form-content",ref_key:"labelFormContent",ref:P},[r(W)?(n(),s("div",A,O)):d("v-if",!0),o(c("div",K,[c("div",j,[d(" 表单内嵌打开标签组件的样式 "),d(' <div v-if="explicit" class="explicit-continer">\r\n\t\t\t\t\t<n-tabs :value="state.labelAnchorKey" type="card" @change="labelAnchorTabsOnChange" tab-position="top">\r\n\t\t\t\t\t\t<template v-for="(v, i) in state.labelConfig">\r\n\t\t\t\t\t\t\t<n-tab-pane :name="v.curKey">\r\n\t\t\t\t\t\t\t\t<span slot="tab">\r\n\t\t\t\t\t\t\t\t\t{{ i }}\r\n\t\t\t\t\t\t\t\t\t<span class="edit-label-type">({{ v.multipleChoice == 2 ? \'单\' : \'多\' }}选)</span>\r\n\t\t\t\t\t\t\t\t</span>\r\n\t\t\t\t\t\t\t\t<div class="explicit-label-wrap left-label-wrap">\r\n\t\t\t\t\t\t\t\t\t<div class="edit-label-content">\r\n\t\t\t\t\t\t\t\t\t\t<labelClassify\r\n\t\t\t\t\t\t\t\t\t\t\t:classifyItem="v"\r\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelChange="handleLabelChange"\r\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelColor="handleLabelColor"\r\n\t\t\t\t\t\t\t\t\t\t\t:handleDelLabel="handleDelLabel"\r\n\t\t\t\t\t\t\t\t\t\t\t:hanldeBlur="hanldeBlur"\r\n\t\t\t\t\t\t\t\t\t\t\t:handleAddLabel="handleAddLabel"\r\n\t\t\t\t\t\t\t\t\t\t\t:clearaddVal="clearaddVal"\r\n\t\t\t\t\t\t\t\t\t\t\t:isEdit="isEdit"\r\n\t\t\t\t\t\t\t\t\t\t\t:sourceType="sourceType"\r\n\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</n-tab-pane>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t</n-tabs>\r\n\t\t\t\t</div> '),d("\r\n\t\t\t\t\t普通标签样式\r\n\t\t\t\t\tv-else\r\n\t\t\t\t\texplicit\r\n\t\t\t\t "),c("div",{class:b(["left-label-wrap",{"total-left-label-wrap":t.isChangeWindow}])},[u(r(I),{"offset-target":et,type:"block",onClick:Z,onChange:tt},{default:p((()=>[(n(!0),s(f,null,h(_.labelConfig,((t,e)=>(n(),y(r(S),{href:`#${t.curKey}`,title:String(e)},null,8,["href","title"])))),256))])),_:1})],2),d(' v-if="!explicit" '),c("div",{class:b(["right-label-wrap",{"total-right-label-wrap":t.isChangeWindow}])},[(n(!0),s(f,null,h(_.labelConfig,((e,l)=>(n(),s("div",{key:l,class:"edit-label-content"},[c("div",{class:"edit-label",id:e.curKey},[v(m(l)+" ",1),c("span",T,"("+m(2==e.multipleChoice?"单":"多")+"选)",1)],8,k),u(E,{classifyItem:e,handleLabelChange:U,handleLabelColor:r(w),handleDelLabel:X,hanldeBlur:H,handleAddLabel:G,clearaddVal:M,isEdit:t.isEdit,sourceType:t.sourceType},null,8,["classifyItem","handleLabelColor","isEdit","sourceType"])])))),128))],2)])],512),[[g,!r(W)]])],512))}});export{B as default};