bug
lu
7 天以前 d157667c10afbda2cf8005459bffa78f40d1b033
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
using DevExpress.Utils;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
 
namespace Gs.DevApp.DevFrm.Rpt
{
    public partial class WomShjh : DevExpress.XtraEditors.XtraForm
    {
        private readonly string _webServiceName = "QL/";
        public WomShjh()
        {
            InitializeComponent();
            //增加时,默认组织
            string deftOrg = UtilityHelper.GetFirstOrg(ucLookOrg1);
            dateEdit1.DateTime = DateTime.Now;
            dateEdit2.DateTime = DateTime.Now.AddDays(30);
            this.gridView1.OptionsView.ShowGroupPanel = false;
            tips.Appearance.BackColor = Color.LightBlue; // 设置背景颜色
            tips.Appearance.ForeColor = Color.Black; // 设置前景色(文字颜色)
            gridView1.MouseMove += (s, e) =>
            {
                try
                {
                    GridHitInfo hi = gridView1.CalcHitInfo(new Point(e.X, e.Y));
                    if (hi.InRowCell)
                    {
                        int cuRowHandle = hi.RowHandle;
                        if (cuRowHandle < 0)
                            return;
                        DataRow curRow = gridView1.GetDataRow(cuRowHandle);
                        var column = hi.Column;
                        string showTxt = curRow[column.FieldName].ToString();
                        ToolTipControllerShowEventArgs aa = new ToolTipControllerShowEventArgs();
                        aa.AllowHtmlText = DefaultBoolean.True;
                        aa.Title = column.Caption; //HTML, 粗体 
                        aa.ToolTip = showTxt; //断行 
                        aa.ShowBeak = true;
                        aa.Rounded = true; ////圆角 
                        aa.RoundRadius = 7; //圆角率 
                                            // aa.ToolTipType = ToolTipType.SuperTip; //超级样式,可多行或显示图标 
                        aa.ToolTipType = ToolTipType.Standard;//标准样式,可显示鸟嘴。 
                        aa.IconType = ToolTipIconType.Information; //消息图标 
                        aa.IconSize = ToolTipIconSize.Small; //大图标 
                        tips.ShowHint(aa);
                    }
                    else
                        tips.HideHint();
                }
                catch (Exception exception)
                {
                }
            };
            gridView1.OptionsFind.AlwaysVisible = true; // 始终显示查找面板
            gridView1.OptionsFind.ShowClearButton = true; // 显示清除按钮
            gridView1.OptionsFind.ShowCloseButton = true; // 显示关闭按钮
            gridView1.IndicatorWidth = 60;
            gridView1.OptionsView.ColumnAutoWidth = false;//自动调整列宽
            gridView1.CustomDrawRowIndicator += (s, e) =>
            {
                if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                    e.Info.DisplayText = (e.RowHandle + 1).ToString();
            };
            gridView1.CustomDrawEmptyForeground += (s, e) =>
            {
                var str = "暂未查找到匹配的数据!";
                var f = new Font("微软雅黑", 16);
                var r = new Rectangle(gridView1.GridControl.Width / 2 - 100,
                    e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                e.Graphics.DrawString(str, f, Brushes.Gray, r);
            };
            gridView1.ShowFindPanel(); // 显示查找面板
            getPageList();
            btnQuery.Click += (s, e) =>
            {
                getPageList();
            };
        }
 
        /// <summary>
        /// </summary>
        /// <param name="curPage">第几页</param>
        /// <param name="pageSize">每页几条</param>
        private void getPageList()
        {
            gcMain1.DataSource = null;
            var _obj = new
            {
                orgId = "",//主建
                beginDate = DateTime.Now.AddMonths(-1).ToString(),
                endDate = DateTime.Now.ToString()
            };
            var json = JsonConvert.SerializeObject(_obj);
            try
            {
                var strReturn = UtilityHelper.HttpPost("",
                    _webServiceName + "GetShjhList", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strReturn);
                if (_rtn.rtnCode > 0)
                {
                    JObject _job = JObject.Parse(strReturn);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
                    {
                        array.Add(a);
                    }
                    DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                    gcMain1.BindingContext = new BindingContext();
                    if (dt.Rows.Count > 0)
                    {
                        gcMain1.DataSource = dt;
                        gcMain1.ForceInitialize();
                        gridView1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
                }
                else
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
 
        /// <summary>
        /// 查看详细
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rptBtnView_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            string itemId = "";
            string orgId = ucLookOrg1.GetId();
            string beginDate = dateEdit1.DateTime.ToString();
            string endDate = dateEdit2.DateTime.ToString();
            Form frm = new WomShjhShow(orgId, beginDate, endDate, itemId);
            frm.ShowDialog();
        }
 
    }
}