ForbidAccountTable.vue 5.73 KB
<template>
    <m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm" @onSearch="pageReload" @onReset="pageReset" :simpleFieldNum="4"/>
    <a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false" @change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn"
             size="small" :pagination="pageState" :row-key="record => record.aucvehId" :scroll="{y: '446px'}">
        <template #customFilterDropdown="{setSelectedKeys, selectedKeys, confirm, clearFilters, column}">
            <m-filter-text-render :pagination="pagination" :column="column" :confirm="confirm"></m-filter-text-render>
            <m-filter-checkbox-group-render :pagination="pagination" :column="column" :confirm="confirm"></m-filter-checkbox-group-render>
        </template>
        <template #bodyCell="{column,record}">
            <template v-if="column.key === 'accountType'">
                <account-type-tag :account-type="record.accountType"></account-type-tag>
            </template>
            <template v-if="column.key === 'action'">
                <a-button v-sec="'control_4'" type="primary" danger size="small" @click="enableAccount(record)">禁止出价</a-button>
            </template>
        </template>
        <!--拍卖车辆列表end-->
    </a-table>
</template>
<script lang="ts">
import {Component, Prop} from 'vue-facing-decorator';
import AuctionVehicleStateTag from "@/views/auction/auction/tag/AuctionVehicleStateTag.vue";
import {message, Modal, TableColumnsType} from "ant-design-vue";
import {Account} from "lib/src/entity/account/entity/Account";
import {AccountController} from "@/api/AccountController";
import {Operator} from "lib/src/core/page/Pagination";
import {PaginationComponent} from "@/components/PaginationComponent";
import {Auction} from "lib/src/entity/auction/entity/Auction";
import AccountTypeTag from "@/views/account/account/tag/AccountTypeTag.vue";
import {createVNode} from "vue";
import {ExclamationCircleOutlined} from "@ant-design/icons-vue";

@Component({
    components: {AccountTypeTag, AuctionVehicleStateTag}
})
export default class ForbidAccountTable extends PaginationComponent<Account> {

    @Prop({required: true})
    auction: Auction;

    /**
     * 表格列配置
     */
    columns: TableColumnsType = [
        {title: '车商ID', dataIndex: 'accountId', key: 'accountId', width: 100, resizable: true, ellipsis: true, sorter: true},
        {title: '手机号', dataIndex: 'mobile', key: 'mobile', align: 'center', width: 120, resizable: true, ellipsis: true, sorter: true},
        {title: '昵称', dataIndex: 'nickName', key: 'nickName', width: 120, resizable: true, ellipsis: true, sorter: true},
        {title: '认证姓名', dataIndex: 'accountName', key: 'accountName', width: 150, resizable: true, ellipsis: true, sorter: true},
        {
            title: '账号状态', dataIndex: 'enabled', key: 'enabled', width: 100, align: 'center', resizable: true, ellipsis: true, sorter: true,
            customRender: ({text}) => {
                return text ? '启用' : '禁止出价';
            }
        },
        {title: '账户类型', dataIndex: 'accountType', key: 'accountType', align: 'center', width: 100, resizable: true, ellipsis: true, sorter: true},

        {title: '当前场出价次数', dataIndex: ['bidStat', 'bidCount'], key: 'bidCount', align: 'right', width: 100, resizable: true, ellipsis: true, sorter: false},
        {title: '最后出价金额', dataIndex: ['bidStat', 'bidPrice'], key: 'bidPrice', align: 'right', width: 100, resizable: true, ellipsis: true, sorter: false},

        {title: '最近活跃时间', dataIndex: 'lastLoginTime', key: 'lastLoginTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
        {title: '注册时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
        {title: '用户标签', dataIndex: 'accountTags', key: 'accountTags', resizable: true, ellipsis: true, sorter: true},
        {title: '操作', key: 'action', width: 110, align: 'center', fixed: 'right'},
    ];

    created(): void {
        this.init(this.axios, AccountController.PAGE_AUCTION_ACCOUNT);
        this.buildQueryForm({
            accountName: [null, {label: '用户名', field: 'accountName', operator: Operator.like}],
            createTime: [null, {label: '创建时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range'}],
            mobile: [null, {label: '手机号', field: 'mobile', operator: Operator.like}],
            enabled: [null, {
                label: '账号状态', field: 'enabled', type: 'select', allowClear: true, optionItems: [
                    {label: '启用', value: true},
                    {label: '禁止出价', value: false},
                ], operator: Operator.eq
            }],
        });
        this.pagination.putData("auctionId", this.auction.auctionId);
        //this.pagination.setDefaultSort('createTime', Order.desc);
        this.pageLoad();
    }

    enableAccount(record: Account): void {
        const that = this;
        Modal.confirm({
            title: '重要提示',
            icon: createVNode(ExclamationCircleOutlined),
            content: `此操作将立即禁止用户【${record.accountName}】在本场次的所有出价权限,且无法撤销,请确认!`,
            onOk() {
                AccountController.enableAccount(that.axios, record.accountId, false).then(() => {
                    message.success('禁用成功');
                    record.enabled = false;
                });
            },
            onCancel() {
                console.log('Cancel');
            },
        });
    }
}
</script>


<style scoped lang="less">

</style>