import{u as I}from"./usePagination.26f71951.js";import{u as N,a as M}from"./api.f7e03949.js";import{e as U}from"./emitter.bff31cdd.js";import{u as O}from"./useElTableData.076dc1a9.js";import{S as j,W as A}from"./requestCode.a7f226d1.js";import{n as V,E as B,u as W}from"./elementPlus.4833989a.js";import{d as P,a1 as q,r as D,ai as d,o as S,M as x,O as n,U as c,H as L,K as k,u as l,B as $,E as G,A as H,aq as K,S as Q,P as R,a as y,T,D as z}from"./vue.adf17aba.js";const J=P({__name:"index",props:{size:{},disabled:{type:Boolean},type:{},icon:{},nativeType:{},loadingIcon:{},plain:{type:Boolean},text:{type:Boolean},link:{type:Boolean},bg:{type:Boolean},autofocus:{type:Boolean},round:{type:Boolean},circle:{type:Boolean},color:{},dark:{type:Boolean},autoInsertSpace:{type:Boolean},tag:{}},emits:["upload-success","upload-error"],setup(E,{emit:p}){const g=E,r=q(),s=p,_=D(),i=D(!1);async function m(e){try{i.value=!0;const{file:a}=e,t=new FormData;t.append("file",a);const o=await r.api(t);v(o),e.onSuccess(o)}catch(a){console.log("Error==>",a),e.onError(a),s("upload-error",a)}finally{i.value=!1}}function h(e){_.value.clearFiles();const a=e[0];a.uid=V(),_.value.handleStart(a),_.value.submit()}function v(e){e.code===j?(B.success({message:e.msg,plain:!0}),s("upload-success",e)):e.code===A?B.warning({message:e.msg,plain:!0}):(B.error({message:e.msg,plain:!0}),s("upload-error",e))}return(e,a)=>{const t=d("el-button"),o=d("el-upload");return S(),x(o,k({ref_key:"upload",ref:_,"auto-upload":!0,"http-request":m,limit:1,"on-exceed":h,"show-file-list":l(r).showFileList,action:"#"},l(r)),{trigger:n(()=>[c(t,k({loading:l(i),plain:"",round:"",type:"warning"},g),{default:n(()=>[L(e.$slots,"default")]),_:3},16,["loading"])]),_:3},16,["show-file-list"])}}}),X=y("span",null,"序号",-1),Y={class:"font-semibold"},Z={class:"font-semibold"},ee={class:"mt-3.5 flex justify-end"},ie=P({__name:"WeightTable",setup(E){const{tableData:p,total:g,currentPage:r,pageSize:s,handlePageChange:_}=I(h),i=$("filter"),m=D(!1);U.on("QueryPage-query",()=>{h()}),G(()=>{s.value=20}),H(()=>{U.all.clear()});async function h(){const a={marketplace_Ids:i.value.marketIds,report_type:i.value.reportType,date_start:i.value.reportDate[0],date_end:i.value.reportDate[1],page:r.value,limit:s.value},{success:t,data:o}=await O(M,a,p,g,m);if(p.value=o||[],t)o&&o.length>0&&(p.value=p.value.flatMap(f=>Object.entries(f).map(([b,w])=>({keyword:b,weight:w}))));else return}function v(){console.log("success=> ")}function e(){console.log("Error=> ")}return(a,t)=>{const o=d("el-descriptions"),f=d("el-table-column"),b=d("el-table"),w=d("el-pagination"),C=d("el-card"),F=K("loading");return S(),x(C,{shadow:"hover",style:{border:"none","margin-bottom":"10px"}},{default:n(()=>[c(o,{title:"/ 特征词与权重 /"},{extra:n(()=>[c(J,{api:N,icon:l(W),plain:"",round:"",type:"warning",showFileList:!1,onUploadSuccess:v,onUploadError:e},{default:n(()=>[Q("文件上传 ")]),_:1},8,["api","icon"])]),_:1}),c(C,{shadow:"never"},{default:n(()=>[R((S(),x(b,{data:l(p),height:"600",style:{width:"100%"}},{default:n(()=>[c(f,{align:"center",type:"index",width:"60"},{header:n(()=>[X]),_:1}),c(f,{align:"center",label:"关键词",prop:"keyword"},{default:n(({row:u})=>[y("span",Y,T(u.keyword),1)]),_:1}),c(f,{align:"center",label:"权重值",prop:"weight"},{default:n(({row:u})=>[y("span",Z,T(u.weight),1)]),_:1})]),_:1},8,["data"])),[[F,l(m)]]),y("div",ee,[c(w,{"current-page":l(r),"onUpdate:currentPage":t[0]||(t[0]=u=>z(r)?r.value=u:null),"page-size":l(s),"onUpdate:pageSize":t[1]||(t[1]=u=>z(s)?s.value=u:null),"page-sizes":[10,20,30,50,100,200],total:l(g),layout:"sizes, prev, pager, next, total",onChange:l(_)},null,8,["current-page","page-size","total","onChange"])])]),_:1})]),_:1})}}});export{ie as _};
