wansfa 1 vuosi sitten
vanhempi
commit
1a0f6183ae

+ 0 - 1
src/api/company/companyVoiceApi.js

@@ -12,7 +12,6 @@ export function callMobile(query) {
 }
  
 export function callOffMobile(voiceId) {
-
   return request({
     url: '/company/voiceApi/callOffMobile?voiceId='+voiceId ,
     method: 'get'

+ 2 - 0
src/api/qw/account.js

@@ -51,6 +51,8 @@ export function exportAccount(query) {
     params: query
   })
 }
+
+
 //根据账号获取设备id
 export function getDeviceId(account) {
   return request({

+ 11 - 0
src/api/qw/login.js

@@ -9,3 +9,14 @@ export function getQrCode(deviceId) {
   })
 }
 
+
+// 二维码
+export function verify(data) {
+  return request({
+    url: '/qw/login/verify',
+    method: 'post',
+    data:data 
+  })
+}
+
+

+ 0 - 1
src/layout/index.vue

@@ -54,7 +54,6 @@ import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components'
 import ResizeMixin from './mixin/ResizeHandler'
 import { mapState } from 'vuex'
 
-
 export default {
   name: 'Layout',
   components: {

+ 6 - 4
src/main.js

@@ -23,7 +23,6 @@ import { callMobile } from "@/api/company/companyVoiceApi"
 import { getAge,formatDate,parsePost,parseArr,formatMoney, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree,parseTime,dateFormat,friendlyDate,formatTime } from "@/utils/common";
 import { callNumber,callOff } from "@/utils/call";
 
-
 import Pagination from "@/components/Pagination";
 //自定义表格工具扩展
 import RightToolbar from "@/components/RightToolbar"
@@ -38,13 +37,16 @@ Vue.component('ImageUpload',ImageUpload)
 import audio from 'vue-mobile-audio'
 Vue.use(audio)
 
+Vue.prototype.callNumber = callNumber
+Vue.prototype.callOff = callOff
+Vue.prototype.callMobile = callMobile
+
 //import LemonIMUI from 'lemon-imui';
 import LemonIMUI from '@/components/LemonUI';
 Vue.use(LemonIMUI);
 
-Vue.prototype.callNumber = callNumber
-Vue.prototype.callOff = callOff
-Vue.prototype.callMobile = callMobile
+import qwIm  from "@/utils/webSocket";
+Vue.prototype.qwIm = qwIm
 
 // Vue.prototype.callOffMobile = callOffMobile
 // Vue.prototype.getSipAccount = getSipAccount

+ 2 - 1
src/store/getters.js

@@ -20,6 +20,7 @@ const getters = {
   callHa1: state => state.user.callHa1,
   isCall: state => state.user.isCall,
   callTitle: state => state.user.callTitle,
-  
+  qwUser: state => state.user.qwUser,
+
 }
 export default getters

+ 10 - 1
src/store/modules/user.js

@@ -15,6 +15,7 @@ const user = {
     callHa1:null,
     isCall:false,
     callTitle:null,
+    qwUser:null,
   },
 
   mutations: {
@@ -53,6 +54,11 @@ const user = {
       console.log(title)
       state.callTitle = title
     },
+    SET_QW_USER: (state, qwUser) => {
+      console.log("qxj SET_QW_USER:"+JSON.stringify(qwUser))
+      state.qwUser = qwUser
+    },
+
   },
 
   actions: {
@@ -63,11 +69,14 @@ const user = {
     Call({ commit }, data){
       commit('SET_CALL', true)
       commit('SET_CALL_STATUS', "正在呼叫"+data.mobile+"...")
-
     },
     CallOff({ commit }){
       commit('SET_CALL', false)
     },
+
+    qwUser({ commit }, qwUser){
+      commit('SET_QW_USER', qwUser)
+    },
     // 登录
     Login({ commit }, userInfo) {
       const username = userInfo.username.trim()

+ 28 - 21
src/utils/request.js

@@ -32,28 +32,35 @@ service.interceptors.response.use(res => {
     // 获取错误信息
     const msg = errorCode[code] || res.data.msg || errorCode['default']
     if (code === 401) {
-      MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
-          confirmButtonText: '重新登录',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }
-      ).then(() => {
-        store.dispatch('LogOut').then(() => {
-          location.href = '/index';
+        MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
+            confirmButtonText: '重新登录',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
+        ).then(() => {
+          store.dispatch('LogOut').then(() => {
+            location.href = '/index';
+          })
         })
-      })
-    } else if (code === 500) {
-      Notification.error({
-        title: msg
-      })
-      return Promise.reject(new Error(msg))
-    } else if (code !== 200) {
-      Notification.error({
-        title: msg
-      })
-      return Promise.reject('error')
-    } else {
-      return res.data
+    } 
+    else if (code === 500) {
+        Notification.error({
+          title: msg
+        })
+        return Promise.reject(new Error(msg))
+    } 
+    else if (code == 5001) {
+      return res.data;
+    }
+    else if (code !== 200) {
+        Notification.error({
+          title: msg
+        })
+        return Promise.reject('error')
+    }
+  
+    else {
+         return res.data
     }
   },
   error => {

+ 34 - 0
src/utils/webSocket.js

@@ -0,0 +1,34 @@
+
+var server = "ws://localhost:7012/imserver/r:";
+
+// function init() {
+//     if(typeof(WebSocket) === "undefined"){
+//         alert("您的浏览器不支持socket")
+//     }else{
+//         // 实例化socket
+//         socket = new WebSocket(server)
+//         // 监听socket连接
+//         socket.onopen = this.open
+//         // 监听socket错误信息
+//         socket.onerror = this.error
+//         // 监听socket消息
+//         socket.onmessage = this.getMessage
+//     }
+// };
+
+
+export default {
+    socket: {},
+    initSocket: function(uid,reset) {
+        if(typeof(WebSocket) === "undefined"){
+            console.log("您的浏览器不支持socket")
+        }else{
+            // 实例化socket
+            if(!this.socket || reset){
+                console.log("实例化socket");
+                this.socket = new WebSocket(server+uid);
+            }
+            
+        }
+    }
+}

+ 18 - 10
src/views/company/tcmScheduleReport/add.vue

@@ -79,13 +79,13 @@
               </el-col>
                <el-col :span="7">
                     <el-form-item :label="item+'单数'"  label-width="90px" :prop="'round'+(index+1)+'Order'">
-                        <el-input-number  v-model="form['round'+(index+1)+'Order']" :min="0"  :max="form.totalNum" :step="1" :placeholder="'请输入'+item+'单数'"/>
+                        <el-input-number  v-model="form['round'+(index+1)+'Order']" :min="0"  :step="1" :placeholder="'请输入'+item+'单数'"/>
                     </el-form-item>
               </el-col>  
 
               <el-col :span="5">
                     <el-form-item :label="item+'转化率:'" label-width="90px" :prop="'round'+(index+1)+'Rate'"> 
-                       <b class="span">{{(form['round'+(index+1)+'Rate']*100).toFixed(2)+"%"}}</b>  
+                       <b class="span">{{  renderRate(index) }}</b>  
                     </el-form-item>
               </el-col>
                <el-col :span="5">
@@ -357,14 +357,12 @@ export default {
         var roundRate=rule.field.replace('Order','Rate');
         if (Number(value) > this.form.totalNum) {
             this.form[roundRate]=0;
-            callback(new Error('当前轮次单数不能大于总进线'))
+            //callback(new Error('当前轮次单数不能大于总进线'))
         }else if(orderNum>this.form.totalNum){
              this.form[roundRate]=0;
-            callback(new Error('所有轮次单数不能大于总进线'))
-        }
-         else {
-            callback()
+            //callback(new Error('所有轮次单数不能大于总进线'))
         }
+        callback();
     };
     return {
       // 遮罩层
@@ -455,13 +453,14 @@ export default {
         console.log('newVal->',newVal)
         console.log('oldVal->',oldVal)
         this.form.registerRate=0;
-        if(!!newVal && Number(newVal)<=this.form.totalNum){
+        if(!!newVal && Number(newVal)<=this.form.totalNum && this.form.totalNum>0){
            this.form.registerRate=(newVal/this.form.totalNum*1.0).toFixed(2);
         }
     },
     'form.onlineNum':function(newVal,oldVal){
         console.log('newVal->',newVal)
         console.log('oldVal->',oldVal)
+        this.form.onlineRate=0;
         if(!!newVal){
            this.form.onlineRate=(newVal/this.form.registerNum*1.0).toFixed(2);
         }
@@ -469,13 +468,15 @@ export default {
     'form.finishNum':function(newVal,oldVal){
         console.log('newVal->',newVal)
         console.log('oldVal->',oldVal)
-        if(!!newVal){
+        this.form.finishRate=0;
+        if(!!newVal && this.form.registerNum>0){
            this.form.finishRate=(newVal/this.form.registerNum*1.0).toFixed(2); 
         }
     },  
      'form.round1Money':function(newVal,oldVal){   
+       
         if(!!newVal){
-            if(this.form.round1Order>0){
+            if(this.form.round1Order>0  && this.form.round1Order>0){
                 this.form.round1Unit=(newVal/this.form.round1Order*1.0).toFixed(2); 
             }
             this.calcTotalMoney();
@@ -746,6 +747,13 @@ export default {
         console.log("qxj totalOrder:"+totalOrder);
         this.form.totalOrder=totalOrder.toFixed(2);
     },
+    renderRate(index){
+        var val="0.00%";
+        if((this.form['round'+(index+1)+'Rate'])!=Infinity){
+             val=(this.form['round'+(index+1)+'Rate']*100).toFixed(2)+"%";
+        }
+        return val;
+    },
 
 
     /** 提交按钮 */

+ 92 - 28
src/views/company/tcmScheduleReport/companyReport.vue

@@ -15,7 +15,7 @@
       </el-form-item>
 
       <el-form-item label="所属档期" prop="scheduleId">
-            <el-select multiple style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
+            <el-select filterable multiple style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
                   <el-option
                       v-for="item in scheduleList"
                       :key="item.id"
@@ -55,10 +55,29 @@
 	      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-  
     <el-table v-loading="loading" :data="tcmScheduleReportList" @selection-change="handleSelectionChange">
       <el-table-column fixed  label="档期" align="center" prop="scheduleName" />
+      <el-table-column fixed label="公司名称" width="100px" align="center" prop="companyName" />
+      <el-table-column fixed label="团队总人数" width="90px" align="center" prop="cuCount"   >
+          <template slot-scope="scope">
+            {{!scope.row.cuCount?0:scope.row.cuCount}}
+          </template>
+      </el-table-column>
+      <el-table-column fixed label="接线人数" width="80px" align="center" prop="connectionNum" />
       <el-table-column fixed  label="总进线"  width="60"  align="center" prop="totalNum" />
+
+      <el-table-column fixed label="人均受线" width="90" align="center" prop="preMoney"   >
+          <template slot-scope="scope">
+            {{!scope.row.money?0:(scope.row.totalNum/scope.row.cuCount).toFixed(2)}}
+          </template>
+      </el-table-column>
+      <el-table-column fixed label="总消费" width="90" align="center" prop="money"   >
+          <template slot-scope="scope">
+            {{!scope.row.money?0:(scope.row.money).toFixed(2)}}
+          </template>
+      </el-table-column>
+
+
       <el-table-column fixed  label="注册数"  width="60"  align="center" prop="registerNum" />
       <el-table-column fixed  label="上线数"  width="60"  align="center" prop="onlineNum" />
       <el-table-column fixed  label="完课数"  width="60"  align="center" prop="finishNum" />
@@ -67,21 +86,35 @@
                {{ renderTotalVal(scope.row,0) }}
             </template>
      </el-table-column>
-     <el-table-column   label="上线率" width="80" align="center" prop="onlineRate"   >
+     <el-table-column   label="进线上线率" width="80" align="center" prop="onlineRate"   >
             <template slot-scope="scope">
                {{ renderTotalVal(scope.row,1) }}
             </template>
     </el-table-column>
-     <el-table-column   label="完课率" width="80" align="center" prop="finishRate"   >
+     <el-table-column   label="进线完课率" width="80" align="center" prop="finishRate"   >
            <template slot-scope="scope">
                {{ renderTotalVal(scope.row,2) }}
            </template>
     </el-table-column>
-    <el-table-column   label="消费金额" width="90" align="center" prop="money"   >
+
+    <el-table-column  label="创建时间" align="center" prop="createTime" width="100">
             <template slot-scope="scope">
-               {{!scope.row.money?0:(scope.row.money).toFixed(2)}}
+               <span>{{ parseTime(scope.row.createTime) }}</span>
             </template>
-    </el-table-column>
+      </el-table-column>
+     
+       <el-table-column  label="最后更新时间" align="center" prop="updateTime" width="100">
+            <template slot-scope="scope">
+               <span>{{ parseTime(scope.row.updateTime) }}</span>
+            </template>
+      </el-table-column>
+
+        <el-table-column v-for='index in 36' :key='index' :label="renderLabel(index-1)"  :width="(index-1)%4==2?'85':'72'"  :prop="renderLabelProp(index)"  align="center" >
+           <template slot-scope="scope">
+                {{ runderValue(scope.row,index-1) }}  
+           </template>     
+      </el-table-column>
+
      <el-table-column fixed="right"  label="累计总业绩" width="90" align="center" prop="totalMoney"   >
             <template slot-scope="scope">
                {{!scope.row.totalMoney?0:(scope.row.totalMoney).toFixed(2)}}
@@ -92,6 +125,13 @@
               {{!scope.row.totalOrder?0:scope.row.totalOrder}}
             </template>
     </el-table-column>
+
+    <el-table-column fixed="right"  label="人均业绩"  width="90" align="center" prop="targetRate"   >
+           <template slot-scope="scope">
+               {{ renderTotalVal(scope.row,4) }}
+           </template>
+      </el-table-column>
+
    <el-table-column  fixed="right" label="目标业绩"  width="80"  align="center" prop="targetMoney"   >
           <template slot-scope="scope">
             {{!scope.row.targetMoney?0:(scope.row.targetMoney).toFixed(2)}}
@@ -102,21 +142,18 @@
                 {{ renderTotalVal(scope.row,3) }}
            </template>
     </el-table-column>
-    <el-table-column  label="更新时间" align="center" prop="updateTime" width="100">
+
+    <el-table-column fixed="right"  label="ZROI"  width="90" align="center" prop="zroi"   >
             <template slot-scope="scope">
-               <span>{{ parseTime(scope.row.updateTime) }}</span>
+                {{ renderTotalVal(scope.row,6) }}
             </template>
       </el-table-column>
-    <!-- <el-table-column  label="创建时间" align="center" prop="createTime" width="100">
-            <template slot-scope="scope">
-               <span>{{ parseTime(scope.row.createTime) }}</span>
-            </template>
-      </el-table-column> -->
-    <el-table-column v-for='index in 36' :key='index' :label="renderLabel(index-1)"  :width="(index-1)%4==2?'85':'72'"  :prop="renderLabelProp(index)"  align="center" >
+
+      <el-table-column fixed="right"  label="单线R值"  width="90" align="center" prop="targetRate"   >
            <template slot-scope="scope">
-                {{ runderValue(scope.row,index-1) }}  
-           </template>     
-      </el-table-column>
+               {{ renderTotalVal(scope.row,5) }}
+           </template>
+    </el-table-column>
 
     </el-table>
     
@@ -170,6 +207,7 @@ export default {
         pageSize: 10,
         scheduleId: null,
         deptId:null,
+        deptIdStr:null,
         userId: null,
         companyId: null,
         totalNum: null,
@@ -240,14 +278,17 @@ export default {
         var cell=parseInt(index%4);
         var value=0;
         if(cell==0){   //业绩   
-            value=!row["round"+colls+"Money"]?0:(row["round"+colls+"Money"]).toFixed(2);
+            value=!row["round"+colls+"Money"]?0:(row["round"+colls+"Money"]).toFixed(3);
         }
         else if(cell==1){   //订单数
             value=row["round"+colls+"Order"];
         }
         else if(cell==2){    //转化率 =成单数/总进线 
-            value=(row["round"+colls+"Order"]/row["totalNum"]*100.0).toFixed(2)+"%";
-            //value=(row["round"+colls+"Rate"]*100).toFixed(2)+"%";
+            if(row.totalNum>0){
+                value=(row["round"+colls+"Order"]/row.totalNum*100.0).toFixed(3)+"%";
+             }else{
+                value="0%";
+             }
         }
         else if(cell==3){    //客单=成交金额/成交单数
             var roundMoney=row["round"+colls+"Money"];
@@ -261,13 +302,25 @@ export default {
     renderTotalVal(row,index){
        var value=0;
         if(index==0){   //注册率=注册数/总进线
-             value=(row["registerNum"]/row["totalNum"]*100.0).toFixed(3)+"%";
+             if(row.totalNum>0){
+                value=(row.registerNum/row.totalNum*100.0).toFixed(3)+"%";  
+             }else{
+                value="0%";
+             }
         }
-        else if(index==1){   //上线率=上线数/注册数
-             value=(row["onlineNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        else if(index==1){   //上线率=上线数/进线数
+              if(row.totalNum>0){
+                value=(row.onlineNum/row.totalNum*100.0).toFixed(3)+"%";  
+             }else{
+                value="0%";
+             }
         }
-        else if(index==2){   //完课率=完课数/注册数
-             value=(row["finishNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        else if(index==2){   //完课率=完课数/进线数
+             if(row.totalNum>0){
+                value=(row.finishNum/row.totalNum*100.0).toFixed(3)+"%";  
+             }else{
+                value="0%";
+             }
         }
         else if(index==3){   //目标完成率=累计业绩/目标业绩
              if(row.targetMoney>0){
@@ -276,12 +329,19 @@ export default {
                 value="0%";
              }
         }
-        else if(index==4){   //人均业绩=总业绩/当期部门人数
-             value=(row["totalMoney"]/row["cuCount"]*1.0).toFixed(3);  
+        else if(index==4){   //人均业绩=总业绩/接线人数
+             value=(row["totalMoney"]/row["connectionNum"]*1.0).toFixed(3);  
         }
         else if(index==5){   //单线R值=累计业绩/总进线
              value=(row["targetMoney"]/row["totalNum"]*1.0).toFixed(3);  
         }
+        else if(index==6){   //zori=总业绩/总消耗
+            if(row.money>0){
+                value=(row.totalMoney/row.money*1.0).toFixed(3);  
+            }else{
+                value="0%";
+            } 
+        }
         return value;
     },
     getTreeselect() {
@@ -430,6 +490,10 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
+      if(this.scheduleIdArr.length>0){
+          this.queryParams.scheduleId=this.scheduleIdArr.toString();
+      }
+      this.queryParams=this.addDateRange(this.queryParams,this.dateRange);
       const queryParams = this.queryParams;
       this.$confirm('是否确认导出中医档期业绩报表数据项?', "警告", {
           confirmButtonText: "确定",

+ 2 - 2
src/views/company/tcmScheduleReport/consume.vue

@@ -3,7 +3,7 @@
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      
         <el-form-item label="所属档期" prop="scheduleId">
-            <el-select  style="width:205.4px" v-model="queryParams.scheduleId" placeholder="请选择档期" clearable size="small" >
+            <el-select  filterable style="width:205.4px" v-model="queryParams.scheduleId" placeholder="请选择档期" clearable size="small" >
                   <el-option
                       v-for="item in scheduleList"
                       :key="item.id"
@@ -115,7 +115,7 @@
     <el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="所属档期" prop="scheduleId">
-            <el-select  style="width: 350px" v-model="form.scheduleId" placeholder="请选择档期" clearable size="small" >
+            <el-select filterable style="width: 350px" v-model="form.scheduleId" placeholder="请选择档期" clearable size="small" >
                   <el-option
                       v-for="item in scheduleList"
                       :key="item.id"

+ 31 - 11
src/views/company/tcmScheduleReport/index.vue

@@ -15,7 +15,7 @@
       </el-form-item>
 
       <el-form-item label="所属档期" prop="scheduleId">
-            <el-select multiple style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
+            <el-select filterable multiple style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
                   <el-option
                       v-for="item in scheduleList"
                       :key="item.id"
@@ -121,17 +121,17 @@
 
       <el-table-column  label="注册率" align="center" prop="registerRate"   >
         <template slot-scope="scope">
-          {{(scope.row.registerNum/scope.row.totalNum*100.0).toFixed(3)+"%"}}
+          {{ renderTotalVal(scope.row,0) }}
         </template>
-    </el-table-column>
+    </el-table-column>()
      <el-table-column  label="进线上线率" align="center" prop="onlineRate"   >
         <template slot-scope="scope">
-          {{(scope.row.onlineNum/scope.row.totalNum*100.0).toFixed(3)+"%"}}
+           {{ renderTotalVal(scope.row,1) }}
         </template>
     </el-table-column>
      <el-table-column  label="进线完课率" align="center" prop="finishRate"   >
         <template slot-scope="scope">
-         {{(scope.row.finishNum/scope.row.totalNum*100.0).toFixed(3)+"%"}}
+             {{ renderTotalVal(scope.row,2) }}
         </template>
     </el-table-column>
      <el-table-column  label="累计总业绩" width="90" align="center" prop="totalMoney"   >
@@ -243,8 +243,8 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
 
        <el-form-item label="所属档期" prop="scheduleId">
-            <el-select style="width: 200px" v-model="form.scheduleId" placeholder="请选择档期" clearable size="small" >
-              <el-option
+            <el-select filterable style="width: 200px" v-model="form.scheduleId" placeholder="请选择档期" clearable size="small" >
+              <el-option 
                       v-for="item in scheduleList"
                       :key="item.id"
                       :label="item.name"
@@ -270,7 +270,6 @@
               <el-col :span="8" v-if="form.registerRate!='0'">
                     <el-form-item label-width="80px" label="注册率" prop="registerRate">
                            {{(form.registerRate*100).toFixed(2)+"%"}}
-                      <!-- <el-input v-model="form.registerRate" placeholder="请输入注册率" /> -->
                     </el-form-item>
               </el-col>
                <el-col :span="8" v-if="form.onlineRate!='0'">
@@ -527,14 +526,15 @@ export default {
         console.log('newVal->',newVal)
         console.log('oldVal->',oldVal)
         this.form.registerRate=0;
-        if(!!newVal && Number(newVal)<=this.form.totalNum){
+        if(!!newVal && Number(newVal)<=this.form.totalNum && this.form.totalNum!=0 ){
            this.form.registerRate=(newVal/this.form.totalNum*1.0).toFixed(2);
         }
     },
     'form.onlineNum':function(newVal,oldVal){
         console.log('newVal->',newVal)
         console.log('oldVal->',oldVal)
-        if(!!newVal){
+        this.form.onlineRate=0;
+        if(!!newVal  && this.form.registerNum!=0){
            this.form.onlineRate=(newVal/this.form.registerNum*1.0).toFixed(2);
         }
         
@@ -542,7 +542,8 @@ export default {
     'form.finishNum':function(newVal,oldVal){
         console.log('newVal->',newVal)
         console.log('oldVal->',oldVal)
-        if(!!newVal){
+        this.form.finishRate=0;
+        if(!!newVal   && this.form.registerNum!=0){
            this.form.finishRate=(newVal/this.form.registerNum*1.0).toFixed(2); 
         }
         
@@ -738,6 +739,25 @@ export default {
         }).then(response => {
           this.download(response.msg);
         }).catch(function() {});
+    },
+    renderTotalVal(row,index){
+       var value="0%";
+        if(index==0){   //注册率=注册数/总进线
+             if(row.totalNum>0){
+                 value=(row.registerNum/row.totalNum*100.0).toFixed(3)+"%";
+             }
+        }
+        else if(index==1){   //进线上线率=上线数/总进线
+            if(row.totalNum>0){
+                  value=(row.onlineNum/row.totalNum*100.0).toFixed(3)+"%"; 
+             }
+        }
+        else if(index==2){   //进线完课率=完课数/总进线
+             if(row.totalNum>0){
+                  value=(row.finishNum/row.totalNum*100.0).toFixed(3)+"%";
+             }
+        }
+        return value;
     }
   }
 };

+ 18 - 6
src/views/company/tcmScheduleReport/statisticsReport.vue

@@ -15,7 +15,7 @@
       </el-form-item>
 
       <el-form-item label="所属档期" prop="scheduleId">
-            <el-select multiple style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
+            <el-select filterable multiple style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
                   <el-option
                       v-for="item in scheduleList"
                       :key="item.id"
@@ -342,13 +342,25 @@ export default {
     renderTotalVal(row,index){
        var value=0;
         if(index==0){   //注册率=注册数/总进线
-             value=(row["registerNum"]/row["totalNum"]*100.0).toFixed(3)+"%";
+             if(row.totalNum>0){
+                value=(row.registerNum/row.totalNum*100.0).toFixed(3)+"%";  
+             }else{
+                value="0%";
+             }
         }
-        else if(index==1){   //上线率=上线数/注册数
-             value=(row["onlineNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        else if(index==1){   //上线率=上线数/总进线
+             if(row.totalNum>0){
+                value=(row.onlineNum/row.totalNum*100.0).toFixed(3)+"%";  
+             }else{
+                value="0%";
+             }
         }
-        else if(index==2){   //完课率=完课数/注册数
-             value=(row["finishNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        else if(index==2){   //完课率=完课数/总进线
+             if(row.totalNum>0){
+                value=(row.finishNum/row.totalNum*100.0).toFixed(3)+"%";  
+             }else{
+                value="0%";
+             }
         }
         else if(index==3){   //目标完成率=累计业绩/目标业绩
              if(row.targetMoney>0){

+ 1 - 1
src/views/crm/customer/line.vue

@@ -268,7 +268,7 @@
 </template>
 
 <script>
- import store from "@/store";
+import store from "@/store";
 import { importLineTemplate,getLineCustomerList ,assignToUser,getCustomerDetails,exportCustomer } from "@/api/crm/customer";
 import customerDetails from '../components/customerDetails.vue';
 import { treeselect } from "@/api/company/companyDept";

+ 15 - 5
src/views/qw/qwChat/qq.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-      <div class="imui-center qq-lemon-imui">
+      <div class="imui-center qq-lemon-imui" v-show="showQW">
         <lemon-imui  class="lemon-slot"
           :width="windowWidth"
           :height="windowHeight"
@@ -98,9 +98,9 @@
 
 <script>
 
+import store from "@/store";
 import { getQrCode } from '@/api/qw/login';
 import { getDeviceId} from '@/api/qw/account';
-
 import LemonMessageVoice from "@/components/LemonUI/components/lemon-message-voice";
 
 import ContactsData from "@/components/LemonUI/database/contacts";
@@ -240,6 +240,8 @@ export default {
       hideMenu: false,
       hideMessageName: false,
       hideMessageTime: true,
+      qwUser:store.getters.qwUser,
+      showQW:false,
       UserData: {
         id: "1000",
         displayName: "June",
@@ -250,6 +252,14 @@ export default {
     };
   },
   mounted() {
+    if(!this.qwUser){
+        this.$message.error('未登录企微账号');
+        setTimeout(() => {
+          this.$router.go(-1);
+        }, 2000);
+        return;
+    }
+    this.showQW=true;
     const contactData1 = {
             id: "contact-1",
             displayName: "工作协作群",
@@ -286,11 +296,11 @@ export default {
     const IMUI = this.$refs.IMUI;
     IMUI.initContacts(ContactsData);
 
-    var converData = ContactsData.filter(item => item.id<=7);
-    converData.sort((a1, a2) => {
+    var conversationData = ContactsData.filter(item => item.id<=7);
+    conversationData.sort((a1, a2) => {
       return a2.lastSendTime - a1.lastSendTime;
     });
-    IMUI.initConversations(converData);
+    IMUI.initConversations(conversationData);
   
     IMUI.initMenus([
       {

+ 134 - 41
src/views/qw/qwLogin/index.vue

@@ -6,10 +6,13 @@
           <el-card class="scan-card" shadow="hover">
             <div class="scan-card-content">
               <h1 class="title">扫码登录</h1>
-               <el-form-item label="账号" prop="account" style="width:100%">
+               <el-form-item label="账号" prop="account" style="width:100%" v-if="!showVerifyCode">
                   <el-input  v-model="qwForm.account" placeholder="请输入账号" style="margin-bottom: 20px"></el-input>
                </el-form-item>
-              <el-button type="primary" @click.native.prevent="handleLogin">登录</el-button>
+                <el-form-item label="验证码" prop="verifyCode" style="width:100%" v-if="showVerifyCode">
+                  <el-input  v-model="qwForm.verifyCode" placeholder="请输入验证码" style="margin-bottom: 20px"></el-input>
+               </el-form-item>
+              <el-button type="primary" @click.native.prevent="handleLogin" style="width:200px">{{loginTips}}</el-button>
               <div class="qrcode-container" v-show="showQRCode">
                 <div>
                   <img ref="imageElement" alt="Base64 Image" style="width:250px,height:auto ;">
@@ -25,9 +28,10 @@
 </template>
 
 <script>
-import { getQrCode } from '@/api/qw/login';
+import store from "@/store";
+import { getQrCode,verify } from '@/api/qw/login';
 import { getDeviceId} from '@/api/qw/account';
-
+import { Notification } from 'element-ui'
 export default {
   data() {
     return {
@@ -39,65 +43,154 @@ export default {
       showQRCode: false, // 是否显示二维码
       errorMessage: '', // 错误信息
       qrCode:'',
+      companyUser:store.getters.user,
+      showVerifyCode:false,
+      loginTips:"获取二维码",
       qwForm: {
-          account:null
+          account:"1261818888",
+          verifyCode:null
       },
        // 表单校验
       qwRules: {
         account: [
           { required: true, message: "请输入账号", trigger: "blur" }
+        ],
+         verifyCode: [
+          { required: true, message: "请输入验证码", trigger: "blur" }
         ]
       }
     };
   },
+  created() {
+
+  },
+  mounted () {
+      // 初始化
+      //this.initSocket(this.companyUser.userId);
+      //console.log("userId:"+JSON.stringify(this.companyUser));
+  },
   methods: {
     handleLogin() {
       this.$refs.qwForm.validate(valid => {
           if (valid) {
-                  const account = this.qwForm.account;
-                  this.loading=true;
-                  if (this.showQRCode) {
-                      this.getQrCode();
-                  }else{
-                        getDeviceId(account).then(response => {
-                              this.deviceId = response.deviceId;
-                              this.showQRCode = !!this.deviceId; // 根据 deviceId 控制是否显示二维码
-                              if (this.showQRCode) {
-                                  this.getQrCode();
-                              }else{
-                                  // deviceId 为空时显示错误提示
-                                  this.errorMessage = '请检查账号是否正确或是否审核通过';
-                                  this.loading=false;
-                              }
-                      });
-                  }
+                if(!this.showVerifyCode){
+                    this.loginAction();
+                }else{
+                     this.verify();
+                }
           }
       });
     },
     getQrCode(){
-              // 获取二维码
-              getQrCode(this.deviceId).then(response => {
-                this.qrCode = response.data.qrcode; 
-                const base64Data = this.qrCode; // Base64 编码
-                const image = new Image();
-                image.onload = () => {
-                  this.$refs.imageElement.src = image.src;
-                };
-                image.src = `data:image/jpeg;base64,${base64Data}`;   
+            // 获取二维码
+           getQrCode(this.deviceId).then(response => {
+                console.log("qxj getQrCode:"+JSON.stringify(response));
                 this.loading=false;  
+                  if(response.code==200){
+                        this.qrCode = response.data.qrcode; 
+                        const base64Data = this.qrCode; // Base64 编码
+                        const image = new Image();
+                        image.onload = () => {
+                          this.$refs.imageElement.src = image.src;
+                        };
+                        image.src = `data:image/jpeg;base64,${base64Data}`;   
+                  }else{
+                         this.showQRCode=false;
+                         Notification.error({title: response.msg });
+                  }
               });
+    },
+
+    loginAction(){
+              Notification.success({title: "登录成功!" });
+              return;
+
+              const account = this.qwForm.account;
+              this.loading=true;
+              if (this.showQRCode) {
+                  this.getQrCode();
+              }else{
+                    getDeviceId(account).then(response => {
+                          this.deviceId = response.deviceId;
+                          this.showQRCode = !!this.deviceId; // 根据 deviceId 控制是否显示二维码
+                          this.initSocket(this.deviceId);
+                          if (this.showQRCode) {
+                                this.getQrCode();
+                          }else{
+                              // deviceId 为空时显示错误提示
+                              this.errorMessage = '请检查账号是否正确或是否审核通过';
+                              this.loading=false;
+                          }
+                  });
+              }
+    },
+    verify(){
+              // 验证码验证
+              this.loading=true;
+              const verifyCode=this.qwForm.verifyCode;
+              let data={"verifyCode":verifyCode,"deviceId":this.deviceId};
+              verify(data).then(response => {
+                  this.loading=false;  
+              });
+    },
+     initSocket(userId) {
+               let that=this;
+              if(!!this.qwIm.socket){
+                  this.qwIm.initSocket(userId,true);
+                    // 监听socket连接
+                  this.qwIm.socket.onopen = function() {
+                          console.log("socket连接成功");
+                  };
+                  // 监听socket错误信息
+                  this.qwIm.socket.onerror = function() {
+                      console.log("连接错误")
+                  };
+                  // 监听socket消息
+                  this.qwIm.socket.onmessage = function(res) {
+                       var data=JSON.parse(res.data);
+                        console.log("收到服务端内容", JSON.stringify(data));
+                        if(data.cmd=="loginSucc"){
+                            var qwUserInfo=JSON.parse(data.msg);
+                            //console.log("qxj loginSucc", JSON.stringify(qwUserInfo));
+                           
+                            store.dispatch('qwUser',qwUserInfo);
+                            that.showQRCode=false;
+                            that.$router.push({path:'/qw/chat'});
+                        }
+                        if(data.cmd=="verifyCode"){
+                            that.loginTips="登录";
+                            that.showQRCode=false;
+                            that.showVerifyCode=true;
+                        }
+                  };
+                    // 监听socket消息
+                  this.qwIm.socket.onclose = function(res) {
+                        console.log("socket已经关闭")
+                  };
+              }
+      },
+      open() {
+            console.log("socket连接成功");
+
+      },
+      error() {
+            console.log("连接错误")
+      },
+      getMessage(msg) {
+            console.log(msg.data)
+       },
+      // 发送消息给被连接的服务端
+      send(params) {
+            // this.qwIm.socket.send(params)
+      },
+      close() {
+           
+      },
+      destroyed () {
+        // 销毁监听
+        //this.qwIm.socket.onclose = this.close
     }
 
-    // convertBase64ToImage(qrCode) {
-    //   const base64Data = qrCode; // Base64 编码
-    //   console.log(base64Data)
-    //   const image = new Image();
-    //   image.onload = () => {
-    //     this.$refs.imageElement.src = image.src;
-    //   };
-    //   image.src = `data:image/jpeg;base64,${base64Data}`;
-    // },
-    
   },
 };
 </script>