这种是普通页面上的下拉框的后台代码
///
/// 初始化仓库下拉框列表
///
///
public ActionResult FormInitRepertoryList()
{
var data = sysRepertoryApp.GetList(null);
Dictionary
foreach (SysRepertoryEntity item in data)
{
var fieldItem = new
{
encode = item.F_Repertory_Id,
fullname = item.F_Repertory_Name
};
dictionary.Add(fieldItem.encode, fieldItem);
}
return Content(dictionary.ToJson());
}
页面
vm中的Data
RepertoryList: []
vm中的方法
//初始化仓库下拉框
FormInitRepertoryList() {
$.ajax({
type: "POST",
url: "/SystemOrder/InventoryRecord/FormInitRepertoryList",
data: JSON.stringify(this.page),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
vm.RepertoryList = data;
setTimeout(function () { vm.$Spin.hide(); }, 1000);
console.log(data);
}
});
},