OrderVolumeAndCostStatistics.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <div class="page-container">
  3. <div class="queryForm" style="padding-top:10px;padding-left:15px;">
  4. <el-form size="mini" ref="queryForm" :model="queryForm" label-width="120px">
  5. <el-row>
  6. <el-col :span="6" style="height: 40px;">
  7. <el-form-item label="所属机构">
  8. <el-cascader class="widths" :options="institutionOptions" v-model="queryForm.deptId" :props="{
  9. checkStrictly: true, value: 'id',
  10. label: 'name',
  11. }" @change="handleChange" clearable></el-cascader>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="6" style="height: 40px;">
  15. <el-form-item label="所属团队">
  16. <el-select v-model="queryForm.teamCode" @focus="queryTeamCode" @clear="cleanTeamCode" filterable class="widths" clearable>
  17. <el-option v-for="val in teamCodeOptions" :key='val.id' :label="val.name" :value="val.id" ></el-option>
  18. </el-select>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="6" style="height: 40px;">
  22. <el-form-item label="业务员">
  23. <el-select v-model="queryForm.userId" @focus="queryUserCode" filterable class="widths" clearable>
  24. <el-option v-for="val in userCodeOptions" :key='val.id' :label="val.name" :value="val.id" ></el-option>
  25. </el-select>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="6" style="height: 40px;">
  29. <el-form-item label="保险公司">
  30. <el-select v-model="queryForm.insCompany" filterable class="widths" clearable>
  31. <el-option v-for="val in insureComList" :key='val.id' :label="val.name" :value="val.id" ></el-option>
  32. </el-select>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="6" style="height: 40px;">
  36. <el-form-item label="产品">
  37. <el-select v-model="queryForm.riskCode" placeholder="请选择" style="width: 100%;" clearable>
  38. <el-option label="全部" value="ALL"></el-option>
  39. <el-option label="交强" value="BZ"></el-option>
  40. <el-option label="商业" value="BUS"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="12" style="height: 40px;">
  45. <el-form-item label="签单日期">
  46. <el-date-picker v-model="quoteDate" style="width:100%" @change="changeQuoteDate" type="daterange" align="left" value-format="yyyy-MM-dd"
  47. range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. <el-row>
  52. <el-col :span="2" class="u-f u-f-je" style="height: 40px;">
  53. <el-button type="primary" icon="el-icon-arrow-left" size="mini" @click="returnUpper">返回上层</el-button>
  54. </el-col>
  55. <el-col :span="22" class="u-f u-f-je" style="height: 40px;">
  56. <el-button type="primary" style="margin-right: 40px;" @click="queryData">查询</el-button>
  57. </el-col>
  58. </el-row>
  59. </el-form>
  60. </div>
  61. <!-- 数据列表显示区域 -->
  62. <el-table size="mini" border stripe :data="dataList" :height="clientHeight" v-loading="loading" :stripe="true"
  63. :header-cell-style="{background:'#F2F7FC',fontWeight: '700',color:'#606266',textAlign: 'center'}"
  64. :cell-style="{textAlign: 'center'}" style="width: 100%;margin-bottom: 60px;">
  65. <el-table-column fixed label="机构名称" width="180">
  66. <template slot-scope="scope">
  67. <i class="el-icon-paperclip"></i>
  68. <span style="margin-left: 10px" @click="drillingData(scope.row,'jg')">{{ scope.row.institution }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column fixed label="团队名称" width="180">
  72. <template slot-scope="scope">
  73. <i class="el-icon-paperclip" v-if="scope.row.deptname"></i>
  74. <span style="margin-left: 10px" @click="drillingData(scope.row,'td')">{{ scope.row.deptname }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="username" fixed label="业务员名称" width="180"></el-table-column>
  78. <el-table-column prop="riskName" label="产品" width="100"></el-table-column>
  79. <el-table-column prop="policyCount" label="保单数量" width="100"></el-table-column>
  80. <el-table-column prop="sumpremium" label="总保费" width="100"></el-table-column>
  81. <el-table-column prop="superviseCostsPremiums" label="总手续费" width="100"></el-table-column>
  82. <el-table-column prop="otherCostsPremiums" label="总跟单费" width="100"></el-table-column>
  83. <el-table-column prop="sumCostsPremiums" label="费用合计" width="100"></el-table-column>
  84. <el-table-column fixed="right" label="操作" width="180">
  85. <template slot-scope="scope">
  86. <el-button type="primary" size="small" @click="exportListExcel(scope.row)">本行清单导出</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <!-- 底部分页 -->
  91. <div class="bottomFixed">
  92. <el-row>
  93. <el-col :span="2">
  94. <el-button type="primary" style="margin-right: 40px;" @click="exportExcel">全部导出</el-button>
  95. </el-col>
  96. <el-col :span="22">
  97. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  98. :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalSum">
  99. </el-pagination>
  100. </el-col>
  101. </el-row>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. loading: false,
  110. insureComList:[], //保险公司列表
  111. institutionOptions: [],//所属机构列表
  112. teamCodeOptions:[],//所属团队列表
  113. userCodeOptions:[],//所属业务员列表
  114. clientHeight:0,//表格高度
  115. currentPage: 1, //当前页面
  116. pageSize: 10, //每页显示条数
  117. totalSum: 0, //全部的数据条数
  118. quoteDate:"",//报价日期
  119. //查询的表单
  120. queryForm: {
  121. deptId: "",
  122. teamCode:"",
  123. insCompany:"",
  124. userId: "",
  125. riskCode:"ALL",
  126. quoteStartDate: "",
  127. quoteEndDate: "",
  128. pageNum: 1,
  129. pageSize: 10,
  130. isDrilling:"0",//是否下钻查询
  131. isReturnBack:"0"//是否返回上层
  132. },
  133. dataList: [],//查询结果数据
  134. //返回上层查询对象
  135. returnForm:{
  136. deptId: "",
  137. teamCode:"",
  138. }
  139. };
  140. },
  141. created(){
  142. // 设置表格的高度
  143. this.clientHeight = (document.documentElement.clientHeight - 350)+'px';
  144. //获取机构树
  145. this.$api.report.findDeptTree().then((res) => {
  146. this.institutionOptions = res.data;
  147. });
  148. //获取保险公司
  149. this.$api.letter.gainTopList().then(res=>{
  150. this.insureComList=res.data
  151. })
  152. },
  153. mounted() {
  154. const that = this;
  155. // 设置表格的高度
  156. window.onresize = function temp() {
  157. that.clientHeight = (document.documentElement.clientHeight - 350)+'px';
  158. };
  159. },
  160. methods: {
  161. //返回上层
  162. returnUpper(){
  163. this.queryForm.isReturnBack="1";
  164. this.queryForm.deptId= this.returnForm.deptId;
  165. this.queryForm.teamCode= this.returnForm.teamCode;
  166. this.findPage();
  167. },
  168. // 按照查询条件查询
  169. drillingData(obj,type) {
  170. this.queryForm.pageNum = 1;
  171. this.queryForm.pageSize = 10;
  172. this.queryForm.isDrilling="1";
  173. this.queryForm.userId="";
  174. this.queryForm.teamCode="";
  175. this.queryForm.deptId="";
  176. this.queryForm.isReturnBack="0";
  177. if(type=='jg'){
  178. this.queryForm.deptId=obj.institutionId;
  179. }else if(type='td'){
  180. this.queryForm.deptId=obj.institutionId;
  181. this.queryForm.teamCode=obj.deptId;
  182. }
  183. this.findPage();
  184. },
  185. cleanTeamCode(){
  186. //级联清空 业务员
  187. this.queryForm.userId='';
  188. },
  189. queryUserCode(e){
  190. if((this.queryForm.teamCode ==null || this.queryForm.teamCode=='') ){
  191. this.userCodeOptions=[];
  192. this.$message.error('请先选择所属团队!')
  193. return
  194. }
  195. this.$api.report.findUserList(this.queryForm.teamCode).then((res) => {
  196. if (res.code == "200") {
  197. this.userCodeOptions = res.data;
  198. } else {
  199. this.$message.error(res.msg)
  200. }
  201. })
  202. },
  203. queryTeamCode(e){
  204. if((this.queryForm.deptId ==null || this.queryForm.deptId=='') ){
  205. this.teamCodeOptions=[];
  206. this.$message.error('请先选择所属机构!')
  207. return
  208. }
  209. this.$api.report.findTeamList(this.queryForm.deptId).then((res) => {
  210. if (res.code == "200") {
  211. this.teamCodeOptions = res.data;
  212. } else {
  213. this.$message.error(res.msg)
  214. }
  215. })
  216. },
  217. //联级选择器触发事件
  218. handleChange(val) {
  219. if (val.length !== 0) {
  220. this.queryForm.deptId = val.at(-1);
  221. }
  222. else {
  223. this.queryForm.deptId = ''
  224. //级联清空 团队 业务员
  225. this.queryForm.teamCode='';
  226. this.queryForm.userId='';
  227. }
  228. },
  229. //报价日期处理
  230. changeQuoteDate(e) {
  231. if (e === null) {
  232. this.queryForm.quoteStartDate = e;
  233. this.queryForm.quoteEndDate = e;
  234. } else {
  235. this.queryForm.quoteStartDate = e[0];
  236. this.queryForm.quoteEndDate = e[1];
  237. }
  238. },
  239. // 按照查询条件查询
  240. queryData() {
  241. if((this.queryForm.deptId ==null || this.queryForm.deptId=='') ){
  242. this.$message.error('所属机构必须录入!')
  243. return
  244. }
  245. if((this.quoteDate ==null || this.quoteDate=='') ){
  246. this.$message.error('签单日期必须录入!')
  247. return
  248. }
  249. this.queryForm.pageNum = 1;
  250. this.queryForm.pageSize = 10;
  251. this.queryForm.isDrilling="0";
  252. this.queryForm.isReturnBack="0";
  253. this.findPage();
  254. },
  255. //数据
  256. findPage() {
  257. this.loading = true;
  258. this.$api.report.queryOrderAndCostData(this.queryForm).then((res) => {
  259. if (res.code == "200") {
  260. this.loading = false;
  261. this.dataList = res.data.content;
  262. for(let item of this.dataList){
  263. this.returnForm.deptId=item.institutionId;
  264. this.returnForm.teamCode=item.deptId;
  265. }
  266. this.currentPage = res.data.pageNum;
  267. this.totalSum = res.data.totalSize;
  268. } else {
  269. this.$message.error(res.msg)
  270. this.loading = false;
  271. }
  272. })
  273. },
  274. // 每页条数发生改变
  275. handleSizeChange(val) {
  276. this.pageSize = val;
  277. this.currentPage = 1;
  278. this.queryForm.pageNum = 1;
  279. this.queryForm.pageSize = val;
  280. this.findPage();
  281. },
  282. // 当前页发生改变
  283. handleCurrentChange(val) {
  284. this.currentPage = val;
  285. this.queryForm.pageNum = val;
  286. this.findPage();
  287. },
  288. //全部导出
  289. exportExcel(){
  290. if((this.queryForm.deptId ==null || this.queryForm.deptId=='') ){
  291. this.$message.error('所属机构必须录入!')
  292. return
  293. }
  294. if((this.quoteDate ==null || this.quoteDate=='') ){
  295. this.$message.error('签单日期必须录入!')
  296. return
  297. }
  298. this.$api.report.exportOrderAndCostData(this.queryForm).then(res=>{
  299. let url = process.env.BASE_URL+'/upload/'+res.data // 3.创建一个临时的url指向blob对象
  300. // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
  301. let a = document.createElement("a");
  302. a.href = url;
  303. a.download = "出单量及费用统计报表.xlsx";
  304. a.click();
  305. // 5.释放这个临时的对象url
  306. window.URL.revokeObjectURL(url);
  307. })
  308. },
  309. //清单导出
  310. exportListExcel(obj){
  311. let queryListForm={}
  312. queryListForm.quoteStartDate=this.queryForm.quoteStartDate;
  313. queryListForm.quoteEndDate=this.queryForm.quoteEndDate;
  314. queryListForm.insCompany=this.queryForm.insCompany;
  315. queryListForm.riskCode=obj.riskName=='交强险'?"BZ":"BUS";
  316. queryListForm.deptId=obj.institutionId;
  317. queryListForm.teamCode=obj.deptId;
  318. queryListForm.userId=obj.userId;
  319. this.$api.report.exportOrderAndCostListData(queryListForm).then(res=>{
  320. let url = process.env.BASE_URL+'/upload/'+res.data // 3.创建一个临时的url指向blob对象
  321. // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
  322. let a = document.createElement("a");
  323. a.href = url;
  324. a.download = "出单量及费用统计报表-清单.xlsx";
  325. a.click();
  326. // 5.释放这个临时的对象url
  327. window.URL.revokeObjectURL(url);
  328. })
  329. }
  330. }
  331. }
  332. </script>
  333. <style scoped>
  334. /* 底部固定分页 */
  335. .bottomFixed {
  336. height: 50px;
  337. position: fixed;
  338. bottom: 0;
  339. width: 100%;
  340. background: #fff;
  341. }
  342. /* 顶部查询条件样式Start */
  343. .queryFrom .el-row {
  344. margin: 10px 0px;
  345. }
  346. .queryFrom .el-form-item {
  347. margin-bottom: 0px;
  348. }
  349. .queryFrom .queryButton .el-form-item__content {
  350. margin-left: 40px !important;
  351. }
  352. /* 顶部查询条件样式End */
  353. .el-form-item{
  354. margin-bottom: 0px!important;
  355. }
  356. .el-dialog__body{
  357. padding: 10px 20px!important;
  358. }
  359. /deep/ .el-select{
  360. width: 100%;
  361. }
  362. /deep/ .el-cascader--mini{
  363. width: 100%;
  364. }
  365. </style>