117 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			117 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
| <template>
 | ||
|   <el-form v-loading="loading">
 | ||
|     <el-tabs type="border-card" v-model="index" @tab-click="tabClick()">
 | ||
|       <el-tab-pane v-for="itemC of CriterionList" :key="itemC.ReadingQuestionCriterionTrialId">
 | ||
|         <span slot="label">
 | ||
|           {{itemC.ReadingQuestionCriterionTrialName}}
 | ||
|         </span>
 | ||
|           <el-collapse v-model="activeNames">
 | ||
|             <el-collapse-item style="position: relative" v-for="(item, index) of QuestionList" :key="item.ReadingQuestionTrialId" :name="item.ReadingQuestionTrialId">
 | ||
|               <div slot="title">
 | ||
|                 Q{{index + 1}}:{{item.QuestionName}}
 | ||
|               </div>
 | ||
|               <el-checkbox-group v-model="QuestionList[index].grouping">
 | ||
|                 <el-checkbox v-for="(item, index) of item.TypeValue.split('|')" :label="item" :key="item">A{{index+1}}:{{item}}</el-checkbox>
 | ||
|               </el-checkbox-group>
 | ||
|               <div style="margin-top: 20px;">当前选择答案分组: <el-tag v-if="QuestionList[index].grouping.length > 0">{{QuestionList[index].grouping.toString().replaceAll(',', '|')}}</el-tag> <el-button size="mini" type="primary" @click="addGroup(index)">添加分组</el-button></div>
 | ||
|               <div style="margin-top: 20px;">分组: <el-tag closable @close="() => {return tagClose(index, indexA)}" v-for="itemA of QuestionList[index].AnswerGroupList" style="margin-right:10px;">{{itemA}}</el-tag> <el-button size="mini" type="primary" @click="apply(item.ReadingQuestionTrialId, index)">应用</el-button></div>
 | ||
|             </el-collapse-item>
 | ||
|           </el-collapse>
 | ||
|       </el-tab-pane>
 | ||
|     </el-tabs>
 | ||
|   </el-form>
 | ||
| </template>
 | ||
| 
 | ||
| <script>
 | ||
| import { getTrialConfirmCriterionList, getTrialCriterionJudgeQuestionList, setTrialCriterionJudgeQuestionAnswerGroup } from '@/api/trials/reading'
 | ||
| export default {
 | ||
|   data() {
 | ||
|     return {
 | ||
|       CriterionList: [],
 | ||
|       QuestionList: [],
 | ||
|       ReadingQuestionCriterionTrialId: null,
 | ||
|       btnLoading: false,
 | ||
|       loading: false,
 | ||
|       index: 0
 | ||
|     }
 | ||
|   },
 | ||
|   watch: {
 | ||
|     ReadingQuestionCriterionTrialId(v) {
 | ||
|       this.loading = true
 | ||
|       getTrialCriterionJudgeQuestionList({
 | ||
|         ReadingQuestionCriterionTrialId: v
 | ||
|       }).then(res => {
 | ||
|         this.loading = false
 | ||
|         this.QuestionList = res.Result
 | ||
|         this.QuestionList.forEach(v => {
 | ||
|           this.$set(v, 'grouping', [])
 | ||
|           this.$set(v, 'AnswerGroupList', Object.assign([], v.AnswerGroup))
 | ||
|           console.log(v)
 | ||
|         })
 | ||
|       }).catch(() => {
 | ||
|         this.btnLoading = false
 | ||
|         this.loading = false
 | ||
|       })
 | ||
|     }
 | ||
|   },
 | ||
|   methods: {
 | ||
|     tagClose(index, indexA) {
 | ||
|       this.QuestionList[index].AnswerGroupList.splice(indexA, 1)
 | ||
|     },
 | ||
|     addGroup(index) {
 | ||
|       if (this.QuestionList[index].grouping.length === 0) {
 | ||
|         this.$message.error('请先选择答案,再添加分组')
 | ||
|         return
 | ||
|       }
 | ||
|       var grouping = this.QuestionList[index].grouping.toString().replaceAll(',', '|')
 | ||
|       this.QuestionList[index].AnswerGroupList.push(`|${grouping}|`)
 | ||
|       this.$set(this.QuestionList[index], 'grouping', [])
 | ||
|     },
 | ||
|     apply(ReadingQuestionTrialId, index) {
 | ||
|       this.btnLoading = true
 | ||
|       this.loading = true
 | ||
|       setTrialCriterionJudgeQuestionAnswerGroup({
 | ||
|         ReadingQuestionTrialId: ReadingQuestionTrialId,
 | ||
|         AnswerGroup: this.QuestionList[index].AnswerGroupList
 | ||
|       }).then(res => {
 | ||
|         this.$message.success('应用成功')
 | ||
|         this.btnLoading = false
 | ||
|         this.loading = false
 | ||
|       }).catch(() => {
 | ||
|         this.btnLoading = false
 | ||
|         this.loading = false
 | ||
|       })
 | ||
|     },
 | ||
|     tabClick(v) {
 | ||
|       this.ReadingQuestionCriterionTrialId = this.CriterionList[this.index].ReadingQuestionCriterionTrialId
 | ||
|     },
 | ||
|     getList() {
 | ||
|       this.btnLoading = true
 | ||
|       this.loading = true
 | ||
|       getTrialConfirmCriterionList({
 | ||
|         TrialId: this.$route.query.trialId
 | ||
|       }).then(res => {
 | ||
|         this.CriterionList = res.Result
 | ||
|         if (this.CriterionList.length) {
 | ||
|           this.ReadingQuestionCriterionTrialId = this.CriterionList[0].ReadingQuestionCriterionTrialId
 | ||
|         } else {
 | ||
|           this.$alert('请先去确定阅片标准裁判问题配置')
 | ||
|         }
 | ||
|         this.btnLoading = false
 | ||
|         this.loading = false
 | ||
|       }).catch(() => {
 | ||
|         this.btnLoading = false
 | ||
|         this.loading = false
 | ||
|       })
 | ||
|     }
 | ||
|   },
 | ||
|   mounted() {
 | ||
|     this.getList()
 | ||
|   }
 | ||
| }
 | ||
| </script>
 | ||
| 
 | ||
| <style scoped>
 | ||
| 
 | ||
| </style>
 |