"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[9242],{17338:(e,a,t)=>{t.r(a),t.d(a,{default:()=>g});var r=t(66252),l=t(3577),o=t(2262),s=t(7043),i=t(84105),n=t(96486),u=t(61446),c=t(8492),d=t(22201),v=t(93666),f=t(14533);const p={key:0},h={class:"mb-4 flex justify-between"},m={href:"https://resource-1304879925.cos.accelerate.myqcloud.com/dami/data/creatorIdDemo.xlsx",target:"blank",class:"text-primary-color cursor-pointer mr-2"},y={class:"text-primary-color cursor-pointer"},g={__name:"SearchList",setup(e){const a=(0,o.iH)(!1),t=(0,d.tv)(),{t:g}=(0,s.QT)(),b=(0,o.iH)(""),S=(0,o.iH)([]),w=(0,d.yj)(),C=(0,o.iH)(""),k=(0,r.Fl)((()=>"1"===w.query?.type)),U=(0,r.Fl)((()=>"2"===w.query?.type)),_=(0,n.debounce)((()=>{!async function(){try{const e=b.value.replace(/\n/g," ").split(" ").filter((e=>""!==e)),a=[];if(e.forEach((e=>{a.push({name:e})})),a.length<=0)return void u.ZP.success(g("dashboard.errorTips.inputCreatorId"));let r={};k.value?r=await f.Z.setCreatorWhiteList({siteId:C.value,list:a}):U.value&&(r=await f.Z.setCreatorBlackList({siteId:C.value,list:a})),1e5===r.code&&(u.ZP.success(g("dashboard.successTips.scriptSettingSave")),t.push("/"))}catch(e){console.error(e)}}()}),300);function I(){!async function(){try{a.value=!1;const e=(0,v.WI)();if(200===e.code&&e.data){C.value=e?.data.siteId;let a={};k.value?a=await f.Z.getCreatorWhiteList({siteId:C.value}):U.value&&(a=await f.Z.getCreatorBlackList({siteId:C.value})),1e5===a.code&&Array.isArray(a.data)&&a.data.forEach((e=>{b.value+=e.name+"\n"}))}a.value=!0}catch(e){console.log(e),a.value=!0}}()}function x(e,a){return S.value=[e],!1}const D=(0,n.debounce)((function(){const e=S.value[0];e&&function(e){const a=new FileReader;a.onload=e=>{!function(e){const a=new Uint8Array(e),t=i.ij(a,{type:"array"}),r=t.SheetNames[0],l=t.Sheets[r],o=i.P6.sheet_to_json(l);if(console.log(o),console.log(JSON.stringify(o)),!o||o.length<=0)return u.ZP.warning(g("dashboard.formTips.fileNoData"));const s=Object.keys(o[0])[0];b.value="",o.forEach((e=>{""===b.value?b.value+=e[s]:b.value+="\n"+e[s]}))}(e.target.result)},a.readAsArrayBuffer(e)}(e.originFileObj)}),300);return(0,r.bv)((()=>{I()})),(e,t)=>{const s=(0,r.up)("a-upload"),i=(0,r.up)("a-textarea");return a.value?((0,r.wg)(),(0,r.iD)("div",p,[(0,r._)("div",h,[(0,r._)("span",null,(0,l.toDisplayString)((0,o.SU)(g)("dashboard.form.fillCreatorName")),1),(0,r._)("div",null,[(0,r._)("a",m,(0,l.toDisplayString)((0,o.SU)(g)("dashboard.form.demoData")),1),(0,r.Wm)(s,{"file-list":S.value,"onUpdate:file-list":t[0]||(t[0]=e=>S.value=e),name:"file","show-upload-list":!1,"before-upload":x,onChange:(0,o.SU)(D)},{default:(0,r.w5)((()=>[(0,r._)("span",y,(0,l.toDisplayString)((0,o.SU)(g)("dashboard.form.batchImport")),1)])),_:1},8,["file-list","onChange"])])]),(0,r.Wm)(i,{value:b.value,"onUpdate:value":t[1]||(t[1]=e=>b.value=e),placeholder:(0,o.SU)(g)("dashboard.formTips.fillCreatorName"),maxlength:99999,rows:8,"show-count":"","allow-clear":""},null,8,["value","placeholder"]),(0,r.Wm)((0,o.SU)(c.e6),{onSave:(0,o.SU)(_)},null,8,["onSave"])])):(0,r.kq)("",!0)}}}}}]);