From c6c6d9accf57409dad9420c6027cbe573142a199 Mon Sep 17 00:00:00 2001 From: junjun Date: Wed, 21 Sep 2022 14:12:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E9=98=88=E5=80=BC?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BB=8B=E4=BA=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/chart/table/table-info.js | 7 + .../chart/components/normal/LabelNormal.vue | 7 + .../chart/components/senior/Threshold.vue | 122 ++++++++++++------ .../senior/dialog/TableThresholdEdit.vue | 28 +++- .../senior/dialog/TextThresholdEdit.vue | 30 ++++- 5 files changed, 147 insertions(+), 47 deletions(-) diff --git a/frontend/src/views/chart/chart/table/table-info.js b/frontend/src/views/chart/chart/table/table-info.js index ffa5ac370b..1a5e06c06f 100644 --- a/frontend/src/views/chart/chart/table/table-info.js +++ b/frontend/src/views/chart/chart/table/table-info.js @@ -536,6 +536,13 @@ function mappingColor(value, defaultColor, field, type) { color = t[type] flag = true } + } else if (t.term === 'between') { + const min = parseFloat(t.min) + const max = parseFloat(t.max) + if (min <= value && value <= max) { + color = t[type] + flag = true + } } if (flag) { break diff --git a/frontend/src/views/chart/components/normal/LabelNormal.vue b/frontend/src/views/chart/components/normal/LabelNormal.vue index 707f6ca950..7daac33deb 100644 --- a/frontend/src/views/chart/components/normal/LabelNormal.vue +++ b/frontend/src/views/chart/components/normal/LabelNormal.vue @@ -243,6 +243,13 @@ export default { this.label_content_class.color = t.color flag = true } + } else if (t.term === 'between') { + const min = parseFloat(t.min) + const max = parseFloat(t.max) + if (min <= value && value <= max) { + this.label_content_class.color = t.color + flag = true + } } if (flag) { break diff --git a/frontend/src/views/chart/components/senior/Threshold.vue b/frontend/src/views/chart/components/senior/Threshold.vue index dae3a65bb4..c3e0950d11 100644 --- a/frontend/src/views/chart/components/senior/Threshold.vue +++ b/frontend/src/views/chart/components/senior/Threshold.vue @@ -32,18 +32,22 @@ /> - + {{ $t('chart.filter_eq') }} {{ $t('chart.filter_not_eq') }} {{ $t('chart.filter_lt') }} {{ $t('chart.filter_gt') }} {{ $t('chart.filter_le') }} {{ $t('chart.filter_ge') }} + {{ $t('chart.filter_between') }} - - {{ item.value }} + + {{ item.value }} + + {{ item.min }} ≤{{ $t('chart.drag_block_label_value') }}≤ {{ item.max }} + - + @@ -81,6 +85,7 @@ {{ $t('chart.filter_gt') }} {{ $t('chart.filter_le') }} {{ $t('chart.filter_ge') }} + {{ $t('chart.filter_between') }} {{ $t('chart.filter_like') }} {{ $t('chart.filter_not_like') }} {{ $t('chart.filter_null') }} @@ -88,14 +93,17 @@ {{ $t('chart.filter_empty') }} {{ $t('chart.filter_not_empty') }} - - {{ item.value }} + + {{ item.value }} + + {{ item.min }} ≤{{ $t('chart.drag_block_label_value') }}≤ {{ item.max }} +   - + - + @@ -250,21 +258,40 @@ export default { }) return } - if (!ele.value) { - this.$message({ - message: this.$t('chart.value_can_not_empty'), - type: 'error', - showClose: true - }) - return - } - if (parseFloat(ele.value).toString() === 'NaN') { - this.$message({ - message: this.$t('chart.value_error'), - type: 'error', - showClose: true - }) - return + if (ele.term === 'between') { + if (!ele.min || !ele.max) { + this.$message({ + message: this.$t('chart.value_can_not_empty'), + type: 'error', + showClose: true + }) + return + } + if (parseFloat(ele.min).toString() === 'NaN' || parseFloat(ele.max).toString() === 'NaN') { + this.$message({ + message: this.$t('chart.value_error'), + type: 'error', + showClose: true + }) + return + } + } else { + if (!ele.value) { + this.$message({ + message: this.$t('chart.value_can_not_empty'), + type: 'error', + showClose: true + }) + return + } + if (parseFloat(ele.value).toString() === 'NaN') { + this.$message({ + message: this.$t('chart.value_error'), + type: 'error', + showClose: true + }) + return + } } } this.thresholdForm.labelThreshold = JSON.parse(JSON.stringify(this.thresholdArr)) @@ -314,21 +341,40 @@ export default { }) return } - if (!ele.term.includes('null') && !ele.term.includes('empty') && !ele.value) { - this.$message({ - message: this.$t('chart.value_can_not_empty'), - type: 'error', - showClose: true - }) - return - } - if ((field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && parseFloat(ele.value).toString() === 'NaN') { - this.$message({ - message: this.$t('chart.value_error'), - type: 'error', - showClose: true - }) - return + if (ele.term === 'between') { + if (!ele.term.includes('null') && !ele.term.includes('empty') && (!ele.min || !ele.max)) { + this.$message({ + message: this.$t('chart.value_can_not_empty'), + type: 'error', + showClose: true + }) + return + } + if ((field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && (parseFloat(ele.min).toString() === 'NaN' || parseFloat(ele.max).toString() === 'NaN')) { + this.$message({ + message: this.$t('chart.value_error'), + type: 'error', + showClose: true + }) + return + } + } else { + if (!ele.term.includes('null') && !ele.term.includes('empty') && !ele.value) { + this.$message({ + message: this.$t('chart.value_can_not_empty'), + type: 'error', + showClose: true + }) + return + } + if ((field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) && parseFloat(ele.value).toString() === 'NaN') { + this.$message({ + message: this.$t('chart.value_error'), + type: 'error', + showClose: true + }) + return + } } } } diff --git a/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue b/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue index 82df8aa7f8..84ff33682a 100644 --- a/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue +++ b/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue @@ -58,9 +58,9 @@ - + + + + ≤{{ $t('chart.drag_block_label_value') }}≤ + + {{ $t('chart.textColor') }} @@ -89,7 +94,7 @@ @change="changeThreshold" /> - + - - + + + + + ≤{{ $t('chart.drag_block_label_value') }}≤ + + - + - + @@ -51,7 +56,9 @@ export default { term: 'eq', field: '0', value: '0', - color: '#ff0000ff' + color: '#ff0000ff', + min: '0', + max: '1' }, valueOptions: [ { @@ -83,6 +90,13 @@ export default { value: 'ge', label: this.$t('chart.filter_ge') }] + }, + { + label: '', + options: [{ + value: 'between', + label: this.$t('chart.filter_between') + }] } ], predefineColors: COLOR_PANEL @@ -137,6 +151,12 @@ span { width: 200px !important; } +.between-item { + position: relative; + display: inline-block; + width: 100px !important; +} + .select-item { position: relative; display: inline-block;