import { toUnderScoreCase } from '@/utils/stringUtils.js'
// 构建table基本请求---带分页
export function genTableRequest(baseTableQuery) {
    // 构建sortBy的集合
    let sortBy = []
    for (const [key, value] of baseTableQuery.sortBy) {
        sortBy.push({
            column: toUnderScoreCase(key),
            asc: value
        })
    }
    return {
        pageNo: baseTableQuery.currentPage,
        pageSize: baseTableQuery.pageSize,
        sortBy: sortBy.reverse(),
        standId: baseTableQuery.standId,
        userName: baseTableQuery.userName
    }
}

/**
 * 向options中添加全部这个选项
 * @param {*} options 
 * @returns 
 */
export function addAllOptionOfOptions(options) {
    const allOption = [
        {
            value: -99,
            label: '全部'
        }
    ]
    return allOption.concat(options)
}