month.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <!--
  2. * @Description:
  3. * 月报表统计 功能开发
  4. -->
  5. <template>
  6. <div class="app-container">
  7. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="60px">
  8. <el-form-item label="日期" required prop="performDate">
  9. <el-date-picker
  10. v-model="queryParams.performDate"
  11. type="month"
  12. value-format="yyyy-MM"
  13. placeholder="日期">
  14. </el-date-picker>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  18. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  19. </el-form-item>
  20. </el-form>
  21. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  22. <el-button
  23. type="primary"
  24. size="mini"
  25. icon="el-icon-download"
  26. :disabled="dataList.length === 0"
  27. v-hasPermi="['month:month:export']"
  28. @click="handleExport"
  29. v-loading.fullscreen.lock="handleExportLoading"
  30. element-loading-text="正在拼命生成数据中..."
  31. element-loading-spinner="el-icon-loading"
  32. element-loading-background="rgba(0, 0, 0, 0.5)"
  33. >导出excel</el-button>
  34. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  35. </el-row>
  36. <el-table ref="tables" v-loading="loading" :data="dataList" max-height="650px" border>
  37. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  38. <el-table-column label="渠道" align="center">
  39. <template slot-scope="scope">
  40. <span>{{ scope.row.channelTypeName?scope.row.channelTypeName: '-' }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="时间" align="center" prop="month"></el-table-column>
  44. <el-table-column label="人次" align="center">
  45. <template slot-scope="scope">
  46. <span>{{ scope.row.personNum }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="收入" align="center">
  50. <template slot-scope="scope">
  51. <span>{{ scope.row.salePrice }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="客单" align="center">
  55. <template slot-scope="scope">
  56. <span>{{ scope.row.avgPrice }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="人次占比" align="center">
  60. <template slot-scope="scope">
  61. <span>{{ scope.row.personRate?scope.row.personRate+'%' : '-' }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="收入占比" align="center">
  65. <template slot-scope="scope">
  66. <span>{{ scope.row.salePriceRatio?scope.row.salePriceRatio+'%' : '-' }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="销售上座率" align="center">
  70. <template slot-scope="scope">
  71. <span>{{ scope.row.saleSeatRate?scope.row.saleSeatRate+'%' : '-' }}</span>
  72. </template>
  73. </el-table-column>
  74. </el-table>
  75. </div>
  76. </template>
  77. <script>
  78. import { monthReportCount, monthReportExport } from '@/api/statisticalReport/statistics'
  79. import { exportExcel } from '@/utils/exportexcel'
  80. import moment from "moment"
  81. export default {
  82. name: "Month",
  83. dicts: [],
  84. data() {
  85. return {
  86. // 遮罩层
  87. loading: true,
  88. // 选中数组
  89. ids: [],
  90. // 非单个禁用
  91. single: true,
  92. // 非多个禁用
  93. multiple: true,
  94. // 显示搜索条件
  95. showSearch: true,
  96. // 总条数
  97. total: 0,
  98. // 用户表格数据
  99. dataList: [],
  100. // 弹出层标题
  101. title: "",
  102. // 是否显示弹出层
  103. open: false,
  104. // 日期范围
  105. // dateRange: [],
  106. // 查询参数
  107. queryParams: {
  108. performDate:'',
  109. // pageNum: 1,
  110. // pageSize: 10,
  111. },
  112. handleExportLoading: false,
  113. };
  114. },
  115. created() {
  116. this.$set(this.queryParams,'performDate',moment().format("yyyy-MM"));
  117. this.getList();
  118. },
  119. methods: {
  120. /** 查询列表 */
  121. getList() {
  122. this.loading = true;
  123. monthReportCount(this.queryParams).then(response => {
  124. this.dataList = response.data.rows||[];
  125. this.total = response.data.total||0;
  126. this.loading = false;
  127. }
  128. ).catch(()=>{
  129. this.loading = false;
  130. });
  131. },
  132. // 取消按钮
  133. cancel() {
  134. this.open = false;
  135. },
  136. /** 搜索按钮操作 */
  137. handleQuery() {
  138. // this.queryParams.pageNum = 1;
  139. this.getList();
  140. },
  141. /** 重置按钮操作 */
  142. resetQuery() {
  143. this.$set(this.queryParams, 'time', '');
  144. // this.queryParams.pageNum = 1;
  145. this.$set(this.queryParams,'performDate',moment().format("yyyy-MM"));
  146. this.handleQuery();
  147. },
  148. /**
  149. * 导出报表
  150. * @date 2022-10-24
  151. * @returns {any}
  152. */
  153. handleExport() {
  154. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  155. confirmButtonText: '确定 ',
  156. cancelButtonText: '取消 ',
  157. type: 'warning'
  158. })
  159. .then(() => {
  160. this.handleExportLoading = true;
  161. monthReportExport(this.queryParams)
  162. .then((res) => {
  163. exportExcel(res, '月报表', '.xlsx');
  164. this.handleExportLoading = false;
  165. })
  166. .catch(() => {
  167. this.handleExportLoading = false;
  168. });
  169. })
  170. .catch(() => {
  171. this.$message.info('您已取消导出!');
  172. });
  173. },
  174. }
  175. };
  176. </script>
  177. <style lang="scss" scoped>
  178. </style>