import{a6 as k,a7 as V,a8 as I}from"./index.DLhCD1Qz.js";import{_ as x}from"./yb_admin_plugin.DNFUAscl.js";import{aZ as i,aL as n,s as B,bJ as s,I as o,u as c,F as C,aX as U,v as _,H as h,bb as b}from"./@vue.Da0bZ210.js";import"./vue.Bj6dTZYa.js";import"./@element-plus.pQhr8KT1.js";import"./echarts.Dms41JYJ.js";import"./tslib.BDyQ-Jie.js";import"./zrender.BueMfJu3.js";import"./axios.BjtuyMK1.js";import"./pinia.Tngw-S_5.js";import"./vue-router.DaVMGKLh.js";import"./element-plus.DC208N5p.js";import"./lodash-es.DVGGNlzX.js";import"./@vueuse.BhH-hw9p.js";import"./async-validator.9PlIezaS.js";import"./@popperjs.C5az9QE8.js";import"./@ctrl.C4Rzlq_k.js";import"./dayjs.BLMYetss.js";import"./memoize-one.BdPwpGay.js";import"./normalize-wheel-es.BQoi3Ox2.js";import"./@floating-ui.DCXYYTka.js";import"./vue-i18n.C7BagGww.js";import"./@intlify.TnaUIxGf.js";import"./moment.C5S46NFB.js";const S={title:"添加",name:"Add",components:{},props:{edit:{type:Object,default:()=>({id:0})}},data(){return{form:{id:0,title:"",key:"",status:0,group_image:[{id:0,url:"",image:"",images:[{}]}]},rules:{}}},created(){this.listLoading=!0,this.edit.id&&I(this.edit.id).then(e=>{this.form=e.data.info,this.form.group_image.map(t=>{let m=t.image;t.images=[{id:0,image:m}]})})},methods:{add_wx(){this.form.group_image.length>=6?this.$message.error("广告最多保留六张"):this.form.group_image.push({id:0,url:"",images:[]})},del_wx(e){this.form.group_image.length==1?this.$message.error("广告最少保留一张"):this.form.group_image.splice(e,1)},onSubmit(){this.$refs.form.validate(async e=>{if(e)this.edit.id&&delete this.form.create_time,(this.edit.id?k:V)(this.form).then(m=>{this.$baseMessage("保存成功"),this.callBack&&this.callBack()});else return!1})}}},$={class:"link_advert",style:{display:"flex"}};function w(e,t,m,L,r,d){const p=i("el-input"),u=i("el-form-item"),v=i("ImageSelect"),f=i("el-button"),y=i("el-form");return n(),B(y,{ref:"form",model:r.form,rules:r.rules,"label-width":"80px"},{default:s(()=>[o(u,{label:e.translateI18n("名称"),prop:"name",style:{width:"60%"}},{default:s(()=>[o(p,{modelValue:r.form.title,"onUpdate:modelValue":t[0]||(t[0]=l=>r.form.title=l),placeholder:e.translateI18n("名称")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(u,{label:e.translateI18n("广告图")},{default:s(()=>[(n(!0),c(C,null,U(r.form.group_image,(l,g)=>(n(),c("div",{key:g,style:{display:"flex","margin-bottom":"15px"}},[o(v,{value:l.images,"onUpdate:value":a=>l.images=a,num:1},null,8,["value","onUpdate:value"]),_("div",$,[o(p,{modelValue:l.url,"onUpdate:modelValue":a=>l.url=a,modelModifiers:{trim:!0}},null,8,["modelValue","onUpdate:modelValue"])]),o(f,{class:"btn",type:"text",onClick:t[1]||(t[1]=a=>d.add_wx())},{default:s(()=>[h(b(e.translateI18n("添加")),1)]),_:1}),o(f,{class:"btn",type:"text",onClick:a=>d.del_wx(g)},{default:s(()=>[h(b(e.translateI18n("删除")),1)]),_:1},8,["onClick"]),t[2]||(t[2]=_("div",{style:{height:"5px"}},null,-1))]))),128))]),_:1},8,["label"])]),_:1},8,["model","rules"])}const oe=x(S,[["render",w],["__scopeId","data-v-2c5db815"]]);export{oe as default};
