irc_web/.svn/pristine/dc/dc1411e24b309cda975c0e4abb3...

258 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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>
<div style="width: 500px;text-align: right;margin: 10px 0;">
<el-button size="mini" type="primary" @click="addGroup(index, null)">添加规则</el-button>
<el-button size="mini" type="primary" @click="apply(item.ReadingQuestionTrialId, index)">应用</el-button>
</div>
<el-table
v-loading="loading"
:data="QuestionList[index].AnswerGroupList"
style="width: 500px;"
border
stripe
>
<el-table-column
prop="AnswerGroupA"
label="阅片人A"
min-width="100"
>
<template slot-scope="scope">
{{scope.row.AnswerGroupA.toString()}}
</template>
</el-table-column>
<el-table-column
prop="AnswerGroupB"
label="阅片人B"
min-width="100"
>
<template slot-scope="scope">
{{scope.row.AnswerGroupB.toString()}}
</template>
</el-table-column>
<el-table-column
prop="AnswerGroupB"
label="操作"
min-width="80"
>
<template slot-scope="scope">
<el-button
icon="el-icon-edit"
circle
title="编辑"
size="mini"
@click="addGroup(index, scope.$index)"
/>
<el-button
icon="el-icon-delete"
circle
title="删除"
size="mini"
@click="tagClose(index, scope.$index)"
/>
</template>
</el-table-column>
</el-table>
<!-- <div style="background: #f6f6f6;border-radius: 20px;padding: 15px 20px;margin-top: 10px;">-->
<!-- <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>-->
<!-- <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-dialog
title="选择答案"
v-if="QuestionVisible"
:visible.sync="QuestionVisible"
width="800px"
:close-on-click-modal="false"
custom-class="base-dialog-wrapper"
append-to-body
>
<div class="base-dialog-body">
<el-form-item label-width="110px" label="阅片人A">
<el-checkbox-group v-model="QuestionList[selectIndex].groupingA">
<el-checkbox v-for="(item, index) of QuestionList[selectIndex].TypeValue.split('|')" :label="item" :disabled="QuestionList[selectIndex].groupingB.length ? ~QuestionList[selectIndex].groupingB.indexOf(item) : false" :key="item">A{{index+1}}{{item}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label-width="110px" label="阅片人B">
<el-checkbox-group v-model="QuestionList[selectIndex].groupingB">
<el-checkbox v-for="(item, index) of QuestionList[selectIndex].TypeValue.split('|')" :label="item" :disabled="QuestionList[selectIndex].groupingA.length ? ~QuestionList[selectIndex].groupingA.indexOf(item) : false" :key="item">A{{index+1}}{{item}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<!-- 取消 -->
<el-button
:disabled="btnLoading"
size="small"
type="primary"
@click="QuestionVisible = false"
>
{{ $t('common:button:cancel') }}
</el-button>
<el-button
:disabled="btnLoading"
size="small"
type="primary"
@click="save"
>
保存
</el-button>
</div>
</el-dialog>
</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,
QuestionVisible: false,
activeNames: null,
indexA: null,
type: null
}
},
watch: {
ReadingQuestionCriterionTrialId(v) {
this.loading = true
getTrialCriterionJudgeQuestionList({
ReadingQuestionCriterionTrialId: v
}).then(res => {
this.loading = false
this.QuestionList = res.Result
this.activeNames = this.QuestionList[0].ReadingQuestionTrialId
this.QuestionList.forEach(v => {
this.$set(v, 'grouping', [])
this.$set(v, 'groupingA', [])
this.$set(v, 'groupingB', [])
this.$set(v, 'AnswerGroupList', Object.assign([], v.AnswerGroup))
console.log(v)
})
}).catch(() => {
this.btnLoading = false
this.loading = false
})
}
},
methods: {
tagClose(index, indexA) {
this.$confirm('删除该规则组?').then(() => {
this.QuestionList[index].AnswerGroupList.splice(indexA, 1)
})
},
save() {
var index = this.selectIndex
var indexA = this.indexA
if (this.QuestionList[index].groupingA.length === 0) {
this.$message.error('请先选择答案A')
return
}
if (this.QuestionList[index].groupingB.length === 0) {
this.$message.error('请先选择答案B')
return
}
if (this.type === 'add') {
this.QuestionList[index].AnswerGroupList.push({
AnswerGroupA: this.QuestionList[index].groupingA,
AnswerGroupB: this.QuestionList[index].groupingB
})
} else {
this.$set(this.QuestionList[index].AnswerGroupList[indexA], 'AnswerGroupA', this.QuestionList[index].groupingA)
this.$set(this.QuestionList[index].AnswerGroupList[indexA], 'AnswerGroupB', this.QuestionList[index].groupingB)
}
this.$set(this.QuestionList[index], 'groupingA', [])
this.$set(this.QuestionList[index], 'groupingB', [])
this.$message.success('成功新增答案规则')
this.QuestionVisible = false
},
addGroup(index, indexA) {
this.selectIndex = index
this.type = 'add'
if (indexA !== null) {
this.indexA = indexA
this.type = 'edit'
console.log(this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupA)
console.log(this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupB)
this.$set(this.QuestionList[index], 'groupingA', this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupA)
this.$set(this.QuestionList[index], 'groupingB', this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupB)
}
this.QuestionVisible = true
// 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>