| | |
| | | { |
| | | public partial class SysMenuAdd : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public event EventHandler<UpdateParentEventArgs> UpdateParent; |
| | | |
| | | public SysMenuAdd(string guid) |
| | | { |
| | | InitializeComponent(); |
| | |
| | | lbGuid.Text = guid; |
| | | getModel(); |
| | | } |
| | | |
| | | private void TxtMenuType_TextChanged(object sender, EventArgs e) |
| | | { |
| | | if (txtMenuType.SelectedIndex == 1) |
| | |
| | | |
| | | private void BtnSave_Click(object sender, EventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(txtMenuType.Text.Trim()) || txtMenuType.SelectedIndex == 0) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("菜单类型不能为空!"); |
| | | txtMenuType.Focus(); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(txtMenuName.Text.Trim())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("菜单名称不能为空!"); |
| | | txtMenuName.Focus(); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(txtMenuType.Text.Trim())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("菜单类型不能为空!"); |
| | | txtMenuType.Focus(); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(txtStatus.Text.Trim())) |
| | | if (string.IsNullOrEmpty(txtStatus.Text.Trim()) || txtStatus.SelectedIndex == 0) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("菜单状态不能为空!"); |
| | | txtStatus.Focus(); |
| | |
| | | strJson = UtilityHelper.HttpPost("", "MenuAction/EditModel", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson); |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) { getTree(); } |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | UpdateParent?.Invoke(this, new UpdateParentEventArgs { Data = "" }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | private void getTree() |
| | | { |
| | | Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "desc", "", ""); |
| | | Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "asc", "", " and category=1"); |
| | | string json = JsonConvert.SerializeObject(pgq); |
| | | string strReturn = ""; |
| | | try |
| | |
| | | strReturn = UtilityHelper.HttpPost("", "MenuAction/GetListPage", json); |
| | | ReturnModel<PageListModel> dd = UtilityHelper.GetTableByJson(strReturn); |
| | | DataTable dt = dd.rtnData.list; |
| | | txtParentMenuName.Properties.DataSource = dt; |
| | | txtParentMenuName.Properties.DisplayMember = "name"; |
| | | txtParentMenuName.Properties.DisplayMember = "name"; |
| | | txtParentMenuName.Properties.TreeList.KeyFieldName = "guid"; |
| | | txtParentMenuName.Properties.TreeList.ParentFieldName = "upGuid"; |
| | | //txtParentMenuName.Properties.ValueMember = "guid"; |
| | | txtParentMenuName.Properties.DisplayMember = "name"; |
| | | txtParentMenuName.Properties.DataSource = dt; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | private void cleanTxt() |
| | | { |
| | | //guid = lbGuid.Text.Trim(),//主建 |
| | | // upGuid = _upGuid,//上级的主建 |
| | | // name = txtMenuName.Text.Trim(),//名称 |
| | | // icon = txtMenuIco.Text,//菜单图标 |
| | | // status = txtStatus.SelectedIndex,//状态 |
| | | // formPath = txtFormNamespace.Text.Trim(),//窗体路径 |
| | | // idx = int.Parse(txtIdx.Value.ToString()),//排序 |
| | | // category = txtMenuType.SelectedIndex,//类型 |
| | | |
| | | //if(lbGuid.Text) |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |