import{u as a,a as e,r as l,b as t,cK as d,d as o,e as r,f as s,h as i,w as m,g as u,j as n,k as p,i as c,n as f,E as b,q as v}from"./index.286e9b79.js";import{v as j}from"./loading.c49775a6.js";import{E as g,a as _}from"./form.ad10dcd5.js";import{E as h,a as x}from"./tab-pane.1cc0f769.js";/* empty css                    *//* empty css              */import"./form-item.9355e6dc.js";import{E as V}from"./input.31de1b37.js";import{_ as w}from"./page-header.29890ed0.js";import{g as y,p as k}from"./http.f588794f.js";import{E,a as q}from"./index.569c0449.js";import"./_initCloneObject.fb8fbaea.js";import"./strings.8c60bfae.js";import"./event.776e7e11.js";import"./index.ed3ed02e.js";import"./divider.948c4b18.js";const C={class:"card goods-wrap"},U={class:"editor-card"},F={class:"editor-card-box"},K={class:"tool"},M={class:"tool-box"},N={__name:"editor",setup(N){const O=a(),R=e().query.id;let T=l(!1),z=l(!1),A=l(0),B=l();const D=(a,e)=>{A.value=a.paneName};let G=t({data:{name:"",intro:"",status:1,id:0}});T.value=!0,y("diy.topic/editor",{id:R}).then((a=>{T.value=!1,a.code&&!d(a.data)&&(G.data=a.data)}));const H=t({name:[{required:!0,message:"请输入专题名称",trigger:"blur"}]}),I=async()=>{B.value&&await B.value.validate(((a,e)=>{z.value=!1,a?(z.value=!0,k("diy.topic/editor",G.data).then((a=>{z.value=!1,a.code?(B.value.resetFields(),O.replace("/mobile/topic/index"),b.success("编辑成功")):b.error(a.msg)})).catch((a=>{b.error(a)}))):b.error("请完善内容")}))},J=()=>{O.go(-1)};return(a,e)=>{const l=w,t=V,d=g,b=E,y=q,k=h,N=x,O=_,R=v,L=j;return o(),r("div",C,[s(l,{title:"编辑专题"}),i("div",U,[m((o(),n(O,{model:u(G).data,rules:u(H),ref_key:"ruleFormRef",ref:B},{default:p((()=>[i("div",F,[s(N,{modelValue:u(A),"onUpdate:modelValue":e[3]||(e[3]=a=>c(A)?A.value=a:A=a),onTabClick:D},{default:p((()=>[s(k,{label:"基本信息",name:0},{default:p((()=>[s(d,{label:"专题名称",prop:"name","label-width":"100px"},{default:p((()=>[s(t,{modelValue:u(G).data.name,"onUpdate:modelValue":e[0]||(e[0]=a=>u(G).data.name=a),"show-word-limit":"",maxlength:"15",placeholder:"请输入专题名称"},null,8,["modelValue"])])),_:1}),s(d,{label:"备注",prop:"minexp","label-width":"100px"},{default:p((()=>[s(t,{modelValue:u(G).data.intro,"onUpdate:modelValue":e[1]||(e[1]=a=>u(G).data.intro=a),modelModifiers:{number:!0},"show-word-limit":"",maxlength:"50",placeholder:"请输入备注"},null,8,["modelValue"])])),_:1}),s(d,{label:"状态",required:!0,"label-width":"100px"},{default:p((()=>[s(y,{modelValue:u(G).data.status,"onUpdate:modelValue":e[2]||(e[2]=a=>u(G).data.status=a)},{default:p((()=>[s(b,{value:1},{default:p((()=>[f("正常")])),_:1}),s(b,{value:0},{default:p((()=>[f("关闭")])),_:1})])),_:1},8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["modelValue"])])])),_:1},8,["model","rules"])),[[L,u(T)]])]),i("div",K,[i("div",M,[s(R,{onClick:J},{default:p((()=>[f("取消")])),_:1}),s(R,{type:"primary",loading:u(z),onClick:I},{default:p((()=>[f("保存")])),_:1},8,["loading"])])])])}}};export{N as default};
