using DevExpress.XtraBars.Docking2010.Customization; using DevExpress.XtraBars.Docking2010.Views.WindowsUI; using DeviceRepair.Models; using DeviceRepairAndOptimization.Biz; using DeviceRepairAndOptimization.Common; using DeviceRepairAndOptimization.Pages.DriveInformation; using DeviceRepairAndOptimization.Pages.DriveMaintenance; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace DeviceRepairAndOptimization.Pages { public partial class page_DriveListInfo : FormBase { /// /// 数据加载 /// /// List GetDatas() { try { APIResponseData apiResponseData = DeviceManager.Instance.GetQuery(EditSearch.Text.Trim()); return apiResponseData.ToDeserializeObject>(); } catch (Exception) { throw; } } public page_DriveListInfo() { InitializeComponent(); } /// /// 窗体加载完成 /// /// /// private void page_DriveListInfo_Load(object sender, EventArgs e) { // 关闭列头右键菜单 gridView1.OptionsMenu.EnableColumnMenu = false; gridView1.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll | DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveVertScroll; BindData(); } void BindData() { try { splashScreenManager1.ShowWaitForm(); List lst = GetDatas(); gridControl1.DataSource = lst; gridView1.BestFitColumns(); splashScreenManager1.TryCloseWait(); } catch (Exception ex) { splashScreenManager1.TryCloseWait(); XtraMessageBoxHelper.Error(ex.Message); } } /// /// 搜索 /// /// /// private void btn_Filter_Click(object sender, EventArgs e) { BindData(); } /// /// 显示维修记录 /// /// /// private void btn_DeviceOperation_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { if (gridView1.FocusedRowHandle >= 0) { View_DriveInfomationModel entity = (View_DriveInfomationModel)gridView1.GetRow(gridView1.FocusedRowHandle); switch (e.Button.Tag + "") { case "logs": //xuc_RepairLogLst _form = new xuc_RepairLogLst(entity.AutoID); //FlyoutAction action = new FlyoutAction() { Caption = "维修记录", Description = "" }; //FlyoutCommand command1 = new FlyoutCommand() { Text = "确认", Result = DialogResult.OK }; //action.Commands.Add(command1); //Predicate predicate = (A) => //{ // return true; //}; //FlyoutDialog.Show(GlobalInfo._RootForm, _form, action, new FlyoutProperties() { Style = FlyoutStyle.Popup }, predicate); break; case "edit": if (!GlobalInfo.HasRole("BIZ_DEVICELEDGER_EDIT")) { XtraMessageBoxHelper.Error($"当前账号缺少此操作的权限"); return; } Page_DriveInfoEdit view2 = new Page_DriveInfoEdit("编辑", entity); if (view2.ShowDialog() == DialogResult.OK) { XtraMessageBoxHelper.Info("操作成功!"); BindData(); } break; default: break; } } } catch (Exception ex) { BindData(); XtraMessageBoxHelper.Error(ex.Message); } } /// /// 新增 /// /// /// private void btn_Add_Click(object sender, EventArgs e) { try { if (!GlobalInfo.HasRole("BIZ_DEVICELEDGER_ADD")) { XtraMessageBoxHelper.Error($"当前账号缺少此操作的权限"); return; } Page_DriveInfoEdit view = new Page_DriveInfoEdit(); if (view.ShowDialog() == DialogResult.OK) { XtraMessageBoxHelper.Info("操作成功!"); BindData(); } } catch (Exception ex) { BindData(); XtraMessageBoxHelper.Error(ex.Message); } } } }