status.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div id="status">
  3. <data-table v-if="!loading" :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit"> </data-table>
  4. </div>
  5. </template>
  6. <script>
  7. const moment = require('moment');
  8. const { ticketType } = require('@common/dict/index');
  9. import { mapState, createNamespacedHelpers } from 'vuex';
  10. const { mapActions: ticket } = createNamespacedHelpers('ticket');
  11. export default {
  12. name: 'status',
  13. props: {},
  14. components: {},
  15. data: function () {
  16. return {
  17. list: [],
  18. total: 0,
  19. opera: [
  20. {
  21. label: '审核',
  22. method: 'edit',
  23. display: (i) => this.statusData != '1',
  24. },
  25. ],
  26. fields: [
  27. { label: '企业', prop: 'name', filter: true },
  28. { label: '申请时间', prop: 'meta.createdAt', format: (i) => moment(i).format('YYYY-MM-DD HH:mm:ss') },
  29. {
  30. label: '状态',
  31. prop: 'status',
  32. format: (i) => {
  33. const r = ticketType.find((f) => f.value === i);
  34. if (r) return r.label;
  35. else return '';
  36. },
  37. },
  38. ],
  39. loading: true,
  40. };
  41. },
  42. created() {
  43. this.search();
  44. },
  45. methods: {
  46. ...ticket(['query', 'delete']),
  47. async search({ skip = 0, limit = 10, ...info } = {}) {
  48. const res = await this.query({ skip, limit, ...info, status: this.statusData });
  49. if (this.$checkRes(res)) {
  50. this.$set(this, `list`, res.data);
  51. this.$set(this, `total`, res.total);
  52. }
  53. this.loading = false;
  54. },
  55. toEdit({ data }) {
  56. this.$router.push({ path: '/adminCenter/ticket/detail', query: { id: data._id, status: data.status } });
  57. },
  58. },
  59. computed: {
  60. ...mapState(['user', 'menuParams']),
  61. pageTitle() {
  62. return `${this.$route.meta.title}`;
  63. },
  64. statusData() {
  65. return this.$route.params.status;
  66. },
  67. },
  68. watch: {
  69. statusData: {
  70. handler(val) {
  71. this.loading = true;
  72. this.search();
  73. },
  74. },
  75. },
  76. metaInfo() {
  77. return { title: this.$route.meta.title };
  78. },
  79. };
  80. </script>
  81. <style lang="less" scoped></style>