import{e as H,b as I,f as J,g as K,h as O}from"./decoration.c1b95658.js";import{F as Q}from"./index.d8717905.js";import{M as W}from"./index.dfdc0704.js";import{d as X,r as d,V as Y,b as Z,o as ee,c as s,e as i,f,h as t,i as o,u,F as k,j as x,k as c,g as U,t as le,A as L,m as g}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={class:"muted"},ue=g("\u5546\u57CE\u9875\u9762"),te=g("\u81EA\u5B9A\u4E49\u94FE\u63A5"),oe=g("\u4FDD\u5B58"),Fe=X({setup(se){const V=d(),{router:A,route:h}=Y(),m=h.query.id;let e=d({name:"",image:"",pid:"",link_type:1,link_address:"",sort:0,status:1}),b=d([]),y=d([]);d([]);const p=d(""),E=d(""),_=d(""),P=Z({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"}]}),S=async n=>{switch(e.value=await H({id:n}),e.value.link_type){case 1:p.value=e.value.link_address;break;case 2:E.value=e.value.link_address;break;case 3:_.value=e.value.link_address;break}},q=async()=>{const n=await I();b.value=n.lists},N=async()=>{y.value=await J()},j=async()=>{await K({...e.value}),A.back()},z=async()=>{await O({...e.value}),A.back()},M=n=>{switch(e.value.link_type){case 1:e.value.link_address=p.value;break;case 2:e.value.link_address=E.value;break;case 3:e.value.link_address=_.value;break}!n||n.validate(a=>{if(!a)return!1;m?z():j()})};return ee(()=>{m&&S(m),q(),N()}),(n,a)=>{const $=s("el-page-header"),B=s("el-card"),v=s("el-input"),r=s("el-form-item"),D=s("el-option"),w=s("el-select"),C=s("el-radio"),R=s("el-switch"),T=s("el-form"),G=s("el-button");return i(),f(k,null,[t(B,{shadow:"never"},{default:o(()=>[t($,{content:u(m)?"\u7F16\u8F91\u5E7F\u544A":"\u65B0\u589E\u5E7F\u544A",onBack:a[0]||(a[0]=l=>n.$router.back())},null,8,["content"])]),_:1}),t(T,{ref_key:"formRef",ref:V,model:u(e),rules:u(P),"label-width":"120px",class:"formData",size:"small"},{default:o(()=>[t(B,{shadow:"never",style:{"margin-top":"15px"}},{default:o(()=>[t(r,{label:"\u5E7F\u544A\u540D\u79F0:",prop:"name"},{default:o(()=>[t(v,{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(r,{label:"\u5E7F\u544A\u4F4D\u7F6E:",prop:"name"},{default:o(()=>[t(w,{modelValue:u(e).pid,"onUpdate:modelValue":a[2]||(a[2]=l=>u(e).pid=l),class:"ls-input",placeholder:"\u8BF7\u9009\u62E9"},{default:o(()=>[(i(!0),f(k,null,x(u(b),(l,F)=>(i(),c(D,{key:F,label:l.name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(r,{label:"\u56FE\u6807:"},{default:o(()=>[t(W,{modelValue:u(e).image,"onUpdate:modelValue":a[3]||(a[3]=l=>u(e).image=l),limit:1},null,8,["modelValue"]),U("div",ae," \u5EFA\u8BAE\u5C3A\u5BF8\uFF1A\u5BBD750*\u9AD8 "+le(u(e).pid==2?"200":"340")+" \u50CF\u7D20\u7684jpg\uFF0Cjpeg\uFF0Cpng\uFF0Cgif\u56FE\u7247 ",1)]),_:1}),t(r,{label:"\u94FE\u63A5\u5730\u5740:",prop:"link_address"},{default:o(()=>[t(C,{modelValue:u(e).link_type,"onUpdate:modelValue":a[4]||(a[4]=l=>u(e).link_type=l),name:"1",label:1},{default:o(()=>[ue]),_:1},8,["modelValue"]),t(C,{modelValue:u(e).link_type,"onUpdate:modelValue":a[5]||(a[5]=l=>u(e).link_type=l),name:"3",label:3},{default:o(()=>[te]),_:1},8,["modelValue"]),U("div",null,[u(e).link_type===1?(i(),c(w,{key:0,modelValue:p.value,"onUpdate:modelValue":a[6]||(a[6]=l=>p.value=l),class:"ls-input",placeholder:"\u8BF7\u9009\u62E9"},{default:o(()=>[(i(!0),f(k,null,x(u(y),(l,F)=>(i(),c(D,{key:F,label:l.name,value:l.index+""},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):L("",!0),u(e).link_type===3?(i(),c(v,{key:1,class:"ls-input",modelValue:_.value,"onUpdate:modelValue":a[7]||(a[7]=l=>_.value=l),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])):L("",!0)])]),_:1}),t(r,{label:"\u6392\u5E8F:"},{default:o(()=>[t(v,{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(r,{label:"\u72B6\u6001:",prop:"status"},{default:o(()=>[t(R,{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(Q,null,{default:o(()=>[t(G,{type:"primary",size:"small",onClick:a[10]||(a[10]=l=>M(V.value))},{default:o(()=>[oe]),_:1})]),_:1})],64)}}});export{Fe as default};
