import { ActionOptions } from '@/components/DropDownButtons/type';
import type { BasicTableProps } from '@/components/VxeTable';
import { EditType } from '@/type/BaseEnum';
import { Edit, Delete } from "@element-plus/icons-vue";
import { reactive } from 'vue';

/**
 * 审批人员表格配置
 */
function useApprovalUserModel() {
    const approvalUserListOptions = reactive<BasicTableProps>({
        id: 'approvalUser_list_table',
        border: true,
        keepSource: true,
        showOverflow: true,
        height: 520,
        loading: false,
        stripe: true,
        rowConfig: { isHover: true, keyField: '_id' },
        columnConfig: { resizable: true },
        columns: [
            { field: 'approvalTypeName', title: '审批类型', minWidth: 120 },
            { field: 'approvalUserName', title: '批人员', minWidth: 120 },
            { field: 'orderNumber', title: '序号', minWidth: 100 },
            { field: 'createUserName', title: '创建人', minWidth: 120 },
            { field: 'createTime', title: '创建时间', minWidth: 130 },
            { title: '操作', slots: { default: 'actions' }, width: 135, fixed: 'right' }
        ],
        data: []
    })

    // 操作类别
    const approvalUserListActionOptions: ActionOptions[] = [
        {
            value: EditType.EDIT,
            label: "编辑",
            type: "primary",
            icon: Edit,
            permissions: ['sys:approvalUser:edit']
        },
        {
            value: EditType.DELETE,
            label: "删除",
            type: "danger",
            icon: Delete,
            permissions: ['sys:approvalUser:delete']
        }
    ]


    return {
        approvalUserListOptions,
        approvalUserListActionOptions
    }
}

export {
    useApprovalUserModel
}