全栈小学生 a0528dc947 update admin
2023-06-21 18:37:59 +08:00

2 lines
6.1 KiB
JavaScript

import{g as S,a4 as j,r as k,m as p,n as g,F as a,E as r,q as c,L as n,u as l,K as u,I as R,J as U,D as h,a1 as q,T as b}from"./base-d2ce4248.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./index-057b5f2c.js";import"./el-tooltip-58212670.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{t}from"./index-578c83eb.js";import{f as J,j as K,k as M}from"./article-fff730f4.js";import{d as O}from"./storage-e62e496d.js";import{u as G,a as H}from"./vue-router-d3dc2686.js";import{E as Q}from"./index-faa3f8c5.js";import{E as W}from"./index-953c712f.js";import{E as X}from"./index-9997ff5d.js";import{a as Y,E as Z}from"./index-f579a83b.js";import{a as ee,E as te}from"./index-83fe4dc1.js";import{E as ae}from"./index-32160c2f.js";import{a as le,E as oe}from"./index-d4538bff.js";import{E as re}from"./index-3ae544fb.js";import{E as ie}from"./index-aaab07eb.js";import{v as ne}from"./directive-3f066692.js";import"./el-overlay-7451f13b.js";import"./event-f83e96f5.js";import"./index-28969730.js";import"./focus-trap-b41dd321.js";import"./el-radio-b620ac73.js";import"./index-758a5fe7.js";import"./index-92c8bc76.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./el-avatar-4397f45a.js";import"./index-3118dac6.js";import"./common-dd6d00bb.js";import"./common-2cf17469.js";import"./_Uint8Array-6ca580e8.js";import"./_initCloneObject-5fe9c070.js";import"./index-0ba64799.js";import"./strings-986fee93.js";import"./isEqual-51ec1a47.js";import"./index-13c7facf.js";import"./flatten-2fc24abf.js";import"./_isIterateeCall-9ac2a284.js";const se={class:"main-container"},me={class:"flex justify-between items-center"},pe={class:"text-[24px]"},ce={class:"mt-[10px]"},de=["href"],ue={key:0},_e={key:1},ge={class:"mt-[16px] flex justify-end"},gt=S({__name:"list",setup(fe){const C=G().meta.title,o=j({page:1,limit:10,total:0,loading:!0,data:[],searchParam:{title:"",category_id:""}}),v=k([]),y=k();(async()=>{v.value=await(await J({})).data})();const d=(s=1)=>{o.loading=!0,o.page=s,K({page:o.page,limit:o.limit,...o.searchParam}).then(i=>{o.loading=!1,o.data=i.data.data,o.total=i.data.total}).catch(()=>{o.loading=!1})};d();const w=H(),P=()=>{w.push("/article/edit")},V=s=>{w.push(`/article/edit?id=${s.id}`)},T=s=>{Q.confirm(t("articleDeleteTips"),t("warning"),{confirmButtonText:t("confirm"),cancelButtonText:t("cancel"),type:"warning"}).then(()=>{M(s).then(()=>{d()}).catch(()=>{})})},B=s=>{s&&(s.resetFields(),d())};return(s,i)=>{const _=W,F=X,f=Y,E=ee,L=te,D=Z,x=ae,m=le,I=re,N=oe,z=ie,A=ne;return p(),g("div",se,[a(x,{class:"box-card !border-none",shadow:"never"},{default:r(()=>[c("div",me,[c("span",pe,n(l(C)),1),a(_,{type:"primary",class:"w-[100px]",onClick:P},{default:r(()=>[u(n(l(t)("addArticle")),1)]),_:1})]),a(x,{class:"box-card !border-none my-[10px] table-search-wrap",shadow:"never"},{default:r(()=>[a(D,{inline:!0,model:o.searchParam,ref_key:"searchFormRef",ref:y},{default:r(()=>[a(f,{label:l(t)("title"),prop:"title"},{default:r(()=>[a(F,{modelValue:o.searchParam.title,"onUpdate:modelValue":i[0]||(i[0]=e=>o.searchParam.title=e),placeholder:l(t)("titlePlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:l(t)("categoryName"),prop:"category_id"},{default:r(()=>[a(L,{modelValue:o.searchParam.category_id,"onUpdate:modelValue":i[1]||(i[1]=e=>o.searchParam.category_id=e),clearable:"",placeholder:l(t)("categoryIdPlaceholder"),class:"input-width"},{default:r(()=>[a(E,{label:l(t)("selectPlaceholder"),value:""},null,8,["label"]),(p(!0),g(R,null,U(v.value,e=>(p(),h(E,{label:e.name,value:e.category_id},null,8,["label","value"]))),256))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[a(_,{type:"primary",onClick:i[2]||(i[2]=e=>d())},{default:r(()=>[u(n(l(t)("search")),1)]),_:1}),a(_,{onClick:i[3]||(i[3]=e=>B(y.value))},{default:r(()=>[u(n(l(t)("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),c("div",ce,[q((p(),h(N,{data:o.data,size:"large"},{empty:r(()=>[c("span",null,n(o.loading?"":l(t)("emptyData")),1)]),default:r(()=>[a(m,{prop:"id","show-overflow-tooltip":!0,label:l(t)("ID"),width:"100"},null,8,["label"]),a(m,{prop:"category_name",label:l(t)("categoryName"),width:"120"},null,8,["label"]),a(m,{prop:"title","show-overflow-tooltip":!0,label:l(t)("title"),width:"180"},{default:r(({row:e})=>[c("a",{href:e.article_url.web_url,target:"_blank"},n(e.title),9,de)]),_:1},8,["label"]),a(m,{label:l(t)("image"),"min-width":"120",align:"center"},{default:r(({row:e})=>[e.image?(p(),h(I,{key:0,class:"w-12 h-12",src:l(O)(e.image),fit:"contain"},null,8,["src"])):b("",!0)]),_:1},8,["label"]),a(m,{prop:"visit",label:l(t)("visit"),width:"120",align:"center"},{default:r(({row:e})=>[c("span",null,n(parseInt(e.visit+e.visit_virtual)),1)]),_:1},8,["label"]),a(m,{label:l(t)("isShow"),"min-width":"120",align:"center"},{default:r(({row:e})=>[e.is_show==1?(p(),g("span",ue,n(l(t)("show")),1)):b("",!0),e.is_show==0?(p(),g("span",_e,n(l(t)("hidden")),1)):b("",!0)]),_:1},8,["label"]),a(m,{prop:"sort",label:l(t)("sort"),width:"100",align:"center"},null,8,["label"]),a(m,{label:l(t)("createTime"),"min-width":"180",align:"center"},{default:r(({row:e})=>[u(n(e.create_time||""),1)]),_:1},8,["label"]),a(m,{label:l(t)("operation"),fixed:"right",width:"130"},{default:r(({row:e})=>[a(_,{type:"primary",link:"",onClick:$=>V(e)},{default:r(()=>[u(n(l(t)("edit")),1)]),_:2},1032,["onClick"]),a(_,{type:"danger",link:"",onClick:$=>T(e.id)},{default:r(()=>[u(n(l(t)("delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"])),[[A,o.loading]]),c("div",ge,[a(z,{"current-page":o.page,"onUpdate:currentPage":i[4]||(i[4]=e=>o.page=e),"page-size":o.limit,"onUpdate:pageSize":i[5]||(i[5]=e=>o.limit=e),layout:"total, sizes, prev, pager, next, jumper",total:o.total,onSizeChange:i[6]||(i[6]=e=>d()),onCurrentChange:d},null,8,["current-page","page-size","total"])])])]),_:1})])}}});export{gt as default};