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);