username@email.com
2021-10-13 6672a68f11621bc7a49265fc47d4c1e7ae4c060d
专家测试--题库管理 完成
3个文件已修改
15个文件已添加
3168 ■■■■■ 已修改文件
zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/DTO/ExpertTestTopicDTO.cs 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/DTO/ExpertTestTopicanwserDTO.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/DTO/ExpertTestTopicjiexiDTO.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/IServices/IExpertTestTopicService.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/Model/ExpertTestTopic.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/Model/ExpertTestTopicanwser.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/Model/ExpertTestTopicjiexi.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/Model/zhengcaioaContext.cs 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/Services/ExpertTestTopicService.cs 670 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs 515 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicjiexiController.cs 211 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Startup.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Edit.cshtml 642 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml 179 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Views/ExpertTestTopic/print.cshtml 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Edit.cshtml 340 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Index.cshtml 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>();
        }
    }
}
zhengcaioa/DTO/ExpertTestTopicDTO.cs
New file
@@ -0,0 +1,62 @@
using 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; }
    }
}
zhengcaioa/DTO/ExpertTestTopicanwserDTO.cs
New file
@@ -0,0 +1,20 @@
using 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; }
    }
}
zhengcaioa/DTO/ExpertTestTopicjiexiDTO.cs
New file
@@ -0,0 +1,23 @@
using 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; }
    }
}
zhengcaioa/IServices/IExpertTestTopicService.cs
New file
@@ -0,0 +1,38 @@
using 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);
    }
}
zhengcaioa/Model/ExpertTestTopic.cs
New file
@@ -0,0 +1,24 @@
using 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; }
    }
}
zhengcaioa/Model/ExpertTestTopicanwser.cs
New file
@@ -0,0 +1,21 @@
using 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; }
    }
}
zhengcaioa/Model/ExpertTestTopicjiexi.cs
New file
@@ -0,0 +1,22 @@
using 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; }
    }
}
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 =>
            {
zhengcaioa/Services/ExpertTestTopicService.cs
New file
@@ -0,0 +1,670 @@
using 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">主id</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">主id</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;
        }
    }
}
zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs
New file
@@ -0,0 +1,515 @@
using 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();
        }
    }
}
zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicjiexiController.cs
New file
@@ -0,0 +1,211 @@
using 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")
                {
                    //只能有一个主解析
                  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
                {
                    //必须有一个主解析
                    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 = "必须有一个主解析";
                             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));
        }
    }
}
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)); 
zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Edit.cshtml
New file
@@ -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>; //解析状态
    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>&nbsp;基本信息</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">
                                            是否正确
                                        </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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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">
                                            是否正确
                                        </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>
zhengcaioa/zhengcaioa/Views/ExpertTestTopic/Index.cshtml
New file
@@ -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: '解析', 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>&nbsp;&nbsp;&nbsp;<a onclick=\"_pagedel('" + rowObject.Id + "')\"  >删除</a>";
                }
            },
            {
                label: '解析', name: 'jiexiya', labtype: 'txt', hidden: false, width: 50,
                formatter: function (cellvalue, options, rowObject) {
                    return "<a onclick=\"OpenWindow('修改','100%','100%', '/ExpertTestTopicjiexi/Index?topocId=" + rowObject.Id + "')\"  >解析</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: '解析', 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>
}
zhengcaioa/zhengcaioa/Views/ExpertTestTopic/print.cshtml
New file
@@ -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%;"> 解析</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>
zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Edit.cshtml
New file
@@ -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>&nbsp;基本信息</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">解析<i class="red">*</i></label>
                                    <div class="col-sm-11 col-md-11">
                                        <textarea class="form-control bt" id="Jiexi" name="Jiexi" 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.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>&nbsp;&nbsp;<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("解析不能为空");
                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>
zhengcaioa/zhengcaioa/Views/ExpertTestTopicjiexi/Index.cshtml
New file
@@ -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: '解析', 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>&nbsp;&nbsp;&nbsp;<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("新增解析", "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>
}