1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <div id="status">
- <data-table v-if="!loading" :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit"> </data-table>
- </div>
- </template>
- <script>
- const moment = require('moment');
- const { ticketType } = require('@common/dict/index');
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: ticket } = createNamespacedHelpers('ticket');
- export default {
- name: 'status',
- props: {},
- components: {},
- data: function () {
- return {
- list: [],
- total: 0,
- opera: [
- {
- label: '审核',
- method: 'edit',
- display: (i) => this.statusData != '1',
- },
- ],
- fields: [
- { label: '企业', prop: 'name', filter: true },
- { label: '申请时间', prop: 'meta.createdAt', format: (i) => moment(i).format('YYYY-MM-DD HH:mm:ss') },
- {
- label: '状态',
- prop: 'status',
- format: (i) => {
- const r = ticketType.find((f) => f.value === i);
- if (r) return r.label;
- else return '';
- },
- },
- ],
- loading: true,
- };
- },
- created() {
- this.search();
- },
- methods: {
- ...ticket(['query', 'delete']),
- async search({ skip = 0, limit = 10, ...info } = {}) {
- const res = await this.query({ skip, limit, ...info, status: this.statusData });
- if (this.$checkRes(res)) {
- this.$set(this, `list`, res.data);
- this.$set(this, `total`, res.total);
- }
- this.loading = false;
- },
- toEdit({ data }) {
- this.$router.push({ path: '/adminCenter/ticket/detail', query: { id: data._id, status: data.status } });
- },
- },
- computed: {
- ...mapState(['user', 'menuParams']),
- pageTitle() {
- return `${this.$route.meta.title}`;
- },
- statusData() {
- return this.$route.params.status;
- },
- },
- watch: {
- statusData: {
- handler(val) {
- this.loading = true;
- this.search();
- },
- },
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- };
- </script>
- <style lang="less" scoped></style>
|