wangxiaoshuang 2026-03-03 14:14:46 +08:00
commit 1d95cd15f2
4 changed files with 325 additions and 60 deletions

View File

@ -33,7 +33,7 @@
<div v-for="item in qs.Childrens" :key="item.Id">
<div v-if="item.Type === 'basicTable'" class="flex-row" style="margin:3px 0;">
<div class="title">{{ item.QuestionName }}</div>
<div v-if="item.LesionType === 102 && readingTaskState < 2">
<div v-if="item.LesionType === 104 && readingTaskState < 2">
<div class="add-icon" @click.prevent="downloadTpl">
<i class="el-icon-download" />
</div>
@ -49,15 +49,6 @@
</div>
<el-table v-if="item.Type === 'basicTable' && item.TableQuestions" :ref="item.Id"
:data="item.TableQuestions.Answers">
<!-- <el-table-column :label="$t('CustomizeQuestionFormItem:label:OrderMark')" width="60px" show-overflow-tooltip>
<template slot-scope="scope">
{{ getLesionName(item.OrderMark,scope.row.RowIndex) }}
</template>
</el-table-column> -->
<!-- <el-table-column
type="index"
width="40px"
/> -->
<el-table-column v-for="q of item.TableQuestions.Questions" :key="q.Id" :prop="q.Id"
:label="q.QuestionName" show-overflow-tooltip :render-header="renderHeader">
<template slot-scope="scope">
@ -76,14 +67,14 @@
</span>
</template>
</el-table-column>
<el-table-column v-if="readingTaskState < 2 && (item.LesionType === 102 || item.LesionType === 103)"
<el-table-column v-if="readingTaskState < 2 && (item.LesionType === 104)"
:label="$t('common:action:action')" width="90px" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleAddOrEdit('edit', item, scope.$index)">
{{ $t('common:button:edit') }}
</el-button>
<el-button type="text" size="mini" @click="handleDelete(item, scope.$index)"
v-if="item.LesionType === 102">
v-if="item.LesionType === 104">
{{ $t('common:button:delete') }}
</el-button>
</template>
@ -96,10 +87,12 @@
:prop="item.Id" :rules="[
{
required: (item.IsRequired === 0 || (item.IsRequired === 1 && item.RelevanceId && (item.RelevanceValue.includes(questionForm[item.RelevanceId])))) && item.Type !== 'group' && item.Type !== 'summary',
message: ['radio', 'select', 'checkbox'].includes(item.Type) ? $t('common:ruleMessage:select') : $t('common:ruleMessage:specify'), trigger: ['blur', 'change']
message: ['radio', 'select', 'checkbox'].includes(item.Type) ? $t('common:ruleMessage:select') : (item.QuestionType === 1016 || item.QuestionType === 1017) ? $t('trials:reading:ruleMessage:validatorNumberInput') : $t('common:ruleMessage:specify'), trigger: ['blur', 'change']
},
{
validator: item.Type === 'number' && !item.TypeValue && (item.QuestionType === 1016 || item.QuestionType === 1017) ? validatorNumberOrNEInput : (rule, value, callback) => { callback() }, trigger: ['blur', 'change']
}
]">
<!-- 数值类型 -->
<template v-if="item.Type === 'textarea'">
<el-input v-model="questionForm[item.Id]" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }"
:disabled="!isCurrentTask || readingTaskState >= 2"
@ -107,9 +100,29 @@
</template>
<template v-if="item.Type === 'number'">
<div style="display: flex;justify-content: space-between;">
<el-input-number v-model="questionForm[item.Id]"
<el-input
v-if="item.QuestionType === 1016 || item.QuestionType === 1017"
type="text"
@change="(val) => { formItemChange(val, item) }"
@input="numberOrNEInput(item.Id)"
@blur="handleNumberOrNEBlur(item)"
v-model.trim="questionForm[item.Id]" :disabled="readingTaskState === 2">
<template slot="append" v-if="item.Unit !== 0">{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}</template>
<template slot="append" v-else-if="item.ValueType === 2">%</template>
</el-input>
<el-input
v-else
type="number"
@change="(val) => { formItemChange(val, item) }"
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
v-model.trim="questionForm[item.Id]" :disabled="readingTaskState === 2">
<template slot="append" v-if="item.Unit !== 0">{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}</template>
<template slot="append" v-else-if="item.ValueType === 2">%</template>
</el-input>
<!-- <el-input-number v-model="questionForm[item.Id]"
:disabled="!isCurrentTask || readingTaskState >= 2" :precision="0"
@change="((val) => { formItemChange(val, item) })" />
@change="((val) => { formItemChange(val, item) })" /> -->
<svg-icon v-if="item.ShowChartTypeEnum > 0" icon-class="readingChart"
class="svg-icon svg-readingChart" @click.stop="(e) => handleReadingChart({
e,
@ -120,6 +133,15 @@
})" />
</div>
</template>
<template v-if="item.Type === 'calculation'">
<el-input v-model="questionForm[item.Id]"
disabled type="number" @change="((val) => { formItemChange(val, item) })">
<template slot="append" v-if="item.Unit !== 0">
{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}
</template>
<template slot="append" v-else-if="item.ValueType === 2">%</template>
</el-input>
</template>
<template v-if="item.Type === 'select'">
<el-select v-model="questionForm[item.Id]" :disabled="!isCurrentTask || readingTaskState >= 2"
:multiple="item.OptionTypeEnum === 1" @change="((val) => { formItemChange(val, item) })">
@ -256,7 +278,10 @@ export default {
qsForm: {},
diffId: '',
eemId: '',
lumenId: ''
lumenId: '',
sRoiStartDistanceId: '',
sRoiEndDistanceId: '',
sRoiDistanceId: ''
}
},
computed: {
@ -332,6 +357,7 @@ export default {
}
this.questions = this.visitTaskList[i].ReadingQuestions
this.setQuestionForm(this.questions)
this.$nextTick(() => {
this.$refs['ecrf'].getQuestions(this.visitTaskId)
this.$refs['ecrf2'].getQuestions(this.visitTaskId)
@ -343,9 +369,21 @@ export default {
const type = ['number', 'radio', 'select', 'input', 'textarea', 'calculation']
questions.forEach(item => {
if (type.includes(item.Type)) {
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Type === 'number' || item.Type === 'calculation' ? isNaN(parseFloat(item.Answer)) ? null : parseFloat(item.Answer) : item.Answer
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Type === 'number' || item.Type === 'calculation' ? isNaN(parseFloat(item.Answer)) ? null : item.Answer : item.Answer
this.$set(this.questionForm, item.Id, answer)
}
if (item.QuestionType === 1013) {
// ROI
this.sRoiStartDistanceId = item.Id
}
if (item.QuestionType === 1014) {
// ROI
this.sRoiEndDistanceId = item.Id
}
if (item.QuestionType === 1015) {
// ROI
this.sRoiDistanceId = item.Id
}
if (item.Childrens.length > 0) {
this.setQuestionForm(item.Childrens)
}
@ -369,6 +407,7 @@ export default {
item.TableQuestions.Answers[idx][i] = String(obj.anwsers[i])
}
}
if (item.Childrens.length > 0) {
this.setQuestions(item.Childrens, obj)
}
@ -459,13 +498,18 @@ export default {
},
formItemChange(val, item) {
console.log('formItemChange: ', item.QuestionName, val)
this.formChanged = true
if (item.Type === 'number') {
this.limitBlur(item.Id, item.ValueType)
}
// if (item.Type === 'number') {
// this.limitBlur(item.Id, item.ValueType)
// }
if (item.Childrens && item.Childrens.length > 0) {
this.resetChild(item.Childrens)
}
if ((item.QuestionType === 1013 || item.QuestionType === 1014) && !isNaN(parseFloat(this.questionForm[this.sRoiStartDistanceId])) && !isNaN(parseFloat(this.questionForm[this.sRoiEndDistanceId]))) {
let num = parseFloat(this.questionForm[this.sRoiEndDistanceId]) - parseFloat(this.questionForm[this.sRoiStartDistanceId])
this.$set(this.questionForm, this.sRoiDistanceId, parseFloat(num).toFixed(this.digitPlaces))
}
},
resetChild(obj) {
obj.forEach(i => {
@ -483,12 +527,78 @@ export default {
if (valueType === 0) {
this.$set(this.questionForm, qId, parseInt(value))
} else if (valueType === 3) {
this.$set(this.questionForm, qId, parseFloat(value))
this.$set(this.questionForm, qId, value)
} else {
this.$set(this.questionForm, qId, this.numberToFixed(value))
}
}
},
validatorNumberOrNEInput(rule, value, callback) {
let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
if (value === '') {
callback();
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
} else {
callback();
}
}
},
numberOrNEInput(id) {
// this.questionForm[id] = this.questionForm[id].toUpperCase();
if (!this.questionForm[id]) {
return
}
let value = this.questionForm[id].toUpperCase().replace(/[^0-9.NE]/g, '')
if (value.startsWith('N')) {
if (value.length > 2) {
value = value.substring(0, 2)
}
if (value.length === 2 && value[1] !== 'E') {
value = 'N'
}
} else {
value = value.replace(/[NE]/g, '')
}
this.questionForm[id] = value
this.$set(this.questionForm, id, value)
},
handleNumberOrNEBlur(item) {
if (this.questionForm[item.Id] && !isNaN(parseFloat(this.questionForm[item.Id]))) {
if (item.ValueType === 3) {
//
this.$set(this.questionForm, item.Id, value)
} else {
const num = parseFloat(this.questionForm[item.Id])
if (!isNaN(num)) {
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
if (item.ValueType === 0) {
//
this.$set(this.questionForm, item.Id, parseInt(num))
} else if (item.ValueType === 1 || item.ValueType === 2){
//
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
}
}
}
}
},
handleBlur(value, a, item) {
if (!value || item.ValueType === 3) return false
const num = parseFloat(this.questionForm[item.Id])
if (!isNaN(num)) {
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
if (item.ValueType === 0) {
//
this.$set(this.questionForm, item.Id, parseInt(num))
} else if (item.ValueType === 1 || item.ValueType === 2){
//
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
}
}
},
numberToFixed(v) {
if (this.digitPlaces > -1) {
return isNaN(parseFloat(v)) ? null : `${parseFloat(v).toFixed(this.digitPlaces)}`
@ -645,11 +755,7 @@ export default {
}
const res = await submitTableQuestion(params)
if (res.IsSuccess) {
// this.refreshQuestions()
await this.getReadingQuestionAndAnswer(this.visitTaskId)
this.$refs['ecrf'].getQuestions(this.visitTaskId, true)
this.$refs['ecrf2'].getQuestions(this.visitTaskId, true)
this.$refs['ecrf3'].getQuestions(this.visitTaskId, true)
this.refreshQuestions()
DicomEvent.$emit('getReportInfo', true)
//
this.addOrEdit.visible = false
@ -680,7 +786,8 @@ export default {
}
const res = await deleteReadingRowAnswer(param)
if (res.IsSuccess) {
await this.getReadingQuestionAndAnswer(this.visitTaskId)
// await this.getReadingQuestionAndAnswer(this.visitTaskId)
this.refreshQuestions()
DicomEvent.$emit('getReportInfo', true)
// ''
this.$message.success(this.$t('common:message:deletedSuccessfully'))
@ -709,7 +816,7 @@ export default {
}
},
async uploadDlgClose() {
await this.getReadingQuestionAndAnswer(this.visitTaskId)
this.refreshQuestions()
DicomEvent.$emit('getReportInfo', true)
this.upload.visible = false
},
@ -891,6 +998,10 @@ export default {
::v-deep.el-table--scrollable-x .el-table__body-wrapper {
z-index: 2;
}
}
::v-deep.el-tag.el-tag--info {
color: #000;
}
}
</style>

View File

@ -33,7 +33,7 @@
<div v-for="item in qs.Childrens" :key="item.Id">
<div v-if="item.Type === 'basicTable'" class="flex-row" style="margin:3px 0;">
<div class="title">{{ item.QuestionName }}</div>
<div v-if="(item.LesionType === 112 || item.LesionType === 111) && readingTaskState < 2">
<div v-if="(item.LesionType === 104) && readingTaskState < 2">
<div class="add-icon" @click.prevent="downloadTpl(item.LesionType)">
<i class="el-icon-download" />
</div>
@ -49,15 +49,6 @@
</div>
<el-table v-if="item.Type === 'basicTable' && item.TableQuestions" :ref="item.Id"
:data="item.TableQuestions.Answers" max-height="600">
<!-- <el-table-column :label="$t('CustomizeQuestionFormItem:label:OrderMark')" width="60px" show-overflow-tooltip>
<template slot-scope="scope">
{{ getLesionName(item.OrderMark,scope.row.RowIndex) }}
</template>
</el-table-column> -->
<!-- <el-table-column
type="index"
width="40px"
/> -->
<el-table-column v-for="q of item.TableQuestions.Questions" :key="q.Id" :prop="q.Id"
:label="q.QuestionName" show-overflow-tooltip :render-header="renderHeader">
<template slot-scope="scope">
@ -96,8 +87,11 @@
:prop="item.Id" :rules="[
{
required: (item.IsRequired === 0 || (item.IsRequired === 1 && item.RelevanceId && (item.RelevanceValue.includes(questionForm[item.RelevanceId])))) && item.Type !== 'group' && item.Type !== 'summary',
message: ['radio', 'select', 'checkbox'].includes(item.Type) ? $t('common:ruleMessage:select') : $t('common:ruleMessage:specify'), trigger: ['blur', 'change']
message: ['radio', 'select', 'checkbox'].includes(item.Type) ? $t('common:ruleMessage:select') : (item.QuestionType === 1016 || item.QuestionType === 1017) ? $t('trials:reading:ruleMessage:validatorNumberInput') : $t('common:ruleMessage:specify'), trigger: ['blur', 'change']
},
{
validator: item.Type === 'number' && !item.TypeValue && (item.QuestionType === 1016 || item.QuestionType === 1017) ? validatorNumberOrNEInput : (rule, value, callback) => { callback() }, trigger: ['blur', 'change']
}
]">
<!-- 数值类型 -->
<template v-if="item.Type === 'textarea'">
@ -112,6 +106,50 @@
:label="dict.label" />
</el-select>
</template>
<template v-if="item.Type === 'number'">
<div style="display: flex;justify-content: space-between;">
<el-input
v-if="item.QuestionType === 1016 || item.QuestionType === 1017"
type="text"
@change="(val) => { formItemChange(val, item) }"
@input="numberOrNEInput(item.Id)"
@blur="handleNumberOrNEBlur(item)"
v-model.trim="questionForm[item.Id]" :disabled="readingTaskState === 2">
<template slot="append" v-if="item.Unit !== 0">{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}</template>
<template slot="append" v-else-if="item.ValueType === 2">%</template>
</el-input>
<el-input
v-else
type="number"
@change="(val) => { formItemChange(val, item) }"
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
v-model.trim="questionForm[item.Id]" :disabled="readingTaskState === 2">
<template slot="append" v-if="item.Unit !== 0">{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}</template>
<template slot="append" v-else-if="item.ValueType === 2">%</template>
</el-input>
<!-- <el-input-number v-model="questionForm[item.Id]"
:disabled="!isCurrentTask || readingTaskState >= 2" :precision="0"
@change="((val) => { formItemChange(val, item) })" /> -->
<svg-icon v-if="item.ShowChartTypeEnum > 0" icon-class="readingChart"
class="svg-icon svg-readingChart" @click.stop="(e) => handleReadingChart({
e,
data: {
QuestionId: item.Id,
QuestionName: item.QuestionName
}
})" />
</div>
</template>
<template v-if="item.Type === 'calculation'">
<el-input v-model="questionForm[item.Id]"
disabled type="number" @change="((val) => { formItemChange(val, item) })">
<template slot="append" v-if="item.Unit !== 0">
{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}
</template>
<template slot="append" v-else-if="item.ValueType === 2">%</template>
</el-input>
</template>
</el-form-item>
<template v-if="item.Childrens && item.Childrens.length > 0">
<template v-for="child in item.Childrens">
@ -241,7 +279,10 @@ export default {
m1Id: '',
m2Id: '',
m3Id: '',
avgId: ''
avgId: '',
sRoiStartDistanceId: '',
sRoiEndDistanceId: '',
sRoiDistanceId: ''
}
},
computed: {
@ -328,9 +369,21 @@ export default {
const type = ['number', 'radio', 'select', 'input', 'textarea', 'calculation']
questions.forEach(item => {
if (type.includes(item.Type)) {
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Type === 'number' || item.Type === 'calculation' ? isNaN(parseFloat(item.Answer)) ? null : parseFloat(item.Answer) : item.Answer
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Type === 'number' || item.Type === 'calculation' ? isNaN(parseFloat(item.Answer)) ? null : item.Answer : item.Answer
this.$set(this.questionForm, item.Id, answer)
}
if (item.QuestionType === 1013) {
// ROI
this.sRoiStartDistanceId = item.Id
}
if (item.QuestionType === 1014) {
// ROI
this.sRoiEndDistanceId = item.Id
}
if (item.QuestionType === 1015) {
// ROI
this.sRoiDistanceId = item.Id
}
if (item.Childrens.length > 0) {
this.setQuestionForm(item.Childrens)
}
@ -443,13 +496,17 @@ export default {
setMeasuredData(measureData) {
},
formItemChange(val, question) {
formItemChange(val, item) {
this.formChanged = true
if (question.Type === 'number') {
this.limitBlur(question.Id, question.ValueType)
// if (item.Type === 'number') {
// this.limitBlur(item.Id, item.ValueType)
// }
if (item.Childrens && item.Childrens.length > 0) {
this.resetChild(item.Childrens)
}
if (question.Childrens && question.Childrens.length > 0) {
this.resetChild(question.Childrens)
if ((item.QuestionType === 1013 || item.QuestionType === 1014) && !isNaN(parseFloat(this.questionForm[this.sRoiStartDistanceId])) && !isNaN(parseFloat(this.questionForm[this.sRoiEndDistanceId]))) {
let num = parseFloat(this.questionForm[this.sRoiEndDistanceId]) - parseFloat(this.questionForm[this.sRoiStartDistanceId])
this.$set(this.questionForm, this.sRoiDistanceId, parseFloat(num).toFixed(this.digitPlaces))
}
},
resetChild(obj) {
@ -471,6 +528,72 @@ export default {
this.$set(this.questionForm, qId, this.numberToFixed(value))
}
},
validatorNumberOrNEInput(rule, value, callback) {
let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
if (value === '') {
callback();
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
} else {
callback();
}
}
},
numberOrNEInput(id) {
// this.questionForm[id] = this.questionForm[id].toUpperCase();
if (!this.questionForm[id]) {
return
}
let value = this.questionForm[id].toUpperCase().replace(/[^0-9.NE]/g, '')
if (value.startsWith('N')) {
if (value.length > 2) {
value = value.substring(0, 2)
}
if (value.length === 2 && value[1] !== 'E') {
value = 'N'
}
} else {
value = value.replace(/[NE]/g, '')
}
this.questionForm[id] = value
this.$set(this.questionForm, id, value)
},
handleNumberOrNEBlur(item) {
if (this.questionForm[item.Id] && !this.questionForm[item.Id].startsWith('N')) {
if (item.ValueType === 3) {
//
this.$set(this.questionForm, item.Id, value)
} else {
const num = parseFloat(this.questionForm[item.Id])
if (!isNaN(num)) {
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
if (item.ValueType === 0) {
//
this.$set(this.questionForm, item.Id, parseInt(num))
} else if (item.ValueType === 1 || item.ValueType === 2){
//
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
}
}
}
}
},
handleBlur(value, a, item) {
if (!value || item.ValueType === 3) return false
const num = parseFloat(this.questionForm[item.Id])
if (!isNaN(num)) {
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
if (item.ValueType === 0) {
//
this.$set(this.questionForm, item.Id, parseInt(num))
} else if (item.ValueType === 1 || item.ValueType === 2){
//
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
}
}
},
numberToFixed(v) {
if (this.digitPlaces > -1) {
return isNaN(parseFloat(v)) ? null : `${parseFloat(v).toFixed(this.digitPlaces)}`
@ -631,11 +754,11 @@ export default {
}
const res = await submitTableQuestion(params)
if (res.IsSuccess) {
// this.refreshQuestions()
await this.getReadingQuestionAndAnswer(this.visitTaskId)
this.$refs['ecrf'].getQuestions(this.visitTaskId, true)
this.$refs['ecrf2'].getQuestions(this.visitTaskId, true)
this.$refs['ecrf3'].getQuestions(this.visitTaskId, true)
this.refreshQuestions()
// await this.getReadingQuestionAndAnswer(this.visitTaskId)
// this.$refs['ecrf'].getQuestions(this.visitTaskId, true)
// this.$refs['ecrf2'].getQuestions(this.visitTaskId, true)
// this.$refs['ecrf3'].getQuestions(this.visitTaskId, true)
DicomEvent.$emit('getReportInfo', true)
//
this.addOrEdit.visible = false
@ -666,7 +789,8 @@ export default {
}
const res = await deleteReadingRowAnswer(param)
if (res.IsSuccess) {
await this.getReadingQuestionAndAnswer(this.visitTaskId)
this.refreshQuestions()
// await this.getReadingQuestionAndAnswer(this.visitTaskId)
DicomEvent.$emit('getReportInfo', true)
// ''
this.$message.success(this.$t('common:message:deletedSuccessfully'))
@ -699,7 +823,7 @@ export default {
}
},
async uploadDlgClose() {
await this.getReadingQuestionAndAnswer(this.visitTaskId)
this.refreshQuestions()
DicomEvent.$emit('getReportInfo', true)
this.upload.visible = false
},
@ -883,5 +1007,8 @@ export default {
z-index: 2;
}
}
::v-deep.el-tag.el-tag--info {
color: #000;
}
}
</style>

View File

@ -169,7 +169,16 @@
<div style="display: flex;justify-content: space-between;"
v-else-if="question.Type === 'number' || question.Type === 'calculation'">
<template v-if="question.Type === 'number'">
<el-input-number v-if="question.ValueType === 0" v-model="questionForm[question.Id]" :precision="0"
<el-input
v-if="question.Unit"
type="number"
@input="(val) => questionForm[question.Id] = val.replace(/[^\d.]/g, '')"
@blur="handleBlur(questionForm[question.Id], questionForm, question)"
v-model.trim="questionForm[question.Id]" :disabled="readingTaskState === 2">
<template slot="append" v-if="question.Unit !== 0">{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit }}</template>
<template slot="append" v-else-if="question.ValueType === 2">%</template>
</el-input>
<el-input-number v-else-if="question.ValueType === 0" v-model="questionForm[question.Id]" :precision="0"
:disabled="readingTaskState >= 2 || isFirstChangeTask" />
<el-input-number v-else-if="question.ValueType === 3" v-model="questionForm[question.Id]"
:disabled="readingTaskState >= 2 || isFirstChangeTask" />
@ -387,7 +396,21 @@ export default {
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
this.urls.splice(this.fileList.findIndex(f => f === file.url), 1)
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' })
}
},
handleBlur(value, a, item) {
if (!value || item.ValueType === 3) return false
const num = parseFloat(this.questionForm[item.Id])
if (!isNaN(num)) {
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
if (item.ValueType === 0) {
//
this.$set(this.questionForm, item.Id, parseInt(num))
} else if (item.ValueType === 1 || item.ValueType === 2){
//
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
}
}
},
}
}
</script>

View File

@ -179,7 +179,9 @@ export default {
v.IsBaseLineTask = this.isBaseLineTask
if (v.Type === 'group' && v.GroupClassify !== this.groupClassify) continue
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Id) {
this.$set(this.questionForm, v.Id, v.Answer ? v.Answer : null)
const answer = v.Type === 'select' && v.OptionTypeEnum === 1 && v.Answer ? JSON.parse(v.Answer) : v.Answer
this.$set(this.questionForm, v.Id, answer ? answer : null)
// this.$set(this.questionForm, v.Id, v.Answer ? v.Answer : null)
if (v.QuestionType === 44) {
//
this.imageQualityId = v.Id
@ -210,6 +212,7 @@ export default {
//
this.spleenBottomId = v.Id
}
}
if (v.Childrens.length > 0) {
this.setChild(v.Childrens)
@ -231,7 +234,8 @@ export default {
obj.forEach(i => {
i.IsBaseLineTask = this.isBaseLineTask
if (i.Type !== 'group' && i.Type !== 'summary' && i.Id) {
this.$set(this.questionForm, i.Id, i.Answer ? i.Answer : null)
const answer = i.Type === 'select' && i.OptionTypeEnum === 1 && i.Answer ? JSON.parse(i.Answer) : i.Answer
this.$set(this.questionForm, i.Id, answer ? answer : null)
if (i.QuestionType === 44) {
//
this.imageQualityId = i.Id
@ -342,7 +346,7 @@ export default {
var answers = []
var imageQuality = null
for (const k in this.questionForm) {
answers.push({ id: k, answer: this.questionForm[k] })
answers.push({ id: k, answer: Array.isArray(this.questionForm[k]) ? JSON.stringify(this.questionForm[k]) : this.questionForm[k] })
if (k === this.imageQualityId) {
imageQuality = this.questionForm[k]
}
@ -685,7 +689,6 @@ export default {
this.setQuestionStatus(this.questions, this.measurements[idx].QuestionType)
},
setQuestionStatus(obj, questionType) {
console.log(obj, questionType)
for (let i = 0; i < obj.length; i++) {
if (obj[i].QuestionType === questionType) {
this.$set(obj[i], 'SaveEnum', 1)
@ -785,6 +788,7 @@ export default {
if (obj.key === this.spleenStatusId) {
this.setSpleenCommentDisplay()
}
this.formChanged = true
},
setQuestions() {