2 lines
8.5 KiB
JavaScript
2 lines
8.5 KiB
JavaScript
|
|
import{d as ee,o as le,b as w,e as i,m as a,z as o,p as V,U as ae,x as te,s as oe,y as h,r as d,C as u,T as ne,g as m,j as f,F as R,h as S,Z as se,t as T,V as ue,W as de,X as ie,J as b,_ as re}from"./index-eVF4AHSu.js";import{R as me}from"./RichEditor-DD1hYfzj.js";import{M as ve}from"./MediaSelector-DyRQc9ag.js";import{a as ce,f as pe,b as fe,e as ge,g as _e}from"./case-ChTjqYer.js";import{r as Ve}from"./media-BgGGvhcR.js";import"./upload-C79x1DTb.js";import"./pagination-BgSlm-mj.js";const be={class:"case-manage"},ye={class:"page-header"},we={class:"filter-bar"},he={key:1,class:"table-thumb-placeholder"},Ze={class:"pagination-bar"},Ce={class:"dialog-row"},Ue={class:"dialog-row"},xe={class:"dialog-row"},je={class:"dialog-row"},ke={class:"dialog-row"},Ie={class:"dialog-row"},Ee=ee({__name:"CaseManage",setup(Le){const Z=d(!1),L=d([]),_=d([]),z=d(0),C=d(1),U=d(20),x=d(void 0),j=d(""),g=d(!1),k=d("新增案例"),y=d(null),I=d(!1),t=d({categoryId:0,titleZh:"",titleEn:"",subtitleZh:"",subtitleEn:"",coverImage:"",projectTypeZh:"",projectArea:"",projectLocationZh:"",projectDate:"",summaryZh:"",summaryEn:"",contentZh:"",contentEn:"",isHot:0,isRecommend:0,status:1,sortOrder:0});async function v(){Z.value=!0;try{const n=await ce({categoryId:x.value,keyword:j.value||void 0,page:C.value,size:U.value});L.value=n.records,z.value=n.total}catch(n){console.warn("fetchCaseList failed:",n)}finally{Z.value=!1}}async function A(){try{_.value=await pe()}catch{}}le(()=>{A(),v()});function B(){var n;y.value=null,k.value="新增案例",t.value={categoryId:((n=_.value[0])==null?void 0:n.id)??0,titleZh:"",titleEn:"",subtitleZh:"",coverImage:"",status:1,sortOrder:0,isHot:0,isRecommend:0},g.value=!0}function H(n){y.value=n.id,k.value="编辑案例",t.value={...n},g.value=!0}async function N(n){try{await ie.confirm(`确定删除案例「${n.titleZh}」?`,"确认删除",{type:"warning"}),await fe(n.id),b.success("删除成功"),await v()}catch{}}async function O(){if(!t.value.titleZh||!t.value.categoryId){b.warning("请填写案例标题和分类");return}I.value=!0;try{y.value?(await ge(y.value,t.value),b.success("更新成功")):(await _e(t.value),b.success("创建成功")),g.value=!1,await v()}catch(n){b.error(n instanceof Error?n.message:"操作失败")}finally{I.value=!1}}function $(n){var l;return((l=_.value.find(c=>c.id===n))==null?void 0:l.nameZh)||String(n)}return(n,l)=>{const c=u("el-button"),M=u("el-option"),D=u("el-select"),K=u("el-icon"),r=u("el-input"),P=u("el-image"),p=u("el-table-column"),q=u("el-tag"),F=u("el-table"),J=u("el-pagination"),s=u("el-form-item"),E=u("el-switch"),W=u("el-input-number"),X=u("el-form"),G=u("el-dialog"),Q=ne("loading");return m(),w("div",be,[i("div",ye,[l[22]||(l[22]=i("h2",{class:"page-title"},"案例管理",-1)),a(c,{type:"primary",icon:V(ae),onClick:B},{default:o(()=>[...l[21]||(l[21]=[f("新增案例",-1)])]),_:1},8,["icon"])]),i("div",we,[a(D,{modelValue:x.value,"onUpdate:modelValue":l[0]||(l[0]=e=>x.value=e),placeholder:"选择分类",clearable:"",onChange:v,style:{width:"180px"}},{default:o(()=>[(m(!0),w(R,null,S(_.value,e=>(m(),h(M,{key:e.id,label:e.nameZh,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),a(r,{modelValue:j.value,"onUpdate:modelValue":l[1]||(l[1]=e=>j.value=e),placeholder:"搜索案例名称...",clearable:"",onChange:v,onKeyup:te(v,["enter"]),style:{width:"240px"}},{prefix:o(()=>[a(K,null,{default:o(()=>[a(V(se))]),_:1})]),_:1},8,["modelValue"])]),oe((m(),h(F,{data:L.value,class:"admin-table"},{default:o(()=>[a(p,{label:"封面",width:"100"},{default:o(({row:e})=>[e.coverImage?(m(),h(P,{key:0,src:V(Ve)(e.coverImage),fit:"cover",class:"table-thumb"},null,8,["src"])):(m(),w("div",he,"无图"))]),_:1}),a(p,{prop:"titleZh",label:"案例标题","min-width":"200","show-overflow-tooltip":""}),a(p,{label:"分类",width:"120"},{default:o(({row:e})=>[f(T($(e.categoryId)),1)]),_:1}),a(p,{prop:"projectArea",label:"面积",width:"100"}),a(p,{prop:"projectLocationZh",label:"地点",width:"120"}),a(p,{label:"状态",width:"80"},{default:o(({row:e})=>[a(q,{type:e.status===1?"succe
|