优化问卷题目池新增编辑接口

master
xiaochanghai 1 month ago
parent b3c748b428
commit 9594d51a7f
  1. 5
      Tiobon.Core.Api/Tiobon.Core.Model.xml
  2. 5
      Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs
  3. 33
      Tiobon.Core.Services/Ghre/Ghre_SurveyQuestionPoolServices.cs
  4. 5
      Tiobon.Core/Tiobon.Core.Model.xml

@ -41208,6 +41208,11 @@
备注
</summary>
</member>
<member name="P:Tiobon.Core.Model.ViewModels.Extend.Ghre_SurveyQuestionExtendBase.BuiltIn">
<summary>
内置
</summary>
</member>
<member name="P:Tiobon.Core.Model.ViewModels.Extend.InsertGhre_SurveyExtend.Questions">
<summary>
问卷调查题目

@ -189,6 +189,11 @@ public class Ghre_SurveyQuestionExtendBase
/// </summary>
[Display(Name = "RemarkSz"), Description("备注"), MaxLength(2000, ErrorMessage = "备注 不能超过 2000 个字符")]
public string RemarkSz { get; set; }
/// <summary>
/// 内置
/// </summary>
public int? BuiltIn { get; set; }
}
public class InsertGhre_SurveyExtend : Ghre_SurveyExtendBase

@ -1,4 +1,8 @@
namespace Tiobon.Core.Services;
using Mysqlx.Crud;
using System.Net;
using Tiobon.Core.IServices;
namespace Tiobon.Core.Services;
/// <summary>
/// 问卷题库 (服务)
@ -201,7 +205,25 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
if (Id != 0)
{
var question = await base.QueryById(Id);
data.PageData.questionType.ForEach(x => x.isActive = 0);
var questionType = data.PageData.questionType.Where(x => x.QuestionType == question.QuestionType).FirstOrDefault();
if (questionType != null)
{
var answers = await _ghre_SurveyQuestionPoolOptionServicesServices.Query(x => x.SurveyQuestionPoolId == Id, "TaxisNo ASC");
questionType.isActive = 1;
questionType.QuestionContent = question.QuestionContent;
questionType.BuiltIn = question.BuiltIn;
questionType.QuestionAnalysis = question.QuestionAnalysis;
questionType.Options = answers.Select(x => new InsertGhre_SurveyOptionExtend()
{
OptionNo = x.OptionNo,
OptionContent = x.OptionContent,
ImageUrl = x.ImageUrl,
ImageWidthPc = x.ImageWidthPc,
ImageWidthApp = x.ImageWidthApp,
Score = x.Score,
}).ToList();
}
data.PageData.baseData.CreateDataInfo = question.CreateDataInfo;
data.PageData.baseData.UpdateDataInfo = question.UpdateDataInfo;
@ -236,6 +258,7 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
{
OptionNo = x.OptionNo,
OptionContent = x.OptionContent,
Score = x.Score,
ImageUrl = x.ImageUrl,
ImageWidthPc = x.ImageWidthPc,
ImageWidthApp = x.ImageWidthApp,
@ -248,7 +271,7 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
i = i + 100;
});
await _ghre_SurveyQuestionPoolOptionServicesServices.Add(insertAnswers);
//}
await Db.Ado.CommitTranAsync();
@ -295,16 +318,16 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP
insert.BuiltIn = editModel.baseData.BuiltIn;
insert.QuestionType = questionType.QuestionType;
insert.QuestionNo = await GenerateContinuousSequence(insert.QuestionType.Substring(0, 1));
insert.QuestionContent = questionType.QuestionContent;
insert.QuestionAnalysis = questionType.QuestionAnalysis;
await base.Update(Id, insert);
await base.Update(Id, insert);
var insertAnswers = questionType.Options.Select(x => new InsertGhre_SurveyQuestionPoolOptionInput()
{
OptionNo = x.OptionNo,
OptionContent = x.OptionContent,
Score = x.Score,
ImageUrl = x.ImageUrl,
ImageWidthPc = x.ImageWidthPc,
ImageWidthApp = x.ImageWidthApp,

@ -41208,6 +41208,11 @@
备注
</summary>
</member>
<member name="P:Tiobon.Core.Model.ViewModels.Extend.Ghre_SurveyQuestionExtendBase.BuiltIn">
<summary>
内置
</summary>
</member>
<member name="P:Tiobon.Core.Model.ViewModels.Extend.InsertGhre_SurveyExtend.Questions">
<summary>
问卷调查题目

Loading…
Cancel
Save