Merge branch 'uat'
continuous-integration/drone/push Build is passing Details

# Conflicts:
#	src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue
#	src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue
#	src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionList.vue
main
wangxiaoshuang 2025-06-25 10:33:31 +08:00
commit f995b61c04
7 changed files with 415 additions and 715 deletions

View File

@ -237,7 +237,7 @@
@change="(val) => { formItemNumberChange(val, question) }" @change="(val) => { formItemNumberChange(val, question) }"
@input="numberInput(question.Id)" @input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
v-model="questionForm[question.Id]" v-model.trim="questionForm[question.Id]"
:disabled="readingTaskState === 2" :disabled="readingTaskState === 2"
> >
<!-- <template slot="append">1</template> --> <!-- <template slot="append">1</template> -->
@ -250,7 +250,7 @@
v-if="question.Type === 'number' && !question.TypeValue && question.DataSource === 1" v-if="question.Type === 'number' && !question.TypeValue && question.DataSource === 1"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
:disabled="question.DataSource === 1 || readingTaskState === 2" :disabled="question.DataSource === 1 || readingTaskState === 2"
v-model="questionForm[question.Id]" v-model.trim="questionForm[question.Id]"
> >
<!-- <template slot="append">2</template> --> <!-- <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>
@ -531,8 +531,8 @@ export default {
} }
}, },
handleBlur(value, a, b) { handleBlur(value, a, b) {
let reg = new RegExp(/[a-zA-Z]/, 'ig') if (!value) return false
if(!reg.test(value)) { if(!isNaN(parseFloat(value))) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
} }
}, },
@ -1109,8 +1109,6 @@ export default {
flex-direction: row; flex-direction: row;
align-items: flex-start; align-items: flex-start;
} }
::v-deep .el-form-item__content{
}
.el-input{ .el-input{
width:100%; width:100%;
} }

View File

@ -154,7 +154,7 @@
@change="((val)=>{formItemNumberChange(val, question)})" @change="((val)=>{formItemNumberChange(val, question)})"
@input="numberInput(question.Id)" @input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
v-model="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> <template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
</el-input> </el-input>
@ -164,7 +164,7 @@
:disabled="question.DataSource === 1" :disabled="question.DataSource === 1"
@input="numberInput(question.Id, true )" @input="numberInput(question.Id, true )"
@blur="handleCalculationBlur(calculationValue)" @blur="handleCalculationBlur(calculationValue)"
v-model="calculationValue" v-model.trim="calculationValue"
> >
<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>
</el-input> </el-input>
@ -337,7 +337,6 @@ export default {
this.fileList.push({ name: '', url: `${url}` }) this.fileList.push({ name: '', url: `${url}` })
}) })
} }
console.log('11')
} }
if (this.type === 'edit') return if (this.type === 'edit') return
// if (this.question.Type === 'number') { // if (this.question.Type === 'number') {
@ -350,7 +349,7 @@ export default {
methods: { methods: {
numberInput(id,notId = false) { numberInput(id,notId = false) {
if(notId ) { if(notId ) {
// this.calculationValue = this.calculationValue.toUpperCase(); this.calculationValue = this.calculationValue.toUpperCase();
}else { }else {
this.questionForm[id] = this.questionForm[id].toUpperCase(); this.questionForm[id] = this.questionForm[id].toUpperCase();
} }
@ -407,14 +406,17 @@ export default {
} }
}, },
handleBlur(value, a, b) { handleBlur(value, a, b) {
let reg = new RegExp(/[a-zA-Z]/, 'ig') if (!value) return false
if(!reg.test(value)) { if(!isNaN(parseFloat(value))) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
} }
// this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) // this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
}, },
handleCalculationBlur(v) { handleCalculationBlur(v) {
this.calculationValue = parseFloat(v).toFixed(this.digitPlaces) if (!v) return false
if(!isNaN(parseFloat(v))) {
this.calculationValue = parseFloat(v).toFixed(this.digitPlaces)
}
}, },
limitInput(value, q) { limitInput(value, q) {
console.log(value) console.log(value)

View File

@ -137,7 +137,7 @@ export default {
this.classArr.push({triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType}) this.classArr.push({triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType})
} }
if (v.Type === 'number') { if (v.Type === 'number') {
this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces)) this.$set(this.questionForm, v.Id, isNaN(parseFloat(v.Answer)) ? v.Answer : parseFloat(v.Answer).toFixed(this.digitPlaces))
} }
if (v.Childrens.length > 0) { if (v.Childrens.length > 0) {
this.setChild(v.Childrens) this.setChild(v.Childrens)
@ -191,7 +191,7 @@ export default {
this.$set(this.questionForm, v.Id, v.TableQuestions.Answers) this.$set(this.questionForm, v.Id, v.TableQuestions.Answers)
} }
if (v.Type === 'number') { if (v.Type === 'number') {
this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces)) this.$set(this.questionForm, v.Id, isNaN(parseFloat(v.Answer)) ? v.Answer : parseFloat(v.Answer).toFixed(this.digitPlaces))
} }
if (v.Childrens.length > 0) { if (v.Childrens.length > 0) {
this.setChild(v.Childrens) this.setChild(v.Childrens)
@ -212,7 +212,7 @@ export default {
i.TableQuestions.Questions.forEach(o => { i.TableQuestions.Questions.forEach(o => {
if (o.Type === 'number') { if (o.Type === 'number') {
i.TableQuestions.Answers.forEach((ite, index) => { i.TableQuestions.Answers.forEach((ite, index) => {
this.$set(i.TableQuestions.Answers[index], o.Id, i.TableQuestions.Answers[index][o.Id] ? parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces) : null) this.$set(i.TableQuestions.Answers[index], o.Id, isNaN(parseFloat(i.TableQuestions.Answers[index][o.Id])) ? i.TableQuestions.Answers[index][o.Id] : parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces))
}) })
} }
}) })
@ -222,7 +222,7 @@ export default {
this.classArr.push({triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType}) this.classArr.push({triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType})
} }
if (i.Type === 'number') { if (i.Type === 'number') {
this.$set(this.questionForm, i.Id, i.Answer === '' ? '' : parseFloat(i.Answer).toFixed(this.digitPlaces)) this.$set(this.questionForm, i.Id, isNaN(parseFloat(i.Answer)) ? i.Answer : parseFloat(i.Answer).toFixed(this.digitPlaces))
} }
if (i.Childrens && i.Childrens.length > 0) { if (i.Childrens && i.Childrens.length > 0) {
this.setChild(i.Childrens) this.setChild(i.Childrens)

View File

@ -1,109 +1,66 @@
<template> <template>
<div class="criterion-form-item"> <div class="criterion-form-item">
<div <div v-if="!!question.GroupName && question.Type === 'group'"
v-if="!!question.GroupName && question.Type==='group'" style="font-weight: bold;font-size: 16px;margin: 5px 0px;color:#fff;">
style="font-weight: bold;font-size: 16px;margin: 5px 0px;color:#fff;"
>
{{ question.GroupName }} {{ question.GroupName }}
</div> </div>
<div <div v-if="question.Type === 'table' || question.Type === 'basicTable'"
v-if="question.Type==='table' || question.Type==='basicTable'" style="font-weight: bold;font-size: 14px;margin: 5px 0px;">
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"> <div style="display: flex;justify-content: space-between;align-items: center;color:#fff;margin: 10px 0 5px">
<span>{{ question.QuestionName }}</span> <span>{{ 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') }} {{ $t('common:button:add') }}
</el-button> </el-button>
</div> </div>
<el-table <el-table :data="questionForm[question.Id]">
:data="questionForm[question.Id]">
<el-table-column :label="$t('CustomizeQuestionFormItem:label:OrderMark')" width="60px" show-overflow-tooltip> <el-table-column :label="$t('CustomizeQuestionFormItem:label:OrderMark')" width="60px" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
{{question.OrderMark}}{{scope.$index + 1}} {{ question.OrderMark }}{{ scope.$index + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column :prop="item.Id" :label="item.QuestionName" :key="item.Id"
:prop="item.Id" v-for="item of question.TableQuestions.Questions" show-overflow-tooltip :render-header="renderHeader">
:label="item.QuestionName"
:key="item.Id"
v-for="item of question.TableQuestions.Questions"
show-overflow-tooltip
:render-header="renderHeader"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="item.Type === 'upload'"> <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>
<span v-else-if="item.Type === 'number'"> <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>
<span v-else> <span v-else>
{{scope.row[item.Id]}} {{ scope.row[item.Id] }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column :label="$t('common:action:action')" show-overflow-tooltip width="100px"
:label="$t('common:action:action')" v-if="readingTaskState < 2" fixed="right">
show-overflow-tooltip
width="100px"
v-if="readingTaskState < 2"
fixed="right"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="mini" @click="openAddTableCol(question, scope.$index)"> <el-button type="text" size="mini" @click="openAddTableCol(question, scope.$index)">
{{$t('common:button:edit')}} {{ $t('common:button:edit') }}
</el-button> </el-button>
<el-button type="text" size="mini" :disabled="addOrEdit.visible" v-if="scope.row.IsCurrentTaskAdd === 'True' || !question.IsCopyLesions || isBaseline" @click="deleteTableCol(question, scope.$index)"> <el-button type="text" size="mini" :disabled="addOrEdit.visible"
{{$t('common:button:delete')}} v-if="scope.row.IsCurrentTaskAdd === 'True' || !question.IsCopyLesions || isBaseline"
@click="deleteTableCol(question, scope.$index)">
{{ $t('common:button:delete') }}
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog <el-dialog v-if="addOrEdit.visible" v-dialogDrag :title="addOrEdit.title" :visible.sync="addOrEdit.visible"
v-if="addOrEdit.visible" :close-on-click-modal="false" :close-on-press-escape="false" width="400px" :modal="false"
v-dialogDrag :before-close="beforeClose">
:title="addOrEdit.title" <div>
:visible.sync="addOrEdit.visible" <el-form ref="tableQsForm" :model="QuestionsForm" v-loading="loading" size="small">
:close-on-click-modal="false" <QuestionTableFormItem v-for="(item) in QuestionsList" :key="item.Id" :question="item"
:close-on-press-escape="false" :parentQsId="parentQsId" :isBaseline="isBaseline" :reading-task-state="readingTaskState"
width="400px" :question-form="QuestionsForm" :visit-task-id="visitTaskId" :criterion-id="criterionId"
:modal="false" :type="addOrEdit.type" :calculationList="calculationList" :questionsMarkStatus="questionsMarkStatus"
:before-close="beforeClose" @formItemTableNumberChange="formItemTableNumberChange" @resetFormItemData="resetTableFormItemData"
> @setFormItemData="setFormTableItemData" @operateImageMarker="operateImageMarker" @save="save" />
<div> </el-form>
<el-form
ref="tableQsForm"
:model="QuestionsForm"
v-loading="loading"
size="small"
>
<QuestionTableFormItem
v-for="(item) in QuestionsList"
:key="item.Id"
:question="item"
:parentQsId="parentQsId"
:isBaseline="isBaseline"
:reading-task-state="readingTaskState"
:question-form="QuestionsForm"
:visit-task-id="visitTaskId"
:criterion-id="criterionId"
:type="addOrEdit.type"
:calculationList="calculationList"
:questionsMarkStatus="questionsMarkStatus"
@formItemTableNumberChange="formItemTableNumberChange"
@resetFormItemData="resetTableFormItemData"
@setFormItemData="setFormTableItemData"
@operateImageMarker="operateImageMarker"
@save="save"
/>
</el-form>
</div> </div>
<div slot="footer" > <div slot="footer">
<el-button <el-button size="small" @click="handleCancel">
size="small"
@click="handleCancel"
>
{{ $t('common:button:cancel') }} {{ $t('common:button:cancel') }}
</el-button> </el-button>
<!-- 保存 --> <!-- 保存 -->
@ -115,184 +72,97 @@
</div> </div>
<template v-else> <template v-else>
<el-form-item <el-form-item
v-if="(question.ShowQuestion===1 && question.ParentTriggerValueList.includes(questionForm[question.ParentId])) || question.ShowQuestion===0" v-if="(question.ShowQuestion === 1 && question.ParentTriggerValueList.includes(questionForm[question.ParentId])) || question.ShowQuestion === 0"
:label="`${question.QuestionName}`" :label="`${question.QuestionName}`" :prop="question.Id" :rules="[
: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()}, 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'] trigger: ['blur', 'change']
} }
]" ]" :class="[question.Type === 'group' ? 'mb' : question.Type === 'upload' ? 'uploadWrapper' : '']">
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
>
<!-- 输入框 --> <!-- 输入框 -->
<el-input <el-input v-if="question.Type === 'input'" v-model="questionForm[question.Id]"
v-if="question.Type==='input'" :disabled="question.TableQuestionType === 2 || readingTaskState === 2" />
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || readingTaskState === 2"
/>
<!-- 多行文本输入框 --> <!-- 多行文本输入框 -->
<el-input <el-input v-if="question.Type === 'textarea'" v-model="questionForm[question.Id]" type="textarea"
v-if="question.Type==='textarea'" :autosize="{ minRows: 2, maxRows: 4 }" :disabled="readingTaskState === 2" />
v-model="questionForm[question.Id]"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:disabled="readingTaskState === 2"
/>
<!-- 下拉框 --> <!-- 下拉框 -->
<el-select <el-select v-if="question.Type === 'select'" v-model="questionForm[question.Id]" clearable
v-if="question.Type==='select'"
v-model="questionForm[question.Id]"
clearable
:disabled="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && !!question.DictionaryCode || readingTaskState === 2" :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"> <template v-if="question.TableQuestionType === 1">
<el-option <el-option v-for="item in organList" :key="item.Id" :label="item[question.DataTableColumn]"
v-for="item in organList" :value="item[question.DataTableColumn]" />
:key="item.Id"
:label="item[question.DataTableColumn]"
:value="item[question.DataTableColumn]"
/>
</template> </template>
<template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3"> <template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3">
<el-option <el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
v-for="item of $d[question.DictionaryCode]" :label="item.label" />
:key="item.id"
:value="item.value"
:label="item.label"
/>
</template> </template>
<template v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode"> <template
<el-option v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
v-for="item of $d[question.DictionaryCode]" <el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
:key="item.id" :label="item.label" />
:value="item.value"
:label="item.label"
/>
</template> </template>
<template v-else> <template v-else>
<el-option <el-option v-for="val in question.TypeValue.split('|')" :key="val.trim()" :label="val.trim()"
v-for="val in question.TypeValue.split('|')" :value="val.trim()" />
:key="val.trim()"
:label="val.trim()"
:value="val.trim()"
/>
</template> </template>
</el-select> </el-select>
<!-- 单选 --> <!-- 单选 -->
<el-radio-group <el-radio-group v-if="question.Type === 'radio'" v-model="questionForm[question.Id]"
v-if="question.Type==='radio'" @change="((val) => { formItemChange(val, question) })" :disabled="readingTaskState === 2">
v-model="questionForm[question.Id]" <el-radio v-for="val in question.TypeValue.split('|')" :key="val.trim()" :label="val.trim()">
@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() }} {{ val.trim() }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
<!-- 复选框 --> <!-- 复选框 -->
<el-checkbox-group <el-checkbox-group v-if="question.Type === 'checkbox'" v-model="questionForm[question.Id]"
v-if="question.Type==='checkbox'" :disabled="readingTaskState === 2">
v-model="questionForm[question.Id]" <el-checkbox v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()">
:disabled="readingTaskState === 2"
>
<el-checkbox
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val.trim()"
>
{{ val.trim() }} {{ val.trim() }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<!-- 自动分类 --> <!-- 自动分类 -->
<el-input <el-input v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-if="question.Type === 'class' && question.ClassifyShowType === 1" v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType || readingTaskState === 2" />
v-model="questionForm[question.Id]" <el-select v-if="question.Type === 'class' && question.ClassifyShowType === 2"
:disabled="!question.ClassifyEditType || readingTaskState === 2" v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType || readingTaskState === 2"
/> @change="(val) => { formItemChange(val, question) }">
<el-select <el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()" :value="val.trim()" />
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-select>
<el-radio-group <el-radio-group v-if="question.Type === 'class' && question.ClassifyShowType === 3"
v-if="question.Type === 'class' && question.ClassifyShowType === 3" v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType || readingTaskState === 2"
v-model="questionForm[question.Id]" @change="(val) => { formItemChange(val, question) }">
:disabled="!question.ClassifyEditType || readingTaskState === 2" <el-radio v-for="item of question.TypeValue.split('|')" :key="item.trim()" :label="item.trim()">
@change="(val) => { formItemChange(val, question) }"
>
<el-radio
v-for="item of question.TypeValue.split('|')"
:key="item.trim()"
:label="item.trim()"
>
{{ item.trim() }} {{ item.trim() }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
<el-input <el-input v-if="question.Type === 'class' && question.ClassifyShowType === 4" type="number"
v-if="question.Type === 'class' && question.ClassifyShowType === 4" :disabled="!question.ClassifyEditType || readingTaskState === 2" v-model="questionForm[question.Id]"
type="number" @change="(val) => { formItemNumberChange(val, question) }" />
:disabled="!question.ClassifyEditType || readingTaskState === 2"
v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }"
/>
<!-- 自动计算 --> <!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
<el-input <el-input v-if="question.Type === 'calculation'" v-model="questionForm[question.Id]"
v-if="question.Type==='calculation'" @input="value = value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')" disabled />
v-model="questionForm[question.Id]"
@input="value=value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')"
disabled
/>
<!-- 自增 --> <!-- 自增 -->
<el-input <el-input v-if="question.Type === 'increment'" v-model="questionForm[question.Id]" disabled />
v-if="question.Type==='increment'"
v-model="questionForm[question.Id]"
disabled
/>
<!-- 数值 --> <!-- 数值 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
<el-select <el-select v-if="question.Type === 'number' && question.TypeValue" v-model="questionForm[question.Id]" clearable
v-if="question.Type === 'number' && question.TypeValue" @change="(val) => { formItemNumberChange(val, question) }" :disabled="readingTaskState === 2">
v-model="questionForm[question.Id]" <el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()" :value="val.trim()" />
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-select>
<template v-if="question.Type === 'number' && (question.ImageMarkEnum === 1 || question.ImageMarkEnum === 2)"> <template v-if="question.Type === 'number' && (question.ImageMarkEnum === 1 || question.ImageMarkEnum === 2)">
<div style="display: flex;flex-direction: row;justify-content: flex-start;align-items: center;"> <div style="display: flex;flex-direction: row;justify-content: flex-start;align-items: center;">
<el-input <el-input type="number" @change="(val) => { formItemNumberChange(val, question) }"
type="number" @blur="questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked ? () => { } : handleMarkedQsBlur(questionForm[question.Id], questionForm, question.Id, question)"
@change="(val) => { formItemNumberChange(val, question) }"
@blur="questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked ? ()=>{} : handleMarkedQsBlur(questionForm[question.Id], questionForm, question.Id, question) "
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="(questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked && question.ImageMarkEnum === 2) || question.ImageMarkEnum === 1" :disabled="(questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked && question.ImageMarkEnum === 2) || question.ImageMarkEnum === 1"
style="width: 150px;" style="width: 150px;">
>
<template v-if="question.Unit !== 0" slot="append"> <template v-if="question.Unit !== 0" slot="append">
{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit }} {{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit }}
</template> </template>
@ -300,56 +170,38 @@
<!-- 测量 --> <!-- 测量 -->
<el-button <el-button
v-if="readingTaskState < 2 && (!questionsMarkStatus[question.Id] || (questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isMarked))" v-if="readingTaskState < 2 && (!questionsMarkStatus[question.Id] || (questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isMarked))"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 1, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 1, question})"
>
测量 测量
</el-button> </el-button>
<!-- 绑定 --> <!-- 绑定 -->
<el-button <el-button
v-if="readingTaskState < 2 && (!questionsMarkStatus[question.Id] || (questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isMarked))" v-if="readingTaskState < 2 && (!questionsMarkStatus[question.Id] || (questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isMarked))"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 0, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 0, question})"
>
绑定 绑定
</el-button> </el-button>
<!-- 查看 --> <!-- 查看 -->
<el-button <el-button v-if="questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked" size="mini"
v-if="questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked" type="text" @click="operateImageMarker({ operateStateEnum: 2, question })">
size="mini"
type="text"
@click="operateImageMarker({operateStateEnum: 2, question})"
>
查看 查看
</el-button> </el-button>
<!-- 更改 --> <!-- 更改 -->
<el-button <el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked)" v-if="readingTaskState < 2 && (questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked)"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 3, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 3, question})"
>
更改 更改
</el-button> </el-button>
<!-- 移除 --> <!-- 移除 -->
<el-button <el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked)" v-if="readingTaskState < 2 && (questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked)"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 4, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 4, question})"
>
移除 移除
</el-button> </el-button>
<!-- 保存 --> <!-- 保存 -->
<el-button <el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isSaved)" v-if="readingTaskState < 2 && (questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isSaved)"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 5, question })">
type="text" <el-tooltip v-if="questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isSaved"
@click="operateImageMarker({operateStateEnum: 5, question})" class="item" effect="dark" :content="$t('trials:reading:button:unsaved')" placement="bottom">
>
<el-tooltip v-if="questionsMarkStatus[question.Id] && !questionsMarkStatus[question.Id].isSaved" class="item" effect="dark" :content="$t('trials:reading:button:unsaved')" placement="bottom">
<i class="el-icon-warning" style="color:red" /> <i class="el-icon-warning" style="color:red" />
</el-tooltip> </el-tooltip>
保存 保存
@ -357,87 +209,51 @@
</div> </div>
</template> </template>
<template v-else-if="question.Type === 'number'"> <template v-else-if="question.Type === 'number'">
<el-input <el-input type="text" v-if="question.Type === 'number' && !question.TypeValue && question.DataSource !== 1"
type="text" @change="(val) => { formItemNumberChange(val, question) }" @input="numberInput(question.Id)"
v-if="question.Type === 'number' && !question.TypeValue && question.DataSource !== 1" @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" v-model="questionForm[question.Id]"
@change="(val) => { formItemNumberChange(val, question) }" :disabled="readingTaskState === 2">
@input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
v-model="questionForm[question.Id]"
:disabled="readingTaskState === 2"
>
<!-- <template slot="append">1</template> --> <!-- <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> <template slot="append" v-else-if="question.ValueType === 2">%</template>
</el-input> </el-input>
<el-input <el-input type="text" @input="numberInput(question.Id)"
type="text"
@input="numberInput(question.Id)"
v-if="question.Type === 'number' && !question.TypeValue && question.DataSource === 1" v-if="question.Type === 'number' && !question.TypeValue && question.DataSource === 1"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
:disabled="question.DataSource === 1 || readingTaskState === 2" :disabled="question.DataSource === 1 || readingTaskState === 2" v-model="questionForm[question.Id]">
v-model="questionForm[question.Id]"
>
<!-- <template slot="append">2</template> --> <!-- <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> <template slot="append" v-else-if="question.ValueType === 2">%</template>
</el-input> </el-input>
</template> </template>
<!-- 上传图像 --> <!-- 上传图像 -->
<el-upload <el-upload v-if="question.Type === 'upload'" :disabled="readingTaskState === 2" action :accept="question.FileType"
v-if="question.Type==='upload'" :limit="question.ImageCount === 0 ? 100 : question.ImageCount" :on-preview="handlePictureCardPreview"
:disabled="readingTaskState === 2" :before-upload="(file) => { return handleBeforeUpload(file, question.FileType) }"
action :http-request="uploadScreenshot" :on-remove="handleRemove" :file-list="fileList"
:accept="question.FileType" :class="{ disabled: question.ImageCount === 0 ? false : fileList.length >= question.ImageCount }">
: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}"
>
<el-button slot="default" class="el-icon-plus" v-if="readingTaskState < 2"> <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-button>
</el-upload> </el-upload>
<viewer <viewer v-if="question.Type === 'upload' && imgVisible" :ref="imageUrl" style="margin:0 10px;"
v-if="question.Type==='upload' && imgVisible" :images="[imageUrl]">
:ref="imageUrl" <img v-show="false" crossorigin="anonymous" :src="imageUrl" alt="Image">
style="margin:0 10px;"
:images="[imageUrl]"
>
<img
v-show="false"
crossorigin="anonymous"
:src="imageUrl"
alt="Image"
>
</viewer> </viewer>
</el-form-item> </el-form-item>
</template> </template>
<template v-if="question.Childrens && question.Childrens.length>0 && question.Type !== 'table' && question.Type !== 'basicTable'"> <template
<QuestionFormItem v-if="question.Childrens && question.Childrens.length > 0 && question.Type !== 'table' && question.Type !== 'basicTable'">
v-for="(item) in question.Childrens" <QuestionFormItem v-for="(item) in question.Childrens" :key="item.Id" :question="item" :isBaseline="isBaseline"
:key="item.Id" :reading-task-state="readingTaskState" :question-form="questionForm" :visit-task-id="visitTaskId"
:question="item" :criterion-id="criterionId" :calculationList="calculationList" :questionMarkInfoList="questionMarkInfoList"
:isBaseline="isBaseline" :questionsMarkStatus="questionsMarkStatus" @formItemNumberChange="formItemNumberChange"
:reading-task-state="readingTaskState" @setFormItemData="setFormItemData" @resetFormItemData="resetFormItemData" @getQuestions="getQuestions"
:question-form="questionForm" @operateImageMarker="operateImageMarker" @unBindAnnotationToQuestion="unBindAnnotationToQuestion" />
:visit-task-id="visitTaskId"
:criterion-id="criterionId"
:calculationList="calculationList"
:questionMarkInfoList="questionMarkInfoList"
:questionsMarkStatus="questionsMarkStatus"
@formItemNumberChange="formItemNumberChange"
@setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData"
@getQuestions="getQuestions"
@operateImageMarker="operateImageMarker"
@unBindAnnotationToQuestion="unBindAnnotationToQuestion"
/>
</template> </template>
<!-- <base-model :config="addOrEdit" <!-- <base-model :config="addOrEdit"
@ -451,23 +267,10 @@
</base-model> --> </base-model> -->
<!-- 预览文件 --> <!-- 预览文件 -->
<el-dialog <el-dialog v-if="previewVisible" :visible.sync="previewVisible" :title="$t('common:button:preview')"
v-if="previewVisible" :fullscreen="true" append-to-body custom-class="base-dialog-wrapper">
:visible.sync="previewVisible" <div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
:title="$t('common:button:preview')" <PreviewFile v-if="previewVisible" :file-path="currentPath" :file-type="currentType" />
: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> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -586,7 +389,7 @@ export default {
immediate: true, immediate: true,
handler(v) { handler(v) {
let i = v.findIndex(i=>i.QuestionId === this.question.Id) let i = v.findIndex(i => i.QuestionId === this.question.Id)
if (i === -1) return if (i === -1) return
// const { parentQsId, rowId } = v // const { parentQsId, rowId } = v
@ -602,7 +405,7 @@ export default {
if (!parentQsId && !rowId) return if (!parentQsId && !rowId) return
let arr = this.questionForm[parentQsId] let arr = this.questionForm[parentQsId]
if (!arr || !Array.isArray(arr)) return if (!arr || !Array.isArray(arr)) return
let i = arr.findIndex(i=>i.RowId === rowId) let i = arr.findIndex(i => i.RowId === rowId)
if (i === -1) return if (i === -1) return
this.openAddTableCol(this.question, i) this.openAddTableCol(this.question, i)
} }
@ -659,15 +462,15 @@ export default {
}, },
validatorNumberInput(rule, value, callback) { validatorNumberInput(rule, value, callback) {
let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g') let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
if (value === '') { if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify'))); callback(new Error(this.$t('common:ruleMessage:specify')));
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
} else { } else {
if (!reg.test(value)) { callback();
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
}else{
callback();
}
} }
}
}, },
limitInput(value, a, b) { limitInput(value, a, b) {
if (value.indexOf('.') > -1) { if (value.indexOf('.') > -1) {
@ -677,15 +480,14 @@ export default {
} }
}, },
handleBlur(value, a, b) { handleBlur(value, a, b) {
let reg = new RegExp(/[a-zA-Z]/, 'ig') if (!value) return false
if(!reg.test(value)) { if (!isNaN(parseFloat(value))) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
} }
// this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
}, },
handleMarkedQsBlur(value, a, b, question) { handleMarkedQsBlur(value, a, b, question) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
this.$emit('operateImageMarker', {operateStateEnum: 6, question}) this.$emit('operateImageMarker', { operateStateEnum: 6, question })
}, },
async deleteTableCol(row, index) { async deleteTableCol(row, index) {
let loading = null let loading = null
@ -716,7 +518,7 @@ export default {
this.$emit('getQuestions') this.$emit('getQuestions')
} }
loading.close() loading.close()
} catch(e) { } catch (e) {
loading ? loading.close() : '' loading ? loading.close() : ''
console.log(e) console.log(e)
} }
@ -724,7 +526,7 @@ export default {
}, },
setFormTableItemData(obj) { setFormTableItemData(obj) {
this.$set(this.QuestionsForm, obj.key, obj.val) this.$set(this.QuestionsForm, obj.key, obj.val)
this.classArr.map(i=>{ this.classArr.map(i => {
if (i.triggerId === obj.key) { if (i.triggerId === obj.key) {
let answer = null let answer = null
let list = JSON.parse(i.classifyAlgorithms) let list = JSON.parse(i.classifyAlgorithms)
@ -782,7 +584,7 @@ export default {
if (!valid) return if (!valid) return
// //
let isExistUnSaved = false let isExistUnSaved = false
for(let i = 0; i < this.markTableQuestions.length; i++) { for (let i = 0; i < this.markTableQuestions.length; i++) {
let keyId = this.QuestionsForm.RowId ? `${this.QuestionsForm.RowId}_${this.markTableQuestions[i]}` : this.markTableQuestions[i] let keyId = this.QuestionsForm.RowId ? `${this.QuestionsForm.RowId}_${this.markTableQuestions[i]}` : this.markTableQuestions[i]
if (this.questionsMarkStatus[keyId] && !this.questionsMarkStatus[keyId].isSaved) { if (this.questionsMarkStatus[keyId] && !this.questionsMarkStatus[keyId].isSaved) {
isExistUnSaved = true isExistUnSaved = true
@ -865,7 +667,7 @@ export default {
var index = this.AnswersList.findIndex(v => v.RowId === this.QuestionsForm.RowId) var index = this.AnswersList.findIndex(v => v.RowId === this.QuestionsForm.RowId)
this.AnswersList.splice(index, 1, this.QuestionsForm) this.AnswersList.splice(index, 1, this.QuestionsForm)
} }
this.$emit('setFormItemData', {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.formItemNumberChange(this.question.Id, true)
this.addOrEdit.visible = false this.addOrEdit.visible = false
}) })
@ -873,7 +675,7 @@ export default {
async handleCancel() { async handleCancel() {
// //
let isExistUnSaved = false let isExistUnSaved = false
for(let i = 0; i < this.markTableQuestions.length; i++) { for (let i = 0; i < this.markTableQuestions.length; i++) {
let keyId = this.QuestionsForm.RowId ? `${this.QuestionsForm.RowId}_${this.markTableQuestions[i]}` : this.markTableQuestions[i] let keyId = this.QuestionsForm.RowId ? `${this.QuestionsForm.RowId}_${this.markTableQuestions[i]}` : this.markTableQuestions[i]
if (this.questionsMarkStatus[keyId] && !this.questionsMarkStatus[keyId].isSaved) { if (this.questionsMarkStatus[keyId] && !this.questionsMarkStatus[keyId].isSaved) {
isExistUnSaved = true isExistUnSaved = true
@ -982,8 +784,8 @@ export default {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
} }
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => { num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0); return acc + (typeof curr === "number" ? curr : 0);
}, 0) / dataArr.length; }, 0) / dataArr.length;
break; break;
case 11: case 11:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
@ -998,7 +800,7 @@ export default {
num = Math.min(...dataArr); num = Math.min(...dataArr);
break; break;
case 13: case 13:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(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 num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => acc && curr) ? 1 : 0
@ -1089,8 +891,8 @@ export default {
arr.length === 0 arr.length === 0
? 0 ? 0
: arr.reduce((acc, curr) => { : arr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0); return acc + (typeof curr === "number" ? curr : 0);
}, 0) / arr.length; }, 0) / arr.length;
break; break;
case 8: case 8:
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId])); arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]));
@ -1115,9 +917,9 @@ export default {
this.addOrEdit.title = row.QuestionName + this.$t('trials:readingUnit:qsList:title:tableQs') this.addOrEdit.title = row.QuestionName + this.$t('trials:readingUnit:qsList:title:tableQs')
this.QuestionsList = row.TableQuestions.Questions this.QuestionsList = row.TableQuestions.Questions
this.markTableQuestions = [] this.markTableQuestions = []
row.TableQuestions.Questions.map(v=>{ row.TableQuestions.Questions.map(v => {
if (v.Type === 'class') { 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 })
} }
if (v.ImageMarkEnum === 1 || v.ImageMarkEnum == 2) { if (v.ImageMarkEnum === 1 || v.ImageMarkEnum == 2) {
this.markTableQuestions.push(v.Id) this.markTableQuestions.push(v.Id)
@ -1214,18 +1016,18 @@ export default {
this.QuestionsForm.RowId = res.Result.RowId this.QuestionsForm.RowId = res.Result.RowId
obj.rowId = res.Result.RowId obj.rowId = res.Result.RowId
this.AnswersList.push(this.QuestionsForm) this.AnswersList.push(this.QuestionsForm)
this.$emit('setFormItemData', {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.formItemNumberChange(this.question.Id, true)
} }
loading.close() loading.close()
} catch(e) { } catch (e) {
console.log(e) console.log(e)
loading.close() loading.close()
} }
} else { } else {
let i = this.AnswersList.findIndex(i=>i.RowId === this.QuestionsForm.RowId) let i = this.AnswersList.findIndex(i => i.RowId === this.QuestionsForm.RowId)
this.AnswersList[i][obj.question.Id] = this.QuestionsForm[obj.question.Id] this.AnswersList[i][obj.question.Id] = this.QuestionsForm[obj.question.Id]
this.$emit('setFormItemData', {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.formItemNumberChange(this.question.Id, true)
} }
@ -1259,18 +1061,18 @@ export default {
const cacheKey = `imageId:${referencedImageId}` const cacheKey = `imageId:${referencedImageId}`
const cachedStats = annotation.data?.cachedStats?.[cacheKey] const cachedStats = annotation.data?.cachedStats?.[cacheKey]
const hasProp = cachedStats const hasProp = cachedStats
&& Object.prototype.hasOwnProperty.call(cachedStats, prop) && Object.prototype.hasOwnProperty.call(cachedStats, prop)
if (!hasProp) return null if (!hasProp) return null
const value = cachedStats[prop] const value = cachedStats[prop]
return value !== null return value !== null
? parseFloat(value).toFixed(this.digitPlaces) ? parseFloat(value).toFixed(this.digitPlaces)
: value : value
}, },
async beforeClose(done) { async beforeClose(done) {
try { try {
// //
let isExistUnSaved = false let isExistUnSaved = false
for(let i = 0; i < this.markTableQuestions.length; i++) { for (let i = 0; i < this.markTableQuestions.length; i++) {
let keyId = this.QuestionsForm.RowId ? `${this.QuestionsForm.RowId}_${this.markTableQuestions[i]}` : this.markTableQuestions[i] let keyId = this.QuestionsForm.RowId ? `${this.QuestionsForm.RowId}_${this.markTableQuestions[i]}` : this.markTableQuestions[i]
if (this.questionsMarkStatus[keyId] && !this.questionsMarkStatus[keyId].isSaved) { if (this.questionsMarkStatus[keyId] && !this.questionsMarkStatus[keyId].isSaved) {
isExistUnSaved = true isExistUnSaved = true
@ -1349,17 +1151,17 @@ export default {
}, },
// //
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
var suffix = file.url.substring(file.url.lastIndexOf(".")+1) var suffix = file.url.substring(file.url.lastIndexOf(".") + 1)
suffix = suffix ? suffix.toLowerCase() : '' 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') // window.open(this.OSSclientConfig.basePath + file.url,'_blank')
this.currentPath = file.url this.currentPath = file.url
this.currentType = suffix this.currentType = suffix
this.previewVisible = true this.previewVisible = true
}else{ } else {
this.imageUrl = this.OSSclientConfig.basePath + file.url this.imageUrl = this.OSSclientConfig.basePath + file.url
this.imgVisible = true this.imgVisible = true
this.$nextTick(()=>{ this.$nextTick(() => {
this.$refs[this.imageUrl].$viewer.show() this.$refs[this.imageUrl].$viewer.show()
}) })
} }
@ -1369,8 +1171,8 @@ export default {
if (file && file.status === "success") { if (file && file.status === "success") {
this.imageUrl = '' this.imageUrl = ''
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1) this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
this.fileList.forEach((i,index)=>{ this.fileList.forEach((i, index) => {
i.name = `${this.$t('trials:emailManageCfg:title:fileName')}${index+ 1}` i.name = `${this.$t('trials:emailManageCfg:title:fileName')}${index + 1}`
}) })
this.urls.splice(this.fileList.findIndex(f => f === 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 })
@ -1382,79 +1184,95 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.criterion-form-item { .criterion-form-item {
// 穿
::v-deep .el-dialog{
pointer-events:auto;
margin-right: 15px !important;
margin-top: 30vh !important;
}
::v-deep .el-dialog__wrapper{
pointer-events:none;
}
// .custom-dialog .el-dialog__wrapper {
// pointer-events:none;
// }
::v-deep .el-form-item__label{ // 穿
color: #c3c3c3; ::v-deep .el-dialog {
pointer-events: auto;
margin-right: 15px !important;
margin-top: 30vh !important;
}
::v-deep .el-dialog__wrapper {
pointer-events: none;
}
// .custom-dialog .el-dialog__wrapper {
// pointer-events:none;
// }
::v-deep .el-form-item__label {
color: #c3c3c3;
}
::v-deep .el-radio__label {
color: #c3c3c3;
}
::v-deep .el-input-group__append {
background: #000;
color: #ddd;
border: 1px solid #5e5e5e;
}
::v-deep .el-input .el-input__inner {
background-color: transparent;
color: #ddd;
border: 1px solid #5e5e5e;
}
} }
::v-deep .el-radio__label{
color: #c3c3c3; .criterion-form-item {
} ::v-deep .criterion-form-item .el-form-item {
::v-deep .el-input-group__append{
background: #000;
color: #ddd;
border: 1px solid #5e5e5e;
}
::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{
display: block; display: block;
.el-form-item__label{
.el-form-item__label {
display: block; display: block;
color: #c8c8c8; color: #c8c8c8;
float: none; float: none;
text-align: left; text-align: left;
} }
} }
.el-form-item{
.el-form-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: flex-start; align-items: flex-start;
} }
.el-input{
width:100%; .el-input {
width: 100%;
} }
.mb{
.mb {
margin-bottom: 0px; margin-bottom: 0px;
} }
.disabled{
.disabled {
::v-deep .el-upload--picture-card { ::v-deep .el-upload--picture-card {
display: none; display: none;
} }
} }
.uploadWrapper{
.uploadWrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-start; 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; display: none;
} }
::v-deep .el-upload-list__item-name{
::v-deep .el-upload-list__item-name {
color: #0a84ff; color: #0a84ff;
.el-icon-document{
.el-icon-document {
color: #0a84ff; color: #0a84ff;
} }
} }
} }
</style> </style>

View File

@ -165,7 +165,7 @@ export default {
this.classArr.push({ triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType }) this.classArr.push({ triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType })
} }
if (v.Type === 'number') { if (v.Type === 'number') {
this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces)) this.$set(this.questionForm, v.Id, isNaN(parseFloat(v.Answer)) ? v.Answer : parseFloat(v.Answer).toFixed(this.digitPlaces))
if (v.ImageToolAttribute) { if (v.ImageToolAttribute) {
this.$set(this.questionImageToolAttributeInfo, v.Id, v.ImageToolAttribute) this.$set(this.questionImageToolAttributeInfo, v.Id, v.ImageToolAttribute)
} }
@ -206,7 +206,7 @@ export default {
i.TableQuestions.Questions.forEach(o => { i.TableQuestions.Questions.forEach(o => {
if (o.Type === 'number') { if (o.Type === 'number') {
i.TableQuestions.Answers.forEach((ite, index) => { i.TableQuestions.Answers.forEach((ite, index) => {
this.$set(i.TableQuestions.Answers[index], o.Id, i.TableQuestions.Answers[index][o.Id] ? parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces) : null) this.$set(i.TableQuestions.Answers[index], o.Id, isNaN(parseFloat(i.TableQuestions.Answers[index][o.Id])) ? i.TableQuestions.Answers[index][o.Id] : parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces))
}) })
} }
}) })
@ -216,7 +216,7 @@ export default {
this.classArr.push({ triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType }) this.classArr.push({ triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType })
} }
if (i.Type === 'number') { if (i.Type === 'number') {
this.$set(this.questionForm, i.Id, i.Answer === '' ? '' : parseFloat(i.Answer).toFixed(this.digitPlaces)) this.$set(this.questionForm, i.Id, isNaN(parseFloat(i.Answer)) ? i.Answer : parseFloat(i.Answer).toFixed(this.digitPlaces))
if (i.ImageToolAttribute) { if (i.ImageToolAttribute) {
this.$set(this.questionImageToolAttributeInfo, i.Id, i.ImageToolAttribute) this.$set(this.questionImageToolAttributeInfo, i.Id, i.ImageToolAttribute)
} }

View File

@ -1,161 +1,90 @@
<template> <template>
<div class="criterion-table-form-item"> <div class="criterion-table-form-item">
<el-form-item <el-form-item
v-if="(question.ShowQuestion===1 && !!~question.ParentTriggerValueList.indexOf(questionForm[question.ParentId])) || question.ShowQuestion===0" v-if="(question.ShowQuestion === 1 && !!~question.ParentTriggerValueList.indexOf(questionForm[question.ParentId])) || question.ShowQuestion === 0"
:label="`${question.QuestionName}`" :label="`${question.QuestionName}`" :prop="question.Id" :rules="[
:prop="question.Id"
: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()}, 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'] trigger: ['blur', 'change']
} }
]" ]" :class="[question.Type === 'group' ? 'mb' : question.Type === 'upload' ? 'uploadWrapper' : '']">
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
>
<!-- 输入框 --> <!-- 输入框 -->
<el-input <el-input v-if="question.Type === 'input'" v-model="questionForm[question.Id]"
v-if="question.Type==='input'" :disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')" />
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
/>
<!-- 多行文本输入框 --> <!-- 多行文本输入框 -->
<el-input <el-input v-if="question.Type === 'textarea'" v-model="questionForm[question.Id]" type="textarea"
v-if="question.Type==='textarea'"
v-model="questionForm[question.Id]"
type="textarea"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')" :disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }" />
/>
<!-- 下拉框 --> <!-- 下拉框 -->
<el-select <el-select v-if="question.Type === 'select'" v-model="questionForm[question.Id]" clearable
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')" :disabled="(question.TableQuestionType === 2 || question.QuestionGenre === 2) || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemChange(val, question)})" @change="((val) => { formItemChange(val, question) })">
>
<template v-if="question.TableQuestionType === 1"> <template v-if="question.TableQuestionType === 1">
<el-option <el-option v-for="item in organList" :key="item.Id" :label="item[question.DataTableColumn]"
v-for="item in organList" :value="item[question.DataTableColumn]" />
:key="item.Id"
:label="item[question.DataTableColumn]"
:value="item[question.DataTableColumn]"
/>
</template> </template>
<template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3"> <template v-else-if="question.TableQuestionType === 3 || question.QuestionGenre === 3">
<el-option <el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
v-for="item of $d[question.DictionaryCode]" :label="item.label" />
:key="item.id"
:value="item.value"
:label="item.label"
/>
</template> </template>
<template v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode"> <template
<el-option v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
v-for="item of $d[question.DictionaryCode]" <el-option v-for="item of $d[question.DictionaryCode]" :key="item.id" :value="item.value"
:key="item.id" :label="item.label" />
:value="item.value"
:label="item.label"
/>
</template> </template>
<template v-else> <template v-else>
<el-option <el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val" :value="val" />
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
:value="val"
/>
</template> </template>
</el-select> </el-select>
<!-- 单选 --> <!-- 单选 -->
<el-radio-group <el-radio-group v-if="question.Type === 'radio'" v-model="questionForm[question.Id]"
v-if="question.Type==='radio'"
v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')" :disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemChange(val, question)})" @change="((val) => { formItemChange(val, question) })">
> <el-radio v-for="val in question.TypeValue.split('|')" :key="val" :label="val">
<el-radio
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
>
{{ val }} {{ val }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
<!-- 复选框 --> <!-- 复选框 -->
<el-checkbox-group <el-checkbox-group v-if="question.Type === 'checkbox'"
v-if="question.Type==='checkbox'"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')" :disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]">
> <el-checkbox v-for="val in question.TypeValue.split('|')" :key="val" :label="val">
<el-checkbox
v-for="val in question.TypeValue.split('|')"
:key="val"
:label="val"
>
{{ val }} {{ val }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<!-- 自动分类 --> <!-- 自动分类 -->
<el-input <el-input v-if="question.Type === 'class' && question.ClassifyShowType === 1"
v-if="question.Type === 'class' && question.ClassifyShowType === 1" v-model="questionForm[question.Id]" />
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-select <el-option v-for="val in question.TypeValue.split('|')" :key="val" :label="val.trim()" :value="val.trim()" />
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-select>
<el-radio-group <el-radio-group v-if="question.Type === 'class' && question.ClassifyShowType === 3"
v-if="question.Type === 'class' && question.ClassifyShowType === 3" v-model="questionForm[question.Id]" :disabled="!question.ClassifyEditType"
v-model="questionForm[question.Id]" @change="(val) => { formItemChange(val, question) }">
:disabled="!question.ClassifyEditType" <el-radio v-for="item of question.TypeValue.split('|')" :key="item.trim()" :label="item.trim()">
@change="(val) => { formItemChange(val, question) }"
>
<el-radio
v-for="item of question.TypeValue.split('|')"
:key="item.trim()"
:label="item.trim()"
>
{{ item.trim() }} {{ item.trim() }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
<!-- 自动计算 --> <!-- 自动计算 -->
<!-- :precision="2" :step="0.1" :max="10" --> <!-- :precision="2" :step="0.1" :max="10" -->
<el-input <el-input v-if="question.Type === 'calculation'" v-model="questionForm[question.Id]"
v-if="question.Type==='calculation'" oninput="value=value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')" disabled />
v-model="questionForm[question.Id]"
oninput="value=value.replace(/^\D*(\d*(?:.\d{0,2})?).*$/g, '$1')"
disabled
/>
<!-- 自增 --> <!-- 自增 -->
<el-input <el-input v-if="question.Type === 'increment'" v-model="questionForm[question.Id]" disabled />
v-if="question.Type==='increment'"
v-model="questionForm[question.Id]"
disabled
/>
<!-- 数值 --> <!-- 数值 -->
<template v-if="question.Type === 'number' && (question.ImageMarkEnum === 1 || question.ImageMarkEnum === 2)"> <template v-if="question.Type === 'number' && (question.ImageMarkEnum === 1 || question.ImageMarkEnum === 2)">
<div style="display: flex;flex-direction: row;justify-content: flex-start;align-items: center;"> <div style="display: flex;flex-direction: row;justify-content: flex-start;align-items: center;">
<el-input <el-input type="number" @change="(val) => { formItemNumberChange(val, question) }"
type="number" @blur="questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked ? () => { } : handleMarkedQsBlur(questionForm[question.Id], questionForm, question.Id, question)"
@change="(val) => { formItemNumberChange(val, question) }"
@blur="questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked ? ()=>{} : handleMarkedQsBlur(questionForm[question.Id], questionForm, question.Id, question) "
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="(questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked && question.ImageMarkEnum === 2) || question.ImageMarkEnum === 1" :disabled="(questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked && question.ImageMarkEnum === 2) || question.ImageMarkEnum === 1"
style="width: 150px;" style="width: 150px;">
>
<template v-if="question.Unit !== 0" slot="append"> <template v-if="question.Unit !== 0" slot="append">
{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit }} {{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit }}
</template> </template>
@ -163,56 +92,40 @@
<!-- 测量 --> <!-- 测量 -->
<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))" 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" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 1, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 1, question})"
>
测量 测量
</el-button> </el-button>
<!-- 绑定 --> <!-- 绑定 -->
<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))" 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" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 0, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 0, question})"
>
绑定 绑定
</el-button> </el-button>
<!-- 查看 --> <!-- 查看 -->
<el-button <el-button
v-if="questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked" v-if="questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 2, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 2, question})"
>
查看 查看
</el-button> </el-button>
<!-- 更改 --> <!-- 更改 -->
<el-button <el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked)" v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked)"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 3, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 3, question})"
>
更改 更改
</el-button> </el-button>
<!-- 移除 --> <!-- 移除 -->
<el-button <el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked)" v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isMarked)"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 4, question })">
type="text"
@click="operateImageMarker({operateStateEnum: 4, question})"
>
移除 移除
</el-button> </el-button>
<!-- 保存 --> <!-- 保存 -->
<el-button <el-button
v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && !questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isSaved)" v-if="readingTaskState < 2 && (questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && !questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isSaved)"
size="mini" size="mini" type="text" @click="operateImageMarker({ operateStateEnum: 7, question })">
type="text" <el-tooltip
@click="operateImageMarker({operateStateEnum: 7, question})" v-if="questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && !questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isSaved"
> class="item" effect="dark" :content="$t('trials:reading:button:unsaved')" placement="bottom">
<el-tooltip v-if="questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id] && !questionsMarkStatus[rowId ? `${rowId}_${question.Id}` : question.Id].isSaved" class="item" effect="dark" :content="$t('trials:reading:button:unsaved')" placement="bottom">
<i class="el-icon-warning" style="color:red" /> <i class="el-icon-warning" style="color:red" />
</el-tooltip> </el-tooltip>
保存 保存
@ -220,90 +133,53 @@
</div> </div>
</template> </template>
<template v-else-if="question.Type === 'number'"> <template v-else-if="question.Type === 'number'">
<el-input <el-input type="text" v-if="question.Type === 'number' && question.DataSource !== 1"
type="text"
v-if="question.Type === 'number' && question.DataSource !== 1"
:disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')" :disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !isBaseline && questionForm.IsCurrentTaskAdd === 'False')"
@change="((val)=>{formItemNumberChange(val, question)})" @change="((val) => { formItemNumberChange(val, question) })" @input="numberInput(question.Id)"
@input="numberInput(question.Id)" @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" v-model="questionForm[question.Id]">
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" <template slot="append" v-if="question.Unit !== 0">{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) :
v-model="questionForm[question.Id]" question.CustomUnit }}</template>
>
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
</el-input> </el-input>
<el-input <el-input type="text" v-if="question.Type === 'number' && question.DataSource === 1"
type="text" :disabled="question.DataSource === 1" @input="numberInput(question.Id, true)"
v-if="question.Type === 'number' && question.DataSource === 1" @blur="handleCalculationBlur(calculationValue)" v-model="calculationValue">
:disabled="question.DataSource === 1" <template slot="append" v-if="question.Unit !== 0">{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) :
@input="numberInput(question.Id, true )" question.CustomUnit }}</template>
@blur="handleCalculationBlur(calculationValue)"
v-model="calculationValue"
>
<template slot="append" v-if="question.Unit !== 0">{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}</template>
</el-input> </el-input>
</template> </template>
<!-- 上传图像 --> <!-- 上传图像 -->
<el-upload <el-upload v-if="question.Type === 'upload'" action :accept="question.FileType"
v-if="question.Type==='upload'" :limit="question.ImageCount === 0 ? 100 : question.ImageCount" :on-preview="handlePictureCardPreview"
action :before-upload="handleBeforeUpload" :http-request="uploadScreenshot" list-type="picture-card"
:accept="question.FileType" :on-remove="handleRemove" :file-list="fileList"
:limit="question.ImageCount === 0 ? 100 : question.ImageCount" :class="{ disabled: question.ImageCount === 0 ? false : fileList.length >= 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" /> <i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}"> <div slot="file" slot-scope="{file}">
<viewer <viewer :ref="file.url" :images="[imageUrl]" style="
:ref="file.url"
:images="[imageUrl]"
style="
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
" ">
> <img class="el-upload-list__item-thumbnail" :src="OSSclientConfig.basePath + file.url"
<img crossOrigin="anonymous" alt="" style="max-width: 100%; max-height: 100%" />
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-actions">
<span <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in" /> <i class="el-icon-zoom-in" />
</span> </span>
<span <span v-if="readingTaskState < 2" class="el-upload-list__item-delete" @click="handleRemove(file)">
v-if="readingTaskState < 2"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete" /> <i class="el-icon-delete" />
</span> </span>
</span> </span>
</viewer> </viewer>
</div> </div>
</el-upload> </el-upload>
<el-dialog <el-dialog v-if="question.Type === 'upload'" append-to-body :visible.sync="imgVisible" width="600px">
v-if="question.Type==='upload'"
append-to-body
:visible.sync="imgVisible"
width="600px"
>
<el-image :src="imageUrl" width="100%"> <el-image :src="imageUrl" width="100%">
<div slot="placeholder" class="image-slot"> <div slot="placeholder" class="image-slot">
{{$t('trials:readingUnit:qsList:message:loading')}}<span class="dot">...</span> {{ $t('trials:readingUnit:qsList:message:loading') }}<span class="dot">...</span>
</div> </div>
</el-image> </el-image>
</el-dialog> </el-dialog>
@ -426,24 +302,24 @@ export default {
if (this.type === 'edit') return if (this.type === 'edit') return
}, },
methods: { methods: {
numberInput(id,notId = false) { numberInput(id, notId = false) {
if(notId ) { if (notId) {
// this.calculationValue = this.calculationValue.toUpperCase(); this.calculationValue = this.calculationValue.toUpperCase();
}else { } else {
this.questionForm[id] = this.questionForm[id].toUpperCase(); this.questionForm[id] = this.questionForm[id].toUpperCase();
} }
}, },
validatorNumberInput(rule, value, callback) { validatorNumberInput(rule, value, callback) {
let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g') let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
if (value === '') { if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify'))); callback(new Error(this.$t('common:ruleMessage:specify')));
} else {
if (!reg.test(value)) {
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
} else { } else {
if (!reg.test(value)) { callback();
callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
}else{
callback();
}
} }
}
}, },
save() { save() {
}, },
@ -474,11 +350,10 @@ export default {
} }
}, },
handleBlur(value, a, b) { handleBlur(value, a, b) {
let reg = new RegExp(/[a-zA-Z]/, 'ig') if (!value) return false
if(!reg.test(value)) { if (!isNaN(parseFloat(value))) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
} }
// this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
}, },
handleMarkedQsBlur(value, a, b, question) { handleMarkedQsBlur(value, a, b, question) {
this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
@ -486,7 +361,10 @@ export default {
// this.$emit('operateImageMarker', {operateStateEnum: 6, question}) // this.$emit('operateImageMarker', {operateStateEnum: 6, question})
}, },
handleCalculationBlur(v) { handleCalculationBlur(v) {
this.calculationValue = parseFloat(v).toFixed(this.digitPlaces) if (!v) return false
if (!isNaN(parseFloat(v))) {
this.calculationValue = parseFloat(v).toFixed(this.digitPlaces)
}
}, },
limitInput(value, q) { limitInput(value, q) {
if (value.indexOf('.') > -1) { if (value.indexOf('.') > -1) {
@ -554,25 +432,25 @@ export default {
} }
break; break;
case 10: case 10:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
} }
num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => { num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => {
return acc + (typeof curr === "number" ? curr : 0); return acc + (typeof curr === "number" ? curr : 0);
}, 0) / dataArr.length; }, 0) / dataArr.length;
break; break;
case 11: case 11:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
} }
num = Math.max(...dataArr); num = Math.max(...dataArr);
break; break;
case 12: case 12:
if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) {
dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) dataArr.push(parseFloat(this.questionForm[o.TableQuestionId]))
} }
num = Math.min(...dataArr); num = Math.min(...dataArr);
break; break;
} }
} else { } else {
num = parseFloat(this.questionForm[o.TableQuestionId]) num = parseFloat(this.questionForm[o.TableQuestionId])
@ -652,9 +530,9 @@ export default {
var subjectId = this.$route.query.trialId var subjectId = this.$route.query.trialId
var file = await this.fileToBlob(param.file) var file = await this.fileToBlob(param.file)
const res = await this.OSSclient.put(`/${trialId}/Read/${subjectId}/Visit/${param.file.name}`, file) const res = await this.OSSclient.put(`/${trialId}/Read/${subjectId}/Visit/${param.file.name}`, file)
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.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() loading.close()
}, },
handleBeforeUpload(file) { handleBeforeUpload(file) {
@ -681,11 +559,11 @@ export default {
}, },
// //
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
var suffix = file.url.substring(file.url.lastIndexOf(".")+1) var suffix = file.url.substring(file.url.lastIndexOf(".") + 1)
suffix = suffix ? suffix.toLowerCase() : '' 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') window.open(this.OSSclientConfig.basePath + file.url, '_blank')
}else{ } else {
this.imageUrl = this.OSSclientConfig.basePath + file.url this.imageUrl = this.OSSclientConfig.basePath + file.url
// this.imgVisible = true // this.imgVisible = true
this.$refs[file.url].$viewer.show() this.$refs[file.url].$viewer.show()
@ -697,34 +575,38 @@ export default {
this.imageUrl = '' this.imageUrl = ''
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1) this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
this.urls.splice(this.fileList.findIndex(f => f === 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.criterion-table-form-item {
.criterion-table-form-item{ .el-form-item {
.el-form-item{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: flex-start; align-items: flex-start;
} }
.el-input{
width:100%; .el-input {
width: 100%;
} }
.el-select { .el-select {
width:100%; width: 100%;
} }
.mb{
.mb {
margin-bottom: 0px; margin-bottom: 0px;
} }
.disabled{
.disabled {
::v-deep .el-upload--picture-card { ::v-deep .el-upload--picture-card {
display: none; display: none;
} }
} }
.uploadWrapper{
.uploadWrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;

View File

@ -368,7 +368,7 @@ export default {
if (v.Type === 'number') { if (v.Type === 'number') {
let val = null let val = null
if (v.ValueType === 0) { if (v.ValueType === 0) {
val = parseInt(v.Answers[this.visitTaskId]) val = isNaN(parseFloat(v.Answers[this.visitTaskId])) ? v.Answers[this.visitTaskId] : parseInt(v.Answers[this.visitTaskId])
} else if (v.ValueType === 3) { } else if (v.ValueType === 3) {
val = v.Answers[this.visitTaskId] val = v.Answers[this.visitTaskId]
} else { } else {
@ -394,7 +394,7 @@ export default {
if (i.Type === 'number') { if (i.Type === 'number') {
let val = null let val = null
if (i.ValueType === 0) { if (i.ValueType === 0) {
val = parseInt(i.Answers[this.visitTaskId]) val = isNaN(parseFloat(i.Answers[this.visitTaskId])) ? i.Answers[this.visitTaskId] : parseInt(i.Answers[this.visitTaskId])
} else if (i.ValueType === 3) { } else if (i.ValueType === 3) {
val = i.Answers[this.visitTaskId] val = i.Answers[this.visitTaskId]
} else { } else {
@ -533,7 +533,7 @@ export default {
if (item.Type === 'number') { if (item.Type === 'number') {
let val = null let val = null
if (item.ValueType === 0) { if (item.ValueType === 0) {
val = parseInt(i.Answer) val = isNaN(parseFloat(i.Answer)) ? i.Answer : parseInt(i.Answer)
} else if (item.ValueType === 3) { } else if (item.ValueType === 3) {
val = i.Answer val = i.Answer
} else { } else {