133 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			133 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
<template>
 | 
						|
  <div>
 | 
						|
    <el-form
 | 
						|
      ref="readingCriterionsForm"
 | 
						|
      v-loading="loading"
 | 
						|
      :model="form"
 | 
						|
      :rules="rules"
 | 
						|
      label-width="120px"
 | 
						|
      size="small"
 | 
						|
    >
 | 
						|
      <!-- 修约小数位数 -->
 | 
						|
      <el-form-item
 | 
						|
        :label="$t('trials:processCfg:form:digitPlaces')"
 | 
						|
        prop="DigitPlaces"
 | 
						|
      >
 | 
						|
        <el-radio-group
 | 
						|
          v-model="form.DigitPlaces"
 | 
						|
        >
 | 
						|
          <el-radio
 | 
						|
            v-for="item of $d.DigitPlaces"
 | 
						|
            :key="item.id"
 | 
						|
            :label="item.value"
 | 
						|
          >
 | 
						|
            {{ item.label }}
 | 
						|
          </el-radio>
 | 
						|
        </el-radio-group>
 | 
						|
      </el-form-item>
 | 
						|
      <!-- 表单类型 -->
 | 
						|
      <el-form-item
 | 
						|
        label="表单类型"
 | 
						|
        prop="ImagePlatform"
 | 
						|
      >
 | 
						|
        <el-radio-group
 | 
						|
          v-model="form.FormType"
 | 
						|
        >
 | 
						|
          <el-radio
 | 
						|
            v-for="item of $d.CriterionFormType"
 | 
						|
            :key="item.id"
 | 
						|
            :label="item.value"
 | 
						|
          >
 | 
						|
            {{ item.label }}
 | 
						|
          </el-radio>
 | 
						|
        </el-radio-group>
 | 
						|
      </el-form-item>
 | 
						|
      <el-form-item>
 | 
						|
        <QuestionsList
 | 
						|
          v-if="form.FormType===1"
 | 
						|
          :list="readingInfo.TrialQuestionList"
 | 
						|
          :trial-criterion-id="readingInfo.TrialCriterionId"
 | 
						|
        />
 | 
						|
        <PageBreakList
 | 
						|
          v-if="form.FormType===2"
 | 
						|
          :list="readingInfo.ReadingCriterionPageList"
 | 
						|
          :trial-criterion-id="readingInfo.TrialCriterionId"
 | 
						|
        />
 | 
						|
      </el-form-item>
 | 
						|
      <el-form-item>
 | 
						|
        <!-- 保存 -->
 | 
						|
        <el-button
 | 
						|
          type="primary"
 | 
						|
          @click="handleSave"
 | 
						|
        >
 | 
						|
          {{ $t('common:button:save') }}
 | 
						|
        </el-button>
 | 
						|
      </el-form-item>
 | 
						|
    </el-form>
 | 
						|
 | 
						|
  </div>
 | 
						|
</template>
 | 
						|
<script>
 | 
						|
import { getTrialReadingCriterionInfo, setTrialReadingCriterion } from '@/api/trials'
 | 
						|
import PageBreakList from './PageBreakList'
 | 
						|
import QuestionsList from './QuestionsList'
 | 
						|
export default {
 | 
						|
  name: 'ReadingCriterion',
 | 
						|
  components: { PageBreakList, QuestionsList },
 | 
						|
  data() {
 | 
						|
    return {
 | 
						|
      loading: false,
 | 
						|
      form: {
 | 
						|
        TrialCriterionId: '',
 | 
						|
        FormType: null,
 | 
						|
        DigitPlaces: null
 | 
						|
      },
 | 
						|
      rules: {
 | 
						|
        FormType: [
 | 
						|
          { required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }
 | 
						|
        ],
 | 
						|
        DigitPlaces: [
 | 
						|
          { required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }
 | 
						|
        ]
 | 
						|
      },
 | 
						|
      readingInfo: {}
 | 
						|
    }
 | 
						|
  },
 | 
						|
  mounted() {
 | 
						|
    this.initPage()
 | 
						|
  },
 | 
						|
  methods: {
 | 
						|
    initPage() {
 | 
						|
      this.loading = true
 | 
						|
      const trialId = this.$route.query.trialId
 | 
						|
      getTrialReadingCriterionInfo({ trialId }).then(res => {
 | 
						|
        this.loading = false
 | 
						|
        this.readingInfo = res.Result
 | 
						|
        for (const k in this.form) {
 | 
						|
          if (res.Result.hasOwnProperty(k)) {
 | 
						|
            this.form[k] = res.Result[k]
 | 
						|
          }
 | 
						|
        }
 | 
						|
      }).catch(() => {
 | 
						|
        this.loading = false
 | 
						|
      })
 | 
						|
    },
 | 
						|
    // 配置信息保存
 | 
						|
    handleSave() {
 | 
						|
      this.$refs['readingCriterionsForm'].validate((valid) => {
 | 
						|
        if (!valid) return
 | 
						|
        this.loading = true
 | 
						|
        // 保存配置信息
 | 
						|
        setTrialReadingCriterion(this.form).then(res => {
 | 
						|
          this.loading = false
 | 
						|
          if (res.IsSuccess) {
 | 
						|
            this.$message.success(this.$t('common:message:savedSuccessfully'))
 | 
						|
          }
 | 
						|
        }).catch(_ => { this.loading = false })
 | 
						|
      })
 | 
						|
    }
 | 
						|
 | 
						|
  }
 | 
						|
}
 | 
						|
</script>
 |