irc_web/.svn/pristine/be/be8adb653efbe317b106e3e4200...

251 lines
7.8 KiB
Plaintext

<template>
<div class="report-wrapper">
<el-card v-loading="loading" shadow="never">
<div slot="header" class="clearfix report-header">
<div>测量结果</div>
<div v-if="readingTaskState<2" style="margin-left:auto">
<el-button type="primary" size="small" @click="handleSave">保存</el-button>
<el-button type="primary" size="small" @click="handleConfirm">确认</el-button>
</div>
</div>
<el-table
v-adaptive="{bottomOffset:60}"
:data="taskQuestions"
row-key="Id"
border
default-expand-all
height="100"
:tree-props="{children: 'Childrens', hasChildren: 'hasChildren'}"
size="mini"
>
<el-table-column
prop=""
label=""
show-overflow-tooltip
width="350px"
>
<template slot-scope="scope">
{{ scope.row.QuestionName?scope.row.QuestionName:scope.row.GroupName }}
</template>
</el-table-column>
<el-table-column
v-for="task in visitTaskList"
:key="task.VisitTaskId"
prop="date"
:label="task.TaskName"
show-overflow-tooltip
>
<template slot-scope="scope">
<template v-if="task.VisitTaskId === visitTaskId && !scope.row.IsShowInDicom && scope.row.Type !== 'calculation' && scope.row.Type !== 'group' && readingTaskState < 2">
<!-- 输入框 -->
<el-input
v-if="scope.row.Type==='input'"
v-model="scope.row.Answers[task.VisitTaskId]"
/>
<el-select
v-else-if="scope.row.Type==='select'"
v-model="scope.row.Answers[task.VisitTaskId]"
>
<el-option
v-for="val in scope.row.TypeValue.split('|')"
:key="val"
:label="val"
:value="val"
/>
</el-select>
<span v-else>{{ scope.row.Answers[task.VisitTaskId] }}</span>
</template>
<template v-else>
{{ scope.row.Answers[task.VisitTaskId] }}
</template>
</template>
</el-table-column>
</el-table>
</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 { getReadingReportEvaluation, changeDicomReadingQuestionAnswer, submitDicomVisitTask } from '@/api/trials'
import Store from './Store'
import const_ from '@/const/sign-code'
import SignForm from '@/views/trials/components/newSignForm'
export default {
name: 'ReportPage',
components: { SignForm },
props: {
visitTaskId: {
type: String,
required: true
}
},
data() {
return {
currentUser: zzSessionStorage.getItem('userName'),
signVisible: false,
signCode: null,
visitTaskList: [],
taskQuestions: [],
loading: false,
answers: [],
readingTaskState: 2
}
},
mounted() {
Store.$on('getReportInfo', isRefresh => {
if (!isRefresh) return
this.getReportInfo()
})
this.getReportInfo()
},
beforeDestroy() {
Store.$off('getReportInfo')
},
methods: {
getReportInfo() {
this.loading = true
var params = {
visitTaskId: this.visitTaskId,
trialId: this.$router.currentRoute.query.trialId
}
getReadingReportEvaluation(params).then(res => {
this.readingTaskState = res.Result.ReadingTaskState
res.Result.TaskQuestions.forEach(item => {
item.Answers = {}
item.Answer.forEach(i => {
item.Answers[i.VisitTaskId] = i.Answer
})
if (item.Childrens && item.Childrens.length > 0) {
this.setChild(item.Childrens, item.IsShowInDicom)
}
})
this.visitTaskList = res.Result.VisitTaskList
this.taskQuestions = res.Result.TaskQuestions
this.loading = false
}).catch(() => { this.loading = false })
},
setChild(obj, isShowInDicom) {
obj.forEach(item => {
item.IsShowInDicom = isShowInDicom
item.Answers = {}
item.Answer.forEach(i => {
item.Answers[i.VisitTaskId] = i.Answer
})
if (item.Childrens && item.Childrens.length > 0) {
this.setChild(item.Childrens, isShowInDicom)
}
})
},
getAnswer(answerList, taskName) {
if (answerList.length <= 0) return ''
var idx = answerList.findIndex(e => e.TaskName === taskName)
if (idx > -1) {
return answerList[idx].Answer
} else {
return ''
}
},
handleConfirm() {
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 params = {
data: {
visitTaskId: this.visitTaskId
},
signInfo: signInfo
}
submitDicomVisitTask(params).then(res => {
if (res.IsSuccess) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.$refs['signForm'].btnLoading = false
this.signVisible = false
window.location.reload()
window.opener.postMessage('refreshTaskList', window.location)
}
this.loading = false
}).catch(_ => {
this.loading = false
this.$refs['signForm'].btnLoading = false
})
},
getChild(obj) {
obj.forEach(item => {
if (!item.IsShowInDicom && item.Type !== 'calculation') {
this.answers.push({ id: item.QuestionId, answer: item.Answers[this.visitTaskId] })
}
if (item.Childrens && item.Childrens.length > 0) {
this.getChild(item.Childrens)
}
})
},
handleSave() {
this.answers = []
this.taskQuestions.forEach(item => {
if (!item.IsShowInDicom && item.Type !== 'calculation' && item.Type !== 'group') {
this.answers.push({ id: item.QuestionId, answer: item.Answers[this.visitTaskId] })
}
if (item.Childrens && item.Childrens.length > 0) {
this.getChild(item.Childrens)
}
})
if (this.answers.findIndex(i => i.answer === '') > -1) {
this.$confirm('请将疗效评估信息填写完整', {
type: 'warning',
showCancelButton: false,
callback: action => {}
})
} else {
this.loading = true
var params = {
visitTaskId: this.visitTaskId,
answers: this.answers
}
changeDicomReadingQuestionAnswer(params).then(res => {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.loading = false
}).catch(() => {
this.loading = false
})
}
}
}
}
</script>
<style lang="scss" scoped>
.report-wrapper{
height: 100%;
background-color: #fff;
.report-header{
display: flex;
}
}
</style>