diff --git a/src/views/trials/trials-panel/setting/reading-unit/components/ArbitrationRules.vue b/src/views/trials/trials-panel/setting/reading-unit/components/ArbitrationRules.vue index 0e9cc260..dd2729d8 100644 --- a/src/views/trials/trials-panel/setting/reading-unit/components/ArbitrationRules.vue +++ b/src/views/trials/trials-panel/setting/reading-unit/components/ArbitrationRules.vue @@ -26,7 +26,7 @@ {{ $t('common:button:reset') }} - + {{ item.label }} @@ -102,7 +102,9 @@
- {{ item.label }} + {{ item }} @@ -127,6 +129,13 @@
+
+ + + + + +
@@ -145,15 +154,23 @@ - {{ item }} - {{ item.label }} + + - {{ item }} - {{ item.label }} + + @@ -206,7 +223,35 @@ export default { OtherInfo: { IsSign: true }, - JudgyInfo: {} + JudgyInfo: {}, + JudgeDifferenceValueQRules:{ + JudgeDifferenceValue:[ + { + required: true, + message: this.$t( + "trials:trials-list:setitng:JudgeDifferenceValueRequired" + ), + trigger: "blur", + }, + { + pattern: /^[0-9]+(.[0-9]{2})?$/, + message: this.$t( + "trials:trials-list:setitng:JudgeDifferenceValue" + ), + trigger: "blur", + }, + { + validator: (rule, value, callback) => { + if (value <= 0) { + callback(new Error(this.$t("trials:trials-list:setitng:JudgeDifferenceValueMin"))); + } else { + callback(); + } + }, + trigger: "blur", + }, + ] + }, } }, watch: { @@ -240,6 +285,16 @@ export default { this.getTrialJudgyInfo() }, methods: { + JudgeTypeChange(value,index){ + this.$nextTick(()=>{ + if(value===4||value===5){ + if(this.$refs['JudgeDifferenceValue'+value+index][0]){ + this.$refs['JudgeDifferenceValue'+value+index][0].resetFields(); + // this.QuestionList[index].JudgeDifferenceValue = 0; + } + } + }) + }, saveAllSync() { return new Promise((resolve, reject) => { var arr = [] @@ -379,7 +434,8 @@ export default { ReadingQuestionTrialId: ReadingQuestionTrialId, AnswerGroup: [], AnswerCombination: [], - JudgeType: 0 + JudgeType: 0, + JudgeDifferenceValue:0, }).then(res => { this.$set(this.QuestionList[index], 'AnswerGroup2List', []) this.$set(this.QuestionList[index], 'AnswerGroupList', []) @@ -393,7 +449,7 @@ export default { }) }) }, - apply(ReadingQuestionTrialId, index) { + async apply(ReadingQuestionTrialId, index) { if (this.QuestionList[index].JudgeType === 0) { this.$alert(this.$t('trials:adRules:message:msg8'))// '请先配置规则才能应用' return @@ -406,13 +462,22 @@ export default { this.$alert(this.$t('trials:adRules:message:msg8')) return } + if (this.QuestionList[index].JudgeType === 4||this.QuestionList[index].JudgeType === 5) { + try{ + let validate = await this.$refs['JudgeDifferenceValue'+this.QuestionList[index].JudgeType+index][0].validate(); + if(!validate) return; + }catch(err){ + return; + } + } this.btnLoading = true this.loading = true setTrialCriterionJudgeQuestionAnswerGroup({ ReadingQuestionTrialId: ReadingQuestionTrialId, AnswerGroup: this.QuestionList[index].AnswerGroup2List, AnswerCombination: this.QuestionList[index].AnswerGroupList, - JudgeType: this.QuestionList[index].JudgeType + JudgeType: this.QuestionList[index].JudgeType, + JudgeDifferenceValue:Number(this.QuestionList[index].JudgeDifferenceValue), }).then(res => { this.$message.success(this.$t('trials:adRules:message:msg9'))// '应用成功' this.btnLoading = false