import { ActionOptions } from '@/components/DropDownButtons/type';
import { BasicTableProps, VxeGridInstance } from '@/components/VxeTable';
import { BaseFeesetAction } from '@/type/BaseFeesetAction';
import { Delete, Refresh, Edit, Odometer } from "@element-plus/icons-vue";
import { ref, reactive } from 'vue';
/**
 * 应收模版-表格配置
 * @returns 
 */
function useReceivableModel() {
    const receivableGridRef = ref<VxeGridInstance>()
    // vxe-gird-成本费用设置列表配置
    const receivableListOptions = reactive<BasicTableProps>({
        id: 'receivableList_table',
        border: true,
        keepSource: true,
        showOverflow: true,
        height: 520,
        loading: false,
        stripe: true,
        rowConfig: { isHover: true, keyField: 'id' },
        columnConfig: { resizable: true },
        columns: [
            { type: "seq", width: 45 },
            { field: 'modelName', title: '模板名称', minWidth: 120 },
            { field: 'remark', title: '备注', minWidth: 120 },
            { field: 'activeFlag', title: '状态', width: 90, slots: { default: 'activeFlag' } },
            { field: 'createTime', title: '创建时间', minWidth: 120 },
            { field: 'createUserName', title: '创建人', minWidth: 80 },
            { title: '操作', slots: { default: 'actions' }, width: 135, fixed: 'right' }
        ],
        data: []
    })
    const receivableActionOptions: ActionOptions[] = [
        {
            value: BaseFeesetAction.EDIT,
            label: "编辑",
            color: "#0078f3",
            icon: Edit,
            permissions: ['sys:receivableModel:edit'],
            isDisabled: true
        },
        {
            value: BaseFeesetAction.DELETE,
            label: "删除",
            type: "danger",
            icon: Delete,
            permissions: ['sys:receivableModel:delete']
        },
        {
            value: BaseFeesetAction.VIEW,
            label: "查看",
            color: "#01aee6",
            icon: Odometer,
            permissions: ['sys:receivableModel:edit'],
        },
        {
            value: BaseFeesetAction.FEESET_ACTIVE,
            label: "激活",
            islabel: "停用",
            color: "#409eff",
            type: "primary",
            icon: Refresh,
            permissions: ['sys:receivableModel:active']
        },
    ]

    return {
        receivableGridRef,
        receivableListOptions,
        receivableActionOptions
    }
}

export { useReceivableModel }