session copy.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
  4. <!-- <el-form-item label="票务管理:">
  5. <el-select
  6. v-model="queryParams.goodsId"
  7. placeholder="票务管理"
  8. clearable
  9. @change="goodsChangeEven"
  10. style="width: 100%;"
  11. >
  12. <el-option
  13. v-for="dict in ticketList"
  14. :key="dict.id"
  15. :label="dict.goodsName"
  16. :value="dict.goodsId"
  17. />
  18. </el-select>
  19. </el-form-item> -->
  20. <el-form-item label="座位类型:">
  21. <el-select
  22. v-model="queryParams.seatTypeId"
  23. placeholder="座位类型"
  24. clearable
  25. style="width: 100%;"
  26. >
  27. <el-option
  28. v-for="dict in seatList"
  29. :key="dict.seatTypeId"
  30. :label="dict.seatTypeName"
  31. :value="dict.seatTypeId"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="场次日期">
  36. <el-date-picker
  37. v-model="queryParams.time"
  38. type="daterange"
  39. value-format="yyyy-MM-dd"
  40. range-separator="至"
  41. start-placeholder="开始日期"
  42. end-placeholder="结束日期">
  43. </el-date-picker>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  47. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  48. </el-form-item>
  49. </el-form>
  50. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  51. <el-button
  52. type="primary"
  53. size="mini"
  54. icon="el-icon-download"
  55. :disabled="tableData.length === 0"
  56. v-hasPermi="['session:session:downloadExcel']"
  57. @click="handleExport"
  58. v-loading.fullscreen.lock="handleExportLoading"
  59. element-loading-text="正在拼命生成数据中..."
  60. element-loading-spinner="el-icon-loading"
  61. element-loading-background="rgba(0, 0, 0, 0.5)"
  62. >导出excel</el-button>
  63. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  64. </el-row>
  65. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  66. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  67. <!-- <el-table-column label="剧目名称" align="center" prop="performName" />
  68. <el-table-column label="票务名称" align="center" prop="goodsName" /> -->
  69. <el-table-column label="场次日期" align="center">
  70. <template slot-scope="scope">
  71. <span>{{ scope.row.performDate }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="场次" align="center">
  75. <template slot-scope="scope">
  76. <span>{{ scope.row.performTimeStart }} -- {{ scope.row.performTimeEnd }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="座位类型" align="center" prop="seatTypeName" />
  80. <el-table-column label="总库存" align="center">
  81. <template slot-scope="scope">
  82. <span>{{ scope.row.total }}张</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="已售数量" align="center">
  86. <template slot-scope="scope">
  87. <span>{{ scope.row.saleTotal }}张</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="已核销数量" align="center">
  91. <template slot-scope="scope">
  92. <span>{{ scope.row.usedTotal }}张</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="库存数量" align="center">
  96. <template slot-scope="scope">
  97. <span>{{ (scope.row.total - scope.row.saleTotal) >= 0 ? (scope.row.total - scope.row.saleTotal) : '' }}张</span>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <pagination
  102. v-show="total>0"
  103. :total="total"
  104. :page.sync="queryParams.pageNum"
  105. :limit.sync="queryParams.pageSize"
  106. @pagination="getList"
  107. />
  108. </div>
  109. </template>
  110. <script>
  111. import { performTimeCount, downTimeCountListXls } from '@/api/statistics'
  112. import { exportExcel } from '@/utils/exportexcel'
  113. import { seatPricePageList } from '@/api/distribution/ticketMr'
  114. export default {
  115. name: "session",
  116. data() {
  117. return {
  118. // 遮罩层
  119. loading: true,
  120. // 选中数组
  121. ids: [],
  122. // 非单个禁用
  123. single: true,
  124. // 非多个禁用
  125. multiple: true,
  126. // 显示搜索条件
  127. showSearch: true,
  128. // 总条数
  129. total: 0,
  130. // 用户表格数据
  131. dataList: null,
  132. // 弹出层标题
  133. title: "",
  134. // 是否显示弹出层
  135. open: false,
  136. // 日期范围
  137. dateRange: [],
  138. // 查询参数
  139. queryParams: {
  140. pageNum: 1,
  141. pageSize: 10,
  142. },
  143. visibleStatus: false,
  144. newObj: {},
  145. visibleType: '',
  146. handleExportLoading: false,
  147. tableData: {},
  148. ticketList: [],
  149. seatList: [],
  150. };
  151. },
  152. created() {
  153. this.getList();
  154. this.ticketListApi();
  155. },
  156. methods: {
  157. /** 查询列表 */
  158. getList() {
  159. this.loading = true;
  160. if(this.queryParams.time){
  161. this.queryParams.performStartDate = this.queryParams.time[0];
  162. this.queryParams.performEndDate = this.queryParams.time[1];
  163. }
  164. performTimeCount(this.addDateRange(this.queryParams, this.dateRange))
  165. .then(response => {
  166. this.dataList = response.data.rows;
  167. this.total = response.data.total;
  168. this.loading = false;
  169. }
  170. );
  171. },
  172. /** 票务列表查询 */
  173. ticketListApi() {
  174. this.ticketList = []
  175. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  176. .then(response => {
  177. let ticketItemList = []
  178. response.data.rows.forEach(item => {
  179. if(ticketItemList.indexOf(item.goodsId) == -1){
  180. this.ticketList.push(item);
  181. ticketItemList.push(item.goodsId);
  182. }
  183. })
  184. });
  185. },
  186. /** 座位类型列表 */
  187. getSeatTypeList(obj) {
  188. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, goodsId: obj.goodsId}))
  189. .then(response => {
  190. let ticketList = []
  191. response.data.rows.forEach(item => {
  192. if(ticketList.indexOf(item.seatTypeId) == -1){
  193. this.seatList.push(item);
  194. ticketList.push(item.seatTypeId);
  195. }
  196. })
  197. });
  198. },
  199. // 取消按钮
  200. cancel() {
  201. this.open = false;
  202. },
  203. // 票务改变事件
  204. goodsChangeEven() {
  205. this.seatList = [];
  206. this.$set(this.queryParams, 'seatTypeId', '');
  207. let selectMap = {goodsId: this.queryParams.goodsId}
  208. this.getSeatTypeList(selectMap);
  209. },
  210. /** 搜索按钮操作 */
  211. handleQuery() {
  212. this.queryParams.pageNum = 1;
  213. this.getList();
  214. },
  215. /** 重置按钮操作 */
  216. resetQuery() {
  217. this.dateRange = [];
  218. this.seatList = [];
  219. this.$set(this.queryParams, 'time', '');
  220. this.$set(this.queryParams, 'performStartDate', '');
  221. this.$set(this.queryParams, 'performEndDate', '');
  222. this.$set(this.queryParams, 'goodsId', '');
  223. this.$set(this.queryParams, 'seatTypeId', '');
  224. this.queryParams.pageNum = 1;
  225. this.handleQuery();
  226. },
  227. /**
  228. * 导出报表
  229. * @date 2022-10-24
  230. * @returns {any}
  231. */
  232. handleExport() {
  233. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  234. confirmButtonText: '确定 ',
  235. cancelButtonText: '取消 ',
  236. type: 'warning'
  237. })
  238. .then(() => {
  239. this.handleExportLoading = true;
  240. // const { pageNum, pageSize} = this.params;
  241. let postMap = {}
  242. for (let key in this.queryParams) {
  243. if(key != 'pageNum' && key != 'pageSize'){
  244. postMap[key] = this.queryParams[key]
  245. }
  246. }
  247. downTimeCountListXls(postMap)
  248. .then((res) => {
  249. exportExcel(res, '场次统计', '.xlsx');
  250. this.handleExportLoading = false;
  251. })
  252. .catch(() => {
  253. this.handleExportLoading = false;
  254. });
  255. })
  256. .catch(() => {
  257. this.$message.info('您已取消导出!');
  258. });
  259. },
  260. }
  261. };
  262. </script>