156 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			156 lines
		
	
	
		
			4.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="'表单问题'">
 | |
|         <QuestionsList
 | |
|           :TrialReadingCriterionId="TrialReadingCriterionId"
 | |
|           v-if="form.FormType===1"
 | |
|           :list="readingInfo.TrialQuestionList"
 | |
|           :trial-criterion-id="readingInfo.TrialCriterionId"
 | |
|           :is-confirm="isConfirm"
 | |
|           :is-from-system="readingInfo.IsFromSystem"
 | |
|           @reloadArbitrationRules="reloadArbitrationRules"
 | |
|         />
 | |
|         <PageBreakList
 | |
|           :TrialReadingCriterionId="TrialReadingCriterionId"
 | |
|           v-if="form.FormType===2"
 | |
|           :list="readingInfo.ReadingCriterionPageList"
 | |
|           :trial-criterion-id="readingInfo.TrialCriterionId"
 | |
|           :is-confirm="isConfirm"
 | |
|           :is-from-system="readingInfo.IsFromSystem"
 | |
|           @reloadArbitrationRules="reloadArbitrationRules"
 | |
|         />
 | |
|       </el-form-item>
 | |
|       <el-form-item v-if=" hasPermi(['trials:trials-panel:setting:reading-unit:edit'])">
 | |
|         <!-- 保存 -->
 | |
|         <el-button
 | |
|           v-if="!isConfirm"
 | |
|           type="primary"
 | |
|           @click="handleSave(true)"
 | |
|         >
 | |
|           {{ $t('common:button:save') }}
 | |
|         </el-button>
 | |
|         <el-button
 | |
|           type="primary"
 | |
|           @click="configBaseDataVisible = true"
 | |
|         >
 | |
|           基础数据配置
 | |
|         </el-button>
 | |
|       </el-form-item>
 | |
|     </el-form>
 | |
| 
 | |
|     <el-dialog
 | |
|       v-if="configBaseDataVisible"
 | |
|       title="基础数据配置"
 | |
|       :visible.sync="configBaseDataVisible"
 | |
|       :close-on-click-modal="false"
 | |
|       :fullscreen="true"
 | |
|       append-to-body
 | |
|       custom-class="base-dialog-wrapper"
 | |
|     >
 | |
|       <BaseDataConfig :TrialReadingCriterionId="TrialReadingCriterionId" :is-from-system="readingInfo.IsFromSystem" :is-confirm="isConfirm" />
 | |
|     </el-dialog>
 | |
| 
 | |
|   </div>
 | |
| </template>
 | |
| <script>
 | |
| import { getTrialReadingCriterionInfo, setTrialReadingCriterion } from '@/api/trials'
 | |
| import PageBreakList from './PageBreakList'
 | |
| import QuestionsList from './QuestionsList'
 | |
| import BaseDataConfig from './BaseDataConfig'
 | |
| export default {
 | |
|   name: 'ReadingCriterion',
 | |
|   components: { PageBreakList, QuestionsList, BaseDataConfig },
 | |
|   props: {
 | |
|     TrialReadingCriterionId: {
 | |
|       type: String,
 | |
|       default() {
 | |
|         return ''
 | |
|       }
 | |
|     }
 | |
|   },
 | |
|   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: {},
 | |
|       isConfirm: true,
 | |
|       configBaseDataVisible: false
 | |
|     }
 | |
|   },
 | |
|   mounted() {
 | |
|     this.initPage()
 | |
|   },
 | |
|   methods: {
 | |
|     initPage() {
 | |
|       this.loading = true
 | |
|       const trialId = this.$route.query.trialId
 | |
|       getTrialReadingCriterionInfo({ trialId, TrialReadingCriterionId: this.TrialReadingCriterionId }).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]
 | |
|           }
 | |
|         }
 | |
|         this.isConfirm = res.Result.IsSign
 | |
|       }).catch(() => {
 | |
|         this.loading = false
 | |
|       })
 | |
|     },
 | |
|     // 配置信息保存
 | |
|     handleSave(isPrompt = true) {
 | |
|       return new Promise((resolve, reject) => {
 | |
|         this.$refs['readingCriterionsForm'].validate((valid) => {
 | |
|           if (!valid) {
 | |
|             resolve(false)
 | |
|           } else {
 | |
|             this.loading = true
 | |
|             // 保存配置信息
 | |
|             if (!isPrompt) {
 | |
|               this.form.IsSignSave = true
 | |
|             }
 | |
|             this.form.TrialReadingCriterionId = this.TrialReadingCriterionId
 | |
|             setTrialReadingCriterion(this.form).then(res => {
 | |
|               this.loading = false
 | |
|               if (res.IsSuccess && isPrompt) {
 | |
|                 this.$message.success(this.$t('common:message:savedSuccessfully'))
 | |
|               }
 | |
|               this.$emit('reloadArbitrationRules')
 | |
|               resolve(true)
 | |
|             }).catch(_ => {
 | |
|               this.loading = false
 | |
|               resolve(false)
 | |
|             })
 | |
|           }
 | |
|         })
 | |
|       })
 | |
|     },
 | |
|     reloadArbitrationRules() {
 | |
|       this.$emit('reloadArbitrationRules')
 | |
|     },
 | |
|     handleConfig() {}
 | |
| 
 | |
|   }
 | |
| }
 | |
| </script>
 |