Procházet zdrojové kódy

Работа над расширенным поиском

Book Pauk před 2 roky
rodič
revize
d32375d4e4

+ 55 - 1
client/components/Search/Search.vue

@@ -192,7 +192,7 @@
                     <q-input
                         v-model="extSearchNames"
                         class="col q-mt-xs" :bg-color="inputBgColor('extended')" input-style="cursor: pointer"
-                        style="min-width: 200px; max-width: 752px;" label="Расширенный поиск" stack-label outlined dense clearable readonly
+                        style="min-width: 200px; max-width: 638px;" label="Расширенный поиск" stack-label outlined dense clearable readonly
                         @click.stop.prevent="selectExtSearch"
                     >
                         <template v-if="extSearchNames" #append>
@@ -204,6 +204,54 @@
                         </q-tooltip>
                     </q-input>
 
+                    <div class="q-mx-xs" />
+                    <DivBtn
+                        class="text-grey-8 bg-yellow-1 q-mt-xs" :size="30" round
+                        :disabled="!extSearch.author"
+                        @me-click="extToList('author')"
+                    >
+                        <div style="font-size: 130%">
+                            <b>А</b>
+                        </div>
+                        <template #tooltip>
+                            <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
+                                В раздел "Авторы" с переносом значения author={{ extSearch.author }}
+                            </q-tooltip>
+                        </template>
+                    </DivBtn>
+
+                    <div class="q-mx-xs" />
+                    <DivBtn
+                        class="text-grey-8 bg-yellow-1 q-mt-xs" :size="30" round
+                        :disabled="!extSearch.series"
+                        @me-click="extToList('series')"
+                    >
+                        <div style="font-size: 130%">
+                            <b>С</b>
+                        </div>
+                        <template #tooltip>
+                            <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
+                                В раздел "Серии" с переносом значения series={{ extSearch.series }}
+                            </q-tooltip>
+                        </template>
+                    </DivBtn>
+
+                    <div class="q-mx-xs" />
+                    <DivBtn
+                        class="text-grey-8 bg-yellow-1 q-mt-xs" :size="30" round
+                        :disabled="!extSearch.title"
+                        @me-click="extToList('title')"
+                    >
+                        <div style="font-size: 130%">
+                            <b>К</b>
+                        </div>
+                        <template #tooltip>
+                            <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
+                                В раздел "Книги" с переносом значения title={{ extSearch.title }}
+                            </q-tooltip>
+                        </template>
+                    </DivBtn>
+
                     <div class="q-mx-xs" />
                     <DivBtn
                         class="text-grey-8 bg-yellow-1 q-mt-xs" :size="30" :icon-size="24" round
@@ -1114,6 +1162,12 @@ class Search {
         window.open(window.location.href, '_blank');
     }
 
+    extToList(list) {
+        if (this.extSearch[list])
+            this.search[list] = this.extSearch[list];
+        this.selectedList = list;
+    }
+
     async logout() {
         await this.api.logout();
     }

+ 2 - 2
client/components/Search/SelectExtSearchDialog/SelectExtSearchDialog.vue

@@ -25,7 +25,7 @@
                         class="q-mt-xs" style="width: 150px;" :label="`(${f.type}) ${f.field}`"
                         :bg-color="bgColor[f.field] || 'white'"
                         stack-label outlined dense clearable
-                        @keypress="onKeyPress"
+                        @keydown="onKeyDown"
                     >
                         <q-tooltip v-if="search[f.field]" :delay="500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
                             {{ search[f.field] }}
@@ -177,7 +177,7 @@ class SelectExtSearchDialog {
         this.$root.stdDialog.alert(info, 'Памятка', {iconName: 'la la-info-circle'});
     }
 
-    onKeyPress(event) {
+    onKeyDown(event) {
         if (event.code == 'Enter')
             this.apply();
     }

+ 9 - 3
client/components/share/DivBtn.vue

@@ -1,5 +1,5 @@
 <template>
-    <div ref="btn" class="button clickable row justify-center items-center" @click="clickEffect">
+    <div ref="btn" class="button clickable row justify-center items-center" :class="{disabled}" @click.stop.prevent="clickEffect">
         <div class="row justify-center items-center no-wrap" :class="{'button-pressed': pressed}">
             <i :class="icon" :style="`font-size: ${iconSize}px; margin-top: ${imt}px`" />
             <slot></slot>
@@ -29,8 +29,9 @@ class DivBtn {
         height: { type: Number, default: 0 },
         icon: { type: String, default: '' },
         iconSize: { type: Number, default: 14 },
-        round: { type: Boolean },
+        round: Boolean,
         imt:  { type: Number, default: 0 },// icon margin top
+        disabled: Boolean,
     };
 
     pressed = false;
@@ -57,7 +58,12 @@ class DivBtn {
             style.borderRadius = `${this.size/10}px`;
     }
 
-    async clickEffect() {
+    async clickEffect(event) {
+        if (this.disabled) {
+            return;
+        }
+
+        this.$emit('meClick', event);
         this.pressed = true;
         await utils.sleep(100);
         this.pressed = false;