标签:fun filter help style pos bsp queryable entity else
<div class="layui-form-item"> <label class="layui-form-label">所属级别:</label> <div class="layui-input-inline"> <input type="hidden" id="nItemType" name="nItemType" value="" /> @*@Html.DropDownListFor(m => m.MeID, MenuHelper.GetMe(), new { @jqverify = "required", @jqerror = "请选择级别" })**@ <select name="itemselect" id="itemselect" lay-filter="itemselect" @(Type != 0 ? "disabled" : "")> <option value="0">选择级别</option> @{ //foreach (DoingStudy.Entity.News_Menu iModel in new DoingStudy.Repository.News_Menu().IQueryable("MenuID", 0)) foreach (DoingStudy.Entity.News_Menu iModel in new DoingStudy.Repository.News_Menu().IQueryable("PID", 0)) { string sKey = string.Empty; if (nMenuID == iModel.MenuID) { sKey = " selected=\"selected\" "; } <option @sKey value="@iModel.MenuID">@iModel.MenuName</option> } } </select> </div> <div class="layui-input-inline"> <select name="ProfessionID" id="ProfessionID"> @{ <option value="0">全部 </option> if (nMenuID != 0) { List<DoingStudy.Entity.News_Menu> NModel = new DoingStudy.Repository.News_Menu().FindList("PID", nMenuID); for (var i = 0; i < NModel.Count; i++) { string sKey2 = string.Empty; if (ExistID == NModel[i].MenuID) { sKey2 = " selected=\"selected\" "; } <option @sKey2 value="@NModel[i].MenuID">@NModel[i].MenuName</option> } } } </select> </div>
<script> layui.use(‘myform‘); layui.use("form", function () { var form = layui.form(); form.on(‘select(itemselect)‘, function (data) { FillCity(data.value); document.getElementById(‘nItemType‘).value = $("#itemselect").val(); }); //资讯类型 form.on(‘radio(NewsType)‘, function (data) { if (data.value == 3) { $("#divvideo").show(); } else { if (data.value == 0) { $("#divphoto").hide(); } else { $("#divphoto").show(); } $("#divvideo").hide(); } }); }); function FillCity(provinceId) { $.ajax({ url: "/NewsManage/News/GetModuleChildList?pId=" + provinceId, type: "GET", dataType: "JSON", success: function (cities) { $("#ProfessionID").html(""); $.each(cities, function (i, city) { $("#ProfessionID").append(("<option value=‘" + city.Value + "‘>" + city.Text + "</option>")); }); layui.use("form", function () { var form = layui.form(); form.render(); }); } }); } </script>
[HttpGet] public string GetModuleChildList(int pId) { return System.Web.Mvc.MenuHelper.GetModule(pId).ToJson(); }//get请求
[HttpGet]
public ActionResult JsonList()
{
int itemselect = ConvertHelper.SafeRequest("itemselect",0);//一级
int ProfessionID = ConvertHelper.SafeRequest("ProfessionID", 0);//二级
int sMenuID = 0;
if (ProfessionID != 0)
{
sMenuID = ProfessionID;
}
else {
sMenuID = itemselect;
}
string sTitle = ConvertHelper.SafeString(Request["txtTitle"], "");
PageModel page = PageModelInstance.GetInstance();
page.PageSize = pageSize;
page.PageIndex = nowPage;
DataTable dtList = new DoingStudy.Repository.News_News().GetList(sTitle, sNewsType, sMenuID, 0, IsAudit, IsHead, pageSize, nowPage, out RowsCount);
[HttpPost]
public ActionResult Edit(DoingStudy.Entity.News_News model)
{
DoingStudy.Repository.News_News adminRep = new DoingStudy.Repository.News_News();
int itemselect = ConvertHelper.SafeRequest("itemselect", 0);//一级
int ProfessionID = ConvertHelper.SafeRequest("ProfessionID", 0);//二级
if (ProfessionID != 0)
{
model.MenuID = ProfessionID;
}
标签:fun filter help style pos bsp queryable entity else
原文地址:https://www.cnblogs.com/LiDouDou/p/10177434.html