import request from '@/utils/request'

/** 接口 */
const Api = {
	list: '/api/sys/dict/data/list'
}

/** 单据类型查询 */
export function list(data){
    
	return request({
		url: Api.list,
		params: data,
		method: 'get'
	})
}

// 适配于 uni-select 下拉值数据中需要text字段的渲染
export async function getDictionary(dictType ){	
	var dictionary =[];
	let responseData = await request({
		url: Api.list,
		params: {'code': dictType},
		method: 'get'
	}).then(response => {
		dictionary = response.data;
		dictionary.map((item) => {
			item.text = item.label,
			item.value = item.value
		});
	}).catch((e)=>{
		console.log("获取下拉值数据时出现异常",e)
	});
	return dictionary
}