From 067162e1d7191f839684bef453d1a8fce0a1af7a Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Tue, 4 Mar 2025 11:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A0=87=E5=87=86?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customize/CustomizeQuestionFormItem.vue | 17 ++++++++-------- .../CustomizeQuestionTableFormItem.vue | 20 +++++++++++-------- .../customize/CustomizeQuestionsPreview.vue | 13 +++++++----- .../dicoms/customize/CustomizeReportPage.vue | 17 ++++++++-------- 4 files changed, 37 insertions(+), 30 deletions(-) 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 a4cf6cba..cd50ebf9 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue @@ -227,8 +227,7 @@ type="number" v-if="question.Type === 'number' && question.DataSource !== 1" @change="(val) => { formItemNumberChange(val, question) }" - onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')));" - @input="limitInput($event, questionForm, question.Id)" + @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" v-model="questionForm[question.Id]" > @@ -237,8 +236,7 @@ @@ -396,7 +394,7 @@ export default { loading: false, RowIndex: 0, RowId: null, - digitPlaces: 0, + digitPlaces: 2, CalculationTabelList: [], classArr: [] } @@ -424,7 +422,8 @@ export default { }, }, mounted() { - this.digitPlaces = localStorage.getItem('digitPlaces') ? parseInt(localStorage.getItem('digitPlaces')) : 0 + var digitPlaces = Number(localStorage.getItem('digitPlaces')) + this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces // if (this.question.Type === 'class') { // this.ClassifyAlgorithmsList = JSON.parse(this.question.ClassifyAlgorithms) // } @@ -471,6 +470,9 @@ export default { } } }, + handleBlur(value, a, b) { + this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) + }, deleteTableCol(row, index) { this.$confirm(this.$t('trials:uploadNonDicoms:message:msg1')).then(() => { const loading = this.$loading({ fullscreen: true }) @@ -728,14 +730,13 @@ export default { } catch (e) { console.log(e) } - var digitPlaces = parseInt(localStorage.getItem('digitPlaces')) if (rules.ValueType === 2) { num = num * 100 } if (rules.CustomCalculateMark === 13 || rules.CustomCalculateMark === 14) { return num } else { - return num.toFixed(digitPlaces) + return num.toFixed(this.digitPlaces) } }, 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 8c1ad2cf..3163f2c9 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue @@ -148,8 +148,7 @@ v-if="question.Type === 'number' && question.DataSource !== 1" :disabled="question.TableQuestionType === 2 || (question.IsCopy && type === 'edit' && !IsBaseline && questionForm.IsCurrentTaskAdd === 'False')" @change="((val)=>{formItemNumberChange(val, question)})" - onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')))" - @input="limitInput($event, question)" + @blur="handleBlur(questionForm[question.Id], questionForm, question.Id)" v-model="questionForm[question.Id]" > @@ -158,8 +157,7 @@ type="number" v-if="question.Type === 'number' && question.DataSource === 1" :disabled="question.DataSource === 1" - onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')))" - @input="limitInput($event, question)" + @blur="handleCalculationBlur(calculationValue)" v-model="calculationValue" > @@ -297,7 +295,7 @@ export default { organList: [], QuestionsList: [], QuestionsForm: {}, - digitPlaces: 0 + digitPlaces: 2 } }, // watch: { @@ -323,7 +321,8 @@ export default { }, }, mounted() { - this.digitPlaces = localStorage.getItem('digitPlaces') ? parseInt(localStorage.getItem('digitPlaces')) : 0 + var digitPlaces = Number(localStorage.getItem('digitPlaces')) + this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces if (this.question.Type === 'upload') { if (this.questionForm[this.question.Id]) { this.urls = this.questionForm[this.question.Id].split('|') @@ -382,6 +381,12 @@ export default { this.$emit('setFormItemData', { key: question.Id, val: v, question: question }) } }, + handleBlur(value, a, b) { + this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) + }, + handleCalculationBlur(v) { + this.calculationValue = parseFloat(v).toFixed(this.digitPlaces) + }, limitInput(value, q) { console.log(value) if (value.indexOf('.') > -1) { @@ -477,11 +482,10 @@ export default { } catch (e) { console.log(e) } - var digitPlaces = parseInt(localStorage.getItem('digitPlaces')) if (rules.ValueType === 2) { num = num * 100 } - return num.toFixed(digitPlaces) + return num.toFixed(this.digitPlaces) }, formItemNumberChange(v, question) { this.$emit('formItemTableNumberChange', v, question) 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 c30b8a6a..b79a570e 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue @@ -58,10 +58,13 @@ export default { activeName: 0, CalculationList: [], IsBaseline: true, - classArr: [] + classArr: [], + digitPlaces: 2 } }, mounted() { + var digitPlaces = Number(localStorage.getItem('digitPlaces')) + this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces this.getQuestionCalculateRelation() // this.getCustomTableQuestionAnswer() DicomEvent.$on('reGetQuestionAnswer', () => { @@ -133,7 +136,7 @@ export default { 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'))) + this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces)) } if (v.Childrens.length > 0) { this.setChild(v.Childrens) @@ -187,7 +190,7 @@ export default { this.$set(this.questionForm, v.Id, v.TableQuestions.Answers) } if (v.Type === 'number') { - this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(localStorage.getItem('digitPlaces'))) + this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces)) } if (v.Childrens.length > 0) { this.setChild(v.Childrens) @@ -208,7 +211,7 @@ export default { i.TableQuestions.Questions.forEach(o => { if (o.Type === 'number') { i.TableQuestions.Answers.forEach((ite, index) => { - this.$set(i.TableQuestions.Answers[index], o.Id, i.TableQuestions.Answers[index][o.Id] ? parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(localStorage.getItem('digitPlaces')) : null) + this.$set(i.TableQuestions.Answers[index], o.Id, i.TableQuestions.Answers[index][o.Id] ? parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces) : null) }) } }) @@ -218,7 +221,7 @@ export default { 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'))) + this.$set(this.questionForm, i.Id, i.Answer === '' ? '' : parseFloat(i.Answer).toFixed(this.digitPlaces)) } if (i.Childrens && i.Childrens.length > 0) { this.setChild(i.Childrens) 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 e6cf41c5..7a324817 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeReportPage.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeReportPage.vue @@ -148,7 +148,7 @@ v-else-if="scope.row.DataSource !== 1 && questionForm[scope.row.QuestionId] instanceof Array && scope.row.Type==='number' && (scope.row.xfIndex || scope.row.xfIndex === 0) && !scope.row.IsShowInDicom && ((task.IsBaseLine && scope.row.LimitEdit === 1) || (!task.IsBaseLine && scope.row.LimitEdit === 2) || scope.row.LimitEdit === 0)" v-model="questionForm[scope.row.QuestionId][scope.row.xfIndex][scope.row.TableQuestionId]" :disabled="scope.row.DataSource === 1" - onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')))" + @blur="value=parseFloat(value).toFixed(digitPlaces)" @input="limitInput($event, questionForm[scope.row.QuestionId][scope.row.xfIndex], scope.row.TableQuestionId)" size="mini" @focus="() => {questionId = scope.row.QuestionId}" @@ -171,7 +171,7 @@ v-else-if="scope.row.DataSource !== 1 && scope.row.Type==='number' && !scope.row.IsShowInDicom && ((task.IsBaseLine && scope.row.LimitEdit === 1) || (!task.IsBaseLine && scope.row.LimitEdit === 2) || scope.row.LimitEdit === 0)" v-model="questionForm[scope.row.QuestionId]" :disabled="scope.row.DataSource === 1" - onblur="value=parseFloat(value).toFixed(parseInt(localStorage.getItem('digitPlaces')))" + @blur="value=parseFloat(value).toFixed(digitPlaces)" @input="limitInput($event, questionForm, scope.row.QuestionId)" size="mini" @focus="() => {questionId = scope.row.QuestionId}" @@ -314,7 +314,8 @@ export default { TrialReadingCriterionId: null, tableAnswers: {}, questionForm: {}, - questionId: null + questionId: null, + digitPlaces: 2 } }, watch: { @@ -337,7 +338,8 @@ export default { }, async mounted() { this.CriterionType = parseInt(localStorage.getItem('CriterionType')) - this.digitPlaces = parseInt(localStorage.getItem('digitPlaces')) + let digitPlaces = Number(localStorage.getItem('digitPlaces')) + this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces this.TrialReadingCriterionId = this.$route.query.TrialReadingCriterionId window.addEventListener('resize', () => { this.handleResize() @@ -359,7 +361,6 @@ export default { if (value.split('.')[1].length >= this.digitPlaces) { this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) } - } else { } }, setImageUrl(qid, index, tqid, url, RowId) { @@ -552,11 +553,10 @@ export default { } catch (e) { console.log(e) } - var digitPlaces = parseInt(localStorage.getItem('digitPlaces')) if (rules.ValueType === 2) { num = num * 100 } - return isNaN(num) ? '' : isFinite(num) ? num.toFixed(digitPlaces) : '∞' + return isNaN(num) ? '' : isFinite(num) ? num.toFixed(this.digitPlaces) : '∞' }, getReportInfo() { this.loading = true @@ -647,14 +647,13 @@ export default { } } } - var digitPlaces = parseInt(localStorage.getItem('digitPlaces')) || 0 item.Answer.forEach(i => { if (item.DictionaryCode) { this.$set(obj.Answers, i.VisitTaskId, i.Answer ? parseInt(i.Answer) : null) // obj.Answers[i.VisitTaskId] = i.Answer ? parseInt(i.Answer) : null } else { if (item.Type === 'number') { - this.$set(obj.Answers, i.VisitTaskId, isNaN(parseFloat(i.Answer)) ? i.Answer : parseFloat(i.Answer).toFixed(digitPlaces)) + this.$set(obj.Answers, i.VisitTaskId, isNaN(parseFloat(i.Answer)) ? i.Answer : parseFloat(i.Answer).toFixed(this.digitPlaces)) } else { this.$set(obj.Answers, i.VisitTaskId, i.Answer) }