|
@@ -56,15 +56,15 @@
|
|
|
<li v-for="(question,index) in addedQuestionList" :key="question.id">
|
|
<li v-for="(question,index) in addedQuestionList" :key="question.id">
|
|
|
<div class="question_title"
|
|
<div class="question_title"
|
|
|
:class="{required:question.extraConfig.includes('required')}">
|
|
:class="{required:question.extraConfig.includes('required')}">
|
|
|
- {{index + 1}}.{{ question.title }}
|
|
|
|
|
|
|
+ {{index + 1}}.{{ question.questionTitleName }}
|
|
|
<span class="question_type">[{{ qustionTypeToName(question.questionType) }}]</span>
|
|
<span class="question_type">[{{ qustionTypeToName(question.questionType) }}]</span>
|
|
|
</div>
|
|
</div>
|
|
|
<QuestionTypeShow
|
|
<QuestionTypeShow
|
|
|
:isHorizontal="question.extraConfig.includes('isHorizontal')"
|
|
:isHorizontal="question.extraConfig.includes('isHorizontal')"
|
|
|
:questionType="Number(question.questionType)"
|
|
:questionType="Number(question.questionType)"
|
|
|
:questionSubOptions="question.options"
|
|
:questionSubOptions="question.options"
|
|
|
- :scoreReviewType="Number(question.scoreReviewType)"
|
|
|
|
|
- :titleScore="Number(question.titleScore)"
|
|
|
|
|
|
|
+ :evaluationType="Number(question.evaluationType)"
|
|
|
|
|
+ :questionScore="Number(question.questionScore)"
|
|
|
></QuestionTypeShow>
|
|
></QuestionTypeShow>
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
@@ -98,7 +98,7 @@
|
|
|
@dragstart="(e)=>HandleDragStart(e)"
|
|
@dragstart="(e)=>HandleDragStart(e)"
|
|
|
@dragend="(e)=>HandleDragEnd(e,question,index)"
|
|
@dragend="(e)=>HandleDragEnd(e,question,index)"
|
|
|
>
|
|
>
|
|
|
- {{ index + 1 }}.{{ question.title }}
|
|
|
|
|
|
|
+ {{ index + 1 }}.{{ question.questionTitleName }}
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
@@ -120,10 +120,11 @@ import { unioformDateTransform } from '@/utils/dateTransform';
|
|
|
import { useHandleMoveUpAndDown } from '@/baseComponents/useHandleMoveUpAndDown';
|
|
import { useHandleMoveUpAndDown } from '@/baseComponents/useHandleMoveUpAndDown';
|
|
|
|
|
|
|
|
import QuestionTypeShow from '@/components/QuestionTypeShow.vue';
|
|
import QuestionTypeShow from '@/components/QuestionTypeShow.vue';
|
|
|
-
|
|
|
|
|
import moveUpDownIcon from '@/assets/icon/move_up_down.png'
|
|
import moveUpDownIcon from '@/assets/icon/move_up_down.png'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import {addQuestionnaireApi} from '@/api/surveyManagement'
|
|
|
|
|
+
|
|
|
// 题目选项信息 参数
|
|
// 题目选项信息 参数
|
|
|
interface Option {
|
|
interface Option {
|
|
|
label: String
|
|
label: String
|
|
@@ -133,17 +134,17 @@ interface Option {
|
|
|
// 题目信息 参数
|
|
// 题目信息 参数
|
|
|
interface QuestionItm {
|
|
interface QuestionItm {
|
|
|
id:Number
|
|
id:Number
|
|
|
- title: String //题目名称
|
|
|
|
|
- titleScore?: String | Number //题目分值
|
|
|
|
|
|
|
+ questionTitleName: String //题目名称
|
|
|
|
|
+ questionScore?: String | Number //题目分值
|
|
|
questionType: String | String //题目类型
|
|
questionType: String | String //题目类型
|
|
|
extraConfig: String[] // 是否必答 required, 是否横排 isHorizontal
|
|
extraConfig: String[] // 是否必答 required, 是否横排 isHorizontal
|
|
|
options: Option[], //单选/多选 的 选项配置
|
|
options: Option[], //单选/多选 的 选项配置
|
|
|
- scoreReviewType: Number|String
|
|
|
|
|
|
|
+ evaluationType: Number|String // 评分题 的 分值展示形式
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
interface QuestionnaireInfo {
|
|
interface QuestionnaireInfo {
|
|
|
- questionnaireTitle:String,
|
|
|
|
|
- questionnaireDesc:String
|
|
|
|
|
|
|
+ assessmentTitle:String,
|
|
|
|
|
+ assessmentIllustrate:String
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -156,19 +157,19 @@ const questionnaireMsg = ref()
|
|
|
|
|
|
|
|
// 试卷头基本信息
|
|
// 试卷头基本信息
|
|
|
const questionnaireInfo = ref<QuestionnaireInfo>({
|
|
const questionnaireInfo = ref<QuestionnaireInfo>({
|
|
|
- questionnaireTitle:'',
|
|
|
|
|
- questionnaireDesc:''
|
|
|
|
|
|
|
+ assessmentTitle:'',
|
|
|
|
|
+ assessmentIllustrate:''
|
|
|
})
|
|
})
|
|
|
// 已经添加的题型
|
|
// 已经添加的题型
|
|
|
const addedQuestionList = ref<QuestionItm[]>([
|
|
const addedQuestionList = ref<QuestionItm[]>([
|
|
|
{
|
|
{
|
|
|
id:0,
|
|
id:0,
|
|
|
- title: '测试', //题目名称
|
|
|
|
|
- titleScore: 20, //题目分值
|
|
|
|
|
|
|
+ questionTitleName: '测试', //题目名称
|
|
|
|
|
+ questionScore: 20, //题目分值
|
|
|
questionType: '2', //题目类型
|
|
questionType: '2', //题目类型
|
|
|
extraConfig:[], // 是否必答 required, 是否横排 isHorizontal
|
|
extraConfig:[], // 是否必答 required, 是否横排 isHorizontal
|
|
|
options: [] ,
|
|
options: [] ,
|
|
|
- scoreReviewType:''
|
|
|
|
|
|
|
+ evaluationType:''
|
|
|
}
|
|
}
|
|
|
])
|
|
])
|
|
|
|
|
|
|
@@ -180,12 +181,12 @@ const selectedQuestionGetScore = ref(false)
|
|
|
// 试卷总分
|
|
// 试卷总分
|
|
|
const questionTotalScore = computed(()=>{
|
|
const questionTotalScore = computed(()=>{
|
|
|
return addedQuestionList.value?.reduce((a,b)=>{
|
|
return addedQuestionList.value?.reduce((a,b)=>{
|
|
|
- let aScore = Number(a.titleScore || 0)
|
|
|
|
|
- let bScore = Number(b.titleScore || 0)
|
|
|
|
|
|
|
+ let aScore = Number(a.questionScore || 0)
|
|
|
|
|
+ let bScore = Number(b.questionScore || 0)
|
|
|
return {
|
|
return {
|
|
|
- titleScore:aScore + bScore
|
|
|
|
|
|
|
+ questionScore:aScore + bScore
|
|
|
}
|
|
}
|
|
|
- },{titleScore:0}).titleScore
|
|
|
|
|
|
|
+ },{questionScore:0}).questionScore
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
@@ -247,23 +248,25 @@ const SaveQuestionnaire = async ()=>{
|
|
|
await formRef.validate(async(valid) => {
|
|
await formRef.validate(async(valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
if(addedQuestionList.value.length > 0){
|
|
if(addedQuestionList.value.length > 0){
|
|
|
|
|
+
|
|
|
|
|
+ // addQuestionnaireApi()
|
|
|
/**
|
|
/**
|
|
|
* 模拟数据
|
|
* 模拟数据
|
|
|
*/
|
|
*/
|
|
|
// 模拟保存数据 和页面跳转
|
|
// 模拟保存数据 和页面跳转
|
|
|
let questionnaireList = JSON.parse(localStorage.getItem('questionnaireList') || '[]')
|
|
let questionnaireList = JSON.parse(localStorage.getItem('questionnaireList') || '[]')
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
questionnaireMsg.value = {
|
|
questionnaireMsg.value = {
|
|
|
...(questionnaireInfo.value),
|
|
...(questionnaireInfo.value),
|
|
|
- quetionList:addedQuestionList.value,
|
|
|
|
|
|
|
+ questionData:addedQuestionList.value,
|
|
|
id:Number(questionnaireList[questionnaireList.length - 1]?.id || 0) + 1,
|
|
id:Number(questionnaireList[questionnaireList.length - 1]?.id || 0) + 1,
|
|
|
createTime:unioformDateTransform(new Date()),
|
|
createTime:unioformDateTransform(new Date()),
|
|
|
createBy:'管理员',
|
|
createBy:'管理员',
|
|
|
- totalScore:questionTotalScore.value,
|
|
|
|
|
|
|
+ assessmentScore:questionTotalScore.value,
|
|
|
useStatus:1
|
|
useStatus:1
|
|
|
}
|
|
}
|
|
|
questionnaireList.push(questionnaireMsg.value)
|
|
questionnaireList.push(questionnaireMsg.value)
|
|
|
- localStorage.setItem('questionnaireList',JSON.stringify(questionnaireList.value || []))
|
|
|
|
|
|
|
+ localStorage.setItem('questionnaireList',JSON.stringify(questionnaireList || []))
|
|
|
}else{
|
|
}else{
|
|
|
ElMessage.warning('请添加问卷题目')
|
|
ElMessage.warning('请添加问卷题目')
|
|
|
}
|
|
}
|