SOURCE

const mockRandom = Mock.Random

let plantList = ['铁心车间', '油箱车间', '绝缘车间', '线圈车间', '总装车间']
let plantCodeList = ['TX', 'YX', 'JY', 'XQ', 'ZZ']
let plantObjList = []

for (let i = 0; i < plantList.length; i++) {
    plantObjList.push({
        'label': plantList[i],
        'value': plantCodeList[i]
    })
}
mockRandom.extend({
    plantData: function (min, max) {
        min = min < 0 ? 0 : min;
        max = max > 5 ? 5 : max;
        let list = [];
        mockRandom.range(min, max).forEach(i => {
            list.push(plantObjList[i]);
        })
        return list;
    }
})

console.log(mockRandom.plantData(1,5));
console 命令行工具 X clear

                    
>
console