Преглед изворни кода

Merge branch 'dev' of http://www.baoxianzhanggui.com:8090/sxzgd/vue-insagent-pc into dev

@dongkboy пре 2 година
родитељ
комит
72478749ee

+ 5 - 0
src/http/api.js

@@ -46,6 +46,9 @@ import * as cost from './moudules/cost.js'
 //费用管理
 import * as expense from './moudules/expense.js'
 
+//报表管理
+import * as report from './moudules/report.js'
+
 // 默认全部导出
 export default {
     login,
@@ -82,4 +85,6 @@ export default {
     cost, //费用核对
      ///////////费用管理///////////////////////
     expense,
+    //报表管理
+    report,
 }

+ 53 - 0
src/http/moudules/report.js

@@ -0,0 +1,53 @@
+import axios from '../axios'
+
+
+// 报表查询机构树
+export const findDeptTree = () => {
+  return axios({
+    url: '/dept/findCompanyTree',
+    method: 'get',
+  })
+}
+
+
+//报表-查询所属团队
+export const findTeamList = (data) => {
+  return axios({
+    url: "/dept/findTeamList?deptId="+data,
+    method: "get"
+  })
+}
+
+//报表-查询所属业务员
+export const findUserList = (data) => {
+  return axios({
+    url: "/user/findUserList?deptId="+data,
+    method: "get"
+  })
+}
+
+
+//报表-出单量及费用统计-查询
+export const queryOrderAndCostData = (data) => {
+  return axios({
+    url: "/report/queryOrderAndCostData",
+    method: "post",
+    data
+  })
+}
+//报表-出单量及费用统计-导出
+export const exportOrderAndCostData = (data) => {
+  return axios({
+    url: "/report/exportOrderAndCostData",
+    method: "post",
+    data
+  })
+}
+//报表-出单量及费用统计-清单导出
+export const exportOrderAndCostListData = (data) => {
+  return axios({
+    url: "/report/exportOrderAndCostListData",
+    method: "post",
+    data
+  })
+}

+ 357 - 0
src/views/Report/StatisticalReport/OrderVolumeAndCostStatistics.vue

@@ -0,0 +1,357 @@
+<template>
+  <div class="page-container">
+    <div class="queryForm"  style="padding-top:10px;padding-left:15px;">
+      <el-form size="mini" ref="queryForm" :model="queryForm" label-width="120px">
+        <el-row>
+          <el-col :span="6" style="height: 40px;">
+            <el-form-item label="所属机构">
+              <el-cascader class="widths" :options="institutionOptions" v-model="queryForm.deptId" :props="{
+              checkStrictly: true, value: 'id',
+              label: 'name',
+            }" @change="handleChange" clearable></el-cascader>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6" style="height: 40px;">
+            <el-form-item label="所属团队">
+              <el-select v-model="queryForm.teamCode" @focus="queryTeamCode" @clear="cleanTeamCode" filterable  class="widths" clearable>
+                <el-option v-for="val in teamCodeOptions" :key='val.id' :label="val.name" :value="val.id" ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6" style="height: 40px;">
+            <el-form-item label="业务员">
+              <el-select v-model="queryForm.userId" @focus="queryUserCode"  filterable  class="widths" clearable>
+                <el-option v-for="val in userCodeOptions" :key='val.id' :label="val.name" :value="val.id" ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6" style="height: 40px;">
+            <el-form-item label="保险公司">
+              <el-select v-model="queryForm.insCompany"  filterable  class="widths" clearable>
+                <el-option v-for="val in insureComList" :key='val.id' :label="val.name" :value="val.id" ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6" style="height: 40px;">
+            <el-form-item label="产品">
+              <el-select v-model="queryForm.riskCode" placeholder="请选择" style="width: 100%;" clearable>
+                <el-option label="全部" value="ALL"></el-option>
+                <el-option label="交强" value="BZ"></el-option>
+                <el-option label="商业" value="BUS"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12" style="height: 40px;">
+            <el-form-item label="签单日期">
+              <el-date-picker v-model="quoteDate" style="width:100%" @change="changeQuoteDate" type="daterange" align="left" value-format="yyyy-MM-dd"
+                              range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24" class="u-f u-f-je" style="height: 40px;">
+              <el-button type="primary" style="margin-right: 40px;" @click="queryData">查询</el-button>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+
+    <!-- 数据列表显示区域 -->
+    <el-table size="mini" border stripe :data="dataList" :height="clientHeight" v-loading="loading" :stripe="true"
+              :header-cell-style="{background:'#F2F7FC',fontWeight: '700',color:'#606266',textAlign: 'center'}"
+              :cell-style="{textAlign: 'center'}" style="width: 100%;margin-bottom: 60px;">
+      <el-table-column  fixed  label="机构名称" width="180">
+        <template slot-scope="scope">
+            <i class="el-icon-paperclip"></i>
+            <span style="margin-left: 10px" @click="drillingData(scope.row,'jg')">{{ scope.row.institution }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column   fixed label="团队名称" width="180">
+        <template slot-scope="scope">
+          <i class="el-icon-paperclip" v-if="scope.row.deptname"></i>
+          <span style="margin-left: 10px" @click="drillingData(scope.row,'td')">{{ scope.row.deptname }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="username" fixed  label="业务员名称" width="180"></el-table-column>
+      <el-table-column prop="riskName"  label="产品" width="100"></el-table-column>
+      <el-table-column prop="policyCount"  label="保单数量" width="100"></el-table-column>
+      <el-table-column prop="sumpremium"  label="总保费" width="100"></el-table-column>
+      <el-table-column prop="superviseCostsPremiums"  label="总手续费" width="100"></el-table-column>
+      <el-table-column prop="otherCostsPremiums"  label="总跟单费" width="100"></el-table-column>
+      <el-table-column prop="sumCostsPremiums"  label="费用合计" width="100"></el-table-column>
+      <el-table-column   fixed="right" label="操作" width="180">
+        <template slot-scope="scope">
+           <el-button type="primary" size="small" @click="exportListExcel(scope.row)">本行清单导出</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 底部分页 -->
+    <div class="bottomFixed">
+      <el-row>
+        <el-col :span="2">
+          <el-button type="primary" style="margin-right: 40px;" @click="exportExcel">全部导出</el-button>
+        </el-col>
+        <el-col :span="22">
+          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
+                         :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalSum">
+          </el-pagination>
+        </el-col>
+
+      </el-row>
+
+    </div>
+
+  </div>
+</template>
+
+<script>
+  export default {
+    data() {
+      return {
+        loading: false,
+        insureComList:[], //保险公司列表
+        institutionOptions: [],//所属机构列表
+        teamCodeOptions:[],//所属团队列表
+        userCodeOptions:[],//所属业务员列表
+        clientHeight:0,//表格高度
+        currentPage: 1, //当前页面
+        pageSize: 10, //每页显示条数
+        totalSum: 0, //全部的数据条数
+        quoteDate:"",//报价日期
+        //查询的表单
+        queryForm: {
+          deptId: "",
+          teamCode:"",
+          insCompany:"",
+          userId: "",
+          riskCode:"ALL",
+          quoteStartDate: "",
+          quoteEndDate: "",
+          pageNum: 1,
+          pageSize: 10,
+          isDrilling:"0",//是否下钻查询
+        },
+        dataList: [],//查询结果数据
+      };
+    },
+    created(){
+      // 设置表格的高度
+      this.clientHeight = (document.documentElement.clientHeight - 350)+'px';
+      //获取机构树
+      this.$api.report.findDeptTree().then((res) => {
+        this.institutionOptions = res.data;
+      });
+      //获取保险公司
+      this.$api.letter.gainTopList().then(res=>{
+        this.insureComList=res.data
+      })
+    },
+    mounted() {
+      const that = this;
+      // 设置表格的高度
+      window.onresize = function temp() {
+        that.clientHeight = (document.documentElement.clientHeight - 350)+'px';
+      };
+    },
+    methods: {
+      // 按照查询条件查询
+      drillingData(obj,type) {
+        this.queryForm.pageNum = 1;
+        this.queryForm.pageSize = 10;
+        this.queryForm.isDrilling="1";
+        this.queryForm.userId="";
+        this.queryForm.teamCode="";
+        this.queryForm.deptId="";
+        if(type=='jg'){
+          this.queryForm.deptId=obj.institutionId;
+        }else if(type='td'){
+          this.queryForm.deptId=obj.institutionId;
+          this.queryForm.teamCode=obj.deptId;
+        }
+        this.findPage();
+      },
+      cleanTeamCode(){
+        //级联清空 业务员
+        this.queryForm.userId='';
+      },
+      queryUserCode(e){
+        if((this.queryForm.teamCode ==null || this.queryForm.teamCode=='') ){
+          this.userCodeOptions=[];
+          this.$message.error('请先选择所属团队!')
+          return
+        }
+        this.$api.report.findUserList(this.queryForm.teamCode).then((res) => {
+          if (res.code == "200") {
+            this.userCodeOptions = res.data;
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+      },
+      queryTeamCode(e){
+        if((this.queryForm.deptId ==null || this.queryForm.deptId=='') ){
+          this.teamCodeOptions=[];
+          this.$message.error('请先选择所属机构!')
+          return
+        }
+        this.$api.report.findTeamList(this.queryForm.deptId).then((res) => {
+          if (res.code == "200") {
+            this.teamCodeOptions = res.data;
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+
+      },
+      //联级选择器触发事件
+      handleChange(val) {
+        if (val.length !== 0) {
+          this.queryForm.deptId = val.at(-1);
+        }
+        else {
+          this.queryForm.deptId = ''
+          //级联清空 团队  业务员
+          this.queryForm.teamCode='';
+          this.queryForm.userId='';
+        }
+      },
+    //报价日期处理
+    changeQuoteDate(e) {
+      if (e === null) {
+        this.queryForm.quoteStartDate = e;
+        this.queryForm.quoteEndDate = e;
+      } else {
+        this.queryForm.quoteStartDate = e[0];
+        this.queryForm.quoteEndDate = e[1];
+      }
+    },
+      // 按照查询条件查询
+      queryData() {
+        if((this.queryForm.deptId ==null || this.queryForm.deptId=='') ){
+          this.$message.error('所属机构必须录入!')
+          return
+        }
+        if((this.quoteDate ==null || this.quoteDate=='') ){
+          this.$message.error('签单日期必须录入!')
+          return
+        }
+        this.queryForm.pageNum = 1;
+        this.queryForm.pageSize = 10;
+        this.queryForm.isDrilling="0";
+        this.findPage();
+      },
+      //数据
+      findPage() {
+        this.loading = true;
+        this.$api.report.queryOrderAndCostData(this.queryForm).then((res) => {
+          if (res.code == "200") {
+            this.loading = false;
+            this.dataList = res.data.content;
+            this.currentPage = res.data.pageNum;
+            this.totalSum = res.data.totalSize;
+          } else {
+            this.$message.error(res.msg)
+            this.loading = false;
+          }
+        })
+      },
+      // 每页条数发生改变
+      handleSizeChange(val) {
+        this.pageSize = val;
+        this.currentPage = 1;
+        this.queryForm.pageNum = 1;
+        this.queryForm.pageSize = val;
+        this.findPage();
+      },
+      // 当前页发生改变
+      handleCurrentChange(val) {
+        this.currentPage = val;
+        this.queryForm.pageNum = val;
+        this.findPage();
+      },
+
+      //全部导出
+      exportExcel(){
+        if((this.queryForm.deptId ==null || this.queryForm.deptId=='') ){
+          this.$message.error('所属机构必须录入!')
+          return
+        }
+        if((this.quoteDate ==null || this.quoteDate=='')  ){
+          this.$message.error('签单日期必须录入!')
+          return
+        }
+        this.$api.report.exportOrderAndCostData(this.queryForm).then(res=>{
+          let url = process.env.BASE_URL+'/upload/'+res.data // 3.创建一个临时的url指向blob对象
+          // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
+          let a = document.createElement("a");
+          a.href = url;
+          a.download = "出单量及费用统计报表.xlsx";
+          a.click();
+          // 5.释放这个临时的对象url
+          window.URL.revokeObjectURL(url);
+        })
+      },
+
+      //清单导出
+      exportListExcel(obj){
+        let  queryListForm={}
+        queryListForm.quoteStartDate=this.queryForm.quoteStartDate;
+        queryListForm.quoteEndDate=this.queryForm.quoteEndDate;
+        queryListForm.insCompany=this.queryForm.insCompany;
+        queryListForm.riskCode=obj.riskName=='交强险'?"BZ":"BUS";
+        queryListForm.deptId=obj.institutionId;
+        queryListForm.teamCode=obj.deptId;
+        queryListForm.userId=obj.userId;
+        this.$api.report.exportOrderAndCostListData(queryListForm).then(res=>{
+          let url = process.env.BASE_URL+'/upload/'+res.data // 3.创建一个临时的url指向blob对象
+          // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
+          let a = document.createElement("a");
+          a.href = url;
+          a.download = "出单量及费用统计报表-清单.xlsx";
+          a.click();
+          // 5.释放这个临时的对象url
+          window.URL.revokeObjectURL(url);
+        })
+      }
+    }
+  }
+</script>
+
+<style scoped>
+  /* 底部固定分页 */
+  .bottomFixed {
+    height: 50px;
+    position: fixed;
+    bottom: 0;
+    width: 100%;
+    background: #fff;
+  }
+
+  /* 顶部查询条件样式Start */
+  .queryFrom .el-row {
+    margin: 10px 0px;
+  }
+
+  .queryFrom .el-form-item {
+    margin-bottom: 0px;
+  }
+
+  .queryFrom .queryButton .el-form-item__content {
+    margin-left: 40px !important;
+  }
+
+  /* 顶部查询条件样式End */
+
+  .el-form-item{
+    margin-bottom: 0px!important;
+  }
+  .el-dialog__body{
+    padding: 10px 20px!important;
+  }
+
+  /deep/ .el-select{
+    width: 100%;
+  }
+
+  /deep/ .el-cascader--mini{
+    width: 100%;
+  }
+</style>

+ 2 - 2
src/views/Sys/Exportpolicydata.vue

@@ -201,7 +201,7 @@
       // 按照查询条件查询
       queryData() {
         if((this.quoteDate ==null || this.quoteDate=='') && (this.policyDate == null || this.policyDate == '')){
-          this.$message.error('报价时间和起保时间至少录入一项!')
+          this.$message.error('签单日期和起保日期至少录入一项!')
           return
         }
         this.queryForm.pageNum = 1;
@@ -241,7 +241,7 @@
       //全部导出
       exportExcel(){
         if((this.quoteDate ==null || this.quoteDate=='') && (this.policyDate == null || this.policyDate == '')){
-          this.$message.error('报价时间和起保时间至少录入一项!')
+          this.$message.error('签单日期和起保日期至少录入一项!')
           return
         }
         this.$api.letter.exportPolicyData(this.queryForm).then(res=>{