(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-295a9974"],{"271a":function(t,a,e){"use strict";var s=e("cb2d"),i=e("e330"),r=e("577e"),n=e("d6d6"),o=URLSearchParams,c=o.prototype,l=i(c.getAll),h=i(c.has),u=new o("a=1");!u.has("a",2)&&u.has("a",void 0)||s(c,"has",(function(t){var a=arguments.length,e=a<2?void 0:arguments[1];if(a&&void 0===e)return h(this,t);var s=l(this,t);n(a,1);var i=r(e),o=0;while(ot.perPage?a("div",{staticClass:"pagination-row"},[a("el-pagination",{attrs:{background:"",layout:"prev, pager, next, jumper","current-page":t.page,"page-size":t.perPage,total:t.total},on:{"current-change":t.handlePageChange}})],1):t._e(),a("el-dialog",{attrs:{visible:t.batchDialogVisible,"show-close":!1,width:"760px","custom-class":"batch-dialog","append-to-body":""},on:{"update:visible":function(a){t.batchDialogVisible=a},close:t.resetBatchUpload}},[a("div",{staticClass:"batch-body"},[a("div",{staticClass:"batch-head"},[a("div",[a("h3",[t._v("批量增加主播")]),a("p",[t._v("请下载模板后,根据模板内容填写各主播真实信息并以主播名字命名文件")])]),a("button",{staticClass:"template-btn",attrs:{type:"button"},on:{click:t.downloadTemplate}},[t._v("信息表模板")])]),a("div",{staticClass:"batch-upload-row"},[a("span",{staticClass:"upload-field"},[t._v("主播信息表:")]),a("button",{staticClass:"upload-btn",attrs:{type:"button",disabled:t.uploadedBatchFiles.length>=30},on:{click:t.triggerBatchUpload}},[t._v("上传文件")]),a("input",{ref:"batchUploader",staticClass:"hidden-input",attrs:{type:"file",multiple:"",accept:".docx"},on:{change:t.handleBatchUpload}})]),a("div",{staticClass:"batch-tip"},[t._v("格式要求word,不超过10M;可同时上传最多30位主播信息表,支持多次选择追加")]),a("div",{staticClass:"preview-list"},t._l(t.uploadedBatchFiles,(function(e,s){return a("div",{key:e.name+s,staticClass:"preview-card"},[a("div",{staticClass:"preview-doc"},[a("button",{staticClass:"preview-remove",attrs:{type:"button"},on:{click:function(a){return t.removeBatchFile(s)}}},[t._v("×")])]),a("div",{staticClass:"preview-name",attrs:{title:e.name}},[t._v(t._s(e.name))])])})),0),a("div",{staticClass:"batch-actions"},[a("button",{staticClass:"dialog-btn ghost",attrs:{type:"button"},on:{click:t.closeBatchDialog}},[t._v("取消")]),a("button",{staticClass:"dialog-btn primary",attrs:{type:"button",disabled:t.batchSubmitting},on:{click:t.submitBatch}},[t._v(t._s(t.batchSubmitting?"提交中...":"立即提交"))])])])])],1)},i=[],r=(e("d9e2"),e("14d9"),e("1e70"),e("79a4"),e("c1a1"),e("8b00"),e("a4e7"),e("1e5a"),e("72c3"),e("0643"),e("4e3e"),e("a573"),e("9a9a"),e("88a7"),e("271a"),e("5494"),e("1fa1")),n=e("44dc"),o=e.n(n),c=e("1129"),l=e.n(c),h=e("192b"),u=e.n(h),d=e("eb00"),p=e.n(d),g=e("6b1b"),b=e.n(g),f=e("47af"),A=e.n(f),m=e("9ccc"),y=e.n(m),v=e("e8bd"),w=e.n(v),C=e("c24f");const k=30,B=10485760,I={beauty_care:"美妆护肤",fashion_apparel:"服饰穿搭",food_beverage:"食品饮料",digital:"3C数码",mother_baby:"母婴亲子",home_living:"家居生活",maternity_child:"母婴育儿",education:"教育知识",sports_outdoors:"运动户外",gaming:"游戏电竞"};function _(){return[{key:"overview",label:"首页概览",path:"/user/org",activeIcon:u.a,inactiveIcon:p.a},{key:"talent",label:"主播管理",path:"/user/org/talents",activeIcon:b.a,inactiveIcon:A.a},{key:"asset",label:"资产评估申请",path:"/user/org/assets",activeIcon:y.a,inactiveIcon:w.a}]}function E(t){return t&&"object"===typeof t?Array.isArray(t.data)&&t.meta?t:t.data&&"object"===typeof t.data&&!Array.isArray(t.data)?t.data:t:{}}function F(t){const a=t&&"object"===typeof t?t:{},e=Array.isArray(a.platform_accounts)?a.platform_accounts:[],s=null!=a.platform_count?a.platform_count:e.length;return{id:a.id,platformCode:a.account_no||"--",name:a.name||"--",category:a.streamer_type_text||a.streamer_type||I[a.streamer_type]||"--",totalFans:a.total_fans||"--",platformCount:s||0,annualProfit:a.last_year_profit||"--",authStatus:a.authorization_status_text||"--",mobile:a.phone||""}}function R(t){if(!t||"object"!==typeof t)return{success:[],failures:[]};const a=t.data&&"object"===typeof t.data&&!Array.isArray(t.data)?t.data:t;return{success:Array.isArray(a.success)?a.success:[],failures:Array.isArray(a.failures)?a.failures:[]}}var S={name:"OrganizationTalent",components:{UserShell:r["a"]},data(){return{profile:{name:"星辰传媒有限公司",role:"MCN机构",avatar:l.a,background:o.a},menuItems:_(),keyword:"",searchKeyword:"",talents:[],page:1,perPage:15,total:0,batchDialogVisible:!1,uploadedBatchFiles:[],batchSubmitting:!1}},created(){this.fetchPageData()},methods:{async fetchPageData(){await Promise.all([this.fetchProfile(),this.loadTalents()])},async fetchProfile(){try{const t=await Object(C["n"])(),a=E(t);this.profile={...this.profile,name:a.name||this.profile.name,role:a.type_text||this.profile.role,avatar:a.avatar||this.profile.avatar}}catch(t){}},async loadTalents(){try{const t=await Object(C["p"])({keyword:this.searchKeyword||void 0,page:this.page,per_page:this.perPage}),a=E(t),e=Array.isArray(a.data)?a.data:[],s=a.meta&&"object"===typeof a.meta?a.meta:{};this.talents=e.map(F),this.total=Number(s.total)||e.length,this.page=Number(s.current_page)||this.page,this.perPage=Number(s.per_page)||this.perPage}catch(t){this.talents=[],this.total=0,this.$message.error(t&&t.message?t.message:"获取主播列表失败")}},handleSearch(){this.searchKeyword=this.keyword,this.page=1,this.loadTalents()},handlePageChange(t){this.page=t,this.loadTalents()},goTalentForm(t){const a=t?{id:String(t)}:{};this.$router.push({path:"/user/org/talents/form",query:a})},async removeTalent(t){try{await this.$confirm("删除后不可恢复,确认删除该主播吗?","提示",{type:"warning"})}catch(a){return}try{await Object(C["e"])(t),this.$message.success("主播已删除"),1===this.talents.length&&this.page>1&&(this.page-=1),await this.loadTalents()}catch(a){this.$message.error(a&&a.message?a.message:"删除主播失败")}},openBatchDialog(){this.resetBatchUpload(),this.batchDialogVisible=!0},closeBatchDialog(){this.batchDialogVisible=!1,this.resetBatchUpload()},resetBatchUpload(){this.uploadedBatchFiles=[],this.$refs.batchUploader&&(this.$refs.batchUploader.value="")},triggerBatchUpload(){this.uploadedBatchFiles.length>=k?this.$message.warning(`最多只能上传${k}个主播信息表`):this.$refs.batchUploader.click()},handleBatchUpload(t){const a=Array.from(t.target.files||[]);if(t.target.value="",!a.length)return;const e=a.some(t=>!/\.docx$/i.test(t.name||""));if(e)return void this.$message.warning("仅支持上传 .docx 格式文件");const s=a.some(t=>t.size>B);if(s)return void this.$message.warning("单个文件大小不能超过10M");const i=k-this.uploadedBatchFiles.length;if(i<=0)return void this.$message.warning(`最多只能上传${k}个主播信息表`);a.length>i&&this.$message.warning(`最多只能上传${k}个主播信息表,本次仅添加${i}个`);const r=new Set(this.uploadedBatchFiles.map(t=>t.name)),n=[];a.slice(0,i).forEach(t=>{r.has(t.name)||(r.add(t.name),n.push({name:t.name,file:t}))}),n.length?this.uploadedBatchFiles=this.uploadedBatchFiles.concat(n):this.$message.warning("所选文件已存在或无可添加文件")},removeBatchFile(t){this.uploadedBatchFiles.splice(t,1)},downloadTemplate(){const t="主播信息登记表.docx",a=encodeURI("/img/"+t);fetch(a).then(t=>{if(!t.ok)throw new Error("download failed");return t.blob()}).then(a=>{const e=window.URL.createObjectURL(a),s=document.createElement("a");s.href=e,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(e)}).catch(()=>{this.$message.error("模板下载失败,请稍后重试")})},async submitBatch(){if(this.uploadedBatchFiles.length){this.batchSubmitting=!0;try{const t=await Object(C["a"])(this.uploadedBatchFiles.map(t=>t.file)),a=R(t);if(a.failures.length){const t=a.failures.map(t=>{const a=t&&t.filename?t.filename:"未知文件",e=t&&t.message?t.message:"导入失败";return`

${a}:${e}

`}).join("");if(await this.$alert(t,"批量导入失败",{customClass:"batch-alert-dialog",dangerouslyUseHTMLString:!0,confirmButtonText:"知道了"}),!a.success.length)return;this.$message.warning(`部分导入成功,成功 ${a.success.length} 个,失败 ${a.failures.length} 个`)}else this.$message.success(`批量导入已提交,共 ${this.uploadedBatchFiles.length} 个文件`);this.batchDialogVisible=!1,this.resetBatchUpload(),this.page=1,await this.loadTalents()}catch(t){this.$message.error(t&&t.message?t.message:"批量导入失败")}finally{this.batchSubmitting=!1}}else this.$message.warning("请先上传主播信息表")}},watch:{"$route.fullPath"(){this.fetchPageData()}}},x=S,D=(e("3e11"),e("cf94"),e("2877")),N=Object(D["a"])(x,s,i,!1,null,"1e7e872d",null);a["default"]=N.exports},cf94:function(t,a,e){"use strict";e("acf9")},d6d6:function(t,a,e){"use strict";var s=TypeError;t.exports=function(t,a){if(t