介绍:一般用于表格部分数据自动初始化(下拉框) 这里功能做的稍微多一点,prop 验证有 字符串 数组,前者全等或者包含、后者包含
import {
getResProductJson,
...........
//这里是请求api
} from './beforeInitFunc'
import { getResOrderTypeJson } from '@/utils/beforeInitFunc'
// 相应的转换规则
// 这里的 prop 建议都 取一个 res 前缀,这样无理 productId 还是 resProductId 都能匹配成功
export const transform = new Map(
[
// [{value, label: }]
// // 有 json 后缀
[getResProductJson, { label: 'productModel', value: 'productId', prop: 'resProductId' }],
// 一些是没走 json 提供的,就是说单独对全表拿再拿走对应的字段,就是请求返回的数据会比较大
[getResSuppliers, { label: 'supplierNameFull', value: 'supplierId', prop: 'resSupplierId' }],
[getPersonalJson, { label: 'name', value: 'id', prop: 'createById' }],
// 通用函数,用来做一些特殊需求的
[any, { label: 'name', value: 'id' }]
]
)
export default function beforeInit (columnArr = [],