import{u as P}from"./usePagination.8bd548a4.js";import{u as N,a as j}from"./api.2ac1119c.js";import{e as k}from"./emitter.ca07dcc1.js";import{u as M}from"./useElTableData.5df992c8.js";import{S as V,W as L}from"./requestCode.a7f226d1.js";import{m as O,j as B,u as W}from"./elementPlus.c5b0e04f.js";import{d as F,V as q,r as x,a9 as d,o as D,E as S,G as n,M as c,y as A,B as U,u as l,q as G,v as $,p as H,af as K,K as Q,H as R,a as y,L as z,t as T}from"./vue.65d9dadc.js";const J=F({__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,_=x(),i=x(!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=O(),_.value.handleStart(a),_.value.submit()}function v(e){e.code===V?(B.success({message:e.msg,plain:!0}),s("upload-success",e)):e.code===L?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 D(),S(o,U({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,U({loading:l(i),plain:"",round:"",type:"warning"},g),{default:n(()=>[A(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=F({__name:"WeightTable",setup(E){const{tableData:p,total:g,currentPage:r,pageSize:s,handlePageChange:_}=P(h),i=G("filter"),m=x(!1);k.on("QueryPage-query",()=>{h()}),$(()=>{s.value=20}),H(()=>{k.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 M(j,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"),I=K("loading");return D(),S(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((D(),S(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,z(u.keyword),1)]),_:1}),c(f,{align:"center",label:"权重值",prop:"weight"},{default:n(({row:u})=>[y("span",Z,z(u.weight),1)]),_:1})]),_:1},8,["data"])),[[I,l(m)]]),y("div",ee,[c(w,{"current-page":l(r),"onUpdate:currentPage":t[0]||(t[0]=u=>T(r)?r.value=u:null),"page-size":l(s),"onUpdate:pageSize":t[1]||(t[1]=u=>T(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 _};
