index.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one">
  6. <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @check="toCheck"> </data-table>
  7. </el-col>
  8. </el-col>
  9. </el-row>
  10. </div>
  11. </template>
  12. <script>
  13. const { rewardStatus } = require('@common/dict/couindex');
  14. import { mapState, createNamespacedHelpers } from 'vuex';
  15. const { mapActions: reward } = createNamespacedHelpers('reward');
  16. export default {
  17. name: 'index',
  18. props: {},
  19. components: {},
  20. data: function () {
  21. return {
  22. list: [],
  23. total: 0,
  24. opera: [
  25. {
  26. label: '审核',
  27. method: 'check',
  28. display: (item) => {
  29. return item.status == '0';
  30. },
  31. },
  32. ],
  33. fields: [
  34. { label: '申领类型', prop: 'type' },
  35. { label: '申领企业', prop: 'company', filter: 'input' },
  36. { label: '申请人', prop: 'apply_person', filter: 'input' },
  37. { label: '联系电话', prop: 'phone', filter: 'input' },
  38. {
  39. label: '审核状态',
  40. prop: 'status',
  41. format: (i) => {
  42. const r = rewardStatus.find((f) => f.value === i);
  43. if (r) return r.label;
  44. return '未知状态';
  45. },
  46. },
  47. ],
  48. };
  49. },
  50. created() {},
  51. methods: {
  52. ...reward(['query']),
  53. async search({ skip = 0, limit = 10, ...info } = {}) {
  54. info.type = this.type;
  55. const res = await this.query({ skip, limit, ...info });
  56. if (this.$checkRes(res)) {
  57. this.$set(this, `list`, res.data);
  58. this.$set(this, `total`, res.total);
  59. }
  60. },
  61. // 审核
  62. toCheck({ data }) {
  63. this.$router.push({ path: '/adminCenter/reward/detail', query: { id: data.id, type: data.type } });
  64. },
  65. },
  66. computed: {
  67. ...mapState(['user']),
  68. type() {
  69. return this.$route.query.type;
  70. },
  71. },
  72. metaInfo() {
  73. return { title: this.$route.meta.title };
  74. },
  75. watch: {
  76. type: {
  77. deep: true,
  78. immediate: true,
  79. handler(val) {
  80. this.search();
  81. },
  82. },
  83. },
  84. };
  85. </script>
  86. <style lang="less" scoped>
  87. .main {
  88. border-radius: 10px;
  89. box-shadow: 0 0 5px #cccccc;
  90. padding: 20px;
  91. }
  92. .main:hover {
  93. box-shadow: 0 0 5px #409eff;
  94. }
  95. </style>