<script setup>
import {reactive} from "vue";
import useTableQuery from "../../../../hooks/useTableQuery.js";
import Api from "../../../../api/index.js";
import SequenceAdjustment from "../../../../components/SequenceAdjustment/index.vue";

const columns = [
    {
        title: '任务编号',
        dataIndex: 'key',
    },
    {
        title: '任务名称',
        dataIndex: 'key',
    },
    {
        title: '发布渠道',
        dataIndex: 'key',
    },
    {
        title: '创建时间',
        dataIndex: 'key',
    },
    {
        title: '子任务数',
        dataIndex: 'key',
    },
    {
        title: '子任务报价',
        dataIndex: 'key',
    },
    {
        title: '商家ID',
        dataIndex: 'key',
    },
    {
        title: '平台报价',
        dataIndex: 'key',
    },
    {
        title: '是否置顶',
        dataIndex: 'topUp',
        slotName: 'topUp',
        width: 100,
        align: 'center',
    },
    {
        title: '排序',
        dataIndex: 'action',
        slotName: 'action',
        width: 130,
    },
];

const po = reactive({});
const vo = reactive({
    page: '',
    rows: [],
    total: 0,
});

const {loading, pagination, initFetchData} = useTableQuery({
    parameter: po,
    api: Api.system.getData,
    callback: (data) => {
        Object.assign(vo, data);
    }
});
</script>

<template>
    <!-- 任务排序 -->
    <a-card>
        <div class="title">任务排序</div>
        <a-table
            :loading="loading"
            @page-change="(e) => pagination.current = e"
            :pagination="pagination"
            :data="vo.rows"
            :columns="columns"
            class="flex-grow">
            <template v-slot:topUp>
                <a-switch></a-switch>
            </template>
            <template v-slot:action>
                <SequenceAdjustment></SequenceAdjustment>
            </template>
        </a-table>
    </a-card>
</template>

<style lang="scss" scoped>
.title {
    color: rgb(29, 33, 41);
    font-size: 20px;
    font-weight: 500;
    line-height: 28px;
    letter-spacing: 0;
    text-align: left;
    margin-bottom: 16px;
}
</style>
