From 9f9a79983257a47450e00753220d00e1c990289b Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Thu, 24 Oct 2024 17:25:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=86=E7=B1=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=A1=A5=E5=85=85=E5=8F=8A=E9=A2=84=E8=A7=88=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CriterionQuestionForm.vue | 4 +- .../template/components/TableQsForm.vue | 4 +- .../components/QuestionFormItem.vue | 155 +++++++----- .../components/QuestionTableFormItem.vue | 59 ++--- .../reading-unit/components/QuestionsForm.vue | 232 +++++++++++++++--- .../components/QuestionsPreview.vue | 67 +++-- .../reading-unit/components/TableQsForm.vue | 199 ++++++++++++--- 7 files changed, 536 insertions(+), 184 deletions(-) diff --git a/src/views/dictionary/template/components/CriterionQuestionForm.vue b/src/views/dictionary/template/components/CriterionQuestionForm.vue index 1497357c..d59218b5 100644 --- a/src/views/dictionary/template/components/CriterionQuestionForm.vue +++ b/src/views/dictionary/template/components/CriterionQuestionForm.vue @@ -642,8 +642,8 @@ prop="ClassifyQuestionId" > - + - + @@ -144,11 +142,7 @@ @@ -173,6 +167,7 @@ @@ -203,10 +198,23 @@ /> + + + {{ item.trim() }} + + { - 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) diff --git a/src/views/trials/trials-panel/setting/reading-unit/components/QuestionTableFormItem.vue b/src/views/trials/trials-panel/setting/reading-unit/components/QuestionTableFormItem.vue index bd172ee6..d152565c 100644 --- a/src/views/trials/trials-panel/setting/reading-unit/components/QuestionTableFormItem.vue +++ b/src/views/trials/trials-panel/setting/reading-unit/components/QuestionTableFormItem.vue @@ -103,10 +103,23 @@ /> + + + {{ item.trim() }} + + { - 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) { // 检测文件类型是否符合要求 diff --git a/src/views/trials/trials-panel/setting/reading-unit/components/QuestionsForm.vue b/src/views/trials/trials-panel/setting/reading-unit/components/QuestionsForm.vue index d5646930..042833b3 100644 --- a/src/views/trials/trials-panel/setting/reading-unit/components/QuestionsForm.vue +++ b/src/views/trials/trials-panel/setting/reading-unit/components/QuestionsForm.vue @@ -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 @@ > @@ -677,13 +681,13 @@ > @@ -762,8 +766,29 @@ + + + + {{ item.label }} + + + - + + + + + + +
+ + + + + + + + + + +
+