/* empty css             *//* empty css                   */import{_ as e}from"./index-9f9af49f.js";/* empty css                     *//* empty css                  *//* empty css                *//* empty css                 */import a from"./videoList-1a13fbd5.js";import{d as l,m as s,R as r,ax as t,x as o,o as u,c as i,X as d,f as m,l as n,w as p,a as j,e as c,F as v,y as f,b3 as y,z as _,b,t as x,a7 as g,a5 as h,a3 as V,a4 as w,J as k,U,Z as C,a0 as z,_ as $}from"./index-0ffeeea6.js";import{o as q}from"./index-6d7b8c09.js";/* empty css                 *//* empty css                   *//* empty css                  *//* empty css                   */import"./index-44ccf907.js";import"./index.vue_vue_type_script_setup_true_lang-66f33117.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-72910575.js";/* empty css                          *//* empty css                 *//* empty css                */import"./index-b8a1ff49.js";import"./useGetList-07470d8e.js";import"./index-7475c2a5.js";import"./http-ffb58baa.js";const O={key:0,class:"flex flex-wrap mb-5"},S={class:"flex justify-end"},I=$(l({__name:"config",props:{primary:Object},emits:["close"],setup(l,{emit:$}){const I=l,J=s([]);r(),t();const N=s(!1),F=s(!1);s("");const G=s(),L=s({duanjus:[]}),A=()=>{F.value=!0},E=e=>{L.value.duanjus=e,L.value.duanjus.length>0&&(J.value=L.value.duanjus.map((e=>e.sort))),F.value=!1},H=e=>{L.value,L.value.duanjus=L.value.duanjus.map(((e,a)=>({id:e.id,sort:J.value[a],name:e.name}))),e&&(()=>{const e=new Set,a=new Set;for(const l of L.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})()&&(N.value=!0,e.validate((e=>{e?(q(L.value).then((e=>{h.success(e.message),$("close")})),N.value=!1):N.value=!1})).then((()=>{})))};return I.primary&&(I.primary,L.value.id=I.primary.id,L.value.duanjus=JSON.parse(JSON.stringify(I.primary.duanjus)),L.value.duanjus.length>0&&(J.value=L.value.duanjus.map((e=>e.sort)))),o((()=>{})),(l,s)=>{const r=V,t=w,o=k,h=U,$=C,q=e,M=z;return u(),i(v,null,[d((u(),n($,{model:m(L),"label-width":"120px",ref_key:"form",ref:G,class:"pr-4"},{default:p((()=>[j(t,{label:"列表名称",prop:"ids",rules:[{required:!1,message:"列表名称必须填写"}],"label-width":"120px"},{default:p((()=>[j(r,{modelValue:I.primary.type_str,"onUpdate:modelValue":s[0]||(s[0]=e=>I.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(L).duanjus.length>0?(u(),i("div",O,[(u(!0),i(v,null,f(m(L).duanjus,((e,a)=>(u(),i("div",{key:e.id,class:"mt-3 mr-3"},[j(r,{type:"number",disabled:!1,min:"1",modelValue:m(J)[a],"onUpdate:modelValue":e=>m(J)[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 L.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:A},{default:p((()=>[b("选择短剧")])),_:1})])])])),_:1}),c("div",S,[j(h,{type:"primary",onClick:s[1]||(s[1]=e=>H(m(G)))},{default:p((()=>[b(x(l.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[M,m(N)]]),j(q,{modelValue:m(F),"onUpdate:modelValue":s[2]||(s[2]=e=>g(F)?F.value=e:null),title:"选择短剧",width:"90%",alignCenter:!0,"destroy-on-close":""},{default:p((()=>[j(a,{onConfirm:E,primary:m(L).duanjus},null,8,["primary"])])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-cf39a8e3"]]);export{I as default};
