自动计算平均值问题
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
05cd1c4075
commit
29be0d6035
|
@ -8,24 +8,22 @@
|
||||||
</div> -->
|
</div> -->
|
||||||
<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;"
|
style="font-weight: bold; font-size: 16px; margin: 5px 0px"
|
||||||
>
|
>
|
||||||
{{ language==='en'?question.GroupEnName:question.GroupName }}
|
{{ language === "en" ? question.GroupEnName : question.GroupName }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="question.Type === 'table'"
|
v-if="question.Type === 'table'"
|
||||||
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;">
|
<div style="display: flex; justify-content: space-between">
|
||||||
<span>{{ question.QuestionName }}</span>
|
<span>{{ question.QuestionName }}</span>
|
||||||
<!-- 添加 -->
|
<!-- 添加 -->
|
||||||
<el-button type="primary" @click="openAddTableCol(question)">
|
<el-button type="primary" @click="openAddTableCol(question)">
|
||||||
{{ $t('trials:readingUnit:qsList:title:add') }}
|
{{ $t("trials:readingUnit:qsList:title:add") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table :data="questionForm[question.Id]">
|
||||||
:data="questionForm[question.Id]"
|
|
||||||
>
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="item of question.TableQuestions.Questions"
|
v-for="item of question.TableQuestions.Questions"
|
||||||
:key="item.Id"
|
:key="item.Id"
|
||||||
|
@ -38,14 +36,37 @@
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="(question.ShowQuestion===1 && !!~question.ParentTriggerValueList.indexOf(questionForm[question.ParentId].toString())) || question.ShowQuestion===0"
|
v-if="
|
||||||
|
(question.ShowQuestion === 1 &&
|
||||||
|
!!~question.ParentTriggerValueList.indexOf(
|
||||||
|
questionForm[question.ParentId].toString()
|
||||||
|
)) ||
|
||||||
|
question.ShowQuestion === 0
|
||||||
|
"
|
||||||
:label="`${question.QuestionName}`"
|
:label="`${question.QuestionName}`"
|
||||||
:prop="question.Id"
|
:prop="question.Id"
|
||||||
:rules="[
|
:rules="[
|
||||||
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (!!~question.RelevanceValueList.indexOf(questionForm[question.RelevanceId].toString())))) && question.Type!=='group' && question.Type!=='summary',
|
{
|
||||||
message: this.$t('common:ruleMessage:specify'), trigger: ['blur', 'change']},
|
required:
|
||||||
|
(question.IsRequired === 0 ||
|
||||||
|
(question.IsRequired === 1 &&
|
||||||
|
question.RelevanceId &&
|
||||||
|
!!~question.RelevanceValueList.indexOf(
|
||||||
|
questionForm[question.RelevanceId].toString()
|
||||||
|
))) &&
|
||||||
|
question.Type !== 'group' &&
|
||||||
|
question.Type !== 'summary',
|
||||||
|
message: this.$t('common:ruleMessage:specify'),
|
||||||
|
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
|
||||||
|
@ -65,8 +86,16 @@
|
||||||
v-if="question.Type === 'select'"
|
v-if="question.Type === 'select'"
|
||||||
v-model="questionForm[question.Id]"
|
v-model="questionForm[question.Id]"
|
||||||
clearable
|
clearable
|
||||||
:disabled="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && !!question.DictionaryCode"
|
:disabled="
|
||||||
@change="((val)=>{formItemChange(val, question)})"
|
(question.TableQuestionType === 2 ||
|
||||||
|
question.QuestionGenre === 2) &&
|
||||||
|
!!question.DictionaryCode
|
||||||
|
"
|
||||||
|
@change="
|
||||||
|
(val) => {
|
||||||
|
formItemChange(val, question);
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-if="question.TableQuestionType === 1">
|
<template v-if="question.TableQuestionType === 1">
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -76,7 +105,11 @@
|
||||||
:value="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]"
|
v-for="item of $d[question.DictionaryCode]"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -84,7 +117,13 @@
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="(question.TableQuestionType === 2 || question.QuestionGenre === 2) && question.DictionaryCode">
|
<template
|
||||||
|
v-else-if="
|
||||||
|
(question.TableQuestionType === 2 ||
|
||||||
|
question.QuestionGenre === 2) &&
|
||||||
|
question.DictionaryCode
|
||||||
|
"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item of $d[question.DictionaryCode]"
|
v-for="item of $d[question.DictionaryCode]"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -100,13 +139,16 @@
|
||||||
:value="val"
|
:value="val"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-select>
|
</el-select>
|
||||||
<!-- 单选 -->
|
<!-- 单选 -->
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-if="question.Type === 'radio'"
|
v-if="question.Type === 'radio'"
|
||||||
v-model="questionForm[question.Id]"
|
v-model="questionForm[question.Id]"
|
||||||
@change="((val)=>{formItemChange(val, question)})"
|
@change="
|
||||||
|
(val) => {
|
||||||
|
formItemChange(val, question);
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-if="question.DictionaryCode">
|
<template v-if="question.DictionaryCode">
|
||||||
<el-radio
|
<el-radio
|
||||||
|
@ -177,7 +219,11 @@
|
||||||
v-if="question.Type === 'number' && question.DataSource !== 1"
|
v-if="question.Type === 'number' && question.DataSource !== 1"
|
||||||
v-model="questionForm[question.Id]"
|
v-model="questionForm[question.Id]"
|
||||||
type="number"
|
type="number"
|
||||||
@change="((val)=>{formItemNumberChange(val, question)})"
|
@change="
|
||||||
|
(val) => {
|
||||||
|
formItemNumberChange(val, question);
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<el-input
|
<el-input
|
||||||
v-if="question.Type === 'number' && question.DataSource === 1"
|
v-if="question.Type === 'number' && question.DataSource === 1"
|
||||||
|
@ -205,7 +251,7 @@
|
||||||
:src="OSSclientConfig.basePath + file.url"
|
:src="OSSclientConfig.basePath + file.url"
|
||||||
crossOrigin="Anonymous"
|
crossOrigin="Anonymous"
|
||||||
alt=""
|
alt=""
|
||||||
>
|
/>
|
||||||
<span class="el-upload-list__item-actions">
|
<span class="el-upload-list__item-actions">
|
||||||
<span
|
<span
|
||||||
class="el-upload-list__item-preview"
|
class="el-upload-list__item-preview"
|
||||||
|
@ -233,15 +279,22 @@
|
||||||
<el-image :src="imageUrl" crossOrigin="Anonymous" width="100%">
|
<el-image :src="imageUrl" crossOrigin="Anonymous" 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>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="question.Childrens && question.Childrens.length>0 && question.Type !== 'table'">
|
<template
|
||||||
|
v-if="
|
||||||
|
question.Childrens &&
|
||||||
|
question.Childrens.length > 0 &&
|
||||||
|
question.Type !== 'table'
|
||||||
|
"
|
||||||
|
>
|
||||||
<QuestionFormItem
|
<QuestionFormItem
|
||||||
v-for="(item) in question.Childrens"
|
v-for="item in question.Childrens"
|
||||||
:key="item.Id"
|
:key="item.Id"
|
||||||
:question="item"
|
:question="item"
|
||||||
:reading-task-state="readingTaskState"
|
:reading-task-state="readingTaskState"
|
||||||
|
@ -264,13 +317,9 @@
|
||||||
width="400px"
|
width="400px"
|
||||||
append-to-body
|
append-to-body
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form ref="tableQsForm" v-loading="loading" size="small">
|
||||||
ref="tableQsForm"
|
|
||||||
v-loading="loading"
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<QuestionTableFormItem
|
<QuestionTableFormItem
|
||||||
v-for="(item) in QuestionsList"
|
v-for="item in QuestionsList"
|
||||||
:key="item.Id"
|
:key="item.Id"
|
||||||
:question="item"
|
:question="item"
|
||||||
:reading-task-state="readingTaskState"
|
:reading-task-state="readingTaskState"
|
||||||
|
@ -282,7 +331,10 @@
|
||||||
@setFormItemData="setFormItemData"
|
@setFormItemData="setFormItemData"
|
||||||
@resetFormItemData="resetFormItemData"
|
@resetFormItemData="resetFormItemData"
|
||||||
/>
|
/>
|
||||||
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
|
<div
|
||||||
|
class="base-dialog-footer"
|
||||||
|
style="text-align: right; margin-top: 10px"
|
||||||
|
>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<!-- 取消 -->
|
<!-- 取消 -->
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -290,11 +342,11 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="addOrEdit.visible = false"
|
@click="addOrEdit.visible = false"
|
||||||
>
|
>
|
||||||
{{ $t('common:button:cancel') }}
|
{{ $t("common:button:cancel") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- 保存 -->
|
<!-- 保存 -->
|
||||||
<el-button size="small" type="primary" @click="save">
|
<el-button size="small" type="primary" @click="save">
|
||||||
{{ $t('common:button:save') }}
|
{{ $t("common:button:save") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
@ -303,66 +355,73 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { uploadReadingAnswerImage, getTrialOrganList, getCustomTableQuestionPreview, getQuestionCalculateRelation } from '@/api/trials'
|
import {
|
||||||
import QuestionTableFormItem from './QuestionTableFormItem'
|
uploadReadingAnswerImage,
|
||||||
import { mapGetters } from 'vuex'
|
getTrialOrganList,
|
||||||
|
getCustomTableQuestionPreview,
|
||||||
|
getQuestionCalculateRelation,
|
||||||
|
} from "@/api/trials";
|
||||||
|
import QuestionTableFormItem from "./QuestionTableFormItem";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: 'QuestionFormItem',
|
name: "QuestionFormItem",
|
||||||
components: { QuestionTableFormItem },
|
components: { QuestionTableFormItem },
|
||||||
props: {
|
props: {
|
||||||
questionForm: {
|
questionForm: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default() {
|
default() {
|
||||||
return {}
|
return {};
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
isSystemCriterion: {
|
isSystemCriterion: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default() { return false }
|
default() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
question: {
|
question: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default() {
|
default() {
|
||||||
return []
|
return [];
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
criterionId: {
|
criterionId: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true,
|
||||||
},
|
},
|
||||||
readingTaskState: {
|
readingTaskState: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true,
|
||||||
},
|
},
|
||||||
visitTaskId: {
|
visitTaskId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: "",
|
||||||
},
|
},
|
||||||
calculationList: {
|
calculationList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default() {
|
default() {
|
||||||
return []
|
return [];
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['language'])
|
...mapGetters(["language"]),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
addOrEdit: { visible: false, title: '' },
|
addOrEdit: { visible: false, title: "" },
|
||||||
fileList: [],
|
fileList: [],
|
||||||
accept: '.png,.jpg,.jpeg',
|
accept: ".png,.jpg,.jpeg",
|
||||||
imgVisible: false,
|
imgVisible: false,
|
||||||
imageUrl: '',
|
imageUrl: "",
|
||||||
urls: [],
|
urls: [],
|
||||||
organList: [],
|
organList: [],
|
||||||
QuestionsList: [],
|
QuestionsList: [],
|
||||||
QuestionsForm: {},
|
QuestionsForm: {},
|
||||||
AnswersList: [],
|
AnswersList: [],
|
||||||
loading: false
|
loading: false,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
questionForm: {
|
questionForm: {
|
||||||
|
@ -370,50 +429,56 @@ export default {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(v, oldv) {
|
handler(v, oldv) {
|
||||||
try {
|
try {
|
||||||
if (!v || !v[this.question.Id] || !oldv || !oldv[this.question.Id]) return
|
if (!v || !v[this.question.Id] || !oldv || !oldv[this.question.Id])
|
||||||
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e, v)
|
console.log(e, v);
|
||||||
}
|
|
||||||
this.formItemNumberChange(this.question.Id, false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.formItemNumberChange(this.question.Id, false);
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.question.Type === 'class') {
|
if (this.question.Type === "class") {
|
||||||
this.ClassifyAlgorithmsList = JSON.parse(this.question.ClassifyAlgorithms)
|
this.ClassifyAlgorithmsList = JSON.parse(
|
||||||
|
this.question.ClassifyAlgorithms
|
||||||
|
);
|
||||||
}
|
}
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (this.question.Type === 'class') {
|
if (this.question.Type === "class") {
|
||||||
let o = this.ClassifyAlgorithmsList.find(v => {
|
let o = this.ClassifyAlgorithmsList.find((v) => {
|
||||||
return this.questionForm[this.question.ClassifyQuestionId] >= v.gt && this.questionForm[this.question.ClassifyQuestionId] < v.lt
|
return (
|
||||||
})
|
this.questionForm[this.question.ClassifyQuestionId] >= v.gt &&
|
||||||
|
this.questionForm[this.question.ClassifyQuestionId] < v.lt
|
||||||
|
);
|
||||||
|
});
|
||||||
if (this.questionForm[this.question.ClassifyQuestionId]) {
|
if (this.questionForm[this.question.ClassifyQuestionId]) {
|
||||||
this.questionForm[this.question.Id] = o ? o.label : null
|
this.questionForm[this.question.Id] = o ? o.label : null;
|
||||||
} else {
|
} else {
|
||||||
this.questionForm[this.question.Id] = null
|
this.questionForm[this.question.Id] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 300)
|
}, 300);
|
||||||
if (this.question.Type === 'upload') {
|
if (this.question.Type === "upload") {
|
||||||
if (this.questionForm[this.question.Id]) {
|
if (this.questionForm[this.question.Id]) {
|
||||||
this.urls = this.questionForm[this.question.Id].split('|')
|
this.urls = this.questionForm[this.question.Id].split("|");
|
||||||
this.fileList = []
|
this.fileList = [];
|
||||||
this.urls.map(url => {
|
this.urls.map((url) => {
|
||||||
this.fileList.push({ name: '', url: `${url}` })
|
this.fileList.push({ name: "", url: `${url}` });
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.question.Type === 'table') {
|
if (this.question.Type === "table") {
|
||||||
// this.getQuestionCalculateRelation()
|
// this.getQuestionCalculateRelation()
|
||||||
if (this.questionForm[this.question.Id]) {
|
if (this.questionForm[this.question.Id]) {
|
||||||
this.QuestionsForm = {}
|
this.QuestionsForm = {};
|
||||||
this.question.TableQuestions.Questions.forEach(v => {
|
this.question.TableQuestions.Questions.forEach((v) => {
|
||||||
if (v.Type === 'number') {
|
if (v.Type === "number") {
|
||||||
this.$set(this.QuestionsForm, v.Id, 0)
|
this.$set(this.QuestionsForm, v.Id, 0);
|
||||||
} else {
|
} else {
|
||||||
this.$set(this.QuestionsForm, v.Id, '')
|
this.$set(this.QuestionsForm, v.Id, "");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -421,21 +486,24 @@ export default {
|
||||||
getQuestionCalculateRelation() {
|
getQuestionCalculateRelation() {
|
||||||
getQuestionCalculateRelation({
|
getQuestionCalculateRelation({
|
||||||
TrialReadingCriterionId: this.criterionId,
|
TrialReadingCriterionId: this.criterionId,
|
||||||
ReadingQuestionId: this.question.Id
|
ReadingQuestionId: this.question.Id,
|
||||||
}).then(res => {
|
}).then((res) => {
|
||||||
this.calculationList = res.Result
|
this.calculationList = res.Result;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
this.AnswersList.push(this.QuestionsForm)
|
this.AnswersList.push(this.QuestionsForm);
|
||||||
this.$emit('setFormItemData', { key: this.question.Id, val: this.AnswersList })
|
this.$emit("setFormItemData", {
|
||||||
this.formItemNumberChange(this.question.Id, true)
|
key: this.question.Id,
|
||||||
this.addOrEdit.visible = false
|
val: this.AnswersList,
|
||||||
|
});
|
||||||
|
this.formItemNumberChange(this.question.Id, true);
|
||||||
|
this.addOrEdit.visible = false;
|
||||||
},
|
},
|
||||||
logic(rules, num = 0) {
|
logic(rules, num = 0) {
|
||||||
try {
|
try {
|
||||||
if (rules.CalculateQuestionList.length === 0) {
|
if (rules.CalculateQuestionList.length === 0) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
rules.CalculateQuestionList.forEach((o, i) => {
|
rules.CalculateQuestionList.forEach((o, i) => {
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
|
@ -444,228 +512,261 @@ export default {
|
||||||
case 5:
|
case 5:
|
||||||
this.questionForm[o.QuestionId].forEach((q, qi) => {
|
this.questionForm[o.QuestionId].forEach((q, qi) => {
|
||||||
if (qi === 0) {
|
if (qi === 0) {
|
||||||
num = parseFloat(q[o.TableQuestionId])
|
num = parseFloat(q[o.TableQuestionId]);
|
||||||
} else {
|
} else {
|
||||||
num *= parseFloat(q[o.TableQuestionId])
|
num *= parseFloat(q[o.TableQuestionId]);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
break
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
this.questionForm[o.QuestionId].forEach((q, qi) => {
|
this.questionForm[o.QuestionId].forEach((q, qi) => {
|
||||||
if (qi === 0) {
|
if (qi === 0) {
|
||||||
num = parseFloat(q[o.TableQuestionId])
|
num = parseFloat(q[o.TableQuestionId]);
|
||||||
} else {
|
} else {
|
||||||
num += parseFloat(q[o.TableQuestionId])
|
num += parseFloat(q[o.TableQuestionId]);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
break
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
this.questionForm[o.QuestionId].forEach((q, qi) => {
|
this.questionForm[o.QuestionId].forEach((q, qi) => {
|
||||||
if (qi === 0) {
|
if (qi === 0) {
|
||||||
num = parseFloat(q[o.TableQuestionId])
|
num = parseFloat(q[o.TableQuestionId]);
|
||||||
} else {
|
} else {
|
||||||
num += parseFloat(q[o.TableQuestionId])
|
num += parseFloat(q[o.TableQuestionId]);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
num = this.questionForm[o.QuestionId].length === 0 ? 0 : num / this.questionForm[o.QuestionId].length
|
num =
|
||||||
break
|
this.questionForm[o.QuestionId].length === 0
|
||||||
|
? 0
|
||||||
|
: num / this.questionForm[o.QuestionId].length;
|
||||||
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
var arr = []
|
var arr = [];
|
||||||
this.questionForm[o.QuestionId].forEach(q => {
|
this.questionForm[o.QuestionId].forEach((q) => {
|
||||||
arr.push(q[o.TableQuestionId])
|
arr.push(q[o.TableQuestionId]);
|
||||||
})
|
});
|
||||||
num = arr.length === 0 ? 0 : Math.max(...arr)
|
num = arr.length === 0 ? 0 : Math.max(...arr);
|
||||||
break
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
var arr = []
|
var arr = [];
|
||||||
this.questionForm[o.QuestionId].forEach(q => {
|
this.questionForm[o.QuestionId].forEach((q) => {
|
||||||
arr.push(q[o.TableQuestionId])
|
arr.push(q[o.TableQuestionId]);
|
||||||
})
|
});
|
||||||
num = arr.length === 0 ? 0 : Math.min(...arr)
|
num = arr.length === 0 ? 0 : Math.min(...arr);
|
||||||
console.log('min', this.questionForm[o.QuestionId], arr, num)
|
console.log("min", this.questionForm[o.QuestionId], arr, num);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
num = parseFloat(this.questionForm[o.TableQuestionId])
|
num = parseFloat(this.questionForm[o.TableQuestionId]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (rules.CustomCalculateMark) {
|
switch (rules.CustomCalculateMark) {
|
||||||
case 1:
|
case 1:
|
||||||
num += parseFloat(this.questionForm[o.TableQuestionId])
|
num += parseFloat(this.questionForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
num -= parseFloat(this.questionForm[o.TableQuestionId])
|
num -= parseFloat(this.questionForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
num *= parseFloat(this.questionForm[o.TableQuestionId])
|
num *= parseFloat(this.questionForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
num /= parseFloat(this.questionForm[o.TableQuestionId])
|
num /= parseFloat(this.questionForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e);
|
||||||
}
|
}
|
||||||
return num
|
return num;
|
||||||
},
|
},
|
||||||
formItemNumberChange(questionId, isTable) {
|
formItemNumberChange(questionId, isTable) {
|
||||||
if (isTable) {
|
if (isTable) {
|
||||||
this.calculationList.forEach((v, i) => {
|
this.calculationList.forEach((v, i) => {
|
||||||
var find = v.CalculateQuestionList.filter(o => {
|
var find = v.CalculateQuestionList.filter((o) => {
|
||||||
return o.QuestionId === questionId
|
return o.QuestionId === questionId;
|
||||||
})
|
});
|
||||||
// find的自动计算值number
|
// find的自动计算值number
|
||||||
console.log('find', find)
|
console.log("find", find);
|
||||||
if (find) {
|
if (find) {
|
||||||
var num = this.logic(v)
|
var num = this.logic(v);
|
||||||
if (num !== false) {
|
if (num !== false) {
|
||||||
this.$emit('setFormItemData', { key: v.QuestionId, val: num })
|
this.$emit("setFormItemData", { key: v.QuestionId, val: num });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.calculationList.forEach(v => {
|
this.calculationList.forEach((v) => {
|
||||||
var find = v.CalculateQuestionList.filter(o => {
|
var find = v.CalculateQuestionList.filter((o) => {
|
||||||
return o.TableQuestionId === questionId
|
return o.TableQuestionId === questionId;
|
||||||
})
|
});
|
||||||
// find的自动计算值number
|
// find的自动计算值number
|
||||||
if (find) {
|
if (find) {
|
||||||
var num = this.logic(v)
|
var num = this.logic(v);
|
||||||
if (num !== false) {
|
if (num !== false) {
|
||||||
this.$emit('setFormItemData', { key: v.QuestionId, val: num })
|
this.$emit("setFormItemData", { key: v.QuestionId, val: num });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
// this.$emit('formItemNumberChange')
|
// this.$emit('formItemNumberChange')
|
||||||
},
|
},
|
||||||
formItemTableNumberChange() {
|
formItemTableNumberChange() {
|
||||||
this.question.TableQuestions.Questions.forEach(v => {
|
console.log(this.question.TableQuestions.Questions);
|
||||||
if (v.Type === 'number' && v.DataSource === 1) {
|
this.question.TableQuestions.Questions.forEach((v) => {
|
||||||
var CalculateQuestions = JSON.parse(v.CalculateQuestions)
|
if (v.Type === "number" && v.DataSource === 1) {
|
||||||
var num,arr=[]
|
var CalculateQuestions = JSON.parse(v.CalculateQuestions);
|
||||||
|
var num,
|
||||||
|
arr = [];
|
||||||
CalculateQuestions.forEach((o, i) => {
|
CalculateQuestions.forEach((o, i) => {
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
num = parseFloat(this.QuestionsForm[o.TableQuestionId])
|
num = parseFloat(this.QuestionsForm[o.TableQuestionId]);
|
||||||
arr = [num];
|
arr = [num];
|
||||||
} else {
|
} else {
|
||||||
switch (v.CustomCalculateMark) {
|
switch (v.CustomCalculateMark) {
|
||||||
case 1:
|
case 1:
|
||||||
num += parseFloat(this.QuestionsForm[o.TableQuestionId])
|
num += parseFloat(this.QuestionsForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
num -= parseFloat(this.QuestionsForm[o.TableQuestionId])
|
num -= parseFloat(this.QuestionsForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
num *= parseFloat(this.QuestionsForm[o.TableQuestionId])
|
num *= parseFloat(this.QuestionsForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
num /= parseFloat(this.QuestionsForm[o.TableQuestionId])
|
num /= parseFloat(this.QuestionsForm[o.TableQuestionId]);
|
||||||
break
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]))
|
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]));
|
||||||
num += parseFloat(this.QuestionsForm[o.TableQuestionId])
|
num =
|
||||||
num = arr.length === 0 ? 0 : num / arr.length
|
arr.length === 0
|
||||||
break
|
? 0
|
||||||
|
: arr.reduce((acc, curr) => {
|
||||||
|
return acc + (typeof curr === "number" ? curr : 0);
|
||||||
|
}, 0) / arr.length;
|
||||||
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]))
|
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]));
|
||||||
num = arr.length === 0 ? 0 : Math.max(...arr)
|
num = arr.length === 0 ? 0 : Math.max(...arr);
|
||||||
break
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]))
|
arr.push(parseFloat(this.QuestionsForm[o.TableQuestionId]));
|
||||||
num = arr.length === 0 ? 0 : Math.min(...arr)
|
num = arr.length === 0 ? 0 : Math.min(...arr);
|
||||||
// console.log('min', this.questionForm[o.QuestionId], arr, num)
|
// console.log('min', this.questionForm[o.QuestionId], arr, num)
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.$set(this.QuestionsForm, v.Id, num.toString())
|
this.$set(this.QuestionsForm, v.Id, num.toString());
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
openAddTableCol(row) {
|
openAddTableCol(row) {
|
||||||
this.addOrEdit.visible = true
|
this.addOrEdit.visible = true;
|
||||||
this.addOrEdit.title = row.QuestionName + this.$t('trials:readingUnit:qsList:title:tableQs')// '表格问题'
|
this.addOrEdit.title =
|
||||||
this.QuestionsList = row.TableQuestions.Questions
|
row.QuestionName + this.$t("trials:readingUnit:qsList:title:tableQs"); // '表格问题'
|
||||||
this.AnswersList = row.TableQuestions.Answers
|
this.QuestionsList = row.TableQuestions.Questions;
|
||||||
this.QuestionsForm = {}
|
this.AnswersList = row.TableQuestions.Answers;
|
||||||
|
this.QuestionsForm = {};
|
||||||
},
|
},
|
||||||
getOrganInfoList() {
|
getOrganInfoList() {
|
||||||
var param = {
|
var param = {
|
||||||
trialId: this.$route.query.trialId,
|
trialId: this.$route.query.trialId,
|
||||||
lesionType: this.question.LesionType,
|
lesionType: this.question.LesionType,
|
||||||
// systemCriterionId: this.criterionId,
|
// systemCriterionId: this.criterionId,
|
||||||
isEnable: true
|
isEnable: true,
|
||||||
}
|
};
|
||||||
getTrialOrganList(param).then(res => {
|
getTrialOrganList(param).then((res) => {
|
||||||
this.organList = res.Result
|
this.organList = res.Result;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
formNumberItemChange(v) {
|
formNumberItemChange(v) {
|
||||||
this.$emit('setFormItemData', { key: v.QuestionId, val: num })
|
this.$emit("setFormItemData", { key: v.QuestionId, val: num });
|
||||||
},
|
},
|
||||||
formItemChange(v, question) {
|
formItemChange(v, question) {
|
||||||
if (question.Childrens.length > 0) {
|
if (question.Childrens.length > 0) {
|
||||||
this.resetChild(question.Childrens)
|
this.resetChild(question.Childrens);
|
||||||
}
|
}
|
||||||
if (question.TableQuestionType === 1 && question.RelationQuestions.length > 0) {
|
if (
|
||||||
var index = this.organList.findIndex(item => item[question.DataTableColumn] === v)
|
question.TableQuestionType === 1 &&
|
||||||
if (index < 0) return
|
question.RelationQuestions.length > 0
|
||||||
var selected = this.organList[index]
|
) {
|
||||||
this.question.RelationQuestions.map(qs => {
|
var index = this.organList.findIndex(
|
||||||
var val = selected[qs.DataTableColumn]
|
(item) => item[question.DataTableColumn] === v
|
||||||
|
);
|
||||||
|
if (index < 0) return;
|
||||||
|
var selected = this.organList[index];
|
||||||
|
this.question.RelationQuestions.map((qs) => {
|
||||||
|
var val = selected[qs.DataTableColumn];
|
||||||
// if (typeof val === 'boolean') {
|
// if (typeof val === 'boolean') {
|
||||||
// // val = String(val)
|
// // val = String(val)
|
||||||
// }
|
// }
|
||||||
this.$emit('setFormItemData', { key: qs.Id, val: val })
|
this.$emit("setFormItemData", { key: qs.Id, val: val });
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetChild(obj) {
|
resetChild(obj) {
|
||||||
obj.forEach(i => {
|
obj.forEach((i) => {
|
||||||
this.$emit('resetFormItemData', i.Id)
|
this.$emit("resetFormItemData", i.Id);
|
||||||
if (i.Childrens && i.Childrens.length > 0) {
|
if (i.Childrens && i.Childrens.length > 0) {
|
||||||
this.resetChild(i.Childrens)
|
this.resetChild(i.Childrens);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
resetFormItemData(v) {
|
resetFormItemData(v) {
|
||||||
this.$emit('resetFormItemData', v)
|
this.$emit("resetFormItemData", v);
|
||||||
},
|
},
|
||||||
setFormItemData(obj) {
|
setFormItemData(obj) {
|
||||||
this.$emit('setFormItemData', obj)
|
this.$emit("setFormItemData", obj);
|
||||||
},
|
},
|
||||||
async uploadScreenshot(param) {
|
async uploadScreenshot(param) {
|
||||||
if (!this.visitTaskId) {
|
if (!this.visitTaskId) {
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
target: document.querySelector('.ecrf-wrapper'),
|
target: document.querySelector(".ecrf-wrapper"),
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
lock: true,
|
lock: true,
|
||||||
text: 'Loading',
|
text: "Loading",
|
||||||
spinner: 'el-icon-loading'
|
spinner: "el-icon-loading",
|
||||||
})
|
});
|
||||||
var file = await this.fileToBlob(param.file)
|
var file = await this.fileToBlob(param.file);
|
||||||
const res = await this.OSSclient.put(`/${this.trialId}/ReadAttachment/preview/${param.file.name}`, file)
|
const res = await this.OSSclient.put(
|
||||||
this.fileList.push({ name: param.file.name, url: this.$getObjectName(res.url) })
|
`/${this.trialId}/ReadAttachment/preview/${param.file.name}`,
|
||||||
this.urls.push(this.$getObjectName(res.url))
|
file
|
||||||
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' })
|
);
|
||||||
loading.close()
|
this.fileList.push({
|
||||||
|
name: param.file.name,
|
||||||
|
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("|") : "",
|
||||||
|
});
|
||||||
|
loading.close();
|
||||||
} else {
|
} else {
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
target: document.querySelector('.ecrf-wrapper'),
|
target: document.querySelector(".ecrf-wrapper"),
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
lock: true,
|
lock: true,
|
||||||
text: 'Loading',
|
text: "Loading",
|
||||||
spinner: 'el-icon-loading'
|
spinner: "el-icon-loading",
|
||||||
})
|
});
|
||||||
var file = await this.fileToBlob(param.file)
|
var file = await this.fileToBlob(param.file);
|
||||||
const res = await this.OSSclient.put(`/${this.trialId}/ReadAttachment/${this.subjectId}/${this.visitTaskId}/${param.file.name}`, file)
|
const res = await this.OSSclient.put(
|
||||||
this.fileList.push({ name: param.file.name, url: this.$getObjectName(res.url) })
|
`/${this.trialId}/ReadAttachment/${this.subjectId}/${this.visitTaskId}/${param.file.name}`,
|
||||||
this.urls.push(this.$getObjectName(res.url))
|
file
|
||||||
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' })
|
);
|
||||||
loading.close()
|
this.fileList.push({
|
||||||
|
name: param.file.name,
|
||||||
|
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("|") : "",
|
||||||
|
});
|
||||||
|
loading.close();
|
||||||
}
|
}
|
||||||
// uploadReadingAnswerImage(this.$route.query.trialId, this.visitTaskId, formData).then(res => {
|
// uploadReadingAnswerImage(this.$route.query.trialId, this.visitTaskId, formData).then(res => {
|
||||||
// if (res.IsSuccess) {
|
// if (res.IsSuccess) {
|
||||||
|
@ -682,20 +783,25 @@ export default {
|
||||||
// 检测文件类型是否符合要求
|
// 检测文件类型是否符合要求
|
||||||
if (this.checkFileSuffix(file.name)) {
|
if (this.checkFileSuffix(file.name)) {
|
||||||
// this.fileList = []
|
// this.fileList = []
|
||||||
return true
|
return true;
|
||||||
} else {
|
} else {
|
||||||
var msg = this.$t('trials:readingUnit:qsList:message:imageFormat').replace('xxx', this.accept)
|
var msg = this.$t(
|
||||||
this.$alert(msg)
|
"trials:readingUnit:qsList:message:imageFormat"
|
||||||
return false
|
).replace("xxx", this.accept);
|
||||||
|
this.$alert(msg);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkFileSuffix(fileName) {
|
checkFileSuffix(fileName) {
|
||||||
var index = fileName.lastIndexOf('.')
|
var index = fileName.lastIndexOf(".");
|
||||||
var suffix = fileName.substring(index + 1, fileName.length)
|
var suffix = fileName.substring(index + 1, fileName.length);
|
||||||
if (this.accept.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1) {
|
if (
|
||||||
return false
|
this.accept.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) ===
|
||||||
|
-1
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
autoCalculation() {
|
autoCalculation() {
|
||||||
|
@ -703,18 +809,27 @@ export default {
|
||||||
},
|
},
|
||||||
// 预览图片
|
// 预览图片
|
||||||
handlePictureCardPreview(file) {
|
handlePictureCardPreview(file) {
|
||||||
this.imageUrl = this.OSSclientConfig.basePath + file.url
|
this.imageUrl = this.OSSclientConfig.basePath + file.url;
|
||||||
this.imgVisible = true
|
this.imgVisible = true;
|
||||||
},
|
},
|
||||||
// 删除图片
|
// 删除图片
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
this.imageUrl = ''
|
this.imageUrl = "";
|
||||||
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
|
this.fileList.splice(
|
||||||
this.urls.splice(this.fileList.findIndex(f => f === file.url), 1)
|
this.fileList.findIndex((f) => f.url === file.url),
|
||||||
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' })
|
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("|") : "",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.my_dialog {
|
.my_dialog {
|
||||||
|
|
Loading…
Reference in New Issue