接口 查询下拉数据框
下拉的数据展示之后端接口
[HttpGet("GetFaultReasonDrop")]
public IActionResult GetFaultReasonDrop()
{
var response = _MachineFaultreasonService.GetList()
.Where(it => it.Status == "0")
.Select(it => new
{
id = it.Id,
dictLabel = it.FaultReasonname,
dictValue = it.FaultReasoncode,
});
return SUCCESS(response);
}
export function GetFaultReasonDrop() {
return request({
url: 'MACHINE/MMachineFaultreason/GetFaultReasonDrop',
method: 'get'
})
}
GetFaultReasonDrop().then((res) => {
if (res.code == 200) {
this.exceptionReasonOptions = res.data
}
})
<el-option v-for="item in exceptionReasonOptions" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>