数值题型特性优化(数值类型下拉框暂时只有非dicom报告页已修改)
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-07-08 17:52:58 +08:00
parent da136787dd
commit 360f2e65a7
6 changed files with 524 additions and 619 deletions

View File

@ -1,61 +1,47 @@
<template>
<div class="criterion-form-item">
<div
v-if="!!question.GroupName && question.Type==='group'"
style="font-weight: bold;font-size: 16px;margin: 5px 0px;color:#fff;"
>
<div v-if="!!question.GroupName && question.Type === 'group'"
style="font-weight: bold;font-size: 16px;margin: 5px 0px;color:#fff;">
{{ question.GroupName }}
</div>
<div
v-if="question.Type==='table' || question.Type==='basicTable'"
style="font-weight: bold;font-size: 14px;margin: 5px 0px;"
>
<div v-if="question.Type === 'table' || question.Type === 'basicTable'"
style="font-weight: bold;font-size: 14px;margin: 5px 0px;">
<div style="display: flex;justify-content: space-between;align-items: center;color:#fff;margin: 10px 0 5px">
<span :title="question.Remark">{{ question.QuestionName }}</span>
<el-button size="mini" v-if="readingTaskState<2" @click="openAddTableCol(question)">
<el-button size="mini" v-if="readingTaskState < 2" @click="openAddTableCol(question)">
{{ $t('common:button:add') }}
</el-button>
</div>
<el-table
:data="questionForm[question.Id]">
<el-table :data="questionForm[question.Id]">
<el-table-column :label="$t('CustomizeQuestionFormItem:label:OrderMark')" width="60px" show-overflow-tooltip>
<template slot-scope="scope">
{{question.OrderMark}}{{scope.$index + 1}}
{{ question.OrderMark }}{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column
:prop="item.Id"
:label="item.QuestionName"
:key="item.Id"
v-for="item of question.TableQuestions.Questions"
show-overflow-tooltip
:render-header="renderHeader"
>
<el-table-column :prop="item.Id" :label="item.QuestionName" :key="item.Id"
v-for="item of question.TableQuestions.Questions" show-overflow-tooltip :render-header="renderHeader">
<template slot-scope="scope">
<span v-if="item.Type === 'upload'">
{{scope.row[item.Id] === '' ? '' : scope.row[item.Id] ? scope.row[item.Id].split('|').length : ''}}
{{ scope.row[item.Id] === '' ? '' : scope.row[item.Id] ? scope.row[item.Id].split('|').length : '' }}
</span>
<span v-else-if="item.Type === 'number'">
{{scope.row[item.Id] ? parseFloat(scope.row[item.Id]).toFixed(digitPlaces) : null}}
{{ scope.row[item.Id] ? parseFloat(scope.row[item.Id]).toFixed(digitPlaces) : null }}
</span>
<span v-else>
{{scope.row[item.Id]}}
{{ scope.row[item.Id] }}
</span>
</template>
</el-table-column>
<el-table-column
:label="$t('common:action:action')"
show-overflow-tooltip
width="100px"
v-if="readingTaskState < 2"
fixed="right"
>
<el-table-column :label="$t('common:action:action')" show-overflow-tooltip width="100px"
v-if="readingTaskState < 2" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="openAddTableCol(question, scope.$index)">
{{$t('common:button:edit')}}
{{ $t('common:button:edit') }}
</el-button>
<el-button type="text" size="mini" v-if="scope.row.IsCurrentTaskAdd === 'True' || !question.IsCopyLesions || IsBaseline" @click="deleteTableCol(question, scope.$index)">
{{$t('common:button:delete')}}
<el-button type="text" size="mini"
v-if="scope.row.IsCurrentTaskAdd === 'True' || !question.IsCopyLesions || IsBaseline"
@click="deleteTableCol(question, scope.$index)">
{{ $t('common:button:delete') }}
</el-button>
</template>
</el-table-column>
@ -63,285 +49,146 @@
</div>
<template v-else>
<el-form-item
v-if="(question.ShowQuestion===1 && question.ParentTriggerValueList.includes(questionForm[question.ParentId])) || question.ShowQuestion===0"
:label="`${question.QuestionName}`"
:title="question.Remark"
:prop="question.Id"
:rules="[
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (question.RelevanceValueList.includes(isNaN(parseFloat(questionForm[question.RelevanceId])) ? questionForm[question.RelevanceId] : questionForm[question.RelevanceId].toString())))) && question.Type!=='group' && question.Type!=='summary',
message: $t('common:ruleMessage:specify'), trigger: ['blur', 'change']},
{
validator: question.Type === 'number' && !question.TypeValue ? validatorNumberInput :(rule,value,callback )=>{callback()},
trigger: ['blur', 'change']
}
]"
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
>
v-if="(question.ShowQuestion === 1 && question.ParentTriggerValueList.includes(questionForm[question.ParentId])) || question.ShowQuestion === 0"
:label="`${question.QuestionName}`" :title="question.Remark" :prop="question.Id" :rules="[
{
required: (question.IsRequired === 0 || (question.IsRequired === 1 && question.RelevanceId && (question.RelevanceValueList.includes(isNaN(parseFloat(questionForm[question.RelevanceId])) ? questionForm[question.RelevanceId] : questionForm[question.RelevanceId].toString())))) && question.Type !== 'group' && question.Type !== 'summary',
message: $t('common:ruleMessage:specify'), trigger: ['blur', 'change']
},
{
validator: question.Type === 'number' && !question.TypeValue ? validatorNumberInput : (rule, value, callback) => { callback() },
trigger: ['blur', 'change']
}
]" :class="[question.Type === 'group' ? 'mb' : question.Type === 'upload' ? 'uploadWrapper' : '']">
<!-- 输入框 -->
<el-input
v-if="question.Type==='input'"
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || readingTaskState === 2"
/>
<el-input v-if="question.Type === 'input'" v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || readingTaskState === 2" />
<!-- 多行文本输入框 -->
<el-input
v-if="question.Type==='textarea'"
v-model="questionForm[question.Id]"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:disabled="readingTaskState === 2"
/>
<el-input v-if="question.Type === 'textarea'" v-model="questionForm[question.Id]" type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }" :disabled="readingTaskState === 2" />
<!-- 下拉框 -->
<el-select
v-if="question.Type==='select'"
v-model="questionForm[question.Id]"
clearable
<el-select v-if="question.Type === 'select'" v-model="questionForm[question.Id]" clearable
:disabled="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && !!question.DictionaryCode || readingTaskState === 2"
@change="((val)=>{formItemChange(val, question)})"
>
@change="((val) => { formItemChange(val, question) })">
<template v-if="question.TableQuestionType === 1">
<el-option
v-for="item in organList"
:key="item.Id"
:label="item[question.DataTableColumn]"
:value="item[question.DataTableColumn]"
/>
<el-option v-for="item in organList" :key="item.Id" :label="item[question.DataTableColumn]"
:value="item[question.DataTableColumn]" />
</template>
<template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3">
<el-option
v-for="item of $d[question.DictionaryCode]"
:key="item.id"
:value="item.value"
:label="item.label"
/>
<el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
:label="item.label" />
</template>
<template v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
<el-option
v-for="item of $d[question.DictionaryCode]"
:key="item.id"
:value="item.value"
:label="item.label"
/>
<template
v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
<el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
:label="item.label" />
</template>
<template v-else>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val.trim()"
:label="val.trim()"
:value="val.trim()"
/>
<el-option v-for="val in question.TypeValue.split('|')" :key="val.trim()" :label="val.trim()"
:value="val.trim()" />
</template>
</el-select>
<!-- 单选 -->
<el-radio-group
v-if="question.Type==='radio'"
v-model="questionForm[question.Id]"
@change="((val)=>{formItemChange(val, question)})"
:disabled="readingTaskState === 2"
>
<el-radio
v-for="val in question.TypeValue.split('|')"
:key="val.trim()"
:label="val.trim()"
>
<el-radio-group v-if="question.Type === 'radio'" v-model="questionForm[question.Id]"
@change="((val) => { formItemChange(val, question) })" :disabled="readingTaskState === 2">
<el-radio v-for="val in question.TypeValue.split('|')" :key="val.trim()" :label="val.trim()">
{{ val.trim() }}
</el-radio>
</el-radio-group>
<!-- 复选框 -->
<el-checkbox-group
v-if="question.Type==='checkbox'"
v-model="questionForm[question.Id]"
:disabled="readingTaskState === 2"
>
<el-checkbox
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
>
<el-checkbox-group v-if="question.Type === 'checkbox'" v-model="questionForm[question.Id]"
:disabled="readingTaskState === 2">
<el-checkbox v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()">
{{ val.trim() }}
</el-checkbox>
</el-checkbox-group>
<!-- 自动分类 -->
<el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType || readingTaskState === 2"
/>
<el-select
v-if="question.Type === 'class' && question.ClassifyShowType === 2"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType || readingTaskState === 2"
@change="(val) => { formItemChange(val, question) }"
>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
:value="val.trim()"
/>
<el-input v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType || readingTaskState === 2" />
<el-select v-if="question.Type === 'class' && question.ClassifyShowType === 2"
v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType || readingTaskState === 2"
@change="(val) => { formItemChange(val, question) }">
<el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()" :value="val.trim()" />
</el-select>
<el-radio-group
v-if="question.Type === 'class' && question.ClassifyShowType === 3"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType || readingTaskState === 2"
@change="(val) => { formItemChange(val, question) }"
>
<el-radio
v-for="item of question.TypeValue.split('|')"
:key="item.trim()"
:label="item.trim()"
>
<el-radio-group v-if="question.Type === 'class' && question.ClassifyShowType === 3"
v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType || readingTaskState === 2"
@change="(val) => { formItemChange(val, question) }">
<el-radio v-for="item of question.TypeValue.split('|')" :key="item.trim()" :label="item.trim()">
{{ item.trim() }}
</el-radio>
</el-radio-group>
<el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 4"
type="number"
:disabled="!question.ClassifyEditType || readingTaskState === 2"
v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }"
/>
<el-input v-if="question.Type === 'class' && question.ClassifyShowType === 4" type="number"
:disabled="!question.ClassifyEditType || readingTaskState === 2" v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }" />
<!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-input
v-if="question.Type==='calculation'"
v-model="questionForm[question.Id]"
@input="value=value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')"
disabled
/>
<el-input v-if="question.Type === 'calculation'" v-model="questionForm[question.Id]"
@input="value = value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')" disabled />
<!-- 自增 -->
<el-input
v-if="question.Type==='increment'"
v-model="questionForm[question.Id]"
disabled
/>
<el-input v-if="question.Type === 'increment'" v-model="questionForm[question.Id]" disabled />
<!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-select
v-if="question.Type === 'number' && question.TypeValue"
v-model="questionForm[question.Id]"
clearable
@change="(val) => { formItemNumberChange(val, question) }"
:disabled="readingTaskState === 2"
>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
:value="val.trim()"
/>
<el-select v-if="question.Type === 'number' && question.TypeValue" v-model="questionForm[question.Id]" clearable
@change="(val) => { formItemNumberChange(val, question) }" :disabled="readingTaskState === 2">
<el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()" :value="val.trim()" />
</el-select>
<el-input
type="text"
v-if="question.Type === 'number' && !question.TypeValue && question.DataSource !== 1"
@change="(val) => { formItemNumberChange(val, question) }"
@input="numberInput(question.Id)"
<el-input type="text" v-if="question.Type === 'number' && !question.TypeValue && question.DataSource !== 1"
@change="(val) => { formItemNumberChange(val, question) }" @input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
v-model.trim="questionForm[question.Id]"
:disabled="readingTaskState === 2"
>
v-model.trim="questionForm[question.Id]" :disabled="readingTaskState === 2">
<!-- <template slot="append">1</template> -->
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
<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
type="text"
@input="numberInput(question.Id)"
<el-input type="text" @input="numberInput(question.Id)"
v-if="question.Type === 'number' && !question.TypeValue && question.DataSource === 1"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
:disabled="question.DataSource === 1 || readingTaskState === 2"
v-model.trim="questionForm[question.Id]"
>
:disabled="question.DataSource === 1 || readingTaskState === 2" v-model.trim="questionForm[question.Id]">
<!-- <template slot="append">2</template> -->
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
<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-upload
v-if="question.Type==='upload'"
:disabled="readingTaskState === 2"
action
:accept="question.FileType"
:limit="question.ImageCount === 0 ? 100 : question.ImageCount"
<el-upload v-if="question.Type === 'upload'" :disabled="readingTaskState === 2" action
:accept="question.FileType" :limit="question.ImageCount === 0 ? 100 : question.ImageCount"
:on-preview="handlePictureCardPreview"
:before-upload="(file) => {return handleBeforeUpload(file, question.FileType)}"
:http-request="uploadScreenshot"
:on-remove="handleRemove"
:file-list="fileList"
:class="{disabled:question.ImageCount === 0 ? false : fileList.length >= question.ImageCount}"
>
:before-upload="(file) => { return handleBeforeUpload(file, question.FileType) }"
:http-request="uploadScreenshot" :on-remove="handleRemove" :file-list="fileList"
:class="{ disabled: question.ImageCount === 0 ? false : fileList.length >= question.ImageCount }">
<el-button slot="default" class="el-icon-plus" v-if="readingTaskState < 2">
{{this.$t('common:button:upload')}}
{{ this.$t('common:button:upload') }}
</el-button>
</el-upload>
<viewer
v-if="question.Type==='upload' && imgVisible"
:ref="imageUrl"
style="margin:0 10px;"
:images="[imageUrl]"
>
<img
v-show="false"
crossorigin="anonymous"
:src="imageUrl"
alt="Image"
>
<viewer v-if="question.Type === 'upload' && imgVisible" :ref="imageUrl" style="margin:0 10px;"
:images="[imageUrl]">
<img v-show="false" crossorigin="anonymous" :src="imageUrl" alt="Image">
</viewer>
</el-form-item>
</template>
<template v-if="question.Childrens && question.Childrens.length>0 && question.Type !== 'table' && question.Type !== 'basicTable'">
<CustomizeQuestionFormItem
v-for="(item) in question.Childrens"
:key="item.Id"
:question="item"
:IsBaseline="IsBaseline"
:reading-task-state="readingTaskState"
:question-form="questionForm"
:visit-task-id="visitTaskId"
:criterion-id="criterionId"
:CalculationList="CalculationList"
@formItemNumberChange="formItemNumberChange"
@setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData"
/>
<template
v-if="question.Childrens && question.Childrens.length > 0 && question.Type !== 'table' && question.Type !== 'basicTable'">
<CustomizeQuestionFormItem v-for="(item) in question.Childrens" :key="item.Id" :question="item"
:IsBaseline="IsBaseline" :reading-task-state="readingTaskState" :question-form="questionForm"
:visit-task-id="visitTaskId" :criterion-id="criterionId" :CalculationList="CalculationList"
@formItemNumberChange="formItemNumberChange" @setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData" />
</template>
<base-model :config="addOrEdit"
class="my_dialog"
:close-on-click-modal="false"
width="400px"
append-to-body
>
<base-model :config="addOrEdit" class="my_dialog" :close-on-click-modal="false" width="400px" append-to-body>
<template slot="dialog-body">
<el-form
ref="tableQsForm"
:model="QuestionsForm"
v-loading="loading"
size="small"
>
<QuestionTableFormItem
v-for="(item) in QuestionsList"
:key="item.Id"
:question="item"
:IsBaseline="IsBaseline"
:reading-task-state="readingTaskState"
:question-form="QuestionsForm"
:visit-task-id="visitTaskId"
:criterion-id="criterionId"
:type="addOrEdit.type"
:CalculationList="CalculationTabelList"
@formItemTableNumberChange="formItemTableNumberChange"
@resetFormItemData="resetTableFormItemData"
@setFormItemData="setFormTableItemData"
/>
<el-form ref="tableQsForm" :model="QuestionsForm" v-loading="loading" size="small">
<QuestionTableFormItem v-for="(item) in QuestionsList" :key="item.Id" :question="item"
:IsBaseline="IsBaseline" :reading-task-state="readingTaskState" :question-form="QuestionsForm"
:visit-task-id="visitTaskId" :criterion-id="criterionId" :type="addOrEdit.type"
:CalculationList="CalculationTabelList" @formItemTableNumberChange="formItemTableNumberChange"
@resetFormItemData="resetTableFormItemData" @setFormItemData="setFormTableItemData" />
</el-form>
</template>
<template slot="dialog-footer">
<el-button
size="small"
@click="addOrEdit.visible = false"
>
<el-button size="small" @click="addOrEdit.visible = false">
{{ $t('common:button:cancel') }}
</el-button>
<!-- 保存 -->
@ -351,23 +198,10 @@
</template>
</base-model>
<!-- 预览文件 -->
<el-dialog
v-if="previewVisible"
:visible.sync="previewVisible"
:title="$t('common:button:preview')"
:fullscreen="true"
append-to-body
custom-class="base-dialog-wrapper"
>
<div
class="base-modal-body"
style="border: 2px solid #ccc; padding: 10px"
>
<PreviewFile
v-if="previewVisible"
:file-path="currentPath"
:file-type="currentType"
/>
<el-dialog v-if="previewVisible" :visible.sync="previewVisible" :title="$t('common:button:preview')"
:fullscreen="true" append-to-body custom-class="base-dialog-wrapper">
<div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
<PreviewFile v-if="previewVisible" :file-path="currentPath" :file-type="currentType" />
</div>
</el-dialog>
</div>
@ -514,15 +348,15 @@ export default {
},
validatorNumberInput(rule, value, callback) {
let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify')));
if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify')));
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
}else{
callback();
}
callback();
}
}
},
limitInput(value, a, b) {
if (value.indexOf('.') > -1) {
@ -533,7 +367,7 @@ export default {
},
handleBlur(value, a, b) {
if (!value) return false
if(!isNaN(parseFloat(value))) {
if (!isNaN(parseFloat(value))) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
}
},
@ -553,14 +387,14 @@ export default {
}
loading.close()
}).catch(() => {
loading.close()
})
loading.close()
})
})
},
setFormTableItemData(obj) {
this.$set(this.QuestionsForm, obj.key, obj.val)
this.classArr.map(i=>{
this.classArr.map(i => {
if (i.triggerId === obj.key) {
let answer = null
let list = JSON.parse(i.classifyAlgorithms)
@ -571,12 +405,12 @@ export default {
parseFloat(obj.val) < parseFloat(v.lt)
)
})
answer = o ? o.label : null
answer = o ? o.label : null
} else if (i.classifyType === 1) {
let o = list.find(v => {
return v.val.includes(obj.val)
})
answer = o ? o.label : null
answer = o ? o.label : null
}
this.$set(this.QuestionsForm, i.classId, answer)
}
@ -675,13 +509,14 @@ export default {
var index = this.AnswersList.findIndex(v => v.RowId === this.QuestionsForm.RowId)
this.AnswersList.splice(index, 1, this.QuestionsForm)
}
console.log({key: this.question.Id, val: this.AnswersList, question: this.question})
this.$emit('setFormItemData', {key: this.question.Id, val: this.AnswersList, question: this.question})
console.log({ key: this.question.Id, val: this.AnswersList, question: this.question })
this.$emit('setFormItemData', { key: this.question.Id, val: this.AnswersList, question: this.question })
this.formItemNumberChange(this.question.Id, true)
this.addOrEdit.visible = false
})
},
logic(rules, num = 0) {
let isNE = false
try {
if (rules.CalculateQuestionList.length === 0) {
return false
@ -698,6 +533,9 @@ export default {
} else {
num *= parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
break;
case 6:
@ -707,6 +545,9 @@ export default {
} else {
num += parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
break;
case 7:
@ -716,6 +557,9 @@ export default {
} else {
num += parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = this.questionForm[o.QuestionId].length === 0 ? 0 : num / this.questionForm[o.QuestionId].length
break;
@ -723,6 +567,9 @@ export default {
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = arr.length === 0 ? 0 : Math.max(...arr)
break;
@ -730,17 +577,26 @@ export default {
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = arr.length === 0 ? 0 : Math.min(...arr)
break;
}
} else {
num = parseFloat(this.questionForm[o.TableQuestionId])
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
if (!isNaN(num)) {
dataArr.push(num)
}
}
} else {
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
switch (rules.CustomCalculateMark) {
case 1:
num += parseFloat(this.questionForm[o.TableQuestionId])
@ -763,8 +619,8 @@ export default {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0);
}, 0) / dataArr.length;
return acc + (typeof curr === "number" ? curr : 0);
}, 0) / dataArr.length;
break;
case 11:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
@ -779,7 +635,7 @@ export default {
num = Math.min(...dataArr);
break;
case 13:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc && curr) ? 1 : 0
@ -796,6 +652,9 @@ export default {
} catch (e) {
console.log(e)
}
if (isNE) {
return 'NE'
}
if (rules.ValueType === 2) {
num = num * 100
}
@ -804,7 +663,7 @@ export default {
} else {
return num.toFixed(this.digitPlaces)
}
},
formItemNumberChange(questionId, isTable) {
if (typeof isTable === 'object') {
@ -868,7 +727,7 @@ export default {
// this.$set(this.QuestionsForm, v.Id, num.toString())
// }
// })
// },
formItemTableNumberChange() {
this.question.TableQuestions.Questions.forEach((v) => {
@ -876,7 +735,11 @@ export default {
var CalculateQuestions = JSON.parse(v.CalculateQuestions);
var num,
arr = [];
let isNE = false
CalculateQuestions.forEach((o, i) => {
if (this.QuestionsForm[o.TableQuestionId] === 'NE') {
isNE = true
}
if (i === 0) {
num = parseFloat(this.QuestionsForm[o.TableQuestionId]);
arr = [num];
@ -900,8 +763,8 @@ export default {
arr.length === 0
? 0
: arr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0);
}, 0) / arr.length;
return acc + (typeof curr === "number" ? curr : 0);
}, 0) / arr.length;
break;
case 8:
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]));
@ -915,6 +778,9 @@ export default {
}
}
});
if (isNE) {
num = 'NE'
}
this.$set(this.QuestionsForm, v.Id, num.toString());
}
});
@ -923,9 +789,9 @@ export default {
this.addOrEdit.visible = true
this.addOrEdit.title = row.QuestionName + this.$t('trials:readingUnit:qsList:title:tableQs')
this.QuestionsList = row.TableQuestions.Questions
row.TableQuestions.Questions.map(v=>{
row.TableQuestions.Questions.map(v => {
if (v.Type === 'class') {
this.classArr.push({triggerId: v.ClassifyTableQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType})
this.classArr.push({ triggerId: v.ClassifyTableQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType })
}
})
this.AnswersList = row.TableQuestions.Answers
@ -1034,17 +900,17 @@ export default {
},
//
handlePictureCardPreview(file) {
var suffix = file.url.substring(file.url.lastIndexOf(".")+1)
var suffix = file.url.substring(file.url.lastIndexOf(".") + 1)
suffix = suffix ? suffix.toLowerCase() : ''
if (suffix === 'doc' || suffix === 'docx' || suffix === 'pdf'){
if (suffix === 'doc' || suffix === 'docx' || suffix === 'pdf') {
// window.open(this.OSSclientConfig.basePath + file.url,'_blank')
this.currentPath = file.url
this.currentType = suffix
this.previewVisible = true
}else{
} else {
this.imageUrl = this.OSSclientConfig.basePath + file.url
this.imgVisible = true
this.$nextTick(()=>{
this.$nextTick(() => {
this.$refs[this.imageUrl].$viewer.show()
})
}
@ -1054,8 +920,8 @@ export default {
if (file && file.status === "success") {
this.imageUrl = ''
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
this.fileList.forEach((i,index)=>{
i.name = `${this.$t('trials:emailManageCfg:title:fileName')}${index+ 1}`
this.fileList.forEach((i, index) => {
i.name = `${this.$t('trials:emailManageCfg:title:fileName')}${index + 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('|') : '', question: this.question })
@ -1066,12 +932,14 @@ export default {
}
</script>
<style lang="scss" scoped>
.my_dialog{
.criterion-form-item{
.my_dialog {
.criterion-form-item {
width: 100%;
::v-deep .el-form-item__content{
::v-deep .el-form-item__content {
width: auto;
}
//::v-deep .el-input-goup__append{
// background-color: transparent;
// color: #ddd;
@ -1079,63 +947,78 @@ export default {
//}
}
}
::v-deep .el-form-item__label{
::v-deep .el-form-item__label {
color: #c3c3c3;
}
::v-deep .el-radio__label{
::v-deep .el-radio__label {
color: #c3c3c3;
}
::v-deep .el-input-group__append{
::v-deep .el-input-group__append {
background: #000;
color: #ddd;
border: 1px solid #5e5e5e;
}
::v-deep .el-input .el-input__inner{
::v-deep .el-input .el-input__inner {
background-color: transparent;
color: #ddd;
border: 1px solid #5e5e5e;
}
.criterion-form-item{
::v-deep .criterion-form-item .el-form-item{
.criterion-form-item {
::v-deep .criterion-form-item .el-form-item {
display: block;
.el-form-item__label{
.el-form-item__label {
display: block;
color: #c8c8c8;
float: none;
text-align: left;
}
}
.el-form-item{
.el-form-item {
display: flex;
flex-direction: row;
align-items: flex-start;
}
.el-input{
width:100%;
.el-input {
width: 100%;
}
.mb{
margin-bottom: 0px;
}
.disabled{
::v-deep .el-upload--picture-card {
display: none;
.mb {
margin-bottom: 0px;
}
.disabled {
::v-deep .el-upload--picture-card {
display: none;
}
}
.uploadWrapper {
display: flex;
flex-direction: column;
align-items: flex-start;
}
}
.uploadWrapper{
display: flex;
flex-direction: column;
align-items: flex-start;
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
height: 10px !important;
}
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar{
height: 10px!important;
}
::v-deep .el-table__fixed-right::before{
::v-deep .el-table__fixed-right::before {
display: none;
}
::v-deep .el-upload-list__item-name{
::v-deep .el-upload-list__item-name {
color: #0a84ff;
.el-icon-document{
.el-icon-document {
color: #0a84ff;
}
}

View File

@ -1,240 +1,135 @@
<template>
<div class="criterion-form-item">
<el-form-item
v-if="(question.ShowQuestion===1 && !!~question.ParentTriggerValueList.indexOf(questionForm[question.ParentId])) || question.ShowQuestion===0"
:label="`${question.QuestionName}`"
:prop="question.Id"
:title="question.Remark"
:rules="[
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && !!~question.RelevanceValueList.indexOf(questionForm[question.RelevanceId]))) && question.Type!=='group' && question.Type!=='summary',
message: $t('common:ruleMessage:select'), trigger: ['blur', 'change']},
{
validator: question.Type === 'number' && !question.TypeValue ? validatorNumberInput :(rule,value,callback )=>{callback()},
trigger: ['blur', 'change']
}
]"
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
>
<!-- 输入框 -->
<el-input
v-if="question.Type==='input'"
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
/>
<!-- 多行文本输入框 -->
<el-input
v-if="question.Type==='textarea'"
v-model="questionForm[question.Id]"
type="textarea"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
:autosize="{ minRows: 2, maxRows: 4}"
/>
<!-- 下拉框 -->
<el-select
v-if="question.Type==='select'"
v-model="questionForm[question.Id]"
clearable
:disabled="(question.TableQuestionType === 2 || question.QuestionGenre === 2) || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemChange(val, question)})"
>
<template v-if="question.TableQuestionType === 1">
<el-option
v-for="item in organList"
:key="item.Id"
:label="item[question.DataTableColumn]"
:value="item[question.DataTableColumn]"
/>
</template>
<template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3">
<el-option
v-for="item of $d[question.DictionaryCode]"
:key="item.id"
:value="item.value"
:label="item.label"
/>
</template>
<template v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
<el-option
v-for="item of $d[question.DictionaryCode]"
:key="item.id"
:value="item.value"
:label="item.label"
/>
</template>
<template v-else>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
:value="val"
/>
</template>
v-if="(question.ShowQuestion === 1 && !!~question.ParentTriggerValueList.indexOf(questionForm[question.ParentId])) || question.ShowQuestion === 0"
:label="`${question.QuestionName}`" :prop="question.Id" :title="question.Remark" :rules="[
{
required: (question.IsRequired === 0 || (question.IsRequired === 1 && question.RelevanceId && !!~question.RelevanceValueList.indexOf(questionForm[question.RelevanceId]))) && question.Type !== 'group' && question.Type !== 'summary',
message: $t('common:ruleMessage:select'), trigger: ['blur', 'change']
},
{
validator: question.Type === 'number' && !question.TypeValue ? validatorNumberInput : (rule, value, callback) => { callback() },
trigger: ['blur', 'change']
}
]" :class="[question.Type === 'group' ? 'mb' : question.Type === 'upload' ? 'uploadWrapper' : '']">
<!-- 输入框 -->
<el-input v-if="question.Type === 'input'" v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')" />
<!-- 多行文本输入框 -->
<el-input v-if="question.Type === 'textarea'" v-model="questionForm[question.Id]" type="textarea"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
:autosize="{ minRows: 2, maxRows: 4 }" />
<!-- 下拉框 -->
<el-select v-if="question.Type === 'select'" v-model="questionForm[question.Id]" clearable
:disabled="(question.TableQuestionType === 2 || question.QuestionGenre === 2) || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val) => { formItemChange(val, question) })">
<template v-if="question.TableQuestionType === 1">
<el-option v-for="item in organList" :key="item.Id" :label="item[question.DataTableColumn]"
:value="item[question.DataTableColumn]" />
</template>
<template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3">
<el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
:label="item.label" />
</template>
<template
v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
<el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
:label="item.label" />
</template>
<template v-else>
<el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val" :value="val" />
</template>
</el-select>
<!-- 单选 -->
<el-radio-group
v-if="question.Type==='radio'"
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemChange(val, question)})"
>
<el-radio
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
>
{{ val }}
</el-radio>
</el-radio-group>
<!-- 复选框 -->
<el-checkbox-group
v-if="question.Type==='checkbox'"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
v-model="questionForm[question.Id]"
>
<el-checkbox
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
>
{{ val }}
</el-checkbox>
</el-checkbox-group>
<!-- 自动分类 -->
<el-input
v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]"
/>
<el-select
v-if="question.Type === 'class' && question.ClassifyShowType === 2"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType"
@change="(val) => { formItemChange(val, question) }"
>
<el-option
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
:value="val.trim()"
/>
</el-select>
<el-radio-group
v-if="question.Type === 'class' && question.ClassifyShowType === 3"
v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType"
@change="(val) => { formItemChange(val, question) }"
>
<el-radio
v-for="item of question.TypeValue.split('|')"
:key="item.trim()"
:label="item.trim()"
>
{{ item.trim() }}
</el-radio>
</el-radio-group>
<!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-input
v-if="question.Type==='calculation'"
v-model="questionForm[question.Id]"
oninput="value=value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')"
disabled
/>
<!-- 自增 -->
<el-input
v-if="question.Type==='increment'"
v-model="questionForm[question.Id]"
disabled
/>
<!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-input
type="text"
v-if="question.Type === 'number' && question.DataSource !== 1"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemNumberChange(val, question)})"
@input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
v-model.trim="questionForm[question.Id]"
>
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
</el-input>
<el-input
type="text"
v-if="question.Type === 'number' && question.DataSource === 1"
:disabled="question.DataSource === 1"
@input="numberInput(question.Id, true )"
@blur="handleCalculationBlur(calculationValue)"
v-model.trim="calculationValue"
>
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
</el-input>
<!-- 上传图像 -->
<el-upload
v-if="question.Type==='upload'"
action
:accept="question.FileType"
:limit="question.ImageCount === 0 ? 100 : question.ImageCount"
:on-preview="handlePictureCardPreview"
:before-upload="handleBeforeUpload"
:http-request="uploadScreenshot"
list-type="picture-card"
:on-remove="handleRemove"
:file-list="fileList"
:class="{disabled: question.ImageCount === 0 ? false : fileList.length >= question.ImageCount}"
>
<i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}">
<viewer
:ref="file.url"
:images="[imageUrl]"
style="
</el-select>
<!-- 单选 -->
<el-radio-group v-if="question.Type === 'radio'" v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val) => { formItemChange(val, question) })">
<el-radio v-for="val in question.TypeValue.split('|')" :key="val" :label="val">
{{ val }}
</el-radio>
</el-radio-group>
<!-- 复选框 -->
<el-checkbox-group v-if="question.Type === 'checkbox'"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
v-model="questionForm[question.Id]">
<el-checkbox v-for="val in question.TypeValue.split('|')" :key="val" :label="val">
{{ val }}
</el-checkbox>
</el-checkbox-group>
<!-- 自动分类 -->
<el-input v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-model="questionForm[question.Id]" />
<el-select v-if="question.Type === 'class' && question.ClassifyShowType === 2" v-model="questionForm[question.Id]"
:disabled="!question.ClassifyEditType" @change="(val) => { formItemChange(val, question) }">
<el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()" :value="val.trim()" />
</el-select>
<el-radio-group v-if="question.Type === 'class' && question.ClassifyShowType === 3"
v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType"
@change="(val) => { formItemChange(val, question) }">
<el-radio v-for="item of question.TypeValue.split('|')" :key="item.trim()" :label="item.trim()">
{{ item.trim() }}
</el-radio>
</el-radio-group>
<!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-input v-if="question.Type === 'calculation'" v-model="questionForm[question.Id]"
oninput="value=value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')" disabled />
<!-- 自增 -->
<el-input v-if="question.Type === 'increment'" v-model="questionForm[question.Id]" disabled />
<!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" -->
<el-input type="text" v-if="question.Type === 'number' && question.DataSource !== 1"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val) => { formItemNumberChange(val, question) })" @input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
v-model.trim="questionForm[question.Id]">
<template slot="append" v-if="question.Unit !== 0">{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) :
question.CustomUnit }}</template>
</el-input>
<el-input type="text" v-if="question.Type === 'number' && question.DataSource === 1"
:disabled="question.DataSource === 1" @input="numberInput(question.Id, true)"
@blur="handleCalculationBlur(calculationValue)" v-model.trim="calculationValue">
<template slot="append" v-if="question.Unit !== 0">{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) :
question.CustomUnit }}</template>
</el-input>
<!-- 上传图像 -->
<el-upload v-if="question.Type === 'upload'" action :accept="question.FileType"
:limit="question.ImageCount === 0 ? 100 : question.ImageCount" :on-preview="handlePictureCardPreview"
:before-upload="handleBeforeUpload" :http-request="uploadScreenshot" list-type="picture-card"
:on-remove="handleRemove" :file-list="fileList"
:class="{ disabled: question.ImageCount === 0 ? false : fileList.length >= question.ImageCount }">
<i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}">
<viewer :ref="file.url" :images="[imageUrl]" style="
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
"
>
<img
class="el-upload-list__item-thumbnail"
:src="OSSclientConfig.basePath + file.url"
crossOrigin="anonymous"
alt=""
style="max-width: 100%; max-height: 100%"
/>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in" />
</span>
<span
v-if="readingTaskState < 2"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete" />
</span>
">
<img class="el-upload-list__item-thumbnail" :src="OSSclientConfig.basePath + file.url"
crossOrigin="anonymous" alt="" style="max-width: 100%; max-height: 100%" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<i class="el-icon-zoom-in" />
</span>
</viewer>
<span v-if="readingTaskState < 2" class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete" />
</span>
</span>
</viewer>
</div>
</el-upload>
<el-dialog v-if="question.Type === 'upload'" append-to-body :visible.sync="imgVisible" width="600px">
<el-image :src="imageUrl" width="100%">
<div slot="placeholder" class="image-slot">
{{ $t('trials:readingUnit:qsList:message:loading') }}<span class="dot">...</span>
</div>
</el-upload>
<el-dialog
v-if="question.Type==='upload'"
append-to-body
:visible.sync="imgVisible"
width="600px"
>
<el-image :src="imageUrl" width="100%">
<div slot="placeholder" class="image-slot">
{{$t('trials:readingUnit:qsList:message:loading')}}<span class="dot">...</span>
</div>
</el-image>
</el-dialog>
</el-form-item>
</el-image>
</el-dialog>
</el-form-item>
</div>
</template>
<script>
@ -348,24 +243,24 @@ export default {
// }
},
methods: {
numberInput(id,notId = false) {
if(notId ) {
numberInput(id, notId = false) {
if (notId) {
this.calculationValue = this.calculationValue.toUpperCase();
}else {
} else {
this.questionForm[id] = this.questionForm[id].toUpperCase();
}
},
validatorNumberInput(rule, value, callback) {
let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify')));
if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify')));
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
}else{
callback();
}
callback();
}
}
},
save() {
},
@ -408,14 +303,14 @@ export default {
},
handleBlur(value, a, b) {
if (!value) return false
if(!isNaN(parseFloat(value))) {
if (!isNaN(parseFloat(value))) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
}
// this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
},
handleCalculationBlur(v) {
if (!v) return false
if(!isNaN(parseFloat(v))) {
if (!isNaN(parseFloat(v))) {
this.calculationValue = parseFloat(v).toFixed(this.digitPlaces)
}
},
@ -429,6 +324,7 @@ export default {
}
},
logic(rules, num = 0) {
let isNE = false
try {
if (rules.CalculateQuestionList.length === 0) {
return false
@ -437,6 +333,10 @@ export default {
var count = 0
var maxList = [], minList = []
rules.CalculateQuestionList.forEach((o, i) => {
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
if (rules.CustomCalculateMark > 4 && rules.CustomCalculateMark < 10) {
if (i !== 0) {
switch (rules.CustomCalculateMark) {
@ -486,25 +386,25 @@ export default {
}
break;
case 10:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => {
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0);
}, 0) / dataArr.length;
break;
case 11:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.max(...dataArr);
break;
case 12:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.min(...dataArr);
break;
break;
case 11:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.max(...dataArr);
break;
case 12:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.min(...dataArr);
break;
}
} else {
num = parseFloat(this.questionForm[o.TableQuestionId])
@ -514,6 +414,9 @@ export default {
} catch (e) {
console.log(e)
}
if (isNE) {
return 'NE'
}
if (rules.ValueType === 2) {
num = num * 100
}
@ -552,9 +455,9 @@ export default {
var file = await this.fileToBlob(param.file)
const res = await this.OSSclient.put(`/${trialId}/Read/${subjectId}/Visit/${param.file.name}`, file)
console.log(res)
this.fileList.push({ name: param.file.name, path: this.$getObjectName(res.url), url: this.$getObjectName(res.url)})
this.fileList.push({ name: param.file.name, path: this.$getObjectName(res.url), url: this.$getObjectName(res.url) })
this.urls.push(this.$getObjectName(res.url))
this.$emit('setFormItemData', { key:this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
loading.close()
},
handleBeforeUpload(file) {
@ -581,56 +484,62 @@ export default {
},
//
handlePictureCardPreview(file) {
var suffix = file.url.substring(file.url.lastIndexOf(".")+1)
var suffix = file.url.substring(file.url.lastIndexOf(".") + 1)
suffix = suffix ? suffix.toLowerCase() : ''
if (suffix === 'doc' || suffix === 'docx' || suffix === 'pdf'){
window.open(this.OSSclientConfig.basePath + file.url,'_blank')
}else{
if (suffix === 'doc' || suffix === 'docx' || suffix === 'pdf') {
window.open(this.OSSclientConfig.basePath + file.url, '_blank')
} else {
this.imageUrl = this.OSSclientConfig.basePath + file.url
// this.imgVisible = true
this.$refs[file.url].$viewer.show()
}
},
//
handleRemove(file, fileList) {
this.imageUrl = ''
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('|') : '', question: this.question })
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
}
}
}
</script>
<style lang="scss" scoped>
.my_dialog{
.criterion-form-item{
::v-deep .el-form-item__content{
.my_dialog {
.criterion-form-item {
::v-deep .el-form-item__content {
width: auto;
}
}
}
.criterion-form-item{
.el-form-item{
.criterion-form-item {
.el-form-item {
display: flex;
flex-direction: row;
align-items: flex-start;
}
::v-deep .el-form-item__content{
::v-deep .el-form-item__content {
width: 500px;
}
.el-input{
width:100%;
.el-input {
width: 100%;
}
.mb{
.mb {
margin-bottom: 0px;
}
.disabled{
.disabled {
::v-deep .el-upload--picture-card {
display: none;
}
}
.uploadWrapper{
.uploadWrapper {
display: flex;
flex-direction: column;
align-items: flex-start;

View File

@ -708,6 +708,7 @@ export default {
}
},
logic(rules, num = 0) {
let isNE = false
try {
if (rules.CalculateQuestionList.length === 0) {
return false
@ -724,6 +725,9 @@ export default {
} else {
num *= parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
break;
case 6:
@ -733,6 +737,9 @@ export default {
} else {
num += parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
break;
case 7:
@ -742,6 +749,9 @@ export default {
} else {
num += parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = this.questionForm[o.QuestionId].length === 0 ? 0 : num / this.questionForm[o.QuestionId].length
break;
@ -749,6 +759,9 @@ export default {
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = arr.length === 0 ? 0 : Math.max(...arr)
break;
@ -756,17 +769,26 @@ export default {
var arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = arr.length === 0 ? 0 : Math.min(...arr)
break;
}
} else {
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
num = parseFloat(this.questionForm[o.TableQuestionId])
if (!isNaN(num)) {
dataArr.push(num)
}
}
} else {
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
switch (rules.CustomCalculateMark) {
case 1:
num += parseFloat(this.questionForm[o.TableQuestionId])
@ -822,6 +844,9 @@ export default {
} catch (e) {
console.log(e)
}
if (isNE) {
return 'NE'
}
if (isNaN(num)) {
return null
}
@ -875,7 +900,11 @@ export default {
var CalculateQuestions = JSON.parse(v.CalculateQuestions);
var num,
arr = [];
let isNE = false
CalculateQuestions.forEach((o, i) => {
if (this.QuestionsForm[o.TableQuestionId] === 'NE') {
isNE = true
}
if (i === 0) {
num = parseFloat(this.QuestionsForm[o.TableQuestionId]);
arr = [num];
@ -914,6 +943,9 @@ export default {
}
}
});
if (isNE) {
num = 'NE'
}
this.$set(this.QuestionsForm, v.Id, num.toString());
}
});

View File

@ -94,31 +94,31 @@
<el-button
v-if="readingTaskState < 2 && (!questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] || (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && !questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked))"
size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 1, question })">
{{$t('dicom3D:CustomizeQuestionFormItem:button:measure')}}
{{ $t('dicom3D:CustomizeQuestionFormItem:button:measure') }}
</el-button>
<!-- 绑定 -->
<el-button
v-if="readingTaskState < 2 && (!questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] || (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && !questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked))"
size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 0, question })">
{{$t('dicom3D:CustomizeQuestionFormItem:button:bind')}}
{{ $t('dicom3D:CustomizeQuestionFormItem:button:bind') }}
</el-button>
<!-- 查看 -->
<el-button
v-if="questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked"
size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 2, question })">
{{$t('dicom3D:CustomizeQuestionFormItem:button:view')}}
{{ $t('dicom3D:CustomizeQuestionFormItem:button:view') }}
</el-button>
<!-- 更改 -->
<el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked)"
size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 3, question })">
{{$t('dicom3D:CustomizeQuestionFormItem:button:edit')}}
{{ $t('dicom3D:CustomizeQuestionFormItem:button:edit') }}
</el-button>
<!-- 移除 -->
<el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked)"
size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 4, question })">
{{$t('dicom3D:CustomizeQuestionFormItem:button:remove')}}
{{ $t('dicom3D:CustomizeQuestionFormItem:button:remove') }}
</el-button>
<!-- 保存 -->
<el-button
@ -129,7 +129,7 @@
class="item" effect="dark" :content="$t('trials:reading:button:unsaved')" placement="bottom">
<i class="el-icon-warning" style="color:red" />
</el-tooltip>
{{$t('dicom3D:CustomizeQuestionFormItem:button:save')}}
{{ $t('dicom3D:CustomizeQuestionFormItem:button:save') }}
</el-button>
</div>
</template>
@ -375,6 +375,7 @@ export default {
}
},
logic(rules, num = 0) {
let isNE = false
try {
if (rules.CalculateQuestionList.length === 0) {
return false
@ -383,6 +384,9 @@ export default {
var count = 0
var maxList = [], minList = []
rules.CalculateQuestionList.forEach((o, i) => {
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
if (rules.CustomCalculateMark > 4 && rules.CustomCalculateMark < 10) {
if (i !== 0) {
switch (rules.CustomCalculateMark) {
@ -460,6 +464,9 @@ export default {
} catch (e) {
console.log(e)
}
if (isNE) {
return 'NE'
}
if (rules.ValueType === 2) {
num = num * 100
}

View File

@ -107,10 +107,11 @@
{{ questionForm[scope.row.QuestionId][scope.row.xfIndex][scope.row.TableQuestionId] }}
</span>
<el-select
v-else-if="(scope.row.Type==='select' || scope.row.Type==='radio') && !scope.row.IsShowInDicom && ((task.IsBaseLine && scope.row.LimitEdit === 1) || (!task.IsBaseLine && scope.row.LimitEdit === 2) || scope.row.LimitEdit === 0)"
v-else-if="(scope.row.Type==='select' || scope.row.Type==='radio' || (scope.row.Type==='number' && scope.row.TypeValue)) && !scope.row.IsShowInDicom && ((task.IsBaseLine && scope.row.LimitEdit === 1) || (!task.IsBaseLine && scope.row.LimitEdit === 2) || scope.row.LimitEdit === 0)"
v-model="questionForm[scope.row.QuestionId]"
size="mini"
clearable
:clearable="scope.row.Type!=='number'"
@focus="() => {questionId = scope.row.QuestionId}"
>
<template>
<el-option
@ -396,7 +397,7 @@ export default {
if (v.Type === 'number') {
let val = null
if (v.ValueType === 0) {
val = parseInt(v.Answers[this.visitTaskId])
val = v.Answers[this.visitTaskId] ? parseInt(v.Answers[this.visitTaskId]) : ''
} else if (v.ValueType === 3) {
val = v.Answers[this.visitTaskId]
} else {
@ -422,7 +423,7 @@ export default {
if (i.Type === 'number') {
let val = null
if (i.ValueType === 0) {
val = parseInt(i.Answers[this.visitTaskId])
val = i.Answers[this.visitTaskId] ? parseInt(i.Answers[this.visitTaskId]) : ''
} else if (i.ValueType === 3) {
val = i.Answers[this.visitTaskId]
} else {
@ -446,10 +447,12 @@ export default {
})
},
logic(rules, num = 0) {
let isNE = false
try {
if (rules.CalculateQuestionList.length === 0) {
return false
}
let dataArr = []
rules.CalculateQuestionList.forEach((o, i) => {
if (i === 0) {
if (rules.CustomCalculateMark > 4) {
@ -461,6 +464,9 @@ export default {
} else {
num *= parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
break
case 6:
@ -470,6 +476,9 @@ export default {
} else {
num += isNaN(parseFloat(q[o.TableQuestionId])) ? null : parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
break
case 7:
@ -479,6 +488,9 @@ export default {
} else {
num += parseFloat(q[o.TableQuestionId])
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = this.questionForm[o.QuestionId].length === 0 ? 0 : num / this.questionForm[o.QuestionId].length
break
@ -486,6 +498,9 @@ export default {
const arr = []
this.questionForm[o.QuestionId].forEach(q => {
arr.push(q[o.TableQuestionId])
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = arr.length === 0 ? 0 : Math.max(...arr)
break
@ -493,14 +508,32 @@ export default {
const arr1 = []
this.questionForm[o.QuestionId].forEach(q => {
arr1.push(q[o.TableQuestionId])
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
})
num = arr1.length === 0 ? 0 : Math.min(...arr1)
break
case 12:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
num = Math.min(...dataArr);
break;
}
} else {
num = parseFloat(this.questionForm[o.TableQuestionId])
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
}
} else {
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
switch (rules.CustomCalculateMark) {
case 1:
num += parseFloat(this.questionForm[o.TableQuestionId])
@ -515,12 +548,21 @@ export default {
num /= parseFloat(this.questionForm[o.TableQuestionId])
// num /= parseFloat(this.questionForm[o.TableQuestionId])
break
case 12:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
}
num = Math.min(...dataArr);
break;
}
}
})
} catch (e) {
console.log(e)
}
if (isNE) {
return 'NE'
}
if (rules.ValueType === 2) {
num = num * 100
}

View File

@ -160,7 +160,7 @@
<template v-else-if="question.ValueType === 2" slot="append">%</template>
</el-input>
<el-input v-else-if="question.Type === 'number' && question.DataSource === 1"
v-model="questionForm[question.Id]" type="number" :disabled="question.DataSource === 1">
v-model="questionForm[question.Id]" :disabled="question.DataSource === 1">
<template v-if="question.Unit !== 0" slot="append">{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) :
question.CustomUnit }}</template>
<template v-else-if="question.ValueType === 2" slot="append">%</template>
@ -380,6 +380,7 @@ export default {
this.addOrEdit.visible = false;
},
logic(rules, num = 0) {
let isNE = false
try {
if (rules.CalculateQuestionList.length === 0) {
return false;
@ -396,6 +397,9 @@ export default {
} else {
num *= parseFloat(q[o.TableQuestionId]);
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
});
break;
case 6:
@ -405,6 +409,9 @@ export default {
} else {
num += parseFloat(q[o.TableQuestionId]);
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
});
break;
case 7:
@ -414,6 +421,9 @@ export default {
} else {
num += parseFloat(q[o.TableQuestionId]);
}
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
});
num =
this.questionForm[o.QuestionId].length === 0
@ -424,6 +434,9 @@ export default {
var arr = [];
this.questionForm[o.QuestionId].forEach((q) => {
arr.push(q[o.TableQuestionId]);
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
});
num = arr.length === 0 ? 0 : Math.max(...arr);
break;
@ -431,6 +444,9 @@ export default {
var arr = [];
this.questionForm[o.QuestionId].forEach((q) => {
arr.push(q[o.TableQuestionId]);
if (q[o.TableQuestionId] === 'NE') {
isNE = true
}
});
num = arr.length === 0 ? 0 : Math.min(...arr);
console.log("min", this.questionForm[o.QuestionId], arr, num);
@ -438,11 +454,17 @@ export default {
}
} else {
num = parseFloat(this.questionForm[o.TableQuestionId]);
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
if (!isNaN(num)) {
dataArr.push(num)
}
}
} else {
if (this.questionForm[o.TableQuestionId] === 'NE') {
isNE = true
}
switch (rules.CustomCalculateMark) {
case 1:
num += parseFloat(this.questionForm[o.TableQuestionId]);
@ -495,6 +517,9 @@ export default {
} catch (e) {
console.log(e);
}
if (isNE) {
num = 'NE'
}
return num;
},
formItemNumberChange(questionId, isTable) {
@ -538,7 +563,11 @@ export default {
var CalculateQuestions = JSON.parse(v.CalculateQuestions);
var num,
arr = [];
let isNE = false
CalculateQuestions.forEach((o, i) => {
if (this.QuestionsForm[o.TableQuestionId] === 'NE') {
isNE = true
}
if (i === 0) {
num = parseFloat(this.QuestionsForm[o.TableQuestionId]);
arr = [num];
@ -577,6 +606,9 @@ export default {
}
}
});
if (isNE) {
num = 'NE'
}
this.$set(this.QuestionsForm, v.Id, num.toString());
}
});