import{_ as e}from"./index-7266ee79.js";import a from"./videoList-577963e4.js";import{d as l,k as s,G as u,a5 as r,p as t,r as d,K as n,o,c as i,J as m,f as p,j as c,w as f,a as v,e as j,F as _,q as y,bY as h,s as b,b as x,t as V,Q as g,O as w,_ as k}from"./index-018fb6dd.js";import{o as C}from"./index-dd579723.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(),r();const $=s(!1),q=s(!1);s("");const z=s(),G=s({duanjus:[]}),N=()=>{q.value=!0},I=e=>{G.value.duanjus=e,G.value.duanjus.length>0&&(O.value=G.value.duanjus.map((e=>e.sort))),q.value=!1},L=e=>{G.value,G.value.duanjus=G.value.duanjus.map(((e,a)=>({id:e.id,sort:O.value[a],name:e.name}))),e&&(()=>{const e=new Set,a=new Set;for(const l of G.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(G.value).then((e=>{w.success(e.message),k("close")})),$.value=!1):$.value=!1})).then((()=>{})))};return J.primary&&(J.primary,G.value.id=J.primary.id,G.value.duanjus=JSON.parse(JSON.stringify(J.primary.duanjus)),G.value.duanjus.length>0&&(O.value=G.value.duanjus.map((e=>e.sort)))),t((()=>{})),(l,s)=>{const u=d("el-input"),r=d("el-form-item"),t=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(G),"label-width":"120px",ref_key:"form",ref:z,class:"pr-4"},{default:f((()=>[v(r,{label:"列表名称",prop:"ids",rules:[{required:!1,message:"列表名称必须填写"}],"label-width":"120px"},{default:f((()=>[v(u,{modelValue:J.primary.type_str,"onUpdate:modelValue":s[0]||(s[0]=e=>J.primary.type_str=e),disabled:"",size:"default",clearable:""},null,8,["modelValue"])])),_:1}),v(r,{label:"短剧",prop:"duanjus",rules:[{required:!0,message:"选择短剧"}]},{default:f((()=>[j("div",null,[p(G).duanjus.length>0?(o(),i("div",U,[(o(!0),i(_,null,y(p(G).duanjus,((e,a)=>(o(),i("div",{key:e.id,class:"mt-3 mr-3"},[v(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"]),v(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"]),v(t,{class:"ml-3 cursor-pointer",onClick:e=>{return l=a,void G.value.duanjus.splice(l,1);var l}},{default:f((()=>[v(p(h))])),_:2},1032,["onClick"])])))),128))])):b("",!0),j("div",null,[v(w,{type:"primary",size:"default",onClick:N},{default:f((()=>[x("选择短剧")])),_:1})])])])),_:1}),j("div",S,[v(w,{type:"primary",onClick:s[1]||(s[1]=e=>L(p(z)))},{default:f((()=>[x(V(l.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[Y,p($)]]),v(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:f((()=>[v(a,{onConfirm:I,primary:p(G).duanjus},null,8,["primary"])])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-cf39a8e3"]]);export{J as default};
