import{E as e,k as a,q as l,p as t,n as o,r as s,s as i,v as r,O as n,P as d,l as p,m as u,o as c}from"../element-plus/element-plus.780230b7.js";import{T as m,t as f}from"../eventModel/eventModel.cb5e5cf1.js";import{Y as v,I as g,F as _}from"../facebook/facebook.a6cd46de.js";import{W as b,r as h,d as x,w as y,A as w,o as k,c as j,a as I,R as z,u as V,z as C,ae as T,I as U,O as F,P as L,L as P,a4 as S,T as D,K as M,au as N,av as R,a5 as q,F as K,Q as A,aw as E}from"../@vue/@vue.4762a280.js";import{_ as H}from"../question-filled/question-filled.26353817.js";import{h as O,_ as Y,g as B}from"../../assets/index.d04c3cc5.js";import"../dayjs/dayjs.4327edce.js";import"../axios/axios.b8790c3c.js";import"../@vueuse/@vueuse.00829289.js";import"../lodash-es/lodash-es.3d8ce632.js";import"../async-validator/async-validator.21881447.js";import"../@ctrl/@ctrl.17547d95.js";import"../escape-html/escape-html.d572c0fd.js";import"../normalize-wheel-es/normalize-wheel-es.db30398b.js";import"../vue-router/vue-router.a593c94c.js";import"../nprogress/nprogress.6ebd1c78.js";import"../pinia/pinia.07ac0f5f.js";import"../vue-demi/vue-demi.4f3c4c97.js";import"../pinia-plugin-persist/pinia-plugin-persist.67085de7.js";import"../echarts/echarts.f2b2ac0c.js";import"../tslib/tslib.e35f93b8.js";import"../zrender/zrender.fe59a237.js";const Q=e=>(N("data-v-5a2658d9"),e=e(),R(),e),W={class:"screen_box"},G={class:"flex_between screen_box_1"},J={class:"fitler-item"},X=Q((()=>I("div",{class:"filter-lable"},"广告账号",-1))),Z=q("    "),$=Q((()=>I("div",{class:"filter-lable"},"人群包ID",-1))),ee=q("    "),ae=Q((()=>I("div",{class:"filter-lable"},"人群包名称",-1))),le=q("    "),te={class:"table_container"},oe={class:"flex_center"},se=["innerHTML"],ie={class:"cellDiv"},re={class:"clampTwo line21",style:{flex:"1"}},ne=Q((()=>I("div",{class:"flex_center"},"操作",-1))),de=q("禁用"),pe=q("启用"),ue={key:0,class:"tMar10 flex",style:{"justify-content":"center"}};var ce=Y(x({__name:"tiktok",props:{renew:{type:Number,default:1}},setup(n){const d=n;y((()=>d.renew),((e,a)=>{R()}));const{advertiserId:p,orientationId:u,orientationName:c,pagination:m,loading:v}=(({})=>{const e=h(),a=h(),l=h(),t=h(!1);return{advertiserId:e,orientationId:a,orientationName:l,pagination:b({page:1,total:0,pageSize:20}),loading:t}})({}),{tableInfo:g}=(({})=>({tableInfo:b({extra:{},tableList:[],descol:[{prop:"advertiser_id",label:"广告账户ID"},{prop:"orientation_name",label:"人群包名称"},{prop:"orientation_id",label:"人群包ID"}]})}))({}),_=e=>{m.page=e,N()},x=a=>{v.value=!0;let l=1-a.enable;var t;(t={enable:l,population_ids:a.id},new Promise((async(a,l)=>{const o=await O.post("/api/population/changeStatus",t);0==o.code?a(o.data):(e.error(o.msg),l())}))).then((e=>{v.value=!1})).catch((()=>{v.value=!1}))},N=()=>{var a;v.value=!0,(a={advertiser_id:p.value,orientation_id:u.value,orientation_name:c.value,page:m.page,page_size:m.pageSize},new Promise((async(l,t)=>{const o=await O.post("/api/population/lists",a);0==o.code?l(o.data):(e.error(o.msg),t())}))).then((e=>{g.tableList=e.data,v.value=!1,m.total=e.pageInfo.totalNum})).catch((()=>{v.value=!1}))};w((()=>{R()}));const R=()=>{m.page=1,N()};return(e,n)=>{const d=a,b=H,h=l,y=t,w=o,N=s,q=i,K=r;return k(),j(P,null,[I("div",W,[I("div",G,[I("div",J,[X,z(d,{modelValue:V(p),"onUpdate:modelValue":n[0]||(n[0]=e=>C(p)?p.value=e:null),placeholder:"搜索广告账号ID",style:{width:"200px"},onKeyup:n[1]||(n[1]=T((e=>R()),["enter","native"]))},null,8,["modelValue"]),Z,$,z(d,{modelValue:V(u),"onUpdate:modelValue":n[2]||(n[2]=e=>C(u)?u.value=e:null),placeholder:"搜索人群包ID",style:{width:"200px"},onKeyup:n[3]||(n[3]=T((e=>R()),["enter","native"]))},null,8,["modelValue"]),ee,ae,z(d,{modelValue:V(c),"onUpdate:modelValue":n[4]||(n[4]=e=>C(c)?c.value=e:null),placeholder:"搜索人群包名称",style:{width:"200px"},onKeyup:n[5]||(n[5]=T((e=>R()),["enter","native"]))},null,8,["modelValue"]),le])])]),I("div",te,[U((k(),F(N,{ref:"tableRef",data:V(g).tableList,"header-cell-style":V(f),style:{width:"100%"},"empty-text":"暂无数据","max-height":"calc(100vh - 400px)"},{default:L((()=>[(k(!0),j(P,null,S(V(g).descol,(e=>(k(),F(y,{fixed:e.fixed,prop:e.prop,"min-width":e.width?e.width:"90px",align:"center"},{header:L((()=>[I("div",oe,[I("span",null,D(e.label),1),e.note?(k(),F(h,{key:0,placement:"top",effect:"dark"},{content:L((()=>[I("span",{innerHTML:e.note},null,8,se)])),default:L((()=>[z(b,{class:"c-999 f14 pointer"})])),_:2},1024)):M("",!0)])])),default:L((a=>[I("div",ie,[z(h,{disabled:!(a.row[e.prop]&&a.row[e.prop].length>30),effect:"dark",content:a.row[e.prop]+""},{default:L((()=>[I("div",re,D(a.row[e.prop]||0==a.row[e.prop]?a.row[e.prop]:"-"),1)])),_:2},1032,["disabled","content"])])])),_:2},1032,["fixed","prop","min-width"])))),256)),z(y,{fixed:"right",width:"80px"},{header:L((()=>[ne])),default:L((({row:e})=>[1==e.enable?(k(),F(w,{key:0,style:{width:"20px"},type:"primary",text:"",onClick:a=>x(e)},{default:L((()=>[de])),_:2},1032,["onClick"])):(k(),F(w,{key:1,style:{width:"20px"},type:"primary",text:"",onClick:a=>x(e)},{default:L((()=>[pe])),_:2},1032,["onClick"]))])),_:1})])),_:1},8,["data","header-cell-style"])),[[K,V(v)]]),Number(V(m).total)>0?(k(),j("div",ue,[z(q,{currentPage:V(m).page,"onUpdate:currentPage":n[6]||(n[6]=e=>V(m).page=e),"page-size":V(m).pageSize,"onUpdate:page-size":n[7]||(n[7]=e=>V(m).pageSize=e),background:"",total:V(m).total,onCurrentChange:_},null,8,["currentPage","page-size","total"])])):M("",!0)])],64)}}}),[["__scopeId","data-v-5a2658d9"]]);const me=e=>(N("data-v-7065b022"),e=e(),R(),e),fe=q("点击上传"),ve=me((()=>I("p",{class:"file-info flex",style:{"margin-left":"80px"}},[q("请使用此模板进行数据导入,点击下载 "),I("a",{href:"https://zhitou.wenxingshuju.com/template/population_template.xlsx",class:"c-theme pointer"},"Excel模板")],-1))),ge={class:"dialog-footer"},_e=q(" 取 消 "),be=q(" 确 认 ");var he=Y(x({__name:"tableUpload",emits:["close"],setup(e,{expose:a,emit:l}){const t=h(!1),s=h(!1),i=h(),m=h(),f=h("/api/population/importInfo"),v=b({platform:1,file:""}),g={admin_id:B("admin_id"),ttl:B("ttl"),sign:B("sign")},_=b({file:[{required:!0,message:"请选择文件",trigger:"blur"}]}),x=e=>{i.value.clearFiles();const a=e[0];a.uid=d(),i.value.handleStart(a)},y=(e,a)=>{v.file=(null==e?void 0:e.name)||""},w=(e,a)=>{a&&0!=a.length||(v.file="")},j=e=>{s.value=!1,"0"==e.code&&(t.value=!1,l("close",v.platform))},V=e=>{s.value=!1},C=()=>{t.value=!1};return a({initFun:(e,a)=>{t.value=e,v.platform=a}}),(e,a)=>{const l=o,d=n,b=p,h=u,T=c,P=r;return k(),F(T,{"destroy-on-close":!0,"close-on-click-modal":!1,modelValue:t.value,"onUpdate:modelValue":a[1]||(a[1]=e=>t.value=e),title:"上传表格",width:"500px","before-close":C},{footer:L((()=>[I("span",ge,[z(l,{onClick:C},{default:L((()=>[_e])),_:1}),U((k(),F(l,{type:"primary",onClick:a[0]||(a[0]=e=>(async e=>{e&&await e.validate(((e,a)=>{e&&(s.value=!0,i.value.submit())}))})(m.value))},{default:L((()=>[be])),_:1})),[[P,s.value,void 0,{fullscreen:!0,lock:!0}]])])])),default:L((()=>[z(h,{ref_key:"ruleFormRef",ref:m,model:v,rules:_,"label-width":"80px",size:"default","status-icon":""},{default:L((()=>[z(b,{label:"选择表格",prop:"file"},{default:L((()=>[z(d,{ref_key:"uploadRef",ref:i,action:f.value,"auto-upload":!1,"on-exceed":x,"on-change":y,"on-remove":w,"on-success":j,"on-error":V,accept:".xlsx",limit:1,data:g,name:"file"},{trigger:L((()=>[z(l,{type:"primary",disabled:!v.platform},{default:L((()=>[fe])),_:1},8,["disabled"])])),_:1},8,["action"])])),_:1}),ve])),_:1},8,["model","rules"])])),_:1},8,["modelValue"])}}}),[["__scopeId","data-v-7065b022"]]);const xe={class:"flex_between box_1"},ye=(e=>(N("data-v-f2311356"),e=e(),R(),e))((()=>I("div",{class:"platformBox flex_1"},null,-1))),we={class:"flex f14"},ke=q("导入");var je=Y(x({__name:"index",setup(e){const a=h(),{platformActive:l}={platformList:b([{id:1,name:"TikTok",img:m},{id:2,name:"YouTube",img:v},{id:3,name:"INS",img:g},{id:4,name:"Facebook",img:_}]),platformActive:h(1)},t=K(),s=h(1);w((()=>{i()}));const i=()=>{1==l.value&&(t.value=ce)},r=()=>{var e;null==(e=a.value)||e.initFun(!0,l.value)},n=e=>{s.value++};return(e,l)=>{const i=o;return k(),j(P,null,[I("div",xe,[ye,I("div",we,[z(i,{type:"primary",class:"lMar10",onClick:r},{default:L((()=>[ke])),_:1})])]),(k(),F(E,null,[(k(),F(A(V(t)),{renew:s.value},null,8,["renew"]))],1024)),z(he,{ref_key:"TableUploadRef",ref:a,onClose:n},null,512)],64)}}}),[["__scopeId","data-v-f2311356"]]);export{je as default};