/* empty css             *//* empty css                   */import{_ as e}from"./index-30b81ccf.js";/* empty css                     *//* empty css                  *//* empty css                *//* empty css                 */import a from"./videoList-0c1ffdd3.js";import{d as l,m as s,Q as r,au as t,x as o,o as u,c as i,W as d,f as m,l as n,w as p,a as j,e as c,F as v,y as f,a$ as _,z as y,b,t as g,a6 as h,a4 as x,a2 as V,a3 as w,J as k,S as C,Y as $,$ as U,_ as S}from"./index-2b50ecca.js";import{o as z}from"./index-e32fd9c9.js";/* empty css                 *//* empty css                   *//* empty css                  *//* empty css                   */import"./index-a921dba7.js";import"./index.vue_vue_type_script_setup_true_lang-bc7fd1e2.js";/* empty css                      *//* empty css               *//* empty css                  *//* empty css                     *//* empty css                  *//* empty css                        *//* empty css                    */import"./el-tooltip-4ed993c7.js";/* empty css                   *//* empty css                        */import"./search.vue_vue_type_script_setup_true_lang-946854ba.js";/* empty css                          *//* empty css                 *//* empty css                */import"./index-b8a1ff49.js";import"./useGetList-927e47a1.js";import"./index-403f799c.js";import"./http-aa208300.js";const J={key:0,class:"flex flex-wrap mb-5"},O={class:"flex justify-end"},q=S(l({__name:"config",props:{primary:Object},emits:["close"],setup(l,{emit:S}){const q=l,F=s([]);r(),t();const L=s(!1),N=s(!1);s("");const Q=s(),Y=s({duanjus:[]}),D=()=>{N.value=!0},G=e=>{Y.value.duanjus=e,Y.value.duanjus.length>0&&(F.value=Y.value.duanjus.map((e=>e.sort))),N.value=!1},I=e=>{Y.value,Y.value.duanjus=Y.value.duanjus.map(((e,a)=>({id:e.id,sort:F.value[a],name:e.name}))),e&&(()=>{const e=new Set,a=new Set;for(const l of Y.value.duanjus){if(null===l.sort||void 0===l.sort)return x.error(`${l.name}的排序不能为空`),!1;if(e.has(l.sort))return x.error(`${l.name}的排序重复`),!1;if(e.add(l.sort),a.has(l.name))return x.error(`${l.name}的排序重复`),!1;a.add(l.name)}return!0})()&&(L.value=!0,e.validate((e=>{e?(z(Y.value).then((e=>{x.success(e.message),S("close")})),L.value=!1):L.value=!1})).then((()=>{})))};return q.primary&&(q.primary,Y.value.id=q.primary.id,Y.value.duanjus=JSON.parse(JSON.stringify(q.primary.duanjus)),Y.value.duanjus.length>0&&(F.value=Y.value.duanjus.map((e=>e.sort)))),o((()=>{})),(l,s)=>{const r=V,t=w,o=k,x=C,S=$,z=e,M=U;return u(),i(v,null,[d((u(),n(S,{model:m(Y),"label-width":"120px",ref_key:"form",ref:Q,class:"pr-4"},{default:p((()=>[j(t,{label:"列表名称",prop:"ids",rules:[{required:!1,message:"列表名称必须填写"}],"label-width":"120px"},{default:p((()=>[j(r,{modelValue:q.primary.type_str,"onUpdate:modelValue":s[0]||(s[0]=e=>q.primary.type_str=e),disabled:"",size:"default",clearable:""},null,8,["modelValue"])])),_:1}),j(t,{label:"短剧",prop:"duanjus",rules:[{required:!0,message:"选择短剧"}]},{default:p((()=>[c("div",null,[m(Y).duanjus.length>0?(u(),i("div",J,[(u(!0),i(v,null,f(m(Y).duanjus,((e,a)=>(u(),i("div",{key:e.id,class:"mt-3 mr-3"},[j(r,{type:"number",disabled:!1,min:"1",modelValue:m(F)[a],"onUpdate:modelValue":e=>m(F)[a]=e,modelModifiers:{number:!0},placeholder:"排序",size:"default",style:{width:"115px"}},null,8,["modelValue","onUpdate:modelValue"]),j(r,{modelValue:e.name,"onUpdate:modelValue":a=>e.name=a,disabled:!0,placeholder:"短剧名称",style:{width:"300px"},class:"input-with-select"},null,8,["modelValue","onUpdate:modelValue"]),j(o,{class:"ml-3 cursor-pointer",onClick:e=>{return l=a,void Y.value.duanjus.splice(l,1);var l}},{default:p((()=>[j(m(_))])),_:2},1032,["onClick"])])))),128))])):y("",!0),c("div",null,[j(x,{type:"primary",size:"default",onClick:D},{default:p((()=>[b("选择短剧")])),_:1})])])])),_:1}),c("div",O,[j(x,{type:"primary",onClick:s[1]||(s[1]=e=>I(m(Q)))},{default:p((()=>[b(g(l.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[M,m(L)]]),j(z,{modelValue:m(N),"onUpdate:modelValue":s[2]||(s[2]=e=>h(N)?N.value=e:null),title:"选择短剧",width:"90%",alignCenter:!0,"destroy-on-close":""},{default:p((()=>[j(a,{onConfirm:G,primary:m(Y).duanjus},null,8,["primary"])])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-53098657"]]);export{q as default};
