|
|
|
@ -1,4 +1,8 @@ |
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using System.Net; |
|
|
|
|
using Tiobon.Core.IServices; |
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 问卷题库 (服务) |
|
|
|
@ -52,16 +56,163 @@ public class Ghre_SurveyQuestionPoolServices : BaseServices<Ghre_SurveyQuestionP |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="Id"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
public async Task<ServiceResult<InsertGhre_SurveyQuestionExtend>> QueryFrom(long Id) |
|
|
|
|
public async Task<ServiceResult<FromGhre_SurveyQuestionPoolInput>> 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<InsertGhre_SurveyOptionExtend> |
|
|
|
|
{ |
|
|
|
|
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<InsertGhre_SurveyOptionExtend> |
|
|
|
|
{ |
|
|
|
|
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<FromGhre_SurveyQuestionPoolType> |
|
|
|
|
{ |
|
|
|
|
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<Ghre_SurveyQuestionPoolOption>().OrderBy(x => x.SortNo).Where(x => x.SurveyQuestionPoolId == Id).ToListAsync(); |
|
|
|
|
data.Options = Mapper.Map(options).ToANew<List<InsertGhre_SurveyOptionExtend>>(); |
|
|
|
|
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<InsertGhre_SurveyQuestionExtend>.OprateSuccess("查询成功!", data); |
|
|
|
|
#endregion |
|
|
|
|
return ServiceResult<FromGhre_SurveyQuestionPoolInput>.OprateSuccess("查询成功!", data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult> InsertFrom(InsertGhre_SurveyQuestionExtend insertModel) |
|
|
|
|