/* empty css             *//* empty css                   */import{_ as e}from"./index-30b81ccf.js";/* empty css                     *//* empty css                  *//* empty css                *//* empty css                 */import a from"./videoList-2b3c6035.js";import{d as l,m as s,Q as t,au as r,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 y,z as _,b,t as g,a6 as x,a4 as h,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-32e7c6b2.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([]);t(),r();const L=s(!1),N=s(!1);s("");const Q=s(),W=s({duanjus:[]}),Y=()=>{N.value=!0},D=e=>{W.value.duanjus=e,W.value.duanjus.length>0&&(F.value=W.value.duanjus.map((e=>e.sort))),N.value=!1},G=e=>{W.value.duanjus=W.value.duanjus.map(((e,a)=>({id:e.id,sort:F.value[a],name:e.name}))),W.value,e&&(()=>{const e=new Set,a=new Set;for(const l of W.value.duanjus){if(null===l.sort||void 0===l.sort)return h.error(`${l.name}的排序不能为空`),!1;if(e.has(l.sort))return h.error(`${l.name}的排序重复`),!1;if(e.add(l.sort),a.has(l.name))return h.error(`${l.name}的排序重复`),!1;a.add(l.name)}return!0})()&&(L.value=!0,e.validate((e=>{e?(z(W.value.id,W.value).then((e=>{h.success(e.message),S("close")})),L.value=!1):L.value=!1})).then((()=>{})))};return q.primary&&(q.primary,W.value.id=q.primary.id,W.value.duanjus=JSON.parse(JSON.stringify(q.primary.duanjus)),W.value.duanjus.length>0&&(F.value=W.value.duanjus.map((e=>e.sort)))),o((()=>{})),(l,s)=>{const t=V,r=w,o=k,h=C,S=$,z=e,I=U;return u(),i(v,null,[d((u(),n(S,{model:m(W),"label-width":"120px",ref_key:"form",ref:Q,class:"pr-4"},{default:p((()=>[j(r,{label:"频道名称",prop:"ids",rules:[{required:!1,message:"频道名称必须填写"}],"label-width":"120px"},{default:p((()=>[j(t,{modelValue:q.primary.type_txt,"onUpdate:modelValue":s[0]||(s[0]=e=>q.primary.type_txt=e),disabled:"",size:"default",clearable:""},null,8,["modelValue"])])),_:1}),j(r,{label:"短剧",prop:"duanjus",rules:[{required:!0,message:"选择短剧"}]},{default:p((()=>[c("div",null,[m(W).duanjus.length>0?(u(),i("div",J,[(u(!0),i(v,null,f(m(W).duanjus,((e,a)=>(u(),i("div",{key:e.id,class:"mt-3 mr-3"},[j(t,{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(t,{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 W.value.duanjus.splice(l,1);var l}},{default:p((()=>[j(m(y))])),_:2},1032,["onClick"])])))),128))])):_("",!0),c("div",null,[j(h,{type:"primary",size:"default",onClick:Y},{default:p((()=>[b("选择短剧")])),_:1})])])])),_:1}),c("div",O,[j(h,{type:"primary",onClick:s[1]||(s[1]=e=>G(m(Q)))},{default:p((()=>[b(g(l.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[I,m(L)]]),j(z,{modelValue:m(N),"onUpdate:modelValue":s[2]||(s[2]=e=>x(N)?N.value=e:null),title:"选择短剧",width:"90%",alignCenter:!0,"destroy-on-close":""},{default:p((()=>[j(a,{onConfirm:D,primary:m(W).duanjus},null,8,["primary"])])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-423f87f7"]]);export{q as default};
