rewardRound.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="奖励类型" prop="rewardType">
  5. <el-select v-model="queryParams.rewardType" placeholder="请选择奖励类型" clearable size="small">
  6. <el-option
  7. v-for="item in typeOptions"
  8. :key="item.dictValue"
  9. :label="item.dictLabel"
  10. :value="item.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="奖励状态" prop="status">
  15. <el-select v-model="queryParams.status" placeholder="请选择奖励状态" clearable size="small">
  16. <el-option
  17. v-for="item in statusOptions"
  18. :key="item.dictValue"
  19. :label="item.dictLabel"
  20. :value="item.dictValue"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="销售公司" prop="companyId">
  25. <el-select v-model="queryParams.companyId"
  26. placeholder="请选择推送公司"
  27. size="small">
  28. <!-- 公司选项 -->
  29. <el-option
  30. v-for="item in companyList"
  31. :key="item.companyId"
  32. :label="item.companyName"
  33. :value="item.companyId"
  34. />
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="创建时间" prop="createTime">
  38. <el-date-picker clearable size="small" style="width: 205.4px"
  39. v-model="dateRange"
  40. type="daterange"
  41. value-format="yyyy-MM-dd"
  42. start-placeholder="开始日期" end-placeholder="结束日期"
  43. >
  44. </el-date-picker>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <el-col :span="1.5">
  53. <el-button
  54. type="warning"
  55. plain
  56. icon="el-icon-download"
  57. size="mini"
  58. :loading="exportLoading"
  59. @click="handleExport"
  60. v-hasPermi="['course:rewardRound:export']"
  61. >导出</el-button>
  62. </el-col>
  63. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  64. </el-row>
  65. <el-table border v-loading="loading" :data="rewardRoundList" @selection-change="handleSelectionChange">
  66. <el-table-column type="selection" width="55" align="center" />
  67. <el-table-column label="领取用户" align="center" prop="userIdByName" />
  68. <el-table-column label="奖励类型" align="center" prop="rewardType">
  69. <template slot-scope="scope">
  70. <dict-tag :options="typeOptions" :value="scope.row.rewardType"/>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="公司" align="center" prop="companyName" />
  74. <el-table-column label="实际领取到的奖励" align="center" prop="actualRewards" />
  75. <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
  76. <el-table-column label="奖励状态" align="center" prop="status">
  77. <template slot-scope="scope">
  78. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  79. </template>
  80. </el-table-column>
  81. <!-- <el-table-column label="看课记录id" align="center" prop="watchId" />-->
  82. </el-table>
  83. <pagination
  84. v-show="total>0"
  85. :total="total"
  86. :page.sync="queryParams.pageNum"
  87. :limit.sync="queryParams.pageSize"
  88. @pagination="getList"
  89. />
  90. </div>
  91. </template>
  92. <script>
  93. import { listRewardRound, getRewardRound, delRewardRound, addRewardRound, updateRewardRound, exportRewardRound } from "@/api/reward/rewardRound";
  94. import {getCompanyList} from "@/api/company/company";
  95. export default {
  96. name: "RewardRound",
  97. data() {
  98. return {
  99. dateRange:[],
  100. companyList:[],
  101. statusOptions: [],
  102. typeOptions: [],
  103. // 遮罩层
  104. loading: true,
  105. // 导出遮罩层
  106. exportLoading: false,
  107. // 选中数组
  108. ids: [],
  109. // 非单个禁用
  110. single: true,
  111. // 非多个禁用
  112. multiple: true,
  113. // 显示搜索条件
  114. showSearch: true,
  115. // 总条数
  116. total: 0,
  117. // 奖励领取记录表格数据
  118. rewardRoundList: [],
  119. // 弹出层标题
  120. title: "",
  121. // 是否显示弹出层
  122. open: false,
  123. // 查询参数
  124. queryParams: {
  125. pageNum: 1,
  126. pageSize: 10,
  127. rewardId: null,
  128. rewardConfigId: null,
  129. userId: null,
  130. rewardType: null,
  131. companyId: null,
  132. actualRewards: null,
  133. receiveTime: null,
  134. createId: null,
  135. status: null,
  136. courseId: null,
  137. watchId: null
  138. },
  139. // 表单参数
  140. form: {},
  141. };
  142. },
  143. created() {
  144. this.getList();
  145. this.getDicts("sys_reward_type").then((response) => {
  146. this.typeOptions = response.data;
  147. });
  148. this.getDicts("sys_reward_status").then((response) => {
  149. this.statusOptions = response.data;
  150. });
  151. getCompanyList().then(response => {
  152. this.companyList = response.data;
  153. });
  154. },
  155. methods: {
  156. /** 查询奖励领取记录列表 */
  157. getList() {
  158. this.loading = true;
  159. listRewardRound(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  160. this.rewardRoundList = response.rows;
  161. this.total = response.total;
  162. this.loading = false;
  163. });
  164. },
  165. // 取消按钮
  166. cancel() {
  167. this.open = false;
  168. this.reset();
  169. },
  170. // 表单重置
  171. reset() {
  172. this.form = {
  173. id: null,
  174. rewardId: null,
  175. rewardConfigId: null,
  176. userId: null,
  177. rewardType: null,
  178. companyId: null,
  179. actualRewards: null,
  180. receiveTime: null,
  181. createId: null,
  182. createTime: null,
  183. updateTime: null,
  184. status: 0,
  185. courseId: null,
  186. watchId: null
  187. };
  188. this.resetForm("form");
  189. },
  190. /** 搜索按钮操作 */
  191. handleQuery() {
  192. this.queryParams.pageNum = 1;
  193. this.getList();
  194. },
  195. /** 重置按钮操作 */
  196. resetQuery() {
  197. this.resetForm("queryForm");
  198. this.handleQuery();
  199. },
  200. // 多选框选中数据
  201. handleSelectionChange(selection) {
  202. this.ids = selection.map(item => item.id)
  203. this.single = selection.length!==1
  204. this.multiple = !selection.length
  205. },
  206. /** 导出按钮操作 */
  207. handleExport() {
  208. const queryParams = this.queryParams;
  209. this.$confirm('是否确认导出所有奖励领取记录数据项?', "警告", {
  210. confirmButtonText: "确定",
  211. cancelButtonText: "取消",
  212. type: "warning"
  213. }).then(() => {
  214. this.exportLoading = true;
  215. return exportRewardRound(queryParams);
  216. }).then(response => {
  217. this.download(response.msg);
  218. this.exportLoading = false;
  219. }).catch(() => {});
  220. }
  221. }
  222. };
  223. </script>