jgy-public-component 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,3 @@
1
- (function(f,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus"),require("@element-plus/icons-vue"),require("vuedraggable"),require("@iconify/vue"),require("xlsx"),require("nprogress")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus","@element-plus/icons-vue","vuedraggable","@iconify/vue","xlsx","nprogress"],e):(f=typeof globalThis<"u"?globalThis:f||self,e(f.JgyPublicComponent={},f.Vue,f.ElementPlus,f.ElementPlusIconsVue,f.vuedraggable,f.IconifyVue,f.XLSX,f.NProgress))})(this,function(f,e,l,b,oe,le,ie,J){"use strict";function re(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(i,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return i.default=t,Object.freeze(i)}const D=re(ie),se=["disabled"],ce={key:0,class:"j-button__loading-icon"},de={key:1,class:"j-button__text"},me=e.defineComponent({__name:"JButton",props:{type:{default:"default"},size:{default:"medium"},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:i}){const a=t,n=i;function o(r){!a.disabled&&!a.loading&&n("click",r)}return(r,c)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["j-button",[`j-button--${t.type}`,`j-button--${t.size}`,{"j-button--plain":t.plain,"j-button--round":t.round,"j-button--disabled":t.disabled,"j-button--loading":t.loading}]]),disabled:t.disabled||t.loading,onClick:o},[t.loading?(e.openBlock(),e.createElementBlock("span",ce)):e.createCommentVNode("",!0),r.$slots.default?(e.openBlock(),e.createElementBlock("span",de,[e.renderSlot(r.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)],10,se))}}),M=(t,i)=>{const a=t.__vccOpts||t;for(const[n,o]of i)a[n]=o;return a},q=M(me,[["__scopeId","data-v-22864824"]]),fe={class:"j-upload-img-container"},pe={key:0,class:"images-wrapper"},ue={class:"image-item"},he=["onClick"],ge={key:0,class:"image-item single-image-item"},ke={class:"image-actions"},ye={key:2,class:"upload-tip"},Ce={key:0},W=M(e.defineComponent({name:"JUploadImg",__name:"JUploadImg",props:{modelValue:{default:""},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},limit:{default:9},maxSize:{default:2},accept:{default:"image/jpeg,image/png,image/jpg,image/gif"},tip:{default:"只能上传jpg/png/gif格式的图片,且不超过2MB"},showTip:{type:Boolean,default:!0},uploadFn:{type:Function,default:void 0}},emits:["update:modelValue","success","error"],setup(t,{emit:i}){const a=t,n=i,o=e.ref(""),r=e.ref(!1),c=a.showTip,m=()=>{r.value=!0},d=()=>{o.value="",n("update:modelValue",""),l.ElMessage.success("删除成功")},h=e.ref([]),p=e.ref(!1),$=E=>{h.value=E.map((u,s)=>({uid:Date.now()+s,url:u}))};e.watch(()=>a.modelValue,E=>{a.multiple?Array.isArray(E)&&E.length>0?$(E):h.value=[]:typeof E=="string"?o.value=E:o.value=""},{immediate:!0});const N=()=>{V()},C=E=>{h.value.splice(E,1),V(),l.ElMessage.success("删除成功")},k=async E=>{const u=E.raw;if(!u){l.ElMessage.error("文件不存在,请重试");return}if(u.size>a.maxSize*1024*1024){l.ElMessage.error(`图片大小不能超过 ${a.maxSize}MB`);return}if(!a.uploadFn){l.ElMessage.error("未配置上传函数 (uploadFn)");return}try{p.value=!0;const s=await a.uploadFn(u);a.multiple?(h.value.push({uid:Date.now(),url:s}),V()):(o.value=s,n("update:modelValue",s)),n("success",s),l.ElMessage.success("上传成功")}catch(s){console.error("上传出错:",s),l.ElMessage.error("上传失败,请重试"),n("error",s)}finally{p.value=!1}},V=()=>{const E=h.value.map(u=>u.url);n("update:modelValue",E)};return(E,u)=>(e.openBlock(),e.createElementBlock("div",fe,[t.multiple?(e.openBlock(),e.createElementBlock("div",pe,[e.createVNode(e.unref(oe),{modelValue:h.value,"onUpdate:modelValue":u[0]||(u[0]=s=>h.value=s),class:"images-list","item-key":"uid",animation:200,disabled:t.disabled,onEnd:N},{item:e.withCtx(({element:s,index:y})=>[e.createElementVNode("div",ue,[e.createVNode(e.unref(l.ElImage),{src:s.url,"preview-src-list":h.value.map(B=>B.url),"initial-index":y,fit:"cover",class:"image-preview","preview-teleported":!0,"hide-on-click-modal":!0},null,8,["src","preview-src-list","initial-index"]),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"delete-btn",onClick:e.withModifiers(B=>C(y),["stop"])},[e.createVNode(e.unref(l.ElIcon),{class:"icon-delete"},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Delete))]),_:1})],8,he))])]),_:1},8,["modelValue","disabled"]),!t.disabled&&(!t.limit||h.value.length<t.limit)?(e.openBlock(),e.createBlock(e.unref(l.ElUpload),{key:0,class:"image-uploader","auto-upload":!1,"show-file-list":!1,"on-change":k,disabled:p.value,"list-type":"picture-card",accept:t.accept},{default:e.withCtx(()=>[p.value?(e.openBlock(),e.createBlock(e.unref(l.ElIcon),{key:1,class:"uploader-icon is-loading"},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Loading))]),_:1})):(e.openBlock(),e.createBlock(e.unref(l.ElIcon),{key:0,class:"uploader-icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Plus))]),_:1}))]),_:1},8,["disabled","accept"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[o.value?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(e.unref(l.ElImage),{src:o.value,fit:"cover",class:"image-preview"},null,8,["src"]),e.createElementVNode("div",ke,[e.createVNode(e.unref(l.ElIcon),{class:"action-icon",onClick:e.withModifiers(m,["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(b.ZoomIn))]),_:1}),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(l.ElIcon),{key:0,class:"action-icon",onClick:e.withModifiers(d,["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Delete))]),_:1}))])])):(e.openBlock(),e.createBlock(e.unref(l.ElUpload),{key:1,class:"image-uploader","auto-upload":!1,"show-file-list":!1,"on-change":k,disabled:t.disabled||p.value,accept:t.accept,"list-type":"picture-card"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ElIcon),{class:"uploader-icon"},{default:e.withCtx(()=>[p.value?(e.openBlock(),e.createBlock(e.unref(b.Loading),{key:1,class:"is-loading"})):(e.openBlock(),e.createBlock(e.unref(b.Plus),{key:0}))]),_:1})]),_:1},8,["disabled","accept"])),r.value?(e.openBlock(),e.createBlock(e.unref(l.ElImageViewer),{key:2,"url-list":[o.value],teleported:!0,onClose:u[1]||(u[1]=s=>r.value=!1)},null,8,["url-list"])):e.createCommentVNode("",!0)],64)),e.unref(c)?(e.openBlock(),e.createElementBlock("div",ye,[e.createElementVNode("span",null,e.toDisplayString(t.tip),1),t.multiple&&t.limit?(e.openBlock(),e.createElementBlock("span",Ce," (最多 "+e.toDisplayString(t.limit)+" 张)",1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-7dc4f798"]]),_=e.defineComponent({name:"JIconRender",__name:"JIconRender",props:{icon:{},size:{default:24}},setup(t){return(i,a)=>t.icon?(e.openBlock(),e.createBlock(e.unref(le.Icon),e.mergeProps({key:0,icon:t.icon,width:t.size,height:t.size},i.$attrs),null,16,["icon","width","height"])):e.createCommentVNode("",!0)}}),we={class:"action-left"},X=M(e.defineComponent({name:"JSearchHeader",__name:"JSearchHeader",props:{selectedCount:{default:0},addText:{default:"新增"},defaultVisible:{default:5},showAdd:{type:Boolean,default:!0},showBatchDelete:{type:Boolean,default:!0},showSearch:{type:Boolean,default:!0},showReset:{type:Boolean,default:!0}},emits:["search","reset","add","batchDelete"],setup(t,{emit:i}){const a=t,n=i,o=e.ref(),r=e.ref(!1),c=e.ref(!1),m=e.ref(0),d=e.ref(0),h=e.computed(()=>m.value>a.defaultVisible),p=()=>{if(!o.value)return;const C=Array.from(o.value.children);m.value=C.length;const k=C[a.defaultVisible-1];if(k&&o.value){const V=o.value.getBoundingClientRect(),E=k.getBoundingClientRect();d.value=E.bottom-V.top}},$=()=>{const C=o.value;if(C)if(r.value)p(),r.value=!1,C.style.maxHeight=C.scrollHeight+"px",C.offsetHeight,C.style.maxHeight=d.value+"px";else{r.value=!0,C.style.maxHeight=C.scrollHeight+"px";const k=()=>{C.style.maxHeight="none",C.removeEventListener("transitionend",k)};C.addEventListener("transitionend",k)}};let N=null;return e.onMounted(()=>{p(),h.value&&o.value&&(o.value.style.maxHeight=d.value+"px"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.value=!0})}),o.value&&(N=new MutationObserver(()=>{p(),h.value&&!r.value&&o.value&&(o.value.style.maxHeight=d.value+"px")}),N.observe(o.value,{childList:!0}))}),e.onBeforeUnmount(()=>{N==null||N.disconnect()}),(C,k)=>(e.openBlock(),e.createBlock(e.unref(l.ElCard),{shadow:"never",class:"j-search-header-card"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ElForm),{inline:"",class:"search-form"},{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"formItemsRef",ref:o,class:e.normalizeClass(["form-items-wrapper",{"is-animated":c.value}])},[e.renderSlot(C.$slots,"default",{},void 0,!0)],2)]),_:3}),e.createElementVNode("div",{class:"action-bar",style:e.normalizeStyle({marginTop:r.value?"0px":"10px"})},[e.createElementVNode("div",we,[t.showAdd?(e.openBlock(),e.createBlock(e.unref(l.ElButton),{key:0,type:"primary",icon:e.unref(b.Plus),onClick:k[0]||(k[0]=V=>n("add"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.addText),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),t.showBatchDelete?(e.openBlock(),e.createBlock(e.unref(l.ElButton),{key:1,type:"danger",icon:e.unref(b.Delete),disabled:t.selectedCount===0,onClick:k[1]||(k[1]=V=>n("batchDelete"))},{default:e.withCtx(()=>[e.createTextVNode(" 批量删除"+e.toDisplayString(t.selectedCount?`(${t.selectedCount})`:""),1)]),_:1},8,["icon","disabled"])):e.createCommentVNode("",!0),t.showSearch?(e.openBlock(),e.createBlock(e.unref(l.ElButton),{key:2,type:"primary",icon:e.unref(b.Search),onClick:k[2]||(k[2]=V=>n("search"))},{default:e.withCtx(()=>[...k[4]||(k[4]=[e.createTextVNode("搜索",-1)])]),_:1},8,["icon"])):e.createCommentVNode("",!0),t.showReset?(e.openBlock(),e.createBlock(e.unref(l.ElButton),{key:3,icon:e.unref(b.Refresh),onClick:k[3]||(k[3]=V=>n("reset"))},{default:e.withCtx(()=>[...k[5]||(k[5]=[e.createTextVNode("重置",-1)])]),_:1},8,["icon"])):e.createCommentVNode("",!0),e.renderSlot(C.$slots,"actions",{},void 0,!0)]),h.value?(e.openBlock(),e.createBlock(e.unref(l.ElButton),{key:0,link:"",type:"primary",onClick:$},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value?"收起":"展开")+" ",1),e.createVNode(e.unref(l.ElIcon),{class:e.normalizeClass(["toggle-icon",{"is-expanded":r.value}])},{default:e.withCtx(()=>[e.createVNode(e.unref(b.ArrowDown))]),_:1},8,["class"])]),_:1})):e.createCommentVNode("",!0)],4)]),_:3}))}}),[["__scopeId","data-v-c1f4bf4c"]]),Ee={class:"j-import-upload-row"},Be={class:"j-import-stat-num"},be={class:"j-import-stat-num"},Ve={class:"j-import-stat-num"},Ne={key:0,class:"j-import-status-fail"},xe={key:1},K=M(e.defineComponent({name:"JImportExcel",__name:"JImportExcel",props:e.mergeModels({getFieldListApi:{},importApi:{},excludeFields:{default:()=>["id","ctime","mtime"]},title:{default:"Excel 批量导入"}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:e.mergeModels(["success"],["update:modelValue"]),setup(t,{emit:i}){const a=t,n=i,o=e.useModel(t,"modelValue"),r=e.ref(!1),c=e.ref({}),m=e.ref([]),d=e.ref({total:0,success:0,fail:0}),h={0:"待创建",1:"创建成功",2:"创建中",[-1]:"创建失败"},p=e.computed(()=>Object.entries(c.value).filter(([u])=>!a.excludeFields.includes(u)).map(([u,s])=>({id:u,label:s,prop:u}))),$=async()=>{try{const u=await a.getFieldListApi();c.value=u.data.tableFieldsInfo??{}}catch{l.ElMessage.error("获取字段列表失败")}},N=u=>{const s=u.raw;if(!s)return;if(!["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"].includes(s.type)&&!s.name.match(/\.xlsx?$/i)){l.ElMessage.warning("请上传 .xlsx 或 .xls 格式文件");return}const B=new FileReader;B.onload=g=>{try{const j=D.read(g.target.result,{type:"binary"}),w=j.SheetNames[0],I=j.Sheets[w],A=D.utils.sheet_to_json(I,{header:1,defval:""}).slice(1).filter(R=>R.some(T=>T!==""));if(!A.length){l.ElMessage.warning("文件内容为空");return}const S=A.map(R=>{const T={_status:0,_error:""};return p.value.forEach((U,ne)=>{T[U.prop]=R[ne]!==void 0?R[ne]:""}),T});m.value=S,d.value={total:S.length,success:0,fail:0}}catch{l.ElMessage.error("解析文件失败,请检查文件格式")}},B.readAsBinaryString(s)},C=u=>{m.value.splice(u,1),d.value.total=m.value.length},k=async()=>{const u=m.value.filter(s=>s._status===0).map(({_status:s,_error:y,...B})=>B);if(!u.length){l.ElMessage.warning("没有可导入的数据");return}r.value=!0;try{const s=await a.importApi(u);s.code===1?(m.value.forEach(y=>{y._status===0&&(y._status=1)}),d.value.success=m.value.filter(y=>y._status===1).length,l.ElMessage.success("导入成功"),n("success")):l.ElMessage.error(s.msg||"导入失败")}catch{l.ElMessage.error("导入失败,请重试")}finally{r.value=!1}},V=()=>{try{const u=D.utils.book_new(),s=p.value.map(g=>g.label),y={};s.forEach(g=>y[g]="");const B=D.utils.json_to_sheet([y]);D.utils.book_append_sheet(u,B,"模板"),D.writeFile(u,"导入模板.xlsx")}catch{l.ElMessage.error("模板下载失败")}},E=()=>{r.value||(o.value=!1,m.value=[],d.value={total:0,success:0,fail:0})};return(u,s)=>(e.openBlock(),e.createBlock(e.unref(l.ElDialog),{modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=y=>o.value=y),title:a.title,width:"900px","close-on-click-modal":!1,onOpen:$,onClose:E},{footer:e.withCtx(()=>[e.createVNode(e.unref(l.ElButton),{onClick:E},{default:e.withCtx(()=>[...s[9]||(s[9]=[e.createTextVNode("关闭",-1)])]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(l.ElCard),{shadow:"never",class:"j-import-upload-card"},{default:e.withCtx(()=>[s[3]||(s[3]=e.createElementVNode("div",{class:"j-import-upload-card-title"},"导入 EXCEL",-1)),e.createVNode(e.unref(l.ElDivider),{style:{margin:"10px 0"}}),e.createElementVNode("div",Ee,[e.createVNode(e.unref(l.ElUpload),{accept:".xlsx,.xls","auto-upload":!1,"show-file-list":!1,"on-change":N},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ElButton),{size:"small"},{default:e.withCtx(()=>[...s[1]||(s[1]=[e.createTextVNode("点击上传",-1)])]),_:1})]),_:1}),p.value.length?(e.openBlock(),e.createBlock(e.unref(l.ElLink),{key:0,type:"primary",class:"j-import-no-wrap",onClick:V},{default:e.withCtx(()=>[...s[2]||(s[2]=[e.createTextVNode(" 下载导入模板.xlsx ",-1)])]),_:1})):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(e.unref(l.ElRow),{class:"j-import-stats-row",gutter:20,align:"middle"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ElCol),{span:18},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ElRow),{class:"j-import-stats-cols"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ElCol),{span:4,class:"j-import-stat-item"},{default:e.withCtx(()=>[e.createElementVNode("div",Be,e.toDisplayString(d.value.total),1),s[4]||(s[4]=e.createElementVNode("div",{class:"j-import-stat-label"},"导入数量",-1))]),_:1}),e.createVNode(e.unref(l.ElCol),{span:4,class:"j-import-stat-item"},{default:e.withCtx(()=>[e.createElementVNode("div",be,e.toDisplayString(d.value.fail),1),s[5]||(s[5]=e.createElementVNode("div",{class:"j-import-stat-label"},"失败数量",-1))]),_:1}),e.createVNode(e.unref(l.ElCol),{span:4,class:"j-import-stat-item"},{default:e.withCtx(()=>[e.createElementVNode("div",Ve,e.toDisplayString(d.value.success),1),s[6]||(s[6]=e.createElementVNode("div",{class:"j-import-stat-label"},"成功数量",-1))]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(l.ElCol),{span:6,class:"j-import-confirm-col"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ElButton),{type:"primary",size:"small",loading:r.value,disabled:!m.value.length,onClick:k},{default:e.withCtx(()=>[...s[7]||(s[7]=[e.createTextVNode(" 确认导入 ",-1)])]),_:1},8,["loading","disabled"])]),_:1})]),_:1}),e.createVNode(e.unref(l.ElTable),{data:m.value,border:"",size:"small","max-height":"360",class:"j-import-data-table"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,y=>(e.openBlock(),e.createBlock(e.unref(l.ElTableColumn),{key:y.prop,prop:y.prop,label:y.label,"min-width":120,"show-overflow-tooltip":""},null,8,["prop","label"]))),128)),e.createVNode(e.unref(l.ElTableColumn),{label:"状态",width:"110",align:"center",fixed:"right"},{default:e.withCtx(({row:y})=>[y._status===-1?(e.openBlock(),e.createElementBlock("span",Ne,e.toDisplayString(y._error||"创建失败"),1)):(e.openBlock(),e.createElementBlock("span",xe,e.toDisplayString(h[y._status]),1))]),_:1}),e.createVNode(e.unref(l.ElTableColumn),{label:"操作",width:"80",align:"center",fixed:"right"},{default:e.withCtx(({$index:y,row:B})=>[B._status===0?(e.openBlock(),e.createBlock(e.unref(l.ElButton),{key:0,size:"small",onClick:g=>C(y)},{default:e.withCtx(()=>[...s[8]||(s[8]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["data"])]),_:1},8,["modelValue","title"]))}}),[["__scopeId","data-v-74dcefaa"]]),Se={class:"j-sidebar__menu-item-title"},F=M(e.defineComponent({name:"JSideMenuItem",__name:"JSideMenuItem",props:{menuItem:{},isCollapse:{type:Boolean},depth:{default:0}},emits:["menu-click"],setup(t,{emit:i}){const a=t,n=i,o=()=>{n("menu-click",a.menuItem)};return(r,c)=>{const m=e.resolveComponent("JSideMenuItem",!0);return t.menuItem.children&&t.menuItem.children.length>0?(e.openBlock(),e.createBlock(e.unref(l.ElSubMenu),{key:0,index:t.menuItem.path,class:e.normalizeClass([`j-sidebar__depth-${t.depth}`])},{title:e.withCtx(()=>[t.menuItem.icon&&t.depth===0?(e.openBlock(),e.createBlock(e.unref(_),{key:0,icon:t.menuItem.icon},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",Se,e.toDisplayString(t.menuItem.title||t.menuItem.name),1)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.menuItem.children,d=>(e.openBlock(),e.createBlock(m,{key:d.path,"menu-item":d,"is-collapse":t.isCollapse,depth:t.depth+1,onMenuClick:c[0]||(c[0]=h=>n("menu-click",h))},null,8,["menu-item","is-collapse","depth"]))),128))]),_:1},8,["index","class"])):(e.openBlock(),e.createBlock(e.unref(l.ElMenuItem),{key:1,index:t.menuItem.path,class:e.normalizeClass([`j-sidebar__depth-${t.depth}`]),onClick:o},{title:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(t.menuItem.title||t.menuItem.name),1)]),default:e.withCtx(()=>[t.menuItem.icon&&t.depth===0?(e.openBlock(),e.createBlock(e.unref(_),{key:0,icon:t.menuItem.icon},null,8,["icon"])):e.createCommentVNode("",!0)]),_:1},8,["index","class"]))}}}),[["__scopeId","data-v-3a990426"]]),$e={class:"j-sidebar__logo"},je={class:"j-sidebar__title"},Me={class:"j-sidebar__menu-wrapper"},Ie={class:"j-sidebar__footer"},z=M(e.defineComponent({name:"JSidebar",__name:"JSidebar",props:{menus:{},activeMenu:{default:""},title:{default:""},collapsedTitle:{default:""},collapsed:{type:Boolean,default:!1},collapsedWidth:{default:80},expandedWidth:{default:200},router:{type:Boolean,default:!0}},emits:["update:collapsed","menu-click"],setup(t,{emit:i}){const a=t,n=i,o=e.ref(a.collapsed);e.watch(()=>a.collapsed,c=>{o.value=c});const r=()=>{o.value=!o.value,n("update:collapsed",o.value)};return(c,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["j-sidebar",o.value?"j-sidebar--collapsed":"j-sidebar--expanded"]),style:e.normalizeStyle({width:o.value?`${t.collapsedWidth}px`:`${t.expandedWidth}px`})},[e.createElementVNode("div",$e,[e.renderSlot(c.$slots,"logo",{collapsed:o.value},()=>{var d;return[e.createElementVNode("h2",je,e.toDisplayString(o.value?t.collapsedTitle||((d=t.title)==null?void 0:d.charAt(0))||"":t.title),1)]},!0)]),e.createElementVNode("div",Me,[e.createVNode(e.unref(l.ElMenu),{"default-active":t.activeMenu,class:"j-sidebar__menu",router:t.router,collapse:o.value,"collapse-transition":!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.menus,d=>(e.openBlock(),e.createBlock(F,{key:d.path,"menu-item":d,"is-collapse":o.value,onMenuClick:m[0]||(m[0]=h=>n("menu-click",h))},null,8,["menu-item","is-collapse"]))),128))]),_:1},8,["default-active","router","collapse"])]),e.createElementVNode("div",Ie,[e.renderSlot(c.$slots,"footer",{collapsed:o.value,toggle:r},()=>[e.createElementVNode("button",{class:"j-sidebar__collapse-btn",onClick:r},[e.createVNode(e.unref(_),{icon:o.value?"mdi:chevron-right":"mdi:chevron-left"},null,8,["icon"])])],!0)])],6))}}),[["__scopeId","data-v-a3fac9de"]]),Re={class:"j-admin-layout__right-panel"},Te={class:"j-admin-layout__header"},De={class:"j-admin-layout__header-left"},_e={key:0,class:"j-admin-layout__logo"},Ae={class:"j-admin-layout__header-right"},Je={class:"j-admin-layout__user"},Fe={class:"j-admin-layout__content-container"},G=M(e.defineComponent({name:"JAdminLayout",__name:"JAdminLayout",props:{topMenus:{},sideMenus:{},activeTopMenu:{default:""},activeMenu:{default:""},title:{default:""},logoTitle:{default:""},collapsedTitle:{default:""},collapsed:{type:Boolean,default:!1},username:{default:""},profileText:{default:"个人资料"},logoutText:{default:"退出登录"},sidebarCollapsedWidth:{default:80},sidebarExpandedWidth:{default:200},headerHeight:{default:"50px"},contentPadding:{default:"10px"},contentBackground:{default:"#f0f2f5"},headerBackground:{default:"#ffffff"},showProfile:{type:Boolean,default:!0},showLogout:{type:Boolean,default:!0},hideContentScrollbar:{type:Boolean,default:!1}},emits:["update:collapsed","top-menu-select","side-menu-click","profile","logout"],setup(t,{emit:i}){const a=t,n=i,o=e.computed({get:()=>a.collapsed,set:d=>n("update:collapsed",d)}),r=e.computed(()=>({"--j-admin-layout-header-height":a.headerHeight,"--j-admin-layout-content-padding":a.contentPadding,"--j-admin-layout-content-bg":a.contentBackground,"--j-admin-layout-header-bg":a.headerBackground})),c=d=>{n("top-menu-select",d)},m=d=>{n("side-menu-click",d)};return(d,h)=>(e.openBlock(),e.createElementBlock("div",{class:"j-admin-layout",style:e.normalizeStyle(r.value)},[t.sideMenus.length>0?(e.openBlock(),e.createBlock(e.unref(z),{key:0,collapsed:o.value,"onUpdate:collapsed":h[0]||(h[0]=p=>o.value=p),menus:t.sideMenus,"active-menu":t.activeMenu,title:t.title,"collapsed-title":t.collapsedTitle,"collapsed-width":t.sidebarCollapsedWidth,"expanded-width":t.sidebarExpandedWidth,onMenuClick:m},e.createSlots({_:2},[d.$slots.sidebarFooter?{name:"footer",fn:e.withCtx(({collapsed:p,toggle:$})=>[e.renderSlot(d.$slots,"sidebarFooter",{collapsed:p,toggle:$},void 0,!0)]),key:"0"}:void 0]),1032,["collapsed","menus","active-menu","title","collapsed-title","collapsed-width","expanded-width"])):e.createCommentVNode("",!0),e.createElementVNode("div",Re,[e.createElementVNode("div",Te,[e.createElementVNode("div",De,[t.sideMenus.length===0?(e.openBlock(),e.createElementBlock("div",_e,[e.renderSlot(d.$slots,"logo",{},()=>[e.createElementVNode("h2",null,e.toDisplayString(t.logoTitle||t.title),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(e.unref(l.ElMenu),{mode:"horizontal","default-active":t.activeTopMenu,class:"j-admin-layout__top-menu",onSelect:c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.topMenus,p=>(e.openBlock(),e.createBlock(e.unref(l.ElMenuItem),{key:p.path,index:p.path},{default:e.withCtx(()=>[p.icon?(e.openBlock(),e.createBlock(e.unref(_),{key:0,icon:p.icon,class:"j-admin-layout__top-menu-icon"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(p.title||p.name),1)]),_:2},1032,["index"]))),128))]),_:1},8,["default-active"])]),e.createElementVNode("div",Ae,[e.renderSlot(d.$slots,"headerRight",{username:t.username},()=>[t.showProfile||t.showLogout?(e.openBlock(),e.createBlock(e.unref(l.ElDropdown),{key:0},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(l.ElDropdownMenu),null,{default:e.withCtx(()=>[t.showProfile?(e.openBlock(),e.createBlock(e.unref(l.ElDropdownItem),{key:0,onClick:h[1]||(h[1]=p=>n("profile"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.profileText),1)]),_:1})):e.createCommentVNode("",!0),t.showLogout?(e.openBlock(),e.createBlock(e.unref(l.ElDropdownItem),{key:1,onClick:h[2]||(h[2]=p=>n("logout"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.logoutText),1)]),_:1})):e.createCommentVNode("",!0)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("span",Je,[e.createTextVNode(e.toDisplayString(t.username)+" ",1),e.createVNode(e.unref(l.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(b.ArrowDown))]),_:1})])]),_:1})):e.createCommentVNode("",!0)],!0)])]),e.createElementVNode("div",Fe,[e.renderSlot(d.$slots,"tabs",{},void 0,!0),e.createElementVNode("div",{class:e.normalizeClass(["j-admin-layout__content",{"j-admin-layout__content--scrollbar-hidden":t.hideContentScrollbar}])},[e.renderSlot(d.$slots,"default",{},void 0,!0)],2)])])],4))}}),[["__scopeId","data-v-51b44ebf"]]);function L(t,i){return Array.isArray(t)?t.map(a=>L(a,i)):t!==null&&typeof t=="object"&&!(t instanceof Date)?i(t):t}function Z(t,i=[]){return Object.fromEntries(Object.entries(t).map(([a,n])=>{const o=L(n,c=>Z(c,i));return i.includes(a)?[a,o]:[a.replace(/([A-Z])/g,"_$1").toLowerCase(),o]}))}function Q(t,i=[]){return Object.fromEntries(Object.entries(t).map(([a,n])=>{const o=L(n,c=>Q(c,i));return i.includes(a)?[a,o]:[a.replace(/_([a-z])/g,(c,m)=>m.toUpperCase()),o]}))}function ze(t,i){const a={};for(const n of i)n in t&&(a[n]=t[n]);return a}function Le(t,i){const a={...t};for(const n of i)delete a[n];return a}function O(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(a=>O(a));const i={};for(const a of Object.keys(t))i[a]=O(t[a]);return i}function Y(t,i=!1){const a={};for(const[n,o]of Object.entries(t))if(!(o==null||o===""))if(i&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)){const r=Y(o,!0);Object.keys(r).length>0&&(a[n]=r)}else a[n]=o;return a}function P(t,i="",a="."){const n={};for(const[o,r]of Object.entries(t)){const c=i?`${i}${a}${o}`:o;r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)?Object.assign(n,P(r,c,a)):n[c]=r}return n}function Oe(t,i="."){const a={};for(const[n,o]of Object.entries(t)){const r=n.split(i);let c=a;for(let m=0;m<r.length-1;m++){const d=r[m];d in c||(c[d]={}),c=c[d]}c[r[r.length-1]]=o}return a}function He(t){return Object.entries(t).map(([i,a])=>({id:i,label:a,prop:i}))}function v(t,i){if(!t)return null;let a=t.replace(/^@\//,"");a.startsWith("views/")||(a=`views/${a}`),a.endsWith(".vue")||(a=`${a}.vue`);const n=`/src/${a}`;return i[n]??i["/src/views/common/NotFound.vue"]??null}function ee(t){const i=new Map,a=[];return t.forEach(n=>i.set(n.name,{...n,children:[]})),t.forEach(n=>{const o=i.get(n.name);if(!n.parent_name)a.push(o);else{const r=i.get(n.parent_name);r?(r.children??(r.children=[]),r.children.push(o)):a.push(o)}}),a}function H(t,i,a){return t.filter(n=>!a||!n.project||n.project===a).map(n=>{var c;const o={path:n.path,name:n.name,meta:{requiresAuth:n.requiresAuth===1,title:n.title,permissions:n.permissions?n.permissions.split(",").map(m=>m.trim()).filter(Boolean):[],params:n.params?n.params.split("&").map(m=>m.trim()).filter(Boolean):[]}},r=v(n.component,i);return r&&(o.component=r),n.redirect&&(o.redirect=n.redirect),(c=n.children)!=null&&c.length&&(o.children=H(n.children,i,a)),o})}function Ue(t,i,a,n){const o=new Map;t.forEach(c=>o.set(c.name,c));const r=c=>{let m=c.parent_name;const d=new Set;for(;m;){if(m===a)return!0;if(d.has(m))return!1;d.add(m);const h=o.get(m);if(!h)return!1;m=h.parent_name}return!1};return t.filter(c=>c.name!==a&&c.is_show===1&&c.component&&i.includes(c.code)&&r(c)&&(!n||!c.project||c.project===n)).sort((c,m)=>c.sorts-m.sorts)[0]}J.configure({showSpinner:!1});const te=(...t)=>{},ae=(...t)=>{},qe=(...t)=>{console.error("[Router]",...t)};function We(t,i){const{getRouteStore:a,getPermissionStore:n,getUserStore:o,isAuthenticated:r,viewModules:c,homeComponent:m,notFoundComponent:d,projectName:h,layoutRouteName:p="Layout",publicPaths:$=["/login","/register"],loginRouteName:N="login",forbiddenRouteName:C="Forbidden",homeRouteName:k="Home",homeRoutePath:V="home",homeTitle:E="首页",noPermissionMessage:u="暂无权限"}=i;let s=!1;function y(g){const w=ee(g).find(x=>x.name===p),I=w!=null&&w.children?H(w.children,c,h):[];I.forEach(x=>{x.name&&t.hasRoute(x.name)||(t.addRoute(p,x),te(`Add route: ${String(x.name)} -> ${x.path}`))}),t.hasRoute(k)||t.addRoute(p,{path:V,name:k,component:m,meta:{title:E}}),t.hasRoute("NotFound")||t.addRoute({path:"/:pathMatch(.*)*",name:"NotFound",component:d}),te(`Dynamic routes added: ${I.length}`)}function B(g,j){if(g===k){j();return}t.hasRoute(k)?j({name:k,replace:!0}):j()}return t.beforeEach(async(g,j,w)=>{if(J.start(),r()&&!s)try{const S=a(),R=n();if(await S.initRoutes(),await R.loadUserPermissions(),y(S.backendRoutes),s=!0,g.path==="/"||g.path===""){B(g.name,w);return}if(g.name===p){B(g.name,w);return}const T=S.backendRoutes.find(U=>U.name===g.name);if(T&&!R.routePermissions.includes(T.code)){ae("No route permission:",g.path),w({name:C,replace:!0});return}w({path:g.path,query:g.query,hash:g.hash,replace:!0});return}catch(S){qe("Failed to load route permissions:",S),s=!1,await o().logout(),w({name:N,replace:!0});return}if($.includes(g.path)){r()?w({path:"/",replace:!0}):w();return}if(!r()){w({name:N,replace:!0});return}const I=n(),x=a();if(g.name===k){w();return}if(I.routePermissions.length===0){g.path!=="/"?(l.ElMessage.warning(u),w({path:"/",replace:!0})):B(g.name,w);return}if(g.path==="/"){B(g.name,w);return}if(g.name===p){B(g.name,w);return}const A=x.backendRoutes.find(S=>S.name===g.name);if(A&&!I.routePermissions.includes(A.code)){ae("No route permission:",g.path),w({name:C,replace:!0});return}w()}),t.afterEach(()=>J.done()),{resetRouterState:()=>{s=!1}}}const Xe=[q,W,_,X,K,z,F,G],Ke={install:t=>{Xe.forEach(i=>{t.component(i.name??i.__name??"",i)})}};f.JAdminLayout=G,f.JButton=q,f.JIconRender=_,f.JImportExcel=K,f.JSearchHeader=X,f.JSideMenuItem=F,f.JSidebar=z,f.JUploadImg=W,f.buildRouteTree=ee,f.createRouterGuard=We,f.deepClone=O,f.default=Ke,f.filterEmpty=Y,f.findFirstAllowedRoute=Ue,f.flatten=P,f.getComponentImport=v,f.omit=Le,f.pick=ze,f.toCamelCase=Q,f.toSnakeCase=Z,f.toTableColumns=He,f.transformBackendRoutes=H,f.unflatten=Oe,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus"),require("@element-plus/icons-vue"),require("vuedraggable"),require("@iconify/vue"),require("xlsx"),require("nprogress")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus","@element-plus/icons-vue","vuedraggable","@iconify/vue","xlsx","nprogress"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.JgyPublicComponent={},w.Vue,w.ElementPlus,w.ElementPlusIconsVue,w.vuedraggable,w.IconifyVue,w.XLSX,w.NProgress))})(this,function(w,e,a,R,je,Me,Ae,X){"use strict";function ze(t){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(p,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return p.default=t,Object.freeze(p)}const O=ze(Ae),Re=["disabled"],Fe={key:0,class:"j-button__loading-icon"},Le={key:1,class:"j-button__text"},Je=e.defineComponent({__name:"JButton",props:{type:{default:"default"},size:{default:"medium"},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:p}){const o=t,r=p;function i(d){!o.disabled&&!o.loading&&r("click",d)}return(d,m)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["j-button",[`j-button--${t.type}`,`j-button--${t.size}`,{"j-button--plain":t.plain,"j-button--round":t.round,"j-button--disabled":t.disabled,"j-button--loading":t.loading}]]),disabled:t.disabled||t.loading,onClick:i},[t.loading?(e.openBlock(),e.createElementBlock("span",Fe)):e.createCommentVNode("",!0),d.$slots.default?(e.openBlock(),e.createElementBlock("span",Le,[e.renderSlot(d.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)],10,Re))}}),q=(t,p)=>{const o=t.__vccOpts||t;for(const[r,i]of p)o[r]=i;return o},oe=q(Je,[["__scopeId","data-v-22864824"]]),qe={class:"j-upload-img-container"},Oe={key:0,class:"images-wrapper"},Ue={class:"image-item"},He=["onClick"],We={key:0,class:"image-item single-image-item"},Ke={class:"image-actions"},Xe={key:2,class:"upload-tip"},Ge={key:0},ne=q(e.defineComponent({name:"JUploadImg",__name:"JUploadImg",props:{modelValue:{default:""},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},limit:{default:9},maxSize:{default:2},accept:{default:"image/jpeg,image/png,image/jpg,image/gif"},tip:{default:"只能上传jpg/png/gif格式的图片,且不超过2MB"},showTip:{type:Boolean,default:!0},uploadFn:{type:Function,default:void 0}},emits:["update:modelValue","success","error"],setup(t,{emit:p}){const o=t,r=p,i=e.ref(""),d=e.ref(!1),m=o.showTip,u=()=>{d.value=!0},s=()=>{i.value="",r("update:modelValue",""),a.ElMessage.success("删除成功")},k=e.ref([]),b=e.ref(!1),$=T=>{k.value=T.map((E,f)=>({uid:Date.now()+f,url:E}))};e.watch(()=>o.modelValue,T=>{o.multiple?Array.isArray(T)&&T.length>0?$(T):k.value=[]:typeof T=="string"?i.value=T:i.value=""},{immediate:!0});const x=()=>{M()},N=T=>{k.value.splice(T,1),M(),a.ElMessage.success("删除成功")},V=async T=>{const E=T.raw;if(!E){a.ElMessage.error("文件不存在,请重试");return}if(E.size>o.maxSize*1024*1024){a.ElMessage.error(`图片大小不能超过 ${o.maxSize}MB`);return}if(!o.uploadFn){a.ElMessage.error("未配置上传函数 (uploadFn)");return}try{b.value=!0;const f=await o.uploadFn(E);o.multiple?(k.value.push({uid:Date.now(),url:f}),M()):(i.value=f,r("update:modelValue",f)),r("success",f),a.ElMessage.success("上传成功")}catch(f){console.error("上传出错:",f),a.ElMessage.error("上传失败,请重试"),r("error",f)}finally{b.value=!1}},M=()=>{const T=k.value.map(E=>E.url);r("update:modelValue",T)};return(T,E)=>(e.openBlock(),e.createElementBlock("div",qe,[t.multiple?(e.openBlock(),e.createElementBlock("div",Oe,[e.createVNode(e.unref(je),{modelValue:k.value,"onUpdate:modelValue":E[0]||(E[0]=f=>k.value=f),class:"images-list","item-key":"uid",animation:200,disabled:t.disabled,onEnd:x},{item:e.withCtx(({element:f,index:C})=>[e.createElementVNode("div",Ue,[e.createVNode(e.unref(a.ElImage),{src:f.url,"preview-src-list":k.value.map(B=>B.url),"initial-index":C,fit:"cover",class:"image-preview","preview-teleported":!0,"hide-on-click-modal":!0},null,8,["src","preview-src-list","initial-index"]),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"delete-btn",onClick:e.withModifiers(B=>N(C),["stop"])},[e.createVNode(e.unref(a.ElIcon),{class:"icon-delete"},{default:e.withCtx(()=>[e.createVNode(e.unref(R.Delete))]),_:1})],8,He))])]),_:1},8,["modelValue","disabled"]),!t.disabled&&(!t.limit||k.value.length<t.limit)?(e.openBlock(),e.createBlock(e.unref(a.ElUpload),{key:0,class:"image-uploader","auto-upload":!1,"show-file-list":!1,"on-change":V,disabled:b.value,"list-type":"picture-card",accept:t.accept},{default:e.withCtx(()=>[b.value?(e.openBlock(),e.createBlock(e.unref(a.ElIcon),{key:1,class:"uploader-icon is-loading"},{default:e.withCtx(()=>[e.createVNode(e.unref(R.Loading))]),_:1})):(e.openBlock(),e.createBlock(e.unref(a.ElIcon),{key:0,class:"uploader-icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(R.Plus))]),_:1}))]),_:1},8,["disabled","accept"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.value?(e.openBlock(),e.createElementBlock("div",We,[e.createVNode(e.unref(a.ElImage),{src:i.value,fit:"cover",class:"image-preview"},null,8,["src"]),e.createElementVNode("div",Ke,[e.createVNode(e.unref(a.ElIcon),{class:"action-icon",onClick:e.withModifiers(u,["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(R.ZoomIn))]),_:1}),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(a.ElIcon),{key:0,class:"action-icon",onClick:e.withModifiers(s,["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(R.Delete))]),_:1}))])])):(e.openBlock(),e.createBlock(e.unref(a.ElUpload),{key:1,class:"image-uploader","auto-upload":!1,"show-file-list":!1,"on-change":V,disabled:t.disabled||b.value,accept:t.accept,"list-type":"picture-card"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElIcon),{class:"uploader-icon"},{default:e.withCtx(()=>[b.value?(e.openBlock(),e.createBlock(e.unref(R.Loading),{key:1,class:"is-loading"})):(e.openBlock(),e.createBlock(e.unref(R.Plus),{key:0}))]),_:1})]),_:1},8,["disabled","accept"])),d.value?(e.openBlock(),e.createBlock(e.unref(a.ElImageViewer),{key:2,"url-list":[i.value],teleported:!0,onClose:E[1]||(E[1]=f=>d.value=!1)},null,8,["url-list"])):e.createCommentVNode("",!0)],64)),e.unref(m)?(e.openBlock(),e.createElementBlock("div",Xe,[e.createElementVNode("span",null,e.toDisplayString(t.tip),1),t.multiple&&t.limit?(e.openBlock(),e.createElementBlock("span",Ge," (最多 "+e.toDisplayString(t.limit)+" 张)",1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-7dc4f798"]]),U=e.defineComponent({name:"JIconRender",__name:"JIconRender",props:{icon:{},size:{default:24}},setup(t){return(p,o)=>t.icon?(e.openBlock(),e.createBlock(e.unref(Me.Icon),e.mergeProps({key:0,icon:t.icon,width:t.size,height:t.size},p.$attrs),null,16,["icon","width","height"])):e.createCommentVNode("",!0)}}),Ze={class:"action-left"},re=q(e.defineComponent({name:"JSearchHeader",__name:"JSearchHeader",props:{selectedCount:{default:0},addText:{default:"新增"},defaultVisible:{default:5},showAdd:{type:Boolean,default:!0},showBatchDelete:{type:Boolean,default:!0},showSearch:{type:Boolean,default:!0},showReset:{type:Boolean,default:!0}},emits:["search","reset","add","batchDelete"],setup(t,{emit:p}){const o=t,r=p,i=e.ref(),d=e.ref(!1),m=e.ref(!1),u=e.ref(0),s=e.ref(0),k=e.computed(()=>u.value>o.defaultVisible),b=()=>{if(!i.value)return;const N=Array.from(i.value.children);u.value=N.length;const V=N[o.defaultVisible-1];if(V&&i.value){const M=i.value.getBoundingClientRect(),T=V.getBoundingClientRect();s.value=T.bottom-M.top}},$=()=>{const N=i.value;if(N)if(d.value)b(),d.value=!1,N.style.maxHeight=N.scrollHeight+"px",N.offsetHeight,N.style.maxHeight=s.value+"px";else{d.value=!0,N.style.maxHeight=N.scrollHeight+"px";const V=()=>{N.style.maxHeight="none",N.removeEventListener("transitionend",V)};N.addEventListener("transitionend",V)}};let x=null;return e.onMounted(()=>{b(),k.value&&i.value&&(i.value.style.maxHeight=s.value+"px"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{m.value=!0})}),i.value&&(x=new MutationObserver(()=>{b(),k.value&&!d.value&&i.value&&(i.value.style.maxHeight=s.value+"px")}),x.observe(i.value,{childList:!0}))}),e.onBeforeUnmount(()=>{x==null||x.disconnect()}),(N,V)=>(e.openBlock(),e.createBlock(e.unref(a.ElCard),{shadow:"never",class:"j-search-header-card"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElForm),{inline:"",class:"search-form"},{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"formItemsRef",ref:i,class:e.normalizeClass(["form-items-wrapper",{"is-animated":m.value}])},[e.renderSlot(N.$slots,"default",{},void 0,!0)],2)]),_:3}),e.createElementVNode("div",{class:"action-bar",style:e.normalizeStyle({marginTop:d.value?"0px":"10px"})},[e.createElementVNode("div",Ze,[t.showAdd?(e.openBlock(),e.createBlock(e.unref(a.ElButton),{key:0,type:"primary",icon:e.unref(R.Plus),onClick:V[0]||(V[0]=M=>r("add"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.addText),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),t.showBatchDelete?(e.openBlock(),e.createBlock(e.unref(a.ElButton),{key:1,type:"danger",icon:e.unref(R.Delete),disabled:t.selectedCount===0,onClick:V[1]||(V[1]=M=>r("batchDelete"))},{default:e.withCtx(()=>[e.createTextVNode(" 批量删除"+e.toDisplayString(t.selectedCount?`(${t.selectedCount})`:""),1)]),_:1},8,["icon","disabled"])):e.createCommentVNode("",!0),t.showSearch?(e.openBlock(),e.createBlock(e.unref(a.ElButton),{key:2,type:"primary",icon:e.unref(R.Search),onClick:V[2]||(V[2]=M=>r("search"))},{default:e.withCtx(()=>[...V[4]||(V[4]=[e.createTextVNode("搜索",-1)])]),_:1},8,["icon"])):e.createCommentVNode("",!0),t.showReset?(e.openBlock(),e.createBlock(e.unref(a.ElButton),{key:3,icon:e.unref(R.Refresh),onClick:V[3]||(V[3]=M=>r("reset"))},{default:e.withCtx(()=>[...V[5]||(V[5]=[e.createTextVNode("重置",-1)])]),_:1},8,["icon"])):e.createCommentVNode("",!0),e.renderSlot(N.$slots,"actions",{},void 0,!0)]),k.value?(e.openBlock(),e.createBlock(e.unref(a.ElButton),{key:0,link:"",type:"primary",onClick:$},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value?"收起":"展开")+" ",1),e.createVNode(e.unref(a.ElIcon),{class:e.normalizeClass(["toggle-icon",{"is-expanded":d.value}])},{default:e.withCtx(()=>[e.createVNode(e.unref(R.ArrowDown))]),_:1},8,["class"])]),_:1})):e.createCommentVNode("",!0)],4)]),_:3}))}}),[["__scopeId","data-v-c1f4bf4c"]]),Qe={class:"j-import-upload-row"},Ye={class:"j-import-stat-num"},Pe={class:"j-import-stat-num"},ve={class:"j-import-stat-num"},et={key:0,class:"j-import-status-fail"},tt={key:1},ie=q(e.defineComponent({name:"JImportExcel",__name:"JImportExcel",props:e.mergeModels({getFieldListApi:{},importApi:{},excludeFields:{default:()=>["id","ctime","mtime"]},title:{default:"Excel 批量导入"}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:e.mergeModels(["success"],["update:modelValue"]),setup(t,{emit:p}){const o=t,r=p,i=e.useModel(t,"modelValue"),d=e.ref(!1),m=e.ref({}),u=e.ref([]),s=e.ref({total:0,success:0,fail:0}),k={0:"待创建",1:"创建成功",2:"创建中",[-1]:"创建失败"},b=e.computed(()=>Object.entries(m.value).filter(([E])=>!o.excludeFields.includes(E)).map(([E,f])=>({id:E,label:f,prop:E}))),$=async()=>{try{const E=await o.getFieldListApi();m.value=E.data.tableFieldsInfo??{}}catch{a.ElMessage.error("获取字段列表失败")}},x=E=>{const f=E.raw;if(!f)return;if(!["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"].includes(f.type)&&!f.name.match(/\.xlsx?$/i)){a.ElMessage.warning("请上传 .xlsx 或 .xls 格式文件");return}const B=new FileReader;B.onload=g=>{try{const A=O.read(g.target.result,{type:"binary"}),S=A.SheetNames[0],I=A.Sheets[S],y=O.utils.sheet_to_json(I,{header:1,defval:""}).slice(1).filter(F=>F.some(L=>L!==""));if(!y.length){a.ElMessage.warning("文件内容为空");return}const D=y.map(F=>{const L={_status:0,_error:""};return b.value.forEach((W,K)=>{L[W.prop]=F[K]!==void 0?F[K]:""}),L});u.value=D,s.value={total:D.length,success:0,fail:0}}catch{a.ElMessage.error("解析文件失败,请检查文件格式")}},B.readAsBinaryString(f)},N=E=>{u.value.splice(E,1),s.value.total=u.value.length},V=async()=>{const E=u.value.filter(f=>f._status===0).map(({_status:f,_error:C,...B})=>B);if(!E.length){a.ElMessage.warning("没有可导入的数据");return}d.value=!0;try{const f=await o.importApi(E);f.code===1?(u.value.forEach(C=>{C._status===0&&(C._status=1)}),s.value.success=u.value.filter(C=>C._status===1).length,a.ElMessage.success("导入成功"),r("success")):a.ElMessage.error(f.msg||"导入失败")}catch{a.ElMessage.error("导入失败,请重试")}finally{d.value=!1}},M=()=>{try{const E=O.utils.book_new(),f=b.value.map(g=>g.label),C={};f.forEach(g=>C[g]="");const B=O.utils.json_to_sheet([C]);O.utils.book_append_sheet(E,B,"模板"),O.writeFile(E,"导入模板.xlsx")}catch{a.ElMessage.error("模板下载失败")}},T=()=>{d.value||(i.value=!1,u.value=[],s.value={total:0,success:0,fail:0})};return(E,f)=>(e.openBlock(),e.createBlock(e.unref(a.ElDialog),{modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=C=>i.value=C),title:o.title,width:"900px","close-on-click-modal":!1,onOpen:$,onClose:T},{footer:e.withCtx(()=>[e.createVNode(e.unref(a.ElButton),{onClick:T},{default:e.withCtx(()=>[...f[9]||(f[9]=[e.createTextVNode("关闭",-1)])]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(a.ElCard),{shadow:"never",class:"j-import-upload-card"},{default:e.withCtx(()=>[f[3]||(f[3]=e.createElementVNode("div",{class:"j-import-upload-card-title"},"导入 EXCEL",-1)),e.createVNode(e.unref(a.ElDivider),{style:{margin:"10px 0"}}),e.createElementVNode("div",Qe,[e.createVNode(e.unref(a.ElUpload),{accept:".xlsx,.xls","auto-upload":!1,"show-file-list":!1,"on-change":x},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElButton),{size:"small"},{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode("点击上传",-1)])]),_:1})]),_:1}),b.value.length?(e.openBlock(),e.createBlock(e.unref(a.ElLink),{key:0,type:"primary",class:"j-import-no-wrap",onClick:M},{default:e.withCtx(()=>[...f[2]||(f[2]=[e.createTextVNode(" 下载导入模板.xlsx ",-1)])]),_:1})):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(e.unref(a.ElRow),{class:"j-import-stats-row",gutter:20,align:"middle"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElCol),{span:18},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElRow),{class:"j-import-stats-cols"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElCol),{span:4,class:"j-import-stat-item"},{default:e.withCtx(()=>[e.createElementVNode("div",Ye,e.toDisplayString(s.value.total),1),f[4]||(f[4]=e.createElementVNode("div",{class:"j-import-stat-label"},"导入数量",-1))]),_:1}),e.createVNode(e.unref(a.ElCol),{span:4,class:"j-import-stat-item"},{default:e.withCtx(()=>[e.createElementVNode("div",Pe,e.toDisplayString(s.value.fail),1),f[5]||(f[5]=e.createElementVNode("div",{class:"j-import-stat-label"},"失败数量",-1))]),_:1}),e.createVNode(e.unref(a.ElCol),{span:4,class:"j-import-stat-item"},{default:e.withCtx(()=>[e.createElementVNode("div",ve,e.toDisplayString(s.value.success),1),f[6]||(f[6]=e.createElementVNode("div",{class:"j-import-stat-label"},"成功数量",-1))]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(a.ElCol),{span:6,class:"j-import-confirm-col"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElButton),{type:"primary",size:"small",loading:d.value,disabled:!u.value.length,onClick:V},{default:e.withCtx(()=>[...f[7]||(f[7]=[e.createTextVNode(" 确认导入 ",-1)])]),_:1},8,["loading","disabled"])]),_:1})]),_:1}),e.createVNode(e.unref(a.ElTable),{data:u.value,border:"",size:"small","max-height":"360",class:"j-import-data-table"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,C=>(e.openBlock(),e.createBlock(e.unref(a.ElTableColumn),{key:C.prop,prop:C.prop,label:C.label,"min-width":120,"show-overflow-tooltip":""},null,8,["prop","label"]))),128)),e.createVNode(e.unref(a.ElTableColumn),{label:"状态",width:"110",align:"center",fixed:"right"},{default:e.withCtx(({row:C})=>[C._status===-1?(e.openBlock(),e.createElementBlock("span",et,e.toDisplayString(C._error||"创建失败"),1)):(e.openBlock(),e.createElementBlock("span",tt,e.toDisplayString(k[C._status]),1))]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"操作",width:"80",align:"center",fixed:"right"},{default:e.withCtx(({$index:C,row:B})=>[B._status===0?(e.openBlock(),e.createBlock(e.unref(a.ElButton),{key:0,size:"small",onClick:g=>N(C)},{default:e.withCtx(()=>[...f[8]||(f[8]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["data"])]),_:1},8,["modelValue","title"]))}}),[["__scopeId","data-v-74dcefaa"]]),at={class:"j-sidebar__menu-item-title"},G=q(e.defineComponent({name:"JSideMenuItem",__name:"JSideMenuItem",props:{menuItem:{},isCollapse:{type:Boolean},depth:{default:0}},emits:["menu-click"],setup(t,{emit:p}){const o=t,r=p,i=()=>{r("menu-click",o.menuItem)};return(d,m)=>{const u=e.resolveComponent("JSideMenuItem",!0);return t.menuItem.children&&t.menuItem.children.length>0?(e.openBlock(),e.createBlock(e.unref(a.ElSubMenu),{key:0,index:t.menuItem.path,class:e.normalizeClass([`j-sidebar__depth-${t.depth}`])},{title:e.withCtx(()=>[t.menuItem.icon&&t.depth===0?(e.openBlock(),e.createBlock(e.unref(U),{key:0,icon:t.menuItem.icon},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",at,e.toDisplayString(t.menuItem.title||t.menuItem.name),1)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.menuItem.children,s=>(e.openBlock(),e.createBlock(u,{key:s.path,"menu-item":s,"is-collapse":t.isCollapse,depth:t.depth+1,onMenuClick:m[0]||(m[0]=k=>r("menu-click",k))},null,8,["menu-item","is-collapse","depth"]))),128))]),_:1},8,["index","class"])):(e.openBlock(),e.createBlock(e.unref(a.ElMenuItem),{key:1,index:t.menuItem.path,class:e.normalizeClass([`j-sidebar__depth-${t.depth}`]),onClick:i},{title:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(t.menuItem.title||t.menuItem.name),1)]),default:e.withCtx(()=>[t.menuItem.icon&&t.depth===0?(e.openBlock(),e.createBlock(e.unref(U),{key:0,icon:t.menuItem.icon},null,8,["icon"])):e.createCommentVNode("",!0)]),_:1},8,["index","class"]))}}}),[["__scopeId","data-v-3a990426"]]),lt={class:"j-sidebar__logo"},ot={class:"j-sidebar__title"},nt={class:"j-sidebar__menu-wrapper"},rt={class:"j-sidebar__footer"},Z=q(e.defineComponent({name:"JSidebar",__name:"JSidebar",props:{menus:{},activeMenu:{default:""},title:{default:""},collapsedTitle:{default:""},collapsed:{type:Boolean,default:!1},collapsedWidth:{default:80},expandedWidth:{default:200},router:{type:Boolean,default:!0}},emits:["update:collapsed","menu-click"],setup(t,{emit:p}){const o=t,r=p,i=e.ref(o.collapsed);e.watch(()=>o.collapsed,m=>{i.value=m});const d=()=>{i.value=!i.value,r("update:collapsed",i.value)};return(m,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["j-sidebar",i.value?"j-sidebar--collapsed":"j-sidebar--expanded"]),style:e.normalizeStyle({width:i.value?`${t.collapsedWidth}px`:`${t.expandedWidth}px`})},[e.createElementVNode("div",lt,[e.renderSlot(m.$slots,"logo",{collapsed:i.value},()=>{var s;return[e.createElementVNode("h2",ot,e.toDisplayString(i.value?t.collapsedTitle||((s=t.title)==null?void 0:s.charAt(0))||"":t.title),1)]},!0)]),e.createElementVNode("div",nt,[e.createVNode(e.unref(a.ElMenu),{"default-active":t.activeMenu,class:"j-sidebar__menu",router:t.router,collapse:i.value,"collapse-transition":!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.menus,s=>(e.openBlock(),e.createBlock(G,{key:s.path,"menu-item":s,"is-collapse":i.value,onMenuClick:u[0]||(u[0]=k=>r("menu-click",k))},null,8,["menu-item","is-collapse"]))),128))]),_:1},8,["default-active","router","collapse"])]),e.createElementVNode("div",rt,[e.renderSlot(m.$slots,"footer",{collapsed:i.value,toggle:d},()=>[e.createElementVNode("button",{class:"j-sidebar__collapse-btn",onClick:d},[e.createVNode(e.unref(U),{icon:i.value?"mdi:chevron-right":"mdi:chevron-left"},null,8,["icon"])])],!0)])],6))}}),[["__scopeId","data-v-a3fac9de"]]),it={class:"j-admin-layout__right-panel"},ct={class:"j-admin-layout__header"},st={class:"j-admin-layout__header-left"},dt={key:0,class:"j-admin-layout__logo"},pt={class:"j-admin-layout__header-right"},mt={class:"j-admin-layout__user"},ft={class:"j-admin-layout__content-container"},ce=q(e.defineComponent({name:"JAdminLayout",__name:"JAdminLayout",props:{topMenus:{},sideMenus:{},activeTopMenu:{default:""},activeMenu:{default:""},title:{default:""},logoTitle:{default:""},collapsedTitle:{default:""},collapsed:{type:Boolean,default:!1},username:{default:""},profileText:{default:"个人资料"},logoutText:{default:"退出登录"},sidebarCollapsedWidth:{default:80},sidebarExpandedWidth:{default:200},headerHeight:{default:"50px"},contentPadding:{default:"10px"},contentBackground:{default:"#f0f2f5"},headerBackground:{default:"#ffffff"},showProfile:{type:Boolean,default:!0},showLogout:{type:Boolean,default:!0},hideContentScrollbar:{type:Boolean,default:!1}},emits:["update:collapsed","top-menu-select","side-menu-click","profile","logout"],setup(t,{emit:p}){const o=t,r=p,i=e.computed({get:()=>o.collapsed,set:s=>r("update:collapsed",s)}),d=e.computed(()=>({"--j-admin-layout-header-height":o.headerHeight,"--j-admin-layout-content-padding":o.contentPadding,"--j-admin-layout-content-bg":o.contentBackground,"--j-admin-layout-header-bg":o.headerBackground})),m=s=>{r("top-menu-select",s)},u=s=>{r("side-menu-click",s)};return(s,k)=>(e.openBlock(),e.createElementBlock("div",{class:"j-admin-layout",style:e.normalizeStyle(d.value)},[t.sideMenus.length>0?(e.openBlock(),e.createBlock(e.unref(Z),{key:0,collapsed:i.value,"onUpdate:collapsed":k[0]||(k[0]=b=>i.value=b),menus:t.sideMenus,"active-menu":t.activeMenu,title:t.title,"collapsed-title":t.collapsedTitle,"collapsed-width":t.sidebarCollapsedWidth,"expanded-width":t.sidebarExpandedWidth,onMenuClick:u},e.createSlots({_:2},[s.$slots.sidebarFooter?{name:"footer",fn:e.withCtx(({collapsed:b,toggle:$})=>[e.renderSlot(s.$slots,"sidebarFooter",{collapsed:b,toggle:$},void 0,!0)]),key:"0"}:void 0]),1032,["collapsed","menus","active-menu","title","collapsed-title","collapsed-width","expanded-width"])):e.createCommentVNode("",!0),e.createElementVNode("div",it,[e.createElementVNode("div",ct,[e.createElementVNode("div",st,[t.sideMenus.length===0?(e.openBlock(),e.createElementBlock("div",dt,[e.renderSlot(s.$slots,"logo",{},()=>[e.createElementVNode("h2",null,e.toDisplayString(t.logoTitle||t.title),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(e.unref(a.ElMenu),{mode:"horizontal","default-active":t.activeTopMenu,class:"j-admin-layout__top-menu",onSelect:m},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.topMenus,b=>(e.openBlock(),e.createBlock(e.unref(a.ElMenuItem),{key:b.path,index:b.path},{default:e.withCtx(()=>[b.icon?(e.openBlock(),e.createBlock(e.unref(U),{key:0,icon:b.icon,class:"j-admin-layout__top-menu-icon"},null,8,["icon"])):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(b.title||b.name),1)]),_:2},1032,["index"]))),128))]),_:1},8,["default-active"])]),e.createElementVNode("div",pt,[e.renderSlot(s.$slots,"headerRight",{username:t.username},()=>[t.showProfile||t.showLogout?(e.openBlock(),e.createBlock(e.unref(a.ElDropdown),{key:0},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(a.ElDropdownMenu),null,{default:e.withCtx(()=>[t.showProfile?(e.openBlock(),e.createBlock(e.unref(a.ElDropdownItem),{key:0,onClick:k[1]||(k[1]=b=>r("profile"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.profileText),1)]),_:1})):e.createCommentVNode("",!0),t.showLogout?(e.openBlock(),e.createBlock(e.unref(a.ElDropdownItem),{key:1,onClick:k[2]||(k[2]=b=>r("logout"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.logoutText),1)]),_:1})):e.createCommentVNode("",!0)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("span",mt,[e.createTextVNode(e.toDisplayString(t.username)+" ",1),e.createVNode(e.unref(a.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(R.ArrowDown))]),_:1})])]),_:1})):e.createCommentVNode("",!0)],!0)])]),e.createElementVNode("div",ft,[e.renderSlot(s.$slots,"tabs",{},void 0,!0),e.createElementVNode("div",{class:e.normalizeClass(["j-admin-layout__content",{"j-admin-layout__content--scrollbar-hidden":t.hideContentScrollbar}])},[e.renderSlot(s.$slots,"default",{},void 0,!0)],2)])])],4))}}),[["__scopeId","data-v-51b44ebf"]]),ht={class:"pdd-body"},gt=["href"],ut=["innerHTML"],yt={key:1},kt={key:1},_t={key:1},bt={class:"pdd-supplier-head"},Ct={class:"pdd-supplier-name"},wt={class:"pdd-supplier-meta"},Vt={class:"pdd-supplier-meta"},Nt={key:1},Et={key:1},xt={key:1},Bt={key:1},Dt=["href"],St={key:1},se=e.ref([]),Q=e.ref([]),de=e.ref([]),pe=e.ref([]),me=e.ref([]),fe=e.ref([]);let he=!1,H=null;const Tt=t=>{const p=(o,r)=>t({url:o,method:"post",data:r});return he?Promise.resolve():H||(H=Promise.all([p("/bis-app/comm/productAttrValue/getAll",{pageSize:999}).then(o=>{var r,i,d;o.code===1&&(se.value=((r=o.data)==null?void 0:r.brand)||[],Q.value=((i=o.data)==null?void 0:i.unit)||[],de.value=((d=o.data)==null?void 0:d.sale)||[])}).catch(()=>{}),p("/bis-app/comm/company/list",{pageSize:999,subject_type:"purchase"}).then(o=>{var r;o.code===1&&(pe.value=((r=o.data)==null?void 0:r.list)||o.data||[])}).catch(()=>{}),p("/bis-app/comm/tagCategoryValue/list",{tag_code:"PRODUCT_TAG",pageIndex:1,pageSize:999}).then(o=>{var r;o.code===1&&(me.value=((r=o.data)==null?void 0:r.list)||o.data||[])}).catch(()=>{}),p("/bis-app/comm/customAttr/list",{pageIndex:1,pageSize:999}).then(o=>{var r;o.code===1&&(fe.value=((r=o.data)==null?void 0:r.list)||o.data||[])}).catch(()=>{})]).then(()=>{he=!0}).finally(()=>{H=null}),H)},It=e.defineComponent({name:"JProductDetailDialog",directives:{loading:a.vLoading},__name:"JProductDetailDialog",props:{visible:{type:Boolean,default:!1},code:{default:""},type:{default:"sku"},id:{default:void 0},request:{}},emits:["update:visible"],setup(t,{emit:p}){const o=t,r=p,i=(n,c)=>o.request({url:n,method:"post",data:c}),d=e.ref(!1),m=e.ref(null),u=async()=>{if(!o.code&&o.id===void 0)return;m.value=null,Tt(o.request);const n=o.type==="spu"?"/bis-app/comm/spu/doDetail":"/bis-app/comm/sku/doDetail",c=o.type==="spu"?{id:o.id,spu_code:o.code}:{id:o.id,sku_code:o.code};d.value=!0;try{const l=await i(n,c);l.code===1&&l.data?m.value=l.data:a.ElMessage.error(l.msg||"获取详情失败")}catch{a.ElMessage.error("获取详情失败")}finally{d.value=!1}};e.watch(()=>o.visible,n=>{n&&u()});const s=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.basic_info)??m.value??{}}),k=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.spec_info)??{}}),b=e.computed(()=>{var n,c;return((n=m.value)==null?void 0:n.images_info)??((c=m.value)==null?void 0:c.image_info)??{}}),$=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.purchase_info)??{}}),x=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.declaration_info)??{}}),N=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.qc_info)??{}}),V=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.bind_sku_info)??{}}),M=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.spu_bind_sku)??{}}),T=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.spec_box_info)??k.value.spec_box_info??[]}),E=e.computed(()=>{var n;return((n=m.value)==null?void 0:n.sku_supplier)??$.value.supplier_list??[]}),f=e.computed(()=>String(s.value.product_type??(o.type==="spu"?"30":"10"))),C=e.computed(()=>f.value==="30"),B=e.computed(()=>({10:"单品",20:"组合产品",30:"多属性产品"})[f.value]||f.value),g=e.computed(()=>C.value&&s.value.spu_name||s.value.product_name),A=e.computed(()=>C.value&&s.value.spu_name_en||s.value.product_name_en),S=e.computed(()=>C.value?s.value.spu_code:s.value.sku_code),I=n=>{if(n==null||n==="")return[];if(Array.isArray(n))return n.map(String).filter(Boolean);if(typeof n=="string"){const c=n.trim();if(!c)return[];if(c.startsWith("["))try{const l=JSON.parse(c);return Array.isArray(l)?l.map(String).filter(Boolean):[]}catch{}return c.split(",").map(l=>l.trim()).filter(Boolean)}return[String(n)]},z=n=>{let c=[];if(Array.isArray(n))c=n;else if(typeof n=="string"&&n.trim())try{const l=JSON.parse(n);c=Array.isArray(l)?l:[n]}catch{c=[n]}return c.map(l=>{if(typeof l=="string")return{name:l.split("/").pop()||l,url:l};const h=(l==null?void 0:l.url)||(l==null?void 0:l.file_url)||(l==null?void 0:l.path)||"";return{name:(l==null?void 0:l.name)||(l==null?void 0:l.file_name)||h.split("/").pop()||"附件",url:h}}).filter(l=>l.url)},y=n=>n==null||n===""?"—":n,D=(n,c)=>n==null||n===""?"—":`${n} ${c||""}`.trim(),F=(n,c,l,h="cm")=>{if([n,c,l].every(j=>j==null||j===""))return"—";const _=j=>j==null||j===""?"—":j;return`${_(n)} × ${_(c)} × ${_(l)} ${h}`},L=(n,c)=>{if(c==null||c==="")return"";const l=n.find(h=>String(h.id)===String(c));return(l==null?void 0:l.attr_value_name)||""},W=e.computed(()=>s.value.brand_name||L(se.value,s.value.brand_id)),K=e.computed(()=>s.value.unit_name||L(Q.value,s.value.unit_id)),Ut=e.computed(()=>s.value.sale_status_name||s.value.status_name||L(de.value,s.value.status)),Ht=e.computed(()=>x.value.declaration_unit_name||L(Q.value,x.value.declaration_unit_id)||x.value.declaration_unit_id),Wt=e.computed(()=>{if(s.value.pe_code_name)return s.value.pe_code_name;const n=I(s.value.pe_codes);return n.length?n.map(c=>{var l;return((l=pe.value.find(h=>String(h.company_code)===String(c)))==null?void 0:l.company_name)||c}).join("、"):""}),xe=e.computed(()=>I(s.value.tags).map(n=>{const c=me.value.find(l=>String(l.tag_value_code)===String(n));return{code:n,name:(c==null?void 0:c.tag_value_name)||n,color:(c==null?void 0:c.tag_color)||""}})),Kt=e.computed(()=>{const n=s.value.sku_attr;return!n||typeof n!="object"||Array.isArray(n)?"":Object.entries(n).map(([c,l])=>`${c}: ${l}`).join(";")}),Be=e.computed(()=>z(s.value.att_files)),Xt=e.computed(()=>{const n=s.value.product_desc||"";return String(n).replace(/<[^>]*>/g,"").trim().length>0||/<img/i.test(String(n))}),ee=e.computed(()=>{var n;return b.value.main_image||((n=m.value)==null?void 0:n.product_image)||""}),te=e.computed(()=>{var n;return I(b.value.size_images??((n=m.value)==null?void 0:n.size_images))}),ae=e.computed(()=>I(b.value.selling_point_images)),Gt=e.computed(()=>({spot:"抽检",full:"全检",exempt:"免检"})[N.value.qc_method]||y(N.value.qc_method)),le=e.computed(()=>I(N.value.images)),De=e.computed(()=>z(N.value.att_files)),Se=e.computed(()=>Array.isArray(N.value.qc_content)?N.value.qc_content:[]),Te=n=>String(n.custom_attr_id??n.id??n.attr_id??n.attr_code??"").trim(),Zt=n=>{const c=Array.isArray(n)?n:n!=null&&n!==""?[n]:[],l=[];for(const h of c)if(typeof h=="string")h.split(/[,,、\n]/).map(_=>_.trim()).filter(Boolean).forEach(_=>l.push({id:"",name:_}));else if(h&&typeof h=="object"){const _=String(h.attr_value??h.value??h.label??h.attr_value_name??h.name??"").trim(),j=String(h.id??h.attr_value_id??h.value_id??"");_&&l.push({id:j,name:_})}return l},Qt=e.computed(()=>{const n=new Map;for(const c of fe.value){const l=Te(c);l&&n.set(l,c)}return n}),Ie=e.computed(()=>{var h;const n=(h=m.value)==null?void 0:h.custom_attr_info,c=(n==null?void 0:n.list)??n;return(Array.isArray(c)?c:[]).map(_=>{const j=Te(_),J=Qt.value.get(j);return{..._,custom_attr_id:j,attr_name:_.attr_name||(J==null?void 0:J.attr_name)||j,options:Zt((J==null?void 0:J.attr_value)??(J==null?void 0:J.options)??_.options??_.attr_value)}})}),Yt=n=>{const c=I(n.custom_attr_value_id??n.custom_attr_value);if(!c.length)return"—";const l=n.options||[];return c.map(h=>{var _;return((_=l.find(j=>j.id&&String(j.id)===String(h)||String(j.name)===String(h)))==null?void 0:_.name)||h}).join("、")},Pt=e.computed(()=>V.value.bind_sku_list??[]),$e=e.computed(()=>M.value.sku_attr??[]),vt=e.computed(()=>M.value.sku_list??[]),ea=(n,c)=>{var _;const l=(_=n.sku_attr)==null?void 0:_[c.attr_code];if(l==null||l==="")return"—";const h=(c.childs||[]).find(j=>String(j.attr_value_code)===String(l));return(h==null?void 0:h.attr_value_name)||String(l)},ta=n=>{const c=[];for(const l of n.supplier_quote||[])for(const h of l.quote_list||[])c.push({currency:l.quote_currency_code,is_tax:l.is_tax,tax_rate:l.tax_rate,...h});return c};return(n,c)=>(e.openBlock(),e.createBlock(e.unref(a.ElDialog),{"model-value":t.visible,title:"查看产品",width:"1200px",top:"4vh","close-on-click-modal":!1,"onUpdate:modelValue":c[1]||(c[1]=l=>r("update:visible",l))},{footer:e.withCtx(()=>[e.createVNode(e.unref(a.ElButton),{onClick:c[0]||(c[0]=l=>r("update:visible",!1))},{default:e.withCtx(()=>[...c[17]||(c[17]=[e.createTextVNode("关闭",-1)])]),_:1})]),default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",ht,[m.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c[13]||(c[13]=e.createElementVNode("div",{class:"pdd-title"},"基本信息",-1)),e.createVNode(e.unref(a.ElDescriptions),{column:3,border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElDescriptionsItem),{label:C.value?"中文款式":"中文品名"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(g.value)),1)]),_:1},8,["label"]),e.createVNode(e.unref(a.ElDescriptionsItem),{label:C.value?"英文款式":"英文品名"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(A.value)),1)]),_:1},8,["label"]),e.createVNode(e.unref(a.ElDescriptionsItem),{label:C.value?"SPU":"SKU"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(S.value)),1)]),_:1},8,["label"]),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"产品类型"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(B.value),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"采购公司"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(Wt.value)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"状态"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(Ut.value)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"品类"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(s.value.category_path_name||s.value.category_name)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"品牌"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(W.value)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"单位"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(K.value)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"产品标签"},{default:e.withCtx(()=>[xe.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(xe.value,l=>(e.openBlock(),e.createBlock(e.unref(a.ElTag),{key:l.code,size:"small",class:"pdd-tag",style:e.normalizeStyle(l.color?{backgroundColor:l.color,borderColor:l.color,color:"#fff"}:{})},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.name),1)]),_:2},1032,["style"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode("—")],64))]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"材质"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(s.value.material)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"型号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(s.value.product_model)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"开发员"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(s.value.develop_leader_name||s.value.develop_user)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"采购员"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(s.value.purchase_leader_name||s.value.purchase_user)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"产品运营"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(s.value.sales_leader_name||s.value.sales_user)),1)]),_:1}),C.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(a.ElDescriptionsItem),{key:0,label:"关联SPU"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(s.value.spu_code)),1)]),_:1})),C.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(a.ElDescriptionsItem),{key:1,label:"产品属性",span:2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(Kt.value)),1)]),_:1})),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"附件",span:3},{default:e.withCtx(()=>[Be.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(Be.value,(l,h)=>(e.openBlock(),e.createElementBlock("a",{key:h,href:l.url,target:"_blank",class:"pdd-file"},e.toDisplayString(l.name),9,gt))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode("—")],64))]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"详细描述",span:3},{default:e.withCtx(()=>[Xt.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"pdd-rich",innerHTML:s.value.product_desc},null,8,ut)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode("—")],64))]),_:1})]),_:1}),f.value==="20"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c[2]||(c[2]=e.createElementVNode("div",{class:"pdd-title"},"产品组成",-1)),e.createVNode(e.unref(a.ElDescriptions),{column:3,border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElDescriptionsItem),{label:"单位加工费"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.value.unit_process_cost!=null&&V.value.unit_process_cost!==""?`${V.value.unit_process_cost} ${V.value.unit_process_currency_code||""}`:"—"),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"加工备注",span:2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(V.value.unit_process_remark)),1)]),_:1})]),_:1}),e.createVNode(e.unref(a.ElTable),{data:Pt.value,border:"",size:"small",class:"pdd-table"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElTableColumn),{label:"图片",width:"70",align:"center"},{default:e.withCtx(({row:l})=>[l.image||l.product_image?(e.openBlock(),e.createBlock(e.unref(a.ElImage),{key:0,src:l.image||l.product_image,"preview-src-list":[l.image||l.product_image],"preview-teleported":"",fit:"cover",class:"pdd-thumb"},null,8,["src","preview-src-list"])):(e.openBlock(),e.createElementBlock("span",yt,"—"))]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"品名",prop:"product_name","min-width":"140","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"SKU",prop:"sku_code","min-width":"120","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"单位","min-width":"70"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(y(l.unit||l.unit_name)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"数量","min-width":"70"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(y(l.quantity??l.sku_quantity)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"品类",prop:"category_path_name","min-width":"120","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"型号","min-width":"90"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(y(l.model_no||l.product_model)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"材质",prop:"material","min-width":"90","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"单品尺寸","min-width":"140"},{default:e.withCtx(({row:l})=>{var h,_,j,J;return[e.createTextVNode(e.toDisplayString(F((h=l.spec_info)==null?void 0:h.length,(_=l.spec_info)==null?void 0:_.width,(j=l.spec_info)==null?void 0:j.height,((J=l.spec_info)==null?void 0:J.height_unit)||"cm")),1)]}),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"净重","min-width":"80"},{default:e.withCtx(({row:l})=>{var h,_;return[e.createTextVNode(e.toDisplayString(D(((h=l.spec_info)==null?void 0:h.net_weight)??l.net_weight,(_=l.spec_info)==null?void 0:_.product_unit)),1)]}),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"毛重","min-width":"80"},{default:e.withCtx(({row:l})=>{var h,_;return[e.createTextVNode(e.toDisplayString(D(((h=l.spec_info)==null?void 0:h.gross_weight)??l.gross_weight,(_=l.spec_info)==null?void 0:_.product_unit)),1)]}),_:1})]),_:1},8,["data"])],64)):e.createCommentVNode("",!0),C.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[c[3]||(c[3]=e.createElementVNode("div",{class:"pdd-title"},"款式属性",-1)),e.createVNode(e.unref(a.ElTable),{data:$e.value,border:"",size:"small",class:"pdd-table"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElTableColumn),{label:"属性",prop:"attr_name",width:"160"}),e.createVNode(e.unref(a.ElTableColumn),{label:"属性值"},{default:e.withCtx(({row:l})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.childs||[],h=>(e.openBlock(),e.createBlock(e.unref(a.ElTag),{key:h.attr_value_code,size:"small",class:"pdd-tag"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.attr_value_name),1)]),_:2},1024))),128))]),_:1})]),_:1},8,["data"]),c[4]||(c[4]=e.createElementVNode("div",{class:"pdd-subtitle"},"关联产品信息",-1)),e.createVNode(e.unref(a.ElTable),{data:vt.value,border:"",size:"small",class:"pdd-table"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElTableColumn),{label:"图片",width:"70",align:"center"},{default:e.withCtx(({row:l})=>[l.main_image?(e.openBlock(),e.createBlock(e.unref(a.ElImage),{key:0,src:l.main_image,"preview-src-list":[l.main_image],"preview-teleported":"",fit:"cover",class:"pdd-thumb"},null,8,["src","preview-src-list"])):(e.openBlock(),e.createElementBlock("span",kt,"—"))]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"SKU",prop:"sku_code","min-width":"130","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"中文品名",prop:"product_name","min-width":"150","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"英文品名","min-width":"150","show-overflow-tooltip":""},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(y(l.product_name_en||l.product_en_name)),1)]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($e.value,l=>(e.openBlock(),e.createBlock(e.unref(a.ElTableColumn),{key:l.attr_code,label:l.attr_name,"min-width":"100"},{default:e.withCtx(({row:h})=>[e.createTextVNode(e.toDisplayString(ea(h,l)),1)]),_:2},1032,["label"]))),128))]),_:1},8,["data"])],64)):e.createCommentVNode("",!0),c[14]||(c[14]=e.createElementVNode("div",{class:"pdd-title"},"规格信息",-1)),e.createVNode(e.unref(a.ElDescriptions),{column:3,border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElDescriptionsItem),{label:"单品毛重"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(D(k.value.gross_weight,k.value.gross_weight_unit)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"单品净重"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(D(k.value.net_weight,k.value.net_weight_unit)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"包装重"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(D(k.value.tare_weight,k.value.tare_weight_unit)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"单品尺寸"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(F(k.value.length,k.value.width,k.value.height)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"包装尺寸",span:2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(F(k.value.tare_length,k.value.tare_width,k.value.tare_height)),1)]),_:1})]),_:1}),T.value.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[c[6]||(c[6]=e.createElementVNode("div",{class:"pdd-subtitle"},"装箱规格",-1)),e.createVNode(e.unref(a.ElTable),{data:T.value,border:"",size:"small",class:"pdd-table"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElTableColumn),{type:"index",label:"序号",width:"60",align:"center"}),e.createVNode(e.unref(a.ElTableColumn),{label:"箱规名称",prop:"box_name","min-width":"130","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"单箱数量","min-width":"90"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(l.box_quantity!=null?`${l.box_quantity} pcs`:"—"),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"单箱重量","min-width":"100"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(D(l.one_box_weight,l.one_box_unit)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"箱子重量","min-width":"100"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(D(l.box_weight,l.box_unit)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"外箱尺寸","min-width":"150"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(F(l.box_length,l.box_width,l.box_height)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"首选",width:"70",align:"center"},{default:e.withCtx(({row:l})=>[Number(l.is_preferred)===1?(e.openBlock(),e.createBlock(e.unref(a.ElTag),{key:0,size:"small",type:"success"},{default:e.withCtx(()=>[...c[5]||(c[5]=[e.createTextVNode("首选",-1)])]),_:1})):(e.openBlock(),e.createElementBlock("span",_t,"—"))]),_:1})]),_:1},8,["data"])],64)):e.createCommentVNode("",!0),C.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[c[9]||(c[9]=e.createElementVNode("div",{class:"pdd-title"},"采购信息",-1)),e.createVNode(e.unref(a.ElDescriptions),{column:3,border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElDescriptionsItem),{label:"采购成本"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y($.value.purchase_cost)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"采购交期"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString($.value.delivery_day!=null&&$.value.delivery_day!==""?`${$.value.delivery_day} 天`:"—"),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"采购税率"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString($.value.tax_rate!=null&&$.value.tax_rate!==""?`${$.value.tax_rate} %`:"—"),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"采购备注",span:3},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y($.value.purchase_remark)),1)]),_:1})]),_:1}),E.value.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c[8]||(c[8]=e.createElementVNode("div",{class:"pdd-subtitle"},"报价信息",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,(l,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:"pdd-supplier"},[e.createElementVNode("div",bt,[e.createElementVNode("span",Ct,e.toDisplayString(l.supplier_name||l.supplier_code||"—"),1),Number(l.is_preferred)===1?(e.openBlock(),e.createBlock(e.unref(a.ElTag),{key:0,size:"small",type:"success"},{default:e.withCtx(()=>[...c[7]||(c[7]=[e.createTextVNode("首选",-1)])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("span",wt,"预计交期:"+e.toDisplayString(l.delivery_day!=null&&l.delivery_day!==""?`${l.delivery_day} 天`:"—"),1),e.createElementVNode("span",Vt,"报价备注:"+e.toDisplayString(y(l.purchase_remark??l.remark)),1)]),e.createVNode(e.unref(a.ElTable),{data:ta(l),border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElTableColumn),{label:"币种",prop:"currency",width:"80"}),e.createVNode(e.unref(a.ElTableColumn),{label:"含税",width:"70",align:"center"},{default:e.withCtx(({row:_})=>[e.createTextVNode(e.toDisplayString(Number(_.is_tax)===1?"是":"否"),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"税率",width:"80"},{default:e.withCtx(({row:_})=>[e.createTextVNode(e.toDisplayString(_.tax_rate!=null&&_.tax_rate!==""?`${_.tax_rate} %`:"—"),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"采购数量 ≥","min-width":"100"},{default:e.withCtx(({row:_})=>[e.createTextVNode(e.toDisplayString(y(_.purchase_quantity)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"单价","min-width":"100"},{default:e.withCtx(({row:_})=>[e.createTextVNode(e.toDisplayString(y(_.purchase_price)),1)]),_:1}),e.createVNode(e.unref(a.ElTableColumn),{label:"含税单价","min-width":"100"},{default:e.withCtx(({row:_})=>[e.createTextVNode(e.toDisplayString(y(_.purchase_price_tax)),1)]),_:1})]),_:1},8,["data"])]))),128))],64)):e.createCommentVNode("",!0)],64)),C.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[c[10]||(c[10]=e.createElementVNode("div",{class:"pdd-title"},"产品图片",-1)),e.createVNode(e.unref(a.ElDescriptions),{column:1,border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElDescriptionsItem),{label:"主图"},{default:e.withCtx(()=>[ee.value?(e.openBlock(),e.createBlock(e.unref(a.ElImage),{key:0,src:ee.value,"preview-src-list":[ee.value],"preview-teleported":"",fit:"cover",class:"pdd-img"},null,8,["src","preview-src-list"])):(e.openBlock(),e.createElementBlock("span",Nt,"—"))]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"尺寸图"},{default:e.withCtx(()=>[te.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(te.value,(l,h)=>(e.openBlock(),e.createBlock(e.unref(a.ElImage),{key:h,src:l,"preview-src-list":te.value,"initial-index":h,"preview-teleported":"",fit:"cover",class:"pdd-img"},null,8,["src","preview-src-list","initial-index"]))),128)):(e.openBlock(),e.createElementBlock("span",Et,"—"))]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"卖点图"},{default:e.withCtx(()=>[ae.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(ae.value,(l,h)=>(e.openBlock(),e.createBlock(e.unref(a.ElImage),{key:h,src:l,"preview-src-list":ae.value,"initial-index":h,"preview-teleported":"",fit:"cover",class:"pdd-img"},null,8,["src","preview-src-list","initial-index"]))),128)):(e.openBlock(),e.createElementBlock("span",xt,"—"))]),_:1})]),_:1})],64)),c[15]||(c[15]=e.createElementVNode("div",{class:"pdd-title"},"申报信息",-1)),e.createVNode(e.unref(a.ElDescriptions),{column:3,border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElDescriptionsItem),{label:"中文申报名"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.declaration_name)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"英文申报名"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.declaration_name_en)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"中文材质"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.material)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"英文材质"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.material_en)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"中文用途"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.use)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"英文用途"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.use_en)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"中文功能"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.usage)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"英文功能"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.usage_en)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"申报价值"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.value.declaration_value!=null&&x.value.declaration_value!==""?`${x.value.declaration_value} ${x.value.declaration_currency_code||""}`:"—"),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"海关编码"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.hs_code)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"报关型号"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.declaration_model)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"原产地"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.country_of_origin)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"境内货源地"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(x.value.domestic_source_location)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"申报单位",span:2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(Ht.value)),1)]),_:1})]),_:1}),c[16]||(c[16]=e.createElementVNode("div",{class:"pdd-title"},"质检项",-1)),e.createVNode(e.unref(a.ElDescriptions),{column:3,border:"",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElDescriptionsItem),{label:"质检方式"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Gt.value),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"模板",span:2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(N.value.template_name||N.value.template_id||N.value.qc_temp_id)),1)]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"图片",span:3},{default:e.withCtx(()=>[le.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(le.value,(l,h)=>(e.openBlock(),e.createBlock(e.unref(a.ElImage),{key:h,src:l,"preview-src-list":le.value,"initial-index":h,"preview-teleported":"",fit:"cover",class:"pdd-img"},null,8,["src","preview-src-list","initial-index"]))),128)):(e.openBlock(),e.createElementBlock("span",Bt,"—"))]),_:1}),e.createVNode(e.unref(a.ElDescriptionsItem),{label:"附件",span:3},{default:e.withCtx(()=>[De.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(De.value,(l,h)=>(e.openBlock(),e.createElementBlock("a",{key:h,href:l.url,target:"_blank",class:"pdd-file"},e.toDisplayString(l.name),9,Dt))),128)):(e.openBlock(),e.createElementBlock("span",St,"—"))]),_:1})]),_:1}),Se.value.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:5},[c[11]||(c[11]=e.createElementVNode("div",{class:"pdd-subtitle"},"自定义质检项",-1)),e.createVNode(e.unref(a.ElTable),{data:Se.value,border:"",size:"small",class:"pdd-table"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElTableColumn),{type:"index",label:"序号",width:"60",align:"center"}),e.createVNode(e.unref(a.ElTableColumn),{label:"质检项",prop:"qc_item","min-width":"150","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"质检内容",prop:"qc_content","min-width":"250","show-overflow-tooltip":""})]),_:1},8,["data"])],64)):e.createCommentVNode("",!0),Ie.value.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:6},[c[12]||(c[12]=e.createElementVNode("div",{class:"pdd-title"},"自定义属性",-1)),e.createVNode(e.unref(a.ElTable),{data:Ie.value,border:"",size:"small",class:"pdd-table"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElTableColumn),{label:"属性名称",prop:"attr_name",width:"200","show-overflow-tooltip":""}),e.createVNode(e.unref(a.ElTableColumn),{label:"属性值"},{default:e.withCtx(({row:l})=>[e.createTextVNode(e.toDisplayString(Yt(l)),1)]),_:1})]),_:1},8,["data"])],64)):e.createCommentVNode("",!0)],64)):d.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(a.ElEmpty),{key:1,description:"暂无数据"}))])),[[e.unref(a.vLoading),d.value]])]),_:1},8,["model-value"]))}}),ge=q(It,[["__scopeId","data-v-8f050f53"]]),$t={key:1,class:"j-sku-link-empty"},ue=q(e.defineComponent({name:"JSkuLink",__name:"JSkuLink",props:{code:{},emptyText:{default:"-"}},emits:["open"],setup(t,{emit:p}){const o=t,r=p,i=e.computed(()=>String(o.code??"").trim()||o.emptyText),d=e.computed(()=>{const u=String(o.code??"").trim();return u!==""&&u!=="-"}),m=()=>{d.value&&r("open",String(o.code).trim())};return(u,s)=>d.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"j-sku-link",onClick:e.withModifiers(m,["stop"])},e.toDisplayString(i.value),1)):(e.openBlock(),e.createElementBlock("span",$t,e.toDisplayString(t.emptyText),1))}}),[["__scopeId","data-v-7f661ba5"]]);function jt(){const t=e.ref(!1),p=e.ref("");return{productDetailDialogVisible:t,productDetailDialogCode:p,openProductDetailDialog:r=>{const i=String(r??"").trim();!i||i==="-"||(p.value=i,t.value=!0)}}}const ye=q(e.defineComponent({name:"JSearchInputDialog",__name:"JSearchInputDialog",props:e.mergeModels({options:{default:()=>[]},placeholder:{default:"请输入关键词"},width:{default:"320px"},selectWidth:{default:"100px"},separator:{default:","},dialogTitle:{default:""},dialogWidth:{default:"480px"},rows:{default:8},textareaPlaceholder:{default:"支持换行、逗号、空格分隔,确定后自动合并"},clearOnTypeChange:{type:Boolean,default:!1}},{type:{default:""},typeModifiers:{},keyword:{default:""},keywordModifiers:{}}),emits:e.mergeModels(["confirm","search"],["update:type","update:keyword"]),setup(t,{expose:p,emit:o}){var f,C;const r=t,i=e.useModel(t,"type"),d=e.useModel(t,"keyword"),m=o,u=e.ref(!1),s=e.ref(""),k=e.computed(()=>r.options.find(B=>B.value===i.value)),b=e.computed(()=>{var g;return r.dialogTitle?r.dialogTitle:`批量输入${((g=k.value)==null?void 0:g.label)||"关键词"}`}),$=B=>{if(!B)return"";const g=B.split(/[\n\r,,;;\s\t]+/).map(I=>I.trim()).filter(Boolean),A=[],S=new Set;for(const I of g)S.has(I)||(S.add(I),A.push(I));return A.join(r.separator)},x=B=>B?B.split(/[\n\r,,;;\s\t.]+/).map(g=>g.trim()).filter(Boolean).join(`
2
+ `):"",N=()=>{s.value=x(d.value),u.value=!0},V=()=>{d.value=$(s.value),u.value=!1,m("confirm",{type:i.value,keyword:d.value})},M=()=>{s.value=""};return!i.value&&((f=r.options)!=null&&f.length)&&(i.value=((C=r.options[0])==null?void 0:C.value)||""),e.watch(i,(B,g)=>{r.clearOnTypeChange&&B!==g&&(d.value="")}),p({reset:B=>{var g,A;i.value=B||((A=(g=r.options)==null?void 0:g[0])==null?void 0:A.value)||"",d.value=""},toParams:()=>!d.value||!i.value?{}:{[i.value]:d.value},openDialog:N}),(B,g)=>{const A=e.resolveComponent("el-option"),S=e.resolveComponent("el-select"),I=e.resolveComponent("el-button"),z=e.resolveComponent("el-input"),y=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",{class:"j-search-input-dialog",style:e.normalizeStyle({width:t.width})},[e.createVNode(z,{modelValue:d.value,"onUpdate:modelValue":g[1]||(g[1]=D=>d.value=D),placeholder:t.placeholder,clearable:"",class:"j-search-input-dialog__input",onKeyup:g[2]||(g[2]=e.withKeys(D=>m("search"),["enter"]))},{prepend:e.withCtx(()=>[e.createVNode(S,{modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=D=>i.value=D),style:e.normalizeStyle({width:t.selectWidth}),disabled:!t.options.length},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,D=>(e.openBlock(),e.createBlock(A,{key:D.value,label:D.label,value:D.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","style","disabled"])]),append:e.withCtx(()=>[e.createVNode(I,{icon:e.unref(R.Memo),title:b.value,onClick:N},null,8,["icon","title"])]),_:1},8,["modelValue","placeholder"]),e.createVNode(y,{modelValue:u.value,"onUpdate:modelValue":g[5]||(g[5]=D=>u.value=D),title:b.value,width:t.dialogWidth,"append-to-body":"","destroy-on-close":"","close-on-click-modal":!1,onClosed:M},{footer:e.withCtx(()=>[e.createVNode(I,{onClick:g[4]||(g[4]=D=>u.value=!1)},{default:e.withCtx(()=>[...g[6]||(g[6]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(I,{type:"primary",onClick:V},{default:e.withCtx(()=>[...g[7]||(g[7]=[e.createTextVNode("确定",-1)])]),_:1})]),default:e.withCtx(()=>[e.createVNode(z,{modelValue:s.value,"onUpdate:modelValue":g[3]||(g[3]=D=>s.value=D),type:"textarea",rows:t.rows,placeholder:t.textareaPlaceholder,resize:"vertical"},null,8,["modelValue","rows","placeholder"])]),_:1},8,["modelValue","title","width"])],4)}}}),[["__scopeId","data-v-29890413"]]);function Y(t,p){return Array.isArray(t)?t.map(o=>Y(o,p)):t!==null&&typeof t=="object"&&!(t instanceof Date)?p(t):t}function ke(t,p=[]){return Object.fromEntries(Object.entries(t).map(([o,r])=>{const i=Y(r,m=>ke(m,p));return p.includes(o)?[o,i]:[o.replace(/([A-Z])/g,"_$1").toLowerCase(),i]}))}function _e(t,p=[]){return Object.fromEntries(Object.entries(t).map(([o,r])=>{const i=Y(r,m=>_e(m,p));return p.includes(o)?[o,i]:[o.replace(/_([a-z])/g,(m,u)=>u.toUpperCase()),i]}))}function Mt(t,p){const o={};for(const r of p)r in t&&(o[r]=t[r]);return o}function At(t,p){const o={...t};for(const r of p)delete o[r];return o}function P(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(o=>P(o));const p={};for(const o of Object.keys(t))p[o]=P(t[o]);return p}function be(t,p=!1){const o={};for(const[r,i]of Object.entries(t))if(!(i==null||i===""))if(p&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)){const d=be(i,!0);Object.keys(d).length>0&&(o[r]=d)}else o[r]=i;return o}function Ce(t,p="",o="."){const r={};for(const[i,d]of Object.entries(t)){const m=p?`${p}${o}${i}`:i;d!==null&&typeof d=="object"&&!Array.isArray(d)&&!(d instanceof Date)?Object.assign(r,Ce(d,m,o)):r[m]=d}return r}function zt(t,p="."){const o={};for(const[r,i]of Object.entries(t)){const d=r.split(p);let m=o;for(let u=0;u<d.length-1;u++){const s=d[u];s in m||(m[s]={}),m=m[s]}m[d[d.length-1]]=i}return o}function Rt(t){return Object.entries(t).map(([p,o])=>({id:p,label:o,prop:p}))}function we(t,p){if(!t)return null;let o=t.replace(/^@\//,"");o.startsWith("views/")||(o=`views/${o}`),o.endsWith(".vue")||(o=`${o}.vue`);const r=`/src/${o}`;return p[r]??p["/src/views/common/NotFound.vue"]??null}function Ve(t){const p=new Map,o=[];return t.forEach(r=>p.set(r.name,{...r,children:[]})),t.forEach(r=>{const i=p.get(r.name);if(!r.parent_name)o.push(i);else{const d=p.get(r.parent_name);d?(d.children??(d.children=[]),d.children.push(i)):o.push(i)}}),o}function v(t,p,o){return t.filter(r=>!o||!r.project||r.project===o).map(r=>{var m;const i={path:r.path,name:r.name,meta:{requiresAuth:r.requiresAuth===1,title:r.title,permissions:r.permissions?r.permissions.split(",").map(u=>u.trim()).filter(Boolean):[],params:r.params?r.params.split("&").map(u=>u.trim()).filter(Boolean):[]}},d=we(r.component,p);return d&&(i.component=d),r.redirect&&(i.redirect=r.redirect),(m=r.children)!=null&&m.length&&(i.children=v(r.children,p,o)),i})}function Ft(t,p,o,r){const i=new Map;t.forEach(m=>i.set(m.name,m));const d=m=>{let u=m.parent_name;const s=new Set;for(;u;){if(u===o)return!0;if(s.has(u))return!1;s.add(u);const k=i.get(u);if(!k)return!1;u=k.parent_name}return!1};return t.filter(m=>m.name!==o&&m.is_show===1&&m.component&&p.includes(m.code)&&d(m)&&(!r||!m.project||m.project===r)).sort((m,u)=>m.sorts-u.sorts)[0]}X.configure({showSpinner:!1});const Ne=(...t)=>{},Ee=(...t)=>{},Lt=(...t)=>{console.error("[Router]",...t)};function Jt(t,p){const{getRouteStore:o,getPermissionStore:r,getUserStore:i,isAuthenticated:d,viewModules:m,homeComponent:u,notFoundComponent:s,projectName:k,layoutRouteName:b="Layout",publicPaths:$=["/login","/register"],loginRouteName:x="login",forbiddenRouteName:N="Forbidden",homeRouteName:V="Home",homeRoutePath:M="home",homeTitle:T="首页",noPermissionMessage:E="暂无权限"}=p;let f=!1;function C(g){const S=Ve(g).find(z=>z.name===b),I=S!=null&&S.children?v(S.children,m,k):[];I.forEach(z=>{z.name&&t.hasRoute(z.name)||(t.addRoute(b,z),Ne(`Add route: ${String(z.name)} -> ${z.path}`))}),t.hasRoute(V)||t.addRoute(b,{path:M,name:V,component:u,meta:{title:T}}),t.hasRoute("NotFound")||t.addRoute({path:"/:pathMatch(.*)*",name:"NotFound",component:s}),Ne(`Dynamic routes added: ${I.length}`)}function B(g,A){if(g===V){A();return}t.hasRoute(V)?A({name:V,replace:!0}):A()}return t.beforeEach(async(g,A,S)=>{if(X.start(),d()&&!f)try{const D=o(),F=r();if(await D.initRoutes(),await F.loadUserPermissions(),C(D.backendRoutes),f=!0,g.path==="/"||g.path===""){B(g.name,S);return}if(g.name===b){B(g.name,S);return}const L=D.backendRoutes.find(W=>W.name===g.name);if(L&&!F.routePermissions.includes(L.code)){Ee("No route permission:",g.path),S({name:N,replace:!0});return}S({path:g.path,query:g.query,hash:g.hash,replace:!0});return}catch(D){Lt("Failed to load route permissions:",D),f=!1,await i().logout(),S({name:x,replace:!0});return}if($.includes(g.path)){d()?S({path:"/",replace:!0}):S();return}if(!d()){S({name:x,replace:!0});return}const I=r(),z=o();if(g.name===V){S();return}if(I.routePermissions.length===0){g.path!=="/"?(a.ElMessage.warning(E),S({path:"/",replace:!0})):B(g.name,S);return}if(g.path==="/"){B(g.name,S);return}if(g.name===b){B(g.name,S);return}const y=z.backendRoutes.find(D=>D.name===g.name);if(y&&!I.routePermissions.includes(y.code)){Ee("No route permission:",g.path),S({name:N,replace:!0});return}S()}),t.afterEach(()=>X.done()),{resetRouterState:()=>{f=!1}}}const qt=[oe,ne,U,re,ie,Z,G,ce,ge,ue,ye],Ot={install:t=>{qt.forEach(p=>{t.component(p.name??p.__name??"",p)})}};w.JAdminLayout=ce,w.JButton=oe,w.JIconRender=U,w.JImportExcel=ie,w.JProductDetailDialog=ge,w.JSearchHeader=re,w.JSearchInputDialog=ye,w.JSideMenuItem=G,w.JSidebar=Z,w.JSkuLink=ue,w.JUploadImg=ne,w.buildRouteTree=Ve,w.createRouterGuard=Jt,w.deepClone=P,w.default=Ot,w.filterEmpty=be,w.findFirstAllowedRoute=Ft,w.flatten=Ce,w.getComponentImport=we,w.omit=At,w.pick=Mt,w.toCamelCase=_e,w.toSnakeCase=ke,w.toTableColumns=Rt,w.transformBackendRoutes=v,w.unflatten=zt,w.useProductDetailDialog=jt,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
3
  //# sourceMappingURL=index.umd.cjs.map