ng-alain动态表单下拉框动态数据

ui: SFUISchema = {
	$repoId: {
		widget: 'select',
		placeholder: '请选择',
		allowClear: true,
		serverSearch: true,
		// 懒加载数据,利用管道,插入数据项
		asyncData: () => this.dictService.findAllByDictNo('XXX').pipe(map((value) => {
			const result = [];
			for (let i = 0; i < value.body.length; i++) {
				if (value.body[i].multiTenancyId === null) {
					result.push({ label: value.body[i].itemText, value: value.body[i].id });
				}
			}
			return result;
		})),
		// 搜索时进行懒加载
		onSearch: (keyword: string) => this.dictService.findAllByDictNo(keyword).toPromise(),
    },
    // ...
}

你可能感兴趣的:(angular)