irc_web/.svn/pristine/c0/c0cfeaa32c2cea919acdb729034...

435 lines
18 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.

<!-- eslint-disable vue/no-unused-vars -->
<!-- eslint-disable vue/no-template-shadow -->
/* eslint-disable */
<template>
<el-form v-loading="loading">
<el-form-item label="仲裁对象" :label-width="'120px'">
<el-radio-group v-model="JudgyInfo.ArbitrationRule" :disabled="OtherInfo.IsSign">
<el-radio
v-for="item of $d.ArbitrationRule"
:key="item.id"
:disabled="!JudgyInfo.IsReadingTaskViewInOrder || true"
:label="item.value"
>
{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-collapse v-model="activeNames">
<el-collapse-item v-for="(item, index) of QuestionList" :key="item.ReadingQuestionTrialId" style="position: relative" :name="item.ReadingQuestionTrialId">
<div slot="title">
{{ item.PageName }}Q{{ index + 1 }}{{ item.QuestionName }}
</div>
<div style="position: relative">
<el-button v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']" style="position: absolute;right:0;top: 0;z-index: 10" size="mini" type="primary" :disabled="OtherInfo.IsSign" @click="apply(item.ReadingQuestionTrialId, index)">保存</el-button>
<el-button v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']" style="position: absolute;right:60px;top: 0;z-index: 10" size="mini" type="primary" :disabled="OtherInfo.IsSign" @click="reset(item.ReadingQuestionTrialId, index)">重置</el-button>
<el-form-item :label-width="'150px'" :label="'产生裁判阅片的条件'">
<el-radio-group v-model="QuestionList[index].JudgeType">
<el-radio v-for="item of $d.JudgeTypeEnum" :key="item.id" :disabled="OtherInfo.IsSign || !hasPermi(['trials:trials-panel:setting:reading-unit:edit'])" :label="item.value">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</div>
<div v-if="QuestionList[index].JudgeType === 3" style="text-align: right;margin: 10px 0;">
<el-button v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']" size="mini" type="primary" :disabled="OtherInfo.IsSign" @click="addGroup(index, null)">添加规则</el-button>
</div>
<el-table
v-if="QuestionList[index].JudgeType === 3"
v-loading="loading"
:data="QuestionList[index].AnswerGroupList"
border
stripe
>
<el-table-column
prop="AnswerGroupA"
label="序号"
width="50"
>
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column
prop="AnswerGroupA"
label="阅片人A"
min-width="100"
>
<template slot-scope="scope">
{{ QuestionList[index].QuestionGenre === 3 ? scope.row.AnswerGroupA.map(v => $fd(QuestionList[index].DictionaryCode, parseInt(v))).toString() : scope.row.AnswerGroupA.toString() }}
</template>
</el-table-column>
<el-table-column
prop="AnswerGroupB"
label="阅片人B"
min-width="100"
>
<template slot-scope="scope">
{{ QuestionList[index].QuestionGenre === 3 ? scope.row.AnswerGroupB.map(v => $fd(QuestionList[index].DictionaryCode, parseInt(v))).toString() : 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"
:disabled="OtherInfo.IsSign"
@click="addGroup(index, scope.$index)"
/>
<el-button
icon="el-icon-delete"
circle
title="删除"
size="mini"
:disabled="OtherInfo.IsSign"
@click="tagClose(index, scope.$index)"
/>
</template>
</el-table-column>
</el-table>
<div v-if="QuestionList[index].JudgeType === 2">
<div style="background: #f6f6f6;border-radius: 20px;padding: 15px 20px;margin-top: 10px;">
<el-checkbox-group v-model="QuestionList[index].grouping" v-if="QuestionList[index].QuestionGenre === 3">
<el-checkbox v-for="item of $d[QuestionList[index].DictionaryCode]" :key="item.id" :disabled="OtherInfo.IsSign" :label="item.value">{{ item.label }}</el-checkbox>
</el-checkbox-group>
<el-checkbox-group v-model="QuestionList[index].grouping" v-else>
<el-checkbox v-for="item of item.TypeValue.split('|')" :key="item" :disabled="OtherInfo.IsSign" :label="item">{{ item }}</el-checkbox>
</el-checkbox-group>
<div style="margin-top: 20px;">当前选择答案分组:
<el-tag v-if="QuestionList[index].grouping.length > 0 && QuestionList[index].QuestionGenre !== 3">{{ QuestionList[index].grouping.toString().replaceAll(',', '|') }}</el-tag>
<el-tag v-if="QuestionList[index].grouping.length > 0 && QuestionList[index].QuestionGenre === 3">{{ QuestionList[index].grouping.map(v => $d[QuestionList[index].DictionaryCode].find(v1 => v1.value === v).label).toString().replaceAll(',', '|') }}</el-tag>
<el-button size="mini" type="primary" :disabled="OtherInfo.IsSign" @click="addGroup2(index)">添加分组</el-button>
</div>
</div>
<div v-if="QuestionList[index].QuestionGenre !== 3" style="margin-top: 20px;">分组: <el-tag v-for="itemA of QuestionList[index].AnswerGroup2List" :key="itemA" closable style="margin-right:10px;" @close="() => {return tagClose2(index, indexA)}">{{ itemA }}</el-tag></div>
<div v-if="QuestionList[index].QuestionGenre === 3" style="margin-top: 20px;">
分组:
<el-tag v-for="itemA of QuestionList[index].AnswerGroup2List" :key="itemA" closable style="margin-right:10px;" @close="() => {return tagClose2(index, indexA)}">
{{ itemA.split('|').map(v => $fd(QuestionList[index].DictionaryCode, parseInt(v))).join('|') }}
</el-tag>
</div>
</div>
</el-collapse-item>
</el-collapse>
<!-- </el-tab-pane>-->
<!-- </el-tabs>-->
<el-dialog
v-if="QuestionVisible"
title="选择答案"
: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-if="QuestionList[selectIndex].QuestionGenre !== 3" v-for="(item, index) of QuestionList[selectIndex].TypeValue.split('|')" :key="item" :label="item" :disabled="QuestionList[selectIndex].groupingB.length ? ~QuestionList[selectIndex].groupingB.indexOf(item) : false">{{ item }}</el-checkbox>
<el-checkbox v-if="QuestionList[selectIndex].QuestionGenre === 3" v-for="(item, index) of $d[QuestionList[selectIndex].DictionaryCode]" :key="item.id" :label="item.value" :disabled="QuestionList[selectIndex].groupingB.length ? ~QuestionList[selectIndex].groupingB.indexOf(item.value) : false">{{ item.label }}</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-if="QuestionList[selectIndex].QuestionGenre !== 3" v-for="(item, index) of QuestionList[selectIndex].TypeValue.split('|')" :key="item" :label="item" :disabled="QuestionList[selectIndex].groupingA.length ? ~QuestionList[selectIndex].groupingA.indexOf(item) : false">{{ item }}</el-checkbox>
<el-checkbox v-if="QuestionList[selectIndex].QuestionGenre === 3" v-for="(item, index) of $d[QuestionList[selectIndex].DictionaryCode]" :key="item.id" :label="item.value" :disabled="QuestionList[selectIndex].groupingA.length ? ~QuestionList[selectIndex].groupingA.indexOf(item.value) : false">{{ item.label }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<!-- 取消 -->
<el-button
v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']"
:disabled="btnLoading"
size="small"
type="primary"
@click="QuestionVisible = false;$set(QuestionList[selectIndex], 'groupingA', []);$set(QuestionList[selectIndex], 'groupingB', [])"
>
{{ $t('common:button:cancel') }}
</el-button>
<el-button
v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']"
: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'
import { setTrialJudgyInfo, getTrialJudgyInfo } from '@/api/trials/setting'
export default {
props: {
TrialReadingCriterionId: {
type: String,
default() {
return ''
}
}
},
data() {
return {
CriterionList: [],
QuestionList: [],
ReadingQuestionCriterionTrialId: null,
btnLoading: false,
loading: false,
index: 0,
QuestionVisible: false,
activeNames: null,
indexA: null,
type: null,
OtherInfo: {
IsSign: true
},
JudgyInfo: {}
}
},
watch: {
TrialReadingCriterionId(v) {
if (v === null) return
this.loading = true
getTrialCriterionJudgeQuestionList({
TrialId: this.$route.query.trialId,
// ReadingQuestionCriterionTrialId: v,
TrialReadingCriterionId: this.TrialReadingCriterionId
}).then(res => {
this.loading = false
this.QuestionList = res.Result
this.OtherInfo = res.OtherInfo
this.activeNames = this.QuestionList.map(v => v.ReadingQuestionTrialId)
this.QuestionList.forEach(v => {
this.$set(v, 'grouping', [])
this.$set(v, 'groupingA', [])
this.$set(v, 'groupingB', [])
this.$set(v, 'AnswerGroupList', Object.assign([], v.AnswerCombination))
this.$set(v, 'AnswerGroup2List', Object.assign([], v.AnswerGroup))
})
}).catch(() => {
this.btnLoading = false
this.loading = false
})
}
},
mounted() {
this.getList()
this.getTrialJudgyInfo()
},
methods: {
saveAllSync() {
return new Promise((resolve, reject) => {
var arr = []
this.QuestionList.forEach((v, i) => {
arr.push(this.applySync(v.ReadingQuestionTrialId, i))
})
Promise.all(arr).then(() => {
resolve('resolve')
}).catch(() => {
this.$alert('请先配置裁判规则才能确认!')
reject('reject')
})
})
},
applySync(ReadingQuestionTrialId, index) {
return new Promise((resolve, reject) => {
if (this.QuestionList[index].JudgeType === 0) {
reject()
return
}
if (this.QuestionList[index].JudgeType === 2 && this.QuestionList[index].AnswerGroup2List.length === 0) {
reject()
return
}
if (this.QuestionList[index].JudgeType === 3 && this.QuestionList[index].AnswerGroupList.length === 0) {
reject()
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
}).then(res => {
resolve()
this.btnLoading = false
this.loading = false
}).catch(() => {
reject()
this.btnLoading = false
this.loading = false
})
})
},
setTrialJudgyInfo() {
this.loading = true
setTrialJudgyInfo({
TrialId: this.$route.query.trialId,
ArbitrationRule: this.JudgyInfo.ArbitrationRule,
TrialReadingCriterionId: this.TrialReadingCriterionId
}).then(res => {
this.loading = false
this.$message.success('保存成功')
}).catch(() => {
this.loading = false
})
},
getTrialJudgyInfo() {
this.loading = true
getTrialJudgyInfo({
TrialId: this.$route.query.trialId,
TrialReadingCriterionId: this.TrialReadingCriterionId
}).then(res => {
this.JudgyInfo = res.Result
this.loading = false
}).catch(v => {
this.loading = false
})
},
tagClose2(index, indexA) {
this.$confirm('删除该规则组?').then(() => {
this.QuestionList[index].AnswerGroup2List.splice(indexA, 1)
})
},
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
},
addGroup2(index) {
if (this.QuestionList[index].grouping.length === 0) {
this.$message.error('请先选择答案,再添加分组')
return
}
var grouping = this.QuestionList[index].grouping.toString().replaceAll(',', '|')
this.QuestionList[index].AnswerGroup2List.push(`|${grouping}|`)
this.$set(this.QuestionList[index], 'grouping', [])
},
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
},
reset(ReadingQuestionTrialId, index) {
this.$confirm('确定重置当前设置的裁判任务生成规则吗?').then(() => {
this.btnLoading = true
this.loading = true
setTrialCriterionJudgeQuestionAnswerGroup({
ReadingQuestionTrialId: ReadingQuestionTrialId,
AnswerGroup: [],
AnswerCombination: [],
JudgeType: 0
}).then(res => {
this.$set(this.QuestionList[index], 'AnswerGroup2List', [])
this.$set(this.QuestionList[index], 'AnswerGroupList', [])
this.$set(this.QuestionList[index], 'JudgeType', 0)
this.$message.success('重置成功')
this.btnLoading = false
this.loading = false
}).catch(() => {
this.btnLoading = false
this.loading = false
})
})
},
apply(ReadingQuestionTrialId, index) {
if (this.QuestionList[index].JudgeType === 0) {
this.$message.error('请先配置规则才能应用')
return
}
if (this.QuestionList[index].JudgeType === 2 && this.QuestionList[index].AnswerGroup2List.length === 0) {
this.$message.error('请先配置规则才能应用')
return
}
if (this.QuestionList[index].JudgeType === 3 && this.QuestionList[index].AnswerGroupList.length === 0) {
this.$message.error('请先配置规则才能应用')
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
}).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.loading = true
getTrialCriterionJudgeQuestionList({
TrialId: this.$route.query.trialId,
TrialReadingCriterionId: this.TrialReadingCriterionId
}).then(res => {
this.loading = false
this.QuestionList = res.Result
this.OtherInfo = res.OtherInfo
this.activeNames = this.QuestionList.map(v => v.ReadingQuestionTrialId)
this.QuestionList.forEach(v => {
this.$set(v, 'grouping', [])
this.$set(v, 'groupingA', [])
this.$set(v, 'groupingB', [])
this.$set(v, 'AnswerGroupList', Object.assign([], v.AnswerCombination))
this.$set(v, 'AnswerGroup2List', Object.assign([], v.AnswerGroup))
})
}).catch(() => {
this.btnLoading = false
this.loading = false
})
}
}
}
</script>