From 5b6ef8202f59dfcbb64faeaad16285b1f69ab85d Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Tue, 6 Dec 2022 21:52:19 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B4=20=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D0=BC=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SelectExtSearchDialog.vue | 70 ++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/client/components/Search/SelectExtSearchDialog/SelectExtSearchDialog.vue b/client/components/Search/SelectExtSearchDialog/SelectExtSearchDialog.vue index 5fb14fd..fe00906 100644 --- a/client/components/Search/SelectExtSearchDialog/SelectExtSearchDialog.vue +++ b/client/components/Search/SelectExtSearchDialog/SelectExtSearchDialog.vue @@ -8,12 +8,31 @@ -
+
+
+
+
+ + + {{ search[f.field] }} + + +
+
+
@@ -36,6 +55,15 @@ const componentOptions = { dialogVisible(newValue) { this.$emit('update:modelValue', newValue); }, + extSearch(newValue) { + this.search = newValue; + }, + search: { + handler() { + this.validate(); + }, + deep: true, + }, } }; class SelectExtSearchDialog { @@ -46,6 +74,9 @@ class SelectExtSearchDialog { }; dialogVisible = false; + search = {}; + bgColor = {}; + error = ''; created() { this.commit = this.$store.commit; @@ -54,9 +85,44 @@ class SelectExtSearchDialog { mounted() { } + get config() { + return this.$store.state.config; + } + + get recStruct() { + if (this.config.dbConfig && this.config.dbConfig.inpxInfo.recStruct) + return this.config.dbConfig.inpxInfo.recStruct; + else + return []; + } + + validate() { + const validNumValue = (n) => { + return false; + }; + + let error = []; + const s = this.search; + for (const f of this.recStruct) { + if (f.type == 'N' && s[f.field] && !validNumValue(s[f.field])) { + error.push(`Недопустимое значение поля ${f.field}`); + this.bgColor[f.field] = 'red-2'; + } else { + this.bgColor[f.field] = '';//default + } + } + + this.error = error.join('
'); + } + okClick() { this.dialogVisible = false; } + + apply() { + this.validate(); + this.dialogVisible = false; + } } export default vueComponent(SelectExtSearchDialog);