InsuranceDataExport.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div>
  3. <el-main ref="elMain" style="padding: 0px;">
  4. <!-- 工具区域Start -->
  5. <el-form class="queryForm" ref="queryFormRef" :model="queryForm" label-width="80px">
  6. <el-row style="margin-bottom: 15px;">
  7. <el-col :span="8">
  8. <el-form-item label="录入时间">
  9. <el-date-picker value-format="yyyy-MM-dd" v-model="queryForm.date" style="margin-left: 20px;" size="mini"
  10. type="daterange" align="left" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  11. </el-date-picker>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="4">
  15. <el-form-item label="订单状态">
  16. <el-select v-model="queryForm.orderStatus" disabled class="widths" size="mini" clearable>
  17. <el-option v-for="val in optionsStatus" :key='val.dictValue' :label="val.dictTag" :value="val.dictValue" ></el-option>
  18. </el-select>
  19. </el-form-item>
  20. </el-col>
  21. </el-row>
  22. </el-form>
  23. <kt-button label="导出Excel" :perms="permsDelete" size="small" type="danger" @click="handlePrint()"
  24. style="float: left;margin-left: 50px;" />
  25. </el-main>
  26. </div>
  27. </template>
  28. <script>
  29. import KtButton from "@/views/Core/KtButton";
  30. export default {
  31. components: {
  32. KtButton,
  33. },
  34. data() {
  35. return {
  36. queryForm:{},
  37. permsDelete:"sys:user:delete",
  38. optionsStatus:[],
  39. };
  40. },
  41. created() {
  42. this.$api.insCompany.dicType('insOrderStatus').then(res=>{
  43. this.optionsStatus=res.data.ddList
  44. let filterArr = res.data.ddList.filter(item=>{
  45. return item.dictTag == '已承保'
  46. })
  47. if(filterArr.length){
  48. this.queryForm.orderStatus = filterArr[0].dictValue
  49. }
  50. })
  51. },
  52. mounted() {
  53. },
  54. methods: {
  55. // 导出excel
  56. handlePrint(){
  57. if(this.queryForm.date!=null){
  58. this.queryForm.startDate=this.queryForm.date[0]
  59. this.queryForm.endDate=this.queryForm.date[1]
  60. }else{
  61. this.$message.error('请选择录入时间!')
  62. return
  63. }
  64. let params = {
  65. endDate:this.queryForm.endDate,
  66. orderstatus:this.queryForm.orderStatus,
  67. startDate:this.queryForm.startDate
  68. }
  69. this.$api.letter.orderExportExcel(params).then(res=>{
  70. if(res.code==200){
  71. let url = process.env.BASE_URL+'/upload/'+res.data // 3.创建一个临时的url指向blob对象
  72. // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
  73. let a = document.createElement("a");
  74. a.href = url;
  75. a.download = "导出订单.xlsx";
  76. a.click();
  77. // 5.释放这个临时的对象url
  78. window.URL.revokeObjectURL(url);
  79. }else{
  80. this.$message.error(res.msg)
  81. }
  82. })
  83. },
  84. },
  85. };
  86. </script>
  87. <style scoped lang="scss">
  88. .el-divider {
  89. margin: 10px 0px 15px !important;
  90. }
  91. .queryForm .el-row {
  92. margin: 0px;
  93. }
  94. .queryForm .el-form-item {
  95. margin-bottom: 0px;
  96. }
  97. .products {
  98. // margin: 20px;
  99. .productCosts {
  100. text-align: center;
  101. span {
  102. font-weight: bold;
  103. }
  104. }
  105. }
  106. .ruleStyle{
  107. /deep/ .el-divider__text{
  108. color: red;
  109. }
  110. }
  111. .products>div {
  112. margin: 5px;
  113. }
  114. .productstitle {
  115. width: 100%;
  116. border-bottom: 2px solid #409eff;
  117. text-align: center;
  118. }
  119. .productstitle>div {
  120. width: 100px;
  121. height: 26px;
  122. line-height: 30px;
  123. background: #409eff;
  124. color: #fff;
  125. border-top-right-radius: 15px;
  126. padding: 2px;
  127. font-size: 12px;
  128. }
  129. /deep/ {
  130. .el-button--warning {
  131. color: #fff;
  132. background-color: #ee7000;
  133. border-color: #ee7000;
  134. &:hover {
  135. color: #fff;
  136. background-color: #ee6f00ce;
  137. border-color: #ee6f00ce;
  138. }
  139. }
  140. }
  141. .apistyle /deep/ .el-form-item__label{
  142. min-width: 180px;
  143. }
  144. </style>