irc_web/.svn/pristine/fb/fb878a2b80367d064db6084b5cb...

282 lines
8.8 KiB
Plaintext

<template>
<div v-loading="loading" style="min-height:400px;">
<el-card v-if="isRender" shadow="never" :body-style="{ padding: '10px' }">
<div slot="header" class="clearfix">
<span style="font-weight: bold;">历史评判结果</span>
</div>
<el-divider content-position="left">{{ r1.armEnum }}</el-divider>
<el-form
ref="questions"
size="small"
:model="r1.questionForm"
>
<FormItem
v-for="question of r1.questions"
:key="question.ReadingQuestionTrialId"
:question="question"
:question-form="r1.questionForm"
:reading-task-state="2"
@resetFormItemData="resetFormItemData1"
/>
</el-form>
<el-divider content-position="left">{{ r2.armEnum }}</el-divider>
<el-form
ref="questions"
size="small"
:model="r1.questionForm"
>
<el-form
v-if="isRender"
ref="questions"
size="small"
:model="r2.questionForm"
>
<FormItem
v-for="question of r2.questions"
:key="question.ReadingQuestionTrialId"
:question="question"
:question-form="r2.questionForm"
:reading-task-state="2"
@resetFormItemData="resetFormItemData2"
/>
</el-form>
</el-form>
</el-card>
<el-card v-if="isRender" shadow="never" :body-style="{ padding: '10px' }" class="box-mr">
<div slot="header" class="clearfix">
<span style="font-weight: bold;">裁判结果</span>
</div>
<el-form ref="adForm" :model="adForm">
<el-form-item
label=""
prop="judgeResultTaskId"
:rules="[
{ required: true, message: '请选择'},
]"
>
<el-radio-group v-model="adForm.judgeResultTaskId" :disabled="readingTaskState >= 2">
<el-radio v-for="t in visitTasks" :key="t.visitTaskId" :label="t.visitTaskId">{{ t.name }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="备注"
prop="judgeResultRemark"
:rules="[
{ required: true, message: '请注明'},
]"
>
<el-input
v-model="adForm.judgeResultRemark"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:disabled="readingTaskState >= 2"
/>
</el-form-item>
<el-form-item v-if="readingTaskState < 2">
<div style="text-align:center;">
<el-button type="primary" @click="handleSave">保存</el-button>
<el-button type="primary" @click="handleSubmit">提交</el-button>
</div>
</el-form-item>
</el-form>
</el-card>
<!-- 签名框 -->
<el-dialog
v-if="signVisible"
:visible.sync="signVisible"
:close-on-click-modal="false"
width="600px"
custom-class="base-dialog-wrapper"
>
<div slot="title">
<span style="font-size:18px;">{{ $t('common:dialogTitle:sign') }}</span>
<span style="font-size:12px;margin-left:5px">{{ `(${$t('common:label:sign')}${ currentUser })` }}</span>
</div>
<SignForm ref="signForm" :sign-code-enum="signCode" @closeDialog="closeSignDialog" />
</el-dialog>
</div>
</template>
<script>
import { getJudgeReadingInfo, saveJudgeVisitTaskResult, submitJudgeVisitTaskResult } from '@/api/trials'
import const_ from '@/const/sign-code'
import FormItem from './FormItem'
import SignForm from '@/views/trials/components/newSignForm'
export default {
name: 'ECRF',
components: {
FormItem,
SignForm
},
props: {
trialId: {
type: String,
required: true
},
visitTaskId: {
type: String,
required: true
}
},
data() {
return {
loading: false,
isRender: false,
signVisible: false,
signCode: null,
currentUser: zzSessionStorage.getItem('userName'),
readingTaskState: 0,
r1: {
armEnum: null,
questions: [],
questionForm: {}
},
r2: {
armEnum: null,
questions: [],
questionForm: {}
},
visitTasks: [],
adForm: {
visitTaskId: '',
judgeResultTaskId: '',
judgeResultRemark: ''
}
}
},
mounted() {
this.getQuestions()
},
methods: {
getQuestions() {
this.loading = true
var param = {
visitTaskId: this.visitTaskId
}
getJudgeReadingInfo(param).then(res => {
this.visitTasks = []
this.adForm.judgeResultTaskId = res.Result.JudgeResultTaskId
this.adForm.judgeResultRemark = res.Result.JudgeResultRemark
this.readingTaskState = res.Result.ReadingTaskState
var questions = res.Result.VisitTaskInfoList
this.r1.armEnum = this.$fd('ArmEnum', questions[0].ArmEnum)
this.r1.questions = questions[0].TaskReadingQuestionList
questions[0].TaskReadingQuestionList.map(q => {
if (q.Type !== 'group' && q.Type !== 'summary') {
this.$set(this.r1.questionForm, q.ReadingQuestionTrialId, q.Answer)
if (q.Childrens.length > 0) {
this.setChild(this.r1.questionForm, q.Childrens)
}
}
})
this.visitTasks.push({ name: 'R1', visitTaskId: questions[0].VisitTaskId })
this.r2.armEnum = this.$fd('ArmEnum', questions[1].ArmEnum)
this.r2.questions = questions[1].TaskReadingQuestionList
questions[1].TaskReadingQuestionList.map(q => {
if (q.Type !== 'group' && q.Type !== 'summary') {
this.$set(this.r2.questionForm, q.ReadingQuestionTrialId, q.Answer)
if (q.Childrens.length > 0) {
this.setChild(this.r2.questionForm, q.Childrens)
}
}
})
this.visitTasks.push({ name: 'R2', visitTaskId: questions[1].VisitTaskId })
this.isRender = true
this.loading = false
}).catch(() => { this.loading = false })
},
setChild(obj, question) {
question.forEach(i => {
this.$set(obj, i.ReadingQuestionTrialId, i.Answer)
if (i.Childrens && i.Childrens.length > 0) {
this.setChild(obj, i.Childrens)
}
})
},
// setChild2(obj) {
// obj.forEach(i => {
// this.$set(this.r2.questionForm, i.ReadingQuestionTrialId, i.Answer)
// if (i.Childrens && i.Childrens.length > 0) {
// this.setChild2(i.Childrens)
// }
// })
// },
handleSave() {
this.$refs['adForm'].validate((valid) => {
if (!valid) return
this.loading = true
this.adForm.visitTaskId = this.visitTaskId
saveJudgeVisitTaskResult(this.adForm).then(res => {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.loading = false
}).catch(() => {
this.loading = false
})
})
},
handleSubmit() {
this.$refs['questions'].validate((valid) => {
if (!valid) return
const { ImageAssessmentReportConfirmation } = const_.processSignature
this.signCode = ImageAssessmentReportConfirmation
this.signVisible = true
})
},
// 关闭签名框
closeSignDialog(isSign, signInfo) {
if (isSign) {
this.signConfirm(signInfo)
} else {
this.signVisible = false
}
},
// 签名并确认
signConfirm(signInfo) {
this.loading = true
var answers = []
for (const k in this.questionForm) {
answers.push({ readingQuestionTrialId: k, answer: this.questionForm[k] })
}
var params = {
data: {
visitTaskId: this.visitTaskId,
judgeResultTaskId: this.adForm.judgeResultTaskId,
judgeResultRemark: this.adForm.judgeResultRemark
},
signInfo: signInfo
}
submitJudgeVisitTaskResult(params).then(res => {
this.loading = false
if (res.IsSuccess) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.isEdit = false
this.$refs['signForm'].btnLoading = false
this.signVisible = false
window.location.reload()
window.opener.postMessage('noneDicoms', window.location)
}
}).catch(_ => {
this.loading = false
this.$refs['signForm'].btnLoading = false
})
},
resetFormItemData1(v) {
this.r1.questionForm[v] = ''
},
resetFormItemData2(v) {
this.r2.questionForm[v] = ''
}
}
}
</script>
<style lang="scss" scoped>
.box-mr{
margin:10px 0;
}
</style>