cnhis-design-vue 3.2.4-beta.20 → 3.2.4-beta.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. package/es/components/biunique-chat/index.d.ts +39 -9
  2. package/es/components/biunique-chat/src/Index.vue.d.ts +39 -9
  3. package/es/components/biunique-chat/src/components/ChatFile.vue.d.ts +26 -8
  4. package/es/components/biunique-chat/src/components/ChatFile.vue2.js +1 -1
  5. package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
  6. package/es/components/biunique-chat/src/components/ChatHeader.vue.d.ts +39 -9
  7. package/es/components/biunique-chat/src/components/ChatHeader.vue2.js +1 -1
  8. package/es/components/biunique-chat/src/components/ChatRecord.vue.d.ts +13 -1
  9. package/es/components/biunique-chat/src/components/ChatRecord.vue2.js +1 -1
  10. package/es/components/biunique-chat/src/hooks/useScrollLoading.d.ts +1 -1
  11. package/es/components/biunique-chat/src/hooks/useScrollLoading.js +1 -1
  12. package/es/components/biunique-chat/style/index.css +1 -1
  13. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  14. package/es/components/classification/src/index.vue.d.ts +3 -0
  15. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  16. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  17. package/es/components/field-set/src/components/Row.vue.d.ts +1 -1
  18. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +1 -0
  19. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue2.js +1 -1
  20. package/es/components/index.css +1 -1
  21. package/es/env.d.ts +25 -25
  22. package/es/shared/package.json.js +1 -1
  23. package/package.json +2 -2
@@ -836,23 +836,37 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
836
836
  type: StringConstructor;
837
837
  default: string;
838
838
  };
839
+ visible: {
840
+ type: BooleanConstructor;
841
+ };
839
842
  }, {
840
843
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
841
844
  type: {
842
845
  type: StringConstructor;
843
846
  default: string;
844
847
  };
848
+ visible: {
849
+ type: BooleanConstructor;
850
+ };
845
851
  }>> & {}>>;
846
- imageList: {
852
+ state: import("./src/types").IState;
853
+ imageList: import("vue").Ref<import("../../shared/types").AnyObject[]>;
854
+ fileList: import("vue").Ref<import("../../shared/types").AnyObject[]>;
855
+ imageRef: import("vue").Ref<any>;
856
+ fileRef: import("vue").Ref<any>;
857
+ keyword: import("vue").Ref<any>;
858
+ handleInput: () => void;
859
+ currentInfo: {
860
+ page: number;
861
+ hasMore: boolean;
862
+ lastSendTime: string;
863
+ };
864
+ handleSearch: () => Promise<void>;
865
+ formatImageList: (data: import("../../shared/types").AnyObject[]) => {
847
866
  label: string;
848
- data: string[];
849
- }[];
850
- fileList: {
851
- name: string;
852
- size: string;
853
- time: string;
854
- sender: string;
867
+ list: unknown;
855
868
  }[];
869
+ resetAndSearch: () => void;
856
870
  title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
857
871
  getDetail: (item: import("../../shared/types").AnyObject) => string;
858
872
  NModal: any;
@@ -1066,8 +1080,12 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1066
1080
  type: StringConstructor;
1067
1081
  default: string;
1068
1082
  };
1083
+ visible: {
1084
+ type: BooleanConstructor;
1085
+ };
1069
1086
  }>>, {
1070
1087
  type: string;
1088
+ visible: boolean;
1071
1089
  }>;
1072
1090
  ChatRecord: import("vue").DefineComponent<{
1073
1091
  visible: {
@@ -1102,7 +1120,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1102
1120
  startDateDisabled: (ts: number) => boolean;
1103
1121
  endDateDisabled: (ts: number) => boolean;
1104
1122
  resetInfo: () => void;
1105
- handleCloseTag: (type: "end" | "start" | "member", e: Event) => void;
1123
+ handleCloseTag: (type: "end" | "start" | "member") => void;
1106
1124
  getPrefixCondition: () => (JSX.Element | null)[];
1107
1125
  renderLabel: (option: import("../../shared/types").AnyObject) => JSX.Element;
1108
1126
  NModal: any;
@@ -1111,6 +1129,17 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1111
1129
  NSelect: any;
1112
1130
  NAvatar: any;
1113
1131
  NPopover: any;
1132
+ NInputGroup: import("vue").DefineComponent<{
1133
+ [x: string]: never;
1134
+ [x: number]: never;
1135
+ [x: symbol]: never;
1136
+ }, {
1137
+ mergedClsPrefix: import("vue").ComputedRef<string>;
1138
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1139
+ [x: string]: never;
1140
+ [x: number]: never;
1141
+ [x: symbol]: never;
1142
+ }>>, {}>;
1114
1143
  DatePicker: SFCWithInstall<import("vue").DefineComponent<{
1115
1144
  updateUnchangedValue: {
1116
1145
  type: BooleanConstructor;
@@ -1190,6 +1219,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1190
1219
  }>>;
1191
1220
  formatTime: typeof import("./src/utils").formatTime;
1192
1221
  MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
1222
+ images: import("vue").Ref<any[]>;
1193
1223
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1194
1224
  visible: {
1195
1225
  type: BooleanConstructor;
@@ -839,23 +839,37 @@ declare const _default: import("vue").DefineComponent<{
839
839
  type: StringConstructor;
840
840
  default: string;
841
841
  };
842
+ visible: {
843
+ type: BooleanConstructor;
844
+ };
842
845
  }, {
843
846
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
844
847
  type: {
845
848
  type: StringConstructor;
846
849
  default: string;
847
850
  };
851
+ visible: {
852
+ type: BooleanConstructor;
853
+ };
848
854
  }>> & {}>>;
849
- imageList: {
855
+ state: IState;
856
+ imageList: import("vue").Ref<AnyObject[]>;
857
+ fileList: import("vue").Ref<AnyObject[]>;
858
+ imageRef: import("vue").Ref<any>;
859
+ fileRef: import("vue").Ref<any>;
860
+ keyword: import("vue").Ref<any>;
861
+ handleInput: () => void;
862
+ currentInfo: {
863
+ page: number;
864
+ hasMore: boolean;
865
+ lastSendTime: string;
866
+ };
867
+ handleSearch: () => Promise<void>;
868
+ formatImageList: (data: AnyObject[]) => {
850
869
  label: string;
851
- data: string[];
852
- }[];
853
- fileList: {
854
- name: string;
855
- size: string;
856
- time: string;
857
- sender: string;
870
+ list: unknown;
858
871
  }[];
872
+ resetAndSearch: () => void;
859
873
  title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
860
874
  getDetail: (item: AnyObject) => string;
861
875
  NModal: any;
@@ -1069,8 +1083,12 @@ declare const _default: import("vue").DefineComponent<{
1069
1083
  type: StringConstructor;
1070
1084
  default: string;
1071
1085
  };
1086
+ visible: {
1087
+ type: BooleanConstructor;
1088
+ };
1072
1089
  }>>, {
1073
1090
  type: string;
1091
+ visible: boolean;
1074
1092
  }>;
1075
1093
  ChatRecord: import("vue").DefineComponent<{
1076
1094
  visible: {
@@ -1105,7 +1123,7 @@ declare const _default: import("vue").DefineComponent<{
1105
1123
  startDateDisabled: (ts: number) => boolean;
1106
1124
  endDateDisabled: (ts: number) => boolean;
1107
1125
  resetInfo: () => void;
1108
- handleCloseTag: (type: "end" | "start" | "member", e: Event) => void;
1126
+ handleCloseTag: (type: "end" | "start" | "member") => void;
1109
1127
  getPrefixCondition: () => (JSX.Element | null)[];
1110
1128
  renderLabel: (option: AnyObject) => JSX.Element;
1111
1129
  NModal: any;
@@ -1114,6 +1132,17 @@ declare const _default: import("vue").DefineComponent<{
1114
1132
  NSelect: any;
1115
1133
  NAvatar: any;
1116
1134
  NPopover: any;
1135
+ NInputGroup: import("vue").DefineComponent<{
1136
+ [x: string]: never;
1137
+ [x: number]: never;
1138
+ [x: symbol]: never;
1139
+ }, {
1140
+ mergedClsPrefix: import("vue").ComputedRef<string>;
1141
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1142
+ [x: string]: never;
1143
+ [x: number]: never;
1144
+ [x: symbol]: never;
1145
+ }>>, {}>;
1117
1146
  DatePicker: import("../../../shared/types").SFCWithInstall<import("vue").DefineComponent<{
1118
1147
  updateUnchangedValue: {
1119
1148
  type: BooleanConstructor;
@@ -1193,6 +1222,7 @@ declare const _default: import("vue").DefineComponent<{
1193
1222
  }>>;
1194
1223
  formatTime: typeof import("./utils").formatTime;
1195
1224
  MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
1225
+ images: import("vue").Ref<any[]>;
1196
1226
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1197
1227
  visible: {
1198
1228
  type: BooleanConstructor;
@@ -5,23 +5,37 @@ declare const _default: import("vue").DefineComponent<{
5
5
  type: StringConstructor;
6
6
  default: string;
7
7
  };
8
+ visible: {
9
+ type: BooleanConstructor;
10
+ };
8
11
  }, {
9
12
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
10
13
  type: {
11
14
  type: StringConstructor;
12
15
  default: string;
13
16
  };
17
+ visible: {
18
+ type: BooleanConstructor;
19
+ };
14
20
  }>> & {}>>;
15
- imageList: {
21
+ state: import("../types").IState;
22
+ imageList: import("vue").Ref<AnyObject[]>;
23
+ fileList: import("vue").Ref<AnyObject[]>;
24
+ imageRef: import("vue").Ref<any>;
25
+ fileRef: import("vue").Ref<any>;
26
+ keyword: import("vue").Ref<any>;
27
+ handleInput: () => void;
28
+ currentInfo: {
29
+ page: number;
30
+ hasMore: boolean;
31
+ lastSendTime: string;
32
+ };
33
+ handleSearch: () => Promise<void>;
34
+ formatImageList: (data: AnyObject[]) => {
16
35
  label: string;
17
- data: string[];
18
- }[];
19
- fileList: {
20
- name: string;
21
- size: string;
22
- time: string;
23
- sender: string;
36
+ list: unknown;
24
37
  }[];
38
+ resetAndSearch: () => void;
25
39
  title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
26
40
  getDetail: (item: AnyObject) => string;
27
41
  NModal: any;
@@ -235,7 +249,11 @@ declare const _default: import("vue").DefineComponent<{
235
249
  type: StringConstructor;
236
250
  default: string;
237
251
  };
252
+ visible: {
253
+ type: BooleanConstructor;
254
+ };
238
255
  }>>, {
239
256
  type: string;
257
+ visible: boolean;
240
258
  }>;
241
259
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as t,computed as i,openBlock as a,createBlock as e,unref as m,withCtx as c,createElementBlock as s,createVNode as p,Fragment as o,renderList as l,createElementVNode as n,toDisplayString as u}from"vue";import{NModal as d,NImageGroup as f,NImage as h,NInput as r,NIcon as g}from"naive-ui";import{SearchOutline as b,OpenOutline as y,DownloadOutline as w}from"@vicons/ionicons5";const G={key:0,class:"c-chat-dialog__content c-chat-image-wrapper"},v={class:"label"},E={class:"image-box"},P={key:1,class:"c-chat-dialog__content c-chat-file-wrapper"},_={class:"file-list-box"},x={class:"text"},J={class:"name"},k={class:"detail"},C={class:"opt-box"};var z=t({__name:"ChatFile",props:{type:{type:String,default:"image"}},setup(t){const z=t,j=[{label:"本周",data:["https://cdn.cnhis.cc/1204564363755786242/03014.jpg","https://img1.baidu.com/it/u=1068679326,1387532038&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=664","https://img0.baidu.com/it/u=2417241712,2153529446&fm=253&fmt=auto&app=138&f=JPEG?w=501&h=500"]},{label:"本月",data:["https://img1.baidu.com/it/u=1068679326,1387532038&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=664","https://img0.baidu.com/it/u=2417241712,2153529446&fm=253&fmt=auto&app=138&f=JPEG?w=501&h=500","https://himg.bdimg.com/sys/portrait/item/public.1.f50c02bd.y9WGGCP1aqCEf85wL6yrng?tt=1706769350037"]},{label:"2024年01月",data:["https://cdn.cnhis.cc/1204564363755786242/03014.jpg","https://img1.baidu.com/it/u=1068679326,1387532038&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=664","https://img0.baidu.com/it/u=2417241712,2153529446&fm=253&fmt=auto&app=138&f=JPEG?w=501&h=500","https://himg.bdimg.com/sys/portrait/item/public.1.f50c02bd.y9WGGCP1aqCEf85wL6yrng?tt=1706769350037","https://cdn.cnhis.cc/1204564363755786242/03014.jpg","https://img1.baidu.com/it/u=1068679326,1387532038&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=664","https://img0.baidu.com/it/u=2417241712,2153529446&fm=253&fmt=auto&app=138&f=JPEG?w=501&h=500","https://himg.bdimg.com/sys/portrait/item/public.1.f50c02bd.y9WGGCP1aqCEf85wL6yrng?tt=1706769350037"]}],q=[{name:"问的那个1.docx",size:"8kb",time:"2024/01/01 10:30",sender:"大傻子(质控部)"},{name:"问的那个21.docx",size:"8kb",time:"2024/01/01 10:30",sender:"大傻子(质控2部)"}],L=i((()=>"image"===z.type?"聊天图片":"聊天文件"));function W(t){const{size:i,time:a,sender:e}=t;return`${i}.${a}.${e}`}return(i,z)=>(a(),e(m(d),{preset:"dialog",title:m(L),"show-icon":!1,class:"c-chat-dialog"},{default:c((()=>["image"===t.type?(a(),s("div",G,[p(m(f),null,{default:c((()=>[(a(),s(o,null,l(j,(t=>n("div",{class:"image-item",key:t.label},[n("span",v,u(t.label),1),n("div",E,[(a(!0),s(o,null,l(t.data,((t,i)=>(a(),e(m(h),{key:i,width:"80",height:"80",src:t},null,8,["src"])))),128))])]))),64))])),_:1})])):(a(),s("div",P,[p(m(r),{placeholder:"搜索文件"},{prefix:c((()=>[p(m(g),{component:m(b)},null,8,["component"])])),_:1}),n("div",_,[(a(),s(o,null,l(q,((t,i)=>n("div",{class:"file-item",key:i},[p(m(g),{component:m(b)},null,8,["component"]),n("div",x,[n("span",J,u(t.name),1),n("span",k,u(W(t)),1)]),n("div",C,[p(m(g),{size:16,component:m(y)},null,8,["component"]),p(m(g),{size:16,component:m(w)},null,8,["component"])])]))),64))])]))])),_:1},8,["title"]))}});export{z as default};
1
+ import{defineComponent as e,ref as t,computed as a,watch as o,openBlock as s,createBlock as i,unref as n,withCtx as l,withDirectives as r,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as y,vShow as f}from"vue";import{NModal as g,NImageGroup as v,NImage as h,NInput as b,NIcon as w}from"naive-ui";import{SearchOutline as M,OpenOutline as _,DownloadOutline as k}from"@vicons/ionicons5";import{searchChatRecordApi as I}from"../api/index.js";import{useScrollLoading as S}from"../hooks/useScrollLoading.js";import{format as T,isSameWeek as x,isSameMonth as j}from"date-fns";import{useState as A}from"../hooks/useState.js";import{last as z}from"lodash-es";import"../utils/emoji.js";import{useDebounceFn as D}from"@vueuse/core";const H={class:"label"},L={class:"image-box"},E={class:"c-chat-dialog__content c-chat-file-wrapper"},$={class:"text"},F={class:"name"},K={class:"detail"},O={class:"opt-box"};var R=e({__name:"ChatFile",props:{type:{type:String,default:"image"},visible:{type:Boolean}},setup(e){const R=e,{state:B}=A(),C=t([]),G=t([{name:"问的那个1.docx",size:"8kb",time:"2024/01/01 10:30",sender:"大傻子(质控部)"},{name:"问的那个21.docx",size:"8kb",time:"2024/01/01 10:30",sender:"大傻子(质控2部)"}]),U=t(),q=t(),J=t(),N=D(V,500),P={page:0,hasMore:!0,lastSendTime:T(new Date,"yyyy-MM-dd HH:mm:ss")};async function Q(){var e;try{if(!P.hasMore)return;P.page++;const t=await I({orgId:B.orgId,keyword:J.value,endTime:"",startTime:"",lastSendTime:P.lastSendTime,memberIdSet:[],page:P.page,recordType:"image"===R.type?"IMAGE":"FILE",sessionKey:B.currentSessionItem.sessionKey,userId:B.userInfo.id});Array.isArray(t)&&0!==t.length&&Array.isArray(t[0].recordList)||(P.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let a=t||[];if(Array.isArray(t)&&t.length>0&&(a=t[0].recordList),P.lastSendTime=null==(e=z(a))?void 0:e.sendTime,"image"===R.type){const e=function(e){const t={};e.forEach((e=>{const a=new Date(e.sendTime);let o=T(a,"yyyy年MM月");x(a,new Date)?o="本周":j(a,new Date)&&(o="本月"),t[o]||(t[o]=[]),t[o].push(e.content.msg)}));return Object.entries(t).map((([e,t])=>({label:e,list:t})))}(a);C.value=P.page>1?C.value.concat(e):e}}catch(e){console.log(e)}}function V(){Object.assign(P,{page:0,hasMore:!0,lastSendTime:T(new Date,"yyyy-MM-dd HH:mm:ss")}),Q()}S(U,(()=>{Q()})),S(q,(()=>{Q()}));const W=a((()=>"image"===R.type?"聊天图片":"聊天文件"));function X(e){const{size:t,time:a,sender:o}=e;return`${t}.${a}.${o}`}return o((()=>R.visible),(e=>{e?V():J.value=""})),(t,a)=>(s(),i(n(g),{preset:"dialog",title:n(W),"show-icon":!1,"auto-focus":!1,class:"c-chat-dialog"},{default:l((()=>[r(c("div",{class:"c-chat-dialog__content c-chat-image-wrapper",ref_key:"imageRef",ref:U},[m(n(v),{"show-toolbar-tooltip":""},{default:l((()=>[(s(!0),p(d,null,u(C.value,(e=>(s(),p("div",{class:"image-item",key:e.label},[c("span",H,y(e.label),1),c("div",L,[(s(!0),p(d,null,u(e.list,(e=>(s(),i(n(h),{key:e,width:"80",height:"80",src:e},null,8,["src"])))),128))])])))),128))])),_:1})],512),[[f,"image"===e.type]]),r(c("div",E,[m(n(b),{placeholder:"搜索文件",value:J.value,"onUpdate:value":a[0]||(a[0]=e=>J.value=e),valueModifiers:{trim:!0},onInput:n(N)},{prefix:l((()=>[m(n(w),{component:n(M)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"file-list-box",ref_key:"fileRef",ref:q},[(s(!0),p(d,null,u(G.value,((e,t)=>(s(),p("div",{class:"file-item",key:t},[m(n(w),{component:n(M)},null,8,["component"]),c("div",$,[c("span",F,y(e.name),1),c("span",K,y(X(e)),1)]),c("div",O,[m(n(w),{size:16,component:n(_)},null,8,["component"]),m(n(w),{size:16,component:n(k)},null,8,["component"])])])))),128))],512)],512),[[f,"image"!==e.type]])])),_:1},8,["title"]))}});export{R as default};
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as c,withCtx as r,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as w,alt as E}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],U={class:"btn-box"},X=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var z=t({__name:"ChatFooter",setup(t){const z=e(),B=e(""),{state:R,stompClient:q}=T(),{setCurrentSessionItem:P}=b(R),Q=e(!1);function V(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Z()))}function W(){var t,e;B.value=(null==(e=null==(t=z.value)?void 0:t.innerText)?void 0:e.trim())||""}async function Y(t,e){const{file:n,name:s}=t.file,i=new FormData;i.append("sender",R.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");$({chatMessageType:e,msg:e===I.FILE?s:a,url:a})}function Z(){if(!(B.value.length>2e3))return B.value?void $({msg:B.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function $(t){const{chatMessageType:e=I.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===I.FILE&&(i.fileUrl=s),[I.TEXT,I.BLEND].includes(e)&&(z.value.innerHTML="",B.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");R.currentMsg={content:i,sender:R.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},R.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a});try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:R.currentSessionItem.receiver})),R.currentMsg={...R.currentMsg,fail:!1}}catch(t){R.currentMsg={...R.currentMsg,fail:!0}}finally{R.currentMsg={...R.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(R).id?"default":"not-allowed"})},[l("div",S,[c(o(v),{show:Q.value,"onUpdate:show":e[0]||(e[0]=t=>Q.value=t),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:r((()=>[j])),default:r((()=>[l("div",L,[u(' <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> '),F,l("div",K,[(s(!0),i(d,null,f(o(w),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:r((()=>[l("i",{onClick:()=>function(t){Q.value=!1,$({chatMessageType:I.EMOJI,msg:t})}(e)},[l("img",{src:t},null,8,H)],8,D)])),default:r((()=>[m(" "+g(o(E)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),l("span",{onClick:e[1]||(e[1]=()=>$({chatMessageType:o(I).EMOJI,msg:0}))},J),c(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[2]||(e[2]=t=>Y(t,o(I).IMAGE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),c(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[3]||(e[3]=t=>Y(t,o(I).FILE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:z,class:"input-box",contenteditable:"",onKeydown:V,onInput:W},null,544),[[h,o(R).id]]),l("div",U,[X,c(o(x),{type:"primary",round:"",disabled:!B.value,onClick:Z},{default:r((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(R).id]])}});export{z as default};
1
+ import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as r,withCtx as c,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as w,alt as E}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],U={class:"btn-box"},X=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var z=t({__name:"ChatFooter",setup(t){const z=e(),B=e(""),{state:R,stompClient:q}=T(),{setCurrentSessionItem:P}=b(R),Q=e(!1);function V(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Z()))}function W(){var t,e;B.value=(null==(e=null==(t=z.value)?void 0:t.innerText)?void 0:e.trim())||""}async function Y(t,e){const{file:n,name:s}=t.file,i=new FormData;i.append("sender",R.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");$({chatMessageType:e,msg:e===I.FILE?s:a,url:a})}function Z(){if(!(B.value.length>2e3))return B.value?void $({msg:B.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function $(t){const{chatMessageType:e=I.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===I.FILE&&(i.fileUrl=s),[I.TEXT,I.BLEND].includes(e)&&(z.value.innerHTML="",B.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");R.currentMsg={content:i,sender:R.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},R.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a});try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:R.currentSessionItem.receiver})),R.currentMsg={...R.currentMsg,fail:!1}}catch(t){R.currentMsg={...R.currentMsg,fail:!0}}finally{R.currentMsg={...R.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(R).id?"default":"not-allowed"})},[l("div",S,[r(o(v),{show:Q.value,"onUpdate:show":e[0]||(e[0]=t=>Q.value=t),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:c((()=>[j])),default:c((()=>[l("div",L,[u(' <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> '),F,l("div",K,[(s(!0),i(d,null,f(o(w),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:c((()=>[l("i",{onClick:()=>function(t){Q.value=!1,$({chatMessageType:I.EMOJI,msg:t})}(e)},[l("img",{src:t},null,8,H)],8,D)])),default:c((()=>[m(" "+g(o(E)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),l("span",{onClick:e[1]||(e[1]=()=>$({chatMessageType:o(I).EMOJI,msg:0}))},J),r(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[2]||(e[2]=t=>Y(t,o(I).IMAGE))},{default:c((()=>[r(o(k),{abstract:""},{default:c((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),r(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[3]||(e[3]=t=>Y(t,o(I).FILE))},{default:c((()=>[r(o(k),{abstract:""},{default:c((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:z,class:"input-box",contenteditable:"",onKeydown:V,onInput:W},null,544),[[h,o(R).id]]),l("div",U,[X,r(o(x),{type:"primary",round:"",disabled:!B.value,onClick:Z},{default:c((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(R).id]])}});export{z as default};
@@ -332,23 +332,37 @@ declare const _default: import("vue").DefineComponent<{}, {
332
332
  type: StringConstructor;
333
333
  default: string;
334
334
  };
335
+ visible: {
336
+ type: BooleanConstructor;
337
+ };
335
338
  }, {
336
339
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
337
340
  type: {
338
341
  type: StringConstructor;
339
342
  default: string;
340
343
  };
344
+ visible: {
345
+ type: BooleanConstructor;
346
+ };
341
347
  }>> & {}>>;
342
- imageList: {
348
+ state: import("../types").IState;
349
+ imageList: import("vue").Ref<AnyObject[]>;
350
+ fileList: import("vue").Ref<AnyObject[]>;
351
+ imageRef: import("vue").Ref<any>;
352
+ fileRef: import("vue").Ref<any>;
353
+ keyword: import("vue").Ref<any>;
354
+ handleInput: () => void;
355
+ currentInfo: {
356
+ page: number;
357
+ hasMore: boolean;
358
+ lastSendTime: string;
359
+ };
360
+ handleSearch: () => Promise<void>;
361
+ formatImageList: (data: AnyObject[]) => {
343
362
  label: string;
344
- data: string[];
345
- }[];
346
- fileList: {
347
- name: string;
348
- size: string;
349
- time: string;
350
- sender: string;
363
+ list: unknown;
351
364
  }[];
365
+ resetAndSearch: () => void;
352
366
  title: import("vue").ComputedRef<"聊天图片" | "聊天文件">;
353
367
  getDetail: (item: AnyObject) => string;
354
368
  NModal: any;
@@ -562,8 +576,12 @@ declare const _default: import("vue").DefineComponent<{}, {
562
576
  type: StringConstructor;
563
577
  default: string;
564
578
  };
579
+ visible: {
580
+ type: BooleanConstructor;
581
+ };
565
582
  }>>, {
566
583
  type: string;
584
+ visible: boolean;
567
585
  }>;
568
586
  ChatRecord: import("vue").DefineComponent<{
569
587
  visible: {
@@ -598,7 +616,7 @@ declare const _default: import("vue").DefineComponent<{}, {
598
616
  startDateDisabled: (ts: number) => boolean;
599
617
  endDateDisabled: (ts: number) => boolean;
600
618
  resetInfo: () => void;
601
- handleCloseTag: (type: "end" | "start" | "member", e: Event) => void;
619
+ handleCloseTag: (type: "end" | "start" | "member") => void;
602
620
  getPrefixCondition: () => (JSX.Element | null)[];
603
621
  renderLabel: (option: AnyObject) => JSX.Element;
604
622
  NModal: any;
@@ -607,6 +625,17 @@ declare const _default: import("vue").DefineComponent<{}, {
607
625
  NSelect: any;
608
626
  NAvatar: any;
609
627
  NPopover: any;
628
+ NInputGroup: import("vue").DefineComponent<{
629
+ [x: string]: never;
630
+ [x: number]: never;
631
+ [x: symbol]: never;
632
+ }, {
633
+ mergedClsPrefix: import("vue").ComputedRef<string>;
634
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
635
+ [x: string]: never;
636
+ [x: number]: never;
637
+ [x: symbol]: never;
638
+ }>>, {}>;
610
639
  DatePicker: import("../../../../shared/types").SFCWithInstall<import("vue").DefineComponent<{
611
640
  updateUnchangedValue: {
612
641
  type: BooleanConstructor;
@@ -686,6 +715,7 @@ declare const _default: import("vue").DefineComponent<{}, {
686
715
  }>>;
687
716
  formatTime: typeof import("../utils").formatTime;
688
717
  MESSAGE_TYPE: typeof import("../constants").MESSAGE_TYPE;
718
+ images: import("vue").Ref<any[]>;
689
719
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
690
720
  visible: {
691
721
  type: BooleanConstructor;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as a,openBlock as o,createElementBlock as s,Fragment as t,unref as i,createElementVNode as r,createVNode as c,withCtx as l,toDisplayString as n,createCommentVNode as u}from"vue";import{NAvatar as h}from"naive-ui";import{useState as v}from"../hooks/useState.js";import m from"./PersonProfile.vue.js";import f from"./ChatSet.vue.js";import d from"./ChatFile.vue.js";import p from"./ChatRecord.vue.js";const w={key:0,class:"chat-header box-shadow"},C={class:"chat-header__left"},_={class:"name"},g={class:"chat-header__right"};var k=e({__name:"ChatHeader",setup(e){const{state:k}=v(),j=a(!1),S=a(!1),b=a("image"),y=a(!1);function I(e){b.value=e,S.value=!0}return(e,a)=>(o(),s(t,null,[i(k).id?(o(),s("section",w,[r("div",C,[c(m,{"user-id":i(k).currentSessionItem.receiver},{trigger:l((()=>[c(i(h),{round:"",size:30,src:i(k).currentSessionItem.avatar},null,8,["src"])])),_:1},8,["user-id"]),r("span",_,n(i(k).currentSessionItem.name),1)]),r("div",g,[r("i",{class:"chat--iconfont chat--icon-image",onClick:a[0]||(a[0]=()=>I("image"))}),r("i",{class:"chat--iconfont chat--icon-folder",onClick:a[1]||(a[1]=()=>I("file"))}),r("i",{class:"chat--iconfont chat--icon-list-search",onClick:a[2]||(a[2]=e=>y.value=!0)}),r("i",{class:"chat--iconfont chat--icon-set",onClick:a[3]||(a[3]=e=>j.value=!0)})])])):u("v-if",!0),c(f,{show:j.value,"onUpdate:show":a[4]||(a[4]=e=>j.value=e)},null,8,["show"]),c(d,{show:S.value,"onUpdate:show":a[5]||(a[5]=e=>S.value=e),type:b.value},null,8,["show","type"]),c(p,{show:y.value,"onUpdate:show":a[6]||(a[6]=e=>y.value=e),visible:y.value},null,8,["show","visible"])],64))}});export{k as default};
1
+ import{defineComponent as e,ref as a,openBlock as o,createElementBlock as s,Fragment as t,unref as i,createElementVNode as l,createVNode as r,withCtx as c,toDisplayString as n,createCommentVNode as u}from"vue";import{NAvatar as h}from"naive-ui";import{useState as v}from"../hooks/useState.js";import m from"./PersonProfile.vue.js";import f from"./ChatSet.vue.js";import d from"./ChatFile.vue.js";import p from"./ChatRecord.vue.js";const w={key:0,class:"chat-header box-shadow"},C={class:"chat-header__left"},_={class:"name"},g={class:"chat-header__right"};var k=e({__name:"ChatHeader",setup(e){const{state:k}=v(),b=a(!1),j=a(!1),S=a("image"),y=a(!1);function I(e){S.value=e,j.value=!0}return(e,a)=>(o(),s(t,null,[i(k).id?(o(),s("section",w,[l("div",C,[r(m,{"user-id":i(k).currentSessionItem.receiver},{trigger:c((()=>[r(i(h),{round:"",size:30,src:i(k).currentSessionItem.avatar},null,8,["src"])])),_:1},8,["user-id"]),l("span",_,n(i(k).currentSessionItem.name),1)]),l("div",g,[l("i",{class:"chat--iconfont chat--icon-image",onClick:a[0]||(a[0]=()=>I("image"))}),l("i",{class:"chat--iconfont chat--icon-folder",onClick:a[1]||(a[1]=()=>I("file"))}),l("i",{class:"chat--iconfont chat--icon-list-search",onClick:a[2]||(a[2]=e=>y.value=!0)}),l("i",{class:"chat--iconfont chat--icon-set",onClick:a[3]||(a[3]=e=>b.value=!0)})])])):u("v-if",!0),r(f,{show:b.value,"onUpdate:show":a[4]||(a[4]=e=>b.value=e)},null,8,["show"]),r(d,{show:j.value,"onUpdate:show":a[5]||(a[5]=e=>j.value=e),type:S.value,visible:j.value},null,8,["show","type","visible"]),r(p,{show:y.value,"onUpdate:show":a[6]||(a[6]=e=>y.value=e),visible:y.value},null,8,["show","visible"])],64))}});export{k as default};
@@ -35,7 +35,7 @@ declare const _default: import("vue").DefineComponent<{
35
35
  startDateDisabled: (ts: number) => boolean;
36
36
  endDateDisabled: (ts: number) => boolean;
37
37
  resetInfo: () => void;
38
- handleCloseTag: (type: 'member' | 'start' | 'end', e: Event) => void;
38
+ handleCloseTag: (type: 'member' | 'start' | 'end') => void;
39
39
  getPrefixCondition: () => (JSX.Element | null)[];
40
40
  renderLabel: (option: AnyObject) => JSX.Element;
41
41
  NModal: any;
@@ -44,6 +44,17 @@ declare const _default: import("vue").DefineComponent<{
44
44
  NSelect: any;
45
45
  NAvatar: any;
46
46
  NPopover: any;
47
+ NInputGroup: import("vue").DefineComponent<{
48
+ [x: string]: never;
49
+ [x: number]: never;
50
+ [x: symbol]: never;
51
+ }, {
52
+ mergedClsPrefix: import("vue").ComputedRef<string>;
53
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
54
+ [x: string]: never;
55
+ [x: number]: never;
56
+ [x: symbol]: never;
57
+ }>>, {}>;
47
58
  DatePicker: import("../../../../shared/types").SFCWithInstall<import("vue").DefineComponent<{
48
59
  updateUnchangedValue: {
49
60
  type: BooleanConstructor;
@@ -123,6 +134,7 @@ declare const _default: import("vue").DefineComponent<{
123
134
  }>>;
124
135
  formatTime: typeof formatTime;
125
136
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
137
+ images: import("vue").Ref<any[]>;
126
138
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
127
139
  visible: {
128
140
  type: BooleanConstructor;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as a,computed as l,watch as t,openBlock as s,createBlock as r,unref as n,withCtx as o,createElementVNode as i,createVNode as u,toDisplayString as c,resolveDynamicComponent as d,createElementBlock as v,Fragment as m,renderList as p,withDirectives as f,createTextVNode as g,vShow as y}from"vue";import{NModal as b,NAvatar as h,NInput as _,NSelect as T,NPopover as k,NTag as x,NIcon as M}from"naive-ui";import{SearchOutline as I}from"@vicons/ionicons5";import{useState as w}from"../hooks/useState.js";import{transformMessage as S,formatTime as A}from"../utils/index.js";import{last as j}from"lodash-es";import L from"../../../date-picker/index.js";import{searchChatRecordApi as C}from"../api/index.js";import{useDebounceFn as E}from"@vueuse/core";import{format as H}from"date-fns";import{useScrollLoading as D}from"../hooks/useScrollLoading.js";import{MESSAGE_TYPE as U}from"../constants/index.js";import{images as z}from"../utils/emoji.js";const O={class:"c-chat-dialog__header"},J=i("span",{class:"left"},"聊天记录",-1),K={class:"center"},P={class:"c-chat-dialog__content c-chat-record-wrapper"},R={class:"chat-record-box"},B={class:"msg-box"},G={class:"name-and-time"},N={class:"content"},X=["src"],$=["innerHTML"],q={key:1,class:"no-data"},F={class:"chat-record-box__filter"},Q=i("span",{class:"filter-title"},"添加筛选条件",-1),V={class:"filter-item"},W=i("span",{class:"label"},"成员:",-1),Y={class:"filter-item"},Z=i("span",{class:"label"},"日期:",-1),ee={class:"time-target"},ae={class:"time-target__item"},le=i("span",null,"开始:",-1),te={class:"no-data"},se={class:"time-target__item"},re=i("span",null,"结束:",-1),ne={class:"no-data"};var oe=e({__name:"ChatRecord",props:{visible:{type:Boolean}},setup(e){const oe=e,ie={color:"#fff",textColor:"#666"},{state:ue}=w(),ce=a(),de=a([]),ve=a(),me=a([]),pe=a(),fe=a(),ge=E(_e,500),ye={page:0,hasMore:!0,lastSendTime:H(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:ue.orgId,keyword:ve.value,endTime:fe.value?fe.value+" 23:59:59":"",startTime:pe.value?pe.value+" 00:00:00":"",lastSendTime:ye.lastSendTime,memberIdSet:me.value,page:ye.page,recordType:"ALL",sessionKey:ue.currentSessionItem.sessionKey,userId:ue.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=j(l))?void 0:e.sendTime,l.forEach((e=>{var a,l,t,s,r,n;let o="";switch(e.content.chatMessageType){case U.TEXT:o=S(null==(a=e.content)?void 0:a.msg);break;case U.TEMPLATE:o=null==(s=null==(t=null==(l=e.content)?void 0:l.messageTemplate)?void 0:t.setting)?void 0:s.title;break;case U.EMOJI:o=z[null==(r=e.item.content)?void 0:r.msg];break;default:o=null==(n=e.content)?void 0:n.msg}e.__content=o})),de.value=ye.page>1?de.value.concat(l):l}catch(e){console.log(e)}}D(ce,(()=>{be()}));const he=l((()=>[ue.currentSessionItem]));function _e(){Object.assign(ye,{page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")}),be()}function Te(e){return!!fe.value&&e>Date.parse(`${fe.value} 23:59:59`)}function ke(e){return!!pe.value&&e<Date.parse(pe.value)}function xe(e,a){switch(a.stopPropagation(),e){case"member":me.value=[];break;case"start":pe.value=null;break;case"end":fe.value=null}}function Me(e){return u(m,null,[u("div",{style:"display: flex;align-items: center"},[u(h,{src:e.avatar,round:!0,size:"small"},null),u("span",{style:"margin-left: 10px"},[e.name])])])}return t([()=>me.value,()=>pe.value,()=>fe.value],(()=>{oe.visible&&_e()}),{deep:!0}),t((()=>oe.visible),(e=>{e?_e():(ve.value="",fe.value=null,pe.value=null,me.value=[],de.value=[])})),(e,a)=>(s(),r(n(b),{preset:"dialog",title:"","show-icon":!1,"auto-focus":!1,class:"c-chat-dialog"},{header:o((()=>[i("div",O,[J,i("div",K,[u(n(h),{round:"",size:30,src:n(ue).currentSessionItem.avatar},null,8,["src"]),i("span",null,c(n(ue).currentSessionItem.name),1)])])])),default:o((()=>[i("div",P,[u(n(_),{placeholder:"搜索",value:ve.value,"onUpdate:value":a[0]||(a[0]=e=>ve.value=e),valueModifiers:{trim:!0},onInput:n(ge)},{prefix:o((()=>[(s(),r(d((()=>[u(M,{component:I,color:"#6666"},null),me.value.length>0?u(x,{closable:!0,bordered:!1,color:ie,style:"margin-left: 10px",onClose:e=>xe("member",e)},{default:()=>{var e;return[g("成员:")," ",me.value.length>1?me.value.length+"人":null==(e=he.value.find((e=>e.receiver===me.value[0])))?void 0:e.name]}}):null,pe.value?u(x,{closable:!0,bordered:!1,color:ie,style:"margin-left: 10px",onClose:e=>xe("start",e)},{default:()=>[g("起始时间: "),pe.value]}):null,fe.value?u(x,{closable:!0,bordered:!1,color:ie,style:"margin-left: 10px",onClose:e=>xe("end",e)},{default:()=>[g("结束时间: "),fe.value]}):null]))))])),_:1},8,["value","onInput"]),i("div",R,[i("div",{class:"chat-record-box__content",ref_key:"recordRef",ref:ce},[de.value.length>0?(s(!0),v(m,{key:0},p(de.value,(e=>(s(),v("div",{class:"content-item",key:e.id},[u(n(h),{round:"",size:38,src:e.senderAvatar},null,8,["src"]),i("div",B,[i("div",G,[i("span",null,c(e.senderName),1),i("span",null,c(n(A)(e.sendTime).recordTime),1)]),i("div",N,[[n(U).EMOJI,n(U).IMAGE].includes(e.content.chatMessageType)?(s(),v("img",{key:0,src:e.__content},null,8,X)):(s(),v("p",{key:1,innerHTML:e.__content},null,8,$))])])])))),128)):(s(),v("div",q,"没有找到相关记录"))],512),i("div",F,[Q,i("div",V,[W,u(n(T),{value:me.value,"onUpdate:value":a[1]||(a[1]=e=>me.value=e),multiple:"","max-tag-count":1,"render-label":Me,options:n(he),"value-field":"receiver"},null,8,["value","options"])]),i("div",Y,[Z,i("div",ee,[u(n(k),{trigger:"click","show-arrow":!1},{trigger:o((()=>[i("div",ae,[le,f(u(n(x),{bordered:!1,color:ie,closable:"",onClose:a[2]||(a[2]=e=>xe("start",e))},{default:o((()=>[g(c(pe.value),1)])),_:1},512),[[y,pe.value]]),f(i("span",te,"点击选择",512),[[y,!pe.value]])])])),default:o((()=>[u(n(L),{"formatted-value":pe.value,"onUpdate:formatted-value":a[3]||(a[3]=e=>pe.value=e),type:"date",panel:"",clearable:"","is-date-disabled":Te},null,8,["formatted-value"])])),_:1}),u(n(k),{trigger:"click","show-arrow":!1},{trigger:o((()=>[i("div",se,[re,f(u(n(x),{bordered:!1,color:ie,closable:"",onClose:a[4]||(a[4]=e=>xe("end",e))},{default:o((()=>[g(c(fe.value),1)])),_:1},512),[[y,fe.value]]),f(i("span",ne,"点击选择",512),[[y,!fe.value]])])])),default:o((()=>[u(n(L),{"formatted-value":fe.value,"onUpdate:formatted-value":a[5]||(a[5]=e=>fe.value=e),type:"date",panel:"",clearable:"","is-date-disabled":ke},null,8,["formatted-value"])])),_:1})])])])])])])),_:1}))}});export{oe as default};
1
+ import{defineComponent as e,ref as a,computed as l,watch as t,openBlock as s,createBlock as r,unref as n,withCtx as o,createElementVNode as i,createVNode as u,toDisplayString as c,resolveDynamicComponent as d,createElementBlock as v,Fragment as m,renderList as p,withDirectives as f,createTextVNode as g,vShow as y}from"vue";import{NModal as h,NAvatar as b,NInputGroup as _,NInput as T,NSelect as k,NPopover as M,NTag as x,NIcon as I}from"naive-ui";import{SearchOutline as w}from"@vicons/ionicons5";import{useState as S}from"../hooks/useState.js";import{transformMessage as j,formatTime as A}from"../utils/index.js";import{last as L}from"lodash-es";import C from"../../../date-picker/index.js";import{searchChatRecordApi as E}from"../api/index.js";import{useDebounceFn as H}from"@vueuse/core";import{format as z}from"date-fns";import{useScrollLoading as D}from"../hooks/useScrollLoading.js";import{MESSAGE_TYPE as U}from"../constants/index.js";import{images as K}from"../utils/emoji.js";const O={class:"c-chat-dialog__header"},R=i("span",{class:"left"},"聊天记录",-1),B={class:"center"},G={class:"c-chat-dialog__content c-chat-record-wrapper"},J={class:"chat-record-box"},N={class:"msg-box"},P={class:"name-and-time"},X={class:"content"},$=["src"],q=["src"],F=["innerHTML"],Q={key:1,class:"no-data"},V={class:"chat-record-box__filter"},W=i("span",{class:"filter-title"},"添加筛选条件",-1),Y={class:"filter-item"},Z=i("span",{class:"label"},"成员:",-1),ee={class:"filter-item"},ae=i("span",{class:"label"},"日期:",-1),le={class:"time-target"},te={class:"time-target__item"},se=i("span",null,"开始:",-1),re={class:"no-data"},ne={class:"time-target__item"},oe=i("span",null,"结束:",-1),ie={class:"no-data"};var ue=e({__name:"ChatRecord",props:{visible:{type:Boolean}},setup(e){const ue=e,ce={color:"#fff",textColor:"#666"},{state:de}=S(),ve=a(),me=a([]),pe=a(),fe=a([]),ge=a(),ye=a(),he=H(ke,500),be={page:0,hasMore:!0,lastSendTime:z(new Date,"yyyy-MM-dd HH:mm:ss")};async function _e(){var e;try{if(!be.hasMore)return;be.page++;const a=await E({orgId:de.orgId,keyword:pe.value,endTime:ye.value?ye.value+" 23:59:59":"",startTime:ge.value?ge.value+" 00:00:00":"",lastSendTime:be.lastSendTime,memberIdSet:fe.value,page:be.page,recordType:"ALL",sessionKey:de.currentSessionItem.sessionKey,userId:de.userInfo.id});Array.isArray(a)&&0!==a.length&&Array.isArray(a[0].recordList)||(be.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let l=a||[];Array.isArray(a)&&a.length>0&&(l=a[0].recordList),be.lastSendTime=null==(e=L(l))?void 0:e.sendTime,l.forEach((e=>{var a,l,t,s,r;let n="";switch(e.content.chatMessageType){case U.TEXT:n=j(null==(a=e.content)?void 0:a.msg);break;case U.TEMPLATE:n=null==(s=null==(t=null==(l=e.content)?void 0:l.messageTemplate)?void 0:t.setting)?void 0:s.title;break;default:n=null==(r=e.content)?void 0:r.msg}e.__content=n})),me.value=be.page>1?me.value.concat(l):l}catch(e){console.log(e)}}D(ve,(()=>{_e()}));const Te=l((()=>[de.currentSessionItem]));function ke(){Object.assign(be,{page:0,hasMore:!0,lastSendTime:z(new Date,"yyyy-MM-dd HH:mm:ss")}),_e()}function Me(e){return!!ye.value&&e>Date.parse(`${ye.value} 23:59:59`)}function xe(e){return!!ge.value&&e<Date.parse(ge.value)}function Ie(e){switch(e){case"member":fe.value=[];break;case"start":ge.value=null;break;case"end":ye.value=null}}function we(e){return u(m,null,[u("div",{style:"display: flex;align-items: center"},[u(b,{src:e.avatar,round:!0,size:"small"},null),u("span",{style:"margin-left: 10px"},[e.name])])])}return t([()=>fe.value,()=>ge.value,()=>ye.value],(()=>{ue.visible&&ke()}),{deep:!0}),t((()=>ue.visible),(e=>{e?ke():(pe.value="",ye.value=null,ge.value=null,fe.value=[],me.value=[])})),(e,a)=>(s(),r(n(h),{preset:"dialog",title:"","show-icon":!1,"auto-focus":!1,class:"c-chat-dialog"},{header:o((()=>[i("div",O,[R,i("div",B,[u(n(b),{round:"",size:30,src:n(de).currentSessionItem.avatar},null,8,["src"]),i("span",null,c(n(de).currentSessionItem.name),1)])])])),default:o((()=>[i("div",G,[u(n(_),null,{default:o((()=>[(s(),r(d((()=>[u(I,{component:w,size:18,color:"#6666"},null),fe.value.length>0?u(x,{closable:!0,bordered:!1,color:ce,onClose:()=>Ie("member")},{default:()=>{var e;return[g("成员:")," ",fe.value.length>1?fe.value.length+"人":null==(e=Te.value.find((e=>e.receiver===fe.value[0])))?void 0:e.name]}}):null,ge.value?u(x,{closable:!0,bordered:!1,color:ce,onClose:()=>Ie("start")},{default:()=>[g("起始时间: "),ge.value]}):null,ye.value?u(x,{closable:!0,bordered:!1,color:ce,onClose:()=>Ie("end")},{default:()=>[g("结束时间: "),ye.value]}):null])))),u(n(T),{placeholder:"搜索",value:pe.value,"onUpdate:value":a[0]||(a[0]=e=>pe.value=e),valueModifiers:{trim:!0},onInput:n(he)},null,8,["value","onInput"])])),_:1}),i("div",J,[i("div",{class:"chat-record-box__content",ref_key:"recordRef",ref:ve},[me.value.length>0?(s(!0),v(m,{key:0},p(me.value,(e=>(s(),v("div",{class:"content-item",key:e.id},[u(n(b),{round:"",size:38,src:e.senderAvatar},null,8,["src"]),i("div",N,[i("div",P,[i("span",null,c(e.senderName),1),i("span",null,c(n(A)(e.sendTime).recordTime),1)]),i("div",X,[e.content.chatMessageType===n(U).IMAGE?(s(),v("img",{key:0,class:"img",src:e.__content},null,8,$)):e.content.chatMessageType===n(U).EMOJI?(s(),v("img",{key:1,class:"emoji",src:n(K)[e.__content]},null,8,q)):(s(),v("p",{key:2,innerHTML:e.__content},null,8,F))])])])))),128)):(s(),v("div",Q,"没有找到相关记录"))],512),i("div",V,[W,i("div",Y,[Z,u(n(k),{value:fe.value,"onUpdate:value":a[1]||(a[1]=e=>fe.value=e),multiple:"","max-tag-count":1,"render-label":we,options:n(Te),"value-field":"receiver"},null,8,["value","options"])]),i("div",ee,[ae,i("div",le,[u(n(M),{trigger:"click","show-arrow":!1},{trigger:o((()=>[i("div",te,[se,f(u(n(x),{bordered:!1,color:ce,closable:"",onClose:a[2]||(a[2]=()=>Ie("start"))},{default:o((()=>[g(c(ge.value),1)])),_:1},512),[[y,ge.value]]),f(i("span",re,"点击选择",512),[[y,!ge.value]])])])),default:o((()=>[u(n(C),{"formatted-value":ge.value,"onUpdate:formatted-value":a[3]||(a[3]=e=>ge.value=e),type:"date",panel:"",clearable:"","is-date-disabled":Me},null,8,["formatted-value"])])),_:1}),u(n(M),{trigger:"click","show-arrow":!1},{trigger:o((()=>[i("div",ne,[oe,f(u(n(x),{bordered:!1,color:ce,closable:"",onClose:a[4]||(a[4]=()=>Ie("end"))},{default:o((()=>[g(c(ye.value),1)])),_:1},512),[[y,ye.value]]),f(i("span",ie,"点击选择",512),[[y,!ye.value]])])])),default:o((()=>[u(n(C),{"formatted-value":ye.value,"onUpdate:formatted-value":a[5]||(a[5]=e=>ye.value=e),type:"date",panel:"",clearable:"","is-date-disabled":xe},null,8,["formatted-value"])])),_:1})])])])])])])),_:1}))}});export{ue as default};
@@ -1,2 +1,2 @@
1
1
  import { Ref } from 'vue';
2
- export declare function useScrollLoading(el: Ref<HTMLElement | undefined | null>, callback: () => void, direction?: 'top' | 'bottom' | undefined): void;
2
+ export declare function useScrollLoading(wrapperEl: Ref<HTMLElement | undefined | null>, callback: () => void, direction?: 'top' | 'bottom' | undefined): void;
@@ -1 +1 @@
1
- import{onMounted as e}from"vue";import{useThrottleFn as t}from"@vueuse/core";const o=t((({target:e},t,o)=>{const{clientHeight:r,scrollTop:l,scrollHeight:i}=e;if("top"===o){if(0===l)return;r-l>=i-5&&t()}else r+l>=i-10&&t()}),500);function r(t,r,l="bottom"){e((()=>{t.value&&t.value.addEventListener("scroll",(e=>o(e,r,l)))}))}export{r as useScrollLoading};
1
+ import{useThrottleFn as o,useEventListener as t}from"@vueuse/core";const e=o((({target:o},t,e)=>{const{clientHeight:r,scrollTop:c,scrollHeight:l}=o;if("top"===e){if(0===c)return;r-c>=l-5&&t()}else r+c>=l-10&&t()}),500);function r(o,r,c="bottom"){t(o,"scroll",(o=>e(o,r,c)),!0)}export{r as useScrollLoading};