wansfa hai 1 ano
pai
achega
8da2878b5f

+ 11 - 1
src/api/qw/im.js

@@ -43,6 +43,9 @@ export function getMessageList(query) {
 }
 
 
+
+
+
 // 发送文本消息
 export function sendTextMsg(data) {
   return request({
@@ -73,5 +76,12 @@ export function getRoomInfo(roomId) {
 
 
 
-
+//导出消息
+export function exportMessage(query) {
+  return request({
+    url: '/qw/message/export/',
+    method: 'get',
+    params: query
+  })
+}
 

+ 0 - 1
src/components/LemonUI/components/chatrecords/basic.vue

@@ -139,7 +139,6 @@
            
        },
        methods: {
-
                 handleTabClick(tab, event){
                     console.log(tab,tab.index);
                     const sIMUI = this.$refs["sIMUI"+tab.index];

+ 3 - 3
src/components/LemonUI/components/chatrecords/segrecords.vue

@@ -179,7 +179,7 @@
             
        },
        mounted(){
-            this.deviceId=this.qwUser.deviceId;
+            //this.deviceId=this.qwUser.deviceId;
             this.UserData.id=this.qwUser.userId;
             this.UserData.displayName=this.qwUser.nickName;
             this.UserData.avatar=this.qwUser.avatar;
@@ -235,8 +235,8 @@
                       const IMUI = this.$refs.IMUI;
                       if(this.conversationData.length==0){
                           getConversations(this.qwUser.userId).then(response => {
-                                this.conversationData = response.data;
-                                IMUI.initConversations(this.conversationData);
+                                const conversationData = response.data;
+                                IMUI.initConversations(conversationData);
                                 IMUI.clearMessages(this.conversationId);
                                 IMUI.currentContactId="";
                                 IMUI.changeContact(this.conversationId);

+ 12 - 1
src/components/LemonUI/components/editor.vue

@@ -189,6 +189,14 @@ export default {
             return <i class="lemon-icon-message" />;
           },
         },
+         {
+          name: "export",
+          title: "消息导出",
+          click: () => this.exportMsg(),
+          render: menu => {
+            return <i class="lemon-icon-prompt" />;
+          },
+        },
       ];
       let tools = [];
       if (Array.isArray(this.tools)) {
@@ -197,6 +205,7 @@ export default {
           uploadFile: 1,
           uploadImage: 2,
           msgRecords: 3,
+          export:4,
         };
         const indexKeys = Object.keys(indexMap);
         tools = this.tools.map(item => {
@@ -298,7 +307,9 @@ export default {
      async pickMsgBox() {
          this.$emit("pickMsgRecords", this.clipboardBlob);
     },
-
+    async exportMsg() {
+         this.$emit("exportMsg", this.clipboardBlob);
+    },
     _handlePaste(e) {
       e.preventDefault();
       const clipboardData = e.clipboardData || window.clipboardData;

+ 6 - 1
src/components/LemonUI/components/index.vue

@@ -109,7 +109,8 @@ export default {
       conversations:[],
       menus: [],
       editorTools: [
-          { name: "msgRecords" }
+          { name: "msgRecords" },
+          { name: "export" }
         // { name: "emoji" },
         // { name: "uploadFile" },
         // { name: "uploadImage" },
@@ -300,6 +301,9 @@ export default {
     _pickMsgRecords(){
         this.$emit("pick-msg-records");
     },
+    _pickExportMsg(){
+        this.$emit("pick-export-msg");
+    },
     _emitPullMessages(next) {
       //console.log("qxj currentContact:"+JSON.stringify(this.currentContact));
       this._changeContactLock = true;
@@ -571,6 +575,7 @@ export default {
                 onUpload={this._handleUpload}
                 onPickImg={this._pickImg}
                 onPickMsgRecords={this._pickMsgRecords}
+                onExportMsg={this._pickExportMsg}
               />
             </div>
             <div class="lemon-vessel__right">

+ 46 - 7
src/views/qw/forbiddenMessage/index.vue

@@ -4,10 +4,10 @@
       <el-form-item label="公司名" prop="companyId">
           <el-select filterable  v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
               <el-option
-                v-for="item in companys"
-                :key="item.companyId"
-                :label="item.companyName"
-                :value="item.companyId"
+                  v-for="item in companys"
+                  :key="item.companyId"
+                  :label="item.companyName"
+                  :value="item.companyId"
               />
         </el-select>
       </el-form-item>
@@ -73,6 +73,7 @@
       <el-table-column type="selection" width="40" align="center" />
       <el-table-column label="公司" width="200" align="center" prop="companyName" />
       <el-table-column label="员工" width="100" align="center" prop="companyUserName" />
+      <el-table-column label="企微账号" width="100" align="center" prop="account" />
       <el-table-column label="发送时间" width="200" align="center" prop="sendTime">
         <template slot-scope="scope">
           {{ convertTimestampToTime(scope.row.sendTime) }}
@@ -90,7 +91,7 @@
           <el-button
             size="mini"
             type="text"
-            @click="handleUpdate(scope.row)"
+            @click="handleLookMsg(scope.row)"
             v-hasPermi="['qw:forbiddenMessage:edit']"
           >查看</el-button>
         </template>
@@ -129,6 +130,12 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <el-dialog :visible.sync="dialogContextVisible" width="70%">
+        <SegRecords :qwUser="qwUser" :conversationId="conversationId"  :isContext=true :msgType=0  ref="sIMUI4"></SegRecords>
+  </el-dialog>
+
+
   </div>
 </template>
 
@@ -137,9 +144,16 @@ import { listForbiddenMessage, getForbiddenMessage, delForbiddenMessage, addForb
 import Editor from '@/components/Editor';
 import { getCompanyList } from "@/api/company/company";
 
+import EmojiData from "@/components/LemonUI/database/emoji";
+
+import SegRecords from '@/components/LemonUI/components/chatrecords/segrecords.vue'
+
 export default {
   name: "ForbiddenMessage",
-  components: { Editor },
+  components: { 
+       Editor,
+       SegRecords
+   },
   data() {
     return {
       // 遮罩层
@@ -162,6 +176,9 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      qwUser:{},
+      conversationId:null,
+      dialogContextVisible:false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -265,6 +282,20 @@ export default {
         this.title = "修改企微违禁消息";
       });
     },
+    handleLookMsg(row){
+          console.log("qxj row:"+JSON.stringify(row));
+          this.qwUser.userId=row.qwUserId;
+          this.qwUser.nickName=row.nickName;
+          this.qwUser.avatar=row.avatar;
+          this.conversationId=row.conversationId;
+          this.dialogContextVisible=true;
+          setTimeout(() => {
+                const sIMUI = this.$refs["sIMUI4"];
+                console.log("点击了上下文", sIMUI);
+                let message={id:row.messageId};
+                sIMUI.openContextBox(message);
+          }, 50);
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -318,4 +349,12 @@ export default {
     }
   }
 };
-</script>
+</script>
+
+
+<style lang="scss" scoped>
+    /deep/.el-dialog__headerbtn{
+         top:10px;
+    }
+    
+</style>

+ 68 - 60
src/views/qw/qwChat/index.vue

@@ -42,8 +42,6 @@
             <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
           </el-form-item>
-
-
      </el-form>
 
 
@@ -67,6 +65,7 @@
           @menu-avatar-click="handleMenuAvatarClick"
           @pick-image="handleImageClick"
           @pick-msg-records="handleMsgRecordsClick"
+          @pick-export-msg="handleExportMsgClick"
           @send="handleSend">
           <template #cover>
                 <div class="cover">
@@ -174,7 +173,7 @@ import store from "@/store";
 import { getQrCode } from '@/api/qw/login';
 import { getDeviceId,listAccount,getAccount} from '@/api/qw/account';
 import LemonMessageVoice from "@/components/LemonUI/components/message/voice";
-import { getContactsByUser,getConversations,getMessageList,getConversation,sendTextMsg,sendImageMsg,getRoomInfo} from '@/api/qw/im';
+import { getContactsByUser,getConversations,getMessageList,getConversation,sendTextMsg,sendImageMsg,getRoomInfo,exportMessage} from '@/api/qw/im';
 import Conversations from "@/components/LemonUI/database/conversations";
 import EmojiData from "@/components/LemonUI/database/emoji";
 import '@/components/LemonUI/index.css';
@@ -384,8 +383,7 @@ export default {
         this.getContacts();  //获取联系人信息
         this.getConversation();   //获取会话信息 
     },
-
-     qwListAccount(companyUserId) {
+    qwListAccount(companyUserId) {
         if(!this.companyUserId){
              this.msgError("请选择员工");
              return;
@@ -411,7 +409,6 @@ export default {
         this.UserData.displayName=this.qwUser.nickName;
         this.UserData.avatar=this.qwUser.avatar;
     },
-
      /** 搜索按钮操作 */
     handleQuery() {
       this.qwListAccount();
@@ -421,61 +418,59 @@ export default {
       this.resetForm("queryForm");
       //this.handleQuery();
     },
-
-
     initSocket(userId) {
-               let that=this;
-               if(!!this.qwIm.socket){
-                  this.qwIm.initSocket(userId,true);
-                  // 监听socket连接
-                  this.qwIm.socket.onopen = function() {
-                      console.log("socket 连接成功...");
-                  };
-                  this.qwIm.socket.onerror = function() {
-                      console.log("连接错误")
-                  };
-                  // 监听socket消息
-                  const IMUI = this.$refs.IMUI;
-                  this.qwIm.socket.onmessage = function(res) {
-                       var data=JSON.parse(res.data);
-                       //console.log("收到服务端内容", JSON.stringify(data));
-                        if(data.cmd=="heartbeat"){ //收到心跳数据不处理
-                            console.log("heartbeat");
-                        }
-                        if(data.cmd=="offline"){
-                            that.$message.error('企微号已下线');
-                            that.$store.dispatch('qwLoginOut').then(() => {
-
-                            });
-                            setTimeout(() => {
-                               that.$router.push({path:'/qw/qwLogin'});
-                            }, 2000);
-                        }
-                        //接收消息
-                        if(data.cmd=="receiveMsg"){
-                             var msgData=JSON.parse(data.msg);
-                             if(!IMUI.hasConversation(msgData.toContactId)){  //收到新消息时是最新的会话,添加该会话
-                                    let queryParams={conversationId:msgData.toContactId,userId:that.qwUser.userId};
-                                    getConversation(queryParams).then(response => {
-                                          if(response.code==200){
-                                              var conversation=response.data;
-                                              IMUI.appendConversation(conversation); 
-                                              that.appendMessageAction(msgData);
-                                          }
-                                   });
-                             }else{
-                                  that.appendMessageAction(msgData);
-                                  let conversation=IMUI.findConversation(msgData.toContactId);
-                                  IMUI.topPopConversations(conversation);
-                                  
-                             }
-                        }
-                  };
-                  // 监听socket重连
-                  this.qwIm.socket.onreconnect = function(res) {
-                      console.log("socket 断线重连...")
-                  };
-              }
+          let that=this;
+          if(!!this.qwIm.socket){
+                this.qwIm.initSocket(userId,true);
+                // 监听socket连接
+                this.qwIm.socket.onopen = function() {
+                    console.log("socket 连接成功...");
+                };
+                this.qwIm.socket.onerror = function() {
+                    console.log("连接错误")
+                };
+                // 监听socket消息
+                const IMUI = this.$refs.IMUI;
+                this.qwIm.socket.onmessage = function(res) {
+                    var data=JSON.parse(res.data);
+                    //console.log("收到服务端内容", JSON.stringify(data));
+                      if(data.cmd=="heartbeat"){ //收到心跳数据不处理
+                          console.log("heartbeat");
+                      }
+                      if(data.cmd=="offline"){
+                          that.$message.error('企微号已下线');
+                          that.$store.dispatch('qwLoginOut').then(() => {
+
+                          });
+                          setTimeout(() => {
+                            that.$router.push({path:'/qw/qwLogin'});
+                          }, 2000);
+                      }
+                      //接收消息
+                      if(data.cmd=="receiveMsg"){
+                          var msgData=JSON.parse(data.msg);
+                          if(!IMUI.hasConversation(msgData.toContactId)){  //收到新消息时是最新的会话,添加该会话
+                                  let queryParams={conversationId:msgData.toContactId,userId:that.qwUser.userId};
+                                  getConversation(queryParams).then(response => {
+                                        if(response.code==200){
+                                            var conversation=response.data;
+                                            IMUI.appendConversation(conversation); 
+                                            that.appendMessageAction(msgData);
+                                        }
+                                });
+                          }else{
+                                that.appendMessageAction(msgData);
+                                let conversation=IMUI.findConversation(msgData.toContactId);
+                                IMUI.topPopConversations(conversation);
+                                
+                          }
+                      }
+                };
+                // 监听socket重连
+                this.qwIm.socket.onreconnect = function(res) {
+                    console.log("socket 断线重连...")
+                };
+          }
     },
     getRoomInfo(roomId){
         getRoomInfo(roomId).then(response => {
@@ -651,6 +646,19 @@ export default {
       console.log("qxj handleMsgRecordsClick");
       this.$refs.chatRecords.open(this.qwUser,this.queryParams.conversationId,this.conversationData);
     },
+    handleExportMsgClick() { 
+      let that=this;
+      this.$confirm('是否确认导出消息记录吗?', "警告", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(function() {
+            let queryParams={conversationId:that.queryParams.conversationId}
+            return exportMessage(queryParams);
+          }).then(response => {
+            this.download(response.msg);
+          }).catch(function() {});
+    },
     //选择图片框确定按钮回调
     handlePickImageDone(data){
         console.log("handlePickImageDone:"+JSON.stringify(data));