PageSourceSearch

https://gtdv.ru/_nuxt/DJY8eWlR.js

js gtdv.ru collected 2026-10-07 16:42:37 UTC 5,721 bytes, 1 lines download raw bytes

1import{d as F,n as U,L as V,l as B,w as K,a as Q,c as i,b as e,t as r,h as a,j as q,v as R,H as I,y as z,i as D,F as v,r as P,m as b,u as j,p as A,o as l,q as G}from"./Vt2yMpIO.js";import{_ as H}from"./DlAUqK2U.js";const X={class:"admin-search-queries-page"},Z={class:"admin-page-head"},J={class:"admin-total"},O={class:"admin-filters"},W={key:0,class:"admin-message is-success"},Y={key:1,class:"admin-message is-error"},ee={class:"admin-table-card"},te={key:0,class:"admin-empty"},ne={key:1,class:"admin-empty"},se={class:"admin-query-text"},ae={key:0},oe={class:"admin-query-count"},re={class:"admin-query-results"},ie={class:"admin-query-dates"},le={class:"admin-query-actions"},ue=["disabled","onClick"],de={class:"admin-pagination"},pe=["disabled"],ce=["disabled"],ye=F({__name:"search-queries",async setup(me){let p,w;const c=U(),M=V(),o=B({search:String(c.query.search||""),sort:x(c.query.sort),destination:E(c.query.destination),page:Number(c.query.page||1)}),_=A(()=>({search:o.search||void 0,sort:o.sort==="popular"?void 0:o.sort,destination:o.destination||void 0,page:o.page})),{data:u,pending:S,refresh:f}=([p,w]=K(()=>j("/api/admin/search-queries",{query:_,deep:!1,default:()=>({queries:[],pagination:{page:1,perPage:30,total:0,pages:1}})},"$MQEUsGXZvr")),p=await p,w(),p),d=b(""),y=b(""),m=b("");Q(_,()=>{M.replace({query:{..._.value}})});function g(){o.page=1,f()}function k(s){o.page=Math.max(1,Math.min(s,u.value.pagination.pages)),f()}function C(s){if(!s)return"Без даты";const t=new Date(s);return Number.isNaN(t.getTime())?"Без даты":new Intl.DateTimeFormat("ru-RU",{dateStyle:"short",timeStyle:"short"}).format(t)}function x(s){const t=String(s||"").trim();return t==="recent"?t:"popular"}function E(s){const t=String(s||"").trim();return t==="category"||t==="products"?t:""}function $(s){return s==="category"?"Категория":"Поиск по товарам"}function L(s){return`admin-query-destination admin-query-destination--${s}`}function h(s){return`${s.normalized_query}:${s.destination}`}function N(s){const t=Math.abs(s)%100,n=Math.abs(s)%10;return t>=11&&t<=14?"товаров":n===1?"товар":n>=2&&n<=4?"товара":"товаров"}async function T(s){if(!(d.value||!window.confirm(`Удалить запрос «${s.query}» из статистики (${$(s.destination)})?`))){d.value=h(s),y.value="",m.value="";try{const n=await $fetch("/api/admin/search-queries",{method:"DELETE",body:{normalizedQuery:s.normalized_query,destination:s.destination}});y.value=`Удалено записей: ${n.deleted}.`,u.value.queries.length<=1&&o.page>1&&(o.page-=1),await f()}catch(n){m.value=n?.data?.message||"Не удалось удалить запрос."}finally{d.value=""}}}return(s,t)=>(l(),i("section",X,[e("div",Z,[t[5]||(t[5]=e("div",null,[e("p",null,"Аналитика"),e("h1",null,"Поисковые запросы внутри сайта")],-1)),e("span",J,r(a(u).pagination.total)+" всего",1)]),e("div",O,[q(e("input",{"onUpdate:modelValue":t[0]||(t[0]=n=>a(o).search=n),placeholder:"Поиск по фразе",onKeydown:I(g,["enter"])},null,544),[[R,a(o).search]]),q(e("select",{"onUpdate:modelValue":t[1]||(t[1]=n=>a(o).sort=n),onChange:g},[...t[6]||(t[6]=[e("option",{value:"popular"},"Сначала частые",-1),e("option",{value:"recent"},"Сначала новые",-1)])],544),[[z,a(o).sort]]),q(e("select",{"onUpdate:modelValue":t[2]||(t[2]=n=>a(o).destination=n),onChange:g},[...t[7]||(t[7]=[e("option",{value:""},"Все направления",-1),e("option",{value:"category"},"Категория",-1),e("option",{value:"products"},"Поиск по товарам",-1)])],544),[[z,a(o).destination]]),e("button",{type:"button",onClick:g},"Найти")]),a(y)?(l(),i("p",W,r(a(y)),1)):a(m)?(l(),i("p",Y,r(a(m)),1)):D("",!0),e("div",ee,[t[10]||(t[10]=e("div",{class:"admin-search-query-row admin-search-query-row--head"},[e("span",null,"Запрос"),e("span",null,"Куда ушел"),e("span",null,"Частота"),e("span",null,"Найдено"),e("span",null,"Период"),e("span",null,"Действие")],-1)),a(S)?(l(),i("p",te,"Загружаем поисковые запросы...")):a(u).queries.length?(l(!0),i(v,{key:2},P(a(u).queries,n=>(l(),i("article",{key:h(n),class:"admin-search-query-row admin-search-query-row--item"},[e("span",se,[e("strong",null,r(n.query),1),n.normalized_query!==n.query?(l(),i("small",ae,r(n.normalized_query),1)):D("",!0)]),e("span",null,[e("em",{class:G(L(n.destination))},r($(n.destination)),3)]),e("span",oe,[e("strong",null,r(n.searches_count),1),t[8]||(t[8]=e("small",null,"запросов",-1))]),e("span",re,[n.destination==="products"&&n.result_count!==null?(l(),i(v,{key:0},[e("strong",null,r(n.result_count),1),e("small",null,r(N(n.result_count)),1)],64)):(l(),i(v,{key:1},[t[9]||(t[9]=e("strong",null,"—",-1)),e("small",null,r(n.destination==="products"?"нет данных":"не применяется"),1)],64))]),e("span",ie,[e("strong",null,r(C(n.last_seen_at)),1),e("small",null,"первый: "+r(C(n.first_seen_at)),1)]),e("span",le,[e("button",{type:"button",disabled:!!a(d),onClick:ge=>T(n)},r(a(d)===h(n)?"Удаляем...":"Удалить"),9,ue)])]))),128)):(l(),i("p",ne,"Поисковые запросы не найдены."))]),e("div",de,[e("button",{type:"button",disabled:a(o).page<=1,onClick:t[3]||(t[3]=n=>k(a(o).page-1))},"Назад",8,pe),e("span",null,"Страница "+r(a(u).pagination.page)+" из "+r(a(u).pagination.pages),1),e("button",{type:"button",disabled:a(o).page>=a(u).pagination.pages,onClick:t[4]||(t[4]=n=>k(a(o).page+1))},"Вперед",8,ce)])]))}}),he=H(ye,[["__scopeId","data-v-9ceaf5b8"]]);export{he as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.