import{n as T,f as G,o as J,p as K}from"./decoration.c1b95658.js";import{F as O}from"./index.d8717905.js";import{M as Q}from"./index.dfdc0704.js";import{d as W,r as d,V as X,b as Y,c as s,e as n,f as g,h as t,i as o,u,g as U,k as m,F as V,j as h,A as b,m as y,R as Z,S as ee,_ as le}from"./index.0308b213.js";import"./index.vue_vue_type_style_index_0_scoped_f00ed21d_lang.2c48f49b.js";import"./vuedraggable.umd.405b1bec.js";import"./index.35b8c9ab.js";import"./index.9e8820cd.js";import"./sort_out.2008c10d.js";const ae=p=>(Z("data-v-5fc7bc52"),p=p(),ee(),p),ue=ae(()=>U("div",{class:"muted"},"\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A\u5BBD200*\u9AD8200\u50CF\u7D20\u7684jpg\uFF0Cjpeg\uFF0Cpng\uFF0Cgif\u56FE\u7247",-1)),te=y("\u5546\u57CE\u9875\u9762"),oe=y("\u81EA\u5B9A\u4E49\u94FE\u63A5"),se=y("\u4FDD\u5B58"),ne=W({setup(p){const B=d(),{router:E,route:M}=X(),_=M.query.id;let e=d({name:"",image:"",link_type:1,link_address:"",sort:0,status:1}),D=d([]),S=d([]);const c=d(""),v=d(""),f=d(""),H=Y({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",trigger:"blur"}],link_address:[{required:!0,message:"\u94FE\u63A5\u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A",trigger:[]}],status:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001",trigger:"change"}]}),q=async r=>{switch(e.value=await T({id:r}),e.value.link_type){case 1:c.value=e.value.link_address;break;case 2:v.value=e.value.link_address;break;case 3:f.value=e.value.link_address;break}},I=async()=>{D.value=await G()},L=async()=>{await J({...e.value}),E.back()},N=async()=>{await K({...e.value}),E.back()},P=r=>{switch(e.value.link_type){case 1:e.value.link_address=c.value;break;case 2:e.value.link_address=v.value;break;case 3:e.value.link_address=f.value;break}!r||r.validate(a=>{if(!a)return!1;_?N():L()})};return _&&q(_),I(),(r,a)=>{const j=s("el-page-header"),A=s("el-card"),k=s("el-input"),i=s("el-form-item"),w=s("el-radio"),C=s("el-option"),x=s("el-select"),z=s("el-switch"),R=s("el-form"),$=s("el-button");return n(),g(V,null,[t(A,{shadow:"never"},{default:o(()=>[t(j,{content:u(_)?"\u7F16\u8F91\u83DC\u5355":"\u65B0\u589E\u83DC\u5355",onBack:a[0]||(a[0]=l=>r.$router.back())},null,8,["content"])]),_:1}),t(R,{ref_key:"formRef",ref:B,model:u(e),rules:u(H),"label-width":"120px",class:"formData",size:"small"},{default:o(()=>[t(A,{shadow:"never",style:{"margin-top":"15px"}},{default:o(()=>[t(i,{label:"\u83DC\u5355\u540D\u79F0:",prop:"name"},{default:o(()=>[t(k,{class:"ls-input",modelValue:u(e).name,"onUpdate:modelValue":a[1]||(a[1]=l=>u(e).name=l),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),t(i,{label:"\u56FE\u6807:"},{default:o(()=>[t(Q,{modelValue:u(e).image,"onUpdate:modelValue":a[2]||(a[2]=l=>u(e).image=l),limit:1},null,8,["modelValue"]),ue]),_:1}),t(i,{label:"\u94FE\u63A5\u5730\u5740:",prop:"link_address"},{default:o(()=>[t(w,{modelValue:u(e).link_type,"onUpdate:modelValue":a[3]||(a[3]=l=>u(e).link_type=l),name:"1",label:1},{default:o(()=>[te]),_:1},8,["modelValue"]),t(w,{modelValue:u(e).link_type,"onUpdate:modelValue":a[4]||(a[4]=l=>u(e).link_type=l),name:"3",label:3},{default:o(()=>[oe]),_:1},8,["modelValue"]),U("div",null,[u(e).link_type===1?(n(),m(x,{key:0,modelValue:c.value,"onUpdate:modelValue":a[5]||(a[5]=l=>c.value=l),class:"ls-input",placeholder:"\u8BF7\u9009\u62E9"},{default:o(()=>[(n(!0),g(V,null,h(u(D),(l,F)=>(n(),m(C,{key:F,label:l.name,value:l.index},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):b("",!0),u(e).link_type===2?(n(),m(x,{key:1,modelValue:v.value,"onUpdate:modelValue":a[6]||(a[6]=l=>v.value=l),class:"ls-input",placeholder:"\u8BF7\u9009\u62E9"},{default:o(()=>[(n(!0),g(V,null,h(u(S),(l,F)=>(n(),m(C,{key:F,label:l.name,value:l.id+""},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):b("",!0),u(e).link_type===3?(n(),m(k,{key:2,class:"ls-input",modelValue:f.value,"onUpdate:modelValue":a[7]||(a[7]=l=>f.value=l),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])):b("",!0)])]),_:1}),t(i,{label:"\u6392\u5E8F:"},{default:o(()=>[t(k,{class:"ls-input",modelValue:u(e).sort,"onUpdate:modelValue":a[8]||(a[8]=l=>u(e).sort=l),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),t(i,{label:"\u72B6\u6001:",prop:"status"},{default:o(()=>[t(z,{modelValue:u(e).status,"onUpdate:modelValue":a[9]||(a[9]=l=>u(e).status=l),size:"small","active-text":u(e).status?"\u542F\u7528":"\u5173\u95ED","active-value":1,"inactive-value":0},null,8,["modelValue","active-text"])]),_:1})]),_:1})]),_:1},8,["model","rules"]),t(O,null,{default:o(()=>[t($,{type:"primary",size:"small",onClick:a[10]||(a[10]=l=>P(B.value))},{default:o(()=>[se]),_:1})]),_:1})],64)}}});const ke=le(ne,[["__scopeId","data-v-5fc7bc52"]]);export{ke as default};
