index.vue 1.93 KB
Newer Older
水落(YangLei)'s avatar
水落(YangLei) committed
1
<template>
shuiluo's avatar
shuiluo committed
2 3 4
    <Table url="/api/v1/schedules" rowKey="taskId" addBtn ref="table" :buttons="buttons">
        <template #drawer="drawer">
            <Form ref="form" v-bind="drawer" />
5
        </template>
shuiluo's avatar
shuiluo committed
6 7 8 9 10
        <a-table-column :title="$t('system.jobName')" data-index="taskName" />
        <a-table-column :title="$t('task.schedulingRules')" data-index="taskRule" />
        <a-table-column :title="$t('task.implementClass')" data-index="implementClass" />
        <a-table-column :title="$t('table.remark')" data-index="remark" />
    </Table>
水落(YangLei)'s avatar
水落(YangLei) committed
11 12 13
</template>

<script>
14
import Form from './form.vue';
shuiluo's avatar
shuiluo committed
15
import { Table } from '@/components/table';
16 17

export default {
shuiluo's avatar
shuiluo committed
18
    components: { Form, Table },
19 20 21 22
    data() {
        return {
            buttons: [
                {
shuiluo's avatar
shuiluo committed
23 24 25
                    label: this.$t('table.view'),
                    click: (row) => {
                        this.$refs.table.show({ type: 'view', row, title: this.$t('table.view') });
26
                    },
27 28
                },
                {
shuiluo's avatar
shuiluo committed
29 30 31
                    label: this.$t('table.edit'),
                    click: (row) => {
                        this.$refs.table.show({ type: 'edit', row, title: this.$t('table.edit') });
32 33 34
                    },
                },
                {
35
                    type: 'confirm',
shuiluo's avatar
shuiluo committed
36 37 38
                    label: this.$t('task.invalid'),
                    title: this.$t('task.invalidTip'),
                    url: (row) => ({ url: `/api/v1/schedules/${row.taskId}/pause`, method: 'del' }),
39
                    after: () => this.refreshTable(),
shuiluo's avatar
shuiluo committed
40
                    isHidden: (row) => row.isPaused === 1,
41 42
                },
                {
43
                    type: 'confirm',
shuiluo's avatar
shuiluo committed
44 45
                    url: (row) => `/api/v1/schedules/${row.taskId}`,
                    after: this.refreshTable,
46 47 48 49
                },
            ],
        };
    },
50 51 52 53 54
    methods: {
        refreshTable() {
            this.$refs.table.getData();
        },
    },
55
};
水落(YangLei)'s avatar
水落(YangLei) committed
56
</script>