自动分类问题补充及预览更改

uat_us
caiyiling 2024-10-24 17:25:34 +08:00
parent f1f27f405b
commit 9f9a799832
7 changed files with 536 additions and 184 deletions

View File

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

View File

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

View File

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

View File

@ -103,10 +103,23 @@
/>
<!-- 自动计算 -->
<el-input
v-if="question.Type==='class'"
v-if="question.Type === 'class' && !question.TypeValue"
v-model="questionForm[question.Id]"
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
v-if="question.Type==='increment'"
@ -240,8 +253,7 @@ export default {
urls: [],
organList: [],
QuestionsList: [],
QuestionsForm: {},
timer: null
QuestionsForm: {}
}
},
computed: {
@ -269,21 +281,7 @@ export default {
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.questionForm[this.question.Id]) {
this.urls = this.questionForm[this.question.Id].split('|')
@ -302,9 +300,6 @@ export default {
this.getOrganInfoList()
}
},
beforeDestroy() {
clearInterval(this.timer)
},
methods: {
save() {
},
@ -326,9 +321,6 @@ export default {
})
},
formItemChange(v, question) {
if (question.Childrens.length > 0) {
this.resetChild(question.Childrens)
}
if (question.TableQuestionType === 1 && question.RelationQuestions.length > 0) {
var index = this.organList.findIndex(item => item[question.DataTableColumn] === v)
if (index < 0) return
@ -340,6 +332,8 @@ export default {
// }
this.$emit('setFormItemData', { key: qs.Id, val: val })
})
} else {
this.$emit('setFormItemData', { key: question.Id, val: v })
}
},
formItemNumberChange(v, question) {
@ -359,21 +353,8 @@ export default {
setFormItemData(obj) {
this.$emit('setFormItemData', obj)
},
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()
uploadScreenshot(param) {
},
handleBeforeUpload(file) {
//

View File

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

View File

@ -27,7 +27,7 @@
<script>
import { getTrialReadingQuestion, getCustomQuestionPreview, getCustomTableQuestionPreview, getQuestionCalculateRelation } from '@/api/trials'
import { getTrialReadingQuestion, getCustomQuestionPreview, getCustomTableQuestionPreview, getQuestionCalculateRelation} from '@/api/trials'
import QuestionFormItem from './QuestionFormItem'
export default {
name: 'QuestionsPreview',
@ -57,7 +57,8 @@ export default {
isRender: false,
readingTaskState: 0,
activeName: 0,
CalculationList: []
CalculationList: [],
classArr: []
}
},
mounted() {
@ -104,8 +105,8 @@ export default {
if (res.OtherInfo.FormType === 2) {
if (res.Result.MultiPage.length > 0) {
res.Result.MultiPage.map((v) => {
if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table') return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table') {
// if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table' && i.Type !== 'basicTable') return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table' && i.Type !== 'basicTable') {
this.$set(this.questionForm, v.Id, v.Answer)
}
if (v.Childrens.length > 0) {
@ -117,10 +118,16 @@ export default {
}
if (res.Result.PublicPage.length > 0) {
res.Result.PublicPage.map((v) => {
if (v.Type === 'group' && v.Childrens.length === 0 && i.Type !== 'table') return
if (!v.IsPage && v.Type !== 'group' && v.Type !== 'summary' && i.Type !== 'table') {
// 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') {
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) {
this.setChild(v.Childrens)
}
@ -129,15 +136,15 @@ export default {
}
} else {
res.Result.SinglePage.map((v) => {
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 !== 'number') {
// 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') {
this.$set(this.questionForm, v.Id, v.Answer)
}
if (i.Type === 'table') {
if (v.Type === 'table') {
this.$set(this.questionForm, v.Id, [])
}
if (i.Type === 'number') {
this.$set(this.questionForm, v.Id, v.Answer)
if (v.Type === 'class') {
this.classArr.push({triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType})
}
if (v.Childrens.length > 0) {
this.setChild(v.Childrens)
@ -151,14 +158,17 @@ export default {
},
setChild(obj) {
obj.forEach(i => {
if (i.Type !== 'group' && i.Type !== 'summary' && i.Id && i.Type !== 'table') {
if (i.Type !== 'group' && i.Type !== 'summary' && i.Id && i.Type !== 'table' && i.Type !== 'basicTable') {
this.$set(this.questionForm, i.Id, i.Answer)
}
if (i.Type === 'table') {
this.$set(this.questionForm, i.Id, [])
}
if (i.Type === 'number') {
this.$set(this.questionForm, i.Id, i.Answer)
// if (i.Type === 'number') {
// 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) {
this.setChild(i.Childrens)
@ -169,7 +179,34 @@ export default {
this.questionForm[v] = ''
},
setFormItemData(obj) {
this.$set(this.questionForm, obj.key, JSON.parse(JSON.stringify(obj.val)))
if (obj.type && obj.type === 'table') {
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">
<el-select v-model="scope.row.TableQuestionId" clearable>
<el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId" />
<el-option v-for="item of numberQuestions" :key="item.QuestionId" :label="item.QuestionName" :value="item.QuestionId" />
</el-select>
</template>
</el-table-column>
@ -606,8 +606,29 @@
</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
v-if="form.Type === 'class'"
v-if="form.Type === 'class' && form.ClassifyType === 0"
:label="$t('trials:readingUnit:label:ClassifyQuestion')"
prop="ClassifyTableQuestionId"
:rules="[
@ -615,12 +636,29 @@
]"
>
<el-select v-model="form.ClassifyTableQuestionId" clearable>
<el-option v-for="item of Questions" :key="item.QuestionId" :label="item.QuestionName"
<el-option v-for="item of numberQuestions" :key="item.QuestionId" :label="item.QuestionName"
:value="item.QuestionId"/>
</el-select>
</el-form-item>
<el-form-item
v-if="form.Type === 'class'"
v-if="form.Type === 'class' && form.ClassifyType === 1"
: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')"
prop="ClassifyAlgorithms"
:rules="[
@ -667,6 +705,51 @@
</el-table>
</div>
</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>
@ -764,7 +847,8 @@ export default {
ClassifyAlgorithms: null,
ExportIdentification: 0,
ExportResult: [],
ImageCount: 0
ImageCount: 0,
ClassifyType: null
// IsEnable: true
},
rules: {
@ -803,11 +887,15 @@ export default {
tblOptions: [],
colOptions: [],
dicList: [],
Questions: [],
tableQuestions: [],
LimitEdit: 0,
highlightAnswers: [],
validateTypeVal: null
validateTypeVal: null,
numberQuestions: [],
classQuestions: [],
selectQuestions: [],
classifyQuestionOptions: [],
selectedClassifyOptions: []
}
},
watch: {
@ -833,14 +921,14 @@ export default {
},
mounted() {
this.validateTypeVal = (rule, value, callback) => {
if (value === '') {
if (value === '' && this.form.Type !== 'number') {
callback(new Error(this.$t('common:ruleMessage:specify')))
} else {
var arr = value.split('|')
if (new Set(arr).size !== arr.length) {
// ''
callback(new Error(this.$t('trials:readingUnit:qsList:message:msg0')))
} else if (this.form.Type === 'number' && arr.findIndex(i=>isNaN(parseFloat(i)) && i!== 'NE') > -1) {
} else if (value && this.form.Type === 'number' && arr.findIndex(i=>isNaN(parseFloat(i)) && i!== 'NE') > -1) {
callback(new Error(this.$t('trials:readingUnit:qsList:message:msg5')))
} else {
callback()
@ -848,10 +936,43 @@ export default {
}
}
this.initForm()
this.getCalculateTableQuestions('number')
this.getCalculateTableQuestions('table')
this.getCalculateTableQuestions(['number', 'select', 'radio', 'basicTable'])
// this.getCalculateTableQuestions('number')
// this.getCalculateTableQuestions('table')
},
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) {
this.form.CalculateQuestions.splice(index, 1)
},
@ -866,14 +987,22 @@ export default {
this.form.DefaultValue = null
var list = v.split('|')
this.form.ClassifyAlgorithms = null
var arr = Object.assign([], this.ClassifyAlgorithmsList)
this.ClassifyAlgorithmsList = list.map((res, i) => {
return {
label: res,
lt: arr[i] ? arr[i].lt : 0,
gt: arr[i] ? arr[i].gt : 0
}
})
if (this.form.ClassifyType === 0) {
this.ClassifyAlgorithmsList = list.map((res, i) => {
return {
label: res.trim(),
lt: 0,
gt: 0
}
})
} else if (this.form.ClassifyType === 1) {
this.ClassifyAlgorithmsList = list.map((res, i) => {
return {
label: res.trim(),
val: []
}
})
}
},
CustomCalculateMarkChange() {
if (this.form.CustomCalculateMark <= 4) {
@ -898,17 +1027,23 @@ export default {
]
}
},
getCalculateTableQuestions(type) {
getCalculateTableQuestions({
QuestionId: this.readingQuestionId,
type: type
}).then(res => {
if (type === 'table') {
this.tableQuestions = res.Result
} else {
this.Questions = res.Result
}
})
// getCalculateTableQuestions(types) {
// getCalculateTableQuestions({
// QuestionId: this.readingQuestionId,
// typeList: types
// }).then(res => {
// if (type === 'table') {
// this.tableQuestions = res.Result
// } else {
// 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() {
await this.getParentQuestions()
@ -960,6 +1095,9 @@ export default {
}
}
}
if (this.form.ClassifyTableQuestionId) {
this.classifyQuestionChange(this.form.ClassifyTableQuestionId)
}
if (!this.data.ShowOrder) {
if (this.list.length > 0) {
var ShowOrderList = this.list.map(v => v.ShowOrder)
@ -1120,6 +1258,7 @@ export default {
form.ExportIdentification = 0
form.ExportResult = []
form.ImageCount = 0
form.ClassifyType = null
},
close() {
this.$emit('close')