import{_ as e}from"./index-7266ee79.js";import a from"./videoList-809ec754.js";import{d as l,k as s,G as u,a5 as t,p as r,r as d,K as n,o,c as i,J as m,f as p,j as c,w as v,a as f,e as j,F as _,q as y,bY as b,s as h,b as x,t as V,Q as g,O as w,_ as k}from"./index-018fb6dd.js";import{o as C}from"./index-10a794d9.js";/* empty css             *//* empty css                   */import"./index-765bf96c.js";import"./index.vue_vue_type_script_setup_true_lang-a66505b9.js";import"./search.vue_vue_type_script_setup_true_lang-bbdf4bb9.js";import"./index-b8a1ff49.js";import"./useGetList-4b13a7ea.js";import"./index-a3908905.js";import"./http-338d117f.js";const U={key:0,class:"flex flex-wrap mb-5"},S={class:"flex justify-end"},J=k(l({__name:"config",props:{primary:Object},emits:["close"],setup(l,{emit:k}){const J=l,O=s([]);u(),t();const $=s(!1),q=s(!1);s("");const z=s(),N=s({duanjus:[]}),G=()=>{q.value=!0},I=e=>{N.value.duanjus=e,N.value.duanjus.length>0&&(O.value=N.value.duanjus.map((e=>e.sort))),q.value=!1},L=e=>{N.value.duanjus=N.value.duanjus.map(((e,a)=>({id:e.id,sort:O.value[a],name:e.name}))),N.value,e&&(()=>{const e=new Set,a=new Set;for(const l of N.value.duanjus){if(null===l.sort||void 0===l.sort)return w.error(`${l.name}的排序不能为空`),!1;if(e.has(l.sort))return w.error(`${l.name}的排序重复`),!1;if(e.add(l.sort),a.has(l.name))return w.error(`${l.name}的排序重复`),!1;a.add(l.name)}return!0})()&&($.value=!0,e.validate((e=>{e?(C(N.value.id,N.value).then((e=>{w.success(e.message),k("close")})),$.value=!1):$.value=!1})).then((()=>{})))};return J.primary&&(J.primary,N.value.id=J.primary.id,N.value.duanjus=JSON.parse(JSON.stringify(J.primary.duanjus)),N.value.duanjus.length>0&&(O.value=N.value.duanjus.map((e=>e.sort)))),r((()=>{})),(l,s)=>{const u=d("el-input"),t=d("el-form-item"),r=d("el-icon"),w=d("el-button"),k=d("el-form"),C=e,Y=n("loading");return o(),i(_,null,[m((o(),c(k,{model:p(N),"label-width":"120px",ref_key:"form",ref:z,class:"pr-4"},{default:v((()=>[f(t,{label:"频道名称",prop:"ids",rules:[{required:!1,message:"频道名称必须填写"}],"label-width":"120px"},{default:v((()=>[f(u,{modelValue:J.primary.type_txt,"onUpdate:modelValue":s[0]||(s[0]=e=>J.primary.type_txt=e),disabled:"",size:"default",clearable:""},null,8,["modelValue"])])),_:1}),f(t,{label:"短剧",prop:"duanjus",rules:[{required:!0,message:"选择短剧"}]},{default:v((()=>[j("div",null,[p(N).duanjus.length>0?(o(),i("div",U,[(o(!0),i(_,null,y(p(N).duanjus,((e,a)=>(o(),i("div",{key:e.id,class:"mt-3 mr-3"},[f(u,{type:"number",disabled:!1,min:"1",modelValue:p(O)[a],"onUpdate:modelValue":e=>p(O)[a]=e,modelModifiers:{number:!0},placeholder:"排序",size:"default",style:{width:"115px"}},null,8,["modelValue","onUpdate:modelValue"]),f(u,{modelValue:e.name,"onUpdate:modelValue":a=>e.name=a,disabled:!0,placeholder:"短剧名称",style:{width:"300px"},class:"input-with-select"},null,8,["modelValue","onUpdate:modelValue"]),f(r,{class:"ml-3 cursor-pointer",onClick:e=>{return l=a,void N.value.duanjus.splice(l,1);var l}},{default:v((()=>[f(p(b))])),_:2},1032,["onClick"])])))),128))])):h("",!0),j("div",null,[f(w,{type:"primary",size:"default",onClick:G},{default:v((()=>[x("选择短剧")])),_:1})])])])),_:1}),j("div",S,[f(w,{type:"primary",onClick:s[1]||(s[1]=e=>L(p(z)))},{default:v((()=>[x(V(l.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[Y,p($)]]),f(C,{modelValue:p(q),"onUpdate:modelValue":s[2]||(s[2]=e=>g(q)?q.value=e:null),title:"选择短剧",width:"90%",alignCenter:!0,"destroy-on-close":""},{default:v((()=>[f(a,{onConfirm:I,primary:p(N).duanjus},null,8,["primary"])])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-9eecd30d"]]);export{J as default};
