1
lu
2024-10-24 ada663bd38bc0c46d10d3a5955289a5ede463a2d
DevApp/Gs.DevApp/UserControl/UcToolBarMenu.cs
@@ -96,22 +96,22 @@
        public List<string> actions { get; }
        /// <summary>
        /// 报表类型,在数据库中要唯一,否则会保存不了报表设计
        /// 报表,在数据库中要唯一,如:存储过程名{入参1名|入参值,入参2名|入参值}
        /// </summary>
        public string rptService { get; set; }
        public string rptParameter { get; set; }
        /// <summary>
        /// 导出服务名
        /// 导出,视图名,如:视图名{入参1名|入参值,入参2名|入参值}
        /// </summary>
        public string xlsOutView { get; set; }
        public string xlsOutParameter { get; set; }
        /// <summary>
        /// 导入服务名
        /// 导入
        /// </summary>
        public string xlsInService { get; set; }
        /// <summary>
        /// 审核参数,形如:MES_HOLIDAY,check_date,check_status,check_by
        /// 审核参数,表名,字段名,如:MES_HOLIDAY,check_date,check_status,check_by
        /// </summary>
        public string chkParameter { get; set; }
        #endregion
@@ -271,81 +271,82 @@
        private void BtnOut_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (string.IsNullOrEmpty(this.xlsOutView))
            {
                ToolBox.MsgHelper.ShowError("没有指定导出服务,请联系开发人员获取支持!");
                return;
            }
            using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
            {
                folderBrowserDialog.Description = "选择导出文件的保存路径";
                DialogResult dialogResult = folderBrowserDialog.ShowDialog();
                if (dialogResult == DialogResult.OK)
                {
                    string _folder = folderBrowserDialog.SelectedPath;
                    var _obj = new Gs.DevApp.Entity.XlsOutModel(this.xlsOutView);
                    try
                    {
                        string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView", JsonConvert.SerializeObject(_obj));
                        ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                        if (_rtn.rtnCode > 0)
                        {
                            string _file = _rtn.rtnData.fileUrl.ToString();
                            string _folderName = _folder + "\\" + _file.Replace("down/", "");
                            string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file;
                            using (WebClient client = new WebClient())
                            {
                                client.DownloadFile(_url, _folderName);
                            }
                            ToolBox.MsgHelper.ShowInformation("导出成功!");
                        }
                        else
                        {
                            ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                        }
                    }
                    catch (Exception ex)
                    {
                        ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                    }
                }
            }
            //if (string.IsNullOrEmpty(this.xlsOutView))
            //{
            //    ToolBox.MsgHelper.ShowError("没有指定导出服务,请联系开发人员获取支持!");
            //    return;
            //}
            //using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
            //{
            //    folderBrowserDialog.Description = "选择导出文件的保存路径";
            //    DialogResult dialogResult = folderBrowserDialog.ShowDialog();
            //    if (dialogResult == DialogResult.OK)
            //    {
            //        string _folder = folderBrowserDialog.SelectedPath;
            //        var _obj = new Gs.DevApp.Entity.XlsOutModel(this.xlsOutView);
            //        try
            //        {
            //            string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView", JsonConvert.SerializeObject(_obj));
            //            ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
            //            if (_rtn.rtnCode > 0)
            //            {
            //                string _file = _rtn.rtnData.fileUrl.ToString();
            //                string _folderName = _folder + "\\" + _file.Replace("down/", "");
            //                string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file;
            //                using (WebClient client = new WebClient())
            //                {
            //                    client.DownloadFile(_url, _folderName);
            //                }
            //                ToolBox.MsgHelper.ShowInformation("导出成功!");
            //            }
            //            else
            //            {
            //                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            //            }
            //        }
            //        catch (Exception ex)
            //        {
            //            ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            //        }
            //    }
            //}
        }
        private void BtnReport_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (string.IsNullOrEmpty(this.rptService))
            if (string.IsNullOrEmpty(this.rptParameter))
            {
                ToolBox.MsgHelper.ShowError("没有指定报表类型,请联系开发人员获取支持!");
                ToolBox.MsgHelper.ShowError("没有指定报表参数,请联系技术开发人员!");
                return;
            }
            bool _bl = false;
            _bl = _ckRptService();
            if (_bl)
            {
                Gs.DevApp.DevFrm.Rpt.RptPreview frm = new Gs.DevApp.DevFrm.Rpt.RptPreview(this.rptService);
                Gs.DevApp.DevFrm.Rpt.RptPreview frm = new Gs.DevApp.DevFrm.Rpt.RptPreview(this.rptParameter);
                frm.Show();
                return;
            }
            ToolBox.MsgHelper.ShowError("还没有设计模板,请先设计模板!");
            ToolBox.MsgHelper.ShowError("没有设计模板,请先设计模板!");
            return;
        }
        private void BtnDesign_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (string.IsNullOrEmpty(this.rptService))
            if (string.IsNullOrEmpty(this.rptParameter))
            {
                ToolBox.MsgHelper.ShowError("没有指定报表类型,请联系开发人员获取支持!");
                ToolBox.MsgHelper.ShowError("没有指定报表参数,请联系技术开发人员!");
                return;
            }
            bool _bl = false;
            _bl = _ckRptService();
            //如果已经有模板了,直接打开
            //如果已经有模板了,直接打开设置模板
            if (_bl)
            {
                Gs.DevApp.DevFrm.Sys.EasyRptDesign frm = new Gs.DevApp.DevFrm.Sys.EasyRptDesign(this.rptService);
                Gs.DevApp.DevFrm.Sys.EasyRptDesign frm = new Gs.DevApp.DevFrm.Sys.EasyRptDesign(this.rptParameter);
                frm.Show();
                return;
            }
            //否则向导设计模板
            UserControl.ShowRptWizard rptWizard = new ShowRptWizard(this.rptService);
            UserControl.ShowRptWizard rptWizard = new ShowRptWizard(this.rptParameter);
            rptWizard.ShowDialog();
        }
@@ -519,6 +520,7 @@
                      );
                        if (ld1 == true)
                        {
                            btnEsc.Visibility = btnSave.Visibility = btnLoad.Visibility = BarItemVisibility.Always;
                            btnAdd.Visibility = BarItemVisibility.Always;
                            _enabledList.Add(item.Name);
@@ -547,6 +549,19 @@
                        {
                            item.Visibility = BarItemVisibility.Always;
                            //准备启用
                            _enabledList.Add(item.Name);
                            continue;
                        }
                    }
                    ///具有联动关系的按钮(提交检验),
                    if (item.Caption == "提交检验")
                    {
                        bool ld1 = dt.AsEnumerable().Any(row => row.Field<string>("name") == "提交检验"
                      );
                        if (ld1 == true)
                        {
                            btnJianYan.Visibility = btnFjianYan.Visibility = btnLoad.Visibility = BarItemVisibility.Always;
                            btnJianYan.Visibility = BarItemVisibility.Always;
                            _enabledList.Add(item.Name);
                            continue;
                        }
@@ -596,7 +611,7 @@
            {
                var _obj = new
                {
                    reportType = this.rptService,
                    rptParameter = this.rptParameter,
                };
                string strJson = UtilityHelper.HttpPost("", "Report/GetTemplate", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
@@ -611,6 +626,7 @@
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                return true;
            }
            return false;
        }
    }
}