这种是普通页面上的下拉框的后台代码
/// <summary>
/// 初始化仓库下拉框列表
/// </summary>
/// <returns></returns>
public ActionResult FormInitRepertoryList()
{
var data = sysRepertoryApp.GetList(null);
Dictionary<string, object> dictionary = new Dictionary<string, object>();
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());
}
页面
<i-select v-model="InventoryRecordInfo.F_Repertory_Id" :label-in-value="true" filterable>
<i-option v-for="item in RepertoryList" :value="item.encode" :key="item.fullname">{{ item.fullname }}</i-option>
</i-select>
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);
}
});
},
网友评论