From afffb7aad273f7a03790ec71009cf1c8765e87f0 Mon Sep 17 00:00:00 2001 From: super <2903208875@qq.com> Date: Mon, 6 Apr 2026 16:58:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=8B=E8=BD=BD=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/.env | 4 +- app/assets/convert.js | 2 +- app/assets/dedupe.js | 2 +- app/assets/delete-brand.js | 2 +- app/assets/split.js | 2 +- app/main.py | 27 ++++++++-- app/new_web_source/convert.html | 4 +- app/new_web_source/dedupe.html | 4 +- app/new_web_source/delete-brand.html | 4 +- app/new_web_source/split.html | 4 +- .../brand/components/BrandProductRiskTab.vue | 50 +++++++++++++++++++ 11 files changed, 87 insertions(+), 18 deletions(-) diff --git a/app/.env b/app/.env index 856e41a..085b36a 100644 --- a/app/.env +++ b/app/.env @@ -12,7 +12,7 @@ zn_username=%E8%87%AA%E5%8A%A8%E5%8C%96_Robot client_name=ShuFuAI -java_api_base=http://127.0.0.1:18080 -# java_api_base=http://8.136.19.173:18080 +# java_api_base=http://127.0.0.1:18080 +java_api_base=http://8.136.19.173:18080 diff --git a/app/assets/convert.js b/app/assets/convert.js index 20f8bcb..756eba2 100644 --- a/app/assets/convert.js +++ b/app/assets/convert.js @@ -1 +1 @@ -import{d as A,o as H,a as n,c as o,b as z,B as K,e as s,F as w,r as F,t as i,f as _,n as E,w as M,s as j,u as q,g as u,h as T,x as J,i as k,E as r,y as L,z as O,A as G,_ as Q,p as W,q as X}from"./pywebview-BCPdlDdb.js";import{e as Y}from"./brand-CFZZtTv8.js";const Z={class:"page-shell module-page"},ee={class:"main-content"},se={class:"left-panel"},te={class:"upload-zone"},ae={class:"selected-files clean-placeholder"},le={key:0,class:"more-line"},ne={key:1},oe={class:"option-group"},re=["value"],ie={class:"template-item-content"},ce={class:"label"},ue={key:0,class:"template-tag"},de={key:1,class:"template-tag muted"},ve={key:2,class:"template-tag custom"},pe={class:"desc"},_e={key:0,class:"empty-option"},fe={class:"option-group"},me={class:"radio-item active"},he={class:"desc"},ye={class:"run-row"},ge=["disabled"],be={class:"loading-msg"},we={class:"right-panel"},ke={class:"task-list-wrap"},Ce={class:"clean-result-summary"},xe={class:"summary-card"},Fe={class:"summary-card"},Pe={class:"summary-card"},Ee={class:"result-list-wrap"},Te={key:0,class:"empty-tasks"},Ie={key:1,class:"task-list clean-result-list"},Be={class:"left"},Ne=["title"],$e={key:0,class:"files"},De={key:1,class:"files"},Re={class:"task-right"},Se=["onClick"],Ue=["onClick"],Ve=A({__name:"BrandConvertTab",setup(He){const v=u([]),g=u(""),f=u([]),m=u(!1),b=u([]),h=u({total:0,successCount:0,failedCount:0,items:[]}),d=u([]),c=u(""),C=T(()=>v.value.slice(0,8)),I=T(()=>d.value.find(a=>a.id===c.value)||null);async function P(a){const e=k();if(!e?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const l of a){const p=typeof l=="string"?l:l.absolutePath,V=typeof l=="string"?void 0:l.relativePath,y=await e.upload_file_to_java(p,V);if(!y?.success||!y.data)throw new Error(y?.error||y?.message||`上传失败:${p}`);t.push(y.data)}return t}async function B(a){const e=await J();d.value=e||[];const t=d.value.find(p=>p.id===c.value);if(t){c.value=t.id;return}const l=d.value.find(p=>p.isDefault);if(l){c.value=l.id;return}c.value=d.value[0]?.id||""}async function N(a,e){v.value=a,g.value="",f.value=await P(a),r.success(e)}async function $(){const a=k();if(!a?.select_brand_xlsx_files){r.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const e=await a.select_brand_xlsx_files();if(!e?.length)return;await N(e,`已选择 ${e.length} 个待转换文件`)}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function D(){const a=k();if(!a?.select_brand_folder){r.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const e=await a.select_brand_folder();if(!e)return;g.value=e.split(/[/\\]/).filter(Boolean).pop()||"";const t=await Y(e);if(t.success&&t.items?.length){v.value=t.items.map(l=>l.relativePath),f.value=await P(t.items),r.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`);return}r.warning(t.error||"该文件夹下没有 xlsx 文件")}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function R(){if(!f.value.length){r.warning("请先选择待转换 Excel 文件或文件夹");return}if(!c.value){r.warning("请先选择模板");return}try{m.value=!0;const a=await L({files:f.value.map(e=>({fileKey:e.fileKey,originalFilename:e.originalFilename,relativePath:e.relativePath})),templateId:c.value,archiveName:f.value.some(e=>!!e.relativePath)&&g.value?g.value:void 0});h.value=a,b.value=a.items||[],await x(),r.success("格式转换完成")}catch(a){r.error(a instanceof Error?a.message:"格式转换失败")}finally{m.value=!1}}async function x(){try{const a=await O();b.value=a.items||[],h.value={total:a.items?.length||0,successCount:a.items?.filter(e=>e.success).length||0,failedCount:a.items?.filter(e=>!e.success).length||0,items:a.items||[]}}catch{}}async function S(a){try{await G(a),await x(),r.success("已删除")}catch(e){r.error(e instanceof Error?e.message:"删除失败")}}async function U(a){const e=k();if(!a.downloadUrl){r.warning("当前结果没有下载地址");return}const t=a.outputFilename||`${new Date().toISOString().slice(0,10).replace(/-/g,"")}.txt`;if(e?.save_file_from_url){const l=await e.save_file_from_url(a.downloadUrl,t);l.success?r.success(`已保存:${l.path||t}`):l.error&&l.error!=="用户取消"&&r.error(l.error);return}window.open(a.downloadUrl,"_blank")}return H(()=>{B().catch(()=>{}),x().catch(()=>{})}),(a,e)=>(n(),o("div",Z,[z(K,{active:"convert"}),s("div",ee,[s("aside",se,[e[5]||(e[5]=s("div",{class:"section-title"},"选择文件",-1)),s("div",te,[e[1]||(e[1]=s("div",{class:"hint"},"选择需要转换的 Excel 文件或文件夹,将按所选模板生成 txt 文件。",-1)),s("div",{class:"btns"},[s("button",{type:"button",class:"opt-btn",onClick:$},"选择 Excel 文件"),s("button",{type:"button",class:"opt-btn",onClick:D},"选择文件夹")]),s("div",ae,[v.value.length?(n(),o(w,{key:0},[(n(!0),o(w,null,F(C.value,t=>(n(),o("span",{key:t},i(t),1))),128)),v.value.length>C.value.length?(n(),o("span",le," 还有 "+i(v.value.length-C.value.length)+" 个文件未展开显示 ",1)):_("",!0)],64)):(n(),o("span",ne,"暂未选择待转换文件"))])]),e[6]||(e[6]=s("div",{class:"section-title"},"模板选择",-1)),s("div",oe,[(n(!0),o(w,null,F(d.value,t=>(n(),o("label",{key:t.id,class:E(["radio-item",{active:c.value===t.id}])},[M(s("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>c.value=l),type:"radio",value:t.id,name:"convert-template"},null,8,re),[[j,c.value]]),s("div",ie,[s("div",null,[s("span",ce,[q(i(t.templateName)+" ",1),t.isDefault?(n(),o("span",ue,"默认")):t.builtIn?(n(),o("span",de,"内置")):(n(),o("span",ve,"自定义"))]),s("div",pe,"输出文件:"+i(t.outputFilename),1)])])],2))),128)),d.value.length?_("",!0):(n(),o("div",_e,"暂无可用模板"))]),e[7]||(e[7]=s("div",{class:"section-title"},"转换说明",-1)),s("div",fe,[s("label",me,[e[3]||(e[3]=s("input",{type:"checkbox",checked:"",disabled:""},null,-1)),s("div",null,[e[2]||(e[2]=s("span",{class:"label"},"按当前模板输出",-1)),s("div",he,"当前模板:"+i(I.value?.templateName||"未加载模板"),1)])]),e[4]||(e[4]=s("label",{class:"radio-item active"},[s("input",{type:"checkbox",checked:"",disabled:""}),s("div",null,[s("span",{class:"label"},"SKU 使用雪花ID-序号"),s("div",{class:"desc"},"例如 1773816146796-1")])],-1))]),s("div",ye,[s("button",{type:"button",class:"btn-run",disabled:m.value,onClick:R},i(m.value?"转换中...":"开始转换"),9,ge),s("span",be,i(m.value?"正在生成并上传结果,请稍候…":"选择文件后即可执行格式转换,结果会显示在右侧供下载"),1)])]),s("section",we,[e[12]||(e[12]=s("div",{class:"panel-header"},"转换结果",-1)),s("div",ke,[s("div",Ce,[s("div",xe,[e[8]||(e[8]=s("span",{class:"summary-label"},"已处理文件",-1)),s("strong",null,i(h.value.total),1)]),s("div",Fe,[e[9]||(e[9]=s("span",{class:"summary-label"},"成功结果",-1)),s("strong",null,i(h.value.successCount),1)]),s("div",Pe,[e[10]||(e[10]=s("span",{class:"summary-label"},"失败文件",-1)),s("strong",null,i(h.value.failedCount),1)])]),s("div",Ee,[e[11]||(e[11]=s("div",{class:"result-list-header"},[s("span",null,"生成的结果压缩包列表")],-1)),b.value.length===0?(n(),o("div",Te," 暂无转换结果,完成格式转换后会在这里展示结果压缩包 ")):(n(),o("ul",Ie,[(n(!0),o(w,null,F(b.value,t=>(n(),o("li",{key:`${t.resultId||t.outputFilename||t.sourceFilename}`,class:"task-item"},[s("div",Be,[s("span",{class:"id",title:t.sourceFilename},i(t.sourceFilename||"-"),9,Ne),t.outputFilename?(n(),o("div",$e,"压缩包文件:"+i(t.outputFilename),1)):_("",!0),t.error?(n(),o("div",De,"错误信息:"+i(t.error),1)):_("",!0)]),s("div",Re,[s("span",{class:E(["status",t.success?"success":"failed"])},i(t.success?"已完成":"失败"),3),t.success&&t.downloadUrl?(n(),o("button",{key:0,type:"button",class:"download",onClick:l=>U(t)}," 下载压缩包 ",8,Se)):_("",!0),t.resultId?(n(),o("button",{key:1,type:"button",class:"btn-delete",onClick:l=>S(t.resultId)}," 删除 ",8,Ue)):_("",!0)])]))),128))]))])])])])]))}}),Ae=Q(Ve,[["__scopeId","data-v-89690cc3"]]);W(Ae).use(X).mount("#app"); +import{d as A,o as H,a as n,c as o,b as z,B as K,e as s,F as w,r as F,t as i,f as _,n as E,w as M,s as j,u as q,g as u,h as T,x as J,i as k,E as r,y as L,z as O,A as G,_ as Q,p as W,q as X}from"./pywebview-V_UIajJm.js";import{e as Y}from"./brand-1nUVsWrm.js";const Z={class:"page-shell module-page"},ee={class:"main-content"},se={class:"left-panel"},te={class:"upload-zone"},ae={class:"selected-files clean-placeholder"},le={key:0,class:"more-line"},ne={key:1},oe={class:"option-group"},re=["value"],ie={class:"template-item-content"},ce={class:"label"},ue={key:0,class:"template-tag"},de={key:1,class:"template-tag muted"},ve={key:2,class:"template-tag custom"},pe={class:"desc"},_e={key:0,class:"empty-option"},fe={class:"option-group"},me={class:"radio-item active"},he={class:"desc"},ye={class:"run-row"},ge=["disabled"],be={class:"loading-msg"},we={class:"right-panel"},ke={class:"task-list-wrap"},Ce={class:"clean-result-summary"},xe={class:"summary-card"},Fe={class:"summary-card"},Pe={class:"summary-card"},Ee={class:"result-list-wrap"},Te={key:0,class:"empty-tasks"},Ie={key:1,class:"task-list clean-result-list"},Be={class:"left"},Ne=["title"],$e={key:0,class:"files"},De={key:1,class:"files"},Re={class:"task-right"},Se=["onClick"],Ue=["onClick"],Ve=A({__name:"BrandConvertTab",setup(He){const v=u([]),g=u(""),f=u([]),m=u(!1),b=u([]),h=u({total:0,successCount:0,failedCount:0,items:[]}),d=u([]),c=u(""),C=T(()=>v.value.slice(0,8)),I=T(()=>d.value.find(a=>a.id===c.value)||null);async function P(a){const e=k();if(!e?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const l of a){const p=typeof l=="string"?l:l.absolutePath,V=typeof l=="string"?void 0:l.relativePath,y=await e.upload_file_to_java(p,V);if(!y?.success||!y.data)throw new Error(y?.error||y?.message||`上传失败:${p}`);t.push(y.data)}return t}async function B(a){const e=await J();d.value=e||[];const t=d.value.find(p=>p.id===c.value);if(t){c.value=t.id;return}const l=d.value.find(p=>p.isDefault);if(l){c.value=l.id;return}c.value=d.value[0]?.id||""}async function N(a,e){v.value=a,g.value="",f.value=await P(a),r.success(e)}async function $(){const a=k();if(!a?.select_brand_xlsx_files){r.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const e=await a.select_brand_xlsx_files();if(!e?.length)return;await N(e,`已选择 ${e.length} 个待转换文件`)}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function D(){const a=k();if(!a?.select_brand_folder){r.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const e=await a.select_brand_folder();if(!e)return;g.value=e.split(/[/\\]/).filter(Boolean).pop()||"";const t=await Y(e);if(t.success&&t.items?.length){v.value=t.items.map(l=>l.relativePath),f.value=await P(t.items),r.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`);return}r.warning(t.error||"该文件夹下没有 xlsx 文件")}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function R(){if(!f.value.length){r.warning("请先选择待转换 Excel 文件或文件夹");return}if(!c.value){r.warning("请先选择模板");return}try{m.value=!0;const a=await L({files:f.value.map(e=>({fileKey:e.fileKey,originalFilename:e.originalFilename,relativePath:e.relativePath})),templateId:c.value,archiveName:f.value.some(e=>!!e.relativePath)&&g.value?g.value:void 0});h.value=a,b.value=a.items||[],await x(),r.success("格式转换完成")}catch(a){r.error(a instanceof Error?a.message:"格式转换失败")}finally{m.value=!1}}async function x(){try{const a=await O();b.value=a.items||[],h.value={total:a.items?.length||0,successCount:a.items?.filter(e=>e.success).length||0,failedCount:a.items?.filter(e=>!e.success).length||0,items:a.items||[]}}catch{}}async function S(a){try{await G(a),await x(),r.success("已删除")}catch(e){r.error(e instanceof Error?e.message:"删除失败")}}async function U(a){const e=k();if(!a.downloadUrl){r.warning("当前结果没有下载地址");return}const t=a.outputFilename||`${new Date().toISOString().slice(0,10).replace(/-/g,"")}.txt`;if(e?.save_file_from_url){const l=await e.save_file_from_url(a.downloadUrl,t);l.success?r.success(`已保存:${l.path||t}`):l.error&&l.error!=="用户取消"&&r.error(l.error);return}window.open(a.downloadUrl,"_blank")}return H(()=>{B().catch(()=>{}),x().catch(()=>{})}),(a,e)=>(n(),o("div",Z,[z(K,{active:"convert"}),s("div",ee,[s("aside",se,[e[5]||(e[5]=s("div",{class:"section-title"},"选择文件",-1)),s("div",te,[e[1]||(e[1]=s("div",{class:"hint"},"选择需要转换的 Excel 文件或文件夹,将按所选模板生成 txt 文件。",-1)),s("div",{class:"btns"},[s("button",{type:"button",class:"opt-btn",onClick:$},"选择 Excel 文件"),s("button",{type:"button",class:"opt-btn",onClick:D},"选择文件夹")]),s("div",ae,[v.value.length?(n(),o(w,{key:0},[(n(!0),o(w,null,F(C.value,t=>(n(),o("span",{key:t},i(t),1))),128)),v.value.length>C.value.length?(n(),o("span",le," 还有 "+i(v.value.length-C.value.length)+" 个文件未展开显示 ",1)):_("",!0)],64)):(n(),o("span",ne,"暂未选择待转换文件"))])]),e[6]||(e[6]=s("div",{class:"section-title"},"模板选择",-1)),s("div",oe,[(n(!0),o(w,null,F(d.value,t=>(n(),o("label",{key:t.id,class:E(["radio-item",{active:c.value===t.id}])},[M(s("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>c.value=l),type:"radio",value:t.id,name:"convert-template"},null,8,re),[[j,c.value]]),s("div",ie,[s("div",null,[s("span",ce,[q(i(t.templateName)+" ",1),t.isDefault?(n(),o("span",ue,"默认")):t.builtIn?(n(),o("span",de,"内置")):(n(),o("span",ve,"自定义"))]),s("div",pe,"输出文件:"+i(t.outputFilename),1)])])],2))),128)),d.value.length?_("",!0):(n(),o("div",_e,"暂无可用模板"))]),e[7]||(e[7]=s("div",{class:"section-title"},"转换说明",-1)),s("div",fe,[s("label",me,[e[3]||(e[3]=s("input",{type:"checkbox",checked:"",disabled:""},null,-1)),s("div",null,[e[2]||(e[2]=s("span",{class:"label"},"按当前模板输出",-1)),s("div",he,"当前模板:"+i(I.value?.templateName||"未加载模板"),1)])]),e[4]||(e[4]=s("label",{class:"radio-item active"},[s("input",{type:"checkbox",checked:"",disabled:""}),s("div",null,[s("span",{class:"label"},"SKU 使用雪花ID-序号"),s("div",{class:"desc"},"例如 1773816146796-1")])],-1))]),s("div",ye,[s("button",{type:"button",class:"btn-run",disabled:m.value,onClick:R},i(m.value?"转换中...":"开始转换"),9,ge),s("span",be,i(m.value?"正在生成并上传结果,请稍候…":"选择文件后即可执行格式转换,结果会显示在右侧供下载"),1)])]),s("section",we,[e[12]||(e[12]=s("div",{class:"panel-header"},"转换结果",-1)),s("div",ke,[s("div",Ce,[s("div",xe,[e[8]||(e[8]=s("span",{class:"summary-label"},"已处理文件",-1)),s("strong",null,i(h.value.total),1)]),s("div",Fe,[e[9]||(e[9]=s("span",{class:"summary-label"},"成功结果",-1)),s("strong",null,i(h.value.successCount),1)]),s("div",Pe,[e[10]||(e[10]=s("span",{class:"summary-label"},"失败文件",-1)),s("strong",null,i(h.value.failedCount),1)])]),s("div",Ee,[e[11]||(e[11]=s("div",{class:"result-list-header"},[s("span",null,"生成的结果压缩包列表")],-1)),b.value.length===0?(n(),o("div",Te," 暂无转换结果,完成格式转换后会在这里展示结果压缩包 ")):(n(),o("ul",Ie,[(n(!0),o(w,null,F(b.value,t=>(n(),o("li",{key:`${t.resultId||t.outputFilename||t.sourceFilename}`,class:"task-item"},[s("div",Be,[s("span",{class:"id",title:t.sourceFilename},i(t.sourceFilename||"-"),9,Ne),t.outputFilename?(n(),o("div",$e,"压缩包文件:"+i(t.outputFilename),1)):_("",!0),t.error?(n(),o("div",De,"错误信息:"+i(t.error),1)):_("",!0)]),s("div",Re,[s("span",{class:E(["status",t.success?"success":"failed"])},i(t.success?"已完成":"失败"),3),t.success&&t.downloadUrl?(n(),o("button",{key:0,type:"button",class:"download",onClick:l=>U(t)}," 下载压缩包 ",8,Se)):_("",!0),t.resultId?(n(),o("button",{key:1,type:"button",class:"btn-delete",onClick:l=>S(t.resultId)}," 删除 ",8,Ue)):_("",!0)])]))),128))]))])])])])]))}}),Ae=Q(Ve,[["__scopeId","data-v-89690cc3"]]);W(Ae).use(X).mount("#app"); diff --git a/app/assets/dedupe.js b/app/assets/dedupe.js index 42cc314..2e64199 100644 --- a/app/assets/dedupe.js +++ b/app/assets/dedupe.js @@ -1 +1 @@ -import{d as z,o as W,a as n,c as o,b as q,B as J,e as s,F as C,r as F,t as i,f as b,n as I,w as P,v as B,g as u,h as L,i as x,E as r,j as O,k as G,l as Q,m as X,_ as Y,p as Z,q as ee}from"./pywebview-BCPdlDdb.js";import{e as se}from"./brand-CFZZtTv8.js";const te={class:"page-shell module-page"},le={class:"main-content"},ae={class:"left-panel"},ne={class:"upload-zone"},oe={class:"selected-files clean-placeholder"},re={key:0,class:"more-line"},ie={key:1},ue={class:"option-group column-option-group"},ce={class:"column-toolbar"},de={class:"column-count"},ve={key:0,class:"column-grid"},pe=["value"],fe={key:1,class:"empty-column-state"},_e={class:"option-group"},me={class:"run-row"},he=["disabled"],ge={class:"loading-msg"},ye={class:"right-panel"},be={class:"task-list-wrap"},we={class:"clean-result-summary"},ke={class:"summary-card"},Ce={class:"summary-card"},Ie={class:"summary-card"},xe={class:"result-list-wrap"},Ee={key:0,class:"empty-tasks"},De={key:1,class:"task-list clean-result-list"},Fe={class:"left"},Pe=["title"],Be={key:0,class:"files"},Se={key:1,class:"files"},Ue={class:"task-right"},Ne=["onClick"],$e=["onClick"],Ae=z({__name:"BrandDedupeTab",setup(Ke){const p=u([]),c=u([]),f=u([]),w=u(""),d=u([]),S=u(!1),_=u(!0),m=u(!0),h=u(!1),k=u([]),g=u({total:0,successCount:0,failedCount:0,items:[]}),E=L(()=>f.value.slice(0,8));function $(){c.value=[...p.value]}function A(){c.value=[]}async function U(l){const e=x();if(!e?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const a of l){const v=typeof a=="string"?a:a.absolutePath,j=typeof a=="string"?void 0:a.relativePath,y=await e.upload_file_to_java(v,j);if(!y?.success||!y.data)throw new Error(y?.error||y?.message||`上传失败:${v}`);t.push(y.data)}return t}async function N(l){const e=await X(l);if(!e.headers?.length){r.error("读取 Excel 表头失败"),p.value=[],c.value=[];return}const t=["id","ASIN","国家","价格","卖家名称"],a=[...t.filter(v=>e.headers?.includes(v)),...(e.headers||[]).filter(v=>!t.includes(v))];p.value=a,c.value=t.filter(v=>a.includes(v))}async function H(l,e){f.value=l,w.value="",d.value=await U(l),d.value.length>0&&await N(d.value[0].fileKey),r.success(e)}async function K(){const l=x();if(!l?.select_brand_xlsx_files){r.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const e=await l.select_brand_xlsx_files();if(!e?.length)return;await H(e,`已选择 ${e.length} 个待清洗文件`)}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function R(){const l=x();if(!l?.select_brand_folder){r.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const e=await l.select_brand_folder();if(!e)return;w.value=e.split(/[/\\]/).filter(Boolean).pop()||"";const t=await se(e);if(t.success&&t.items?.length){f.value=t.items.map(a=>a.relativePath),d.value=await U(t.items),d.value.length>0&&await N(d.value[0].fileKey),r.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`);return}r.warning(t.error||"该文件夹下没有 xlsx 文件")}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function V(){if(!d.value.length){r.warning("请先选择待清洗 Excel 文件或文件夹");return}if(!c.value.length){r.warning("请至少选择一列保留列");return}if(!S.value&&!_.value&&!m.value){r.warning("请至少选择一种 ID 保留规则");return}try{h.value=!0;const l=await O({files:d.value.map(e=>({fileKey:e.fileKey,originalFilename:e.originalFilename,relativePath:e.relativePath})),selectedColumns:c.value,keepIntegerIds:S.value,keepUnderscoreIds:_.value,keepIntegerMainIdsWhenNoSubIds:m.value,archiveName:d.value.some(e=>!!e.relativePath)&&w.value?w.value:void 0});g.value=l,k.value=l.items||[],await D(),r.success("数据去重完成")}catch(l){r.error(l instanceof Error?l.message:"去重失败")}finally{h.value=!1}}async function D(){try{const l=await G();k.value=l.items||[],g.value={total:l.items?.length||0,successCount:l.items?.filter(e=>e.success).length||0,failedCount:l.items?.filter(e=>!e.success).length||0,items:l.items||[]}}catch{}}async function M(l){try{await Q(l),await D(),r.success("已删除")}catch(e){r.error(e instanceof Error?e.message:"删除失败")}}async function T(l){const e=x();if(!l.downloadUrl){r.warning("当前结果没有下载地址");return}const t=l.outputFilename||`${new Date().toISOString().slice(0,10).replace(/-/g,"")}_cleaned.xlsx`;if(e?.save_file_from_url){const a=await e.save_file_from_url(l.downloadUrl,t);a.success?r.success(`已保存:${a.path||t}`):a.error&&a.error!=="用户取消"&&r.error(a.error);return}window.open(l.downloadUrl,"_blank")}return W(()=>{D().catch(()=>{})}),(l,e)=>(n(),o("div",te,[q(J,{active:"dedupe"}),s("div",le,[s("aside",ae,[e[7]||(e[7]=s("div",{class:"section-title"},"选择文件",-1)),s("div",ne,[e[3]||(e[3]=s("div",{class:"hint"},"选择需要清洗的 Excel 文件或文件夹,后续将按所选规则输出处理结果。",-1)),s("div",{class:"btns"},[s("button",{type:"button",class:"opt-btn",onClick:K},"选择 Excel 文件"),s("button",{type:"button",class:"opt-btn",onClick:R},"选择文件夹")]),s("div",oe,[f.value.length?(n(),o(C,{key:0},[(n(!0),o(C,null,F(E.value,t=>(n(),o("span",{key:t},i(t),1))),128)),f.value.length>E.value.length?(n(),o("span",re," 还有 "+i(f.value.length-E.value.length)+" 个文件未展开显示 ",1)):b("",!0)],64)):(n(),o("span",ie,"暂未选择待清洗文件"))])]),e[8]||(e[8]=s("div",{class:"section-title"},"保留列设置",-1)),s("div",ue,[s("div",ce,[s("span",de,"已选择 "+i(c.value.length)+" / "+i(p.value.length)+" 列",1),s("div",{class:"column-actions"},[s("button",{type:"button",class:"opt-btn small",onClick:$},"全选"),s("button",{type:"button",class:"opt-btn small",onClick:A},"清空")])]),p.value.length?(n(),o("div",ve,[(n(!0),o(C,null,F(p.value,t=>(n(),o("label",{key:t,class:I(["column-item",{active:c.value.includes(t)}])},[P(s("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>c.value=a),type:"checkbox",value:t},null,8,pe),[[B,c.value]]),s("span",null,i(t),1)],2))),128))])):(n(),o("div",fe,"请选择 Excel 文件后读取表头并填充可保留列")),e[4]||(e[4]=s("div",{class:"desc"},"读取首个 Excel 文件的第一行作为表头,用于动态选择需要保留的列。",-1))]),e[9]||(e[9]=s("div",{class:"section-title"},"ID 保留规则",-1)),s("div",_e,[s("label",{class:I(["radio-item",{active:_.value}])},[P(s("input",{"onUpdate:modelValue":e[1]||(e[1]=t=>_.value=t),type:"checkbox"},null,512),[[B,_.value]]),e[5]||(e[5]=s("div",null,[s("span",{class:"label"},"保留子链接"),s("div",{class:"desc"},"例如 1_1、2_3 这种带下划线的子项 ID")],-1))],2),s("label",{class:I(["radio-item",{active:m.value}])},[P(s("input",{"onUpdate:modelValue":e[2]||(e[2]=t=>m.value=t),type:"checkbox"},null,512),[[B,m.value]]),e[6]||(e[6]=s("div",null,[s("span",{class:"label"},"仅剩主链接无子链接"),s("div",{class:"desc"},"当某个主链接只有 13 这类主 ID、没有 13_1 这类对应子 ID 时,自动保留该主 ID")],-1))],2)]),s("div",me,[s("button",{type:"button",class:"btn-run",disabled:h.value,onClick:V},i(h.value?"清洗中...":"开始清洗"),9,he),s("span",ge,i(h.value?"正在处理文件并上传结果,请稍候…":"选择文件、列和 ID 规则后即可执行清洗,结果会显示在右侧供下载"),1)])]),s("section",ye,[e[14]||(e[14]=s("div",{class:"panel-header"},"去重结果",-1)),s("div",be,[s("div",we,[s("div",ke,[e[10]||(e[10]=s("span",{class:"summary-label"},"已处理文件",-1)),s("strong",null,i(g.value.total),1)]),s("div",Ce,[e[11]||(e[11]=s("span",{class:"summary-label"},"成功结果",-1)),s("strong",null,i(g.value.successCount),1)]),s("div",Ie,[e[12]||(e[12]=s("span",{class:"summary-label"},"失败文件",-1)),s("strong",null,i(g.value.failedCount),1)])]),s("div",xe,[e[13]||(e[13]=s("div",{class:"result-list-header"},[s("span",null,"处理后的 Excel 列表")],-1)),k.value.length===0?(n(),o("div",Ee," 暂无去重结果,完成数据去重后会在这里展示输出文件 ")):(n(),o("ul",De,[(n(!0),o(C,null,F(k.value,t=>(n(),o("li",{key:`${t.resultId||t.outputFilename||t.sourceFilename}`,class:"task-item"},[s("div",Fe,[s("span",{class:"id",title:t.sourceFilename},i(t.sourceFilename||"-"),9,Pe),t.outputFilename?(n(),o("div",Be,"输出文件:"+i(t.outputFilename),1)):b("",!0),t.error?(n(),o("div",Se,"错误信息:"+i(t.error),1)):b("",!0)]),s("div",Ue,[s("span",{class:I(["status",t.success?"success":"failed"])},i(t.success?"已完成":"失败"),3),t.success&&t.downloadUrl?(n(),o("button",{key:0,type:"button",class:"download",onClick:a=>T(t)}," 下载文件 ",8,Ne)):b("",!0),t.resultId?(n(),o("button",{key:1,type:"button",class:"btn-delete",onClick:a=>M(t.resultId)}," 删除 ",8,$e)):b("",!0)])]))),128))]))])])])])]))}}),He=Y(Ae,[["__scopeId","data-v-6b14da88"]]);Z(He).use(ee).mount("#app"); +import{d as z,o as W,a as n,c as o,b as q,B as J,e as s,F as C,r as F,t as i,f as b,n as I,w as P,v as B,g as u,h as L,i as x,E as r,j as O,k as G,l as Q,m as X,_ as Y,p as Z,q as ee}from"./pywebview-V_UIajJm.js";import{e as se}from"./brand-1nUVsWrm.js";const te={class:"page-shell module-page"},le={class:"main-content"},ae={class:"left-panel"},ne={class:"upload-zone"},oe={class:"selected-files clean-placeholder"},re={key:0,class:"more-line"},ie={key:1},ue={class:"option-group column-option-group"},ce={class:"column-toolbar"},de={class:"column-count"},ve={key:0,class:"column-grid"},pe=["value"],fe={key:1,class:"empty-column-state"},_e={class:"option-group"},me={class:"run-row"},he=["disabled"],ge={class:"loading-msg"},ye={class:"right-panel"},be={class:"task-list-wrap"},we={class:"clean-result-summary"},ke={class:"summary-card"},Ce={class:"summary-card"},Ie={class:"summary-card"},xe={class:"result-list-wrap"},Ee={key:0,class:"empty-tasks"},De={key:1,class:"task-list clean-result-list"},Fe={class:"left"},Pe=["title"],Be={key:0,class:"files"},Se={key:1,class:"files"},Ue={class:"task-right"},Ne=["onClick"],$e=["onClick"],Ae=z({__name:"BrandDedupeTab",setup(Ke){const p=u([]),c=u([]),f=u([]),w=u(""),d=u([]),S=u(!1),_=u(!0),m=u(!0),h=u(!1),k=u([]),g=u({total:0,successCount:0,failedCount:0,items:[]}),E=L(()=>f.value.slice(0,8));function $(){c.value=[...p.value]}function A(){c.value=[]}async function U(l){const e=x();if(!e?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const a of l){const v=typeof a=="string"?a:a.absolutePath,j=typeof a=="string"?void 0:a.relativePath,y=await e.upload_file_to_java(v,j);if(!y?.success||!y.data)throw new Error(y?.error||y?.message||`上传失败:${v}`);t.push(y.data)}return t}async function N(l){const e=await X(l);if(!e.headers?.length){r.error("读取 Excel 表头失败"),p.value=[],c.value=[];return}const t=["id","ASIN","国家","价格","卖家名称"],a=[...t.filter(v=>e.headers?.includes(v)),...(e.headers||[]).filter(v=>!t.includes(v))];p.value=a,c.value=t.filter(v=>a.includes(v))}async function H(l,e){f.value=l,w.value="",d.value=await U(l),d.value.length>0&&await N(d.value[0].fileKey),r.success(e)}async function K(){const l=x();if(!l?.select_brand_xlsx_files){r.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const e=await l.select_brand_xlsx_files();if(!e?.length)return;await H(e,`已选择 ${e.length} 个待清洗文件`)}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function R(){const l=x();if(!l?.select_brand_folder){r.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const e=await l.select_brand_folder();if(!e)return;w.value=e.split(/[/\\]/).filter(Boolean).pop()||"";const t=await se(e);if(t.success&&t.items?.length){f.value=t.items.map(a=>a.relativePath),d.value=await U(t.items),d.value.length>0&&await N(d.value[0].fileKey),r.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`);return}r.warning(t.error||"该文件夹下没有 xlsx 文件")}catch(e){r.error(e instanceof Error?e.message:"选择失败")}}async function V(){if(!d.value.length){r.warning("请先选择待清洗 Excel 文件或文件夹");return}if(!c.value.length){r.warning("请至少选择一列保留列");return}if(!S.value&&!_.value&&!m.value){r.warning("请至少选择一种 ID 保留规则");return}try{h.value=!0;const l=await O({files:d.value.map(e=>({fileKey:e.fileKey,originalFilename:e.originalFilename,relativePath:e.relativePath})),selectedColumns:c.value,keepIntegerIds:S.value,keepUnderscoreIds:_.value,keepIntegerMainIdsWhenNoSubIds:m.value,archiveName:d.value.some(e=>!!e.relativePath)&&w.value?w.value:void 0});g.value=l,k.value=l.items||[],await D(),r.success("数据去重完成")}catch(l){r.error(l instanceof Error?l.message:"去重失败")}finally{h.value=!1}}async function D(){try{const l=await G();k.value=l.items||[],g.value={total:l.items?.length||0,successCount:l.items?.filter(e=>e.success).length||0,failedCount:l.items?.filter(e=>!e.success).length||0,items:l.items||[]}}catch{}}async function M(l){try{await Q(l),await D(),r.success("已删除")}catch(e){r.error(e instanceof Error?e.message:"删除失败")}}async function T(l){const e=x();if(!l.downloadUrl){r.warning("当前结果没有下载地址");return}const t=l.outputFilename||`${new Date().toISOString().slice(0,10).replace(/-/g,"")}_cleaned.xlsx`;if(e?.save_file_from_url){const a=await e.save_file_from_url(l.downloadUrl,t);a.success?r.success(`已保存:${a.path||t}`):a.error&&a.error!=="用户取消"&&r.error(a.error);return}window.open(l.downloadUrl,"_blank")}return W(()=>{D().catch(()=>{})}),(l,e)=>(n(),o("div",te,[q(J,{active:"dedupe"}),s("div",le,[s("aside",ae,[e[7]||(e[7]=s("div",{class:"section-title"},"选择文件",-1)),s("div",ne,[e[3]||(e[3]=s("div",{class:"hint"},"选择需要清洗的 Excel 文件或文件夹,后续将按所选规则输出处理结果。",-1)),s("div",{class:"btns"},[s("button",{type:"button",class:"opt-btn",onClick:K},"选择 Excel 文件"),s("button",{type:"button",class:"opt-btn",onClick:R},"选择文件夹")]),s("div",oe,[f.value.length?(n(),o(C,{key:0},[(n(!0),o(C,null,F(E.value,t=>(n(),o("span",{key:t},i(t),1))),128)),f.value.length>E.value.length?(n(),o("span",re," 还有 "+i(f.value.length-E.value.length)+" 个文件未展开显示 ",1)):b("",!0)],64)):(n(),o("span",ie,"暂未选择待清洗文件"))])]),e[8]||(e[8]=s("div",{class:"section-title"},"保留列设置",-1)),s("div",ue,[s("div",ce,[s("span",de,"已选择 "+i(c.value.length)+" / "+i(p.value.length)+" 列",1),s("div",{class:"column-actions"},[s("button",{type:"button",class:"opt-btn small",onClick:$},"全选"),s("button",{type:"button",class:"opt-btn small",onClick:A},"清空")])]),p.value.length?(n(),o("div",ve,[(n(!0),o(C,null,F(p.value,t=>(n(),o("label",{key:t,class:I(["column-item",{active:c.value.includes(t)}])},[P(s("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>c.value=a),type:"checkbox",value:t},null,8,pe),[[B,c.value]]),s("span",null,i(t),1)],2))),128))])):(n(),o("div",fe,"请选择 Excel 文件后读取表头并填充可保留列")),e[4]||(e[4]=s("div",{class:"desc"},"读取首个 Excel 文件的第一行作为表头,用于动态选择需要保留的列。",-1))]),e[9]||(e[9]=s("div",{class:"section-title"},"ID 保留规则",-1)),s("div",_e,[s("label",{class:I(["radio-item",{active:_.value}])},[P(s("input",{"onUpdate:modelValue":e[1]||(e[1]=t=>_.value=t),type:"checkbox"},null,512),[[B,_.value]]),e[5]||(e[5]=s("div",null,[s("span",{class:"label"},"保留子链接"),s("div",{class:"desc"},"例如 1_1、2_3 这种带下划线的子项 ID")],-1))],2),s("label",{class:I(["radio-item",{active:m.value}])},[P(s("input",{"onUpdate:modelValue":e[2]||(e[2]=t=>m.value=t),type:"checkbox"},null,512),[[B,m.value]]),e[6]||(e[6]=s("div",null,[s("span",{class:"label"},"仅剩主链接无子链接"),s("div",{class:"desc"},"当某个主链接只有 13 这类主 ID、没有 13_1 这类对应子 ID 时,自动保留该主 ID")],-1))],2)]),s("div",me,[s("button",{type:"button",class:"btn-run",disabled:h.value,onClick:V},i(h.value?"清洗中...":"开始清洗"),9,he),s("span",ge,i(h.value?"正在处理文件并上传结果,请稍候…":"选择文件、列和 ID 规则后即可执行清洗,结果会显示在右侧供下载"),1)])]),s("section",ye,[e[14]||(e[14]=s("div",{class:"panel-header"},"去重结果",-1)),s("div",be,[s("div",we,[s("div",ke,[e[10]||(e[10]=s("span",{class:"summary-label"},"已处理文件",-1)),s("strong",null,i(g.value.total),1)]),s("div",Ce,[e[11]||(e[11]=s("span",{class:"summary-label"},"成功结果",-1)),s("strong",null,i(g.value.successCount),1)]),s("div",Ie,[e[12]||(e[12]=s("span",{class:"summary-label"},"失败文件",-1)),s("strong",null,i(g.value.failedCount),1)])]),s("div",xe,[e[13]||(e[13]=s("div",{class:"result-list-header"},[s("span",null,"处理后的 Excel 列表")],-1)),k.value.length===0?(n(),o("div",Ee," 暂无去重结果,完成数据去重后会在这里展示输出文件 ")):(n(),o("ul",De,[(n(!0),o(C,null,F(k.value,t=>(n(),o("li",{key:`${t.resultId||t.outputFilename||t.sourceFilename}`,class:"task-item"},[s("div",Fe,[s("span",{class:"id",title:t.sourceFilename},i(t.sourceFilename||"-"),9,Pe),t.outputFilename?(n(),o("div",Be,"输出文件:"+i(t.outputFilename),1)):b("",!0),t.error?(n(),o("div",Se,"错误信息:"+i(t.error),1)):b("",!0)]),s("div",Ue,[s("span",{class:I(["status",t.success?"success":"failed"])},i(t.success?"已完成":"失败"),3),t.success&&t.downloadUrl?(n(),o("button",{key:0,type:"button",class:"download",onClick:a=>T(t)}," 下载文件 ",8,Ne)):b("",!0),t.resultId?(n(),o("button",{key:1,type:"button",class:"btn-delete",onClick:a=>M(t.resultId)}," 删除 ",8,$e)):b("",!0)])]))),128))]))])])])])]))}}),He=Y(Ae,[["__scopeId","data-v-6b14da88"]]);Z(He).use(ee).mount("#app"); diff --git a/app/assets/delete-brand.js b/app/assets/delete-brand.js index bbbdb3d..2633354 100644 --- a/app/assets/delete-brand.js +++ b/app/assets/delete-brand.js @@ -1 +1 @@ -import{d as Me,o as Ae,I as Be,a as u,c as i,b as qe,B as Ue,e as r,F as R,r as Z,t as c,f,J as Ke,K as Ie,n as be,g as p,h as j,L as He,i as M,E as h,M as Je,N as Oe,O as Le,P as je,_ as Ve,p as ze,q as Ge}from"./pywebview-BCPdlDdb.js";import{e as Qe}from"./brand-CFZZtTv8.js";const Xe={class:"page-shell module-page"},We={class:"main-content"},Ye={class:"left-panel"},Ze={class:"upload-zone"},es={class:"selected-files clean-placeholder split-selected-files"},ss={key:0,class:"more-line"},ts={key:1},ns={class:"run-row"},as=["disabled"],ls={class:"loading-msg"},rs={key:0,class:"queue-debug-card"},os={key:0,class:"queue-debug-line"},us={key:1,class:"queue-debug-payload"},is={class:"right-panel"},cs={class:"task-list-wrap"},ds={class:"clean-result-summary"},fs={class:"summary-card"},vs={class:"summary-card"},hs={class:"summary-card"},ps={class:"result-list-wrap"},_s={key:0,class:"empty-tasks"},gs={key:0,class:"result-subsection"},ys={class:"task-list clean-result-list"},ks={class:"left split-result-main"},ms=["title"],Is={class:"files"},bs={class:"files"},ws={key:0,class:"files"},Ss={key:1,class:"files"},Cs={key:2,class:"files"},Fs={key:3,class:"time"},Ts={key:4,class:"delete-brand-progress-block"},xs={class:"delete-brand-progress-header"},Ns={class:"delete-brand-progress-bar"},$s={class:"files delete-brand-progress"},Es={key:5,class:"files split-entry-list delete-brand-preview"},Ps={key:6,class:"files"},Ds={class:"task-right split-result-actions"},Rs=["onClick"],Ms=["onClick"],As=["onClick"],Bs={key:1,class:"result-subsection"},qs={class:"task-list clean-result-list"},Us={class:"left split-result-main"},Ks=["title"],Hs={class:"files"},Js={class:"files"},Os={key:0,class:"files"},Ls={key:1,class:"files"},js={key:2,class:"time"},Vs={key:3,class:"delete-brand-progress-block"},zs={class:"delete-brand-progress-header"},Gs={class:"delete-brand-progress-bar"},Qs={class:"files delete-brand-progress"},Xs={key:4,class:"files split-entry-list delete-brand-preview"},Ws={key:5,class:"files"},Ys={class:"task-right split-result-actions"},Zs=["onClick"],et=["onClick"],st=Me({__name:"BrandDeleteBrandTab",setup(nt){function N(){return`delete-brand:current-tasks:${typeof window<"u"&&window.localStorage.getItem("uid")||"0"}`}const C=p([]),A=p([]),$=p(!1),ee=p([]),d=p([]),B=p([]),q=p({total:0,successCount:0,failedCount:0,items:[]}),I=p(""),k=p(""),_=p({}),y=p(null),V=p(!1),F=p(!1),b=p(""),U=p(!1),z=j(()=>C.value.slice(0,10)),m=j(()=>{const e=[];return d.value.forEach(s=>{e.push(...s.items)}),e});function we(){try{const e=typeof window<"u"?window.localStorage.getItem(N()):null;if(e){if(d.value=JSON.parse(e),d.value.length>0){const s=d.value[d.value.length-1];I.value=s.queuePushResult||"",k.value=s.queuePayloadText||""}}else d.value=[]}catch{d.value=[]}}function se(e,s,t,n){const l=s.filter(v=>v.matchStatus==="MATCHED"&&v.success!==!1);if(l.length===0)return;const o={taskId:e,items:l,createdAt:Date.now(),queuePushResult:t,queuePayloadText:n},a=d.value.findIndex(v=>v.taskId===e);a>=0?d.value[a]=o:d.value.push(o),typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value))}function te(e){const s=d.value.length;d.value=d.value.filter(t=>t.taskId!==e),d.value.length!==s&&typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value))}const K=j(()=>B.value.filter(e=>!m.value.some(s=>s.taskId===e.taskId||s.resultId&&s.resultId===e.resultId))),Se=j(()=>m.value.length>0||K.value.length>0);function ne(){typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value))}function E(e){return e?(d.value.find(t=>t.taskId===e)?.items.length||0)>1:!1}function G(e){return e&&d.value.find(s=>s.taskId===e)||null}function Q(e,s){return!e||!s?!1:e.resultId!=null&&s.resultId!=null?e.resultId===s.resultId:e.fileKey&&s.fileKey?e.fileKey===s.fileKey:e.sourceFilename===s.sourceFilename}function T(e,s){const t=G(e);return t&&t.items.find(n=>Q(n,s))||null}function ae(e){if(!e)return!1;const s=G(e);if(!s)return!1;let t=!1;const n=_.value[e]?.line_progress?.info;if(E(e)&&n?.finished_files!=null&&n.finished_files>=0){const l=s.items.filter(a=>a._pushed),o=Math.max(0,Math.min(n.finished_files,l.length));for(let a=0;a0&&n.current_line>=n.total_lines){const l=m.value.find(a=>x(a)===b.value),o=l&&l.taskId===e?T(e,l):s.items.find(a=>a.sourceFilename===n.file_name);o&&!o._completed&&(o._completed=!0,t=!0)}return t&&ne(),t}function le(e){return e&&_.value[e]?.task?.status||""}function H(e){if(e.error)return e.error;if(e.matchStatus&&e.matchStatus!=="MATCHED")return e.matchMessage||"";const s=e.taskId;return s&&_.value[s]?.task?.errorMessage||""}function re(e){const s=e.taskId;if(!s)return!1;const t=_.value[s]?.line_progress,n=le(s),l=E(s),o=S(e);if(l){const a=T(s,e),v=x(e)===b.value,g=!!(t?.has_progress&&t?.info?.file_name===e.sourceFilename);return!!(v||g||a?._pushed||(n==="RUNNING"||n==="PENDING"||!n)&&a?._completed)}return o==="本文件解析完毕"||o==="已被全局判定为终态"?!1:t?.has_progress||t?.info?!0:o==="已入队"||o==="处理中"}function oe(e){return e.map(s=>s.matchStatus==="MATCHED"?{...s,_pushed:!1,_completed:!1}:{...s,matched:!1,openStoreUrl:void 0,error:s.error||void 0,_pushed:!1,_completed:!1})}function ue(e){return e.matchStatus==="MATCHED"?`已匹配 ${e.shopId||""}`.trim():e.matchMessage?e.matchMessage:e.matchStatus==="CONFLICT"?"存在多个同名店铺,请人工确认":e.matchStatus==="PENDING"||e.matchStatus==="INDEX_STALE"?"店铺索引暂未就绪":e.matchStatus?e.matchStatus:e.matched?`已匹配 ${e.shopId||""}`.trim():"待匹配"}function Ce(){ee.value=[...m.value,...K.value]}function w(){Ce(),Fe(ee.value)}function Fe(e){q.value={total:e.length,successCount:e.filter(s=>s.success).length,failedCount:e.filter(s=>!s.success).length,items:e}}function ie(e){const s=e.taskId;return s&&(_.value[s]?.fileProgress||[]).find(l=>l.fileKey&&e.fileKey?l.fileKey===e.fileKey:l.sourceFilename&&e.sourceFilename?l.sourceFilename===e.sourceFilename:!1)||null}function ce(e){const s=e.taskId;if(!s)return"";const t=_.value[s],n=t?.line_progress?.info,l=ie(e);if(l){const a=[],v=l.processedRows??0,g=l.totalRows??0;if(l.status&&a.push(`文件状态:${l.status}`),a.push(`文件进度:${v}/${g}`),n?.finished_files!=null){const D=n.file_total&&n.file_total>0?`/${n.file_total}`:"";a.push(`已完成文件:${n.finished_files}${D}`)}return n?.phase&&a.push(`阶段:${n.phase}`),a.join("|")}if(!t?.line_progress?.has_progress||!n){const a=t?.task?.status;return a?`任务状态:${a}`:""}const o=[];if(n.phase&&o.push(`阶段:${n.phase}`),n.file_index&&n.file_total&&o.push(`文件:${n.file_index}/${n.file_total}`),n.file_name&&o.push(`当前文件:${n.file_name}`),n.current_line!=null&&n.total_lines!=null&&o.push(`${E(s)?"当前文件进度":"进度"}:${n.current_line}/${n.total_lines}`),n.current_country&&o.push(`国家:${n.current_country}`),n.current_asin&&o.push(`ASIN:${n.current_asin}`),n.finished_files!=null){const a=n.file_total&&n.file_total>0?`/${n.file_total}`:"";o.push(`已完成文件:${n.finished_files}${a}`)}return o.join("|")}function J(e){const s=e.taskId;if(!s)return 0;const t=ie(e);if(t)return Math.max(0,Math.min(100,t.percent??0));const n=_.value[s]?.line_progress?.info;return n?n.current_line!=null&&n.total_lines&&n.total_lines>0?Math.max(0,Math.min(100,Math.round(n.current_line/n.total_lines*100))):n.finished_files!=null&&n.file_total&&n.file_total>0?Math.max(0,Math.min(100,Math.round(n.finished_files/n.file_total*100))):_.value[s]?.task?.status==="SUCCESS"?100:0:0}function de(e){const s=_.value[e]?.task?.status;return s==="SUCCESS"||s==="FAILED"}function P(){const e=new Set;return d.value.forEach(s=>{s.items.some(t=>t._pushed)&&e.add(s.taskId)}),Array.from(e)}function S(e){const s=e.taskId;if(!s||!G(s))return"";const n=T(s,e),l=le(s),o=_.value[s]?.line_progress,a=E(s);if(!a&&(l==="SUCCESS"||l==="FAILED"||e.taskStatus==="SUCCESS"||e.taskStatus==="FAILED"))return"已被全局判定为终态";if(n?._completed)return"本文件解析完毕";if(l==="RUNNING"&&o?.has_progress&&o?.info?.file_name===e.sourceFilename)return"处理中";if(a&&!n?._pushed&&!n?._completed)return"未入队";if(a&&l==="SUCCESS")return"本文件解析完毕";if(!a){const v=_.value[s];if(v?.items&&v.items.find(D=>Q(D,e))&&l==="SUCCESS")return"本文件解析完毕"}return n?._pushed?"已入队":"未入队"}function fe(e){if(e.downloadUrl)return!0;const s=e.taskId;return s?_.value[s]?.task?.status==="SUCCESS":!1}function Te(e){const s=e?.task?.id;if(!s||!e?.items?.length)return!1;const t=d.value.find(a=>a.taskId===s);if(!t)return!1;let n=!1;const o=t.items.map(a=>{const v=e.items?.find(D=>Q(D,a));if(!v)return a;const g={...a,...v,success:a.success??v.success,_pushed:a._pushed,_completed:a._completed};return JSON.stringify(g)!==JSON.stringify(a)&&(n=!0),g}).filter(a=>a.matchStatus==="MATCHED"&&a.success!==!1);return JSON.stringify(o)!==JSON.stringify(t.items)&&(t.items=o,n=!0),n&&ne(),n}async function X(e){const s=e||P();if(s.length)try{const t=await He(s);let n=!1;for(const l of t.items||[]){const o=l?.task?.id;typeof o=="number"&&o>0&&(_.value[o]=l,Te(l)&&(n=!0),ae(o)&&(n=!0))}n&&w()}catch{}}function xe(){return document.visibilityState==="visible"?4500:1e4}function W(e=!1){if(y.value){if(!e)return;clearTimeout(y.value),y.value=null}const s=async()=>{if(y.value=null,V.value){W();return}const t=P();if(!t.length)return;V.value=!0;let n=!1;try{await X(t),await De();for(const l of t)de(l)&&(te(l),n=!0)}finally{V.value=!1}n&&(L(),w()),P().length>0&&W()};e?s():y.value=window.setTimeout(s,xe())}function Y(e=!1){y.value&&!e||W(e)}function O(e){const s=e.taskId?_.value[e.taskId]?.task?.status:null;return s==="SUCCESS"?{className:"success",text:"已完成"}:s==="FAILED"?{className:"failed",text:"失败"}:s==="RUNNING"?{className:"running",text:"执行中"}:e.taskStatus==="SUCCESS"?{className:"success",text:"已完成"}:e.taskStatus==="FAILED"?{className:"failed",text:"失败"}:e.taskStatus==="RUNNING"?{className:"running",text:"执行中"}:e.success?{className:"success",text:"已完成"}:{className:"failed",text:"失败"}}function ve(){y.value&&(window.clearTimeout(y.value),y.value=null)}async function he(e){const s=M();if(!s?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const n of e){const l=typeof n=="string"?n:n.absolutePath,o=typeof n=="string"?void 0:n.relativePath,a=await s.upload_file_to_java(l,o);if(!a?.success||!a.data)throw new Error(a?.error||a?.message||`上传失败:${l}`);t.push(a.data)}return t}async function Ne(){const e=M();if(!e?.select_brand_xlsx_files){h.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const s=await e.select_brand_xlsx_files();if(!s?.length)return;C.value=s,A.value=await he(s),h.success(`已选择 ${s.length} 个删除品牌文件`)}catch(s){h.error(s instanceof Error?s.message:"选择失败")}}async function $e(){const e=M();if(!e?.select_brand_folder){h.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const s=await e.select_brand_folder();if(!s)return;const t=await Qe(s);if(!t.success||!t.items?.length){h.warning(t.error||"该文件夹下没有 xlsx 文件");return}C.value=t.items.map(n=>n.relativePath||n.absolutePath),A.value=await he(t.items),h.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`)}catch(s){h.error(s instanceof Error?s.message:"选择失败")}}async function Ee(){if(!A.value.length){h.warning("请先选择待处理文件");return}try{$.value=!0;const e=await Je({files:A.value.map(l=>({fileKey:l.fileKey,originalFilename:l.originalFilename,relativePath:l.relativePath}))}),s=oe(e.items||[]),t=s.some(l=>l.matchStatus==="MATCHED"),n=s.some(l=>l.matchStatus&&l.matchStatus!=="MATCHED");I.value="解析完成,等待手动点击打开紫鸟进行单任务处理",k.value="",s.length&&s[0].taskId&&se(s[0].taskId,s,I.value,k.value),w(),n?h.warning("部分文件尚未命中可用店铺索引,已保留状态信息,请等待后台刷新后重试。"):t?h.success("删除品牌解析完成,请手动推送"):h.warning("当前没有可推送的已匹配文件,请先等待店铺索引刷新。"),await L()}catch(e){h.error(e instanceof Error?e.message:"执行失败")}finally{$.value=!1}}async function pe(e){const s=e.taskId;if(!s){h.warning("未找到任务ID");return}const t=M(),n=Oe(s),l=e.outputFilename||e.sourceFilename||`delete-brand_${s}.xlsx`;if(t?.save_file_from_url){const o=await t.save_file_from_url(n,l);o.success?h.success(`已保存:${o.path||l}`):o.error&&o.error!=="用户取消"&&h.error(o.error);return}window.open(n,"_blank")}async function L(){try{const e=await Le();B.value=oe(e.items||[]),w(),await X(),Y(!0)}catch(e){console.error("loadHistory error:",e)}}function _e(e){d.value.forEach(t=>{t.items=t.items.filter(n=>n.resultId!==e)});const s=d.value.length;d.value=d.value.filter(t=>t.items.length>0),d.value.length!==s&&typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value)),B.value=B.value.filter(t=>t.resultId!==e),w(),P().length===0&&ve()}async function ge(e){try{await je(e),_e(e),await L(),h.success("已删除")}catch(s){const t=s instanceof Error?s.message:"删除失败";if(typeof t=="string"&&t.includes("记录不存在")){_e(e),h.success("已删除");return}h.error(t)}}function ye(e){const s=e.slice(0,5).map(n=>`${n.country}:${n.asin}${n.status?`(${n.status})`:""}`);return e.length-s.length>0?`${s.join("、")} 等 ${e.length} 条`:s.join("、")}function at(e,s){}function ke(){for(const e of d.value)for(const s of e.items){const t=S(s);if(t==="已入队"||t==="处理中")return!0}return!1}function x(e){return e.resultId!=null?`result:${e.resultId}`:`task:${e.taskId||0}:${e.sourceFilename||""}`}function Pe(){return m.value.find(e=>!e.openStoreUrl||x(e)===b.value||T(e.taskId,e)?._completed?!1:S(e)==="未入队")}async function me(e,s){if(s?.auto&&ke())return e.taskId,e.sourceFilename,!1;const t=M(),n=e.taskId;if(!n)return!1;const l=d.value.find(g=>g.taskId===n);if(!l)return!1;if(!t?.enqueue_json)return h.error("当前环境未启用 pywebview enqueue_json(浏览器环境不会推送)"),!1;const o={type:"delete-brand-run",ts:Date.now(),data:{taskId:n,items:[e]}};k.value=JSON.stringify(o,null,2);const a=await t.enqueue_json(o);let v="";if(a?.success){v=`已推送文件 ${e.sourceFilename},当前队列长度:${a.queue_size??"-"}`;const g=T(n,e);g&&(g._pushed=!0,g._completed=!1),b.value=x(e),se(n,l.items,v,k.value),Y(!0)}else v=`推送到 Python 队列失败:${a?.error||"未知错误"}`;return I.value=v,!!a?.success}async function De(){if(!F.value||U.value){F.value,U.value;return}if(ke())return;const e=b.value;if(e){const t=m.value.find(n=>x(n)===e);if(t){const n=t.taskId,l=E(n);l&&(ae(n),S(t),void 0);const o=S(t);if(o==="已入队"||o==="处理中"){t.sourceFilename;return}if(l){const a=T(n,t);if(a&&!a._completed){t.sourceFilename,a._pushed,a._completed;return}}}}const s=Pe();if(!s){b.value="",F.value=!1;return}U.value=!0;try{s.taskId,s.sourceFilename,x(s),await me(s,{auto:!0})||(s.taskId,s.sourceFilename,F.value=!1)}finally{U.value=!1}}async function Re(e){F.value=!0,await me(e)||(F.value=!1,b.value="")}return Ae(()=>{we();const e=P();e.length>0?X(e).then(()=>{let s=!1;for(const t of e)de(t)&&(te(t),s=!0);s&&w(),Y(!0)}):w(),L().catch(()=>{})}),Be(()=>{ve()}),(e,s)=>(u(),i("div",Xe,[qe(Ue,{active:"delete-brand"}),r("div",We,[r("aside",Ye,[s[2]||(s[2]=r("div",{class:"section-title"},"选择文件",-1)),r("div",Ze,[s[0]||(s[0]=r("div",{class:"hint"},"上传删除品牌 Excel;无论是直接上传文件还是上传文件夹批量导入,都会按每个 Excel 文件名作为店铺名。",-1)),r("div",{class:"btns"},[r("button",{type:"button",class:"opt-btn",onClick:Ne},"选择 Excel 文件"),r("button",{type:"button",class:"opt-btn",onClick:$e},"选择文件夹")]),r("div",es,[C.value.length?(u(),i(R,{key:0},[(u(!0),i(R,null,Z(z.value,t=>(u(),i("span",{key:t},c(t),1))),128)),C.value.length>z.value.length?(u(),i("span",ss," 还有 "+c(C.value.length-z.value.length)+" 个文件未展开显示 ",1)):f("",!0)],64)):(u(),i("span",ts,"暂未选择删除品牌文件"))])]),s[3]||(s[3]=Ke('
执行说明
',2)),r("div",ns,[r("button",{type:"button",class:"btn-run",disabled:$.value,onClick:Ee},c($.value?"解析中...":"开始解析"),9,as),r("span",ls,c($.value?"正在读取删除品牌数据,请稍候…":"解析后会在右侧展示按国家分组的去重结果"),1)]),I.value||k.value?(u(),i("div",rs,[s[1]||(s[1]=r("div",{class:"section-title queue-debug-title"},"Python 队列推送结果",-1)),I.value?(u(),i("div",os,c(I.value),1)):f("",!0),k.value?(u(),i("pre",us,c(k.value),1)):f("",!0)])):f("",!0)]),r("section",is,[s[12]||(s[12]=r("div",{class:"panel-header"},"删除品牌结果",-1)),r("div",cs,[r("div",ds,[r("div",fs,[s[4]||(s[4]=r("span",{class:"summary-label"},"已处理文件",-1)),r("strong",null,c(q.value.total),1)]),r("div",vs,[s[5]||(s[5]=r("span",{class:"summary-label"},"成功结果",-1)),r("strong",null,c(q.value.successCount),1)]),r("div",hs,[s[6]||(s[6]=r("span",{class:"summary-label"},"失败文件",-1)),r("strong",null,c(q.value.failedCount),1)])]),r("div",ps,[s[11]||(s[11]=r("div",{class:"result-list-header"},[r("span",null,"删除品牌结果列表")],-1)),Se.value?(u(),i(R,{key:1},[m.value.length?(u(),i("div",gs,[s[8]||(s[8]=r("div",{class:"result-subsection-title"},"当前任务",-1)),r("ul",ys,[(u(!0),i(R,null,Z(m.value,t=>(u(),i("li",{key:`current-${t.taskId||t.resultId||t.sourceFilename}`,class:"task-item split-result-item"},[r("div",ks,[r("span",{class:"id",title:t.sourceFilename},c(t.sourceFilename||"-"),9,ms),r("div",Is,"店铺名:"+c(t.shopName||"-"),1),r("div",bs,"匹配结果:"+c(ue(t)),1),t.platform?(u(),i("div",ws,"平台:"+c(t.platform),1)):f("",!0),S(t)?(u(),i("div",Ss,"队列状态:"+c(S(t)),1)):f("",!0),t.countryCount!==void 0&&t.matched?(u(),i("div",Cs,"国家数:"+c(t.countryCount),1)):f("",!0),t.totalRows!==void 0&&t.matched?(u(),i("div",Fs,"去重后 "+c(t.totalRows)+" 条 ",1)):f("",!0),re(t)?(u(),i("div",Ts,[r("div",xs,[s[7]||(s[7]=r("span",null,"任务进度",-1)),r("span",null,c(J(t))+"%",1)]),r("div",Ns,[r("div",{class:"delete-brand-progress-bar-fill",style:Ie({width:`${J(t)}%`})},null,4)]),r("div",$s,c(ce(t)),1)])):f("",!0),t.previewRows?.length?(u(),i("div",Es,c(ye(t.previewRows)),1)):f("",!0),H(t)?(u(),i("div",Ps,"错误信息:"+c(H(t)),1)):f("",!0)]),r("div",Ds,[r("span",{class:be(["status",O(t).className])},c(O(t).text),3),t.openStoreUrl?(u(),i("button",{key:0,type:"button",class:"download",onClick:n=>Re(t)}," 打开紫鸟 ",8,Rs)):f("",!0),fe(t)?(u(),i("button",{key:1,type:"button",class:"download",onClick:n=>pe(t)}," 下载 ",8,Ms)):f("",!0),t.resultId?(u(),i("button",{key:2,type:"button",class:"btn-delete",onClick:n=>ge(t.resultId)}," 删除 ",8,As)):f("",!0)])]))),128))])])):f("",!0),K.value.length?(u(),i("div",Bs,[s[10]||(s[10]=r("div",{class:"result-subsection-title"},"历史记录",-1)),r("ul",qs,[(u(!0),i(R,null,Z(K.value,t=>(u(),i("li",{key:`history-${t.taskId||t.resultId||t.sourceFilename}`,class:"task-item split-result-item"},[r("div",Us,[r("span",{class:"id",title:t.sourceFilename},c(t.sourceFilename||"-"),9,Ks),r("div",Hs,"店铺名:"+c(t.shopName||"-"),1),r("div",Js,"匹配结果:"+c(ue(t)),1),t.platform?(u(),i("div",Os,"平台:"+c(t.platform),1)):f("",!0),t.countryCount!==void 0&&t.matched?(u(),i("div",Ls,"国家数:"+c(t.countryCount),1)):f("",!0),t.totalRows!==void 0&&t.matched?(u(),i("div",js,"去重后 "+c(t.totalRows)+" 条 ",1)):f("",!0),re(t)?(u(),i("div",Vs,[r("div",zs,[s[9]||(s[9]=r("span",null,"任务进度",-1)),r("span",null,c(J(t))+"%",1)]),r("div",Gs,[r("div",{class:"delete-brand-progress-bar-fill",style:Ie({width:`${J(t)}%`})},null,4)]),r("div",Qs,c(ce(t)),1)])):f("",!0),t.previewRows?.length?(u(),i("div",Xs,c(ye(t.previewRows)),1)):f("",!0),H(t)?(u(),i("div",Ws,"错误信息:"+c(H(t)),1)):f("",!0)]),r("div",Ys,[r("span",{class:be(["status",O(t).className])},c(O(t).text),3),fe(t)?(u(),i("button",{key:0,type:"button",class:"download",onClick:n=>pe(t)}," 下载 ",8,Zs)):f("",!0),t.resultId?(u(),i("button",{key:1,type:"button",class:"btn-delete",onClick:n=>ge(t.resultId)}," 删除 ",8,et)):f("",!0)])]))),128))])])):f("",!0)],64)):(u(),i("div",_s," 暂无删除品牌结果,完成解析后会在这里展示按国家分组的去重结果 "))])])])])]))}}),tt=Ve(st,[["__scopeId","data-v-7f166b99"]]);ze(tt).use(Ge).mount("#app"); +import{d as Me,o as Ae,I as Be,a as u,c as i,b as qe,B as Ue,e as r,F as R,r as Z,t as c,f,J as Ke,K as Ie,n as be,g as p,h as j,L as He,i as M,E as h,M as Je,N as Oe,O as Le,P as je,_ as Ve,p as ze,q as Ge}from"./pywebview-V_UIajJm.js";import{e as Qe}from"./brand-1nUVsWrm.js";const Xe={class:"page-shell module-page"},We={class:"main-content"},Ye={class:"left-panel"},Ze={class:"upload-zone"},es={class:"selected-files clean-placeholder split-selected-files"},ss={key:0,class:"more-line"},ts={key:1},ns={class:"run-row"},as=["disabled"],ls={class:"loading-msg"},rs={key:0,class:"queue-debug-card"},os={key:0,class:"queue-debug-line"},us={key:1,class:"queue-debug-payload"},is={class:"right-panel"},cs={class:"task-list-wrap"},ds={class:"clean-result-summary"},fs={class:"summary-card"},vs={class:"summary-card"},hs={class:"summary-card"},ps={class:"result-list-wrap"},_s={key:0,class:"empty-tasks"},gs={key:0,class:"result-subsection"},ys={class:"task-list clean-result-list"},ks={class:"left split-result-main"},ms=["title"],Is={class:"files"},bs={class:"files"},ws={key:0,class:"files"},Ss={key:1,class:"files"},Cs={key:2,class:"files"},Fs={key:3,class:"time"},Ts={key:4,class:"delete-brand-progress-block"},xs={class:"delete-brand-progress-header"},Ns={class:"delete-brand-progress-bar"},$s={class:"files delete-brand-progress"},Es={key:5,class:"files split-entry-list delete-brand-preview"},Ps={key:6,class:"files"},Ds={class:"task-right split-result-actions"},Rs=["onClick"],Ms=["onClick"],As=["onClick"],Bs={key:1,class:"result-subsection"},qs={class:"task-list clean-result-list"},Us={class:"left split-result-main"},Ks=["title"],Hs={class:"files"},Js={class:"files"},Os={key:0,class:"files"},Ls={key:1,class:"files"},js={key:2,class:"time"},Vs={key:3,class:"delete-brand-progress-block"},zs={class:"delete-brand-progress-header"},Gs={class:"delete-brand-progress-bar"},Qs={class:"files delete-brand-progress"},Xs={key:4,class:"files split-entry-list delete-brand-preview"},Ws={key:5,class:"files"},Ys={class:"task-right split-result-actions"},Zs=["onClick"],et=["onClick"],st=Me({__name:"BrandDeleteBrandTab",setup(nt){function N(){return`delete-brand:current-tasks:${typeof window<"u"&&window.localStorage.getItem("uid")||"0"}`}const C=p([]),A=p([]),$=p(!1),ee=p([]),d=p([]),B=p([]),q=p({total:0,successCount:0,failedCount:0,items:[]}),I=p(""),k=p(""),_=p({}),y=p(null),V=p(!1),F=p(!1),b=p(""),U=p(!1),z=j(()=>C.value.slice(0,10)),m=j(()=>{const e=[];return d.value.forEach(s=>{e.push(...s.items)}),e});function we(){try{const e=typeof window<"u"?window.localStorage.getItem(N()):null;if(e){if(d.value=JSON.parse(e),d.value.length>0){const s=d.value[d.value.length-1];I.value=s.queuePushResult||"",k.value=s.queuePayloadText||""}}else d.value=[]}catch{d.value=[]}}function se(e,s,t,n){const l=s.filter(v=>v.matchStatus==="MATCHED"&&v.success!==!1);if(l.length===0)return;const o={taskId:e,items:l,createdAt:Date.now(),queuePushResult:t,queuePayloadText:n},a=d.value.findIndex(v=>v.taskId===e);a>=0?d.value[a]=o:d.value.push(o),typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value))}function te(e){const s=d.value.length;d.value=d.value.filter(t=>t.taskId!==e),d.value.length!==s&&typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value))}const K=j(()=>B.value.filter(e=>!m.value.some(s=>s.taskId===e.taskId||s.resultId&&s.resultId===e.resultId))),Se=j(()=>m.value.length>0||K.value.length>0);function ne(){typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value))}function E(e){return e?(d.value.find(t=>t.taskId===e)?.items.length||0)>1:!1}function G(e){return e&&d.value.find(s=>s.taskId===e)||null}function Q(e,s){return!e||!s?!1:e.resultId!=null&&s.resultId!=null?e.resultId===s.resultId:e.fileKey&&s.fileKey?e.fileKey===s.fileKey:e.sourceFilename===s.sourceFilename}function T(e,s){const t=G(e);return t&&t.items.find(n=>Q(n,s))||null}function ae(e){if(!e)return!1;const s=G(e);if(!s)return!1;let t=!1;const n=_.value[e]?.line_progress?.info;if(E(e)&&n?.finished_files!=null&&n.finished_files>=0){const l=s.items.filter(a=>a._pushed),o=Math.max(0,Math.min(n.finished_files,l.length));for(let a=0;a0&&n.current_line>=n.total_lines){const l=m.value.find(a=>x(a)===b.value),o=l&&l.taskId===e?T(e,l):s.items.find(a=>a.sourceFilename===n.file_name);o&&!o._completed&&(o._completed=!0,t=!0)}return t&&ne(),t}function le(e){return e&&_.value[e]?.task?.status||""}function H(e){if(e.error)return e.error;if(e.matchStatus&&e.matchStatus!=="MATCHED")return e.matchMessage||"";const s=e.taskId;return s&&_.value[s]?.task?.errorMessage||""}function re(e){const s=e.taskId;if(!s)return!1;const t=_.value[s]?.line_progress,n=le(s),l=E(s),o=S(e);if(l){const a=T(s,e),v=x(e)===b.value,g=!!(t?.has_progress&&t?.info?.file_name===e.sourceFilename);return!!(v||g||a?._pushed||(n==="RUNNING"||n==="PENDING"||!n)&&a?._completed)}return o==="本文件解析完毕"||o==="已被全局判定为终态"?!1:t?.has_progress||t?.info?!0:o==="已入队"||o==="处理中"}function oe(e){return e.map(s=>s.matchStatus==="MATCHED"?{...s,_pushed:!1,_completed:!1}:{...s,matched:!1,openStoreUrl:void 0,error:s.error||void 0,_pushed:!1,_completed:!1})}function ue(e){return e.matchStatus==="MATCHED"?`已匹配 ${e.shopId||""}`.trim():e.matchMessage?e.matchMessage:e.matchStatus==="CONFLICT"?"存在多个同名店铺,请人工确认":e.matchStatus==="PENDING"||e.matchStatus==="INDEX_STALE"?"店铺索引暂未就绪":e.matchStatus?e.matchStatus:e.matched?`已匹配 ${e.shopId||""}`.trim():"待匹配"}function Ce(){ee.value=[...m.value,...K.value]}function w(){Ce(),Fe(ee.value)}function Fe(e){q.value={total:e.length,successCount:e.filter(s=>s.success).length,failedCount:e.filter(s=>!s.success).length,items:e}}function ie(e){const s=e.taskId;return s&&(_.value[s]?.fileProgress||[]).find(l=>l.fileKey&&e.fileKey?l.fileKey===e.fileKey:l.sourceFilename&&e.sourceFilename?l.sourceFilename===e.sourceFilename:!1)||null}function ce(e){const s=e.taskId;if(!s)return"";const t=_.value[s],n=t?.line_progress?.info,l=ie(e);if(l){const a=[],v=l.processedRows??0,g=l.totalRows??0;if(l.status&&a.push(`文件状态:${l.status}`),a.push(`文件进度:${v}/${g}`),n?.finished_files!=null){const D=n.file_total&&n.file_total>0?`/${n.file_total}`:"";a.push(`已完成文件:${n.finished_files}${D}`)}return n?.phase&&a.push(`阶段:${n.phase}`),a.join("|")}if(!t?.line_progress?.has_progress||!n){const a=t?.task?.status;return a?`任务状态:${a}`:""}const o=[];if(n.phase&&o.push(`阶段:${n.phase}`),n.file_index&&n.file_total&&o.push(`文件:${n.file_index}/${n.file_total}`),n.file_name&&o.push(`当前文件:${n.file_name}`),n.current_line!=null&&n.total_lines!=null&&o.push(`${E(s)?"当前文件进度":"进度"}:${n.current_line}/${n.total_lines}`),n.current_country&&o.push(`国家:${n.current_country}`),n.current_asin&&o.push(`ASIN:${n.current_asin}`),n.finished_files!=null){const a=n.file_total&&n.file_total>0?`/${n.file_total}`:"";o.push(`已完成文件:${n.finished_files}${a}`)}return o.join("|")}function J(e){const s=e.taskId;if(!s)return 0;const t=ie(e);if(t)return Math.max(0,Math.min(100,t.percent??0));const n=_.value[s]?.line_progress?.info;return n?n.current_line!=null&&n.total_lines&&n.total_lines>0?Math.max(0,Math.min(100,Math.round(n.current_line/n.total_lines*100))):n.finished_files!=null&&n.file_total&&n.file_total>0?Math.max(0,Math.min(100,Math.round(n.finished_files/n.file_total*100))):_.value[s]?.task?.status==="SUCCESS"?100:0:0}function de(e){const s=_.value[e]?.task?.status;return s==="SUCCESS"||s==="FAILED"}function P(){const e=new Set;return d.value.forEach(s=>{s.items.some(t=>t._pushed)&&e.add(s.taskId)}),Array.from(e)}function S(e){const s=e.taskId;if(!s||!G(s))return"";const n=T(s,e),l=le(s),o=_.value[s]?.line_progress,a=E(s);if(!a&&(l==="SUCCESS"||l==="FAILED"||e.taskStatus==="SUCCESS"||e.taskStatus==="FAILED"))return"已被全局判定为终态";if(n?._completed)return"本文件解析完毕";if(l==="RUNNING"&&o?.has_progress&&o?.info?.file_name===e.sourceFilename)return"处理中";if(a&&!n?._pushed&&!n?._completed)return"未入队";if(a&&l==="SUCCESS")return"本文件解析完毕";if(!a){const v=_.value[s];if(v?.items&&v.items.find(D=>Q(D,e))&&l==="SUCCESS")return"本文件解析完毕"}return n?._pushed?"已入队":"未入队"}function fe(e){if(e.downloadUrl)return!0;const s=e.taskId;return s?_.value[s]?.task?.status==="SUCCESS":!1}function Te(e){const s=e?.task?.id;if(!s||!e?.items?.length)return!1;const t=d.value.find(a=>a.taskId===s);if(!t)return!1;let n=!1;const o=t.items.map(a=>{const v=e.items?.find(D=>Q(D,a));if(!v)return a;const g={...a,...v,success:a.success??v.success,_pushed:a._pushed,_completed:a._completed};return JSON.stringify(g)!==JSON.stringify(a)&&(n=!0),g}).filter(a=>a.matchStatus==="MATCHED"&&a.success!==!1);return JSON.stringify(o)!==JSON.stringify(t.items)&&(t.items=o,n=!0),n&&ne(),n}async function X(e){const s=e||P();if(s.length)try{const t=await He(s);let n=!1;for(const l of t.items||[]){const o=l?.task?.id;typeof o=="number"&&o>0&&(_.value[o]=l,Te(l)&&(n=!0),ae(o)&&(n=!0))}n&&w()}catch{}}function xe(){return document.visibilityState==="visible"?4500:1e4}function W(e=!1){if(y.value){if(!e)return;clearTimeout(y.value),y.value=null}const s=async()=>{if(y.value=null,V.value){W();return}const t=P();if(!t.length)return;V.value=!0;let n=!1;try{await X(t),await De();for(const l of t)de(l)&&(te(l),n=!0)}finally{V.value=!1}n&&(L(),w()),P().length>0&&W()};e?s():y.value=window.setTimeout(s,xe())}function Y(e=!1){y.value&&!e||W(e)}function O(e){const s=e.taskId?_.value[e.taskId]?.task?.status:null;return s==="SUCCESS"?{className:"success",text:"已完成"}:s==="FAILED"?{className:"failed",text:"失败"}:s==="RUNNING"?{className:"running",text:"执行中"}:e.taskStatus==="SUCCESS"?{className:"success",text:"已完成"}:e.taskStatus==="FAILED"?{className:"failed",text:"失败"}:e.taskStatus==="RUNNING"?{className:"running",text:"执行中"}:e.success?{className:"success",text:"已完成"}:{className:"failed",text:"失败"}}function ve(){y.value&&(window.clearTimeout(y.value),y.value=null)}async function he(e){const s=M();if(!s?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const n of e){const l=typeof n=="string"?n:n.absolutePath,o=typeof n=="string"?void 0:n.relativePath,a=await s.upload_file_to_java(l,o);if(!a?.success||!a.data)throw new Error(a?.error||a?.message||`上传失败:${l}`);t.push(a.data)}return t}async function Ne(){const e=M();if(!e?.select_brand_xlsx_files){h.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const s=await e.select_brand_xlsx_files();if(!s?.length)return;C.value=s,A.value=await he(s),h.success(`已选择 ${s.length} 个删除品牌文件`)}catch(s){h.error(s instanceof Error?s.message:"选择失败")}}async function $e(){const e=M();if(!e?.select_brand_folder){h.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const s=await e.select_brand_folder();if(!s)return;const t=await Qe(s);if(!t.success||!t.items?.length){h.warning(t.error||"该文件夹下没有 xlsx 文件");return}C.value=t.items.map(n=>n.relativePath||n.absolutePath),A.value=await he(t.items),h.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`)}catch(s){h.error(s instanceof Error?s.message:"选择失败")}}async function Ee(){if(!A.value.length){h.warning("请先选择待处理文件");return}try{$.value=!0;const e=await Je({files:A.value.map(l=>({fileKey:l.fileKey,originalFilename:l.originalFilename,relativePath:l.relativePath}))}),s=oe(e.items||[]),t=s.some(l=>l.matchStatus==="MATCHED"),n=s.some(l=>l.matchStatus&&l.matchStatus!=="MATCHED");I.value="解析完成,等待手动点击打开紫鸟进行单任务处理",k.value="",s.length&&s[0].taskId&&se(s[0].taskId,s,I.value,k.value),w(),n?h.warning("部分文件尚未命中可用店铺索引,已保留状态信息,请等待后台刷新后重试。"):t?h.success("删除品牌解析完成,请手动推送"):h.warning("当前没有可推送的已匹配文件,请先等待店铺索引刷新。"),await L()}catch(e){h.error(e instanceof Error?e.message:"执行失败")}finally{$.value=!1}}async function pe(e){const s=e.taskId;if(!s){h.warning("未找到任务ID");return}const t=M(),n=Oe(s),l=e.outputFilename||e.sourceFilename||`delete-brand_${s}.xlsx`;if(t?.save_file_from_url){const o=await t.save_file_from_url(n,l);o.success?h.success(`已保存:${o.path||l}`):o.error&&o.error!=="用户取消"&&h.error(o.error);return}window.open(n,"_blank")}async function L(){try{const e=await Le();B.value=oe(e.items||[]),w(),await X(),Y(!0)}catch(e){console.error("loadHistory error:",e)}}function _e(e){d.value.forEach(t=>{t.items=t.items.filter(n=>n.resultId!==e)});const s=d.value.length;d.value=d.value.filter(t=>t.items.length>0),d.value.length!==s&&typeof window<"u"&&window.localStorage.setItem(N(),JSON.stringify(d.value)),B.value=B.value.filter(t=>t.resultId!==e),w(),P().length===0&&ve()}async function ge(e){try{await je(e),_e(e),await L(),h.success("已删除")}catch(s){const t=s instanceof Error?s.message:"删除失败";if(typeof t=="string"&&t.includes("记录不存在")){_e(e),h.success("已删除");return}h.error(t)}}function ye(e){const s=e.slice(0,5).map(n=>`${n.country}:${n.asin}${n.status?`(${n.status})`:""}`);return e.length-s.length>0?`${s.join("、")} 等 ${e.length} 条`:s.join("、")}function at(e,s){}function ke(){for(const e of d.value)for(const s of e.items){const t=S(s);if(t==="已入队"||t==="处理中")return!0}return!1}function x(e){return e.resultId!=null?`result:${e.resultId}`:`task:${e.taskId||0}:${e.sourceFilename||""}`}function Pe(){return m.value.find(e=>!e.openStoreUrl||x(e)===b.value||T(e.taskId,e)?._completed?!1:S(e)==="未入队")}async function me(e,s){if(s?.auto&&ke())return e.taskId,e.sourceFilename,!1;const t=M(),n=e.taskId;if(!n)return!1;const l=d.value.find(g=>g.taskId===n);if(!l)return!1;if(!t?.enqueue_json)return h.error("当前环境未启用 pywebview enqueue_json(浏览器环境不会推送)"),!1;const o={type:"delete-brand-run",ts:Date.now(),data:{taskId:n,items:[e]}};k.value=JSON.stringify(o,null,2);const a=await t.enqueue_json(o);let v="";if(a?.success){v=`已推送文件 ${e.sourceFilename},当前队列长度:${a.queue_size??"-"}`;const g=T(n,e);g&&(g._pushed=!0,g._completed=!1),b.value=x(e),se(n,l.items,v,k.value),Y(!0)}else v=`推送到 Python 队列失败:${a?.error||"未知错误"}`;return I.value=v,!!a?.success}async function De(){if(!F.value||U.value){F.value,U.value;return}if(ke())return;const e=b.value;if(e){const t=m.value.find(n=>x(n)===e);if(t){const n=t.taskId,l=E(n);l&&(ae(n),S(t),void 0);const o=S(t);if(o==="已入队"||o==="处理中"){t.sourceFilename;return}if(l){const a=T(n,t);if(a&&!a._completed){t.sourceFilename,a._pushed,a._completed;return}}}}const s=Pe();if(!s){b.value="",F.value=!1;return}U.value=!0;try{s.taskId,s.sourceFilename,x(s),await me(s,{auto:!0})||(s.taskId,s.sourceFilename,F.value=!1)}finally{U.value=!1}}async function Re(e){F.value=!0,await me(e)||(F.value=!1,b.value="")}return Ae(()=>{we();const e=P();e.length>0?X(e).then(()=>{let s=!1;for(const t of e)de(t)&&(te(t),s=!0);s&&w(),Y(!0)}):w(),L().catch(()=>{})}),Be(()=>{ve()}),(e,s)=>(u(),i("div",Xe,[qe(Ue,{active:"delete-brand"}),r("div",We,[r("aside",Ye,[s[2]||(s[2]=r("div",{class:"section-title"},"选择文件",-1)),r("div",Ze,[s[0]||(s[0]=r("div",{class:"hint"},"上传删除品牌 Excel;无论是直接上传文件还是上传文件夹批量导入,都会按每个 Excel 文件名作为店铺名。",-1)),r("div",{class:"btns"},[r("button",{type:"button",class:"opt-btn",onClick:Ne},"选择 Excel 文件"),r("button",{type:"button",class:"opt-btn",onClick:$e},"选择文件夹")]),r("div",es,[C.value.length?(u(),i(R,{key:0},[(u(!0),i(R,null,Z(z.value,t=>(u(),i("span",{key:t},c(t),1))),128)),C.value.length>z.value.length?(u(),i("span",ss," 还有 "+c(C.value.length-z.value.length)+" 个文件未展开显示 ",1)):f("",!0)],64)):(u(),i("span",ts,"暂未选择删除品牌文件"))])]),s[3]||(s[3]=Ke('
执行说明
',2)),r("div",ns,[r("button",{type:"button",class:"btn-run",disabled:$.value,onClick:Ee},c($.value?"解析中...":"开始解析"),9,as),r("span",ls,c($.value?"正在读取删除品牌数据,请稍候…":"解析后会在右侧展示按国家分组的去重结果"),1)]),I.value||k.value?(u(),i("div",rs,[s[1]||(s[1]=r("div",{class:"section-title queue-debug-title"},"Python 队列推送结果",-1)),I.value?(u(),i("div",os,c(I.value),1)):f("",!0),k.value?(u(),i("pre",us,c(k.value),1)):f("",!0)])):f("",!0)]),r("section",is,[s[12]||(s[12]=r("div",{class:"panel-header"},"删除品牌结果",-1)),r("div",cs,[r("div",ds,[r("div",fs,[s[4]||(s[4]=r("span",{class:"summary-label"},"已处理文件",-1)),r("strong",null,c(q.value.total),1)]),r("div",vs,[s[5]||(s[5]=r("span",{class:"summary-label"},"成功结果",-1)),r("strong",null,c(q.value.successCount),1)]),r("div",hs,[s[6]||(s[6]=r("span",{class:"summary-label"},"失败文件",-1)),r("strong",null,c(q.value.failedCount),1)])]),r("div",ps,[s[11]||(s[11]=r("div",{class:"result-list-header"},[r("span",null,"删除品牌结果列表")],-1)),Se.value?(u(),i(R,{key:1},[m.value.length?(u(),i("div",gs,[s[8]||(s[8]=r("div",{class:"result-subsection-title"},"当前任务",-1)),r("ul",ys,[(u(!0),i(R,null,Z(m.value,t=>(u(),i("li",{key:`current-${t.taskId||t.resultId||t.sourceFilename}`,class:"task-item split-result-item"},[r("div",ks,[r("span",{class:"id",title:t.sourceFilename},c(t.sourceFilename||"-"),9,ms),r("div",Is,"店铺名:"+c(t.shopName||"-"),1),r("div",bs,"匹配结果:"+c(ue(t)),1),t.platform?(u(),i("div",ws,"平台:"+c(t.platform),1)):f("",!0),S(t)?(u(),i("div",Ss,"队列状态:"+c(S(t)),1)):f("",!0),t.countryCount!==void 0&&t.matched?(u(),i("div",Cs,"国家数:"+c(t.countryCount),1)):f("",!0),t.totalRows!==void 0&&t.matched?(u(),i("div",Fs,"去重后 "+c(t.totalRows)+" 条 ",1)):f("",!0),re(t)?(u(),i("div",Ts,[r("div",xs,[s[7]||(s[7]=r("span",null,"任务进度",-1)),r("span",null,c(J(t))+"%",1)]),r("div",Ns,[r("div",{class:"delete-brand-progress-bar-fill",style:Ie({width:`${J(t)}%`})},null,4)]),r("div",$s,c(ce(t)),1)])):f("",!0),t.previewRows?.length?(u(),i("div",Es,c(ye(t.previewRows)),1)):f("",!0),H(t)?(u(),i("div",Ps,"错误信息:"+c(H(t)),1)):f("",!0)]),r("div",Ds,[r("span",{class:be(["status",O(t).className])},c(O(t).text),3),t.openStoreUrl?(u(),i("button",{key:0,type:"button",class:"download",onClick:n=>Re(t)}," 打开紫鸟 ",8,Rs)):f("",!0),fe(t)?(u(),i("button",{key:1,type:"button",class:"download",onClick:n=>pe(t)}," 下载 ",8,Ms)):f("",!0),t.resultId?(u(),i("button",{key:2,type:"button",class:"btn-delete",onClick:n=>ge(t.resultId)}," 删除 ",8,As)):f("",!0)])]))),128))])])):f("",!0),K.value.length?(u(),i("div",Bs,[s[10]||(s[10]=r("div",{class:"result-subsection-title"},"历史记录",-1)),r("ul",qs,[(u(!0),i(R,null,Z(K.value,t=>(u(),i("li",{key:`history-${t.taskId||t.resultId||t.sourceFilename}`,class:"task-item split-result-item"},[r("div",Us,[r("span",{class:"id",title:t.sourceFilename},c(t.sourceFilename||"-"),9,Ks),r("div",Hs,"店铺名:"+c(t.shopName||"-"),1),r("div",Js,"匹配结果:"+c(ue(t)),1),t.platform?(u(),i("div",Os,"平台:"+c(t.platform),1)):f("",!0),t.countryCount!==void 0&&t.matched?(u(),i("div",Ls,"国家数:"+c(t.countryCount),1)):f("",!0),t.totalRows!==void 0&&t.matched?(u(),i("div",js,"去重后 "+c(t.totalRows)+" 条 ",1)):f("",!0),re(t)?(u(),i("div",Vs,[r("div",zs,[s[9]||(s[9]=r("span",null,"任务进度",-1)),r("span",null,c(J(t))+"%",1)]),r("div",Gs,[r("div",{class:"delete-brand-progress-bar-fill",style:Ie({width:`${J(t)}%`})},null,4)]),r("div",Qs,c(ce(t)),1)])):f("",!0),t.previewRows?.length?(u(),i("div",Xs,c(ye(t.previewRows)),1)):f("",!0),H(t)?(u(),i("div",Ws,"错误信息:"+c(H(t)),1)):f("",!0)]),r("div",Ys,[r("span",{class:be(["status",O(t).className])},c(O(t).text),3),fe(t)?(u(),i("button",{key:0,type:"button",class:"download",onClick:n=>pe(t)}," 下载 ",8,Zs)):f("",!0),t.resultId?(u(),i("button",{key:1,type:"button",class:"btn-delete",onClick:n=>ge(t.resultId)}," 删除 ",8,et)):f("",!0)])]))),128))])])):f("",!0)],64)):(u(),i("div",_s," 暂无删除品牌结果,完成解析后会在这里展示按国家分组的去重结果 "))])])])])]))}}),tt=Ve(st,[["__scopeId","data-v-7f166b99"]]);ze(tt).use(Ge).mount("#app"); diff --git a/app/assets/split.js b/app/assets/split.js index b45cf3d..bee324a 100644 --- a/app/assets/split.js +++ b/app/assets/split.js @@ -1 +1 @@ -import{d as G,o as J,a,c as n,b as L,B as O,e,F as S,r as $,t as i,f as v,n as x,w as k,s as V,C as M,g as d,h as Q,i as F,E as r,D as W,G as X,m as Y,v as Z,H as ss,_ as es,p as ts,q as ls}from"./pywebview-BCPdlDdb.js";import{e as as}from"./brand-CFZZtTv8.js";const ns={class:"page-shell module-page"},os={class:"main-content"},is={class:"left-panel"},rs={class:"upload-zone"},us={class:"selected-files clean-placeholder split-selected-files"},ds={key:0,class:"more-line"},cs={key:1},ps={class:"option-group column-option-group"},vs={class:"column-toolbar"},fs={class:"column-count"},_s={class:"column-actions"},ms={key:0,class:"column-grid"},ys=["value"],gs={key:1,class:"empty-column-state"},hs={class:"option-group"},bs={class:"radio-item active"},ws={class:"desc"},ks={class:"option-group"},Cs={class:"option-group"},Ss={key:0,class:"split-input-card"},xs={key:1,class:"split-input-card"},Fs={class:"run-row"},Es=["disabled"],Ps={class:"loading-msg"},$s={class:"right-panel"},Bs={class:"task-list-wrap"},Rs={class:"clean-result-summary"},Us={class:"summary-card"},Is={class:"summary-card"},Vs={class:"summary-card"},Ms={class:"result-list-wrap"},Ts={key:0,class:"empty-tasks"},Ds={key:1,class:"task-list clean-result-list"},Hs={class:"left split-result-main"},Ns=["title"],js={key:0,class:"files"},As={key:1,class:"time"},Ks={key:2,class:"files"},zs={key:3,class:"files split-entry-list"},qs={key:4,class:"files"},Gs={class:"task-right split-result-actions"},Js=["onClick"],Ls=["onClick"],Os=G({__name:"BrandSplitTab",setup(Ws){const f=d([]),C=d(""),c=d([]),_=d([]),p=d([]),B=d(0),u=d("rows_per_file"),m=d(2e3),y=d(5),g=d(!1),h=d([]),b=d({total:0,successCount:0,failedCount:0,items:[]}),E=Q(()=>f.value.slice(0,8));function T(l){b.value={total:l.length,successCount:l.filter(s=>s.success).length,failedCount:l.filter(s=>!s.success).length,items:l}}async function R(l){const s=F();if(!s?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const o of l){const I=typeof o=="string"?o:o.absolutePath,q=typeof o=="string"?void 0:o.relativePath,w=await s.upload_file_to_java(I,q);if(!w?.success||!w.data)throw new Error(w?.error||w?.message||`上传失败:${I}`);t.push(w.data)}return t}async function U(l){const s=await Y(l);_.value=s.headers||[],p.value=[...s.headers||[]],B.value=s.totalRows||0}async function D(l,s){f.value=l,C.value="",c.value=await R(l),c.value.length>0&&await U(c.value[0].fileKey),r.success(s)}async function H(){const l=F();if(!l?.select_brand_xlsx_files){r.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const s=await l.select_brand_xlsx_files();if(!s?.length)return;await D(s,`已选择 ${s.length} 个待拆分文件`)}catch(s){r.error(s instanceof Error?s.message:"选择失败")}}async function N(){const l=F();if(!l?.select_brand_folder){r.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const s=await l.select_brand_folder();if(!s)return;C.value=s.split(/[/\\]/).filter(Boolean).pop()||"";const t=await as(s);if(t.success&&t.items?.length){f.value=t.items.map(o=>o.relativePath),c.value=await R(t.items),c.value.length>0&&await U(c.value[0].fileKey),r.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`);return}r.warning(t.error||"该文件夹下没有 xlsx 文件")}catch(s){r.error(s instanceof Error?s.message:"选择失败")}}async function j(){if(!c.value.length){r.warning("请先选择待拆分 Excel 文件或文件夹");return}if(!p.value.length){r.warning("请至少选择一列保留列");return}if(u.value==="rows_per_file"&&(!m.value||m.value<=0)){r.warning("请输入有效的每份条数");return}if(u.value==="parts"&&(!y.value||y.value<=0)){r.warning("请输入有效的拆分份数");return}try{g.value=!0;const l=await W({files:c.value.map(s=>({fileKey:s.fileKey,originalFilename:s.originalFilename,relativePath:s.relativePath})),selectedColumns:p.value,splitMode:u.value,rowsPerFile:u.value==="rows_per_file"&&m.value||void 0,parts:u.value==="parts"&&y.value||void 0,archiveName:c.value.some(s=>!!s.relativePath)&&C.value?C.value:void 0});b.value=l,h.value=l.items||[],await P(),r.success("数据拆分完成")}catch(l){r.error(l instanceof Error?l.message:"数据拆分失败")}finally{g.value=!1}}async function P(){try{const l=await X();h.value=l.items||[],T(h.value)}catch{}}async function A(l){try{await ss(l),await P(),r.success("已删除")}catch(s){r.error(s instanceof Error?s.message:"删除失败")}}function K(l){const s=l.slice(0,4).map(o=>o.rowCount!==void 0?`${o.filename}(${o.rowCount}条)`:o.filename);return l.length-s.length>0?`${s.join("、")} 等 ${l.length} 个文件`:s.join("、")}async function z(l){const s=F();if(!l.downloadUrl){r.warning("当前结果没有下载地址");return}const t=l.outputFilename||`${new Date().toISOString().slice(0,10).replace(/-/g,"")}.zip`;if(s?.save_file_from_url){const o=await s.save_file_from_url(l.downloadUrl,t);o.success?r.success(`已保存:${o.path||t}`):o.error&&o.error!=="用户取消"&&r.error(o.error);return}window.open(l.downloadUrl,"_blank")}return J(()=>{P().catch(()=>{})}),(l,s)=>(a(),n("div",ns,[L(O,{active:"split"}),e("div",os,[e("aside",is,[s[14]||(s[14]=e("div",{class:"section-title"},"选择文件",-1)),e("div",rs,[s[7]||(s[7]=e("div",{class:"hint"},"选择需要拆分的 Excel 文件或文件夹,按规则拆成多个 Excel 文件。",-1)),e("div",{class:"btns"},[e("button",{type:"button",class:"opt-btn",onClick:H},"选择 Excel 文件"),e("button",{type:"button",class:"opt-btn",onClick:N},"选择文件夹")]),e("div",us,[f.value.length?(a(),n(S,{key:0},[(a(!0),n(S,null,$(E.value,t=>(a(),n("span",{key:t},i(t),1))),128)),f.value.length>E.value.length?(a(),n("span",ds," 还有 "+i(f.value.length-E.value.length)+" 个文件未展开显示 ",1)):v("",!0)],64)):(a(),n("span",cs,"暂未选择待拆分文件"))])]),s[15]||(s[15]=e("div",{class:"section-title"},"保留列设置",-1)),e("div",ps,[e("div",vs,[e("span",fs,"已选择 "+i(p.value.length)+" / "+i(_.value.length)+" 列",1),e("div",_s,[e("button",{type:"button",class:"opt-btn small",onClick:s[0]||(s[0]=t=>p.value=[..._.value])},"全选"),e("button",{type:"button",class:"opt-btn small",onClick:s[1]||(s[1]=t=>p.value=[])},"清空")])]),_.value.length?(a(),n("div",ms,[(a(!0),n(S,null,$(_.value,t=>(a(),n("label",{key:t,class:x(["column-item",{active:p.value.includes(t)}])},[k(e("input",{"onUpdate:modelValue":s[2]||(s[2]=o=>p.value=o),type:"checkbox",value:t},null,8,ys),[[Z,p.value]]),e("span",null,i(t),1)],2))),128))])):(a(),n("div",gs,"请选择 Excel 文件后读取表头并填充可保留列"))]),s[16]||(s[16]=e("div",{class:"section-title"},"总条数",-1)),e("div",hs,[e("label",bs,[s[9]||(s[9]=e("input",{type:"checkbox",checked:"",disabled:""},null,-1)),e("div",null,[s[8]||(s[8]=e("span",{class:"label"},"当前数据总条数",-1)),e("div",ws,i(B.value)+" 条(不含表头)",1)])])]),s[17]||(s[17]=e("div",{class:"section-title"},"拆分模式",-1)),e("div",ks,[e("label",{class:x(["radio-item",{active:u.value==="rows_per_file"}])},[k(e("input",{"onUpdate:modelValue":s[3]||(s[3]=t=>u.value=t),type:"radio",value:"rows_per_file",name:"split-mode"},null,512),[[V,u.value]]),s[10]||(s[10]=e("div",null,[e("span",{class:"label"},"按每份条数"),e("div",{class:"desc"},"例如每份 2000 条,最后一份放剩余数据")],-1))],2),e("label",{class:x(["radio-item",{active:u.value==="parts"}])},[k(e("input",{"onUpdate:modelValue":s[4]||(s[4]=t=>u.value=t),type:"radio",value:"parts",name:"split-mode"},null,512),[[V,u.value]]),s[11]||(s[11]=e("div",null,[e("span",{class:"label"},"按份数平均拆分"),e("div",{class:"desc"},"例如拆 5 份,按总条数尽量平均分配")],-1))],2)]),s[18]||(s[18]=e("div",{class:"section-title"},"拆分参数",-1)),e("div",Cs,[u.value==="rows_per_file"?(a(),n("label",Ss,[s[12]||(s[12]=e("span",{class:"label"},"每份条数",-1)),k(e("input",{"onUpdate:modelValue":s[5]||(s[5]=t=>m.value=t),class:"split-number-input",type:"number",min:"1",placeholder:"例如 2000"},null,512),[[M,m.value,void 0,{number:!0}]])])):(a(),n("label",xs,[s[13]||(s[13]=e("span",{class:"label"},"拆分份数",-1)),k(e("input",{"onUpdate:modelValue":s[6]||(s[6]=t=>y.value=t),class:"split-number-input",type:"number",min:"1",placeholder:"例如 5"},null,512),[[M,y.value,void 0,{number:!0}]])]))]),e("div",Fs,[e("button",{type:"button",class:"btn-run",disabled:g.value,onClick:j},i(g.value?"拆分中...":"开始拆分"),9,Es),e("span",Ps,i(g.value?"正在拆分并上传结果,请稍候…":"选择文件、保留列和拆分规则后即可执行拆分,结果会显示在右侧供下载"),1)])]),e("section",$s,[s[23]||(s[23]=e("div",{class:"panel-header"},"拆分结果",-1)),e("div",Bs,[e("div",Rs,[e("div",Us,[s[19]||(s[19]=e("span",{class:"summary-label"},"已处理文件",-1)),e("strong",null,i(b.value.total),1)]),e("div",Is,[s[20]||(s[20]=e("span",{class:"summary-label"},"成功结果",-1)),e("strong",null,i(b.value.successCount),1)]),e("div",Vs,[s[21]||(s[21]=e("span",{class:"summary-label"},"失败文件",-1)),e("strong",null,i(b.value.failedCount),1)])]),e("div",Ms,[s[22]||(s[22]=e("div",{class:"result-list-header"},[e("span",null,"拆分结果压缩包列表")],-1)),h.value.length===0?(a(),n("div",Ts," 暂无拆分结果,完成数据拆分后会在这里展示压缩包文件 ")):(a(),n("ul",Ds,[(a(!0),n(S,null,$(h.value,t=>(a(),n("li",{key:`${t.resultId||t.outputFilename||t.sourceFilename}-${t.rowCount||0}`,class:"task-item split-result-item"},[e("div",Hs,[e("span",{class:"id",title:t.sourceFilename},i(t.sourceFilename||"-"),9,Ns),t.outputFilename?(a(),n("div",js,"压缩包文件:"+i(t.outputFilename),1)):v("",!0),t.rowCount!==void 0?(a(),n("div",As,"压缩包共包含 "+i(t.rowCount)+" 条数据",1)):v("",!0),t.entryCount&&t.entryCount>0?(a(),n("div",Ks,"压缩包内共 "+i(t.entryCount)+" 个拆分文件",1)):v("",!0),t.entries&&t.entries.length?(a(),n("div",zs," 压缩包内容:"+i(K(t.entries)),1)):v("",!0),t.error?(a(),n("div",qs,"错误信息:"+i(t.error),1)):v("",!0)]),e("div",Gs,[e("span",{class:x(["status",t.success?"success":"failed"])},i(t.success?"已完成":"失败"),3),t.success&&t.downloadUrl?(a(),n("button",{key:0,type:"button",class:"download",onClick:o=>z(t)}," 下载压缩包 ",8,Js)):v("",!0),t.resultId?(a(),n("button",{key:1,type:"button",class:"btn-delete",onClick:o=>A(t.resultId)}," 删除 ",8,Ls)):v("",!0)])]))),128))]))])])])])]))}}),Qs=es(Os,[["__scopeId","data-v-4df71c3f"]]);ts(Qs).use(ls).mount("#app"); +import{d as G,o as J,a,c as n,b as L,B as O,e,F as S,r as $,t as i,f as v,n as x,w as k,s as V,C as M,g as d,h as Q,i as F,E as r,D as W,G as X,m as Y,v as Z,H as ss,_ as es,p as ts,q as ls}from"./pywebview-V_UIajJm.js";import{e as as}from"./brand-1nUVsWrm.js";const ns={class:"page-shell module-page"},os={class:"main-content"},is={class:"left-panel"},rs={class:"upload-zone"},us={class:"selected-files clean-placeholder split-selected-files"},ds={key:0,class:"more-line"},cs={key:1},ps={class:"option-group column-option-group"},vs={class:"column-toolbar"},fs={class:"column-count"},_s={class:"column-actions"},ms={key:0,class:"column-grid"},ys=["value"],gs={key:1,class:"empty-column-state"},hs={class:"option-group"},bs={class:"radio-item active"},ws={class:"desc"},ks={class:"option-group"},Cs={class:"option-group"},Ss={key:0,class:"split-input-card"},xs={key:1,class:"split-input-card"},Fs={class:"run-row"},Es=["disabled"],Ps={class:"loading-msg"},$s={class:"right-panel"},Bs={class:"task-list-wrap"},Rs={class:"clean-result-summary"},Us={class:"summary-card"},Is={class:"summary-card"},Vs={class:"summary-card"},Ms={class:"result-list-wrap"},Ts={key:0,class:"empty-tasks"},Ds={key:1,class:"task-list clean-result-list"},Hs={class:"left split-result-main"},Ns=["title"],js={key:0,class:"files"},As={key:1,class:"time"},Ks={key:2,class:"files"},zs={key:3,class:"files split-entry-list"},qs={key:4,class:"files"},Gs={class:"task-right split-result-actions"},Js=["onClick"],Ls=["onClick"],Os=G({__name:"BrandSplitTab",setup(Ws){const f=d([]),C=d(""),c=d([]),_=d([]),p=d([]),B=d(0),u=d("rows_per_file"),m=d(2e3),y=d(5),g=d(!1),h=d([]),b=d({total:0,successCount:0,failedCount:0,items:[]}),E=Q(()=>f.value.slice(0,8));function T(l){b.value={total:l.length,successCount:l.filter(s=>s.success).length,failedCount:l.filter(s=>!s.success).length,items:l}}async function R(l){const s=F();if(!s?.upload_file_to_java)throw new Error("当前桌面端未提供文件上传桥接能力");const t=[];for(const o of l){const I=typeof o=="string"?o:o.absolutePath,q=typeof o=="string"?void 0:o.relativePath,w=await s.upload_file_to_java(I,q);if(!w?.success||!w.data)throw new Error(w?.error||w?.message||`上传失败:${I}`);t.push(w.data)}return t}async function U(l){const s=await Y(l);_.value=s.headers||[],p.value=[...s.headers||[]],B.value=s.totalRows||0}async function D(l,s){f.value=l,C.value="",c.value=await R(l),c.value.length>0&&await U(c.value[0].fileKey),r.success(s)}async function H(){const l=F();if(!l?.select_brand_xlsx_files){r.warning("当前环境不支持文件选择,请在本机客户端中打开");return}try{const s=await l.select_brand_xlsx_files();if(!s?.length)return;await D(s,`已选择 ${s.length} 个待拆分文件`)}catch(s){r.error(s instanceof Error?s.message:"选择失败")}}async function N(){const l=F();if(!l?.select_brand_folder){r.warning("当前环境不支持文件夹选择,请在本机客户端中打开");return}try{const s=await l.select_brand_folder();if(!s)return;C.value=s.split(/[/\\]/).filter(Boolean).pop()||"";const t=await as(s);if(t.success&&t.items?.length){f.value=t.items.map(o=>o.relativePath),c.value=await R(t.items),c.value.length>0&&await U(c.value[0].fileKey),r.success(`已选择文件夹内 ${t.items.length} 个 xlsx 文件`);return}r.warning(t.error||"该文件夹下没有 xlsx 文件")}catch(s){r.error(s instanceof Error?s.message:"选择失败")}}async function j(){if(!c.value.length){r.warning("请先选择待拆分 Excel 文件或文件夹");return}if(!p.value.length){r.warning("请至少选择一列保留列");return}if(u.value==="rows_per_file"&&(!m.value||m.value<=0)){r.warning("请输入有效的每份条数");return}if(u.value==="parts"&&(!y.value||y.value<=0)){r.warning("请输入有效的拆分份数");return}try{g.value=!0;const l=await W({files:c.value.map(s=>({fileKey:s.fileKey,originalFilename:s.originalFilename,relativePath:s.relativePath})),selectedColumns:p.value,splitMode:u.value,rowsPerFile:u.value==="rows_per_file"&&m.value||void 0,parts:u.value==="parts"&&y.value||void 0,archiveName:c.value.some(s=>!!s.relativePath)&&C.value?C.value:void 0});b.value=l,h.value=l.items||[],await P(),r.success("数据拆分完成")}catch(l){r.error(l instanceof Error?l.message:"数据拆分失败")}finally{g.value=!1}}async function P(){try{const l=await X();h.value=l.items||[],T(h.value)}catch{}}async function A(l){try{await ss(l),await P(),r.success("已删除")}catch(s){r.error(s instanceof Error?s.message:"删除失败")}}function K(l){const s=l.slice(0,4).map(o=>o.rowCount!==void 0?`${o.filename}(${o.rowCount}条)`:o.filename);return l.length-s.length>0?`${s.join("、")} 等 ${l.length} 个文件`:s.join("、")}async function z(l){const s=F();if(!l.downloadUrl){r.warning("当前结果没有下载地址");return}const t=l.outputFilename||`${new Date().toISOString().slice(0,10).replace(/-/g,"")}.zip`;if(s?.save_file_from_url){const o=await s.save_file_from_url(l.downloadUrl,t);o.success?r.success(`已保存:${o.path||t}`):o.error&&o.error!=="用户取消"&&r.error(o.error);return}window.open(l.downloadUrl,"_blank")}return J(()=>{P().catch(()=>{})}),(l,s)=>(a(),n("div",ns,[L(O,{active:"split"}),e("div",os,[e("aside",is,[s[14]||(s[14]=e("div",{class:"section-title"},"选择文件",-1)),e("div",rs,[s[7]||(s[7]=e("div",{class:"hint"},"选择需要拆分的 Excel 文件或文件夹,按规则拆成多个 Excel 文件。",-1)),e("div",{class:"btns"},[e("button",{type:"button",class:"opt-btn",onClick:H},"选择 Excel 文件"),e("button",{type:"button",class:"opt-btn",onClick:N},"选择文件夹")]),e("div",us,[f.value.length?(a(),n(S,{key:0},[(a(!0),n(S,null,$(E.value,t=>(a(),n("span",{key:t},i(t),1))),128)),f.value.length>E.value.length?(a(),n("span",ds," 还有 "+i(f.value.length-E.value.length)+" 个文件未展开显示 ",1)):v("",!0)],64)):(a(),n("span",cs,"暂未选择待拆分文件"))])]),s[15]||(s[15]=e("div",{class:"section-title"},"保留列设置",-1)),e("div",ps,[e("div",vs,[e("span",fs,"已选择 "+i(p.value.length)+" / "+i(_.value.length)+" 列",1),e("div",_s,[e("button",{type:"button",class:"opt-btn small",onClick:s[0]||(s[0]=t=>p.value=[..._.value])},"全选"),e("button",{type:"button",class:"opt-btn small",onClick:s[1]||(s[1]=t=>p.value=[])},"清空")])]),_.value.length?(a(),n("div",ms,[(a(!0),n(S,null,$(_.value,t=>(a(),n("label",{key:t,class:x(["column-item",{active:p.value.includes(t)}])},[k(e("input",{"onUpdate:modelValue":s[2]||(s[2]=o=>p.value=o),type:"checkbox",value:t},null,8,ys),[[Z,p.value]]),e("span",null,i(t),1)],2))),128))])):(a(),n("div",gs,"请选择 Excel 文件后读取表头并填充可保留列"))]),s[16]||(s[16]=e("div",{class:"section-title"},"总条数",-1)),e("div",hs,[e("label",bs,[s[9]||(s[9]=e("input",{type:"checkbox",checked:"",disabled:""},null,-1)),e("div",null,[s[8]||(s[8]=e("span",{class:"label"},"当前数据总条数",-1)),e("div",ws,i(B.value)+" 条(不含表头)",1)])])]),s[17]||(s[17]=e("div",{class:"section-title"},"拆分模式",-1)),e("div",ks,[e("label",{class:x(["radio-item",{active:u.value==="rows_per_file"}])},[k(e("input",{"onUpdate:modelValue":s[3]||(s[3]=t=>u.value=t),type:"radio",value:"rows_per_file",name:"split-mode"},null,512),[[V,u.value]]),s[10]||(s[10]=e("div",null,[e("span",{class:"label"},"按每份条数"),e("div",{class:"desc"},"例如每份 2000 条,最后一份放剩余数据")],-1))],2),e("label",{class:x(["radio-item",{active:u.value==="parts"}])},[k(e("input",{"onUpdate:modelValue":s[4]||(s[4]=t=>u.value=t),type:"radio",value:"parts",name:"split-mode"},null,512),[[V,u.value]]),s[11]||(s[11]=e("div",null,[e("span",{class:"label"},"按份数平均拆分"),e("div",{class:"desc"},"例如拆 5 份,按总条数尽量平均分配")],-1))],2)]),s[18]||(s[18]=e("div",{class:"section-title"},"拆分参数",-1)),e("div",Cs,[u.value==="rows_per_file"?(a(),n("label",Ss,[s[12]||(s[12]=e("span",{class:"label"},"每份条数",-1)),k(e("input",{"onUpdate:modelValue":s[5]||(s[5]=t=>m.value=t),class:"split-number-input",type:"number",min:"1",placeholder:"例如 2000"},null,512),[[M,m.value,void 0,{number:!0}]])])):(a(),n("label",xs,[s[13]||(s[13]=e("span",{class:"label"},"拆分份数",-1)),k(e("input",{"onUpdate:modelValue":s[6]||(s[6]=t=>y.value=t),class:"split-number-input",type:"number",min:"1",placeholder:"例如 5"},null,512),[[M,y.value,void 0,{number:!0}]])]))]),e("div",Fs,[e("button",{type:"button",class:"btn-run",disabled:g.value,onClick:j},i(g.value?"拆分中...":"开始拆分"),9,Es),e("span",Ps,i(g.value?"正在拆分并上传结果,请稍候…":"选择文件、保留列和拆分规则后即可执行拆分,结果会显示在右侧供下载"),1)])]),e("section",$s,[s[23]||(s[23]=e("div",{class:"panel-header"},"拆分结果",-1)),e("div",Bs,[e("div",Rs,[e("div",Us,[s[19]||(s[19]=e("span",{class:"summary-label"},"已处理文件",-1)),e("strong",null,i(b.value.total),1)]),e("div",Is,[s[20]||(s[20]=e("span",{class:"summary-label"},"成功结果",-1)),e("strong",null,i(b.value.successCount),1)]),e("div",Vs,[s[21]||(s[21]=e("span",{class:"summary-label"},"失败文件",-1)),e("strong",null,i(b.value.failedCount),1)])]),e("div",Ms,[s[22]||(s[22]=e("div",{class:"result-list-header"},[e("span",null,"拆分结果压缩包列表")],-1)),h.value.length===0?(a(),n("div",Ts," 暂无拆分结果,完成数据拆分后会在这里展示压缩包文件 ")):(a(),n("ul",Ds,[(a(!0),n(S,null,$(h.value,t=>(a(),n("li",{key:`${t.resultId||t.outputFilename||t.sourceFilename}-${t.rowCount||0}`,class:"task-item split-result-item"},[e("div",Hs,[e("span",{class:"id",title:t.sourceFilename},i(t.sourceFilename||"-"),9,Ns),t.outputFilename?(a(),n("div",js,"压缩包文件:"+i(t.outputFilename),1)):v("",!0),t.rowCount!==void 0?(a(),n("div",As,"压缩包共包含 "+i(t.rowCount)+" 条数据",1)):v("",!0),t.entryCount&&t.entryCount>0?(a(),n("div",Ks,"压缩包内共 "+i(t.entryCount)+" 个拆分文件",1)):v("",!0),t.entries&&t.entries.length?(a(),n("div",zs," 压缩包内容:"+i(K(t.entries)),1)):v("",!0),t.error?(a(),n("div",qs,"错误信息:"+i(t.error),1)):v("",!0)]),e("div",Gs,[e("span",{class:x(["status",t.success?"success":"failed"])},i(t.success?"已完成":"失败"),3),t.success&&t.downloadUrl?(a(),n("button",{key:0,type:"button",class:"download",onClick:o=>z(t)}," 下载压缩包 ",8,Js)):v("",!0),t.resultId?(a(),n("button",{key:1,type:"button",class:"btn-delete",onClick:o=>A(t.resultId)}," 删除 ",8,Ls)):v("",!0)])]))),128))]))])])])])]))}}),Qs=es(Os,[["__scopeId","data-v-4df71c3f"]]);ts(Qs).use(ls).mount("#app"); diff --git a/app/main.py b/app/main.py index 6dbdfa9..1c561fb 100644 --- a/app/main.py +++ b/app/main.py @@ -154,17 +154,36 @@ class WindowAPI: ) return result[0] if result else '' - def save_file_from_url(self, url, default_filename='download.zip'): - """弹窗选择保存位置,从 url 下载文件并保存。用于品牌任务结果 zip 等。""" + def save_file_from_url(self, url, default_filename='download.bin'): + """弹窗选择保存位置,从 url 下载文件并保存。根据文件后缀动态设置保存类型。""" if not url or not url.strip(): return {'success': False, 'error': '下载地址为空'} + + filename = str(default_filename or 'download.bin').strip() or 'download.bin' + ext = os.path.splitext(filename)[1].lower() + + # 根据默认文件名后缀动态设置文件类型,避免固定为 zip 造成误导 + if ext == '.zip': + file_types = ('ZIP 压缩包 (*.zip)', '所有文件 (*.*)') + elif ext in ('.xlsx', '.xls'): + file_types = ('Excel 文件 (*.xlsx;*.xls)', '所有文件 (*.*)') + elif ext == '.csv': + file_types = ('CSV 文件 (*.csv)', '所有文件 (*.*)') + elif ext == '.txt': + file_types = ('文本文件 (*.txt)', '所有文件 (*.*)') + elif ext == '.json': + file_types = ('JSON 文件 (*.json)', '所有文件 (*.*)') + else: + file_types = ('所有文件 (*.*)',) + result = self._window.create_file_dialog( webview.SAVE_DIALOG, - save_filename=default_filename, - file_types=('ZIP 压缩包 (*.zip)', '所有文件 (*.*)') + save_filename=filename, + file_types=file_types ) if not result: return {'success': False, 'error': '用户取消'} + path = result[0] if isinstance(result, (list, tuple)) else result try: import requests diff --git a/app/new_web_source/convert.html b/app/new_web_source/convert.html index 469cb72..cbb529e 100644 --- a/app/new_web_source/convert.html +++ b/app/new_web_source/convert.html @@ -5,8 +5,8 @@ 格式转换 - 数富AI - - + + diff --git a/app/new_web_source/dedupe.html b/app/new_web_source/dedupe.html index 5f20d01..ffe9b93 100644 --- a/app/new_web_source/dedupe.html +++ b/app/new_web_source/dedupe.html @@ -5,8 +5,8 @@ 数据去重 - 数富AI - - + + diff --git a/app/new_web_source/delete-brand.html b/app/new_web_source/delete-brand.html index 0607e8e..b3e2adf 100644 --- a/app/new_web_source/delete-brand.html +++ b/app/new_web_source/delete-brand.html @@ -5,8 +5,8 @@ 删除品牌 - 数富AI - - + + diff --git a/app/new_web_source/split.html b/app/new_web_source/split.html index fc2834d..f774bb5 100644 --- a/app/new_web_source/split.html +++ b/app/new_web_source/split.html @@ -5,8 +5,8 @@ 数据拆分 - 数富AI - - + + diff --git a/frontend-vue/src/pages/brand/components/BrandProductRiskTab.vue b/frontend-vue/src/pages/brand/components/BrandProductRiskTab.vue index 6e41ad4..2fca269 100644 --- a/frontend-vue/src/pages/brand/components/BrandProductRiskTab.vue +++ b/frontend-vue/src/pages/brand/components/BrandProductRiskTab.vue @@ -75,6 +75,24 @@
保存中…
+
商品列表筛选
+

与「推送到 Python 队列」一并下发,供 Python 区分处理场景。

+
+ + + +
+