/* empty css             *//* empty css                   */import{_ as e}from"./index-e025ca33.js";/* empty css                     *//* empty css                  *//* empty css                *//* empty css                 */import a from"./videoList-3e290e54.js";import{d as l,m as s,V as r,av as t,x as o,o as u,c as i,Z as d,f as m,l as n,w as p,a as j,e as c,F as v,y as f,cB as y,z as _,b,t as h,a9 as g,a7 as x,a5 as V,a6 as w,J as k,W as U,a0 as C,a2 as S,_ as $}from"./index-41bf27b7.js";import{o as z}from"./index-7325fac4.js";/* empty css                   *//* empty css                  *//* empty css                   */import"./index-2a89b0c2.js";import"./index.vue_vue_type_script_setup_true_lang-e74be938.js";/* 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-8edf6ccf.js";/* empty css                          *//* empty css                 *//* empty css                */import"./index-b8a1ff49.js";import"./useGetList-d550ec92.js";import"./index-f69c28c3.js";import"./http-e55ef919.js";const J={key:0,class:"flex flex-wrap mb-5"},O={class:"flex justify-end"},W=$(l({__name:"config",props:{primary:Object},emits:["close"],setup(l,{emit:$}){const W=l,q=s([]);r(),t();const L=s(!1),N=s(!1);s("");const X=s(),B=s({duanjus:[]}),F=()=>{N.value=!0},G=e=>{B.value.duanjus=e,B.value.duanjus.length>0&&(q.value=B.value.duanjus.map((e=>e.sort))),N.value=!1},I=e=>{B.value,B.value.duanjus=B.value.duanjus.map(((e,a)=>({id:e.id,sort:q.value[a],name:e.name}))),e&&(()=>{const e=new Set,a=new Set;for(const l of B.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(B.value).then((e=>{x.success(e.message),$("close")})),L.value=!1):L.value=!1})).then((()=>{})))};return W.primary&&(W.primary,B.value.id=W.primary.id,B.value.duanjus=JSON.parse(JSON.stringify(W.primary.duanjus)),B.value.duanjus.length>0&&(q.value=B.value.duanjus.map((e=>e.sort)))),o((()=>{})),(l,s)=>{const r=V,t=w,o=k,x=U,$=C,z=e,M=S;return u(),i(v,null,[d((u(),n($,{model:m(B),"label-width":"120px",ref_key:"form",ref:X,class:"pr-4"},{default:p((()=>[j(t,{label:"列表名称",prop:"ids",rules:[{required:!1,message:"列表名称必须填写"}],"label-width":"120px"},{default:p((()=>[j(r,{modelValue:W.primary.type_str,"onUpdate:modelValue":s[0]||(s[0]=e=>W.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(B).duanjus.length>0?(u(),i("div",J,[(u(!0),i(v,null,f(m(B).duanjus,((e,a)=>(u(),i("div",{key:e.id,class:"mt-3 mr-3"},[j(r,{type:"number",disabled:!1,min:"1",modelValue:m(q)[a],"onUpdate:modelValue":e=>m(q)[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 B.value.duanjus.splice(l,1);var l}},{default:p((()=>[j(m(y))])),_:2},1032,["onClick"])])))),128))])):_("",!0),c("div",null,[j(x,{type:"primary",size:"default",onClick:F},{default:p((()=>[b("选择短剧")])),_:1})])])])),_:1}),c("div",O,[j(x,{type:"primary",onClick:s[1]||(s[1]=e=>I(m(X)))},{default:p((()=>[b(h(l.$t("system.confirm")),1)])),_:1})])])),_:1},8,["model"])),[[M,m(L)]]),j(z,{modelValue:m(N),"onUpdate:modelValue":s[2]||(s[2]=e=>g(N)?N.value=e:null),title:"选择短剧",width:"90%",alignCenter:!0,"destroy-on-close":""},{default:p((()=>[j(a,{onConfirm:G,primary:m(B).duanjus},null,8,["primary"])])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-cf39a8e3"]]);export{W as default};
