cnhis-design-vue 3.2.8-beta.8 → 3.2.8-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -87
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +2 -2
- package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
- package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
- package/es/components/iho-chat/src/hooks/useSearchUserList.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/shared/assets/img/ai__avatar.png.js +1 -1
- package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
- package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
- package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
- package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
- package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
- package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
- package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
- package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
- package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
- package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
- package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/hooks/selectHooks/useSearchContent.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/fabricjs/index.d.ts +6823 -0
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
- package/es/components/iho-chat/src/hooks/useScrollLoading.d.ts +0 -2
- package/es/components/iho-chat/src/hooks/useScrollLoading.js +0 -1
package/README.md
CHANGED
@@ -1,87 +1,87 @@
|
|
1
|
-
# 安装
|
2
|
-
|
3
|
-
```shell
|
4
|
-
npm i cnhis-design-vue@[版本号]
|
5
|
-
# or
|
6
|
-
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
-
```
|
8
|
-
|
9
|
-
## 1.全局引入
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
// main.ts
|
13
|
-
import { createApp } from 'vue';
|
14
|
-
import App from './App.vue';
|
15
|
-
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
-
import cui from 'cnhis-design-vue';
|
17
|
-
|
18
|
-
const app = createApp(App);
|
19
|
-
app.use(cui).mount('#app');
|
20
|
-
```
|
21
|
-
|
22
|
-
## 2. 按需引入
|
23
|
-
|
24
|
-
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
-
|
26
|
-
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
-
|
28
|
-
```shell
|
29
|
-
# 安装自动导入样式的插件
|
30
|
-
npm i -d vite-plugin-style-import
|
31
|
-
```
|
32
|
-
|
33
|
-
```typescript
|
34
|
-
// vite.config.ts
|
35
|
-
import { defineConfig } from 'vite';
|
36
|
-
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
-
|
38
|
-
export default defineConfig({
|
39
|
-
plugins: [
|
40
|
-
// ...otherPlugins
|
41
|
-
createStyleImportPlugin({
|
42
|
-
libs: [
|
43
|
-
{
|
44
|
-
libraryName: 'cnhis-design-vue',
|
45
|
-
esModule: true,
|
46
|
-
ensureStyleFile: true,
|
47
|
-
resolveStyle: name => {
|
48
|
-
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
]
|
52
|
-
})
|
53
|
-
]
|
54
|
-
});
|
55
|
-
```
|
56
|
-
|
57
|
-
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
-
|
59
|
-
```typescript
|
60
|
-
// main.ts
|
61
|
-
import 'cnhis-design-vue/es/components/index.css';
|
62
|
-
```
|
63
|
-
|
64
|
-
## 3.FAQ
|
65
|
-
|
66
|
-
### 3.1 项目打包后样式丢失
|
67
|
-
|
68
|
-
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
-
|
70
|
-
```typescript
|
71
|
-
// vite.config.ts
|
72
|
-
import { defineConfig } from 'vite';
|
73
|
-
|
74
|
-
export default defineConfig({
|
75
|
-
build: {
|
76
|
-
rollupOptions: {
|
77
|
-
// ..otherOptions
|
78
|
-
output: {
|
79
|
-
dir: './dist',
|
80
|
-
manualChunks: {
|
81
|
-
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
});
|
87
|
-
```
|
1
|
+
# 安装
|
2
|
+
|
3
|
+
```shell
|
4
|
+
npm i cnhis-design-vue@[版本号]
|
5
|
+
# or
|
6
|
+
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
+
```
|
8
|
+
|
9
|
+
## 1.全局引入
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
// main.ts
|
13
|
+
import { createApp } from 'vue';
|
14
|
+
import App from './App.vue';
|
15
|
+
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
+
import cui from 'cnhis-design-vue';
|
17
|
+
|
18
|
+
const app = createApp(App);
|
19
|
+
app.use(cui).mount('#app');
|
20
|
+
```
|
21
|
+
|
22
|
+
## 2. 按需引入
|
23
|
+
|
24
|
+
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
+
|
26
|
+
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
+
|
28
|
+
```shell
|
29
|
+
# 安装自动导入样式的插件
|
30
|
+
npm i -d vite-plugin-style-import
|
31
|
+
```
|
32
|
+
|
33
|
+
```typescript
|
34
|
+
// vite.config.ts
|
35
|
+
import { defineConfig } from 'vite';
|
36
|
+
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
+
|
38
|
+
export default defineConfig({
|
39
|
+
plugins: [
|
40
|
+
// ...otherPlugins
|
41
|
+
createStyleImportPlugin({
|
42
|
+
libs: [
|
43
|
+
{
|
44
|
+
libraryName: 'cnhis-design-vue',
|
45
|
+
esModule: true,
|
46
|
+
ensureStyleFile: true,
|
47
|
+
resolveStyle: name => {
|
48
|
+
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
]
|
52
|
+
})
|
53
|
+
]
|
54
|
+
});
|
55
|
+
```
|
56
|
+
|
57
|
+
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
+
|
59
|
+
```typescript
|
60
|
+
// main.ts
|
61
|
+
import 'cnhis-design-vue/es/components/index.css';
|
62
|
+
```
|
63
|
+
|
64
|
+
## 3.FAQ
|
65
|
+
|
66
|
+
### 3.1 项目打包后样式丢失
|
67
|
+
|
68
|
+
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
+
|
70
|
+
```typescript
|
71
|
+
// vite.config.ts
|
72
|
+
import { defineConfig } from 'vite';
|
73
|
+
|
74
|
+
export default defineConfig({
|
75
|
+
build: {
|
76
|
+
rollupOptions: {
|
77
|
+
// ..otherOptions
|
78
|
+
output: {
|
79
|
+
dir: './dist',
|
80
|
+
manualChunks: {
|
81
|
+
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
```
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'bpmn-js/lib/Viewer';
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'bpmn-js/lib/features/modeling';
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'diagram-js/lib/navigation/movecanvas';
|
@@ -486,9 +486,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
486
486
|
}>;
|
487
487
|
developMode: boolean;
|
488
488
|
draggable: boolean;
|
489
|
+
isHighlightRow: boolean;
|
489
490
|
idx: number;
|
490
491
|
isHighlight: boolean;
|
491
|
-
isHighlightRow: boolean;
|
492
492
|
isFieldSet: boolean;
|
493
493
|
fieldDescribeMode: "column" | "tooltip";
|
494
494
|
}>;
|
@@ -508,9 +508,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
508
508
|
}>;
|
509
509
|
developMode: boolean;
|
510
510
|
draggable: boolean;
|
511
|
+
isHighlightRow: boolean;
|
511
512
|
idx: number;
|
512
513
|
isHighlight: boolean;
|
513
|
-
isHighlightRow: boolean;
|
514
514
|
isFieldSet: boolean;
|
515
515
|
fieldDescribeMode: "column" | "tooltip";
|
516
516
|
}>;
|
@@ -646,9 +646,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
646
646
|
}>;
|
647
647
|
developMode: boolean;
|
648
648
|
draggable: boolean;
|
649
|
+
isHighlightRow: boolean;
|
649
650
|
idx: number;
|
650
651
|
isHighlight: boolean;
|
651
|
-
isHighlightRow: boolean;
|
652
652
|
isFieldSet: boolean;
|
653
653
|
fieldDescribeMode: "column" | "tooltip";
|
654
654
|
}>;
|
@@ -766,8 +766,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
766
766
|
developMode: boolean;
|
767
767
|
footerFlag: boolean;
|
768
768
|
fieldDescribeMode: "column" | "tooltip";
|
769
|
-
customColumns: FieldSetColumnItem[];
|
770
769
|
showSearch: boolean;
|
770
|
+
customColumns: FieldSetColumnItem[];
|
771
771
|
showSortPriority: boolean;
|
772
772
|
showHeadFilter: boolean;
|
773
773
|
}>;
|
@@ -337,9 +337,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
337
337
|
}>;
|
338
338
|
developMode: boolean;
|
339
339
|
draggable: boolean;
|
340
|
+
isHighlightRow: boolean;
|
340
341
|
idx: number;
|
341
342
|
isHighlight: boolean;
|
342
|
-
isHighlightRow: boolean;
|
343
343
|
isFieldSet: boolean;
|
344
344
|
fieldDescribeMode: "column" | "tooltip";
|
345
345
|
}>;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as s,watch as o,openBlock as a,createBlock as i,unref as n,withCtx as r,withDirectives as l,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as y,vShow as f,normalizeStyle as h}from"vue";import{NModal as
|
1
|
+
import{defineComponent as e,ref as t,computed as s,watch as o,openBlock as a,createBlock as i,unref as n,withCtx as r,withDirectives as l,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as y,vShow as f,normalizeStyle as h}from"vue";import{NModal as v,NImageGroup as g,NImage as w,NInput as b,NIcon as k}from"naive-ui";import{SearchOutline as M,OpenOutline as T,DownloadOutline as I}from"@vicons/ionicons5";import{searchChatRecordApi as S}from"../api/index.js";import{useTheme as _}from"../../../../shared/hooks/useTheme.js";import{useDebounceFn as x}from"@vueuse/core";import{format as j,isSameWeek as A,isSameMonth as H}from"date-fns";import{last as D}from"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as C}from"../../../../shared/hooks/useScrollLoading.js";import{useState as z}from"../hooks/useState.js";import{getFileSize as L,downloadFile as U}from"../utils/index.js";import"trtc-sdk-v5";const E={class:"label"},O={class:"image-box"},$={class:"file-type"},F={class:"text"},K={class:"name"},P={class:"detail"},R={class:"opt-box"};var B=e({__name:"ChatFile",props:{type:{type:String,default:"image"},visible:{type:Boolean}},setup(e){const B=e,G=_(),{state:N}=z(),q=t([]),J=t([]),Q=t(),V=t(),W=t(),X=x(ee,500),Y={page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")};async function Z(){var e;try{if(!Y.hasMore)return;Y.page++;const t=await S({orgId:N.orgId,keyword:W.value,endTime:"",startTime:"",lastSendTime:Y.lastSendTime,memberIdSet:[],page:Y.page,recordType:"image"===B.type?"IMAGE":"FILE",sessionKey:N.currentSessionItem.sessionKey,userId:N.userInfo.id});Array.isArray(t)&&0!==t.length&&Array.isArray(t[0].recordList)||(Y.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let s=t||[];if(Array.isArray(t)&&t.length>0&&(s=t[0].recordList),Y.lastSendTime=null==(e=D(s))?void 0:e.sendTime,"image"===B.type){const e=function(e){const t={};e.forEach((e=>{const s=new Date(e.sendTime);let o=j(s,"yyyy年MM月");A(s,new Date)?o="本周":H(s,new Date)&&(o="本月"),t[o]||(t[o]=[]),t[o].push(e.content.msg)}));return Object.entries(t).map((([e,t])=>({label:e,list:t})))}(s);q.value=Y.page>1?q.value.concat(e):e}else{const e=s.map((e=>new Promise((async t=>{const s=await L(e.content.fileUrl);t({...e,size:s})})))),t=await Promise.all(e);J.value=Y.page>1?J.value.concat(t):t}}catch(e){console.log(e)}}function ee(){Object.assign(Y,{page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")}),Z()}C(Q,(()=>{Z()})),C(V,(()=>{Z()}));const te=s((()=>"image"===B.type?"聊天图片":"聊天文件"));function se(e){const{size:t,sendTime:s,senderName:o}=e;return`${t} · ${j(new Date(s),"yyyy/MM/dd HH:mm")} ${o}`}function oe(e){var t;const s=(null==(t=e.content)?void 0:t.msg)||"",o=s.lastIndexOf(".");if(-1!==o){return s.charAt(o+1).toUpperCase()}return"?"}return o((()=>B.visible),(e=>{e?ee():W.value=""})),(t,s)=>(a(),i(n(v),{preset:"dialog",title:n(te),"show-icon":!1,"auto-focus":!1,class:"iho-chat-dialog"},{default:r((()=>[l(c("div",{class:"iho-chat-dialog__content iho-chat-image-wrapper",ref_key:"imageRef",ref:Q},[m(n(g),{"show-toolbar-tooltip":""},{default:r((()=>[(a(!0),p(d,null,u(q.value,(e=>(a(),p("div",{class:"image-item",key:e.label},[c("span",E,y(e.label),1),c("div",O,[(a(!0),p(d,null,u(e.list,(e=>(a(),i(n(w),{key:e,width:"80",height:"80",src:e},null,8,["src"])))),128))])])))),128))])),_:1})],512),[[f,"image"===e.type]]),l(c("div",{class:"iho-chat-dialog__content iho-chat-file-wrapper",style:h(n(G))},[m(n(b),{clearable:"",placeholder:"搜索文件",value:W.value,"onUpdate:value":s[0]||(s[0]=e=>W.value=e),valueModifiers:{trim:!0},onInput:n(X)},{prefix:r((()=>[m(n(k),{component:n(M)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"file-list-box",ref_key:"fileRef",ref:V},[(a(!0),p(d,null,u(J.value,((e,t)=>(a(),p("div",{class:"file-item",key:t},[c("span",$,y(oe(e)),1),c("div",F,[c("span",K,y(e.content.msg),1),c("span",P,y(se(e)),1)]),c("div",R,[m(n(k),{size:16,component:n(T)},null,8,["component"]),m(n(k),{size:16,component:n(I),onClick:()=>n(U)(e.content.fileUr,e.content.msg)},null,8,["component","onClick"])])])))),128))],512)],4),[[f,"image"!==e.type]])])),_:1},8,["title"]))}});export{B as default};
|
@@ -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 l,createVNode as c,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as v,createBlock as f,createElementVNode as g,withModifiers as y,nextTick as
|
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 l,createVNode as c,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as v,createBlock as f,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as k,NIcon as _,NSpace as x,NButtonGroup as S,NButton as w,NTooltip as I}from"naive-ui";import{format as C}from"date-fns";import{getHistoryRecordApi as L,readMessageApi as j}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{MESSAGE_TYPE as z}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as H,getAVTime as O,downloadFile as D}from"../utils/index.js";import{first as R,last as N}from"lodash-es";import P from"./PersonProfile.vue.js";import q from"./MessageTemplate.vue.js";import{emojis as B}from"../utils/emoji.js";import U from"./ContextMenu.js";import"../../../../shared/utils/index.js";import"@vueuse/core";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{CallOutline as F,VideocamOutline as G,DocumentSharp as J,ChatbubbleEllipsesOutline as K,EllipsisHorizontal as X,ArrowDownSharp as Y}from"@vicons/ionicons5";import{useScrollLoading as $}from"../../../../shared/hooks/useScrollLoading.js";const Q={key:0,class:"time"},V={key:2,class:"message-box"},W={key:0,class:"content-box"},Z={class:"name-box"},ee=["data-time"],te=["onContextmenu"],ne={key:0,class:"reference-content"},se=["innerHTML"],oe=["innerHTML"],ie=["innerHTML"],ae=["src"],re={style:{"margin-left":"8px"}},le={class:"size"};var ce=e({__name:"ChatMain",setup(e){const ce=t(),{state:ue,setMsgList:me}=E(),{setCurrentSessionItem:pe,isGroupChat:de}=b(ue),ve=t(),fe=t(!1),ge=t({left:0,top:0}),ye=t(),he={page:0,hasMore:!0,lastSendTime:C(new Date,"yyyy-MM-dd HH:mm:ss")},Te=n((()=>({"--c-tip-top":de.value?"1px":"-20px","--c-tip-gap":de.value?"10px":"0px"})));function Me({nodes:e}){var t,n;const{_ctx:s}=null==(t=e.download)?void 0:t.children,o=s?null==(n=null==s?void 0:s.proxy)?void 0:n.previewSrc:"";return[e.prev,e.next,e.rotateCounterclockwise,e.rotateClockwise,e.resizeToOriginalSize,e.zoomOut,e.zoomIn,c(I,null,{trigger:()=>c(_,{style:"cursor: pointer",color:"rgba(255, 255, 255, 0.75",size:24,component:Y,onClick:()=>o&&D(o,"img")},null),default:()=>"下载"}),e.close]}async function ke(){try{if(!he.hasMore)return;he.page++;const e=await L({sessionKey:ue.currentSessionItem.sessionKey,page:he.page,lastSendTime:he.lastSendTime});if(!Array.isArray(e)||0===e.length)return he.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=R(e).id;he.lastSendTime=N(e).sendTime,me(he.page>1?[...e,...ue.msgList]:e),1===he.page&&ue.currentSessionItem.unreadNum&&(await j({chatType:ue.currentSessionItem.chatType,messageIdSet:[t],receiver:ue.userInfo.id,sender:ue.currentSessionItem.receiver}),pe({unreadNum:0}))}catch(e){console.log(e)}}async function _e(e,t){ye.value=t,async function(e){var t,n,s,o,i,a;fe.value=!0,await h();const{clientX:r,clientY:l}=e,{width:c=0,height:u=0,left:m=0,top:p=0}=(null==(t=ce.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=ve.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,v=null!=(a=null==(i=ce.value)?void 0:i.scrollTop)?a:0,f=5,g={};r<=m+c/2?g.left=r-m+f+"px":g.right=m+c-r-f+"px";l-p<d/2?g.top=v+f+"px":p+u-l<=d/2?g.bottom=Math.abs(v)+f+"px":g.top=v+l-p-d/2+"px";ge.value=g}(e)}function xe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==z.TEMPLATE||!!n}function Se(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===z.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function we(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===z.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function Ie(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ue.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function Ce(e){ue.currentReferenceMsg=e,Object.assign(ue.currentReferenceMsg,{chatType:ue.currentSessionItem.chatType,receiver:ue.currentSessionItem.receiver,receiverAvatar:ue.currentSessionItem.avatar,receiverName:ue.currentSessionItem.name})}function Le(e,t){"reply"===e&&Ce(t)}return $(ce,(()=>{ke()}),"top",(()=>{fe.value=!1})),s((()=>ue.id),(e=>{e&&(ue.currentReferenceMsg=null,Object.assign(he,{page:0,hasMore:!0,lastSendTime:C(new Date,"yyyy-MM-dd HH:mm:ss")}),ke())}),{immediate:!0}),s((()=>ue.isAppendMsg),(e=>{e&&(me([...ue.msgList,ue.currentMsg]),ue.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ce.value)?void 0:e.scrollHeight)?t:0;null==(n=ce.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(ue).id}]),ref_key:"chatMainRef",ref:ce,style:l(r(Te))},[c(r(T),{"show-toolbar-tooltip":"","render-toolbar":Me},{default:u((()=>[(o(!0),i(m,null,p(r(ue).msgList,((e,t)=>(o(),i(m,{key:e.id},[xe(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ue).userInfo.id}])},[Ie(e,t)?(o(),i("p",Q,d(e.__sendTime),1)):v("v-if",!0),Se(e,"system")?(o(),f(q,{key:1,data:e},null,8,["data"])):(o(),i("div",V,[c(P,{"user-id":e.sender,placement:e.sender==r(ue).userInfo.id?"left":"right"},{trigger:u((()=>[c(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",W,[g("div",Z,[g("span",{class:"name","data-time":e.__time},d(r(de)?e.senderName:""),9,ee)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(z).EMOJI,template:e.content.chatMessageType===r(z).TEMPLATE,"template--3":we(e.content),"audio-video":r(A)(e.content),file:e.content.chatMessageType===r(z).FILE}]),onContextmenu:y((t=>_e(t,e.id)),["prevent"])},[e.content.chatMessageType===r(z).TEXT?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",ne,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(H)(e.content.referenceContent.content)},null,8,se)])):v("v-if",!0),g("pre",{innerHTML:e.__content},null,8,oe)],64)):v("v-if",!0),e.content.chatMessageType===r(z).BLEND?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,ie)):v("v-if",!0),e.content.chatMessageType===r(z).EMOJI?(o(),i("img",{key:2,src:r(B).findEmoji(e.__content)},null,8,ae)):v("v-if",!0),Se(e,"template")?(o(),f(q,{key:3,data:e},null,8,["data"])):v("v-if",!0),e.content.chatMessageType===r(z).IMAGE?(o(),f(r(k),{key:4,width:"240",src:e.__content},null,8,["src"])):v("v-if",!0),r(A)(e.content)?(o(),i(m,{key:5},[c(r(_),{class:a({"is-audio":e.content.chatMessageType===r(z).AUDIO}),component:e.content.chatMessageType===r(z).AUDIO?r(F):r(G)},null,8,["class","component"]),g("span",re,d(r(O)(e.__content)),1)],64)):v("v-if",!0),e.content.chatMessageType===r(z).FILE?(o(),f(r(x),{key:6,"wrap-item":!1},{default:u((()=>[c(r(_),{class:"icon-file",size:"40",component:r(J)},null,8,["component"]),c(r(x),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[g("span",null,d(e.__content),1),g("span",le,d(e.__size),1)])),_:2},1024)])),_:2},1024)):v("v-if",!0),c(r(S),{class:"quick-menu"},{default:u((()=>[r(A)(e.content)?v("v-if",!0):(o(),i(m,{key:0},[v(' <n-button quaternary size="tiny">\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),c(r(w),{quaternary:"",size:"tiny",onClick:()=>Ce(e)},{icon:u((()=>[c(r(_),{size:"17",component:r(K)},null,8,["component"])])),_:2},1032,["onClick"])],64)),c(r(w),{quaternary:"",size:"tiny",onClick:t=>_e(t,e.id)},{icon:u((()=>[c(r(_),{size:"14",component:r(X)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,te)])):v("v-if",!0)]))],2)):v("v-if",!0)],64)))),128))])),_:1}),c(r(U),{ref_key:"contextmenuRef",ref:ve,show:fe.value,"onUpdate:show":t[0]||(t[0]=e=>fe.value=e),position:ge.value,"msg-id":ye.value,onSelect:Le},null,8,["show","position","msg-id"])],6))}});export{ce as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as a,watch as l,openBlock as t,createBlock as s,unref as r,withCtx as o,createElementVNode as n,createVNode as i,toDisplayString as u,resolveDynamicComponent as c,createElementBlock as d,Fragment as v,renderList as m,withDirectives as p,createTextVNode as f,vShow as g}from"vue";import{NModal as h,NAvatar as y,NInputGroup as b,NInput as _,NSelect as T,NPopover as k,NTag as M,NIcon as x}from"naive-ui";import{SearchOutline as
|
1
|
+
import{defineComponent as e,ref as a,watch as l,openBlock as t,createBlock as s,unref as r,withCtx as o,createElementVNode as n,createVNode as i,toDisplayString as u,resolveDynamicComponent as c,createElementBlock as d,Fragment as v,renderList as m,withDirectives as p,createTextVNode as f,vShow as g}from"vue";import{NModal as h,NAvatar as y,NInputGroup as b,NInput as _,NSelect as T,NPopover as k,NTag as M,NIcon as x}from"naive-ui";import{SearchOutline as j}from"@vicons/ionicons5";import{useState as w}from"../hooks/useState.js";import{transformMessage as I,formatTime as S}from"../utils/index.js";import{last as A}from"lodash-es";import{MESSAGE_TYPE as L}from"../constants/index.js";import{searchChatRecordApi as C}from"../api/index.js";import"trtc-sdk-v5";import E from"../../../date-picker/index.js";import{useDebounceFn as H}from"@vueuse/core";import{format as U}from"date-fns";import"../../../../shared/utils/index.js";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as D}from"../../../../shared/hooks/useScrollLoading.js";import{emojis as z}from"../utils/emoji.js";const G={class:"iho-chat-dialog__header"},B=n("span",{class:"left"},"聊天记录",-1),K={class:"center"},N={class:"iho-chat-dialog__content iho-chat-record-wrapper"},O={class:"chat-record-box"},R={class:"msg-box"},J={class:"name-and-time"},P={class:"content"},X=["src"],$=["src"],q=["innerHTML"],F={key:1,class:"no-data"},Q={class:"chat-record-box__filter"},V=n("span",{class:"filter-title"},"添加筛选条件",-1),W={class:"filter-item"},Y=n("span",{class:"label"},"成员:",-1),Z={class:"filter-item"},ee=n("span",{class:"label"},"日期:",-1),ae={class:"time-target"},le={class:"time-target__item"},te=n("span",null,"开始:",-1),se={class:"tip"},re={class:"time-target__item"},oe=n("span",null,"结束:",-1),ne={class:"tip"};var ie=e({__name:"ChatRecord",props:{visible:{type:Boolean}},setup(e){const ie=e,ue={color:"#fff",textColor:"#666"},{state:ce}=w(),de=a(),ve=a([]),me=a(),pe=a([]),fe=a(),ge=a(),he=H(_e,500),ye={page:0,hasMore:!0,lastSendTime:U(new Date,"yyyy-MM-dd HH:mm:ss")};async function be(){var e;try{if(!ye.hasMore)return;ye.page++;const a=await C({orgId:ce.orgId,keyword:me.value,endTime:ge.value?ge.value+" 23:59:59":"",startTime:fe.value?fe.value+" 00:00:00":"",lastSendTime:ye.lastSendTime,memberIdSet:pe.value,page:ye.page,recordType:"ALL",sessionKey:ce.currentSessionItem.sessionKey,userId:ce.userInfo.id});Array.isArray(a)&&0!==a.length&&Array.isArray(a[0].recordList)||(ye.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let l=a||[];Array.isArray(a)&&a.length>0&&(l=a[0].recordList),ye.lastSendTime=null==(e=A(l))?void 0:e.sendTime,l.forEach((e=>{var a,l,t,s;let r="";switch(e.content.chatMessageType){case L.TEXT:case L.BLEND:r=I(e.content);break;case L.TEMPLATE:r=null==(t=null==(l=null==(a=e.content)?void 0:a.messageTemplate)?void 0:l.setting)?void 0:t.title;break;default:r=null==(s=e.content)?void 0:s.msg}e.__content=r})),ve.value=ye.page>1?ve.value.concat(l):l}catch(e){console.log(e)}}function _e(){Object.assign(ye,{page:0,hasMore:!0,lastSendTime:ge.value||U(new Date,"yyyy-MM-dd HH:mm:ss")}),be()}function Te(e){return!!ge.value&&e>Date.parse(`${ge.value} 23:59:59`)}function ke(e){return!!fe.value&&e<Date.parse(fe.value)}function Me(e){switch(e){case"member":pe.value=[];break;case"start":fe.value=null;break;case"end":ge.value=null}}function xe(e){return i(v,null,[i("div",{style:"display: flex;align-items: center"},[i(y,{src:e.avatar,round:!0,size:"small"},null),i("span",{style:"margin-left: 10px"},[e.name])])])}return D(de,(()=>{be()})),l([()=>pe.value,()=>fe.value,()=>ge.value],(()=>{ie.visible&&_e()}),{deep:!0}),l((()=>ie.visible),(e=>{e?_e():(me.value="",ge.value=null,fe.value=null,pe.value=[],ve.value=[])})),(e,a)=>(t(),s(r(h),{preset:"dialog",title:"","show-icon":!1,"auto-focus":!1,class:"iho-chat-dialog"},{header:o((()=>[n("div",G,[B,n("div",K,[i(r(y),{round:"",size:30,src:r(ce).currentSessionItem.avatar},null,8,["src"]),n("span",null,u(r(ce).currentSessionItem.name),1)])])])),default:o((()=>[n("div",N,[i(r(b),null,{default:o((()=>[(t(),s(c((()=>[i(x,{component:j,size:18,color:"#6666"},null),pe.value.length>0?i(M,{closable:!0,bordered:!1,color:ue,onClose:()=>Me("member")},{default:()=>{var e;return[f("成员:")," ",pe.value.length>1?pe.value.length+"人":null==(e=ce.currentGroupUser.find((e=>e.id===pe.value[0])))?void 0:e.name]}}):null,fe.value?i(M,{closable:!0,bordered:!1,color:ue,onClose:()=>Me("start")},{default:()=>[f("起始时间: "),fe.value]}):null,ge.value?i(M,{closable:!0,bordered:!1,color:ue,onClose:()=>Me("end")},{default:()=>[f("结束时间: "),ge.value]}):null])))),i(r(_),{placeholder:"搜索",value:me.value,"onUpdate:value":a[0]||(a[0]=e=>me.value=e),valueModifiers:{trim:!0},onInput:r(he)},null,8,["value","onInput"])])),_:1}),n("div",O,[n("div",{class:"chat-record-box__content",ref_key:"recordRef",ref:de},[ve.value.length>0?(t(!0),d(v,{key:0},m(ve.value,(e=>(t(),d("div",{class:"content-item",key:e.id},[i(r(y),{round:"",size:38,src:e.senderAvatar},null,8,["src"]),n("div",R,[n("div",J,[n("span",null,u(e.senderName),1),n("span",null,u(r(S)(e.sendTime).recordTime),1)]),n("div",P,[e.content.chatMessageType===r(L).IMAGE?(t(),d("img",{key:0,class:"img",src:e.__content},null,8,X)):e.content.chatMessageType===r(L).EMOJI?(t(),d("img",{key:1,class:"emoji",src:r(z).findEmoji(e.__content)},null,8,$)):(t(),d("p",{key:2,innerHTML:e.__content},null,8,q))])])])))),128)):(t(),d("div",F,"没有找到相关记录"))],512),n("div",Q,[V,n("div",W,[Y,i(r(T),{value:pe.value,"onUpdate:value":a[1]||(a[1]=e=>pe.value=e),multiple:"","max-tag-count":1,"render-label":xe,options:r(ce).currentGroupUser,"value-field":"id"},null,8,["value","options"])]),n("div",Z,[ee,n("div",ae,[i(r(k),{trigger:"click","show-arrow":!1},{trigger:o((()=>[n("div",le,[te,p(i(r(M),{bordered:!1,color:ue,closable:"",onClose:a[2]||(a[2]=()=>Me("start"))},{default:o((()=>[f(u(fe.value),1)])),_:1},512),[[g,fe.value]]),p(n("span",se,"点击选择",512),[[g,!fe.value]])])])),default:o((()=>[i(r(E),{"formatted-value":fe.value,"onUpdate:formatted-value":a[3]||(a[3]=e=>fe.value=e),type:"date",panel:"",clearable:"","is-date-disabled":Te},null,8,["formatted-value"])])),_:1}),i(r(k),{trigger:"click","show-arrow":!1},{trigger:o((()=>[n("div",re,[oe,p(i(r(M),{bordered:!1,color:ue,closable:"",onClose:a[4]||(a[4]=()=>Me("end"))},{default:o((()=>[f(u(ge.value),1)])),_:1},512),[[g,ge.value]]),p(n("span",ne,"点击选择",512),[[g,!ge.value]])])])),default:o((()=>[i(r(E),{"formatted-value":ge.value,"onUpdate:formatted-value":a[5]||(a[5]=e=>ge.value=e),type:"date",panel:"",clearable:"","is-date-disabled":ke},null,8,["formatted-value"])])),_:1})])])])])])])),_:1}))}});export{ie as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{ref as e}from"vue";import{isArray as o}from"lodash-es";import{listUserApi as r}from"../api/index.js";import{useDebounceFn as t}from"@vueuse/core";import{useScrollLoading as
|
1
|
+
import{ref as e}from"vue";import{isArray as o}from"lodash-es";import{listUserApi as r}from"../api/index.js";import{useDebounceFn as t}from"@vueuse/core";import"../../../../shared/utils/index.js";import"naive-ui";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as s}from"../../../../shared/hooks/useScrollLoading.js";import{useState as a}from"./useState.js";import"../utils/emoji.js";import"trtc-sdk-v5";function i({wrapperRef:i,keywordRef:n,before:p,after:u}){const l={page:0,hasMore:!0},{state:c}=a(),m=e([]),d=t((function(){Object.assign(l,{page:0,hasMore:!0}),f()}),300);async function f(){const e=(n.value||"").replace(/^\s+|\s+$/g,"");if(!e)return void(p?p():m.value=[]);if(!l.hasMore)return;l.page++,1==l.page&&(m.value=[]);const t=await r({orgId:c.orgId,keyword:e,page:l.page,pageSize:10});o(t.records)&&m.value.length<=+t.total&&(m.value=l.page>1?m.value.concat(t.records):t.records,null==u||u(),m.value.length>=+t.total&&(l.hasMore=!1,console.log("没有更多消息了")))}return s(i,(()=>{f()})),{userList:m,handleInput:d}}export{i as useSearchUserList};
|