Browse Source

Merge remote-tracking branch 'origin/master'

阿拉蕾 1 year ago
parent
commit
ee9408d0cb

+ 40 - 0
src/api/company/scheduleReport.js

@@ -9,6 +9,25 @@ export function listTcmScheduleReport(query) {
   })
 }
 
+// 中医档期业绩报表统计
+export function listTcmStatisticsReport(query) {
+  return request({
+    url: '/company/scheduleReport/statistics',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询指定档期各团队统计报表
+export function getStatisticsByScheduleId(query) {
+  return request({
+    url: '/company/scheduleReport/getStatisticsByScheduleId',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询中医档期业绩报表详细
 export function getTcmScheduleReport(id) {
   return request({
@@ -43,6 +62,15 @@ export function delTcmScheduleReport(id) {
   })
 }
 
+// 导出中医档期业绩统计报表
+export function exportStatisticsScheduleReport(query) {
+  return request({
+    url: '/company/scheduleReport/exportStatistics',
+    method: 'get',
+    params: query
+  })
+}
+
 // 导出中医档期业绩报表
 export function exportTcmScheduleReport(query) {
   return request({
@@ -53,6 +81,8 @@ export function exportTcmScheduleReport(query) {
 }
 
 
+
+
 // 查询中医档期管理列表
 export function listSchedule(query) {
   return request({
@@ -60,4 +90,14 @@ export function listSchedule(query) {
     method: 'get',
     params: query
   })
+}
+
+
+// 查询中医档期管理列表
+export function listAllSchedule(query) {
+  return request({
+    url: '/company/scheduleReport/getAllScheduleList',
+    method: 'get',
+    params: query
+  })
 }

+ 1 - 5
src/views/company/companyVoiceLogs/index.vue

@@ -426,16 +426,12 @@ export default {
           this.download(response.msg);
         }).catch(function() {});
     },
-              /** 查询部门下拉树结构 */
+    /** 查询部门下拉树结构 */
     getTreeselect() {
         var that=this;
         var param={companyId:this.companyId}
         treeselect(param).then((response) => {
           this.deptOptions = response.data;
-          console.log(this.deptOptions)
-          if(response.data!=null&&response.data.length>0){
-            //this.queryParams.deptId=response.data[0].id;
-          }
         });
     },
     companyChange(val){

+ 331 - 0
src/views/company/components/companySchedule.vue

@@ -0,0 +1,331 @@
+<template>
+  <div class="app-container" style="padding-top:0">
+    <el-table v-loading="loading" border :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="100px" align="center" prop="deptName" /> -->
+       <!-- <el-table-column label="员工姓名" align="center" prop="userNickName" /> -->
+       <el-table-column fixed label="团队总人数" width="90px" align="center" prop="cuCount" />
+       <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  label="注册数"  width="60"  align="center" prop="registerNum" />
+      <el-table-column  label="上线数"  width="60"  align="center" prop="onlineNum" />
+      <el-table-column  label="完课数"  width="60"  align="center" prop="finishNum" />
+      <el-table-column  label="注册率"    align="center" prop="registerRate"   >
+            <template slot-scope="scope">
+              {{ renderTotalVal(scope.row,0) }}
+            </template>
+     </el-table-column>
+     <el-table-column   label="上线率" align="center" prop="onlineRate"   >
+            <template slot-scope="scope">
+               {{ renderTotalVal(scope.row,1) }}
+            </template>
+    </el-table-column>
+     <el-table-column   label="完课率"  align="center" prop="finishRate"   >
+           <template slot-scope="scope">
+              {{ renderTotalVal(scope.row,2) }}
+           </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" >
+           <template slot-scope="scope">
+                {{ runderValue(scope.row,index-1) }}  
+           </template>     
+      </el-table-column>
+
+      <el-table-column   label="累计总业绩" width="90" align="center" prop="totalMoney"   >
+            <template slot-scope="scope">
+               {{!scope.row.totalMoney?0:(scope.row.totalMoney).toFixed(2)}}   
+            </template>
+      </el-table-column>
+      <el-table-column   label="累计总单" width="80" align="center" prop="totalOrder"   >
+            <template slot-scope="scope">
+              {{!scope.row.totalOrder?0:scope.row.totalOrder}}
+            </template>
+      </el-table-column>
+
+      <el-table-column  label="人均业绩"  width="90" align="center" prop="targetRate"   >
+           <template slot-scope="scope">
+               {{ renderTotalVal(scope.row,4) }}
+           </template>
+      </el-table-column>
+
+
+      <el-table-column   label="目标业绩"  width="80"  align="center" prop="targetMoney"   >
+                <template slot-scope="scope">
+                {{!scope.row.targetMoney?0:(scope.row.targetMoney).toFixed(2)}}
+                </template>
+        </el-table-column>
+        <el-table-column   label="目标完成率"  width="90" align="center" prop="targetRate"   >
+                <template slot-scope="scope">
+                    {{ renderTotalVal(scope.row,3) }}
+                </template>
+        </el-table-column>
+
+        <el-table-column  label="单线R值"  width="90" align="center" prop="targetRate"   >
+            <template slot-scope="scope">
+                {{ renderTotalVal(scope.row,5) }}
+            </template>
+        </el-table-column>
+
+
+
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+  </div>
+</template>
+
+<script>
+
+import { listTcmStatisticsReport,listAllSchedule,getStatisticsByScheduleId } from "@/api/company/scheduleReport";
+export default {
+  name: "companyScheduleReport",
+  components: {  },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 中医档期业绩报表表格数据
+      tcmScheduleReportList: [],
+      scheduleList:[],
+      deptIds:[],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      dateRange: [],
+      companyId:undefined,
+      companys:[],
+      roundArr:["一轮","二轮","三轮","四轮","五轮","六轮","七轮","八轮","九轮"],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        scheduleId: null,
+        deptId:null,
+        deptIdStr:"",
+        userId: null,
+        companyId: null,
+        totalNum: null,
+        registerNum: null,
+        onlineNum: null,
+        finishNum: null,
+        registerRate: null,
+        onlineRate: null,
+        finishRate: null,
+        totalMoney: null,
+      },
+      users:[],
+      singleColumnArrs:[],
+      // 部门树选项
+      deptOptions: [],
+      // 部门名称
+      deptName: undefined,
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: { 
+         
+      }
+    };
+  },
+  created() {
+      
+  },
+  methods: {
+     getData(data){
+            this.queryParams.companyId=data.companyId;
+            this.queryParams.scheduleId=data.scheduleId;
+            this.queryParams.pageNum=1;
+            this.queryParams.pageSize=10;
+            this.dateRange=[];
+            this.getList();
+    },
+    getListSchedule() {
+        this.loading = true;
+        listAllSchedule().then(response => {
+            this.scheduleList = response.rows;
+        });
+    },
+    /** 查询中医档期业绩报表列表 */
+    getList() {
+      this.loading = true;
+      if(!!this.queryParams.deptIdStr){
+           console.log("qxj params deptIdStr:"+this.queryParams.deptIdStr);
+      }
+      getStatisticsByScheduleId(this.queryParams).then(response => {
+          this.tcmScheduleReportList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+          this.calcFilterData();
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出中医档期业绩报表数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportTcmScheduleReport(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    },
+    renderLabel(index){
+        var colls=parseInt(index/4);
+        var cell=parseInt(index%4);
+        var str=this.roundArr[colls];
+        if(cell==0){
+            str+="业绩"
+        }
+        else if(cell==1){
+            str+="单数"
+        }
+        else if(cell==2){
+             str+="转化率"
+        }
+        else if(cell==3){
+             str+="客单"
+        }
+        return str;
+    },
+    renderLabelProp(index){  
+        var colls=parseInt(index/4)+1;
+        var str=this.roundArr[colls];
+        if(colls==1){
+             str="round"+colls+"Money";
+        }
+        else if(colls==2){
+             str="round"+colls+"Order";
+        }
+        else if(colls==3){
+             str="round"+colls+"Rate";
+        }
+        else if(colls==4){
+             str="round"+colls+"Unit";
+        }
+        return str;
+    },
+    runderValue(row,index){    //注册率=注册数/总进线  上线率=上线数/注册数  完课率=完课数/注册数   目标完成率=累计业绩/目标业绩  单线R值=累计业绩/总进线
+        var colls=parseInt(index/4)+1;
+        var cell=parseInt(index%4);
+        var value=0;
+        if(cell==0){   //业绩   
+            value=!row["round"+colls+"Money"]?0:(row["round"+colls+"Money"]).toFixed(2);
+        }
+        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)+"%";
+        }
+        else if(cell==3){    //客单=成交金额/成交单数
+            var roundMoney=row["round"+colls+"Money"];
+            var roundOrder=row["round"+colls+"Order"];
+            if(!!roundMoney && !!roundOrder){
+                value=(roundMoney/roundOrder*1.0).toFixed(2);
+            }
+        }
+        return value;
+    },
+    renderTotalVal(row,index){
+       var value=0;
+        if(index==0){   //注册率=注册数/总进线
+             value=(row["registerNum"]/row["totalNum"]*100.0).toFixed(3)+"%";
+        }
+        else if(index==1){   //上线率=上线数/注册数
+             value=(row["onlineNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        }
+        else if(index==2){   //完课率=完课数/注册数
+             value=(row["finishNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        }
+        else if(index==3){   //目标完成率=累计业绩/目标业绩
+             value=(row["totalMoney"]/row["targetMoney"]*100.0).toFixed(3)+"%";  
+        }
+        else if(index==4){   //人均业绩=总业绩/当期部门人数
+             value=(row["totalMoney"]/row["cuCount"]*1.0).toFixed(3);  
+        }
+        else if(index==5){   //单线R值=累计业绩/总进线
+             value=(row["targetMoney"]/row["totalNum"]*1.0).toFixed(3);  
+        }
+        return value;
+    },
+
+    calcFilterData(){
+       var that=this;
+       that.singleColumnArrs=[];
+       let arr1 = this.tcmScheduleReportList.map(item => item["companyId"]);
+       let arrFilter=arr1.filter(function(id,index){
+          if(arr1.indexOf(id)==index){
+              that.singleColumnArrs.push(index);
+              return true;
+          }
+          return false
+       });
+    }
+ 
+   
+  }
+};
+</script>

+ 269 - 339
src/views/company/schedule/report.vue

@@ -1,8 +1,9 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="公司名" prop="companyId">
-          <el-select filterable  v-model="queryParams.companyId" placeholder="请选择公司名"  @change="companyChange" clearable size="small">
+    
+    <el-form-item label="公司名" prop="companyId">
+          <el-select multiple filterable  v-model="companyIdArr" placeholder="请选择公司名"   clearable size="small">
               <el-option
                 v-for="item in companys"
                 :key="item.companyId"
@@ -11,21 +12,12 @@
               />
         </el-select>
       </el-form-item>  
-
-      <!-- <el-form-item >
+     <el-form-item > 
           <treeselect style="width: 220px" :clearable="false"  v-model="queryParams.deptId"  :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
-      </el-form-item>
-       <el-form-item label="员工姓名" prop="userNickName">
-        <el-input
-          v-model="queryParams.userNickName"
-          placeholder="请输入员工姓名"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item> -->
+     </el-form-item>
+
       <el-form-item label="所属档期" prop="scheduleId">
-            <el-select  style="width:205.4px" v-model="queryParams.scheduleId" placeholder="请选择档期" clearable size="small" >
+            <el-select multiple style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
                   <el-option
                       v-for="item in scheduleList"
                       :key="item.id"
@@ -86,242 +78,81 @@
       </el-col>
 	     <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
-     <!-- :span-method="objectSpanMethod"  -->
-    <el-table v-loading="loading" border 
-    
-    :data="tcmScheduleReportList" @selection-change="handleSelectionChange">
-      <!-- <el-table-column label="id"  width="50" align="center" prop="id" /> -->
-      <el-table-column fixed label="档期" align="center" prop="scheduleName" />
-      <el-table-column fixed label="公司名称" width="100px" align="center" prop="companyName" />
-    
-      <!-- <el-table-column label="所在部门" align="center" prop="deptName" />
-      <el-table-column label="员工姓名" align="center" prop="userNickName" /> -->
-       <el-table-column fixed label="团队总人数" width="90px" align="center" prop="cuCount" />
-       <el-table-column fixed label="接线人数" width="95px" align="center" prop="connectionNum" />
-      <el-table-column fixed label="总进线"  width="60"  align="center" prop="totalNum" />
-      <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" />
-      <el-table-column  label="注册率"    align="center" prop="registerRate"   >
+  
+    <el-table v-loading="loading" :data="tcmScheduleReportList" @selection-change="handleSelectionChange">
+       <!-- <el-table-column  type="expand" >
             <template slot-scope="scope">
-              {{ renderTotalVal(scope.row,0) }}
+                <el-table border :data="[scope.row]">
+                    <el-table-column prop="round1Money" label="一轮业绩" ></el-table-column>
+                    <el-table-column prop="round1Order" label="一轮单数"></el-table-column>
+                    <el-table-column prop="count" label="一轮转化率">
+                        <template slot-scope="scope1">
+                             {{(scope1.row.onlineRate*100).toFixed(2)+"%"}}
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="round2Unit" label="一轮客单"></el-table-column>
+                </el-table>
+            </template>
+      </el-table-column> -->
+
+      <el-table-column  label="id"  width="50" align="center" prop="id" />
+      <el-table-column  label="档期" align="center" prop="scheduleName" />
+      <el-table-column label="公司名称" width="110" align="center" prop="companyName" />
+      <el-table-column  label="所在部门" width="110" align="center" prop="deptName" />
+      <el-table-column  label="员工姓名" align="center" prop="userNickName" />
+
+      <el-table-column  label="总进线"  width="60"  align="center" prop="totalNum" />
+      <el-table-column  label="注册数"  width="60"  align="center" prop="registerNum" />
+      <el-table-column  label="上线数"  width="60"  align="center" prop="onlineNum" />
+      <el-table-column  label="完课数"  width="60"  align="center" prop="finishNum" />
+      <el-table-column  label="注册率"  width="80"  align="center" prop="registerRate"   >
+            <template slot-scope="scope">
+               {{ renderTotalVal(scope.row,0) }}
             </template>
      </el-table-column>
-     <el-table-column   label="上线率" 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="完课率"  align="center" prop="finishRate"   >
+     <el-table-column   label="完课率" width="80" align="center" prop="finishRate"   >
            <template slot-scope="scope">
-              {{ renderTotalVal(scope.row,2) }}
+               {{ renderTotalVal(scope.row,2) }}
            </template>
     </el-table-column>
-
-    <!-- <el-table-column label="创建时间" align="center" prop="createTime" width="100">
+     <el-table-column   label="累计总业绩" width="90" align="center" prop="totalMoney"   >
             <template slot-scope="scope">
-               <span>{{ parseTime(scope.row.createTime) }}</span>
+               {{!scope.row.totalMoney?0:(scope.row.totalMoney).toFixed(2)}}
             </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   label="累计总业绩" width="90" align="center" prop="totalMoney"   >
-            <template slot-scope="scope">
-               {{!scope.row.totalMoney?0:(scope.row.totalMoney).toFixed(2)}}   
-            </template>
-      </el-table-column>
-      <el-table-column   label="累计总单" width="80" align="center" prop="totalOrder"   >
+    </el-table-column>
+     <el-table-column   label="累计总单" width="80" align="center" prop="totalOrder"   >
             <template slot-scope="scope">
               {{!scope.row.totalOrder?0:scope.row.totalOrder}}
             </template>
-      </el-table-column>
-
-      <el-table-column fixed="right"  label="人均业绩"  width="90" align="center" prop="targetRate"   >
+    </el-table-column>
+   <el-table-column   label="目标业绩"  width="80"  align="center" prop="targetMoney"   >
+          <template slot-scope="scope">
+            {{!scope.row.targetMoney?0:(scope.row.targetMoney).toFixed(2)}}
+          </template>
+    </el-table-column>
+    <el-table-column   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)}}
-            </template>
-      </el-table-column>
-      <el-table-column fixed="right"  label="目标完成率"  width="90" align="center" prop="targetRate"   >
-            <template slot-scope="scope">
                 {{ renderTotalVal(scope.row,3) }}
-            </template>
-      </el-table-column>
-
-      <el-table-column fixed="right"  label="单线R值"  width="90" align="center" prop="targetRate"   >
-           <template slot-scope="scope">
-               {{ renderTotalVal(scope.row,5) }}
            </template>
     </el-table-column>
-
-<!--     
-       <el-table-column  label="一轮业绩"  width="72"  align="center" prop="round1Money"   >  
-           <template slot-scope="scope">
-                {{!scope.row.round1Money?0:(scope.row.round1Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="一轮单数"  width="72" align="center" prop="round1Order" ></el-table-column> 
-      <el-table-column label="一轮转化率" width="85"  align="center" prop="round1Rate">
-            <template slot-scope="scope">
-                {{(scope.row.round1Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="一轮客单"  width="72"  align="center" prop="round1Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round1Unit).toFixed(2)}}
-             </template>
-      </el-table-column>
-
-
-      <el-table-column  label="二轮业绩"  width="72"  align="center" prop="round2Money"   >
-           <template slot-scope="scope">
-                {{!scope.row.round2Money?0:(scope.row.round2Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="二轮单数"  width="72" align="center" prop="round2Order" ></el-table-column>
-      <el-table-column label="二轮转化率" width="85"  align="center" prop="round2Rate">
-            <template slot-scope="scope">
-                {{(scope.row.round2Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="二轮客单"  width="72"  align="center" prop="round2Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round2Unit).toFixed(2)}}
-             </template>
-      </el-table-column>
-
-
-      <el-table-column  label="三轮业绩"  width="72"  align="center" prop="round3Money"   >
-           <template slot-scope="scope">
-                {{!scope.row.round3Money?0:(scope.row.round3Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="三轮单数"  width="72" align="center" prop="round3Order" ></el-table-column>
-      <el-table-column label="三轮转化率" width="85"  align="center" prop="round3Rate">
-            <template slot-scope="scope">
-                {{(scope.row.round3Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="三轮客单"  width="72"  align="center" prop="round3Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round3Unit).toFixed(2)}}
-             </template>
-      </el-table-column>
-   
-      <el-table-column  label="四轮业绩"  width="72"  align="center" prop="round4Money"   >
-           <template slot-scope="scope">
-                {{!scope.row.round4Money?0:(scope.row.round4Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="四轮单数"  width="72" align="center" prop="round4Order" ></el-table-column>
-      <el-table-column label="四轮转化率" width="85"  align="center" prop="round4Rate">
-            <template slot-scope="scope1">
-                {{(scope1.row.round4Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="四轮客单"  width="72"  align="center" prop="round4Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round4Unit).toFixed(2)}}
-             </template>
-      </el-table-column>
-
-      <el-table-column  label="五轮业绩"  width="72"  align="center" prop="round5Money"   >
-           <template slot-scope="scope">
-                {{!scope.row.round5Money?0:(scope.row.round5Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="五轮单数"  width="72" align="center" prop="round5Order" ></el-table-column>
-      <el-table-column label="五轮转化率" width="85"  align="center" prop="round5Rate">
+    <el-table-column  label="创建时间" align="center" prop="createTime" width="100">
             <template slot-scope="scope">
-                {{(scope.row.round5Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="五轮客单"  width="72"  align="center" prop="round5Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round5Unit).toFixed(2)}}
-             </template>
-      </el-table-column>
-      
-      <el-table-column  label="六轮业绩"  width="72"  align="center" prop="round6Money"   >
-           <template slot-scope="scope">
-                {{!scope.row.round6Money?0:(scope.row.round6Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="六轮单数"  width="72" align="center" prop="round6Order" ></el-table-column>
-      <el-table-column label="六轮转化率" width="85"  align="center" prop="round6Rate">
-            <template slot-scope="scope">
-                {{(scope.row.round6Rate*100).toFixed(2)+"%"}}
+               <span>{{ parseTime(scope.row.createTime) }}</span>
             </template>
       </el-table-column>
-      <el-table-column label="六轮客单"  width="72"  align="center" prop="round6Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round6Unit).toFixed(2)}}
-             </template>
-      </el-table-column>
 
-      <el-table-column  label="七轮业绩"  width="72"  align="center" prop="round7Money"   >
-           <template slot-scope="scope">
-                {{!scope.row.round7Money?0:(scope.row.round7Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="七轮单数"  width="72" align="center" prop="round7Order" ></el-table-column>
-      <el-table-column label="七轮转化率" width="85"  align="center" prop="round7Rate">
-            <template slot-scope="scope">
-                {{(scope.row.round7Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="七轮客单"  width="72"  align="center" prop="round7Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round7Unit).toFixed(2)}}
-             </template>
-      </el-table-column>
 
-      <el-table-column  label="八轮业绩"  width="72"  align="center" prop="round8Money"   >
+    <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">
-                {{!scope.row.round8Money?0:(scope.row.round8Money).toFixed(2)}}
-           </template>
-      </el-table-column>
-      <el-table-column label="八轮单数"  width="72" align="center" prop="round8Order" ></el-table-column>
-      <el-table-column label="八轮转化率" width="85"  align="center" prop="round8Rate">
-            <template slot-scope="scope">
-                {{(scope.row.round8Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="八轮客单"  width="72"  align="center" prop="round8Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round8Unit).toFixed(2)}}
-             </template>
+                {{ runderValue(scope.row,index-1) }}  
+           </template>     
       </el-table-column>
 
-      <el-table-column  label="九轮业绩"  width="72"  align="center" prop="round9Money"   >
-            <template slot-scope="scope">
-                    {{!scope.row.round9Money?0:(scope.row.round9Money).toFixed(2)}}
-            </template>
-      </el-table-column>
-      <el-table-column label="九轮单数"  width="72" align="center" prop="round9Order" ></el-table-column>
-      <el-table-column label="九轮转化率" width="85"  align="center" prop="round9Rate">
-            <template slot-scope="scope">
-                {{(scope.row.round9Rate*100).toFixed(2)+"%"}}
-            </template>
-      </el-table-column>
-      <el-table-column label="九轮客单"  width="72"  align="center" prop="round9Unit">
-             <template slot-scope="scope">
-                {{(scope.row.round9Unit).toFixed(2)}}
-             </template>
-      </el-table-column> -->
-
-
         <!-- <el-table-column  fixed="right" label="操作" width="150px" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
             <el-button size="mini" type="text" @click="handleDetails(scope.row)">查看</el-button>
@@ -339,7 +170,6 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
-
   </div>
 </template>
 
@@ -347,16 +177,17 @@
 import { treeselect } from "@/api/company/companyDept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { listTcmScheduleReport, getTcmScheduleReport, delTcmScheduleReport, addTcmScheduleReport, updateTcmScheduleReport, exportTcmScheduleReport,listSchedule } from "@/api/company/scheduleReport";
+import { listTcmScheduleReport, exportTcmScheduleReport,listAllSchedule } from "@/api/company/scheduleReport";
 import { getCompanyList } from "@/api/company/company";
 export default {
-   watch: {
-    // 监听deptId
-    'deptId': 'currDeptChange'
+  watch: {
+    // 监听companyIdArr
+    'companyIdArr':'companyChange'
   },
   name: "TcmScheduleReport",
   components: { Treeselect },
   data() {
+   
     return {
       // 遮罩层
       loading: true,
@@ -373,14 +204,15 @@ export default {
       // 中医档期业绩报表表格数据
       tcmScheduleReportList: [],
       scheduleList:[],
+      companyIdArr:[],
+      scheduleIdArr:[],
+      companys:[],
+      roundArr:["一轮","二轮","三轮","四轮","五轮","六轮","七轮","八轮","九轮"],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
       open: false,
       dateRange: [],
-      companyId:undefined,
-      companys:[],
-      roundArr:["一轮","二轮","三轮","四轮","五轮","六轮","七轮","八轮","九轮"],
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -399,7 +231,6 @@ export default {
         totalMoney: null,
       },
       users:[],
-      singleColumnArrs:[],
       // 部门树选项
       deptOptions: [],
       // 部门名称
@@ -412,81 +243,18 @@ export default {
       }
     };
   },
- 
   created() {
     getCompanyList().then(response => {
        this.companys = response.data;
+       if(this.companys!=null&&this.companys.length>0){
+          this.companyId=this.companys[0].companyId;
+          this.getTreeselect();
+        }
     });
     this.getListSchedule();
     this.getList();
   },
   methods: {
-     getTreeselect() {
-        var param={companyId:this.companyId}
-        treeselect(param).then((response) => {
-          this.deptOptions = response.data;
-        });
-    },
-    companyChange(val){
-      console.log(val);
-      this.companyId=val;
-      this.getTreeselect();
-    },
-    currDeptChange(val){
-          console.log(val)
-          this.queryParams.deptId=val;
-          this.getList();
-    },
-    getListSchedule() {
-        this.loading = true;
-        listSchedule().then(response => {
-            this.scheduleList = response.rows;
-        });
-    },
-    /** 查询中医档期业绩报表列表 */
-    getList() {
-      this.loading = true;
-      listTcmScheduleReport(this.addDateRange(this.queryParams,this.dateRange)).then(response => {
-          this.tcmScheduleReportList = response.rows;
-          this.total = response.total;
-          this.loading = false;
-          this.calcFilterData();
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出中医档期业绩报表数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return exportTcmScheduleReport(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-        }).catch(function() {});
-    },
     renderLabel(index){
         var colls=parseInt(index/4);
         var cell=parseInt(index%4);
@@ -533,7 +301,7 @@ export default {
             value=row["round"+colls+"Order"];
         }
         else if(cell==2){    //转化率 =成单数/总进线 
-            value=(row["round"+colls+"Order"]/row["totalNum"]*100.0).toFixed(2)+"%";
+            value=(row["round"+colls+"Order"]/row["totalNum"]*100.0).toFixed(3)+"%";
             //value=(row["round"+colls+"Rate"]*100).toFixed(2)+"%";
         }
         else if(cell==3){    //客单=成交金额/成交单数
@@ -556,8 +324,12 @@ export default {
         else if(index==2){   //完课率=完课数/注册数
              value=(row["finishNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
         }
-        else if(index==3){   //目标完成率=累计业绩/目标业绩
-             value=(row["totalMoney"]/row["targetMoney"]*100.0).toFixed(3)+"%";  
+        else if(index==3){   //目标完成率=累计业绩/目标业绩    
+             if(row.targetMoney>0){
+                value=(row.totalMoney/row.targetMoney*100.0).toFixed(3)+"%";  
+             }else{
+                value="0%";
+             }
         }
         else if(index==4){   //人均业绩=总业绩/当期部门人数
              value=(row["totalMoney"]/row["cuCount"]*1.0).toFixed(3);  
@@ -565,47 +337,205 @@ export default {
         else if(index==5){   //单线R值=累计业绩/总进线
              value=(row["targetMoney"]/row["totalNum"]*1.0).toFixed(3);  
         }
-
         return value;
     },
-    calcFilterData(){
-       var that=this;
-       that.singleColumnArrs=[];
-       let arr1 = this.tcmScheduleReportList.map(item => item["companyId"]);
-       let arrFilter=arr1.filter(function(id,index){
-          if(arr1.indexOf(id)==index){
-              that.singleColumnArrs.push(index);
-              return true;
-          }
-          return false
-       });
+    getListSchedule() {
+        this.loading = true;
+        listAllSchedule().then(response => {
+            this.scheduleList = response.rows;
+        });
     },
-    objectSpanMethod({row,column,rowIndex,columnIndex }) { 
-        //console.log("qxj singleColumnArrs:"+JSON.stringify(this.singleColumnArrs)+" rowIndex:"+rowIndex+" columnIndex:"+columnIndex);
-        if (columnIndex === 0) {
-          if (this.singleColumnArrs.indexOf(rowIndex)!=-1) {
-               if(this.singleColumnArrs.length<this.tcmScheduleReportList.length){
-                 return {
-                      rowspan: 2,
-                      colspan: 1
-                  };
-               }else{
-                    return {
-                      rowspan: 1,
-                      colspan: 1
-                  };
-               }
-
-          } 
-          else {
-            return {
-              rowspan: 0,
-              colspan: 0
-            };
+    /** 查询中医档期业绩报表列表 */
+    getList() {
+      this.queryParams.scheduleId="";
+      this.queryParams.companyId="";
+      if(this.scheduleIdArr.length>0){
+          this.queryParams.scheduleId=this.scheduleIdArr.toString();
+      }
+      if(this.companyIdArr.length>0){
+          this.queryParams.companyId=this.companyIdArr.toString();
+      }
+      this.loading = true;
+      listTcmScheduleReport(this.addDateRange(this.queryParams,this.dateRange)).then(response => {
+          this.tcmScheduleReportList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        scheduleId: null,
+        userId: null,
+        companyId: null,
+        totalNum: null,
+        registerNum: null,
+        onlineNum: null,
+        finishNum: null,
+        registerRate: null,
+        onlineRate: null,
+        finishRate: null,
+        totalMoney: null,
+        totalOrder: null,
+        targetMoney: null,
+        targetRate: null,
+        round1Money: null,
+        round1Order: null,
+        round1Rate: null,
+        round1Unit: null,
+        round2Money: null,
+        round2Order: null,
+        round2Rate: null,
+        round2Unit: null,
+        round3Money: null,
+        round3Order: null,
+        round3Rate: null,
+        round3Unit: null,
+        round4Money: null,
+        round4Order: null,
+        round4Rate: null,
+        round4Unit: null,
+        round5Money: null,
+        round5Order: null,
+        round5Rate: null,
+        round5Unit: null,
+        round6Money: null,
+        round6Order: null,
+        round6Rate: null,
+        round6Unit: null,
+        round7Money: null,
+        round7Order: null,
+        round7Rate: null,
+        round7Unit: null,
+        round8Money: null,
+        round8Order: null,
+        round8Rate: null,
+        round8Unit: null,
+        round9Money: null,
+        round9Order: null,
+        round9Rate: null,
+        round9Unit: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加中医档期业绩报表";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getTcmScheduleReport(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改中医档期业绩报表";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateTcmScheduleReport(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          } else {
+            addTcmScheduleReport(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              }
+            });
           }
         }
-     }
-   
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除中医档期业绩报表编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delTcmScheduleReport(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {});
+    },
+    handleDetails(row){
+        this.$router.push({path:'/schedule/report/add',query:{"scheduleId":row.scheduleId,"reportId":row.id}});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出公司档期报表数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportTcmScheduleReport(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    },
+    getTreeselect() {
+        var that=this;
+        var param={companyId:this.companyId}
+        treeselect(param).then((response) => {
+          this.deptOptions = response.data;
+        });
+    },
+    companyChange(val){
+      //this.companyId=val;
+      //console.log("qxj  companyChange:"+val);
+      var companyIdArr=this.companyIdArr;
+      if(companyIdArr.length>0){
+          this.companyId=companyIdArr[companyIdArr.length-1];
+         
+      }else{
+            delete this.queryParams.deptId;
+            this.companyId=this.companys[0].companyId;
+      }
+      this.getTreeselect();
+    },
+    currDeptChange(val){
+          console.log(val)
+          this.queryParams.deptId=val;
+          this.getList();
+    }
+  
   }
 };
 </script>

+ 699 - 0
src/views/company/schedule/statistics.vue

@@ -0,0 +1,699 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="公司名" prop="companyId">
+          <el-select multiple filterable  v-model="companyIdArr" placeholder="请选择公司名" clearable size="small">
+              <el-option
+                v-for="item in companys"
+                :key="item.companyId"
+                :label="item.companyName"
+                :value="item.companyId"
+              />
+        </el-select>
+      </el-form-item>  
+     <el-form-item > 
+          <treeselect style="width: 220px" :multiple="true"  :clearable="false"  @select="deptSelect" @deselect="deptCancelSelect"   :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
+     </el-form-item>
+
+
+      <!-- <el-form-item >
+          <treeselect style="width: 220px" :clearable="false"  v-model="queryParams.deptId"  :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
+      </el-form-item>
+       <el-form-item label="员工姓名" prop="userNickName">
+        <el-input
+          v-model="queryParams.userNickName"
+          placeholder="请输入员工姓名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item> -->
+
+      <el-form-item label="所属档期" prop="scheduleId">
+            <el-select multiple="" style="width:205.4px" v-model="scheduleIdArr" placeholder="请选择档期" clearable size="small" >
+                  <el-option
+                      v-for="item in scheduleList"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    />
+            </el-select>
+        </el-form-item>
+
+       <!-- <el-form-item label="档期名称" prop="scheduleName">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入档期名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item> -->
+
+    <!-- <el-form-item label="档期状态" prop="scheduleStatus">
+        <el-select v-model="queryParams.status" placeholder="请选择档期状态" clearable size="small">
+          <el-option
+            v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item> -->
+
+      <el-form-item label="创建时间" prop="createTime">
+            <el-date-picker
+              style="width:225.4px"
+              clearable size="small"
+              v-model="dateRange"
+              type="daterange"
+              value-format="yyyy-MM-dd"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期">
+            </el-date-picker>
+          </el-form-item>
+
+      <el-form-item>
+        <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>
+
+     <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+            type="warning"
+            icon="el-icon-download"
+            size="mini"
+            @click="handleExport"
+            v-hasPermi="['company:tcmScheduleReport:export']"
+        >导出</el-button>
+      </el-col>
+	     <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+     <!-- :span-method="objectSpanMethod"  -->
+    <el-table v-loading="loading" border :data="tcmScheduleReportList" @selection-change="handleSelectionChange">
+      <!-- <el-table-column label="id"  width="50" align="center" prop="id" /> -->
+      <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="100px" align="center" prop="deptName" /> -->
+       <!-- <el-table-column label="员工姓名" align="center" prop="userNickName" /> -->
+       <el-table-column fixed label="团队总人数" width="90px" align="center" prop="cuCount" />
+       <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" />
+      <el-table-column  label="注册率"    align="center" prop="registerRate"   >
+            <template slot-scope="scope">
+              {{ renderTotalVal(scope.row,0) }}
+            </template>
+     </el-table-column>
+     <el-table-column   label="上线率" align="center" prop="onlineRate"   >
+            <template slot-scope="scope">
+               {{ renderTotalVal(scope.row,1) }}
+            </template>
+    </el-table-column>
+     <el-table-column   label="完课率"  align="center" prop="finishRate"   >
+           <template slot-scope="scope">
+              {{ renderTotalVal(scope.row,2) }}
+           </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" >
+           <template slot-scope="scope">
+                {{ runderValue(scope.row,index-1) }}  
+           </template>     
+      </el-table-column>
+
+      <el-table-column   label="累计总业绩" width="90" align="center" prop="totalMoney"   >
+            <template slot-scope="scope">
+               {{!scope.row.totalMoney?0:(scope.row.totalMoney).toFixed(2)}}   
+            </template>
+      </el-table-column>
+      <el-table-column   label="累计总单" width="80" align="center" prop="totalOrder"   >
+            <template slot-scope="scope">
+              {{!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)}}
+            </template>
+      </el-table-column>
+      <el-table-column fixed="right"  label="目标完成率"  width="90" align="center" prop="targetRate"   >
+            <template slot-scope="scope">
+                {{ renderTotalVal(scope.row,3) }}
+            </template>
+      </el-table-column>
+
+      <el-table-column fixed="right"  label="单线R值"  width="90" align="center" prop="targetRate"   >
+           <template slot-scope="scope">
+               {{ renderTotalVal(scope.row,5) }}
+           </template>
+    </el-table-column>
+
+<!--     
+       <el-table-column  label="一轮业绩"  width="72"  align="center" prop="round1Money"   >  
+           <template slot-scope="scope">
+                {{!scope.row.round1Money?0:(scope.row.round1Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="一轮单数"  width="72" align="center" prop="round1Order" ></el-table-column> 
+      <el-table-column label="一轮转化率" width="85"  align="center" prop="round1Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round1Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="一轮客单"  width="72"  align="center" prop="round1Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round1Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+
+
+      <el-table-column  label="二轮业绩"  width="72"  align="center" prop="round2Money"   >
+           <template slot-scope="scope">
+                {{!scope.row.round2Money?0:(scope.row.round2Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="二轮单数"  width="72" align="center" prop="round2Order" ></el-table-column>
+      <el-table-column label="二轮转化率" width="85"  align="center" prop="round2Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round2Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="二轮客单"  width="72"  align="center" prop="round2Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round2Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+
+
+      <el-table-column  label="三轮业绩"  width="72"  align="center" prop="round3Money"   >
+           <template slot-scope="scope">
+                {{!scope.row.round3Money?0:(scope.row.round3Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="三轮单数"  width="72" align="center" prop="round3Order" ></el-table-column>
+      <el-table-column label="三轮转化率" width="85"  align="center" prop="round3Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round3Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="三轮客单"  width="72"  align="center" prop="round3Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round3Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+   
+      <el-table-column  label="四轮业绩"  width="72"  align="center" prop="round4Money"   >
+           <template slot-scope="scope">
+                {{!scope.row.round4Money?0:(scope.row.round4Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="四轮单数"  width="72" align="center" prop="round4Order" ></el-table-column>
+      <el-table-column label="四轮转化率" width="85"  align="center" prop="round4Rate">
+            <template slot-scope="scope1">
+                {{(scope1.row.round4Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="四轮客单"  width="72"  align="center" prop="round4Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round4Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+
+      <el-table-column  label="五轮业绩"  width="72"  align="center" prop="round5Money"   >
+           <template slot-scope="scope">
+                {{!scope.row.round5Money?0:(scope.row.round5Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="五轮单数"  width="72" align="center" prop="round5Order" ></el-table-column>
+      <el-table-column label="五轮转化率" width="85"  align="center" prop="round5Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round5Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="五轮客单"  width="72"  align="center" prop="round5Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round5Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+      
+      <el-table-column  label="六轮业绩"  width="72"  align="center" prop="round6Money"   >
+           <template slot-scope="scope">
+                {{!scope.row.round6Money?0:(scope.row.round6Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="六轮单数"  width="72" align="center" prop="round6Order" ></el-table-column>
+      <el-table-column label="六轮转化率" width="85"  align="center" prop="round6Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round6Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="六轮客单"  width="72"  align="center" prop="round6Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round6Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+
+      <el-table-column  label="七轮业绩"  width="72"  align="center" prop="round7Money"   >
+           <template slot-scope="scope">
+                {{!scope.row.round7Money?0:(scope.row.round7Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="七轮单数"  width="72" align="center" prop="round7Order" ></el-table-column>
+      <el-table-column label="七轮转化率" width="85"  align="center" prop="round7Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round7Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="七轮客单"  width="72"  align="center" prop="round7Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round7Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+
+      <el-table-column  label="八轮业绩"  width="72"  align="center" prop="round8Money"   >
+           <template slot-scope="scope">
+                {{!scope.row.round8Money?0:(scope.row.round8Money).toFixed(2)}}
+           </template>
+      </el-table-column>
+      <el-table-column label="八轮单数"  width="72" align="center" prop="round8Order" ></el-table-column>
+      <el-table-column label="八轮转化率" width="85"  align="center" prop="round8Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round8Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="八轮客单"  width="72"  align="center" prop="round8Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round8Unit).toFixed(2)}}
+             </template>
+      </el-table-column>
+
+      <el-table-column  label="九轮业绩"  width="72"  align="center" prop="round9Money"   >
+            <template slot-scope="scope">
+                    {{!scope.row.round9Money?0:(scope.row.round9Money).toFixed(2)}}
+            </template>
+      </el-table-column>
+      <el-table-column label="九轮单数"  width="72" align="center" prop="round9Order" ></el-table-column>
+      <el-table-column label="九轮转化率" width="85"  align="center" prop="round9Rate">
+            <template slot-scope="scope">
+                {{(scope.row.round9Rate*100).toFixed(2)+"%"}}
+            </template>
+      </el-table-column>
+      <el-table-column label="九轮客单"  width="72"  align="center" prop="round9Unit">
+             <template slot-scope="scope">
+                {{(scope.row.round9Unit).toFixed(2)}}
+             </template>
+      </el-table-column> -->
+
+        <el-table-column  fixed="right" label="操作" width="80px" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+               <el-button size="mini" type="text" @click="handleLook(scope.row)">查看</el-button>
+            </template>
+        </el-table-column>
+
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <el-dialog :title="companyScheduleList.title" :visible.sync="companyScheduleList.open" width="1400px" append-to-body>
+      <company-schedule  ref="companyScheduleList" @close="closeCompanyScheduleList"></company-schedule >
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import { treeselect } from "@/api/company/companyDept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { listTcmStatisticsReport, exportStatisticsScheduleReport,listAllSchedule } from "@/api/company/scheduleReport";
+import { getCompanyList } from "@/api/company/company";
+import companySchedule from '../components/companySchedule.vue';
+export default {
+   watch: {
+     // 监听companyIdArr
+    'companyIdArr':'companyChange'
+  },
+  name: "TcmScheduleReport",
+  components: { Treeselect,companySchedule },
+  data() {
+    return {
+      companyScheduleList:{
+        title:"团队档期报表",
+        open:false,
+      },
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 中医档期业绩报表表格数据
+      tcmScheduleReportList: [],
+      scheduleList:[],
+      companyIdArr:[],
+      scheduleIdArr:[],
+      deptIds:[],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      dateRange: [],
+      companyId:undefined,
+      companys:[],
+      roundArr:["一轮","二轮","三轮","四轮","五轮","六轮","七轮","八轮","九轮"],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        scheduleId: null,
+        deptId:null,
+        deptIdStr:"",
+        userId: null,
+        companyId: null,
+        totalNum: null,
+        registerNum: null,
+        onlineNum: null,
+        finishNum: null,
+        registerRate: null,
+        onlineRate: null,
+        finishRate: null,
+        totalMoney: null,
+      },
+      users:[],
+      singleColumnArrs:[],
+      // 部门树选项
+      deptOptions: [],
+      // 部门名称
+      deptName: undefined,
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: { 
+         
+      }
+    };
+  },
+  created() {
+    getCompanyList().then(response => {
+       this.companys = response.data;
+       if(this.companys!=null&&this.companys.length>0){
+          this.companyId=this.companys[0].companyId;
+          this.getTreeselect();
+        }
+    });
+    this.getListSchedule();
+    this.getList();
+  },
+  methods: {
+     getTreeselect() {
+        var param={companyId:this.companyId}
+        treeselect(param).then((response) => {
+          this.deptOptions = response.data;
+        });
+    },
+    companyChange(val){
+      var companyIdArr=this.companyIdArr;
+      if(companyIdArr.length>0){
+          this.companyId=companyIdArr[companyIdArr.length-1];
+      }else{
+          delete this.queryParams.deptId;
+          this.companyId=this.companys[0].companyId;
+      }
+      this.getTreeselect();
+    },  
+    deptSelect(node,instanceId){
+          console.log(node, instanceId, 'deptSelect');
+          this.deptIds.push(node.id);
+          if(node.children){
+               node.children.forEach(item => {
+                   console.log("qxj item:"+JSON.stringify(item));
+                   this.deptIds.push(item.id);
+               });
+          }
+          this.queryParams.deptIdStr=this.deptIds.toString();
+          //console.log('deptIdStr:'+this.queryParams.deptIdStr);
+          this.getList();
+    },
+    deptCancelSelect(node,instanceId){
+        console.log(node, instanceId, 'delete');
+        for (let i = 0;i<this.deptIds.length;i++){
+                if(node.id == this.deptIds[i]){
+                    this.deptIds.splice(i,1);
+                }
+                if(node.children){
+                    node.children.forEach(item => {
+                          if(item.id == this.deptIds[i]){
+                              var index=this.deptIds.indexOf(item.id);
+                              this.deptIds.splice(index,1);
+                          }
+                     });
+                }
+        }
+        this.queryParams.deptIdStr=this.deptIds.toString();
+        console.log('deptIdStr:'+this.queryParams.deptIdStr);
+        this.getList();
+    },
+    getListSchedule() {
+        this.loading = true;
+        listAllSchedule().then(response => {
+            this.scheduleList = response.rows;
+        });
+    },
+    /** 查询中医档期业绩报表列表 */
+    getList() {
+      this.queryParams.scheduleId="";
+      this.queryParams.companyId="";
+      if(this.scheduleIdArr.length>0){
+          this.queryParams.scheduleId=this.scheduleIdArr.toString();
+      }
+      if(this.companyIdArr.length>0){
+          this.queryParams.companyId=this.companyIdArr.toString();
+      }
+      this.loading = true;
+      if(!!this.queryParams.deptIdStr){
+           console.log("qxj params deptIdStr:"+this.queryParams.deptIdStr);
+      }
+      listTcmStatisticsReport(this.addDateRange(this.queryParams,this.dateRange)).then(response => {
+          this.tcmScheduleReportList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+          this.calcFilterData();
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    handleLook(row){
+      this.companyScheduleList.open=true;
+      var that=this;
+      setTimeout(() => {
+            that.$refs.companyScheduleList.getData(row);
+      }, 200);
+    },
+    closeCompanyScheduleList(){
+       this.companyScheduleList.open=false;
+       this.getList();
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出中医报表统计数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportStatisticsScheduleReport(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    },
+    renderLabel(index){
+        var colls=parseInt(index/4);
+        var cell=parseInt(index%4);
+        var str=this.roundArr[colls];
+        if(cell==0){
+            str+="业绩"
+        }
+        else if(cell==1){
+            str+="单数"
+        }
+        else if(cell==2){
+             str+="转化率"
+        }
+        else if(cell==3){
+             str+="客单"
+        }
+        return str;
+    },
+    renderLabelProp(index){  
+        var colls=parseInt(index/4)+1;
+        var str=this.roundArr[colls];
+        if(colls==1){
+             str="round"+colls+"Money";
+        }
+        else if(colls==2){
+             str="round"+colls+"Order";
+        }
+        else if(colls==3){
+             str="round"+colls+"Rate";
+        }
+        else if(colls==4){
+             str="round"+colls+"Unit";
+        }
+        return str;
+    },
+    runderValue(row,index){    //注册率=注册数/总进线  上线率=上线数/注册数  完课率=完课数/注册数   目标完成率=累计业绩/目标业绩  单线R值=累计业绩/总进线
+        var colls=parseInt(index/4)+1;
+        var cell=parseInt(index%4);
+        var value=0;
+        if(cell==0){   //业绩   
+            value=!row["round"+colls+"Money"]?0:(row["round"+colls+"Money"]).toFixed(2);
+        }
+        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)+"%";
+        }
+        else if(cell==3){    //客单=成交金额/成交单数
+            var roundMoney=row["round"+colls+"Money"];
+            var roundOrder=row["round"+colls+"Order"];
+            if(!!roundMoney && !!roundOrder){
+                value=(roundMoney/roundOrder*1.0).toFixed(2);
+            }
+        }
+        return value;
+    },
+    renderTotalVal(row,index){
+       var value=0;
+        if(index==0){   //注册率=注册数/总进线
+             value=(row["registerNum"]/row["totalNum"]*100.0).toFixed(3)+"%";
+        }
+        else if(index==1){   //上线率=上线数/注册数
+             value=(row["onlineNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        }
+        else if(index==2){   //完课率=完课数/注册数
+             value=(row["finishNum"]/row["registerNum"]*100.0).toFixed(3)+"%";
+        }
+        else if(index==3){   //目标完成率=累计业绩/目标业绩
+            if(row.targetMoney>0){
+                value=(row.totalMoney/row.targetMoney*100.0).toFixed(3)+"%";  
+            }else{
+                value="0%";
+            } 
+        }
+        else if(index==4){   //人均业绩=总业绩/当期部门人数
+             value=(row["totalMoney"]/row["cuCount"]*1.0).toFixed(3);  
+        }
+        else if(index==5){   //单线R值=累计业绩/总进线
+             value=(row["targetMoney"]/row["totalNum"]*1.0).toFixed(3);  
+        }
+        return value;
+    },
+
+    calcFilterData(){
+       var that=this;
+       that.singleColumnArrs=[];
+       let arr1 = this.tcmScheduleReportList.map(item => item["companyId"]);
+       let arrFilter=arr1.filter(function(id,index){
+          if(arr1.indexOf(id)==index){
+              that.singleColumnArrs.push(index);
+              return true;
+          }
+          return false
+       });
+    },
+    objectSpanMethod({row,column,rowIndex,columnIndex }) { 
+        //console.log("qxj singleColumnArrs:"+JSON.stringify(this.singleColumnArrs)+" rowIndex:"+rowIndex+" columnIndex:"+columnIndex);
+        if (columnIndex === 0) {
+          if (this.singleColumnArrs.indexOf(rowIndex)!=-1) {
+               if(this.singleColumnArrs.length<this.tcmScheduleReportList.length){
+                 return {
+                      rowspan: 2,
+                      colspan: 1
+                  };
+               }else{
+                    return {
+                      rowspan: 1,
+                      colspan: 1
+                  };
+               }
+
+          } 
+          else {
+            return {
+              rowspan: 0,
+              colspan: 0
+            };
+          }
+        }
+    }
+   
+  }
+};
+</script>

+ 4 - 6
src/views/crm/components/feiyuCrmLineList.vue

@@ -1,5 +1,6 @@
 <template>
     <div class="app-container">
+        
       <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
         <el-form-item label="线索创建时间" prop="createTime">
             <el-date-picker ref="dtPicker" clearable size="small" style="width: 250px"
@@ -86,6 +87,7 @@
       </el-table-column> -->
 
       </el-table>
+
       <pagination
         v-show="total>0"
         :total="total"
@@ -93,12 +95,8 @@
         :limit.sync="queryParams.pageSize"
         @pagination="getList"
       />
-      <!-- <el-dialog :title="customer.title" :visible.sync="customer.open" width="1000px" append-to-body>
-          <el-table border  :data="customers" >
-              <el-table-column label="客户名称" align="center" prop="customerName" />
-              <el-table-column label="客户手机号" align="center" prop="mobile" />
-          </el-table>
-      </el-dialog> -->
+  
+
     </div>
   </template>
 

+ 1 - 5
src/views/store/components/productOrder.vue

@@ -12,7 +12,7 @@
       <el-card shadow="never" style="margin-top: 15px">
       <div class="operate-container"  v-if="order!=null">
         <span style="margin-left: 20px" class="color-danger">订单状态:
-           <el-tag prop="status" v-for="(item, index) in statusOptions"    v-if="order.status==item.dictValue">{{item.dictLabel}}</el-tag>
+           <el-tag prop="status" v-for="(item, index) in statusOptions"   v-if="order.status==item.dictValue">{{item.dictLabel}}</el-tag>
         </span>
         <div class="operate-button-container" >
           <el-button size="mini" @click="editOrder()"  v-hasPermi="['store:storeOrder:edit']" >修改订单</el-button>
@@ -397,7 +397,6 @@
         <el-button size="mini" @click="updateExpress()" >同步物流发货</el-button>
       </div>
       <div class="table-layout"  v-if="erpOrder!=null">
-
         <el-row>
           <el-col :span="6" class="table-cell-title">订单编号</el-col>
           <el-col :span="6" class="table-cell-title">是否代收</el-col>
@@ -407,7 +406,6 @@
         <el-row>
           <el-col :span="6" class="table-cell">
             {{erpOrder.code}}
-
           </el-col>
           <el-col :span="6" class="table-cell">
             {{erpOrder.cod?'是':'否'}}
@@ -418,7 +416,6 @@
           <el-col :span="6" class="table-cell">
             {{erpOrder.express_name}}
           </el-col>
-
         </el-row>
         <el-row>
           <el-col :span="6" class="table-cell-title">收货人</el-col>
@@ -429,7 +426,6 @@
         <el-row>
           <el-col :span="6" class="table-cell">
             {{erpOrder.receiver_name}}
-
           </el-col>
           <el-col :span="6" class="table-cell">
             {{erpOrder.receiver_mobile}}

+ 1 - 3
src/views/store/storePayment/index.vue

@@ -22,7 +22,6 @@
 
       <el-form-item label="订单号" prop="orderCode">
         <el-input
-          
           v-model="queryParams.orderCode"
           placeholder="请输入订单号"
           clearable
@@ -33,7 +32,6 @@
 
       <el-form-item label="外部订单" prop="tradeNo">
         <el-input
-          
           v-model="queryParams.tradeNo"
           placeholder="请输入外部订单号"
           clearable
@@ -85,7 +83,7 @@
 
       <el-form-item label="提交时间" prop="createTimeRange">
         <el-date-picker
-          style="width:205.4px"
+          style="width: 215.4px"
           clearable size="small"
           v-model="createTimeRange"
           type="daterange"

+ 3 - 3
src/views/store/storeProduct/index.vue

@@ -101,6 +101,7 @@
       <el-tab-pane label="出售中" name="1"></el-tab-pane>
       <el-tab-pane label="待上架" name="0"></el-tab-pane>
     </el-tabs>
+
     <el-table  height="500" border v-loading="loading" :data="storeProductList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="ID" align="center" prop="productId" />
@@ -109,8 +110,7 @@
           <el-popover
             placement="right"
             title=""
-            trigger="hover"
-          >
+            trigger="hover">
             <img slot="reference" :src="scope.row.image" width="100">
             <img :src="scope.row.image" style="max-width: 150px;">
           </el-popover>
@@ -168,7 +168,6 @@
       @pagination="getList"
     />
 
-
     <!-- 添加或修改商品对话框 -->
     <el-dialog :title="title" v-if="open" :visible.sync="open" width="1000px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
@@ -495,6 +494,7 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
   </div>
 </template>