import{I as i}from"./index-OziN21LA.js";import{h as w}from"./index-DDEMnpwQ.js";import{p as I,R as B}from"./element-plus-C2aeItNs.js";import{l as M,aL as U,r as v,aK as b,m as t,p as m,F as z,a7 as S,u as l,U as y,M as d,K as $,R as p,q as h,T as j}from"./vue-chunks-l-AyUCfi.js";const q={class:"w-full"},A={class:"params-index"},E={class:"params-edit flex justify-center items-center"},O=M({__name:"addPromat",props:U({formModel:{type:Object,default:()=>({})}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(f){const g={label:"tag"},n=v([]),u=v(!1);let o=b(f,"modelValue");const k=e=>{o.value.splice(o.value.indexOf(e),1)},V=()=>{o.value=[...o.value,{promotId:"",keyword:""}]},_=e=>{const s=o.value[e];o.value.splice(e,1),o.value.splice(e-1,0,s)},C=e=>{const s=o.value[e];o.value.splice(e,1),o.value.splice(e+1,0,s)};return(()=>{u.value=!0,n.value,w({}).then(e=>{const s=(e.list||[]).map(a=>({tag:a.tag,value:{id:a.id,tag:a.tag}}));n.value=s,u.value=!1}).catch(e=>{u.value=!1,n.value=[]})})(),(e,s)=>(t(),m("div",q,[(t(!0),m(z,null,S(l(o),(a,r)=>(t(),m("div",{key:r,class:"flex params-box justify-center items-center"},[y(l(I),{modelValue:a.keyword,"onUpdate:modelValue":c=>a.keyword=c,style:{width:"44%","margin-right":"6%"},placeholder:"通常设置为/开头，例如：/小红书"},null,8,["modelValue","onUpdate:modelValue"]),u.value?p("",!0):(t(),d(l(B),$({key:0,modelValue:a.promotId,"onUpdate:modelValue":c=>a.promotId=c,style:{width:"44%"},filterable:"",props:g,placeholder:"预设角色"},e.$attrs,{"value-key":"id",options:n.value}),null,16,["modelValue","onUpdate:modelValue","options"])),h("div",A,j(r+1),1),h("div",E,[r+1==l(o).length?(t(),d(l(i),{key:0,size:20,onClick:V,icon:"tdesign:add",class:"cursor-pointer","hover-color":"var(--el-color-primary)"})):p("",!0),r+1!=l(o).length?(t(),d(l(i),{key:1,size:20,onClick:c=>k(r),icon:"tdesign:remove",class:"cursor-pointer","hover-color":"var(--el-color-primary)"},null,8,["onClick"])):p("",!0),y(l(i),{size:20,onClick:c=>C(r),icon:"tdesign:chevron-down",class:"cursor-pointer","hover-color":"var(--el-color-primary)"},null,8,["onClick"]),r!=0?(t(),d(l(i),{key:2,size:20,onClick:c=>_(r),icon:"tdesign:chevron-up",class:"cursor-pointer","hover-color":"var(--el-color-primary)"},null,8,["onClick"])):p("",!0)])]))),128))]))}});export{O as _};
