From 6672a68f11621bc7a49265fc47d4c1e7ae4c060d Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期三, 13 十月 2021 15:45:17 +0800 Subject: [PATCH] 专家测试--题库管理 完成 --- zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicjiexiController.cs | 211 +++ zhengcaioa/Model/ExpertTestTopicjiexi.cs | 22 zhengcaioa/IServices/IExpertTestTopicService.cs | 38 zhengcaioa/zhengcaioa/Views/ExpertTestTopic/print.cshtml | 99 + zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Edit.cshtml | 340 ++++++ zhengcaioa/DTO/ExpertTestTopicanwserDTO.cs | 20 zhengcaioa/zhengcaioa/Startup.cs | 1 zhengcaioa/Services/ExpertTestTopicService.cs | 670 ++++++++++++ zhengcaioa/DTO/ExpertTestTopicDTO.cs | 62 + zhengcaioa/Model/ExpertTestTopic.cs | 24 zhengcaioa/Model/zhengcaioaContext.cs | 176 +++ zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs | 9 zhengcaioa/Model/ExpertTestTopicanwser.cs | 21 zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Edit.cshtml | 642 ++++++++++++ zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml | 179 +++ zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs | 515 +++++++++ zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Index.cshtml | 116 ++ zhengcaioa/DTO/ExpertTestTopicjiexiDTO.cs | 23 18 files changed, 3,168 insertions(+), 0 deletions(-) diff --git a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs index c859ac4..c83d6de 100644 --- a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs +++ b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs @@ -273,6 +273,15 @@ CreateMap<AdmGoodsRecord, AdmGoodsRecordDTO>(); CreateMap<AdmGoodsRecordDTO, AdmGoodsRecord>(); + CreateMap<ExpertTestTopic, ExpertTestTopicDTO>(); + CreateMap<ExpertTestTopicDTO, ExpertTestTopic>(); + + CreateMap<ExpertTestTopicanwser, ExpertTestTopicanwserDTO>(); + CreateMap<ExpertTestTopicanwserDTO, ExpertTestTopicanwser>(); + + CreateMap<ExpertTestTopicjiexi, ExpertTestTopicjiexiDTO>(); + CreateMap<ExpertTestTopicjiexiDTO, ExpertTestTopicjiexi>(); + } } } diff --git a/zhengcaioa/DTO/ExpertTestTopicDTO.cs b/zhengcaioa/DTO/ExpertTestTopicDTO.cs new file mode 100644 index 0000000..0c29c0a --- /dev/null +++ b/zhengcaioa/DTO/ExpertTestTopicDTO.cs @@ -0,0 +1,62 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class ExpertTestTopicDTO + { + public string Id { get; set; } + public string Topictype { get; set; } + public string Zhishitype { get; set; } + public string Topic { get; set; } + public string Area { get; set; } + public string Zhongdian { get; set; } + public string JiexiStatus { get; set; } + public string ShenpiStatus { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + + public string TopictypeName { get; set; } + + public string ZhishitypeName { get; set; } + + public string ZhongdianName { get; set; } + + public string JiexiStatusName { get; set; } + + public string ShenpiStatusName { get; set; } + + public string AreaName { get; set; } + + public List<ExpertTestTopicanwserDTO> expertTestTopicanwserDTOs { get; set; } + + public string[] anwserno { get; set; } + public string[] Anwser { get; set; } + public string[] Shifouzhengqu { get; set; } + + } + + + public class ExpertTestTopicDTOSearch : SearchEntity + { + public string Topictype { get; set; } + public string Zhishitype { get; set; } + public string Zhongdian { get; set; } + + public string JiexiStatus { get; set; } + + public string ShenpiStatus { get; set; } + + public string Topic { get; set; } + + public string TopicId { get; set; } + + public string Falv { get; set; } + + + } +} diff --git a/zhengcaioa/DTO/ExpertTestTopicanwserDTO.cs b/zhengcaioa/DTO/ExpertTestTopicanwserDTO.cs new file mode 100644 index 0000000..270fbe4 --- /dev/null +++ b/zhengcaioa/DTO/ExpertTestTopicanwserDTO.cs @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class ExpertTestTopicanwserDTO + { + public string Id { get; set; } + public string Topic { get; set; } + public string Anwserno { get; set; } + public string Anwser { get; set; } + public string Shifouzhengqu { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/DTO/ExpertTestTopicjiexiDTO.cs b/zhengcaioa/DTO/ExpertTestTopicjiexiDTO.cs new file mode 100644 index 0000000..cb82aa0 --- /dev/null +++ b/zhengcaioa/DTO/ExpertTestTopicjiexiDTO.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class ExpertTestTopicjiexiDTO + { + public string Id { get; set; } + public string Topic { get; set; } + public string Falv { get; set; } + public string FalvName { get; set; } + public string Fatiao { get; set; } + public string Jiexi { get; set; } + public string Flag { get; set; } + public string FlagName { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/IServices/IExpertTestTopicService.cs b/zhengcaioa/IServices/IExpertTestTopicService.cs new file mode 100644 index 0000000..7307dc9 --- /dev/null +++ b/zhengcaioa/IServices/IExpertTestTopicService.cs @@ -0,0 +1,38 @@ +锘縰sing DTO; +using System; +using System.Collections.Generic; +using System.Text; + + +namespace IServices +{ + public interface IExpertTestTopicService + { + ResultEntity save(ExpertTestTopicDTO dto); + + ExpertTestTopicDTO Get(string id); + + ResultDataEntity<ExpertTestTopicDTO> SearchByPaging(ExpertTestTopicDTOSearch searchEntity); + + ResultEntity ModifyStatus(string id, string userid); + + List<ExpertTestTopicDTO> GetList(); + + ResultEntity saveanwser(ExpertTestTopicanwserDTO dto); + + List<ExpertTestTopicanwserDTO> GetListanwser(string topicId=""); + + ResultEntity savejiexi(ExpertTestTopicjiexiDTO dto); + + List<ExpertTestTopicjiexiDTO> GetListjiexi(string topicId = ""); + + ResultEntity shenpi(ExpertTestTopicDTO dto); + + ResultDataEntity<ExpertTestTopicjiexiDTO> SearchByPagingjiexi(ExpertTestTopicDTOSearch searchEntity); + + ExpertTestTopicjiexiDTO Getjiexi(string id); + + ResultEntity ModifyStatusjiexi(string id, string userid); + + } +} diff --git a/zhengcaioa/Model/ExpertTestTopic.cs b/zhengcaioa/Model/ExpertTestTopic.cs new file mode 100644 index 0000000..3b7fbfd --- /dev/null +++ b/zhengcaioa/Model/ExpertTestTopic.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class ExpertTestTopic + { + public string Id { get; set; } + public string Topictype { get; set; } + public string Zhishitype { get; set; } + public string Topic { get; set; } + public string Area { get; set; } + public string Zhongdian { get; set; } + public string JiexiStatus { get; set; } + public string ShenpiStatus { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/Model/ExpertTestTopicanwser.cs b/zhengcaioa/Model/ExpertTestTopicanwser.cs new file mode 100644 index 0000000..b9fe13c --- /dev/null +++ b/zhengcaioa/Model/ExpertTestTopicanwser.cs @@ -0,0 +1,21 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class ExpertTestTopicanwser + { + public string Id { get; set; } + public string Topic { get; set; } + public string Anwserno { get; set; } + public string Anwser { get; set; } + public string Shifouzhengqu { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/Model/ExpertTestTopicjiexi.cs b/zhengcaioa/Model/ExpertTestTopicjiexi.cs new file mode 100644 index 0000000..b1aa203 --- /dev/null +++ b/zhengcaioa/Model/ExpertTestTopicjiexi.cs @@ -0,0 +1,22 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class ExpertTestTopicjiexi + { + public string Id { get; set; } + public string Topic { get; set; } + public string Falv { get; set; } + public string Fatiao { get; set; } + public string Jiexi { get; set; } + public string Flag { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs index 3d34a3d..e07f6f2 100644 --- a/zhengcaioa/Model/zhengcaioaContext.cs +++ b/zhengcaioa/Model/zhengcaioaContext.cs @@ -114,6 +114,9 @@ public virtual DbSet<Expert> Experts { get; set; } public virtual DbSet<ExpertOrderDispatch> ExpertOrderDispatches { get; set; } public virtual DbSet<ExpertPromote> ExpertPromotes { get; set; } + public virtual DbSet<ExpertTestTopic> ExpertTestTopics { get; set; } + public virtual DbSet<ExpertTestTopicanwser> ExpertTestTopicanwsers { get; set; } + public virtual DbSet<ExpertTestTopicjiexi> ExpertTestTopicjiexis { get; set; } #region 琛屾斂绠$悊 public virtual DbSet<AskLeave> AskLeaves { get; set; } @@ -6441,6 +6444,179 @@ .IsUnicode(false) .HasColumnName("sort"); }); + + modelBuilder.Entity<ExpertTestTopic>(entity => + { + entity.ToTable("expert_test_topic"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.Area) + .HasMaxLength(50) + .HasColumnName("area"); + + entity.Property(e => e.Creater) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("creater") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Createtime) + .HasColumnType("datetime") + .HasColumnName("createtime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.JiexiStatus) + .HasMaxLength(1) + .HasColumnName("jiexi_status") + .HasDefaultValueSql("('D')"); + + entity.Property(e => e.Modifier) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("modifier") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Modifytime) + .HasColumnType("datetime") + .HasColumnName("modifytime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.RecStatus) + .IsRequired() + .HasMaxLength(1) + .HasColumnName("rec_status") + .HasDefaultValueSql("('A')"); + + entity.Property(e => e.ShenpiStatus) + .HasMaxLength(1) + .HasColumnName("shenpi_status") + .HasDefaultValueSql("('D')"); + + entity.Property(e => e.Topic) + .HasMaxLength(4000) + .HasColumnName("topic"); + + entity.Property(e => e.Topictype) + .HasMaxLength(50) + .HasColumnName("topictype"); + + entity.Property(e => e.Zhishitype) + .HasMaxLength(50) + .HasColumnName("zhishitype"); + + entity.Property(e => e.Zhongdian) + .HasMaxLength(1) + .HasColumnName("zhongdian"); + }); + + modelBuilder.Entity<ExpertTestTopicanwser>(entity => + { + entity.ToTable("expert_test_topicanwser"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.Anwser) + .HasMaxLength(500) + .HasColumnName("anwser"); + + entity.Property(e => e.Anwserno) + .HasMaxLength(50) + .HasColumnName("anwserno"); + + entity.Property(e => e.Creater) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("creater") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Createtime) + .HasColumnType("datetime") + .HasColumnName("createtime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.Modifier) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("modifier") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Modifytime) + .HasColumnType("datetime") + .HasColumnName("modifytime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.RecStatus) + .IsRequired() + .HasMaxLength(1) + .HasColumnName("rec_status") + .HasDefaultValueSql("('A')"); + + entity.Property(e => e.Shifouzhengqu) + .HasMaxLength(1) + .HasColumnName("shifouzhengqu") + .HasDefaultValueSql("('D')"); + + entity.Property(e => e.Topic) + .HasMaxLength(50) + .HasColumnName("topic"); + }); + + modelBuilder.Entity<ExpertTestTopicjiexi>(entity => + { + entity.ToTable("expert_test_topicjiexi"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.Creater) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("creater") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Createtime) + .HasColumnType("datetime") + .HasColumnName("createtime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.Falv) + .HasMaxLength(50) + .HasColumnName("falv"); + + entity.Property(e => e.Flag) + .HasMaxLength(1) + .HasColumnName("flag"); + + entity.Property(e => e.Fatiao) + .HasMaxLength(500) + .HasColumnName("fatiao"); + + entity.Property(e => e.Jiexi) + .HasMaxLength(4000) + .HasColumnName("jiexi"); + + entity.Property(e => e.Modifier) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("modifier") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Modifytime) + .HasColumnType("datetime") + .HasColumnName("modifytime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.RecStatus) + .IsRequired() + .HasMaxLength(1) + .HasColumnName("rec_status") + .HasDefaultValueSql("('A')"); + + entity.Property(e => e.Topic) + .HasMaxLength(50) + .HasColumnName("topic"); + }); + #region 琛屾斂绠$悊瀹炰綋绫� modelBuilder.Entity<SignIn>(entity => { diff --git a/zhengcaioa/Services/ExpertTestTopicService.cs b/zhengcaioa/Services/ExpertTestTopicService.cs new file mode 100644 index 0000000..36a11e2 --- /dev/null +++ b/zhengcaioa/Services/ExpertTestTopicService.cs @@ -0,0 +1,670 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AutoMapper; +using DTO; +using IServices; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; +using zhengcaioa.Models; + + + +namespace Services +{ + public class ExpertTestTopicService: IExpertTestTopicService + { + private readonly zhengcaioaContext _context; + private readonly IMapper _mapper; + public ExpertTestTopicService(zhengcaioaContext context, IMapper mapper) + { + _context = context; + _mapper = mapper; + } + public ResultEntity save(ExpertTestTopicDTO dto) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + var checkUserSn = _context.ExpertTestTopics.Where(x => x.Topic == dto.Topic && x.RecStatus == "A" && x.Id != dto.Id).FirstOrDefault(); + if (checkUserSn != null && (string.IsNullOrWhiteSpace(dto.Id) || (!string.IsNullOrWhiteSpace(dto.Id) && checkUserSn.Id != dto.Id))) + { + resultEntity.Result = false; + resultEntity.Message = "璇曢閲嶅"; + return resultEntity; + } + + + var entity = _mapper.Map<ExpertTestTopic>(dto); + + + if (String.IsNullOrEmpty(entity.Id)) + { + entity.Id = Guid.NewGuid().ToString(); + dto.Id = entity.Id; + _context.ExpertTestTopics.Add(entity); + } + else + { + var updateproject = _context.ExpertTestTopics.Find(entity.Id); + + updateproject.Topictype = entity.Topictype; + updateproject.Zhishitype = entity.Zhishitype; + + + updateproject.Topic = entity.Topic; + updateproject.Area = entity.Area; + + + updateproject.Zhongdian = entity.Zhongdian; + updateproject.JiexiStatus = entity.JiexiStatus; + updateproject.ShenpiStatus = entity.ShenpiStatus; + + updateproject.RecStatus = entity.RecStatus; + updateproject.Modifier = entity.Modifier; + updateproject.Modifytime = entity.Modifytime; + + } + + + //瀛愯〃 + + var expertTestTopicanwsers = _context.ExpertTestTopicanwsers.Where(x => x.Topic == dto.Id).ToList(); + if (expertTestTopicanwsers != null && expertTestTopicanwsers.Count > 0) + { + foreach (var expertTestTopicanwser in expertTestTopicanwsers) + { + _context.ExpertTestTopicanwsers.Remove(expertTestTopicanwser); + } + } + var anwserno = dto.anwserno; + if (anwserno != null && anwserno.Length > 0) + { + for (int i = 0; i < anwserno.Length; i++) + { + if (!string.IsNullOrEmpty(dto.anwserno[i])) + { + ExpertTestTopicanwser expertTestTopicanwser = new ExpertTestTopicanwser(); + + expertTestTopicanwser.Id = Guid.NewGuid().ToString(); + expertTestTopicanwser.Topic = dto.Id; + + + expertTestTopicanwser.Anwserno = dto.anwserno[i]; + expertTestTopicanwser.Anwser = dto.Anwser[i]; + expertTestTopicanwser.Shifouzhengqu = dto.Shifouzhengqu[i]; + expertTestTopicanwser.Creater = dto.Modifier; + expertTestTopicanwser.Createtime = DateTime.Now; + expertTestTopicanwser.Modifier = dto.Modifier; + expertTestTopicanwser.Modifytime = DateTime.Now; + _context.ExpertTestTopicanwsers.Add(expertTestTopicanwser); + } + } + } + + + _context.SaveChanges(); + resultEntity.ReturnID = entity.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + + public ExpertTestTopicDTO Get(string id) + { + + var entity = _context.ExpertTestTopics.Find(id); + + if (entity.RecStatus != "A") + { + entity = new ExpertTestTopic(); + } + + var result = _mapper.Map<ExpertTestTopicDTO>(entity); + + + return result; + } + + public ResultDataEntity<ExpertTestTopicDTO> SearchByPaging(ExpertTestTopicDTOSearch searchEntity) + { + + + + ResultDataEntity<ExpertTestTopicDTO> data = new ResultDataEntity<ExpertTestTopicDTO>(); + List<ExpertTestTopicDTO> list = new List<ExpertTestTopicDTO>(); + + + + var listCode = (from a in _context.SysCodeDtls + join b in _context.SysCodes + on a.CodeId equals b.Id + where a.RecStatus == "A" + && b.RecStatus == "A" + select new CodeDataEntity() + { + CodeId = b.Id, + CodeTable = b.CodeTable, + CodeField = b.CodeField, + CodeSn = a.CodeSn, + Comments = a.Comments, + Contents = a.Contents, + RecStatus = a.RecStatus, + Sort = a.Sort + } + ); + + ///ExpertTestTopics + var query = (from a in _context.ExpertTestTopics + + + join e in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "topictype") + on a.Topictype equals e.CodeSn + into esssss + from eee in esssss.DefaultIfEmpty() + + join f in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "zhishitype") + on a.Zhishitype equals f.CodeSn + into fsssss + from fff in fsssss.DefaultIfEmpty() + + join g in listCode.Where(x => x.CodeTable == "system" && x.CodeField == "shifou") + on a.Zhongdian equals g.CodeSn + into gsssss + from ggg in gsssss.DefaultIfEmpty() + + join h in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "jiexi_status") + on a.JiexiStatus equals h.CodeSn + into hsssss + from hhh in hsssss.DefaultIfEmpty() + + + join i in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "shenpi_status") + on a.ShenpiStatus equals i.CodeSn + into isssss + from iii in isssss.DefaultIfEmpty() + + + join j in listCode.Where(x => x.CodeTable == "expert_test_topicjiexi" && x.CodeField == "falv") + on a.ShenpiStatus equals j.CodeSn + into jsssss + from jjj in jsssss.DefaultIfEmpty() + + + join k in _context.Areas + on a.Area equals k.CodeId + into ksssss + from kkk in ksssss.DefaultIfEmpty() + + + //join ll in ( from aaa in _context.ExpertTestTopicanwsers.Where(x => x.RecStatus == "A").Select(e => new { Topic = e.Topic, Items = e.Anwserno + " " + e.Anwser + "</br>" }).GroupBy(e => new { e.Topic }) + // let ids = aaa.Select(b => b.Items.ToString()).ToArray() + + // select new { Topic = aaa.Key.Topic, Items = String.Join(" ", ids) } + // //.Select(eg => new + // //{ + // // Topic = eg.Key.Topic, + // // //EmployeeName = eg.First().EmployeeName, + // // Items = eg.Select(i => i.Anwserno) + " " + eg.Select(i => i.Anwser) + "</br>", + // //}) + // ) + //on a.Id equals ll.Topic + // into llsssss + //from llll in llsssss.DefaultIfEmpty() + + + + + + + where a.RecStatus == "A" + + && (string.IsNullOrWhiteSpace(searchEntity.Topictype) || a.Topictype == searchEntity.Topictype.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Zhishitype) || a.Zhishitype == searchEntity.Zhishitype.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Zhongdian) || a.Zhongdian == searchEntity.Zhongdian.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.JiexiStatus) || a.JiexiStatus == searchEntity.JiexiStatus.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.ShenpiStatus) || a.ShenpiStatus == searchEntity.ShenpiStatus.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Topic) || a.Topic.Contains(searchEntity.Topic.Trim())) + + + + + + + select new ExpertTestTopicDTO + { + Id = a.Id, + Topictype = a.Topictype, + TopictypeName = eee.Comments, + Zhishitype = a.Zhishitype, + ZhishitypeName = fff.Comments, + Topic = a.Topic + "</br>" /*+ llll.Items*/, + Zhongdian = a.Zhongdian, + ZhongdianName = ggg.Comments, + JiexiStatus = a.JiexiStatus, + JiexiStatusName = hhh.Comments, + ShenpiStatus = a.ShenpiStatus, + ShenpiStatusName = iii.Comments, + Area = a.Area, + AreaName = kkk.Name, + + + Creater = a.Creater, + Createtime = a.Createtime, + + RecStatus = a.RecStatus, + Modifier = a.Modifier, + Modifytime = a.Modifytime, + + } + ).OrderByDescending(x => x.Modifytime).ToList(); + + + + + + + //if (searchEntity.totalrows == 0) + searchEntity.totalrows = query.Count(); + var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + + var lianlist11 = lianlist.Select(x => x.Id).ToList(); + + var querydels = (from aaa in _context.ExpertTestTopicanwsers.Where(x => x.RecStatus == "A" && lianlist11.Contains(x.Topic) ) select aaa).ToList(); + + foreach(var lian in lianlist) + { + var querydel = querydels.Where(x => x.Topic == lian.Id).OrderBy(x=>x.Anwserno).ToList(); + + foreach (var quer in querydel) + { + lian.Topic += quer.Anwserno + " " + quer.Anwser + " </br>"; + } + } + + + data.LoadData(searchEntity, lianlist); + return data; + } + + + + + + + /// <summary> + /// 淇敼涓昏〃鐘舵�� + /// </summary> + /// <param name="id">涓籭d</param> + /// <param name="userid">鐢ㄦ埛</param> + /// <returns></returns> + public ResultEntity ModifyStatus(string id, string userid) + { + ResultEntity result = new ResultEntity(); + result.Result = true; + + var model = _context.ExpertTestTopics.Find(id); + if (model != null) + { + model.RecStatus = "D"; + model.Modifier = userid; + model.Modifytime = DateTime.Now; + _context.SaveChanges(); + } + + return result; + } + + + /// <summary> + /// 鑾峰彇鎵�鏈夋湁鏁堣鑹� + /// </summary> + /// <returns></returns> + public List<ExpertTestTopicDTO> GetList() + { + + + var listRole = _context.ExpertTestTopics.Where(r => r.RecStatus == "A").ToList(); + + + var list = _mapper.Map<List<ExpertTestTopicDTO>>(listRole); + return list; + } + + public ResultEntity saveanwser(ExpertTestTopicanwserDTO dto) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + + var entity = _mapper.Map<ExpertTestTopicanwser>(dto); + + + if (String.IsNullOrEmpty(entity.Id)) + { + entity.Id = Guid.NewGuid().ToString(); + dto.Id = entity.Id; + _context.ExpertTestTopicanwsers.Add(entity); + } + else + { + var updateproject = _context.ExpertTestTopicanwsers.Find(entity.Id); + + updateproject.Topic = entity.Topic; + updateproject.Anwserno = entity.Anwserno; + + + updateproject.Anwser = entity.Anwser; + updateproject.Shifouzhengqu = entity.Shifouzhengqu; + + + + + updateproject.RecStatus = entity.RecStatus; + updateproject.Modifier = entity.Modifier; + updateproject.Modifytime = entity.Modifytime; + + } + + _context.SaveChanges(); + resultEntity.ReturnID = entity.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + + /// <summary> + /// 鑾峰彇鎵�鏈夋湁鏁堣鑹� + /// </summary> + /// <returns></returns> + public List<ExpertTestTopicanwserDTO> GetListanwser(string topicId = "") + { + + + var listRole = _context.ExpertTestTopicanwsers.Where(r => r.RecStatus == "A").ToList(); + if (!string.IsNullOrEmpty(topicId)) + { + listRole = listRole.Where(x=>x.Topic == topicId).OrderBy(x=>x.Anwserno).ToList(); + } + + var list = _mapper.Map<List<ExpertTestTopicanwserDTO>>(listRole); + return list; + } + + + public ResultEntity savejiexi(ExpertTestTopicjiexiDTO dto) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + + var entity = _mapper.Map<ExpertTestTopicjiexi>(dto); + + + if (String.IsNullOrEmpty(entity.Id)) + { + entity.Id = Guid.NewGuid().ToString(); + dto.Id = entity.Id; + _context.ExpertTestTopicjiexis.Add(entity); + } + else + { + var updateproject = _context.ExpertTestTopicjiexis.Find(entity.Id); + + updateproject.Topic = entity.Topic; + updateproject.Falv = entity.Falv; + + + updateproject.Fatiao = entity.Fatiao; + updateproject.Jiexi = entity.Jiexi; + + updateproject.Flag = entity.Flag; + + + updateproject.RecStatus = entity.RecStatus; + updateproject.Modifier = entity.Modifier; + updateproject.Modifytime = entity.Modifytime; + + } + + _context.SaveChanges(); + resultEntity.ReturnID = entity.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + + /// <summary> + /// 鑾峰彇鎵�鏈夋湁鏁堣鑹� + /// </summary> + /// <returns></returns> + public List<ExpertTestTopicjiexiDTO> GetListjiexi(string topicId = "") + { + var listCode = (from a in _context.SysCodeDtls + join b in _context.SysCodes + on a.CodeId equals b.Id + where a.RecStatus == "A" + && b.RecStatus == "A" + select new CodeDataEntity() + { + CodeId = b.Id, + CodeTable = b.CodeTable, + CodeField = b.CodeField, + CodeSn = a.CodeSn, + Comments = a.Comments, + Contents = a.Contents, + RecStatus = a.RecStatus, + Sort = a.Sort + } + ); + + var listRole = (from a in _context.ExpertTestTopicjiexis + + join e in listCode.Where(x => x.CodeTable == "expert_test_topicjiexi" && x.CodeField == "falv") + on a.Falv equals e.CodeSn + into esssss + from eee in esssss.DefaultIfEmpty() + + join f in listCode.Where(x => x.CodeTable == "system" && x.CodeField == "shifou") + on a.Flag equals f.CodeSn + into fsssss + from fff in fsssss.DefaultIfEmpty() + + + where a.RecStatus == "A" + && (string.IsNullOrWhiteSpace(topicId) || a.Topic == topicId.Trim()) + select new ExpertTestTopicjiexiDTO + { + Id = a.Id, + Topic = a.Topic, + Falv = a.Falv, + FalvName = eee.Comments, + Fatiao = a.Fatiao, + Flag = a.Flag, + FlagName = fff.Comments, + Jiexi = a.Jiexi, + + Creater = a.Creater, + Createtime = a.Createtime, + + RecStatus = a.RecStatus, + Modifier = a.Modifier, + Modifytime = a.Modifytime, + + } + ).OrderBy(x => x.Flag).ThenByDescending(x=>x.Modifytime).ToList(); + + return listRole; + } + + + + public ResultEntity shenpi(ExpertTestTopicDTO dto) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + var updateproject = _context.ExpertTestTopics.Find(dto.Id); + + updateproject.ShenpiStatus = dto.ShenpiStatus; + updateproject.Modifier = dto.Modifier; + updateproject.Modifytime = dto.Modifytime; + + + + _context.SaveChanges(); + resultEntity.ReturnID = dto.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + + + public ResultDataEntity<ExpertTestTopicjiexiDTO> SearchByPagingjiexi(ExpertTestTopicDTOSearch searchEntity) + { + + + + ResultDataEntity<ExpertTestTopicjiexiDTO> data = new ResultDataEntity<ExpertTestTopicjiexiDTO>(); + List<ExpertTestTopicjiexiDTO> list = new List<ExpertTestTopicjiexiDTO>(); + + + + + var listCode = (from a in _context.SysCodeDtls + join b in _context.SysCodes + on a.CodeId equals b.Id + where a.RecStatus == "A" + && b.RecStatus == "A" + select new CodeDataEntity() + { + CodeId = b.Id, + CodeTable = b.CodeTable, + CodeField = b.CodeField, + CodeSn = a.CodeSn, + Comments = a.Comments, + Contents = a.Contents, + RecStatus = a.RecStatus, + Sort = a.Sort + } + ); + + var query = (from a in _context.ExpertTestTopicjiexis + + join e in listCode.Where(x => x.CodeTable == "expert_test_topicjiexi" && x.CodeField == "falv") + on a.Falv equals e.CodeSn + into esssss + from eee in esssss.DefaultIfEmpty() + + join f in listCode.Where(x => x.CodeTable == "system" && x.CodeField == "shifou") + on a.Flag equals f.CodeSn + into fsssss + from fff in fsssss.DefaultIfEmpty() + + + where a.RecStatus == "A" + && (string.IsNullOrWhiteSpace(searchEntity.TopicId) || a.Topic == searchEntity.TopicId.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Falv) || a.Falv == searchEntity.Falv.Trim()) + select new ExpertTestTopicjiexiDTO + { + Id = a.Id, + Topic = a.Topic, + Falv = a.Falv, + FalvName = eee.Comments, + Fatiao = a.Fatiao, + Flag = a.Flag, + FlagName = fff.Comments, + Jiexi = a.Jiexi, + + Creater = a.Creater, + Createtime = a.Createtime, + + RecStatus = a.RecStatus, + Modifier = a.Modifier, + Modifytime = a.Modifytime, + + } + ).OrderBy(x => x.Flag).ThenByDescending(x => x.Modifytime).ToList(); + + + + //if (searchEntity.totalrows == 0) + searchEntity.totalrows = query.Count(); + var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + + + + + data.LoadData(searchEntity, lianlist); + return data; + } + + public ExpertTestTopicjiexiDTO Getjiexi(string id) + { + + var entity = _context.ExpertTestTopicjiexis.Find(id); + + if (entity.RecStatus != "A") + { + entity = new ExpertTestTopicjiexi(); + } + + var result = _mapper.Map<ExpertTestTopicjiexiDTO>(entity); + + + return result; + } + + + /// <summary> + /// 淇敼涓昏〃鐘舵�� + /// </summary> + /// <param name="id">涓籭d</param> + /// <param name="userid">鐢ㄦ埛</param> + /// <returns></returns> + public ResultEntity ModifyStatusjiexi(string id, string userid) + { + ResultEntity result = new ResultEntity(); + result.Result = true; + + var model = _context.ExpertTestTopicjiexis.Find(id); + if (model != null) + { + model.RecStatus = "D"; + model.Modifier = userid; + model.Modifytime = DateTime.Now; + _context.SaveChanges(); + } + + return result; + } + } +} diff --git a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs new file mode 100644 index 0000000..4900f6e --- /dev/null +++ b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs @@ -0,0 +1,515 @@ +锘縰sing DTO; +using IServices; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading.Tasks; +using System.Transactions; +using zhengcaioa.IService; +using zhengcaioa.Models; + + +namespace zhengcaioa.Controllers.ExpertTest +{ + public class ExpertTestTopicController : Controller + { + private readonly ILogger<ExpertTestTopicController> _logger; + private readonly ILiaotianService _liaotianService; + private readonly IExpertTestTopicService _expertTestTopicService; + private readonly IAreaService _areaService; + private readonly IConfiguration _configuration; + private readonly IPltPageService _pltPageService; + private readonly IHttpClientFactory _clientFactory; + + + public ExpertTestTopicController(ILogger<ExpertTestTopicController> logger, ILiaotianService liaotianService, IExpertTestTopicService expertTestTopicService + , IAreaService areaService + , IConfiguration configuration + , IPltPageService pltPageService + , IHttpClientFactory clientFactory) + { + _logger = logger; + _liaotianService = liaotianService; + _expertTestTopicService = expertTestTopicService; + _areaService = areaService; + _configuration = configuration; + _pltPageService = pltPageService; + _clientFactory = clientFactory; + + } + + public IActionResult Index() + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + List<ActionEntity> actionlist = new List<ActionEntity>(); + ActionEntity actionEntity = new ActionEntity(); + actionEntity.OpenType = 0; + actionEntity.ActionUrl = ""; + actionEntity.ActionFun = "Search"; + actionEntity.PageIco = "fa fa-search"; + actionEntity.ActionName = "鏌ヨ"; + actionlist.Add(actionEntity); + + + + + + ActionEntity actionEntity1 = new ActionEntity(); + actionEntity1.OpenType = 0; + actionEntity1.ActionUrl = ""; + actionEntity1.ActionFun = "Add"; + actionEntity1.PageIco = "fa fa-plus"; + actionEntity1.ActionName = "鏂板"; + actionlist.Add(actionEntity1); + + + ActionEntity actionEntity2 = new ActionEntity(); + actionEntity2.OpenType = 0; + actionEntity2.ActionUrl = ""; + actionEntity2.ActionFun = "Print"; + actionEntity2.PageIco = "fa fa-print"; + actionEntity2.ActionName = "鎵撳嵃"; + actionlist.Add(actionEntity2); + + + ViewData["ActionInfo"] = actionlist; + + + + + ViewBag.topictype = _liaotianService.GetSYScode("expert_test_topic", "topictype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + ViewBag.zhishitype = _liaotianService.GetSYScode("expert_test_topic", "zhishitype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.zhongdian = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.jiexi_status = _liaotianService.GetSYScode("expert_test_topic", "jiexi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.shenpi_status = _liaotianService.GetSYScode("expert_test_topic", "shenpi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.Area = _areaService.GetList().Where(x => x.ParentId == "0 ").Select(x => new { code = x.CodeId, label = x.Name }).ToList(); + + + return View(); + + } + + public IActionResult GetList(ExpertTestTopicDTOSearch search) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + //search.Creater = curentuser.Id; + //JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver()); + return new JsonResult(_expertTestTopicService.SearchByPaging(search)); + } + + public IActionResult Edit(string id = null, string Topictype = "", string Zhishitype = "", string Area = "") + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + var expertTestTopicanwserDTOs = new List<ExpertTestTopicanwserDTO>(); + + ExpertTestTopicDTO dto = new ExpertTestTopicDTO(); + if (!String.IsNullOrEmpty(id)) + { + dto = _expertTestTopicService.Get(id); + expertTestTopicanwserDTOs = _expertTestTopicService.GetListanwser(id); + if (expertTestTopicanwserDTOs.Count == 0) + { + expertTestTopicanwserDTOs.Add(new ExpertTestTopicanwserDTO()); + } + + dto.expertTestTopicanwserDTOs = expertTestTopicanwserDTOs; + } + else + { + expertTestTopicanwserDTOs.Add(new ExpertTestTopicanwserDTO()); + dto.expertTestTopicanwserDTOs = expertTestTopicanwserDTOs; + dto.Topictype = Topictype; + dto.Zhishitype = Zhishitype; + dto.Area = Area; + } + + + + + + ViewBag.topictype = _liaotianService.GetSYScode("expert_test_topic", "topictype"); + + ViewBag.zhishitype = _liaotianService.GetSYScode("expert_test_topic", "zhishitype"); + ViewBag.zhongdian = _liaotianService.GetSYScode("system", "shifou").OrderByDescending(x=>x.Sort).ToList(); + ViewBag.jiexi_status = _liaotianService.GetSYScode("expert_test_topic", "jiexi_status"); + ViewBag.shenpi_status = _liaotianService.GetSYScode("expert_test_topic", "shenpi_status"); + ViewBag.Area = _areaService.GetList().Where(x => x.ParentId == "0 ").ToList(); + + + + List<PageEntity> pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/ExpertTestTopic/Index"); + + ViewData["pageEntities"] = pageEntities; + + ViewData.Model = dto; + return View(); + } + + + /// <summary> + /// 淇濆瓨 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + /// + [HttpPost] + public async Task<IActionResult> SaveAsync(ExpertTestTopicDTO data) + { + + ResultEntity resultEntity = new ResultEntity(); + + if (!string.IsNullOrEmpty(data.Id)) + { + + string api_domain = _configuration.GetSection("Elasticsearchurl").Value; + string url = $"{api_domain}/liaotian/person/" + data.Id; + //string requestJson = "{\"id\": \"" + Id + "\",\"question\": \"" + data.Question + "\",\"anwser\": \"" + data.Anwser + "\"}"; + try + { + string result = string.Empty; + Uri postUrl = new Uri(url); + + + + + var httpClient = _clientFactory.CreateClient(); + httpClient.Timeout = new TimeSpan(0, 0, 60); + var Result = await httpClient.DeleteAsync(postUrl); + result = Result.Content.ReadAsStringAsync().Result; + + Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(result); + + if (jobject["error"] == null && jobject["_shards"]["successful"].ToString() == "1") + { + resultEntity.Result = true; + } + else + { + resultEntity.Result = false; + } + + } + catch (Exception e) + { + resultEntity.Result = false; + throw e; + + + } + } + + using (TransactionScope scope = new TransactionScope()) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + data.RecStatus = "A"; + if (String.IsNullOrEmpty(data.Id)) + { + data.Creater = curentuser.Id; + data.Createtime = DateTime.Now; + data.ShenpiStatus = "D"; + data.JiexiStatus = "D"; + } + else + { + var ddd = _expertTestTopicService.Get(data.Id); + + data.ShenpiStatus = "D"; + data.JiexiStatus = ddd.JiexiStatus; + } + data.Modifier = curentuser.Id; + data.Modifytime = DateTime.Now; + + resultEntity = _expertTestTopicService.save(data); + scope.Complete(); + } + + + return new JsonResult(resultEntity); + } + + + /// <summary> + /// 瀹℃牳 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + [HttpPost] + [CheckLogin] + public async Task<string> ShenheAsync(String Id) + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = false; + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + + + + + var data = _expertTestTopicService.Get(Id); + var datadtls = _expertTestTopicService.GetListanwser(Id); + + data.ShenpiStatus = "A"; + data.Modifier = curentuser.Id; + data.Modifytime = DateTime.Now; + resultEntity = _expertTestTopicService.shenpi(data); + + string api_domain = _configuration.GetSection("Elasticsearchurl").Value; + string url = $"{api_domain}/liaotian/person/" + data.Id; + LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); + liaotianElasticsearchDTO.id = data.Id; + liaotianElasticsearchDTO.question = data.Topic; + liaotianElasticsearchDTO.anwser = data.Topic+" </br> "; + foreach(var datadtl in datadtls) + { + if (datadtl.Shifouzhengqu == "A") + { + liaotianElasticsearchDTO.anwser += "<font color=\"#FF0000\">"+datadtl.Anwserno + " " + datadtl.Anwser + "</font> </br> "; + } + else + { + liaotianElasticsearchDTO.anwser += datadtl.Anwserno + " " + datadtl.Anwser + " </br> "; + } + + } + + + + string requestJson = JsonConvert.SerializeObject(liaotianElasticsearchDTO); ;// "{\"id\": \"" + liaotianDTO.Id + "\",\"question\": \"" + liaotianDTO.Question.Replace("\n", "")+ "\",\"anwser\": \"" + liaotianDTO.Anwser.Replace("\n", "") + "\"}"; + + try + { + string result = string.Empty; + Uri postUrl = new Uri(url); + + using (HttpContent httpContent = new StringContent(requestJson)) + { + httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + + var httpClient = _clientFactory.CreateClient(); + httpClient.Timeout = new TimeSpan(0, 0, 60); + var Result = await httpClient.PutAsync(postUrl, httpContent); + result = Result.Content.ReadAsStringAsync().Result; + + + + } + + Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(result); + + if (jobject["error"] == null && jobject["_shards"]["successful"].ToString() == "1") + { + resultEntity.Result = true; + } + else + { + resultEntity.Result = false; + } + + } + catch (Exception e) + { + resultEntity.Result = false; + throw e; + + + } + + + + + + return JsonConvert.SerializeObject(resultEntity); + } + + + /// <summary> + /// 鎻愪氦骞跺鏍� + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + [HttpPost] + [CheckLogin] + public async Task<string> TijiaobingshenheAsync(ExpertTestTopicDTO data) + { + + ResultEntity resultEntity = new ResultEntity(); + using (TransactionScope scope = new TransactionScope()) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + data.RecStatus = "A"; + if (String.IsNullOrEmpty(data.Id)) + { + data.Creater = curentuser.Id; + data.Createtime = DateTime.Now; + data.ShenpiStatus = "A"; + data.JiexiStatus = "D"; + } + else + { + var ddd = _expertTestTopicService.Get(data.Id); + + data.ShenpiStatus = "A"; + data.JiexiStatus = ddd.JiexiStatus; + } + data.Modifier = curentuser.Id; + data.Modifytime = DateTime.Now; + + resultEntity = _expertTestTopicService.save(data); + scope.Complete(); + } + + data = _expertTestTopicService.Get(data.Id); + var datadtls = _expertTestTopicService.GetListanwser(data.Id); + string api_domain = _configuration.GetSection("Elasticsearchurl").Value; + string url = $"{api_domain}/liaotian/person/" + data.Id; + LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); + liaotianElasticsearchDTO.id = data.Id; + liaotianElasticsearchDTO.question = data.Topic; + liaotianElasticsearchDTO.anwser = data.Topic + " </br> "; + foreach (var datadtl in datadtls) + { + if (datadtl.Shifouzhengqu == "A") + { + liaotianElasticsearchDTO.anwser += "<font color=\"#FF0000\">" + datadtl.Anwserno + " " + datadtl.Anwser + "</font> </br>"; + } + else + { + liaotianElasticsearchDTO.anwser += datadtl.Anwserno + " " + datadtl.Anwser + " </br> "; + } + + } + + + + string requestJson = JsonConvert.SerializeObject(liaotianElasticsearchDTO); ;// "{\"id\": \"" + liaotianDTO.Id + "\",\"question\": \"" + liaotianDTO.Question.Replace("\n", "")+ "\",\"anwser\": \"" + liaotianDTO.Anwser.Replace("\n", "") + "\"}"; + + try + { + string result = string.Empty; + Uri postUrl = new Uri(url); + + using (HttpContent httpContent = new StringContent(requestJson)) + { + httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + + var httpClient = _clientFactory.CreateClient(); + httpClient.Timeout = new TimeSpan(0, 0, 60); + var Result = await httpClient.PutAsync(postUrl, httpContent); + result = Result.Content.ReadAsStringAsync().Result; + + + + } + + Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(result); + + if (jobject["error"] == null && jobject["_shards"]["successful"].ToString() == "1") + { + resultEntity.Result = true; + } + else + { + resultEntity.Result = false; + } + + } + catch (Exception e) + { + resultEntity.Result = false; + throw e; + + + } + + + + + return JsonConvert.SerializeObject(resultEntity); + } + + + + + /// <summary> + /// 鍒犻櫎涓讳俊鎭� + /// </summary> + /// <param name="info">瀹炰綋</param> + /// <returns></returns> + /// + public async Task<IActionResult> NullifyAsync(string Id = "") + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + + ResultEntity resultEntity = _expertTestTopicService.ModifyStatus(Id, curentuser.Id); + + string api_domain = _configuration.GetSection("Elasticsearchurl").Value; + string url = $"{api_domain}/liaotian/person/" + Id; + //string requestJson = "{\"id\": \"" + Id + "\",\"question\": \"" + data.Question + "\",\"anwser\": \"" + data.Anwser + "\"}"; + try + { + string result = string.Empty; + Uri postUrl = new Uri(url); + + + + + var httpClient = _clientFactory.CreateClient(); + httpClient.Timeout = new TimeSpan(0, 0, 60); + var Result = await httpClient.DeleteAsync(postUrl); + result = Result.Content.ReadAsStringAsync().Result; + + Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(result); + + if (jobject["error"] == null && jobject["_shards"]["successful"].ToString() == "1") + { + resultEntity.Result = true; + } + else + { + resultEntity.Result = false; + } + + } + catch (Exception e) + { + resultEntity.Result = false; + throw e; + + + } + + return new JsonResult(resultEntity); + } + + + + + public IActionResult print(ExpertTestTopicDTOSearch search) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + search.page = 1; + search.rows = 10000; + ViewBag.listExpertTestTopicDTO = _expertTestTopicService.SearchByPaging(search).DataList; + + + + return View(); + } + } +} diff --git a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicjiexiController.cs b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicjiexiController.cs new file mode 100644 index 0000000..c34a221 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicjiexiController.cs @@ -0,0 +1,211 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using AutoMapper; +using AngleSharp.Html.Parser; +using DTO; +using IServices; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Bot.Builder.Integration.AspNet.Core; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using System.Net.Http; +using System.Threading.Tasks; +using zhengcaioa.Models; +using zhengcaioa.IService; +using CommonToolsCore; +using Services; +using System.Transactions; + +namespace zhengcaioa.Controllers.ExpertTest +{ + public class ExpertTestTopicjiexiController : Controller + { + private readonly ILogger<ExpertTestTopicjiexiController> _logger; + private readonly ILiaotianService _liaotianService; + private readonly IExpertTestTopicService _expertTestTopicService; + + + + public ExpertTestTopicjiexiController(ILogger<ExpertTestTopicjiexiController> logger, ILiaotianService liaotianService, IExpertTestTopicService expertTestTopicService) + { + _logger = logger; + _liaotianService = liaotianService; + _expertTestTopicService = expertTestTopicService; + + + } + public IActionResult Index(string topocId="") + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + List<ActionEntity> actionlist = new List<ActionEntity>(); + ActionEntity actionEntity = new ActionEntity(); + actionEntity.OpenType = 0; + actionEntity.ActionUrl = ""; + actionEntity.ActionFun = "Search"; + actionEntity.PageIco = "fa fa-search"; + actionEntity.ActionName = "鏌ヨ"; + actionlist.Add(actionEntity); + + + + + + ActionEntity actionEntity1 = new ActionEntity(); + actionEntity1.OpenType = 0; + actionEntity1.ActionUrl = ""; + actionEntity1.ActionFun = "Add"; + actionEntity1.PageIco = "fa fa-plus"; + actionEntity1.ActionName = "鏂板"; + actionlist.Add(actionEntity1); + + + + + + ViewData["ActionInfo"] = actionlist; + + + + + ViewBag.Flag = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.falv = _liaotianService.GetSYScode("expert_test_topicjiexi", "falv").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + ViewBag.TopocId = topocId; + + + + return View(); + + } + + public IActionResult GetList(ExpertTestTopicDTOSearch search) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + //search.Creater = curentuser.Id; + //JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver()); + return new JsonResult(_expertTestTopicService.SearchByPagingjiexi(search)); + } + + public IActionResult Edit(string id = null, string topocId = "") + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + + ExpertTestTopicjiexiDTO dto = new ExpertTestTopicjiexiDTO(); + if (!String.IsNullOrEmpty(id)) + { + dto = _expertTestTopicService.Getjiexi(id); + } + else + { + dto.Topic = topocId; + } + + + + + + ViewBag.Flag = _liaotianService.GetSYScode("system", "shifou"); + ViewBag.falv = _liaotianService.GetSYScode("expert_test_topicjiexi", "falv"); + + ViewData.Model = dto; + return View(); + } + + + /// <summary> + /// 淇濆瓨 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + /// + [HttpPost] + public IActionResult Save(ExpertTestTopicjiexiDTO data) + { + // data.DocContent = data.DocContent.Replace("锛�", ";"); + ResultEntity resultEntity = new ResultEntity(); + using (TransactionScope scope = new TransactionScope()) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + data.RecStatus = "A"; + if (String.IsNullOrEmpty(data.Id)) + { + data.Creater = curentuser.Id; + data.Createtime = DateTime.Now; + } + data.Modifier = curentuser.Id; + data.Modifytime = DateTime.Now; + + var expertTestTopicDTO = _expertTestTopicService.Get(data.Topic); + expertTestTopicDTO.JiexiStatus = "A"; + resultEntity = _expertTestTopicService.save(expertTestTopicDTO); + if (data.Flag == "A") + { + //鍙兘鏈変竴涓富瑙f瀽 + var expertTestTopicjiexiDTOs = _expertTestTopicService.GetListjiexi(data.Topic); + if (!string.IsNullOrEmpty(data.Id)) + { + expertTestTopicjiexiDTOs = expertTestTopicjiexiDTOs.Where(x => x.Id != data.Id).ToList(); + } + foreach (var expertTestTopicjiexiDTO in expertTestTopicjiexiDTOs) + { + if (expertTestTopicjiexiDTO.Flag == "A") + { + expertTestTopicjiexiDTO.Flag = "D"; + resultEntity = _expertTestTopicService.savejiexi(expertTestTopicjiexiDTO); + } + } + } + else + { + //蹇呴』鏈変竴涓富瑙f瀽 + var expertTestTopicjiexiDTOs = _expertTestTopicService.GetListjiexi(data.Topic); + if (!string.IsNullOrEmpty(data.Id)) + { + expertTestTopicjiexiDTOs = expertTestTopicjiexiDTOs.Where(x => x.Id != data.Id).ToList(); + } + var boool = false; + foreach (var expertTestTopicjiexiDTO in expertTestTopicjiexiDTOs) + { + if (expertTestTopicjiexiDTO.Flag == "A") + { + boool = true; + } + } + if (!boool) + { + resultEntity.Result = false; + resultEntity.Message = "蹇呴』鏈変竴涓富瑙f瀽"; + return new JsonResult(resultEntity); + } + } + + resultEntity = _expertTestTopicService.savejiexi(data); + scope.Complete(); + } + + + return new JsonResult(resultEntity); + } + + + /// <summary> + /// 鍒犻櫎涓讳俊鎭� + /// </summary> + /// <param name="info">瀹炰綋</param> + /// <returns></returns> + /// + public IActionResult Nullify(string Id = "") + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + return new JsonResult(_expertTestTopicService.ModifyStatusjiexi(Id, curentuser.Id)); + } + } +} diff --git a/zhengcaioa/zhengcaioa/Startup.cs b/zhengcaioa/zhengcaioa/Startup.cs index 250630b..0fff994 100644 --- a/zhengcaioa/zhengcaioa/Startup.cs +++ b/zhengcaioa/zhengcaioa/Startup.cs @@ -151,6 +151,7 @@ services.AddScoped(typeof(IAskService), typeof(AskService)); services.AddScoped(typeof(IAdmGoodsRecordService), typeof(AdmGoodsRecordService)); + services.AddScoped(typeof(IExpertTestTopicService), typeof(ExpertTestTopicService)); //zcweb services.AddScoped(typeof(IDtChannelArticleNewsService), typeof(DtChannelArticleNewsService)); diff --git a/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Edit.cshtml b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Edit.cshtml new file mode 100644 index 0000000..a148667 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Edit.cshtml @@ -0,0 +1,642 @@ +锘緻model DTO.ExpertTestTopicDTO +@using DTO; +@using zhengcaioa.Models; +@{ + + + List<SysCodeDtl> topictype = ViewData["topictype"] as List<SysCodeDtl>; //棰樺瀷 + List<SysCodeDtl> zhishitype = ViewData["zhishitype"] as List<SysCodeDtl>; //鐭ヨ瘑鐐� + List<SysCodeDtl> zhongdian = ViewData["zhongdian"] as List<SysCodeDtl>; //閲嶇偣 + List<SysCodeDtl> jiexi_status = ViewData["jiexi_status"] as List<SysCodeDtl>; //瑙f瀽鐘舵�� + List<SysCodeDtl> shenpi_status = ViewData["shenpi_status"] as List<SysCodeDtl>; //瀹℃壒鐘舵�� + List<AreaDTO> Area = ViewData["Area"] as List<AreaDTO>; //鍖哄煙 + + List<ExpertTestTopicanwserDTO> expertTestTopicanwserDTOs = Model.expertTestTopicanwserDTOs; + + + List<DTO.PageEntity> pageEntities = ViewData["pageEntities"] as List<DTO.PageEntity>; //闂绫诲瀷 + var shenhesto = pageEntities.Where(x => x.PageName == "瀹℃牳").FirstOrDefault(); + string shenhe = ""; + if (shenhesto != null) + { + shenhe = shenhesto.PageName; + } + var tijiaobingshenhesto = pageEntities.Where(x => x.PageName == "鎻愪氦骞跺鏍�").FirstOrDefault(); + string tijiaobingshenhe = ""; + if (tijiaobingshenhesto != null) + { + tijiaobingshenhe = tijiaobingshenhesto.PageName; + } + +} +@{ + Layout = null; +} + +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content="ThemeBucket"> + <title>@(SiteConfig.SiteName)</title> + <link href="~/css/bootstrap.min.css" rel="stylesheet"> + <link href="~/css/font-awesome.min.css" rel="stylesheet"> + <link href="~/css/animate.min.css" rel="stylesheet"> + + @*<link href="~/css/plugins/iCheck/custom.css" rel="stylesheet">*@ + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/chosen/chosen.css" rel="stylesheet"> + @*<link href="~/js/plugins/layer/skin/layer.css" rel="stylesheet">*@ + @*<link href="~/css/plugins/datapicker/datepicker3.css" rel="stylesheet">*@ + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/toastr/toastr.min.css" rel="stylesheet" /> + <link href="~/css/plugins/webuploader/webuploader.css" rel="stylesheet" /> + + <style type="text/css"> + .webuploader-pick { + position: relative; + display: inline-block; + cursor: pointer; + background: #00b7ee; + padding: 8px 14px 7px 14px; + color: #fff; + text-align: center; + border-radius: 3px; + overflow: hidden; + } + + div.clearfix > label { + padding-top: 8px; + } + + .chosen-container { + border-radius: 1px; + border: 1px solid #e5e6e7; + } + + .col-md-1.control-label { + padding-right: 0px; + font-weight: 400; + } + </style> + + <!-- jqgrid--> + @*<link href="~/css/plugins/jqgrid/ui.jqgrid.css" rel="stylesheet">*@ + <script language="javascript" src="~/js/jquery.min.js" type="text/javascript"></script> + <script src="~/js/bootstrap.min.js"></script> + @*<script src="~/js/plugins/bootstro/bootstro.js"></script>*@ + + <!--瀹瑰櫒--> + @*<script language="javascript" src="~/js/datehelper.js" type="text/javascript"></script>*@ + @*<script language="javascript" src="~/js/plugins/query/jquery.query-object.js" type="text/javascript"></script>*@ + @*<script language="javascript" src="~/js/plugins/iCheck/icheck.min.js" type="text/javascript"></script>*@ + <script language="javascript" src="~/js/plugins/chosen/chosen.jquery.js" type="text/javascript"></script> + @*<script language="javascript" src="~/js/plugins/datapicker/bootstrap-datepicker.js" type="text/javascript"></script>*@ + <script language="javascript" src="~/js/plugins/layer/layer.js" type="text/javascript"></script> + @*<script src="~/js/plugins/jqgrid/jquery.jqGrid.min.js" type="text/javascript"></script>*@ + @*<script src="~/js/plugins/jqgrid/i18n/grid.locale-cn.js" type="text/javascript"></script>*@ + <script src="~/js/plugins/toastr/toastr.min.js" type="text/javascript"></script> + <script src="~/js/plugins/webuploader/webuploader.min.js"></script> + + <script language="javascript" src="~/js/common-layout.js" type="text/javascript"></script> + <script src="~/js/plugins/layer/laydate/laydate.js" type="text/javascript"></script> + @*<script src="~/js/plugins/iTexbox/itextbox.js" type="text/javascript"></script>*@ + @*<script src="~/js/plugins/iuploader/iuploader.js"></script>*@ + <script src="~/js/TUJS.js"></script> +</head> +<body class="gray-bg" style="overflow:auto"> + <form id="formtest"> + <div class="wrapper wrapper-content" id="ibox-content" style="padding:15px;"> + <div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5> <i class="fa fa-list"></i> 鍩烘湰淇℃伅</h5> + </div> + <div id="div_content" class="ibox-content" style="background-color:white;"> + <div class="row"> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">棰樺瀷<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <select id="Topictype" class="form-control" name="Topictype" data-placeholder="閫夋嫨 搴忓垪 ..."> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in topictype) + { + @if (!item.CodeSn.Equals(Model.Topictype)) + { + <option value="@item.CodeSn" hassubinfo="true"> + @item.Comments + </option> + } + else + { + <option value="@item.CodeSn" hassubinfo="true" selected="selected"> + @item.Comments + </option> + } + + } + + </select> + <input type="hidden" id="Id" name="Id" value="@Model.Id" /> + </div> + + + + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鐭ヨ瘑鐐�<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <select id="Zhishitype" class="form-control" name="Zhishitype" data-placeholder="閫夋嫨 搴忓垪 ..."> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in zhishitype) + { + @if (!item.CodeSn.Equals(Model.Zhishitype)) + { + <option value="@item.CodeSn" hassubinfo="true"> + @item.Comments + </option> + } + else + { + <option value="@item.CodeSn" hassubinfo="true" selected="selected"> + @item.Comments + </option> + } + + } + + </select> + + </div> + + + + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">鍖哄煙</label> + <div class="col-sm-2 col-md-2"> + <select id="Area" class="form-control" name="Area" data-placeholder="閫夋嫨 搴忓垪 ..."> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in Area) + { + @if (!item.CodeId.Equals(Model.Area)) + { + <option value="@item.CodeId" hassubinfo="true"> + @item.Name + </option> + } + else + { + <option value="@item.CodeId" hassubinfo="true" selected="selected"> + @item.Name + </option> + } + + } + + </select> + + </div> + + + + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label"> + 閲嶇偣鏍囨敞 + </label> + <div class="col-sm-2 col-md-2" grouptype="Vdata"> + @if ("A" == Model.Zhongdian) + { + <input type="checkbox" class="form-control" id="ZhongdianName" checked="checked" name="ZhongdianName" value="A" /> + } + else + { + <input type="checkbox" class="form-control" id="ZhongdianName" name="ZhongdianName" value="A" /> + } + <input type="hidden" id="Zhongdian" name="Zhongdian" value="" /> + + </div> + + + + </div> + + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + + + + + <label class="text-right col-sm-1 col-md-1 control-label">璇曢<i class="red">*</i></label> + <div class="col-sm-11 col-md-11"> + <textarea class="form-control bt" id="Topic" name="Topic" title="璇曢" isempty="" maxlength="4000" length="long" style="resize:none;overflow-y:hidden; min-height:60px;" onpropertychange="this.style.height=this.scrollHeight + 'px'" oninput="this.style.height=this.scrollHeight + 'px'">@Model.Topic</textarea> + + </div> + + + </div> + + <div id="addlist_3"> + @for (int i = 0; i < expertTestTopicanwserDTOs.Count; i++) + { + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">绛旀缂栧彿</label> + <div class="col-sm-2 col-md-2" style="width:5%;"> + <input class="form-control" label="绛旀缂栧彿" name="anwserno" labtype="txt" addvisible="true" editvisible="true" reg="" maxlength="50" ismust="true" type="text" value="@expertTestTopicanwserDTOs[i].Anwserno"> + </div> + <label class="text-right col-sm-1 col-md-1 control-label" style="width:30px;">绛旀</label> + <div class="col-sm-6 col-md-6" > + <input class="form-control" label="绛旀" name="Anwser" labtype="txt" addvisible="true" editvisible="true" maxlength="500" reg="" ismust="flase" type="text" value="@expertTestTopicanwserDTOs[i].Anwser"> + + </div> + + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label"> + 鏄惁姝g‘ + </label> + + + <div class="col-sm-1 col-md-1" grouptype="Vdata" style="width:5%;"> + <select class="form-control" name="Shifouzhengqu" data-placeholder="閫夋嫨 搴忓垪 ..."> + + @foreach (var item in zhongdian) + { + @if (!item.CodeSn.Equals(expertTestTopicanwserDTOs[i].Shifouzhengqu)) + { + <option value="@item.CodeSn" hassubinfo="true"> + @item.Comments + </option> + } + else + { + <option value="@item.CodeSn" hassubinfo="true" selected="selected"> + @item.Comments + </option> + } + + } + + </select> + + </div> + + + + @if (i == 0) + { + <div class="col-sm-1 col-md-1" style="width:80px;"> + <button type="button" class="addBtn" onclick="addBtn(this)" data-type="3" style="width:32px">+</button> + <button type="button" class="delBtn" onclick="delBtn(this)" data-type="3" style="width:32px">-</button> + </div> + } + </div> + } + </div> + + + + + </div> + + + + + + + + + + + + + + + </div> + </div> + </div> + </div> + </div> + </div> + <div class="wrapper wrapper-content" style="margin-top:0px"></div> + <div class="ibox-content" id="top" style="z-index:100; position:fixed; height:50px; width:100%;bottom:0; text-align: right; padding-top:8px "> + <div class="" style="float:right;" data-bootstro-width="500px" data-bootstro-content="鍔熻兘鎸夐挳锛氣�滀繚瀛樷�濓紝鈥滃垹闄も��"> + + + <a class="btn btn-success" href="javascript:void(0)" onclick="savePosition();" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">鎻愪氦</span> + </a> + + <a class="btn btn-success" id="shenhebtn" href="javascript:void(0)" onclick="shenhePosition();" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">瀹℃牳</span> + </a> + + <a class="btn btn-success" id="tijiaobingshenhebtn" href="javascript:void(0)" onclick="tijiaobingshenhePosition();" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">鎻愪氦骞跺鏍�</span> + </a> + </div> + </div> + + </form> + + <script type="text/javascript"> + var Topic = document.getElementById("Topic"); + + Topic.style.height = Topic.scrollHeight + 'px'; + + var hh = document.body.clientHeight - $('.ibox-title').height() - $("#top").height() * 2 - 95; + $("#div_content").height(hh); + + toastr.options = { + "closeButton": true, + "debug": false, + "progressBar": true, + "positionClass": "toast-bottom-right", + "onclick": null, + "showDuration": "300", + "hideDuration": "600", + "timeOut": "4500", + "extendedTimeOut": "600", + "showEasing": "swing", + "hideEasing": "linear", + "showMethod": "fadeIn", + "hideMethod": "fadeOut" + }; + + $("#Topictype").chosen(); + $("#Zhishitype").chosen(); + $("#Area").chosen(); + + + + + var id = '@Model.Id'; + var Clientid = '@Model.ShenpiStatus'; + var shenhe = '@shenhe'; + var tijiaobingshenhe = '@tijiaobingshenhe'; + if (id == null || id == '') { + $("#shenhebtn").hide(); + } else if (shenhe == "" || Clientid == "A") { + $("#shenhebtn").hide(); + } else { + $("#shenhebtn").show(); + } + + if (tijiaobingshenhe == "") { + $("#tijiaobingshenhebtn").hide(); + } else { + $("#tijiaobingshenhebtn").show(); + } + + + var shenhePosition = function () { + + if (id == null || id == '') { + toastr.warning("璇峰厛淇濆瓨"); + return; + } + + + + $.ajax({ + type: "POST", + url: "/ExpertTestTopic/Shenhe", + dataType: "json", + global: false, + data: { Id: id }, + success: function (data) { + + + if (data.Result) { + // parent._afterSave(true); + parent.layer.msg('瀹℃牳鎴愬姛', { icon: 6 }); + _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + } + else { + if ($.isNumber(imgLoad)) { + parent.layer.close(imgLoad); + } + // toastr.error(""); + parent.layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + if ($.isNumber(imgLoad)) { + parent.layer.close(imgLoad); + } + //toastr.error("淇濆瓨澶辫触"); + + parent.layer.msg('瀹℃牳澶辫触', { icon: 5 }); + } + }); + } + + + + // 淇濆瓨宀椾綅淇℃伅 + var tijiaobingshenhePosition = function () { + + + if ($("#Topictype").val() == '') { + toastr.warning("棰樺瀷涓嶈兘涓虹┖"); + return; + } + if ($.trim($("#Zhishitype").val()) == '') { + toastr.warning("鐭ヨ瘑鐐逛笉鑳戒负绌�"); + return; + } + + if ($.trim($("#Topic").val()) == '') { + toastr.warning("璇曢涓嶈兘涓虹┖"); + return; + } + + + if ($("#ZhongdianName").is(':checked')) { + $("#Zhongdian").val("A"); + } else { + $("#Zhongdian").val("D"); + } + + + imgLoad = parent.layer.load(2, { shade: [0.2, '#fff'] }); + $.ajax({ + type: "POST", + url: "/ExpertTestTopic/Tijiaobingshenhe", + dataType: "json", + global: false, + data: $('form').serializeArray(), + success: function (data) { + + + if (data.Result) { + // parent._afterSave(true); + parent.layer.msg('淇濆瓨鎴愬姛', { icon: 6 }); + _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + } + else { + if ($.isNumber(imgLoad)) { + parent.layer.close(imgLoad); + } + // toastr.error(""); + parent.layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + if ($.isNumber(imgLoad)) { + parent.layer.close(imgLoad); + } + //toastr.error("淇濆瓨澶辫触"); + + parent.layer.msg('淇濆瓨澶辫触', { icon: 5 }); + } + }); + } + + + // 淇濆瓨宀椾綅淇℃伅 + var savePosition = function () { + + + + if ($("#Topictype").val() == '') { + toastr.warning("棰樺瀷涓嶈兘涓虹┖"); + return; + } + if ($.trim($("#Zhishitype").val()) == '') { + toastr.warning("鐭ヨ瘑鐐逛笉鑳戒负绌�"); + return; + } + + if ($.trim($("#Topic").val()) == '') { + toastr.warning("璇曢涓嶈兘涓虹┖"); + return; + } + + + if ($("#ZhongdianName").is(':checked')) { + $("#Zhongdian").val("A"); + } else { + $("#Zhongdian").val("D"); + } + + + + + // var data = { id: $("#Id").val(), DocType: $("#DocType").val(), DocDept: $("#DocDept").val(), PublishTime: $("#PublishTime").val(), DocNo: $("#DocNo").val(), DocTitle: $("#DocTitle").val(), DocContent: ueue, DocZtc: $("#DocZtc").val(), Printtimes: $("#Printtimes").val(), DocCsdw: $("#DocCsdw").val(), PrintStatus: $("#PrintStatus").val()} + $.ajax({ + type: "POST", + url: "/ExpertTestTopic/Save", + dataType: "json", + global: false, + data: $('form').serializeArray(), + success: function (data) { + + + + if (data.Result) { + // parent._afterSave(true); + parent.layer.msg('鎴愬姛淇濆瓨', { icon: 6 }); + var Topictype = $("#Topictype").val(); + var Zhishitype = $("#Zhishitype").val(); + var Area = $("#Area").val(); + + window.location = "/ExpertTestTopic/Edit?Topictype=" + Topictype + "&Zhishitype=" + Zhishitype + "&Area=" + Area +"" + + //try { + // _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + //} + //catch (err) { + // parent._CloseTab1("/ExpertTestTopic/Edit/"); + //} + + } + else { + // toastr.error("澶辫触"); + parent.layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + + + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + } + + + + + function _pageAutoClose() { + parent.window._reloadPageData(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.isRefresh = true; + parent.layer.closeAll('loading'); + parent.layer.close(index); + return false; + } + + + function addBtn(obj) { + var oTr = document.createElement('div'); + var num = $(obj).data().type; + console.log(num) + if (num == 3) { + $('#addlist_3').append(oTr); + $(oTr).html(` <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">绛旀缂栧彿</label> + <div class="col-sm-2 col-md-2" style="width:5%;"> + <input class="form-control" label="绛旀缂栧彿" name="anwserno" labtype="txt" addvisible="true" editvisible="true" reg="" maxlength="50" ismust="true" type="text" value=""> + </div> + <label class="text-right col-sm-1 col-md-1 control-label" style="width:30px;">绛旀</label> + <div class="col-sm-6 col-md-6" > + <input class="form-control" label="绛旀" name="Anwser" labtype="txt" addvisible="true" editvisible="true" maxlength="500" reg="" ismust="flase" type="text" value=""> + + </div> + + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label"> + 鏄惁姝g‘ + </label> + + + <div class="col-sm-1 col-md-1" grouptype="Vdata" style="width:5%;"> + <select class="form-control" name="Shifouzhengqu" data-placeholder="閫夋嫨 搴忓垪 ..."> + + @foreach (var item in zhongdian) + { + + <option value="@item.CodeSn" hassubinfo="true"> + @item.Comments + </option> + + + } + + </select> + + </div> + + + </div>`); + } + } + + function delBtn(obj) { + var num = $(obj).data().type; + console.log(num) + + if (num == 3) { + if ($('#addlist_3').find('.clearfix').length > 1) { + $('#addlist_3').find('.clearfix:last').remove(); + } + + } + } + </script> +</body> +</html> \ No newline at end of file diff --git a/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml new file mode 100644 index 0000000..6071b7b --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml @@ -0,0 +1,179 @@ +锘緻{ + ViewBag.Title = "ExpertTestTopic"; + Layout = "~/Views/Shared/_Layout_Search.cshtml"; +} +@section headerStyle{ + <script type="text/javascript"> + + var topictype = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.topictype))'; + var zhishitype = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.zhishitype))'; + var zhongdian = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.zhongdian))'; + var jiexi_status = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.jiexi_status))'; + var shenpi_status = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.shenpi_status))'; + var Area = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Area))'; + + + dataCol = [ + { label: 'id', name: 'Id', labtype: 'txt', hidden: true }, + { + label: '棰樺瀷', name: 'TopictypeName', labtype: 'txt', hidden: false, width: 100 + }, + + { + label: '鐭ヨ瘑鐐�', name: 'ZhishitypeName', labtype: 'txt', hidden: false, width: 100 + }, + { label: '鍖哄煙', name: 'AreaName', labtype: 'txt', hidden: false, width: 100 }, + { label: '璇曢', name: 'Topic', labtype: 'txt', hidden: false, width: 500 }, + { label: '閲嶇偣鏍囨敞', name: 'ZhongdianName', labtype: 'txt', hidden: false, width: 100 }, + { label: '瀹℃牳', name: 'ShenpiStatusName', labtype: 'txt', hidden: false, width: 100 }, + { label: '瑙f瀽', name: 'JiexiStatusName', labtype: 'txt', hidden: false, width: 100 }, + + + { + label: '鎿嶄綔', name: 'caozuo', labtype: 'txt', hidden: false, width: 50, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('淇敼','98%','100%', '/ExpertTestTopic/Edit?id=" + rowObject.Id + "')\" >淇敼</a> <a onclick=\"_pagedel('" + rowObject.Id + "')\" >鍒犻櫎</a>"; + } + }, + { + label: '瑙f瀽', name: 'jiexiya', labtype: 'txt', hidden: false, width: 50, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('淇敼','100%','100%', '/ExpertTestTopicjiexi/Index?topocId=" + rowObject.Id + "')\" >瑙f瀽</a>"; + } + }, + + ]; + dataUrl = "/ExpertTestTopic/GetList?JiexiStatus=D&ShenpiStatus=D"; + searchCol = [ + { label: '鍖哄煙', name: 'Area', labtype: 'combox', hidden: false, data: JSON.parse(Area), cwidth: '5%', cccwidth: '15%' }, + { label: '棰樺瀷', name: 'Topictype', labtype: 'combox', hidden: false, data: JSON.parse(topictype), cwidth: '5%', cccwidth: '15%' }, + { label: '鐭ヨ瘑鐐�', name: 'Zhishitype', labtype: 'combox', hidden: false, data: JSON.parse(zhishitype), cwidth: '5%', cccwidth: '15%' }, + { label: '閲嶇偣鏍囨敞', name: 'Zhongdian', labtype: 'combox', hidden: false, data: JSON.parse(zhongdian), cwidth: '5%', cccwidth: '15%' }, + { label: '瑙f瀽', name: 'JiexiStatus', labtype: 'combox', hidden: false, data: JSON.parse(jiexi_status), cwidth: '5%', cccwidth: '15%' }, + { label: '瀹℃牳', name: 'ShenpiStatus', labtype: 'combox', hidden: false, data: JSON.parse(shenpi_status), cwidth: '5%', cccwidth: '15%' }, + + { label: '璇曢', name: 'Topic', labtype: 'txt', hidden: false }, + + + + + + + + ]; + + + var _pageAdd = function () { + OpenWindow("鏂板鐗╁搧", "98%", "90%", "/ExpertTestTopic/Edit/"); + } + + var _pagedel = function (id) { + if (confirm('鏄惁鍒犻櫎璁板綍')) { + $.ajax({ + type: "GET", + url: "/ExpertTestTopic/Nullify?Id=" + id, + dataType: "json", + global: false, + data: '', + success: function (data) { + + + if (data.Result) { + + layer.msg('鍒犻櫎鎴愬姛', { icon: 6 }); + window._reloadPageData(); + } + else { + // toastr.error(""); + layer.msg('鍒犻櫎澶辫触', { icon: 5 }); + } + + }, + error: function () { + if ($.isNumber(imgLoad)) { + layer.close(imgLoad); + } + //toastr.error("淇濆瓨澶辫触"); + + layer.msg('淇濆瓨澶辫触', { icon: 5 }); + } + }); + } + + + } + var _pageSearch = function () { + $("#jqGrid").jqGrid('setGridParam', { + url: '/ExpertTestTopic/GetList', postData: jsons, page: 1 + }); //閲嶆柊杞藉叆 + var jsons = GetSearchEnd(); + if (jsons == false) { + msg.info("璇峰綍鍏ユ煡璇㈡潯浠�"); + return false; + } + LoadGrid(jsons); + } + + $(document).ready(function () { + + + $("#PBSJiexiStatus").val("D"); + $("#PBSJiexiStatus").trigger('chosen:updated');//鏇存柊閫夐」 + $("#PBSShenpiStatus").val("D"); + $("#PBSShenpiStatus").trigger('chosen:updated');//鏇存柊閫夐」 + + + }); + + var _afterSave = function (result) { + if (result) { + toastr.success("淇濆瓨鎴愬姛"); + } else { + toastr.error("淇濆瓨澶辫触"); + } + } + + var _afterDel = function (result) { + if (result) { + toastr.success("鍒犻櫎鎴愬姛"); + } else { + /**/ + toastr.error("鍒犻櫎鎴愬姛"); + /**/ + } + } + + + var _pagePrint = function () { + + var Area = $("#PBSArea").val(); + var Topictype = $("#PBSTopictype").val(); + + var Zhishitype = $("#PBSZhishitype").val(); + var Zhongdian = $("#PBSZhongdian").val(); + var JiexiStatus = $("#PBSJiexiStatus").val(); + + var ShenpiStatus = $("#PBSShenpiStatus").val(); + var Topic = $.trim($("#PBSTopic").val()); + + + + var url = "/ExpertTestTopic/print?Area=" + Area + "&Topictype=" + Topictype + "&Zhishitype=" + Zhishitype + + "&Zhongdian=" + Zhongdian + "&JiexiStatus=" + JiexiStatus + "&ShenpiStatus=" + ShenpiStatus + + "&Topic=" + Topic; + var me = window.open(url, "鎵撳嵃"); //鎵撳紑鏂扮獥鍙� + + + } + </script> +} + +@section footerScripts{ + <script type="text/javascript"> + + + + + + </script> +} diff --git a/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/print.cshtml b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/print.cshtml new file mode 100644 index 0000000..544e931 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/ExpertTestTopic/print.cshtml @@ -0,0 +1,99 @@ +锘緻using DTO; +@{ + ViewBag.Title = "ExpertTestTopic"; + Layout = null; + List<ExpertTestTopicDTO> ExpertTestTopicDTOs = ViewBag.listExpertTestTopicDTO as List<ExpertTestTopicDTO>; //闂绫诲瀷 +} + +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta http-equiv="Pragma" content="no-cache"> + <meta http-equiv="Cache-Control" content="no-siteapp" /> + <meta http-equiv="Cache-Control" content="no-cache"> + <meta http-equiv="Expires" content="0"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="renderer" content="webkit"> + <title>@SiteConfig.SiteName</title> + <meta name="keywords" content="@SiteConfig.Keywords"> + <meta name="description" content="@SiteConfig.Description"> + <meta name="author" content="@SiteConfig.Author"> + <link rel="icon" type="image/x-icon" href="@SiteConfig.ShortcutIcon"> + <!-- uc寮哄埗绔栧睆 --> + <meta name="screen-orientation" content="portrait"> + <!-- QQ寮哄埗绔栧睆 --> + <meta name="x5-orientation" content="portrait"> + <!-- UC寮哄埗鍏ㄥ睆 --> + <meta name="full-screen" content="yes"> + <!-- QQ寮哄埗鍏ㄥ睆 --> + <meta name="x5-fullscreen" content="true"> + <!--[if lt IE 9]> + <meta http-equiv="refresh" content="0;ie.html" /> + <![endif]--> + <style type="text/css"> + body { + text-align: center; + font-size: 12px; + } + + table { + border-collapse: collapse; + border: none; + width: 900px; + margin: auto; + text-align: left; + } + + td { + border: solid #e5e5e5 1px; + } + </style> +</head> +<body> + @if (ExpertTestTopicDTOs != null && ExpertTestTopicDTOs.Count > 0) + { + + + <table> + <tr> + <td style="width:5%;"> 搴忓彿</td> + <td style="width:7%;"> 棰樺瀷</td> + <td style="width:7%;"> 鐭ヨ瘑鐐�</td> + <td style="width:7%;"> 鍖哄煙</td> + <td style="width:50%;"> 璇曢</td> + <td style="width:7%;"> 閲嶇偣鏍囨敞</td> + <td style="width:7%;"> 瀹℃牳</td> + <td style="width:7%;"> 瑙f瀽</td> + </tr> + + + @{ + int i = 1; + } + + @foreach (var ExpertTestTopicDTO in ExpertTestTopicDTOs) + { + + <tr> + <td> @i</td> + <td> @Html.Raw(ExpertTestTopicDTO.TopictypeName)</td> + <td> @Html.Raw(ExpertTestTopicDTO.ZhishitypeName)</td> + <td> @Html.Raw(ExpertTestTopicDTO.AreaName)</td> + <td> @Html.Raw(ExpertTestTopicDTO.Topic)</td> + <td> @Html.Raw(ExpertTestTopicDTO.ZhongdianName)</td> + <td> @Html.Raw(ExpertTestTopicDTO.ShenpiStatusName)</td> + <td> @Html.Raw(ExpertTestTopicDTO.JiexiStatusName)</td> + </tr> + + i++; + } + + </table> + } +</body> +<script type="text/javascript"> + window.print(); +</script> +</html> diff --git a/zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Edit.cshtml b/zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Edit.cshtml new file mode 100644 index 0000000..a203092 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Edit.cshtml @@ -0,0 +1,340 @@ +锘緻model DTO.ExpertTestTopicjiexiDTO +@using DTO; +@using zhengcaioa.Models; +@{ + + + List<SysCodeDtl> Flag = ViewData["Flag"] as List<SysCodeDtl>; //鐗╁搧鐘舵�� + + List<SysCodeDtl> falv = ViewData["falv"] as List<SysCodeDtl>; //鐗╁搧鐘舵�� + +} +@{ + Layout = null; +} + +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content="ThemeBucket"> + <title>@(SiteConfig.SiteName)</title> + <link href="~/css/bootstrap.min.css" rel="stylesheet"> + <link href="~/css/font-awesome.min.css" rel="stylesheet"> + <link href="~/css/animate.min.css" rel="stylesheet"> + + @*<link href="~/css/plugins/iCheck/custom.css" rel="stylesheet">*@ + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/chosen/chosen.css" rel="stylesheet"> + @*<link href="~/js/plugins/layer/skin/layer.css" rel="stylesheet">*@ + @*<link href="~/css/plugins/datapicker/datepicker3.css" rel="stylesheet">*@ + <link href="~/css/style.min.css" rel="stylesheet"> + <link href="~/css/plugins/toastr/toastr.min.css" rel="stylesheet" /> + <link href="~/css/plugins/webuploader/webuploader.css" rel="stylesheet" /> + + <style type="text/css"> + .webuploader-pick { + position: relative; + display: inline-block; + cursor: pointer; + background: #00b7ee; + padding: 8px 14px 7px 14px; + color: #fff; + text-align: center; + border-radius: 3px; + overflow: hidden; + } + + div.clearfix > label { + padding-top: 8px; + } + + .chosen-container { + border-radius: 1px; + border: 1px solid #e5e6e7; + } + + .col-md-1.control-label { + padding-right: 0px; + font-weight: 400; + } + </style> + + <!-- jqgrid--> + @*<link href="~/css/plugins/jqgrid/ui.jqgrid.css" rel="stylesheet">*@ + <script language="javascript" src="~/js/jquery.min.js" type="text/javascript"></script> + <script src="~/js/bootstrap.min.js"></script> + @*<script src="~/js/plugins/bootstro/bootstro.js"></script>*@ + + <!--瀹瑰櫒--> + @*<script language="javascript" src="~/js/datehelper.js" type="text/javascript"></script>*@ + @*<script language="javascript" src="~/js/plugins/query/jquery.query-object.js" type="text/javascript"></script>*@ + @*<script language="javascript" src="~/js/plugins/iCheck/icheck.min.js" type="text/javascript"></script>*@ + <script language="javascript" src="~/js/plugins/chosen/chosen.jquery.js" type="text/javascript"></script> + @*<script language="javascript" src="~/js/plugins/datapicker/bootstrap-datepicker.js" type="text/javascript"></script>*@ + <script language="javascript" src="~/js/plugins/layer/layer.js" type="text/javascript"></script> + @*<script src="~/js/plugins/jqgrid/jquery.jqGrid.min.js" type="text/javascript"></script>*@ + @*<script src="~/js/plugins/jqgrid/i18n/grid.locale-cn.js" type="text/javascript"></script>*@ + <script src="~/js/plugins/toastr/toastr.min.js" type="text/javascript"></script> + <script src="~/js/plugins/webuploader/webuploader.min.js"></script> + + <script language="javascript" src="~/js/common-layout.js" type="text/javascript"></script> + <script src="~/js/plugins/layer/laydate/laydate.js" type="text/javascript"></script> + @*<script src="~/js/plugins/iTexbox/itextbox.js" type="text/javascript"></script>*@ + @*<script src="~/js/plugins/iuploader/iuploader.js"></script>*@ + <script src="~/js/TUJS.js"></script> +</head> +<body class="gray-bg" style="overflow:auto"> + <form id="formtest"> + <div class="wrapper wrapper-content" id="ibox-content" style="padding:15px;"> + <div class="row"> + <div class="col-sm-12"> + <div class="ibox float-e-margins"> + <div class="ibox-title"> + <h5> <i class="fa fa-list"></i> 鍩烘湰淇℃伅</h5> + </div> + <div id="div_content" class="ibox-content" style="background-color:white;"> + <div class="row"> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">娉曞緥<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <select id="Falv" class="form-control" name="Falv" data-placeholder="閫夋嫨 搴忓垪 ..."> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in falv) + { + @if (!item.CodeSn.Equals(Model.Falv)) + { + <option value="@item.CodeSn" hassubinfo="true"> + @item.Comments + </option> + } + else + { + <option value="@item.CodeSn" hassubinfo="true" selected="selected"> + @item.Comments + </option> + } + + } + + </select> + <input type="hidden" id="Id" name="Id" value="@Model.Id" /> + <input type="hidden" id="Topic" name="Topic" value="@Model.Topic" /> + </div> + + + + </div> + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + + <label class="text-right col-sm-1 col-md-1 control-label">娉曟潯<i class="red">*</i></label> + <div class="col-sm-6 col-md-6"> + <input id="Fatiao" class="form-control" label="娉曟潯" name="Fatiao" labtype="txt" addvisible="true" editvisible="true" maxlength="500" reg="" ismust="true" type="text" value="@Model.Fatiao"> + + </div> + + + </div> + + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + + + <label class="text-right col-sm-1 col-md-1 control-label">涓昏В鏋�<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <select id="Flag" class="form-control" name="Flag" data-placeholder="閫夋嫨 搴忓垪 ..."> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in Flag) + { + @if (!item.CodeSn.Equals(Model.Flag)) + { + <option value="@item.CodeSn" hassubinfo="true"> + @item.Comments + </option> + } + else + { + <option value="@item.CodeSn" hassubinfo="true" selected="selected"> + @item.Comments + </option> + } + + } + + </select> + + </div> + + </div> + + <div class="clearfix layer-area" style="padding-bottom:15px;"> + + + + + <label class="text-right col-sm-1 col-md-1 control-label">瑙f瀽<i class="red">*</i></label> + <div class="col-sm-11 col-md-11"> + <textarea class="form-control bt" id="Jiexi" name="Jiexi" title="瑙f瀽" isempty="" maxlength="4000" length="long" style="resize:none;overflow-y:hidden; min-height:60px;" onpropertychange="this.style.height=this.scrollHeight + 'px'" oninput="this.style.height=this.scrollHeight + 'px'">@Model.Jiexi</textarea> + + </div> + + + </div> + + + + + + + </div> + + + + + + + + + + + + + + + </div> + </div> + </div> + </div> + </div> + </div> + <div class="wrapper wrapper-content" style="margin-top:0px"></div> + <div class="ibox-content" id="top" style="z-index:100; position:fixed; height:50px; width:100%;bottom:0; text-align: right; padding-top:8px "> + <div class="" style="float:right;" data-bootstro-width="500px" data-bootstro-content="鍔熻兘鎸夐挳锛氣�滀繚瀛樷�濓紝鈥滃垹闄も��"> + + + <a class="btn btn-success" href="javascript:void(0)" onclick="savePosition();" style="margin-left:4px; border-radius:4px;"> + <i class="glyphicon glyphicon-ok"></i> <span class="bold">鎻愪氦</span> + </a> + </div> + </div> + + </form> + + <script type="text/javascript"> + + var Jiexi = document.getElementById("Jiexi"); + + Jiexi.style.height = Jiexi.scrollHeight + 'px'; + + var hh = document.body.clientHeight - $('.ibox-title').height() - $("#top").height() * 2 - 95; + $("#div_content").height(hh); + + toastr.options = { + "closeButton": true, + "debug": false, + "progressBar": true, + "positionClass": "toast-bottom-right", + "onclick": null, + "showDuration": "300", + "hideDuration": "600", + "timeOut": "4500", + "extendedTimeOut": "600", + "showEasing": "swing", + "hideEasing": "linear", + "showMethod": "fadeIn", + "hideMethod": "fadeOut" + }; + + + + var id = '@Model.Id'; + + + + + + // 淇濆瓨宀椾綅淇℃伅 + var savePosition = function () { + + + + if ($("#Falv").val() == '') { + toastr.warning("娉曞緥涓嶈兘涓虹┖"); + return; + } + if ($.trim($("#Fatiao").val()) == '') { + toastr.warning("娉曟潯涓嶈兘涓虹┖"); + return; + } + + if ($.trim($("#Jiexi").val()) == '') { + toastr.warning("瑙f瀽涓嶈兘涓虹┖"); + return; + } + if ($.trim($("#Flag").val()) == '') { + toastr.warning("涓昏В鏋愪笉鑳戒负绌�"); + return; + } + + + + + + + + // var data = { id: $("#Id").val(), DocType: $("#DocType").val(), DocDept: $("#DocDept").val(), PublishTime: $("#PublishTime").val(), DocNo: $("#DocNo").val(), DocTitle: $("#DocTitle").val(), DocContent: ueue, DocZtc: $("#DocZtc").val(), Printtimes: $("#Printtimes").val(), DocCsdw: $("#DocCsdw").val(), PrintStatus: $("#PrintStatus").val()} + $.ajax({ + type: "POST", + url: "/ExpertTestTopicjiexi/Save", + dataType: "json", + global: false, + data: $('form').serializeArray(), + success: function (data) { + + + + if (data.Result) { + // parent._afterSave(true); + parent.layer.msg('鎴愬姛淇濆瓨', { icon: 6 }); + + + + try { + _pageAutoClose();//鑷姩鍏抽棴椤甸潰鏂规硶 + } + catch (err) { + parent._CloseTab1("/ExpertTestTopicjiexi/Edit/"); + } + + } + else { + // toastr.error("澶辫触"); + parent.layer.msg(data.Message, { icon: 5 }); + } + + }, + error: function () { + + + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + } + + + + + function _pageAutoClose() { + parent.window._reloadPageData(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.isRefresh = true; + parent.layer.closeAll('loading'); + parent.layer.close(index); + return false; + } + </script> +</body> +</html> \ No newline at end of file diff --git a/zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Index.cshtml b/zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Index.cshtml new file mode 100644 index 0000000..f96617f --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Index.cshtml @@ -0,0 +1,116 @@ +锘緻{ + ViewBag.Title = "ExpertTestTopicjiexi"; + Layout = "~/Views/Shared/_Layout_Search.cshtml"; +} +@section headerStyle{ + <script type="text/javascript"> + + var Flag = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Flag))'; + var falv = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.falv))'; + var TopocId = '@Html.Raw(ViewBag.TopocId)'; + + + dataCol = [ + { label: 'id', name: 'Id', labtype: 'txt', hidden: true }, + { + label: '娉曞緥', name: 'FalvName', labtype: 'txt', hidden: false, width: 100 + }, + + { + label: '娉曟潯', name: 'Fatiao', labtype: 'txt', hidden: false, width: 100 + }, + { label: '瑙f瀽', name: 'Jiexi', labtype: 'txt', hidden: false, width: 300 }, + + { label: '涓昏В鏋�', name: 'FlagName', labtype: 'txt', hidden: false, width: 100 }, + + + + { + label: '鎿嶄綔', name: 'caozuo', labtype: 'txt', hidden: false, width: 50, + formatter: function (cellvalue, options, rowObject) { + return "<a onclick=\"OpenWindow('淇敼','98%','100%', '/ExpertTestTopicjiexi/Edit?id=" + rowObject.Id + "&topocId=" + TopocId + "')\" >淇敼</a> <a onclick=\"_pagedel('" + rowObject.Id + "')\" >鍒犻櫎</a>"; + } + }, + + ]; + dataUrl = "/ExpertTestTopicjiexi/GetList?TopicId=" + TopocId; + searchCol = [ + { label: '娉曞緥', name: 'Falv', labtype: 'combox', hidden: false, data: JSON.parse(falv), cwidth: '5%', cccwidth: '15%' }, + + + + ]; + + + var _pageAdd = function () { + OpenWindow("鏂板瑙f瀽", "98%", "90%", "/ExpertTestTopicjiexi/Edit?topocId=" + TopocId ); + } + + var _pagedel = function (id) { + if (confirm('鏄惁鍒犻櫎璁板綍')) { + $.ajax({ + type: "GET", + url: "/ExpertTestTopicjiexi/Nullify?Id=" + id, + dataType: "json", + global: false, + data: '', + success: function (data) { + + + if (data.Result) { + + layer.msg('鍒犻櫎鎴愬姛', { icon: 6 }); + window._reloadPageData(); + } + else { + // toastr.error(""); + layer.msg('鍒犻櫎澶辫触', { icon: 5 }); + } + + }, + error: function () { + if ($.isNumber(imgLoad)) { + layer.close(imgLoad); + } + //toastr.error("淇濆瓨澶辫触"); + + layer.msg('淇濆瓨澶辫触', { icon: 5 }); + } + }); + } + + + } + + + + + var _afterSave = function (result) { + if (result) { + toastr.success("淇濆瓨鎴愬姛"); + } else { + toastr.error("淇濆瓨澶辫触"); + } + } + + var _afterDel = function (result) { + if (result) { + toastr.success("鍒犻櫎鎴愬姛"); + } else { + /**/ + toastr.error("鍒犻櫎鎴愬姛"); + /**/ + } +} + </script> +} + +@section footerScripts{ + <script type="text/javascript"> + + + + + + </script> +} -- Gitblit v1.9.1