irc_web/.svn/pristine/0a/0a8b61004865a918cd4057454a2...

382 lines
12 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(true)">保存</el-button>
<el-button type="primary" size="small" @click="handleConfirm">确认</el-button>
</div>
</div>
<el-table
ref="reportList"
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"
fixed="left"
>
<template slot-scope="scope">
<span v-if="scope.row.QuestionName">{{ scope.row.QuestionName }}</span>
<span
v-else
style="font-weight: bold;font-size: 16px;color: #f44336;"
>
{{ scope.row.GroupName }}
</span>
</template>
</el-table-column>
<el-table-column
v-for="task in visitTaskList"
:key="task.VisitTaskId"
prop="date"
:label="task.BlindName"
show-overflow-tooltip
width="200px"
>
<template slot-scope="scope">
<template v-if="task.VisitTaskId === visitTaskId && readingTaskState < 2 && scope.row.QuestionType=== 13">
<!-- 输入框 -->
<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]"
@change="handleEvaluateResultChange"
>
<el-option
v-for="val in scope.row.TypeValue.split('|')"
:key="val"
:label="val"
:value="val"
/>
</el-select>
<span v-else>{{ scope.row.Answers && scope.row.Answers.hasOwnProperty(task.VisitTaskId)? scope.row.Answers[task.VisitTaskId]:'' }}</span>
</template>
<template v-else-if="task.VisitTaskId === visitTaskId && readingTaskState < 2 && scope.row.QuestionType=== 14 && scope.row.Answers && currentEvaluateResult !== tumorEvaluate">
<!-- 输入框 -->
<el-input
v-if="scope.row.Type==='input'"
v-model="scope.row.Answers[task.VisitTaskId]"
/>
<p style="width: 180px;white-space: normal;word-break: break-all;word-wrap: break-word;">系统评估结果为:<span style="color:red">{{ tumorEvaluate }}</span>,与当前调整的结果不一致,请填写调整原因</p>
</template>
<template v-else>
{{ scope.row.Answers && scope.row.Answers.hasOwnProperty(task.VisitTaskId)? 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, verifyVisitTaskQuestions } 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,
tumorEvaluate: '',
currentEvaluateResult: ''
}
},
watch: {
taskQuestions() {
this.$nextTick(() => {
this.$refs.reportList.doLayout()
})
}
},
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
this.tumorEvaluate = res.Result.TumorEvaluate
var questions = []
res.Result.TaskQuestions.forEach((item, index) => {
if (!([3, 4, 5, 6, 2].includes(item.QuestionMark))) {
const obj = item
obj.Answers = {}
item.Answer.forEach(i => {
if (item.DictionaryCode) {
obj.Answers[i.VisitTaskId] = this.$fd(item.DictionaryCode, Number(i.Answer))
} else {
obj.Answers[i.VisitTaskId] = i.Answer
}
})
if (item.QuestionType === 13) {
this.currentEvaluateResult = obj.Answers[this.visitTaskId]
}
if (item.Childrens && item.Childrens.length > 0) {
obj.Childrens = this.getQuestions(item.Childrens, obj.IsShowInDicom)
}
questions.push(obj)
}
})
this.taskQuestions = questions
this.visitTaskList = res.Result.VisitTaskList
this.loading = false
}).catch(() => { this.loading = false })
},
getQuestions(questions, isShowInDicom) {
const arr = []
if (questions.length !== 0) {
questions.forEach((item) => {
if (!([3, 4, 5, 6, 2].includes(item.QuestionMark))) {
const obj = item
obj.IsShowInDicom = isShowInDicom
obj.Answers = {}
if (item.RowIndex > 0) {
var idx = item.Childrens.findIndex(i => i.QuestionMark === 4)
if (idx > -1) {
if (item.Childrens[idx].Answer.length > 0) {
item.Childrens[idx].Answer[0].Answer
obj.QuestionName = `${obj.QuestionName} -- ${item.Childrens[idx].Answer[0].Answer}`
}
}
}
item.Answer.forEach(i => {
if (item.DictionaryCode) {
obj.Answers[i.VisitTaskId] = this.$fd(item.DictionaryCode, Number(i.Answer))
} else {
obj.Answers[i.VisitTaskId] = i.Answer
}
})
if (item.QuestionType === 13) {
this.currentEvaluateResult = obj.Answers[this.visitTaskId]
}
if (item.Childrens.length >= 1) {
obj.Childrens = this.getQuestions(item.Childrens, isShowInDicom)
}
arr.push(obj)
}
})
}
return arr
},
handleEvaluateResultChange(val) {
this.currentEvaluateResult = val
},
async handleConfirm() {
await this.handleSave(false)
await this.verifyVisitTaskQuestions()
const { ImageAssessmentReportConfirmation } = const_.processSignature
this.signCode = ImageAssessmentReportConfirmation
this.signVisible = true
},
verifyVisitTaskQuestions() {
return new Promise((resolve, reject) => {
verifyVisitTaskQuestions({ visitTaskId: this.visitTaskId }).then(res => {
resolve()
}).catch(() => {
reject()
})
})
},
// 关闭签名框
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.QuestionType === 13) {
this.answers.push({ id: item.QuestionId, answer: item.Answers[this.visitTaskId] })
}
if (item.Childrens && item.Childrens.length > 0) {
this.getChild(item.Childrens)
}
})
},
handleSave(isPrompt) {
return new Promise((resolve, reject) => {
var evaluateResult = ''
var evaluateAjustReason = ''
this.answers = []
this.taskQuestions.forEach(item => {
if (item.QuestionType === 13) {
this.answers.push({ id: item.QuestionId, answer: item.Answers[this.visitTaskId] })
evaluateResult = item.Answers[this.visitTaskId]
}
if (item.QuestionType === 14) {
evaluateAjustReason = 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 => {}
})
reject()
return
}
if (evaluateResult !== this.tumorEvaluate && !evaluateAjustReason) {
this.$confirm('请填写整体评估调整原因', {
type: 'warning',
showCancelButton: false,
callback: action => {}
})
reject()
return
}
this.loading = true
var params = {
visitTaskId: this.visitTaskId,
answers: this.answers
}
changeDicomReadingQuestionAnswer(params).then(res => {
if (isPrompt) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
}
this.loading = false
resolve()
}).catch(() => {
this.loading = false
reject()
})
})
}
}
}
</script>
<style lang="scss" scoped>
.report-wrapper{
height: 100%;
// background-color: #fff;
background-color: #000;
.report-header{
display: flex;
}
.el-card{
background-color: #000;
color: #ffffff;
border:none;
}
// >>>.el-table__cell{
// background-color: #000;
// color: #ffffff;
// }
// >>>.el-table{
// background-color: #000;
// color: #ffffff;
// }
// >>>.el-table__cell{
// background-color: #000;
// color: #ffffff;
// }
>>>.el-table, .el-table__expanded-cell {
background-color: #000;
color: #fff;
}
>>>.el-table th, .el-table tr {
background-color: #000;
color: #fff;
}
>>>.el-table__body tr > td{
background-color:#000 !important;
color: #fff;
}
>>>.el-table__body tr:hover > td{
background-color:#858282 !important;
color: #fff;
}
>>>.el-table--border th.gutter:last-of-type{
border: none;
}
}
</style>