181 lines
6.1 KiB
C#
181 lines
6.1 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 数据加载
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
List<View_DriveInfomationModel> GetDatas()
|
|
{
|
|
try
|
|
{
|
|
APIResponseData apiResponseData = DeviceManager.Instance.GetQuery(EditSearch.Text.Trim());
|
|
return apiResponseData.ToDeserializeObject<List<View_DriveInfomationModel>>();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
|
|
}
|
|
|
|
public page_DriveListInfo()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 窗体加载完成
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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<View_DriveInfomationModel> lst = GetDatas();
|
|
gridControl1.DataSource = lst;
|
|
//gridView1.BestFitColumns();
|
|
splashScreenManager1.TryCloseWait();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
splashScreenManager1.TryCloseWait();
|
|
XtraMessageBoxHelper.Error(ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 搜索
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btn_Filter_Click(object sender, EventArgs e)
|
|
{
|
|
BindData();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示维修记录
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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<DialogResult> 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);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
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);
|
|
}
|
|
}
|
|
|
|
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
if (e.Column.FieldName == "EquipmentStatus")
|
|
{
|
|
int status;
|
|
if (int.TryParse(e.Value+"", out status) && status>0)
|
|
{
|
|
e.DisplayText = "启用";
|
|
}
|
|
else
|
|
{
|
|
e.DisplayText = "停用";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|