From a1a69c0a7c6d947606187d180ef4f6f4e008fed4 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 12 May 2025 11:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E9=A2=98=E5=BA=93=E6=B1=A0?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E7=BB=B4=E6=8A=A4=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_SurveyQuestionPoolController.cs | 4 +- Tiobon.Core.Api/Tiobon.Core.Model.xml | 10 ++ .../Ghre/IGhre_SurveyQuestionPoolServices.cs | 2 +- .../Extend/FromGhre_QuestionInput.cs | 37 +++- .../Extend/InsertGhre_SurveyExtend.cs | 4 +- .../Ghre/Ghre_SurveyQuestionPoolServices.cs | 165 +++++++++++++++++- Tiobon.Core/Tiobon.Core.Model.xml | 10 ++ 7 files changed, 219 insertions(+), 13 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyQuestionPoolController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyQuestionPoolController.cs index 6591b8b7..b3e8c5a8 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyQuestionPoolController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_SurveyQuestionPoolController.cs @@ -23,8 +23,8 @@ public class Ghre_SurveyQuestionPoolController : BaseController /// /// - [HttpPost("QueryFrom/{Id}")] - public async Task> QueryFrom(long Id) + [HttpPost("QueryForm/{Id}")] + public async Task> QueryFrom(long Id) { return await _service.QueryFrom(Id); } diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index 5a6623ab..467c7cdf 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -41898,6 +41898,16 @@ 修改信息 + + + 创建信息 + + + + + 修改信息 + + 员工id diff --git a/Tiobon.Core.IServices/Ghre/IGhre_SurveyQuestionPoolServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_SurveyQuestionPoolServices.cs index 9eb132fc..033b385f 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_SurveyQuestionPoolServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_SurveyQuestionPoolServices.cs @@ -12,5 +12,5 @@ public interface IGhre_SurveyQuestionPoolServices : IBaseServices InsertFrom(InsertGhre_SurveyQuestionExtend insertModel); - Task> QueryFrom(long Id); + Task> QueryFrom(long Id); } \ No newline at end of file diff --git a/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs b/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs index d34f2fc1..cebc6293 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs @@ -1,4 +1,6 @@ -namespace Tiobon.Core.Model; +using Tiobon.Core.Model.ViewModels.Extend; + +namespace Tiobon.Core.Model; public class FromGhre_QuestionInput { @@ -65,4 +67,37 @@ public class FromGhre_QuestionQuestionAnswerList public string imageUrl { get; set; } public string imgWidthPc { get; set; } public string imgWidthApp { get; set; } +} + +public class FromGhre_SurveyQuestionPoolInput +{ + public List Column { get; set; } = new List(); + public FromGhre_SurveyQuestionPoolPageData PageData { get; set; } = new FromGhre_SurveyQuestionPoolPageData(); + +} + +public class FromGhre_SurveyQuestionPoolPageData +{ + public FromGhre_SurveyQuestionPoolBaseData baseData { get; set; } = new FromGhre_SurveyQuestionPoolBaseData(); + public List questionType { get; set; } = new List { }; +} +public class FromGhre_SurveyQuestionPoolBaseData +{ + public int? BuiltIn { get; set; } + + + /// + /// 创建信息 + /// + public string CreateDataInfo { get; set; } + + /// + /// 修改信息 + /// + public string UpdateDataInfo { get; set; } + +} +public class FromGhre_SurveyQuestionPoolType: InsertGhre_SurveyQuestionExtend +{ + public int isActive { get; set; } = 0; } \ No newline at end of file diff --git a/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs b/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs index 31ab7b4c..2b2c24ad 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs @@ -208,7 +208,7 @@ public class InsertGhre_SurveyQuestionExtend : Ghre_SurveyQuestionExtendBase /// /// 问卷调查选项 /// - public List Options { get; set; } + public List Options { get; set; } = new List(); } /// @@ -244,7 +244,7 @@ public class InsertGhre_SurveyOptionExtend /// /// 是否其他选项 /// - public bool? IsOther { get; set; } + public bool? IsOther { get; set; } = false; /// /// 其他选项内容 diff --git a/Tiobon.Core.Services/Ghre/Ghre_SurveyQuestionPoolServices.cs b/Tiobon.Core.Services/Ghre/Ghre_SurveyQuestionPoolServices.cs index 83c3a351..dd406ad0 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_SurveyQuestionPoolServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_SurveyQuestionPoolServices.cs @@ -1,4 +1,8 @@ -namespace Tiobon.Core.Services; +using Newtonsoft.Json; +using System.Net; +using Tiobon.Core.IServices; + +namespace Tiobon.Core.Services; /// /// 问卷题库 (服务) @@ -52,16 +56,163 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices /// /// - public async Task> QueryFrom(long Id) + public async Task> QueryFrom(long Id) { - var data = new InsertGhre_SurveyQuestionExtend(); + var data = new FromGhre_SurveyQuestionPoolInput(); + + #region Column + data.Column.Add(new FromGhre_QuestionColumn() + { + label = "系统内置", + field = "BuiltIn", + elementType = "Switch", + required = false, + multipleSelect = false, + editable = true, + dataSource = "", + placeholder = "保存后自动生成" + }); + + #endregion + + #region PageData + + + var options = new List + { + new InsertGhre_SurveyOptionExtend() + { + OptionNo= "A", + OptionContent="非常满意", + Score=5 + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="B", + OptionContent= "满意", + Score= 4, + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="C", + OptionContent= "一般", + Score= 3, + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="D", + OptionContent= "不满意", + Score= 2, + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="E", + OptionContent= "非常不满意", + Score=1 + } + }; + + + var options1 = new List + { + new InsertGhre_SurveyOptionExtend() + { + OptionNo= "A", + OptionContent="非常满意", + Score=5 + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="B", + OptionContent= "满意", + Score= 4, + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="C", + OptionContent= "一般", + Score= 3, + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="D", + OptionContent= "不满意", + Score= 2, + }, + new InsertGhre_SurveyOptionExtend() + { + OptionNo="E", + OptionContent= "非常不满意", + Score=1 + } + }; + data.PageData.questionType = new List + { + new FromGhre_SurveyQuestionPoolType() + { + QuestionContent = "单选题", + QuestionType = "Single", + isActive = 1, + Options=options + }, + new FromGhre_SurveyQuestionPoolType() + { + QuestionContent = "多选题", + QuestionType = "Multiple", + isActive = 0, + Options=options + }, + new FromGhre_SurveyQuestionPoolType() + { + QuestionContent = "简答", + QuestionType = "ShortAnswer", + isActive = 0 + }, + new FromGhre_SurveyQuestionPoolType() + { + QuestionContent = "单选评分", + QuestionType = "SingleScore", + isActive = 0, + Options=options + }, + new FromGhre_SurveyQuestionPoolType() + { + QuestionContent = "多选评分", + QuestionType = "MultipleScore", + isActive = 0, + Options=options + }, + new FromGhre_SurveyQuestionPoolType() + { + QuestionContent = "评分", + QuestionType = "Rate", + isActive = 0, + StartTips= "很不满意", + EndTips="非常满意", + QuestionIcon="ghr-survey-icon0" + }, + new FromGhre_SurveyQuestionPoolType() + { + QuestionContent = "量表", + QuestionType = "Scale", + isActive = 0, + StartTips= "很不满意", + EndTips="非常满意", + QuestionIcon="ghr-survey-icon0" + } + }; - if (Id > 0) + if (Id != 0) { - var options = await Db.Queryable().OrderBy(x => x.SortNo).Where(x => x.SurveyQuestionPoolId == Id).ToListAsync(); - data.Options = Mapper.Map(options).ToANew>(); + var question = await base.QueryById(Id); + data.PageData.questionType.ForEach(x => x.isActive = 0); + + data.PageData.baseData.CreateDataInfo = question.CreateDataInfo; + data.PageData.baseData.UpdateDataInfo = question.UpdateDataInfo; + data.PageData.baseData.BuiltIn = question.BuiltIn; } - return ServiceResult.OprateSuccess("查询成功!", data); + #endregion + return ServiceResult.OprateSuccess("查询成功!", data); } public async Task InsertFrom(InsertGhre_SurveyQuestionExtend insertModel) diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index 5a6623ab..467c7cdf 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -41898,6 +41898,16 @@ 修改信息 + + + 创建信息 + + + + + 修改信息 + + 员工id