diff --git a/src/views/dictionary/template/components/CriterionQuestionForm.vue b/src/views/dictionary/template/components/CriterionQuestionForm.vue index 08a6338f..8cb54177 100644 --- a/src/views/dictionary/template/components/CriterionQuestionForm.vue +++ b/src/views/dictionary/template/components/CriterionQuestionForm.vue @@ -1091,11 +1091,7 @@ export default { if (val !== 'select' && val !== 'radio') { data.IsJudgeQuestion = false } - if (val === 'table' || val === 'basicTable') { - data.IsRequired = 2 - } else { - data.LesionType = null - } + if (val === 'number' || val === 'calculation') { data.Unit = 0 } else { @@ -1106,6 +1102,8 @@ export default { } else { data.MaxAnswerLength = null } + data.IsRequired = 2 + data.LesionType = null data.QuestionGenre = null data.DictionaryCode = '' data.TypeValue = '' diff --git a/src/views/dictionary/template/components/TableQsForm.vue b/src/views/dictionary/template/components/TableQsForm.vue index cd02568c..33cae748 100644 --- a/src/views/dictionary/template/components/TableQsForm.vue +++ b/src/views/dictionary/template/components/TableQsForm.vue @@ -583,7 +583,7 @@ export default { ParentTriggerValue: '', ShowOrder: 0, ShowQuestion: 0, - IsRequired: true, + IsRequired: 2, Remark: '', RelevanceId: '', RelevanceValue: '', @@ -875,7 +875,7 @@ export default { } form.TypeValue = '' form.ValueType = '' - + form.IsRequired = 2 form.TableQuestionType = null form.DependParentId = '' form.DataTableColumn = '' diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue index bcf50bb6..126c8af8 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue @@ -120,9 +120,9 @@ @@ -135,10 +135,10 @@ > - {{ val }} + {{ val.trim() }} @@ -149,17 +149,30 @@ - {{ val }} + {{ val.trim() }} + + + {{ item.trim() }} + + @@ -387,7 +399,8 @@ export default { RowIndex: 0, RowId: null, digitPlaces: 0, - CalculationTabelList: [] + CalculationTabelList: [], + classArr: [] } }, watch: { @@ -395,31 +408,31 @@ export default { deep: true, immediate: true, handler(v, oldv) { - try { - if (!v[this.question.Id] || !oldv[this.question.Id]) return - } catch (e) { - } - this.formItemNumberChange(this.question.Id, false) + // try { + // if (!v[this.question.Id] || !oldv[this.question.Id]) return + // } catch (e) { + // } + // this.formItemNumberChange(this.question.Id, false) } }, }, mounted() { this.digitPlaces = localStorage.getItem('digitPlaces') ? parseInt(localStorage.getItem('digitPlaces')) : 0 - if (this.question.Type === 'class') { - this.ClassifyAlgorithmsList = JSON.parse(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) + // if (this.question.Type === 'class') { + // this.ClassifyAlgorithmsList = JSON.parse(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) if (this.question.Type === 'upload') { if (this.questionForm[this.question.Id]) { this.urls = this.questionForm[this.question.Id].split('|') @@ -474,8 +487,32 @@ export default { }) }, - setFormTableItemData(id, url) { - this.$set(this.QuestionsForm, id, url) + setFormTableItemData(obj) { + 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) + } + }, + resetTableFormItemData(obj) { + this.$set(this.QuestionsForm, obj.key, null) }, handleSave() { console.log(this.QuestionsForm) @@ -556,9 +593,10 @@ export default { if (rules.CalculateQuestionList.length === 0) { return false } + let dataArr = [] rules.CalculateQuestionList.forEach((o, i) => { if (i === 0) { - if (rules.CustomCalculateMark > 4) { + if (rules.CustomCalculateMark > 4 && rules.CustomCalculateMark < 10) { switch (rules.CustomCalculateMark) { case 5: this.questionForm[o.QuestionId].forEach((q, qi) => { @@ -605,6 +643,7 @@ export default { } } else { num = parseFloat(this.questionForm[o.TableQuestionId]) + dataArr.push(num) } } else { switch (rules.CustomCalculateMark) { @@ -624,6 +663,26 @@ export default { num /= parseFloat(this.questionForm[o.TableQuestionId]) } break; + case 10: + if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { + dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) + } + num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => { + return acc + (typeof curr === "number" ? curr : 0); + }, 0) / dataArr.length; + break; + case 11: + if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { + dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) + } + num = Math.max(...dataArr); + break; + case 12: + if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { + dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) + } + num = Math.min(...dataArr); + break; } } }) @@ -700,6 +759,11 @@ export default { this.addOrEdit.visible = true this.addOrEdit.title = row.QuestionName + this.$t('trials:readingUnit:qsList:title:tableQs') this.QuestionsList = row.TableQuestions.Questions + row.TableQuestions.Questions.map(v=>{ + if (v.Type === 'class') { + this.classArr.push({triggerId: v.ClassifyTableQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType}) + } + }) this.AnswersList = row.TableQuestions.Answers if (!index && index !== 0) { this.addOrEdit.type = 'add' @@ -739,6 +803,8 @@ export default { // } this.$emit('setFormItemData', { key: qs.Id, val: val }) }) + } else { + this.$emit('setFormItemData', { key: question.Id, val: v }) } }, resetChild(obj) { @@ -754,6 +820,7 @@ export default { }, setFormItemData(obj) { this.$emit('setFormItemData', obj) + }, async uploadScreenshot(param) { console.log('uploadScreenshot') diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue index 501f72dc..ac62347e 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue @@ -95,7 +95,25 @@ {{ val }} - + + + + + {{ item.trim() }} + + { - if (rules.CustomCalculateMark > 4) { + if (rules.CustomCalculateMark > 4 && rules.CustomCalculateMark < 10) { if (i !== 0) { switch (rules.CustomCalculateMark) { case 7: @@ -391,6 +412,7 @@ export default { minList.push(this.questionForm[o.TableQuestionId]) count = parseFloat(this.questionForm[o.TableQuestionId]) num = parseFloat(this.questionForm[o.TableQuestionId]) + dataArr.push(num) } } else { if (i !== 0) { @@ -411,6 +433,26 @@ export default { num /= parseFloat(this.questionForm[o.TableQuestionId]) } break; + case 10: + if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { + dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) + } + num = dataArr.length === 0 ? 0 : dataArr.reduce((acc, curr) => { + return acc + (typeof curr === "number" ? curr : 0); + }, 0) / dataArr.length; + break; + case 11: + if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { + dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) + } + num = Math.max(...dataArr); + break; + case 12: + if (!isNaN(parseFloat(this.questionForm[o.TableQuestionId]))) { + dataArr.push(parseFloat(this.questionForm[o.TableQuestionId])) + } + num = Math.min(...dataArr); + break; } } else { num = parseFloat(this.questionForm[o.TableQuestionId]) @@ -427,7 +469,6 @@ export default { return num.toFixed(digitPlaces) }, formItemNumberChange(v, question) { - console.log(this.CalculationList) this.CalculationList.forEach((v, i) => { console.log('v', v) var find = v.CalculateQuestionList.filter(o => { @@ -476,7 +517,7 @@ export default { console.log(res) this.fileList.push({ name: param.file.name, path: this.$getObjectName(res.url), url: this.$getObjectName(res.url)}) this.urls.push(this.$getObjectName(res.url)) - this.$emit('setFormTableItemData', this.question.Id, this.urls.length > 0 ? this.urls.join('|') : '') + this.$emit('setFormItemData', { key:this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' }) loading.close() }, handleBeforeUpload(file) { @@ -516,7 +557,7 @@ export default { this.imageUrl = '' this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1) this.urls.splice(this.fileList.findIndex(f => f === file.url), 1) - this.$emit('setFormTableItemData', this.question.Id, this.urls.length > 0 ? this.urls.join('|') : '') + this.$emit('setFormItemData', { key:this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' }) } } } diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue index 7d87e083..42c232b0 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue @@ -57,7 +57,8 @@ export default { readingTaskState: 0, activeName: 0, CalculationList: [], - IsBaseline: true + IsBaseline: true, + classArr: [] } }, mounted() { @@ -128,6 +129,9 @@ export default { if (v.Type === 'table' || v.Type === 'basicTable') { this.$set(this.questionForm, v.Id, v.TableQuestions.Answers) } + if (v.Type === 'class') { + this.classArr.push({triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType}) + } if (v.Type === 'number') { this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(localStorage.getItem('digitPlaces'))) } @@ -136,7 +140,6 @@ export default { } }) this.questions = res.Result.SinglePage - console.log(this.questions) this.isRender = true this.loading = false }) @@ -211,6 +214,9 @@ export default { }) this.$set(this.questionForm, i.Id, i.TableQuestions.Answers) } + if (i.Type === 'class') { + this.classArr.push({triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType}) + } if (i.Type === 'number') { this.$set(this.questionForm, i.Id, i.Answer === '' ? '' : parseFloat(i.Answer).toFixed(localStorage.getItem('digitPlaces'))) } @@ -224,6 +230,28 @@ export default { }, setFormItemData(obj) { 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.trim() : null + } + console.log(this.questionForm, qs.classId, answer) + this.$set(this.questionForm, qs.classId, answer) + } } } } diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeReportPage.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeReportPage.vue index 559efb2d..49fa39f1 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeReportPage.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeReportPage.vue @@ -80,7 +80,7 @@