123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Text;
- using System.Collections;
- using Bowin.Common.Utility;
- using Bowin.Web.Controls.Mvc;
- using EMIS.Utility;
- using EMIS.Web.Controls;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EvaluationManage.EvaluationTable;
- using EMIS.CommonLogic.EvaluationManage.EvaluationTable;
- namespace EMIS.Web.Controllers.EvaluationManage.EvaluationTable
- {
- [Authorization]
- public class EvaluationFormController : Controller
- {
- public Lazy<IEvaluationTargetServices> EvaluationTargetServices { get; set; }
- public Lazy<IEvaluationNormServices> EvaluationNormServices { get; set; }
- public Lazy<IEvaluationProjectServices> EvaluationProjectServices { get; set; }
- /// <summary>
- /// 评价表格页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 评价表格标题
- /// </summary>
- /// <returns></returns>
- public JsonResult FormTitle()
- {
- ArrayList formTitleList = new ArrayList();
- formTitleList.Add(new { field = "OrderNo", title = "次序", align = "center", width = "150" });
- formTitleList.Add(new { field = "EvaluationProjectName", title = "评价项目", align = "center", width = "350", formatter = "formatCellTooltip" });
- formTitleList.Add(new { field = "Weight", title = "权重", align = "center", width = "100" });
- formTitleList.Add(new { field = "EvaluationNormName", title = "评分标准", align = "center", width = "250" });
- return Json(new { UpTitle = JsonHelper.ToJSON(formTitleList) }, JsonRequestBehavior.AllowGet);
- }
- /// <summary>
- /// 评价表格内容
- /// </summary>
- /// <returns></returns>
- public JsonResult Content(Guid? evaluationTableID)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var evaluationTargetViewList = EvaluationTargetServices.Value.GetEvaluationTargetViewList(configuretView, null, null, evaluationTableID, null)
- .Select(x => new { x.EvaluationTargetID, x.EvaluationNormID, x.Name, x.Weight }).ToList();
- int i = 1;
- StringBuilder strRows = new StringBuilder();
- foreach (var evaluationTargetView in evaluationTargetViewList)
- {
- StringBuilder strRowtg = new StringBuilder();
- var tgNormNames = string.Join(" ", EvaluationNormServices.Value.GetEvaluationNormDetailViewList(configuretView, evaluationTargetView.EvaluationNormID).Select(s => s.Name + s.Weight));
- strRowtg.Append("{");
- strRowtg.Append("\"OrderNo\":\"" + evaluationTargetView.Name + "\"");
- strRowtg.Append(",\"EvaluationProjectName\":\"\"");
- strRowtg.Append(",\"Weight\":\"" + evaluationTargetView.Weight + "\"");
- strRowtg.Append(",\"EvaluationNormName\":\"" + tgNormNames + "\"");
- strRowtg.Append("}");
- if (string.IsNullOrEmpty(strRows.ToString()))
- {
- strRows.Append(strRowtg);
- }
- else
- {
- strRows.Append("," + strRowtg);
- }
- var evaluationProjectViewList = EvaluationProjectServices.Value.GetEvaluationProjectViewList(configuretView, null, null, evaluationTableID, evaluationTargetView.EvaluationTargetID)
- .Select(x => new { x.EvaluationProjectID, x.OrderNo, x.Name, x.Weight }).ToList();
- int j = 1;
- var evaluationNormDetailViewList = EvaluationNormServices.Value.GetEvaluationNormDetailViewList(configuretView, evaluationTargetView.EvaluationNormID).ToList();
- foreach (var evaluationProjectView in evaluationProjectViewList)
- {
- var prNormNames = string.Join(" ", evaluationNormDetailViewList.Select((s, index) => s.Name + "<input type='radio' name='" + j + "" + i + "'>"));
- StringBuilder strRowpr = new StringBuilder();
- strRowpr.Append("{");
- strRowpr.Append("\"OrderNo\":\"" + evaluationProjectView.OrderNo + "\"");
- strRowpr.Append(",\"EvaluationProjectName\":\"" + evaluationProjectView.Name + "\"");
- strRowpr.Append(",\"Weight\":\"" + evaluationProjectView.Weight + "\"");
- strRowpr.Append(",\"EvaluationNormName\":\"" + prNormNames + "\"");
- strRowpr.Append("}");
- if (string.IsNullOrEmpty(strRows.ToString()))
- {
- strRows.Append(strRowpr);
- }
- else
- {
- strRows.Append("," + strRowpr);
- }
- j++;
- }
- i++;
- }
- return Json(new { rows = strRows.ToString(), total = 0 }, JsonRequestBehavior.AllowGet);
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var evaluationParticipateTypeID = Request.Form["EvaluationParticipateTypeDropdown"].ParseStrTo<Guid>();
- var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo<Guid>();
- var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|