Compare commits

..

No commits in common. "cc520270ac1fad54af8883a08c0fe5a6dc9d3fa2" and "1422a6f4060b76016624e01e9705f761c9ad0623" have entirely different histories.

7 changed files with 183 additions and 535 deletions

View File

@ -642,8 +642,8 @@
prop="ClassifyQuestionId" prop="ClassifyQuestionId"
> >
<el-select v-model="form.ClassifyQuestionId" clearable> <el-select v-model="form.ClassifyQuestionId" clearable>
<el-option v-for="item of Questions" :key="item.Id" :label="item.QuestionName" <el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName"
:value="item.Id"/> :value="item.QuestionId"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item

View File

@ -457,8 +457,8 @@
prop="ClassifyTableQuestionId" prop="ClassifyTableQuestionId"
> >
<el-select v-model="form.ClassifyTableQuestionId" clearable> <el-select v-model="form.ClassifyTableQuestionId" clearable>
<el-option v-for="item of Questions" :key="item.Id" :label="item.QuestionName" <el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName"
:value="item.Id"/> :value="item.QuestionId"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item

View File

@ -73,7 +73,6 @@
v-if="question.Type === 'input'" v-if="question.Type === 'input'"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
:disabled="question.TableQuestionType === 2" :disabled="question.TableQuestionType === 2"
@change="(val) => { formItemChange(val, question) }"
/> />
<!-- 多行文本输入框 --> <!-- 多行文本输入框 -->
<el-input <el-input
@ -81,7 +80,6 @@
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
type="textarea" type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }" :autosize="{ minRows: 2, maxRows: 4 }"
@change="(val) => { formItemChange(val, question) }"
/> />
<!-- 下拉框 --> <!-- 下拉框 -->
<el-select <el-select
@ -93,7 +91,11 @@
question.QuestionGenre === 2) && question.QuestionGenre === 2) &&
!!question.DictionaryCode !!question.DictionaryCode
" "
@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
@ -133,8 +135,8 @@
<el-option <el-option
v-for="val in question.TypeValue.split('|')" v-for="val in question.TypeValue.split('|')"
:key="val" :key="val"
:label="val.trim()" :label="val"
:value="val.trim()" :value="val"
/> />
</template> </template>
</el-select> </el-select>
@ -142,7 +144,11 @@
<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
@ -156,10 +162,10 @@
<template v-if="question.TypeValue"> <template v-if="question.TypeValue">
<el-radio <el-radio
v-for="val in question.TypeValue.split('|')" v-for="val in question.TypeValue.split('|')"
:key="val.trim()" :key="val"
:label="val.trim()" :label="val"
> >
{{ val.trim() }} {{ val }}
</el-radio> </el-radio>
</template> </template>
</el-radio-group> </el-radio-group>
@ -167,7 +173,6 @@
<el-checkbox-group <el-checkbox-group
v-if="question.Type === 'checkbox'" v-if="question.Type === 'checkbox'"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
@change="(val) => { formItemChange(val, question) }"
> >
<template v-if="question.DictionaryCode"> <template v-if="question.DictionaryCode">
<el-checkbox <el-checkbox
@ -181,10 +186,10 @@
<template v-if="question.TypeValue"> <template v-if="question.TypeValue">
<el-checkbox <el-checkbox
v-for="val in question.TypeValue.split('|')" v-for="val in question.TypeValue.split('|')"
:key="val.trim()" :key="val"
:label="val.trim()" :label="val"
> >
{{ val.trim() }} {{ val }}
</el-checkbox> </el-checkbox>
</template> </template>
</el-checkbox-group> </el-checkbox-group>
@ -198,23 +203,10 @@
/> />
<!-- 自动分类 --> <!-- 自动分类 -->
<el-input <el-input
v-if="question.Type === 'class' && !question.TypeValue" v-if="question.Type === 'class'"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
disabled disabled
/> />
<el-radio-group
v-if="question.Type === 'class' && question.TypeValue"
v-model="questionForm[question.Id]"
disabled
>
<el-radio
v-for="item of question.TypeValue.split('|')"
:key="item.trim()"
:label="item.trim()"
>
{{ item.trim() }}
</el-radio>
</el-radio-group>
<!-- 自增 --> <!-- 自增 -->
<el-input <el-input
v-if="question.Type === 'increment'" v-if="question.Type === 'increment'"
@ -227,20 +219,24 @@
v-if="question.Type === 'number' && question.TypeValue" v-if="question.Type === 'number' && question.TypeValue"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
clearable clearable
@change="(val) => { formItemNumberChange(val, question) }" @change="((val)=>{formItemChange(val, question)})"
> >
<el-option <el-option
v-for="val in question.TypeValue.split('|')" v-for="val in question.TypeValue.split('|')"
:key="val" :key="val"
:label="val.trim()" :label="val"
:value="val.trim()" :value="val"
/> />
</el-select> </el-select>
<el-input <el-input
v-else-if="question.Type === 'number' && question.DataSource !== 1" v-else-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-else-if="question.Type === 'number' && question.DataSource === 1" v-else-if="question.Type === 'number' && question.DataSource === 1"
@ -432,7 +428,6 @@ export default {
QuestionsForm: {}, QuestionsForm: {},
AnswersList: [], AnswersList: [],
loading: false, loading: false,
classArr: []
}; };
}, },
watch: { watch: {
@ -456,21 +451,21 @@ export default {
this.question.ClassifyAlgorithms 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 ( return (
// this.questionForm[this.question.ClassifyQuestionId] >= v.gt && this.questionForm[this.question.ClassifyQuestionId] >= v.gt &&
// this.questionForm[this.question.ClassifyQuestionId] < v.lt 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("|");
@ -480,19 +475,19 @@ export default {
}); });
} }
} }
// 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, "");
// } }
// }); });
// } }
// } }
}, },
methods: { methods: {
getQuestionCalculateRelation() { getQuestionCalculateRelation() {
@ -504,13 +499,11 @@ export default {
}); });
}, },
save() { save() {
// this.AnswersList.push(this.QuestionsForm); this.AnswersList.push(this.QuestionsForm);
this.$emit("setFormItemData", { this.$emit("setFormItemData", {
key: this.question.Id, key: this.question.Id,
val: this.QuestionsForm, val: this.AnswersList,
type: 'table'
}); });
this.question.TableQuestions.Answers.push(this.QuestionsForm)
this.formItemNumberChange(this.question.Id, true); this.formItemNumberChange(this.question.Id, true);
this.addOrEdit.visible = false; this.addOrEdit.visible = false;
}, },
@ -696,17 +689,11 @@ export default {
}); });
}, },
openAddTableCol(row) { openAddTableCol(row) {
this.QuestionsForm = {}
this.classArr = []
this.addOrEdit.title = this.addOrEdit.title =
row.QuestionName + this.$t("trials:readingUnit:qsList:title:tableQs"); // '' row.QuestionName + this.$t("trials:readingUnit:qsList:title:tableQs"); // ''
this.QuestionsList = row.TableQuestions.Questions; this.QuestionsList = row.TableQuestions.Questions;
row.TableQuestions.Questions.map(v=>{ this.AnswersList = row.TableQuestions.Answers;
if (v.Type === 'class') {
this.classArr.push({triggerId: v.ClassifyTableQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType})
}
})
// this.AnswersList = row.TableQuestions.Answers;
row.TableQuestions.Questions.map(i=>{ row.TableQuestions.Questions.map(i=>{
this.$set(this.QuestionsForm, i.Id, null) this.$set(this.QuestionsForm, i.Id, null)
}) })
@ -747,8 +734,6 @@ export default {
// } // }
this.$emit("setFormItemData", { key: qs.Id, val: val }); this.$emit("setFormItemData", { key: qs.Id, val: val });
}); });
} else {
this.$emit("setFormItemData", { key: question.Id, val: v })
} }
}, },
resetChild(obj) { resetChild(obj) {
@ -766,29 +751,7 @@ export default {
this.$emit("setFormItemData", obj); this.$emit("setFormItemData", obj);
}, },
setTblFormItemData(obj) { setTblFormItemData(obj) {
console.log('setTblFormItemData', this.classArr)
this.$set(this.QuestionsForm, obj.key, obj.val) this.$set(this.QuestionsForm, obj.key, obj.val)
if (this.classArr.length > 0) {
let qs = this.classArr.find(i=>i.triggerId === obj.key)
if (!qs) return
let answer = null
let list = JSON.parse(qs.classifyAlgorithms)
if (qs.classifyType === 0) {
let o = list.find(v => {
return (
parseFloat(obj.val) >= parseFloat(v.gt) &&
parseFloat(obj.val) < parseFloat(v.lt)
)
})
answer = o ? o.label : null
} else if (qs.classifyType === 1) {
let o = list.find(v => {
return v.val.includes(obj.val)
})
answer = o ? o.label : null
}
this.$set(this.QuestionsForm, qs.classId, answer)
}
}, },
resetTblFormItemData(obj) { resetTblFormItemData(obj) {
this.$set(this.QuestionsForm, obj.key, null) this.$set(this.QuestionsForm, obj.key, null)

View File

@ -103,23 +103,10 @@
/> />
<!-- 自动计算 --> <!-- 自动计算 -->
<el-input <el-input
v-if="question.Type === 'class' && !question.TypeValue" v-if="question.Type==='class'"
v-model="questionForm[question.Id]" v-model="questionForm[question.Id]"
disabled disabled
/> />
<el-radio-group
v-if="question.Type === 'class' && question.TypeValue"
v-model="questionForm[question.Id]"
disabled
>
<el-radio
v-for="item of question.TypeValue.split('|')"
:key="item.trim()"
:label="item.trim()"
>
{{ item.trim() }}
</el-radio>
</el-radio-group>
<!-- 自增 --> <!-- 自增 -->
<el-input <el-input
v-if="question.Type==='increment'" v-if="question.Type==='increment'"
@ -253,7 +240,8 @@ export default {
urls: [], urls: [],
organList: [], organList: [],
QuestionsList: [], QuestionsList: [],
QuestionsForm: {} QuestionsForm: {},
timer: null
} }
}, },
computed: { computed: {
@ -281,7 +269,21 @@ export default {
this.question.ClassifyAlgorithms this.question.ClassifyAlgorithms
); );
} }
this.timer = setInterval(() => {
if (this.question.Type === "class") {
if (this.questionForm[this.question.ClassifyTableQuestionId]) {
let o = this.ClassifyAlgorithmsList.find((v) => {
return (
this.questionForm[this.question.ClassifyTableQuestionId] >= v.gt &&
this.questionForm[this.question.ClassifyTableQuestionId] < v.lt
);
});
this.$emit('setFormItemData', { key: this.question.Id, val: o ? o.label : null })
} else {
this.$emit('setFormItemData', { key: this.question.Id, val: null })
}
}
}, 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('|')
@ -300,6 +302,9 @@ export default {
this.getOrganInfoList() this.getOrganInfoList()
} }
}, },
beforeDestroy() {
clearInterval(this.timer)
},
methods: { methods: {
save() { save() {
}, },
@ -321,6 +326,9 @@ export default {
}) })
}, },
formItemChange(v, question) { formItemChange(v, question) {
if (question.Childrens.length > 0) {
this.resetChild(question.Childrens)
}
if (question.TableQuestionType === 1 && question.RelationQuestions.length > 0) { if (question.TableQuestionType === 1 && question.RelationQuestions.length > 0) {
var index = this.organList.findIndex(item => item[question.DataTableColumn] === v) var index = this.organList.findIndex(item => item[question.DataTableColumn] === v)
if (index < 0) return if (index < 0) return
@ -332,8 +340,6 @@ export default {
// } // }
this.$emit('setFormItemData', { key: qs.Id, val: val }) this.$emit('setFormItemData', { key: qs.Id, val: val })
}) })
} else {
this.$emit('setFormItemData', { key: question.Id, val: v })
} }
}, },
formItemNumberChange(v, question) { formItemNumberChange(v, question) {
@ -353,8 +359,21 @@ export default {
setFormItemData(obj) { setFormItemData(obj) {
this.$emit('setFormItemData', obj) this.$emit('setFormItemData', obj)
}, },
uploadScreenshot(param) { async uploadScreenshot(param) {
if (!this.visitTaskId) return
const loading = this.$loading({
target: document.querySelector('.ecrf-wrapper'),
fullscreen: false,
lock: true,
text: 'Loading',
spinner: 'el-icon-loading'
})
var file = await this.fileToBlob(param.file)
const res = await this.OSSclient.put(`/${this.trialId}/ReadAttachment/${this.subjectId}/${this.visitTaskId}/${param.file.name}`, file)
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()
}, },
handleBeforeUpload(file) { handleBeforeUpload(file) {
// //

View File

@ -405,7 +405,7 @@
:label="$t('trials:qcCfg:table:typeValue')" :label="$t('trials:qcCfg:table:typeValue')"
prop="TypeValue" prop="TypeValue"
:rules="[ :rules="[
{required: form.Type !== 'number', trigger: ['blur', 'change'], message: this.$t('common:ruleMessage:specify')}, {required: form.Type !== 'number', trigger: ['blur', 'change']},
{validator: validateTypeVal, trigger: ['blur', 'change']}, {validator: validateTypeVal, trigger: ['blur', 'change']},
{max: 200, message: `${this.$t('common:ruleMessage:maxLength')} 200`}]" {max: 200, message: `${this.$t('common:ruleMessage:maxLength')} 200`}]"
> >
@ -663,12 +663,8 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.QuestionId" clearable :disabled="!scope.row.IsTable"> <el-select v-model="scope.row.QuestionId" clearable :disabled="!scope.row.IsTable">
<el-option <el-option v-for="item of tableQuestions" :key="item.QuestionId" :label="item.QuestionName"
v-for="item of tableQuestions" :value="item.QuestionId"/>
:key="item.Id"
:label="item.QuestionName"
:value="item.Id"
/>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
@ -681,13 +677,13 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-if="!scope.row.IsTable" v-model="scope.row.TableQuestionId" clearable> <el-select v-if="!scope.row.IsTable" v-model="scope.row.TableQuestionId" clearable>
<el-option v-for="item of numberQuestions" :key="item.Id" :label="item.QuestionName" <el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName"
:value="item.Id"/> :value="item.QuestionId"/>
</el-select> </el-select>
<el-select v-if="scope.row.IsTable" v-model="scope.row.TableQuestionId" clearable> <el-select v-if="scope.row.IsTable" v-model="scope.row.TableQuestionId" clearable>
<el-option <el-option
v-for="item of !scope.row.QuestionId ? [] : tableQuestions.find(v => v.Id === scope.row.QuestionId).TableQuestions" v-for="item of !scope.row.QuestionId ? [] : tableQuestions.find(v => v.QuestionId === scope.row.QuestionId).TableQuestions"
:key="item.Id" :label="item.QuestionName" :value="item.Id"/> :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId"/>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
@ -766,29 +762,8 @@
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<!-- 分类 --> <!-- 分类 -->
<el-form-item
v-if="form.Type === 'class'"
:label="$t('trials:readingUnit:qsList:title:ClassifyType')"
prop="ClassifyType"
:rules="[
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
]"
>
<el-radio-group
v-model="form.ClassifyType"
@change="classifyTypeChange"
>
<el-radio
v-for="item of $d.ClassifyType"
:key="item.id"
:label="item.value"
>
{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item <el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 0" v-if="form.Type === 'class'"
:label="$t('trials:readingUnit:label:ClassifyQuestion')" :label="$t('trials:readingUnit:label:ClassifyQuestion')"
prop="ClassifyQuestionId" prop="ClassifyQuestionId"
:rules="[ :rules="[
@ -796,29 +771,12 @@
]" ]"
> >
<el-select v-model="form.ClassifyQuestionId" clearable> <el-select v-model="form.ClassifyQuestionId" clearable>
<el-option v-for="item in numberQuestions" :key="item.Id" :label="item.QuestionName" <el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName"
:value="item.Id"/> :value="item.QuestionId"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 1" v-if="form.Type === 'class'"
:label="$t('trials:readingUnit:label:ClassifyQuestion')"
prop="ClassifyQuestionId"
:rules="[
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
]"
>
<el-select v-model="form.ClassifyQuestionId" clearable @change="classifyQuestionChange">
<el-option
v-for="item in selectQuestions"
:key="item.Id"
:label="item.QuestionName"
:value="item.Id"
/>
</el-select>
</el-form-item>
<el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 0"
:label="$t('trials:readingUnit:label:ClassifyAlgorithms')" :label="$t('trials:readingUnit:label:ClassifyAlgorithms')"
prop="ClassifyAlgorithms" prop="ClassifyAlgorithms"
:rules="[ :rules="[
@ -865,51 +823,6 @@
</el-table> </el-table>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 1"
:label="$t('trials:readingUnit:label:ClassifyAlgorithms')"
prop="ClassifyAlgorithms"
:rules="[
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
]"
>
<div>
<el-table
ref="CalculateTable"
:data="ClassifyAlgorithmsList"
style="margin: 10px;width: calc(100% - 20px)"
size="small"
>
<!-- 运算类型 -->
<el-table-column
:label="$t('trials:readingUnit:label:label')"
show-overflow-tooltip
min-width="70"
>
<template slot-scope="scope">
{{ scope.row.label }}
</template>
</el-table-column>
<!-- 选项 -->
<el-table-column
:label="$t('trials:readingUnit:label:options')"
show-overflow-tooltip
min-width="128"
>
<template slot-scope="scope">
<el-select v-model="scope.row.val" multiple>
<el-option
v-for="item in classifyQuestionOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
</div>
</el-form-item>
</div> </div>
</div> </div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;"> <div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
@ -991,7 +904,7 @@ export default {
ParentTriggerValueList: [], ParentTriggerValueList: [],
ShowOrder: 0, ShowOrder: 0,
ShowQuestion: 0, ShowQuestion: 0,
IsRequired: 0, IsRequired: 2,
IsJudgeQuestion: false, IsJudgeQuestion: false,
GroupName: '', GroupName: '',
GroupEnName: '', GroupEnName: '',
@ -1024,8 +937,7 @@ export default {
LimitShow: 0, LimitShow: 0,
HighlightAnswerList: [], HighlightAnswerList: [],
ExportIdentification: 0, ExportIdentification: 0,
ExportResult: [], ExportResult: []
ClassifyType: null,
// IsEnable: true // IsEnable: true
}, },
rules: { rules: {
@ -1065,14 +977,10 @@ export default {
groupOptions: [], groupOptions: [],
isParentExistGroup: false, isParentExistGroup: false,
lesionTypes: [], lesionTypes: [],
Questions: [],
tableQuestions: [], tableQuestions: [],
isShow: true, isShow: true,
validateTypeVal:null, validateTypeVal:null
numberQuestions: [],
classQuestions: [],
selectQuestions: [],
classifyQuestionOptions: [],
selectedClassifyOptions: []
} }
}, },
watch: { watch: {
@ -1082,14 +990,14 @@ export default {
}, },
mounted() { mounted() {
this.validateTypeVal = (rule, value, callback) => { this.validateTypeVal = (rule, value, callback) => {
if (value === '' && this.form.Type !== 'number') { if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify'))) callback(new Error(this.$t('common:ruleMessage:specify')))
} else { } else {
var arr = value.split('|') var arr = value.split('|')
if (new Set(arr).size !== arr.length) { if (new Set(arr).size !== arr.length) {
// '' // ''
callback(new Error(this.$t('trials:readingUnit:qsList:message:msg0'))) callback(new Error(this.$t('trials:readingUnit:qsList:message:msg0')))
} else if (value && this.form.Type === 'number' && arr.findIndex(i=>isNaN(parseFloat(i)) && i!== 'NE') > -1) { } else if (this.form.Type === 'number' && arr.findIndex(i=>isNaN(parseFloat(i)) && i!== 'NE') > -1) {
callback(new Error(this.$t('trials:readingUnit:qsList:message:msg5'))) callback(new Error(this.$t('trials:readingUnit:qsList:message:msg5')))
} else { } else {
callback() callback()
@ -1098,48 +1006,22 @@ export default {
} }
this.initForm() this.initForm()
this.getBasicConfigSelect() this.getBasicConfigSelect()
this.getCalculateQuestions(['number', 'select', 'radio', 'basicTable']) this.getCalculateQuestions('number')
// this.getTableQuestions() this.getCalculateQuestions('table')
// this.getCalculateQuestions('number')
// this.getCalculateQuestions('table')
}, },
methods: { methods: {
classifyTypeChange(v) {
this.form.ClassifyQuestionId = ''
if (this.ClassifyAlgorithmsList.length === 0 && this.form.TypeValue) {
let list = this.form.TypeValue.split('|')
this.ClassifyAlgorithmsList = list.map((res, i) => {
return this.form.ClassifyType === 0 ? {
label: res.trim(),
lt: 0,
gt: 0
} : {
label: res.trim(),
val: []
}
})
}
},
typeValueChange(v) { typeValueChange(v) {
this.form.DefaultValue = null this.form.DefaultValue = null
var list = v.split('|') var list = v.split('|')
this.form.ClassifyAlgorithms = null this.form.ClassifyAlgorithms = null
if (this.form.ClassifyType === 0) { var arr = Object.assign([], this.ClassifyAlgorithmsList)
this.ClassifyAlgorithmsList = list.map((res, i) => { this.ClassifyAlgorithmsList = list.map((res, i) => {
return { return {
label: res.trim(), label: res,
lt: 0, lt: arr[i] ? arr[i].lt : 0,
gt: 0 gt: arr[i] ? arr[i].gt : 0
} }
}) })
} else if (this.form.ClassifyType === 1) {
this.ClassifyAlgorithmsList = list.map((res, i) => {
return {
label: res.trim(),
val: []
}
})
}
}, },
getBasicConfigSelect() { getBasicConfigSelect() {
// getBasicConfigSelect('Reading_eCRF_Criterion').then(res => { // getBasicConfigSelect('Reading_eCRF_Criterion').then(res => {
@ -1190,54 +1072,18 @@ export default {
this.isShow = true this.isShow = true
}) })
}, },
async getCalculateQuestions(types) { getCalculateQuestions(type) {
try { getCalculateQuestions({
let params = { TrialCriterionId: this.trialCriterionId,
trialCriterionId: this.trialCriterionId, type: type
typeList: types }).then(res => {
} if (type === 'table') {
let res = await getCalculateQuestions(params)
if (res.Result) {
this.tableQuestions = res.Result.filter(i=>i.Type === 'basicTable')
this.selectQuestions = res.Result.filter(i=>i.Type === 'select' || i.Type === 'radio')
this.numberQuestions = res.Result.filter(i=>i.Type === 'number')
}
} catch(e) {
console.log(e)
}
},
async getTableQuestions() {
try {
let params = {
trialCriterionId: this.trialCriterionId,
type: 'basicTable'
}
let res = await getCalculateQuestions(params)
if (res.Result) {
this.tableQuestions = res.Result this.tableQuestions = res.Result
} else {
this.Questions = res.Result
} }
} catch(e) { })
console.log(e)
}
}, },
classifyQuestionChange (v){
let obj = this.selectQuestions.find(i=>i.Id === v)
let arr = obj && obj.TypeValue ? obj.TypeValue.split('|') : []
arr = arr.length > 0 ? arr.map(i=>i.trim()) : []
this.classifyQuestionOptions = arr
},
// getCalculateQuestions(type) {
// getCalculateQuestions({
// TrialCriterionId: this.trialCriterionId,
// type: type
// }).then(res => {
// if (type === 'table') {
// this.tableQuestions = res.Result
// } else {
// this.Questions = res.Result
// }
// })
// },
async initForm() { async initForm() {
// this.Questions = await getCalculateQuestions({ // this.Questions = await getCalculateQuestions({
// QuestionId: this.trialCriterionId, // QuestionId: this.trialCriterionId,
@ -1266,9 +1112,6 @@ export default {
} }
} }
} }
if (this.form.ClassifyQuestionId) {
this.classifyQuestionChange(this.form.ClassifyQuestionId)
}
if (this.form.ParentId !== '' && this.form.ParentId !== null && this.form.GroupName !== '') { if (this.form.ParentId !== '' && this.form.ParentId !== null && this.form.GroupName !== '') {
this.isParentExistGroup = true this.isParentExistGroup = true
} }
@ -1501,7 +1344,6 @@ export default {
form.HighlightAnswerList = [] form.HighlightAnswerList = []
form.ExportIdentification = 0 form.ExportIdentification = 0
form.ExportResult = [] form.ExportResult = []
form.ClassifyType = null
}, },
getLesionType() { getLesionType() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@ -27,7 +27,7 @@
<script> <script>
import { getTrialReadingQuestion, getCustomQuestionPreview, getCustomTableQuestionPreview, getQuestionCalculateRelation} from '@/api/trials' import { getTrialReadingQuestion, getCustomQuestionPreview, getCustomTableQuestionPreview, getQuestionCalculateRelation } from '@/api/trials'
import QuestionFormItem from './QuestionFormItem' import QuestionFormItem from './QuestionFormItem'
export default { export default {
name: 'QuestionsPreview', name: 'QuestionsPreview',
@ -57,8 +57,7 @@ export default {
isRender: false, isRender: false,
readingTaskState: 0, readingTaskState: 0,
activeName: 0, activeName: 0,
CalculationList: [], CalculationList: []
classArr: []
} }
}, },
mounted() { mounted() {
@ -105,8 +104,8 @@ export default {
if (res.OtherInfo.FormType === 2) { if (res.OtherInfo.FormType === 2) {
if (res.Result.MultiPage.length > 0) { if (res.Result.MultiPage.length > 0) {
res.Result.MultiPage.map((v) => { res.Result.MultiPage.map((v) => {
// if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table' && i.Type !== 'basicTable') return if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table') return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table' && i.Type !== 'basicTable') { if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table') {
this.$set(this.questionForm, v.Id, v.Answer) this.$set(this.questionForm, v.Id, v.Answer)
} }
if (v.Childrens.length > 0) { if (v.Childrens.length > 0) {
@ -118,16 +117,10 @@ export default {
} }
if (res.Result.PublicPage.length > 0) { if (res.Result.PublicPage.length > 0) {
res.Result.PublicPage.map((v) => { res.Result.PublicPage.map((v) => {
// if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table') return if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table') return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table' && i.Type !== 'basicTable') { if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table') {
this.$set(this.questionForm, v.Id, v.Answer) this.$set(this.questionForm, v.Id, v.Answer)
} }
if (v.Type === 'table') {
this.$set(this.questionForm, v.Id, [])
}
if (v.Type === 'class') {
this.classArr.push({triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType})
}
if (v.Childrens.length > 0) { if (v.Childrens.length > 0) {
this.setChild(v.Childrens) this.setChild(v.Childrens)
} }
@ -136,15 +129,15 @@ export default {
} }
} else { } else {
res.Result.SinglePage.map((v) => { res.Result.SinglePage.map((v) => {
// if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table') return if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table') return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table' && i.Type !== 'basicTable') { if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table' && i.Type !== 'number') {
this.$set(this.questionForm, v.Id, v.Answer) this.$set(this.questionForm, v.Id, v.Answer)
} }
if (v.Type === 'table') { if (i.Type === 'table') {
this.$set(this.questionForm, v.Id, []) this.$set(this.questionForm, v.Id, [])
} }
if (v.Type === 'class') { if (i.Type === 'number') {
this.classArr.push({triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType}) this.$set(this.questionForm, v.Id, v.Answer)
} }
if (v.Childrens.length > 0) { if (v.Childrens.length > 0) {
this.setChild(v.Childrens) this.setChild(v.Childrens)
@ -158,17 +151,14 @@ export default {
}, },
setChild(obj) { setChild(obj) {
obj.forEach(i => { obj.forEach(i => {
if (i.Type !== 'group' && i.Type !== 'summary' && i.Id && i.Type !== 'table' && i.Type !== 'basicTable') { if (i.Type !== 'group' && i.Type !== 'summary' && i.Id && i.Type !== 'table') {
this.$set(this.questionForm, i.Id, i.Answer) this.$set(this.questionForm, i.Id, i.Answer)
} }
if (i.Type === 'table') { if (i.Type === 'table') {
this.$set(this.questionForm, i.Id, []) this.$set(this.questionForm, i.Id, [])
} }
// if (i.Type === 'number') { if (i.Type === 'number') {
// this.$set(this.questionForm, i.Id, i.Answer) this.$set(this.questionForm, i.Id, i.Answer)
// }
if (i.Type === 'class') {
this.classArr.push({triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType})
} }
if (i.Childrens && i.Childrens.length > 0) { if (i.Childrens && i.Childrens.length > 0) {
this.setChild(i.Childrens) this.setChild(i.Childrens)
@ -179,34 +169,7 @@ export default {
this.questionForm[v] = '' this.questionForm[v] = ''
}, },
setFormItemData(obj) { setFormItemData(obj) {
if (obj.type && obj.type === 'table') { this.$set(this.questionForm, obj.key, JSON.parse(JSON.stringify(obj.val)))
let arr = this.questionForm[obj.key] || []
arr.push(JSON.parse(JSON.stringify(obj.val)))
this.$set(this.questionForm, obj.key, arr)
} else {
this.$set(this.questionForm, obj.key, JSON.parse(JSON.stringify(obj.val)))
if (this.classArr.length > 0) {
let qs = this.classArr.find(i=>i.triggerId === obj.key)
if (!qs) return
let answer = null
let list = JSON.parse(qs.classifyAlgorithms)
if (qs.classifyType === 0) {
let o = list.find(v => {
return (
parseFloat(obj.val) >= parseFloat(v.gt) &&
parseFloat(obj.val) < parseFloat(v.lt)
)
})
answer = o ? o.label : null
} else if (qs.classifyType === 1) {
let o = list.find(v => {
return v.val.includes(obj.val)
})
answer = o ? o.label : null
}
this.$set(this.questionForm, qs.classId, answer)
}
}
} }
} }
} }

View File

@ -394,7 +394,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.TableQuestionId" clearable> <el-select v-model="scope.row.TableQuestionId" clearable>
<el-option v-for="item of numberQuestions" :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId" /> <el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId" />
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
@ -606,29 +606,8 @@
</el-form-item> </el-form-item>
<!-- 分类 --> <!-- 分类 -->
<el-form-item
v-if="form.Type === 'class'"
:label="$t('trials:readingUnit:qsList:title:ClassifyType')"
prop="ClassifyType"
:rules="[
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
]"
>
<el-radio-group
v-model="form.ClassifyType"
@change="classifyTypeChange"
>
<el-radio
v-for="item of $d.ClassifyType"
:key="item.id"
:label="item.value"
>
{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item <el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 0" v-if="form.Type === 'class'"
:label="$t('trials:readingUnit:label:ClassifyQuestion')" :label="$t('trials:readingUnit:label:ClassifyQuestion')"
prop="ClassifyTableQuestionId" prop="ClassifyTableQuestionId"
:rules="[ :rules="[
@ -636,29 +615,12 @@
]" ]"
> >
<el-select v-model="form.ClassifyTableQuestionId" clearable> <el-select v-model="form.ClassifyTableQuestionId" clearable>
<el-option v-for="item of numberQuestions" :key="item.QuestionId" :label="item.QuestionName" <el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName"
:value="item.QuestionId"/> :value="item.QuestionId"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 1" v-if="form.Type === 'class'"
:label="$t('trials:readingUnit:label:ClassifyQuestion')"
prop="ClassifyTableQuestionId"
:rules="[
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
]"
>
<el-select v-model="form.ClassifyTableQuestionId" clearable @change="classifyTableQuestionChange">
<el-option
v-for="item in selectQuestions"
:key="item.QuestionId"
:label="item.QuestionName"
:value="item.QuestionId"
/>
</el-select>
</el-form-item>
<el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 0"
:label="$t('trials:readingUnit:label:ClassifyAlgorithms')" :label="$t('trials:readingUnit:label:ClassifyAlgorithms')"
prop="ClassifyAlgorithms" prop="ClassifyAlgorithms"
:rules="[ :rules="[
@ -705,51 +667,6 @@
</el-table> </el-table>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item
v-if="form.Type === 'class' && form.ClassifyType === 1"
:label="$t('trials:readingUnit:label:ClassifyAlgorithms')"
prop="ClassifyAlgorithms"
:rules="[
{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
]"
>
<div>
<el-table
ref="CalculateTable"
:data="ClassifyAlgorithmsList"
style="margin: 10px;width: calc(100% - 20px)"
size="small"
>
<!-- 运算类型 -->
<el-table-column
:label="$t('trials:readingUnit:label:label')"
show-overflow-tooltip
min-width="70"
>
<template slot-scope="scope">
{{ scope.row.label }}
</template>
</el-table-column>
<!-- 选项 -->
<el-table-column
:label="$t('trials:readingUnit:label:options')"
show-overflow-tooltip
min-width="128"
>
<template slot-scope="scope">
<el-select v-model="scope.row.val" multiple>
<el-option
v-for="item in classifyQuestionOptions"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
</div>
</el-form-item>
</div> </div>
</div> </div>
@ -847,8 +764,7 @@ export default {
ClassifyAlgorithms: null, ClassifyAlgorithms: null,
ExportIdentification: 0, ExportIdentification: 0,
ExportResult: [], ExportResult: [],
ImageCount: 0, ImageCount: 0
ClassifyType: null
// IsEnable: true // IsEnable: true
}, },
rules: { rules: {
@ -887,15 +803,11 @@ export default {
tblOptions: [], tblOptions: [],
colOptions: [], colOptions: [],
dicList: [], dicList: [],
Questions: [],
tableQuestions: [], tableQuestions: [],
LimitEdit: 0, LimitEdit: 0,
highlightAnswers: [], highlightAnswers: [],
validateTypeVal: null, validateTypeVal: null
numberQuestions: [],
classQuestions: [],
selectQuestions: [],
classifyQuestionOptions: [],
selectedClassifyOptions: []
} }
}, },
watch: { watch: {
@ -921,14 +833,14 @@ export default {
}, },
mounted() { mounted() {
this.validateTypeVal = (rule, value, callback) => { this.validateTypeVal = (rule, value, callback) => {
if (value === '' && this.form.Type !== 'number') { if (value === '') {
callback(new Error(this.$t('common:ruleMessage:specify'))) callback(new Error(this.$t('common:ruleMessage:specify')))
} else { } else {
var arr = value.split('|') var arr = value.split('|')
if (new Set(arr).size !== arr.length) { if (new Set(arr).size !== arr.length) {
// '' // ''
callback(new Error(this.$t('trials:readingUnit:qsList:message:msg0'))) callback(new Error(this.$t('trials:readingUnit:qsList:message:msg0')))
} else if (value && this.form.Type === 'number' && arr.findIndex(i=>isNaN(parseFloat(i)) && i!== 'NE') > -1) { } else if (this.form.Type === 'number' && arr.findIndex(i=>isNaN(parseFloat(i)) && i!== 'NE') > -1) {
callback(new Error(this.$t('trials:readingUnit:qsList:message:msg5'))) callback(new Error(this.$t('trials:readingUnit:qsList:message:msg5')))
} else { } else {
callback() callback()
@ -936,43 +848,10 @@ export default {
} }
} }
this.initForm() this.initForm()
this.getCalculateTableQuestions(['number', 'select', 'radio', 'basicTable']) this.getCalculateTableQuestions('number')
// this.getCalculateTableQuestions('number') this.getCalculateTableQuestions('table')
// this.getCalculateTableQuestions('table')
}, },
methods: { methods: {
async getCalculateTableQuestions(types) {
try {
let params = {
QuestionId: this.readingQuestionId,
typeList: types
}
let res = await getCalculateTableQuestions(params)
if (res.Result) {
this.tableQuestions = res.Result.filter(i=>i.Type === 'basicTable')
this.selectQuestions = res.Result.filter(i=>i.Type === 'select' || i.Type === 'radio')
this.numberQuestions = res.Result.filter(i=>i.Type === 'number')
}
} catch(e) {
console.log(e)
}
},
classifyTypeChange(v) {
this.form.ClassifyTableQuestionId = ''
if (this.ClassifyAlgorithmsList.length === 0 && this.form.TypeValue) {
let list = this.form.TypeValue.split('|')
this.ClassifyAlgorithmsList = list.map((res, i) => {
return this.form.ClassifyType === 0 ? {
label: res.trim(),
lt: 0,
gt: 0
} : {
label: res.trim(),
val: []
}
})
}
},
deleteCustomCalculateMark(index) { deleteCustomCalculateMark(index) {
this.form.CalculateQuestions.splice(index, 1) this.form.CalculateQuestions.splice(index, 1)
}, },
@ -987,22 +866,14 @@ export default {
this.form.DefaultValue = null this.form.DefaultValue = null
var list = v.split('|') var list = v.split('|')
this.form.ClassifyAlgorithms = null this.form.ClassifyAlgorithms = null
if (this.form.ClassifyType === 0) { var arr = Object.assign([], this.ClassifyAlgorithmsList)
this.ClassifyAlgorithmsList = list.map((res, i) => { this.ClassifyAlgorithmsList = list.map((res, i) => {
return { return {
label: res.trim(), label: res,
lt: 0, lt: arr[i] ? arr[i].lt : 0,
gt: 0 gt: arr[i] ? arr[i].gt : 0
} }
}) })
} else if (this.form.ClassifyType === 1) {
this.ClassifyAlgorithmsList = list.map((res, i) => {
return {
label: res.trim(),
val: []
}
})
}
}, },
CustomCalculateMarkChange() { CustomCalculateMarkChange() {
if (this.form.CustomCalculateMark <= 4) { if (this.form.CustomCalculateMark <= 4) {
@ -1027,23 +898,17 @@ export default {
] ]
} }
}, },
// getCalculateTableQuestions(types) { getCalculateTableQuestions(type) {
// getCalculateTableQuestions({ getCalculateTableQuestions({
// QuestionId: this.readingQuestionId, QuestionId: this.readingQuestionId,
// typeList: types type: type
// }).then(res => { }).then(res => {
// if (type === 'table') { if (type === 'table') {
// this.tableQuestions = res.Result this.tableQuestions = res.Result
// } else { } else {
// this.Questions = res.Result this.Questions = res.Result
// } }
// }) })
// },
classifyTableQuestionChange (v){
let obj = this.selectQuestions.find(i=>i.QuestionId === v)
let arr = obj && obj.TypeValue ? obj.TypeValue.split('|') : []
arr = arr.length > 0 ? arr.map(i=>i.trim()) : []
this.classifyQuestionOptions = arr
}, },
async initForm() { async initForm() {
await this.getParentQuestions() await this.getParentQuestions()
@ -1095,9 +960,6 @@ export default {
} }
} }
} }
if (this.form.ClassifyTableQuestionId) {
this.classifyQuestionChange(this.form.ClassifyTableQuestionId)
}
if (!this.data.ShowOrder) { if (!this.data.ShowOrder) {
if (this.list.length > 0) { if (this.list.length > 0) {
var ShowOrderList = this.list.map(v => v.ShowOrder) var ShowOrderList = this.list.map(v => v.ShowOrder)
@ -1258,7 +1120,6 @@ export default {
form.ExportIdentification = 0 form.ExportIdentification = 0
form.ExportResult = [] form.ExportResult = []
form.ImageCount = 0 form.ImageCount = 0
form.ClassifyType = null
}, },
close() { close() {
this.$emit('close') this.$emit('close')