143 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			143 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
<template>
 | 
						|
  <div v-loading="loading" style="min-height:400px;">
 | 
						|
    <el-form
 | 
						|
      v-if="isRender"
 | 
						|
      ref="questions"
 | 
						|
      size="small"
 | 
						|
      :model="questionForm"
 | 
						|
    >
 | 
						|
      <template v-if="formType===2">
 | 
						|
        <el-tabs v-model="activeName">
 | 
						|
          <el-tab-pane
 | 
						|
            v-for="q of questions"
 | 
						|
            :key="q.PageName"
 | 
						|
            :label="q.PageName"
 | 
						|
            :name="q.PageName"
 | 
						|
          >
 | 
						|
            <div v-if="q.Childrens.length>0" :class="{'tabContent':publicQuestions.length>0}">
 | 
						|
              <FormItem
 | 
						|
                v-for="question of q.Childrens"
 | 
						|
                :key="question.ReadingQuestionTrialId"
 | 
						|
                :question="question"
 | 
						|
                :question-form="questionForm"
 | 
						|
                :reading-task-state="readingTaskState"
 | 
						|
                @resetFormItemData="resetFormItemData"
 | 
						|
              />
 | 
						|
            </div>
 | 
						|
          </el-tab-pane>
 | 
						|
        </el-tabs>
 | 
						|
        <el-divider v-if="publicQuestions.length>0" content-position="left">
 | 
						|
          <!-- 公共分页 -->
 | 
						|
        </el-divider>
 | 
						|
        <div v-for="q of publicQuestions" :key="q.PageName">
 | 
						|
          <h4>{{ q.PageName }}</h4>
 | 
						|
          <template v-if="q.Childrens.length>0">
 | 
						|
            <FormItem
 | 
						|
              v-for="question of q.Childrens"
 | 
						|
              :key="question.ReadingQuestionTrialId"
 | 
						|
              :question="question"
 | 
						|
              :question-form="questionForm"
 | 
						|
              :reading-task-state="readingTaskState"
 | 
						|
              @resetFormItemData="resetFormItemData"
 | 
						|
            />
 | 
						|
          </template>
 | 
						|
        </div>
 | 
						|
      </template>
 | 
						|
      <template v-else>
 | 
						|
        <FormItem
 | 
						|
          v-for="question of questions"
 | 
						|
          :key="question.ReadingQuestionTrialId"
 | 
						|
          :question="question"
 | 
						|
          :question-form="questionForm"
 | 
						|
          :reading-task-state="readingTaskState"
 | 
						|
          @resetFormItemData="resetFormItemData"
 | 
						|
        />
 | 
						|
      </template>
 | 
						|
    </el-form>
 | 
						|
  </div>
 | 
						|
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
 | 
						|
import { getSystemReadingQuestion } from '@/api/dictionary'
 | 
						|
import FormItem from '@/views/trials/trials-panel/reading/none-dicoms/components/FormItem'
 | 
						|
export default {
 | 
						|
  name: 'EcrfPreview',
 | 
						|
  components: {
 | 
						|
    FormItem
 | 
						|
  },
 | 
						|
  props: {
 | 
						|
    criterionId: {
 | 
						|
      type: String,
 | 
						|
      required: true
 | 
						|
    }
 | 
						|
  },
 | 
						|
  data() {
 | 
						|
    return {
 | 
						|
      loading: false,
 | 
						|
      questions: [],
 | 
						|
      questionForm: {},
 | 
						|
      publicQuestions: [],
 | 
						|
      isRender: false,
 | 
						|
      readingTaskState: 0,
 | 
						|
      activeName: 0
 | 
						|
    }
 | 
						|
  },
 | 
						|
  mounted() {
 | 
						|
    this.getQuestions()
 | 
						|
  },
 | 
						|
  methods: {
 | 
						|
    getQuestions() {
 | 
						|
      this.loading = true
 | 
						|
      var param = {
 | 
						|
        id: this.criterionId
 | 
						|
      }
 | 
						|
      getSystemReadingQuestion(param).then(res => {
 | 
						|
        res.Result.SinglePage.map((v) => {
 | 
						|
          if (v.Type === 'group' && v.Childrens.length === 0) return
 | 
						|
          if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary') {
 | 
						|
            this.$set(this.questionForm, v.ReadingQuestionTrialId, '')
 | 
						|
          }
 | 
						|
          if (v.Childrens.length > 0) {
 | 
						|
            this.setChild(v.Childrens)
 | 
						|
          }
 | 
						|
        })
 | 
						|
        this.questions = res.Result.SinglePage
 | 
						|
 | 
						|
        this.isRender = true
 | 
						|
        this.loading = false
 | 
						|
      }).catch(() => { this.loading = false })
 | 
						|
    },
 | 
						|
    setChild(obj) {
 | 
						|
      obj.forEach(i => {
 | 
						|
        if (i.Type !== 'group' && i.Type !== 'summary' && i.ReadingQuestionTrialId) {
 | 
						|
          this.$set(this.questionForm, i.ReadingQuestionTrialId, '')
 | 
						|
        }
 | 
						|
        if (i.Childrens && i.Childrens.length > 0) {
 | 
						|
          this.setChild(i.Childrens)
 | 
						|
        }
 | 
						|
      })
 | 
						|
    },
 | 
						|
    resetFormItemData(v) {
 | 
						|
      this.questionForm[v] = ''
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
</script>
 | 
						|
<style lang="scss" scoped>
 | 
						|
::-webkit-scrollbar {
 | 
						|
    width: 7px;
 | 
						|
    height: 7px;
 | 
						|
  }
 | 
						|
  ::-webkit-scrollbar-thumb {
 | 
						|
    border-radius: 10px;
 | 
						|
    background: #d0d0d0;
 | 
						|
  }
 | 
						|
.tabContent{
 | 
						|
  height:300px;
 | 
						|
  overflow-y: auto;
 | 
						|
 | 
						|
}
 | 
						|
</style>
 |