wansfa пре 1 година
родитељ
комит
4dfc8c1bea
1 измењених фајлова са 55 додато и 36 уклоњено
  1. 55 36
      src/views/qw/qwChat/index.vue

+ 55 - 36
src/views/qw/qwChat/index.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="app-container">
 
-     <el-form class="search-form" :inline="true" >
+     <el-form :model="queryParams" ref="queryForm" class="search-form" :inline="true" >
           <el-form-item label="公司名" prop="companyId">
-                <el-select filterable v-model="companyId" @change="companyChange" placeholder="请选择公司名" clearable size="small">
+                <el-select filterable v-model="queryParams.companyId" @change="companyChange" placeholder="请选择公司名" clearable size="small">
                     <el-option
                       v-for="item in companys"
                       :key="item.companyId"
@@ -15,8 +15,9 @@
           <el-form-item >
             <treeselect :clearable="false"  v-model="deptId"  :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
           </el-form-item>
-          <el-form-item>
-              <el-select filterable v-model="userIds" @change="companyUserChange" placeholder="请选择员工" clearable size="small">
+
+          <el-form-item prop="companyUserId">
+              <el-select filterable v-model="queryParams.companyUserId" @change="companyUserChange" placeholder="请选择员工" clearable size="small">
                 <el-option
                   v-for="item in users"
                   :key="item.userId"
@@ -26,8 +27,8 @@
               </el-select>
           </el-form-item>
 
-         <el-form-item>
-              <el-select filterable v-model="qwUserId"  @change="qwUserChange" placeholder="请选择企微账号" clearable size="small">
+         <el-form-item prop="qwUserId">
+              <el-select filterable v-model="queryParams.qwUserId"  @change="qwUserChange" placeholder="请选择企微账号" clearable size="small">
                 <el-option
                   v-for="item in accountList"
                   :key="item.qwUserId"
@@ -178,15 +179,15 @@ export default {
       queryParams: {
           pageNum: 1,
           pageSize: 10,
-          conversationId: null,
+          companyId  : null,
+          companyUserId: null,
+          deptId:null,
+          qwUserId:null,
       },
        companys:[],
        deptOptions:[],
-       companyId:37,
-       companyUserId:undefined,
-       deptId:undefined,
        userIds:undefined,
-       qwUserId:undefined,
+       deptId:null,
        users:[],
 
     };
@@ -195,8 +196,8 @@ export default {
       getCompanyList().then(response => {
         this.companys = response.data;
         if(this.companys!=null&&this.companys.length>0){
-          this.companyId=this.companys[0].companyId;
-          this.getTreeselect();
+          // this.companyId=this.companys[0].companyId;
+          // this.getTreeselect();
         }
       });
   },
@@ -272,53 +273,46 @@ export default {
 
   methods: {
     companyChange(val){
-      console.log(val);
-      this.companyId=val;
-      this.companyUserId=null;
+      // console.log(val);
+      // this.companyId=val;
+      this.queryParams.companyUserId=null;
       this.getTreeselect();
+      this.qwListAccount();
     },
     currDeptChange(val){
-      console.log(val)
-      this.deptId=val;
-      this.companyUserId=null;
+      console.log("---qxj currDeptChange val:"+val)
+      this.queryParams.companyUserId=null;
       this.getUserListByDeptId();
     },
      /** 查询部门下拉树结构 */
     getTreeselect() {
       var that=this;
-      var param={companyId:this.companyId}
+      var param={companyId:this.queryParams.companyId}
       treeselect(param).then((response) => {
         this.deptOptions = response.data;
-        console.log(this.deptOptions)
         if(response.data!=null&&response.data.length>0){
-          this.deptId=response.data[0].id;
-          //that.storeOrder()
+           this.deptId=response.data[0].id;
+           that.qwListAccount();
         }
       });
     },
     getUserListByDeptId() {
-        this.userIds=undefined;
         var data={deptId:this.deptId};
         getUserListByDeptId(data).then(response => {
           this.users = response.data;
         });
     },
     companyUserChange(companyUserId){  
-       this.companyUserId=companyUserId;
+       this.queryParams.companyUserId=companyUserId;
        this.qwListAccount();
     },
     qwListAccount() {
-        if(!this.companyUserId){
-             this.msgError("请选择员工");
-             return;
-        }
-        let queryParams={pageNum: 1, pageSize: 10,companyUserId:this.companyUserId};
-        listAccount(queryParams).then(response => {
+        listAccount(this.queryParams).then(response => {
             this.accountList = response.rows;
             if(this.accountList.length>0){
                 this.qwUser=this.accountList[0];
-                this.qwUserId=this.qwUser.qwUserId;
-                this.qwUser.userId=this.qwUserId;
+                this.queryParams.qwUserId=this.qwUser.qwUserId;
+                this.qwUser.userId=this.queryParams.qwUserId;
                 if(this.qwUser.qwUserId==null){
                     this.msgError("暂未扫码登录企微号");
                     return;
@@ -328,7 +322,7 @@ export default {
                 this.getConversation();   //获取会话信息
             }else{
                  this.qwUser={};
-                 this.qwUserId="";
+                 this.queryParams.qwUserId="";
                  this.msgError("该员工暂无企微号!");
             }
         });
@@ -336,8 +330,8 @@ export default {
     qwUserChange(qwUserId){
         let index= this.accountList.findIndex(item => item.qwUserId == qwUserId);
         this.qwUser=this.accountList[index];
-        this.qwUserId=this.qwUser.qwUserId;
-        this.qwUser.userId=this.qwUserId;
+        this.queryParams.qwUserId=this.qwUser.qwUserId;
+        this.qwUser.userId=this.queryParams.qwUserId;
         if(this.qwUser.qwUserId==null){
             this.msgError("暂未扫码登录企微号");
             return;
@@ -359,9 +353,34 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
+      console.log("qxj resetQuery");
       this.resetForm("queryForm");
       //this.handleQuery();
     },
+
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        account: null,
+        passWord: null,
+        phone: null,
+        email: null,
+        createTime: null,
+
+        remark: null,
+        realName: null,
+        nickName: null,
+        deviceId: null,
+        deptId: null,
+        companyUserId: null,
+        isAudit: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+
+
     initSocket(userId) {
           let that=this;
           if(!!this.qwIm.socket){