joy-admin-components 0.1.30 → 0.1.35

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 +1 @@
1
- (function(h,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("element-plus"),require("vue"),require("lodash"),require("vue-i18n"),require("crypto-js"),require("file-saver"),require("exceljs"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","lodash","vue-i18n","crypto-js","file-saver","exceljs","dayjs"],O):(h=typeof globalThis<"u"?globalThis:h||self,O(h.JoyAdminComponents={},h.ElementPlus,h.Vue,h._,h.VueI18n,h.CryptoJS,h.fileSaver,h.ExcelJS,h.dayjs))})(this,function(h,O,e,U,A,z,ee,R,H){"use strict";const te=e.defineComponent({name:"LayOutForm",setup(o,{slots:t,attrs:n,emit:a}){const r=e.ref(null),u=()=>t.default?t.default().filter(f=>f.type!==Symbol.for("v-cmt")).map(f=>f.type===Symbol.for("v-fgt")?f.children:f).flat().map(f=>{var i;return e.h(O.ElCol,{span:((i=f.props)==null?void 0:i.span)||24},{default:()=>f})}):null;e.onMounted(()=>{a("ref",r.value)});function l(){return e.h(O.ElForm,{...n,ref:r},()=>e.h(O.ElRow,{gutter:n.gutter??20},{default:()=>u()}))}return l}}),Re="",I=(o,t)=>{const n=o.__vccOpts||o;for(const[a,r]of t)n[a]=r;return n},q=I({__name:"index",props:e.mergeModels({api:{type:Function},showCheckAll:{type:Boolean,default:!0},optionClick:{type:Function},maxLimit:{type:Number,default:void 0},minLimit:{type:Number,default:void 0},data:{type:Array},labelValue:{type:Object,default:()=>({label:"label",labelEn:"labelEn",value:"value"})},changeLocal:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["success","change"],["update:modelValue"]),setup(o,{emit:t}){const n=o,a=e.useAttrs(),{t:r,locale:u}=A.useI18n(),l=e.useModel(o,"modelValue"),f=e.computed({get(){if(a.multiple==null||l.value==null)return!1;let d=n.data?n.data:k.value,s=U.difference(d.map(y=>a["value-key"]?y:y[n.labelValue.value]),l.value).length==0;return l.value.length==d.length&&s},set(d){return d}}),i=t,k=e.ref([]),C=async()=>{const{data:d}=await n.api();k.value=[...d],i("success",k)};n.api&&C();const S=n.labelValue.label.split("-"),m=d=>{if(S.length==1){if(n.changeLocal)return r(d[n.labelValue.label]);let s=u.value=="en_us"?d[n.labelValue.labelEn||"i18nName"]:d[n.labelValue.label];return s=s||d[n.labelValue.label],s}else{let s=[];return S.forEach(y=>{s.push(d[y])}),s.join("-")}};function w(d){let s=n.data?n.data:k.value;l.value=d?s.map(y=>a["value-key"]?y:y[n.labelValue.value]):[],e.nextTick(()=>{i("change",l.value)})}function g(d){n.optionClick&&n.optionClick(d),n.optionClick&&i("change",a["value-key"]?d:d[n.labelValue.value])}function c(d){i("change",d)}function p(d){return a.multiple!=null&&a.multiple!=!1&&n.maxLimit>0?l.value.length>=n.maxLimit&&!l.value.includes(d[n.labelValue.value]):a.multiple!=null&&a.multiple!=!1&&n.minLimit>0?l.value.length<=n.minLimit&&l.value.includes(d[n.labelValue.value]):!1}return(d,s)=>{const y=e.resolveComponent("el-checkbox"),x=e.resolveComponent("el-option"),b=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(b,e.mergeProps({modelValue:l.value,"onUpdate:modelValue":s[1]||(s[1]=T=>l.value=T)},e.unref(a),{filterable:"","collapse-tags":"","collapse-tags-tooltip":"",clearable:"",onClear:c,onChange:c}),{default:e.withCtx(()=>[e.unref(a).multiple!=null&&e.unref(a).multiple!=!1&&o.showCheckAll?e.renderSlot(d.$slots,"header",{key:0},()=>[e.createVNode(y,{class:"mgl20",modelValue:f.value,"onUpdate:modelValue":s[0]||(s[0]=T=>f.value=T),onChange:w},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("quan-xuan")),1)]),_:1},8,["modelValue"])],!0):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.data?o.data:k.value,(T,V)=>(e.openBlock(),e.createBlock(x,{key:V,disabled:p(T),label:m(T),onClick:e.withModifiers(D=>g(T),["stop"]),value:e.unref(a)["value-key"]?T:T[o.labelValue.value]},null,8,["disabled","label","onClick","value"]))),128))]),_:3},16,["modelValue"])}}},[["__scopeId","data-v-02dd2f72"]]),ne={__name:"index",emits:["ok","no"],setup(o,{emit:t}){const n=t,a=U.debounce(()=>{n("ok")},500);function r(){n("no")}return(u,l)=>{const f=e.resolveComponent("el-link"),i=e.resolveComponent("el-popconfirm");return e.openBlock(),e.createBlock(i,e.mergeProps(u.$attrs,{onConfirm:e.unref(a),onCancel:r}),{reference:e.withCtx(()=>[e.createVNode(f,{underline:"never",type:u.$attrs.type},{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default")]),_:3},8,["type"])]),_:3},16,["onConfirm"])}}},qe="",oe=["accept"],ae=I({__name:"index",props:{accept:{type:String,default:".xlsx,.xls"},loading:{type:Boolean,default:!1}},emits:["fileChange"],setup(o,{emit:t}){const n=t,a=e.ref(null);function r(u){let l=u.target.files[0];n("fileChange",l),a.value.value=null}return(u,l)=>{const f=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("span",null,[e.createVNode(f,{loading:o.loading,class:"mgr10",onClick:l[0]||(l[0]=i=>a.value.click())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$t("dao-ru")),1)]),_:1},8,["loading"]),e.createElementVNode("input",{onChange:r,ref_key:"input",ref:a,accept:o.accept,style:{position:"absolute",width:"0px",height:"0px",opacity:"0"},type:"file"},null,40,oe)])}}},[["__scopeId","data-v-5f1449ad"]]),Ze="",re=e.defineComponent({props:{name:{tyepe:String,required:!0}}});function le(o,t,n,a,r,u){const l=e.resolveComponent("el-icon");return e.openBlock(),e.createBlock(l,{class:"cmp-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.name)))]),_:1})}const K=I(re,[["render",le],["__scopeId","data-v-733f9daa"]]),We="",ie={key:0},se={class:"btns"},ce={class:"left"},ue={class:"right"},Z=I({__name:"index",props:{form:{type:Object,required:!0}},emits:["confirm","reset"],setup(o,{emit:t}){const n=t,a=e.ref(!0),r=e.ref(null),{t:u}=A.useI18n(),l=e.computed(()=>a.value?u("guan-bi"):u("zhan-kai"));function f(){n("confirm")}function i(){n("reset")}function k(){n("confirm")}return(C,S)=>{const m=e.resolveComponent("el-input"),w=e.resolveComponent("el-date-picker"),g=e.resolveComponent("el-form-item"),c=e.resolveComponent("el-form"),p=e.resolveComponent("el-link"),d=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:"searchBar-container mgt10 mgb10",onKeydown:e.withKeys(f,["enter"])},[e.createElementVNode("div",{class:"searchBar",style:e.normalizeStyle({height:a.value?"auto":"42px"})},[e.createVNode(c,{inline:"",model:o.form.data},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.form.items.filter(s=>!s.hidden),s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.key},[s.type=="br"?(e.openBlock(),e.createElementBlock("br",ie)):(e.openBlock(),e.createBlock(g,{key:1,label:s.name},{default:e.withCtx(()=>{var y,x;return[s.type==="input"?(e.openBlock(),e.createBlock(m,{key:0,modelValue:s.value,"onUpdate:modelValue":b=>s.value=b,class:e.normalizeClass(((y=s.option)==null?void 0:y.class)||"w150"),placeholder:C.$t("qing-shu-ru"),clearable:""},null,8,["modelValue","onUpdate:modelValue","class","placeholder"])):s.type==="custom"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.render),{key:1})):e.createCommentVNode("",!0),s.type==="select"?(e.openBlock(),e.createBlock(q,e.mergeProps({key:2,class:((x=s.option)==null?void 0:x.class)||"w150",modelValue:s.value,"onUpdate:modelValue":b=>s.value=b},{ref_for:!0},s.option,{onChange:f,onClear:f}),null,16,["class","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),s.type==="date"?(e.openBlock(),e.createBlock(w,{key:3,class:e.normalizeClass({datetimerange:"w300",daterange:"w200"}[s.dateType]||"w100"),modelValue:s.value,"onUpdate:modelValue":b=>s.value=b,"value-format":{datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"}[s.dateType]||"YYYY-MM-DD",type:s.dateType||"date",onFocus:b=>r.value=s,onChange:b=>k(),placeholder:C.$t("qing-xuan-ze"),"start-placeholder":C.$t("kai-shi-shi-jian"),"end-placeholder":C.$t("jie-shu-shi-jian")},null,8,["class","modelValue","onUpdate:modelValue","value-format","type","onFocus","onChange","placeholder","start-placeholder","end-placeholder"])):e.createCommentVNode("",!0)]}),_:2},1032,["label"]))],64))),128))]),_:1},8,["model"])],4),e.createElementVNode("div",se,[e.createElementVNode("div",ce,[e.renderSlot(C.$slots,"table-header-left",{},void 0,!0)]),e.createElementVNode("div",ue,[e.createVNode(p,{underline:"never",class:"mgr10",onClick:S[0]||(S[0]=s=>a.value=!a.value)},{default:e.withCtx(()=>[e.createVNode(K,{name:a.value?"ArrowUp":"ArrowDown"},null,8,["name"]),e.createTextVNode(" "+e.toDisplayString(l.value),1)]),_:1}),e.createVNode(d,{type:"primary",onClick:f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.$t("shai-xuan")),1)]),_:1}),e.createVNode(d,{type:"primary",onClick:i},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.$t("chong-zhi")),1)]),_:1}),e.renderSlot(C.$slots,"btn",{},void 0,!0)])])],32)}}},[["__scopeId","data-v-f3f60f9c"]]);function fe(o){return o?Array.isArray(o)?o:o.split(",").map(t=>t.trim()).filter(Boolean):[]}function L(o){let t={};return o.forEach(n=>{const{key:a,type:r,option:u={},value:l,dateType:f,toArr:i}=n;if(r=="input"&&(u!=null&&u.multiple))t[a]=fe(l);else if(r=="date")if(f.includes("range")){const[k,C]=a;let[S,m]=l||[];S&&f=="daterange"&&(S=O.dayjs(S).format("YYYY-MM-DD 00:00:00"),m=O.dayjs(m).format("YYYY-MM-DD 23:59:59")),t[k]=S,t[C]=m}else t[a]=l;else r=="select"?t[a]=i?[l]:l:t[a]=l}),t}const Qe="",de={class:"center"},he=I({__name:"index",props:{id:{type:String,required:!0},loading:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},searchForm:{type:Object,default:()=>({items:[],selections:[],showSearch:!1,showPage:!1,showShadow:!1,showCheckBox:!1})},api:{type:Function},data:{type:Array},tableConfig:{type:Object,default:()=>({})}},setup(o,{expose:t}){const{t:n,locale:a}=A.useI18n(),r=o,u=e.ref(!1),l=e.ref([]),f=U.cloneDeep(r.searchForm.items),i=e.reactive({pageNo:1,pageSize:10,total:0}),k=e.ref(null),C=e.ref(450),S=U.debounce(()=>{e.nextTick(()=>{if(!k.value)return;const $=k.value.getBoundingClientRect(),B=window.innerHeight,v=$.top,N=100,Y=B-v-N,P=200;C.value=Math.max(Y,P)})},100),m=()=>{S()};e.onMounted(()=>{S(),window.addEventListener("resize",m)}),e.onUnmounted(()=>{window.removeEventListener("resize",m)});const w=e.computed(()=>b.value.height||C.value);async function g(_){const{dataFormat:$}=r.tableConfig;u.value=!0;const{code:B,data:v={}}=await r.api(_).finally(()=>{u.value=!1,r.searchForm.selections=[]});if(B==200){let N=v.rows||[];l.value=$?$(N):N,i.total=v.totalRows||0}}function c(_={}){g({...i,...L(r.searchForm.items),..._})}async function p(){const{reset:_}=r.tableConfig;r.searchForm.items.forEach($=>{const B=f.find(v=>v.key==$.key);B&&($.value=B.value)}),_&&await _(),c()}r.api&&r.immediate&&c();function d(){return{...i,...L(r.searchForm.items)}}const s=e.ref(null);t({tableRef:s,getList:c,getPrm:d,calculateTableHeight:S});const y=e.reactive({storage:!0}),x=e.reactive({drag:!0,resizable:!0,maxFixedSize:0}),b=e.computed(()=>{const{customConfig:_,columnConfig:$,...B}=r.tableConfig;return{headerAlign:"left",align:"center",customConfig:{...y,..._},"column-config":{...x,...$},"virtual-x-config":{enabled:!1,scrollToLeftOnChange:!0},"virtual-y-config":{enabled:!0,gt:100},...B}}),T=_=>{i.pageNo=_,g({...i,...L(r.searchForm.items)})},V=_=>{i.pageSize=_,i.pageNo=1,g({...i,...L(r.searchForm.items)})};function D(){const _=s.value.getCheckboxRecords();r.searchForm.selections=_}const E=_=>{const $=s.value;if($){$.toggleCheckboxRow(_);const B=s.value.getCheckboxRecords();r.searchForm.selections=B}};return(_,$)=>{const B=e.resolveComponent("el-button"),v=e.resolveComponent("el-checkbox"),N=e.resolveComponent("el-text"),Y=e.resolveComponent("vxe-column"),P=e.resolveComponent("VxeTable"),je=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({box:o.searchForm.showShadow})},[o.searchForm.showSearch?(e.openBlock(),e.createBlock(Z,{key:0,form:o.searchForm,onReset:p,onConfirm:$[1]||($[1]=F=>c())},{btn:e.withCtx(()=>[e.renderSlot(_.$slots,"search-bar-btn",{},void 0,!0),e.createVNode(B,{round:"",onClick:$[0]||($[0]=F=>s.value.openCustom())},{default:e.withCtx(()=>[e.createVNode(K,{name:"Tools"})]),_:1})]),_:3},8,["form"])):e.createCommentVNode("",!0),e.renderSlot(_.$slots,"table-header-left",{},void 0,!0),e.createElementVNode("div",{ref_key:"tableContentRef",ref:k},[e.createVNode(P,e.mergeProps({id:o.id,ref_key:"tableRef",ref:s,loading:o.loading||u.value,data:o.api?l.value:o.data},b.value,{height:w.value,onCheckboxChange:D,onCheckboxAll:D,border:""}),{default:e.withCtx(()=>[o.searchForm.showCheckBox?(e.openBlock(),e.createBlock(Y,{key:0,type:"checkbox",width:e.unref(a)=="zh_cn"?80:150,fixed:"left",title:_.$t("xu-hao")},{checkbox:e.withCtx(({rowIndex:F,row:J,checked:Ye,disabled:M,indeterminate:Je})=>[e.createElementVNode("div",de,[Ye?(e.openBlock(),e.createBlock(v,{key:0,checked:!0,disabled:M,size:"default",onClick:e.withModifiers(Pe=>!M&&E(J),["stop"])},null,8,["disabled","onClick"])):(e.openBlock(),e.createBlock(v,{key:1,disabled:M,checked:!1,size:"default",onClick:e.withModifiers(Pe=>!M&&E(J),["stop"])},null,8,["disabled","onClick"])),e.createVNode(N,{type:"info",class:"mgl5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(F+1),1)]),_:2},1024)])]),_:1},8,["width","title"])):e.createCommentVNode("",!0),e.renderSlot(_.$slots,"default",{},void 0,!0)]),_:3},16,["id","loading","data","height"])],512),o.searchForm.showPage?(e.openBlock(),e.createBlock(je,{key:1,"current-page":i.pageNo,"onUpdate:currentPage":$[2]||($[2]=F=>i.pageNo=F),class:"myPagination mgt10",background:"",layout:"total, sizes, prev, pager, next",total:i.total,"page-size":i.pageSize,"page-sizes":[10,50,100,500],onCurrentChange:T,onSizeChange:V},null,8,["current-page","total","page-size"])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-7b74503d"]]);function me(o,t={}){const n={inForm:!0,required:!0,...t},a={phone:/^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,password:/(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/,email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/}[o],{inForm:r,value:u,required:l,msg:f="请输入正确内容"}=n;return r?function(i,k,C){if(l){a.test(k)?C():C(new Error(f));return}k&&!a.test(k)?C(new Error(f)):C()}:a.test(u)}const ge={encrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=z.enc.Utf8.parse(t),a=z.enc.Utf8.parse(o),r=z.AES.encrypt(a,n,{mode:z.mode.ECB,padding:z.pad.Pkcs7});return r.toString()},decrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=z.enc.Utf8.parse(t),a=z.AES.decrypt(o,n,{mode:z.mode.ECB,padding:z.pad.Pkcs7});return z.enc.Utf8.stringify(a).toString()}};var W=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Q={exports:{}};(function(o,t){(function(n,a){o.exports=a()})(W,function(){var n="minute",a=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(u,l,f){var i=l.prototype;f.utc=function(c){var p={date:c,utc:!0,args:arguments};return new l(p)},i.utc=function(c){var p=f(this.toDate(),{locale:this.$L,utc:!0});return c?p.add(this.utcOffset(),n):p},i.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var k=i.parse;i.parse=function(c){c.utc&&(this.$u=!0),this.$utils().u(c.$offset)||(this.$offset=c.$offset),k.call(this,c)};var C=i.init;i.init=function(){if(this.$u){var c=this.$d;this.$y=c.getUTCFullYear(),this.$M=c.getUTCMonth(),this.$D=c.getUTCDate(),this.$W=c.getUTCDay(),this.$H=c.getUTCHours(),this.$m=c.getUTCMinutes(),this.$s=c.getUTCSeconds(),this.$ms=c.getUTCMilliseconds()}else C.call(this)};var S=i.utcOffset;i.utcOffset=function(c,p){var d=this.$utils().u;if(d(c))return this.$u?0:d(this.$offset)?S.call(this):this.$offset;if(typeof c=="string"&&(c=function(b){b===void 0&&(b="");var T=b.match(a);if(!T)return null;var V=(""+T[0]).match(r)||["-",0,0],D=V[0],E=60*+V[1]+ +V[2];return E===0?0:D==="+"?E:-E}(c),c===null))return this;var s=Math.abs(c)<=16?60*c:c;if(s===0)return this.utc(p);var y=this.clone();if(p)return y.$offset=s,y.$u=!1,y;var x=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(y=this.local().add(s+x,n)).$offset=s,y.$x.$localOffset=x,y};var m=i.format;i.format=function(c){var p=c||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return m.call(this,p)},i.valueOf=function(){var c=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*c},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var w=i.toDate;i.toDate=function(c){return c==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():w.call(this)};var g=i.diff;i.diff=function(c,p,d){if(c&&this.$u===c.$u)return g.call(this,c,p,d);var s=this.local(),y=f(c).local();return g.call(s,y,p,d)}}})})(Q);var pe=Q.exports;const ye=G(pe);var X={exports:{}};(function(o,t){(function(n,a){o.exports=a()})(W,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},a={};return function(r,u,l){var f,i=function(m,w,g){g===void 0&&(g={});var c=new Date(m),p=function(d,s){s===void 0&&(s={});var y=s.timeZoneName||"short",x=d+"|"+y,b=a[x];return b||(b=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:d,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:y}),a[x]=b),b}(w,g);return p.formatToParts(c)},k=function(m,w){for(var g=i(m,w),c=[],p=0;p<g.length;p+=1){var d=g[p],s=d.type,y=d.value,x=n[s];x>=0&&(c[x]=parseInt(y,10))}var b=c[3],T=b===24?0:b,V=c[0]+"-"+c[1]+"-"+c[2]+" "+T+":"+c[4]+":"+c[5]+":000",D=+m;return(l.utc(V).valueOf()-(D-=D%1e3))/6e4},C=u.prototype;C.tz=function(m,w){m===void 0&&(m=f);var g,c=this.utcOffset(),p=this.toDate(),d=p.toLocaleString("en-US",{timeZone:m}),s=Math.round((p-new Date(d))/1e3/60),y=15*-Math.round(p.getTimezoneOffset()/15)-s;if(!Number(y))g=this.utcOffset(0,w);else if(g=l(d,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(y,!0),w){var x=g.utcOffset();g=g.add(c-x,"minute")}return g.$x.$timezone=m,g},C.offsetName=function(m){var w=this.$x.$timezone||l.tz.guess(),g=i(this.valueOf(),w,{timeZoneName:m}).find(function(c){return c.type.toLowerCase()==="timezonename"});return g&&g.value};var S=C.startOf;C.startOf=function(m,w){if(!this.$x||!this.$x.$timezone)return S.call(this,m,w);var g=l(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return S.call(g,m,w).tz(this.$x.$timezone,!0)},l.tz=function(m,w,g){var c=g&&w,p=g||w||f,d=k(+l(),p);if(typeof m!="string")return l(m).tz(p);var s=function(T,V,D){var E=T-60*V*1e3,_=k(E,D);if(V===_)return[E,V];var $=k(E-=60*(_-V)*1e3,D);return _===$?[E,_]:[T-60*Math.min(_,$)*1e3,Math.max(_,$)]}(l.utc(m,c).valueOf(),d,p),y=s[0],x=s[1],b=l(y).utcOffset(x);return b.$x.$timezone=p,b},l.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},l.tz.setDefault=function(m){f=m}}})})(X);var Ce=X.exports;const ke=G(Ce);H.extend(ye),H.extend(ke);async function _e(o,t){const{fields:n,range:a=1}=t;if(!n)throw new Error("请输入列字段映射");let r=new R.Workbook;await r.xlsx.load(o);const u={};return r.eachSheet(function(l,f){const i=[];l.eachRow(function(k,C){if(C>a){let S={},m=!0;Object.keys(n).forEach(w=>{const g=k.getCell(n[w]).value;S[w]=g,g&&(m=!1)}),m||i.push(S)}}),u[l._name]=i}),r=null,u}const be={columnWidth:30};async function we(o,t,n=[],a={}){if(!o||!t)return;const{columnStyle:r}=a,{columnWidth:u}=be;t.forEach(i=>{i.width=i.width?i.width:u});const{workbook:l,worksheet:f}=$e();f.columns=t,f.addRows(n),r&&await Se(l,f,r);try{const i=await l.xlsx.writeBuffer(),k=new File([i],o,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});ee.saveAs(k)}catch(i){console.log(i)}}function $e(){const o=new R.Workbook;o.creator="distributor System",o.lastModifiedBy="distributor System",o.created=new Date,o.modified=new Date,o.lastPrinted=new Date;const t=o.addWorksheet("Sheet1");return{workbook:o,worksheet:t}}async function Se(o,t,n){const a=Object.keys(n);for(const r of a){const u=n[r],{type:l}=u;switch(l){case"IMG":await xe(o,t,r);break}}}async function xe(o,t,n,a){const r=t.getColumn(n),u=r.values;t.getColumn(n).width=20,t.eachRow((l,f)=>{f>1&&(l.height=40)});for(let l=0,f=u.length;l<f;l++){if(l<2)continue;let i=u[l];i&&(t.getCell(r.letter+l).value="",await Te(o,t,i,{width:100,height:50,col:r._number-1,row:l-1}))}}async function Te(o,t,n,a){const{col:r,row:u,width:l,height:f}=a,{success:i,base64:k}=await Ve(n,.3);if(i){const C=o.addImage({base64:k,extension:"jpeg"});t.addImage(C,{tl:{col:r,row:u},ext:{width:l,height:f}})}}function Ve(o,t=1){const n=new Image;return n.setAttribute("crossOrigin","anonymous"),n.crossOrigin="anonymous",n.src=o,new Promise((a,r)=>{n.onload=()=>{const u=document.createElement("canvas");u.width=n.width,u.height=n.height,u.getContext("2d").drawImage(n,0,0,u.width,u.height),a({success:!0,base64:u.toDataURL("image/jpeg",t)})},n.onerror=()=>{a({success:!1})}})}function Be(o){if(o<26)return String.fromCharCode(65+o);{const t=String.fromCharCode(65+Math.floor((o-26)/26)),n=String.fromCharCode(65+(o-26)%26);return t+n}}class De{constructor(t={}){this.config={clientCode:t.clientCode||"one-portal",casServerUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com/api`,casPortalUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com`,serviceUrl:t.serviceUrl||window.location.origin+"/cas/callback",tokenKey:t.tokenKey||"one_portal_token",userKey:t.userKey||"one_portal_user",debug:t.debug||!1,autoLogin:t.autoLogin!==!1,loginCallback:t.loginCallback||null,logoutCallback:t.logoutCallback||null,errorCallback:t.errorCallback||null},this.token=null,this.user=null,this.init()}init(){this.log("OnePortal CAS SDK 初始化中..."),this.loadFromStorage();const n=new URLSearchParams(window.location.search).get("ticket");this.isLoggedIn()&&this.config.loginCallback?this.config.loginCallback(this.user,this.token):n?(this.log("检测到ST票据:",n),this.validateTicket(n)):this.config.autoLogin&&!this.isLoggedIn()&&(this.log("用户未登录,准备跳转到CAS登录页面"),this.login())}loadFromStorage(){try{this.token=localStorage.getItem(this.config.tokenKey);const t=localStorage.getItem(this.config.userKey);t&&(this.user=JSON.parse(t)),this.log("从本地存储加载数据:",{token:!!this.token,user:!!this.user})}catch(t){this.log("加载本地存储数据失败:",t)}}saveToStorage(){try{this.token&&localStorage.setItem(this.config.tokenKey,this.token),this.user&&localStorage.setItem(this.config.userKey,JSON.stringify(this.user)),this.log("数据已保存到本地存储")}catch(t){this.log("保存到本地存储失败:",t)}}clearStorage(){try{localStorage.removeItem(this.config.tokenKey),localStorage.removeItem(this.config.userKey),this.log("本地存储已清除")}catch(t){this.log("清除本地存储失败:",t)}}isLoggedIn(){return!!(this.token&&this.user)}getUser(){return this.user}getToken(){return this.token}login(){const t=`${this.config.casPortalUrl}?appCode=${this.config.clientCode}&redirectUrl=${encodeURIComponent(this.config.serviceUrl)}`;this.log("跳转到CAS登录页面:",t),window.location.href=t}async validateTicket(t){try{this.log("验证ST票据:",t);const n=await fetch(`${this.config.casServerUrl}/auth/validateST?ticket=${t}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);const a=await n.json();if(a.success&&a.data)return this.token=a.data.token,this.user=a.data.user,this.saveToStorage(),this.clearTicketFromUrl(),this.log("ST票据验证成功,用户登录成功:",this.user),this.config.loginCallback&&this.config.loginCallback(this.user,this.token),!0;throw new Error(a.message||"ST票据验证失败")}catch(n){return this.log("ST票据验证失败:",n),this.handleError(n),!1}}clearTicketFromUrl(){const t=new URL(window.location);t.searchParams.delete("ticket"),window.history.replaceState({},document.title,t.toString())}async logout(t=!0){try{if(this.log("用户登出"),this.token)try{await fetch(`${this.config.casServerUrl}/auth/logout`,{method:"POST",headers:{AppId:this.config.clientCode,Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"}})}catch(n){this.log("调用服务端登出接口失败:",n)}this.token=null,this.user=null,this.clearStorage(),this.config.logoutCallback&&this.config.logoutCallback(),t&&this.login()}catch(n){this.log("登出失败:",n),this.handleError(n)}}async request(t,n={}){const a={headers:{"Content-Type":"application/json",...n.headers},...n};a.headers.appId=this.config.clientCode,this.token&&(a.headers.Authorization=`Bearer ${this.token}`);try{const r=await fetch(t,a);return r.status===401?(this.log("Token已过期,需要重新登录"),this.logout(),null):r}catch(r){throw this.log("请求失败:",r),r}}async fetchUserInfo(){try{const t=await this.request(`${this.config.casServerUrl}/auth/user`);if(t&&t.ok){const n=await t.json();if(n.success&&n.data)return this.user=n.data,this.saveToStorage(),this.user}return null}catch(t){return this.log("获取用户信息失败:",t),null}}async refreshToken(){this.log("Token刷新功能暂未实现")}handleError(t){this.log("发生错误:",t),this.config.errorCallback&&this.config.errorCallback(t)}log(...t){this.config.debug&&console.log("[OnePortal CAS SDK]",...t)}checkLoginStatus(){return!this.isLoggedIn()&&this.config.autoLogin?(this.login(),!1):this.isLoggedIn()}setConfig(t,n){this.config[t]=n}getConfig(t){return this.config[t]}}function Ee(o){return new Promise(t=>{setTimeout(()=>{t()},o)})}function ze(o){return JSON.parse(JSON.stringify(o))}function Oe(o){let t=[],n={},a=(r,u)=>Object.prototype.hasOwnProperty.call(r,u);for(const r of o){n[r.id]={...r,children:a(n,r.id)?n[r.id].children:[]};const u=n[r.id];r.pid==-1?t.push(u):(a(n,r.pid)||(n[r.pid]={children:[]}),n[r.pid].children.push(u))}return t}function ve(o,t=" "){return o?o.split(t).filter(n=>n.trim()):[]}class j{constructor(t,n=["label","value","labelEn"]){this.list=t,this.map=new Map(t.map(a=>{let r={...a,label:a[n[0]],value:a[n[1]]};return n[2]&&(r.labelEn=a[n[2]]),[a[n[1]],r]}))}getName(t,n){if(!this.has(t))return"-";const{label:a,labelEn:r}=this.map.get(t);return(n=="zh_cn"?a:r)||a||"-"}getTag(t){if(!this.has(t))return"info";const{tag:n="info"}=this.map.get(t);return n}getItem(t){return this.has(t)?this.map.get(t):null}getColor(t){if(!this.has(t))return null;const{color:n}=this.map.get(t);return n}has(t){return this.map.has(t)}}function Ne(o,t=[],n="i18nName"){if(o.length==0)return new j([]);if(t.length<2)throw new Error("keys 长度必须大于2 默认前两位为 label value ");let a=o.map(r=>{let u={};return n&&(u.labelEn=r[n]),t.forEach((l,f)=>{f===0?u.label=r[l]:f===1?u.value=r[l]:u[l]=r[l]}),u});return new j(a)}function Ie(o){return o?o.replace(/<[^>]+>/g,""):""}function Fe(o){return o?(o.includes("\\\\u")&&(o=o.replace(/\\/g,"")),o.replace(/\\u[\dA-F]{4}/gi,t=>String.fromCharCode(parseInt(t.replace(/\\u/g,""),16)))):""}function Ue(o,t=10){let n=1048576*t;return!(o.size>n)}function Le(o){return Array.from(10).fill(0).map((n,a)=>o+"_"+a)}function Me(o){let t={};return o.map((n,a)=>{let{key:r,option:u,type:l}=n,f=Be(a);u?t[r]=`${f}---option`:l==="image"?t[r]=`${f}---image`:t[r]=f}),t}function Ae(o,t){return t.split(".").reduce((n,a)=>n&&n[a],o)}h.CmpDictionary=q,h.ConfrimButton=ne,h.ImportButton=ae,h.LayOutForm=te,h.ListPage=he,h.OnePortalCasSDK=De,h.SearchBar=Z,h.StatusMap=j,h._toRaw=ze,h.arrToStatusMap=Ne,h.arrayToTree=Oe,h.checkFileSize=Ue,h.creatValidator=me,h.createImportFields=Me,h.createListPageId=Le,h.crypto=ge,h.exportExcel=we,h.getValueBykey=Ae,h.importExcel=_e,h.sleep=Ee,h.stringToArray=ve,h.stripHtmlTags=Ie,h.unicode2Str=Fe,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
1
+ (function(h,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("element-plus"),require("vue"),require("lodash"),require("vue-i18n"),require("crypto-js"),require("file-saver"),require("exceljs"),require("dayjs"),require("vuex")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","lodash","vue-i18n","crypto-js","file-saver","exceljs","dayjs","vuex"],z):(h=typeof globalThis<"u"?globalThis:h||self,z(h.JoyAdminComponents={},h.ElementPlus,h.Vue,h._,h.VueI18n,h.CryptoJS,h.fileSaver,h.ExcelJS,h.dayjs,h.Vuex))})(this,function(h,z,e,N,U,O,oe,q,K,A){"use strict";const ae=e.defineComponent({name:"LayOutForm",setup(o,{slots:t,attrs:n,emit:a}){const r=e.ref(null),i=()=>t.default?t.default().filter(f=>f.type!==Symbol.for("v-cmt")).map(f=>f.type===Symbol.for("v-fgt")?f.children:f).flat().map(f=>{var s;return e.h(z.ElCol,{span:((s=f.props)==null?void 0:s.span)||24},{default:()=>f})}):null;e.onMounted(()=>{a("ref",r.value)});function l(){return e.h(z.ElForm,{...n,ref:r},()=>e.h(z.ElRow,{gutter:n.gutter??20},{default:()=>i()}))}return l}}),nt="",L=(o,t)=>{const n=o.__vccOpts||o;for(const[a,r]of t)n[a]=r;return n},Z=L({__name:"index",props:e.mergeModels({api:{type:Function},showCheckAll:{type:Boolean,default:!0},optionClick:{type:Function},maxLimit:{type:Number,default:void 0},minLimit:{type:Number,default:void 0},data:{type:Array},labelValue:{type:Object,default:()=>({label:"label",labelEn:"labelEn",value:"value"})},changeLocal:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["success","change"],["update:modelValue"]),setup(o,{emit:t}){const n=o,a=e.useAttrs(),{t:r,locale:i}=U.useI18n(),l=e.useModel(o,"modelValue"),f=e.computed({get(){if(a.multiple==null||l.value==null)return!1;let d=n.data?n.data:C.value,c=N.difference(d.map(y=>a["value-key"]?y:y[n.labelValue.value]),l.value).length==0;return l.value.length==d.length&&c},set(d){return d}}),s=t,C=e.ref([]),k=async()=>{const{data:d}=await n.api();C.value=[...d],s("success",C)};n.api&&k();const $=n.labelValue.label.split("-"),g=d=>{if($.length==1){if(n.changeLocal)return r(d[n.labelValue.label]);let c=i.value=="en_us"?d[n.labelValue.labelEn||"i18nName"]:d[n.labelValue.label];return c=c||d[n.labelValue.label],c}else{let c=[];return $.forEach(y=>{c.push(d[y])}),c.join("-")}};function b(d){let c=n.data?n.data:C.value;l.value=d?c.map(y=>a["value-key"]?y:y[n.labelValue.value]):[],e.nextTick(()=>{s("change",l.value)})}function m(d){n.optionClick&&n.optionClick(d),n.optionClick&&s("change",a["value-key"]?d:d[n.labelValue.value])}function u(d){s("change",d)}function p(d){return a.multiple!=null&&a.multiple!=!1&&n.maxLimit>0?l.value.length>=n.maxLimit&&!l.value.includes(d[n.labelValue.value]):a.multiple!=null&&a.multiple!=!1&&n.minLimit>0?l.value.length<=n.minLimit&&l.value.includes(d[n.labelValue.value]):!1}return(d,c)=>{const y=e.resolveComponent("el-checkbox"),S=e.resolveComponent("el-option"),_=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(_,e.mergeProps({modelValue:l.value,"onUpdate:modelValue":c[1]||(c[1]=V=>l.value=V)},e.unref(a),{filterable:"","collapse-tags":"","collapse-tags-tooltip":"",clearable:"",onClear:u,onChange:u}),{default:e.withCtx(()=>[e.unref(a).multiple!=null&&e.unref(a).multiple!=!1&&o.showCheckAll?e.renderSlot(d.$slots,"header",{key:0},()=>[e.createVNode(y,{class:"mgl20",modelValue:f.value,"onUpdate:modelValue":c[0]||(c[0]=V=>f.value=V),onChange:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("quan-xuan")),1)]),_:1},8,["modelValue"])],!0):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.data?o.data:C.value,(V,x)=>(e.openBlock(),e.createBlock(S,{key:x,disabled:p(V),label:g(V),onClick:e.withModifiers(D=>m(V),["stop"]),value:e.unref(a)["value-key"]?V:V[o.labelValue.value]},null,8,["disabled","label","onClick","value"]))),128))]),_:3},16,["modelValue"])}}},[["__scopeId","data-v-02dd2f72"]]),re={__name:"index",emits:["ok","no"],setup(o,{emit:t}){const n=t,a=N.debounce(()=>{n("ok")},500);function r(){n("no")}return(i,l)=>{const f=e.resolveComponent("el-link"),s=e.resolveComponent("el-popconfirm");return e.openBlock(),e.createBlock(s,e.mergeProps(i.$attrs,{onConfirm:e.unref(a),onCancel:r}),{reference:e.withCtx(()=>[e.createVNode(f,{underline:"never",type:i.$attrs.type},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3},8,["type"])]),_:3},16,["onConfirm"])}}},at="",le=["accept"],ie=L({__name:"index",props:{accept:{type:String,default:".xlsx,.xls"},loading:{type:Boolean,default:!1}},emits:["fileChange"],setup(o,{emit:t}){const n=t,a=e.ref(null);function r(i){let l=i.target.files[0];n("fileChange",l),a.value.value=null}return(i,l)=>{const f=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("span",null,[e.createVNode(f,{loading:o.loading,class:"mgr10",onClick:l[0]||(l[0]=s=>a.value.click())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.$t("dao-ru")),1)]),_:1},8,["loading"]),e.createElementVNode("input",{onChange:r,ref_key:"input",ref:a,accept:o.accept,style:{position:"absolute",width:"0px",height:"0px",opacity:"0"},type:"file"},null,40,le)])}}},[["__scopeId","data-v-5f1449ad"]]),lt="",se=e.defineComponent({props:{name:{tyepe:String,required:!0}}});function ce(o,t,n,a,r,i){const l=e.resolveComponent("el-icon");return e.openBlock(),e.createBlock(l,{class:"cmp-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.name)))]),_:1})}const G=L(se,[["render",ce],["__scopeId","data-v-733f9daa"]]),it="",ue={key:0},fe={class:"btns"},de={class:"left"},he={class:"right"},W=L({__name:"index",props:{form:{type:Object,required:!0}},emits:["confirm","reset"],setup(o,{emit:t}){const n=t,a=e.ref(!0),r=e.ref(null),{t:i}=U.useI18n(),l=e.computed(()=>a.value?i("guan-bi"):i("zhan-kai"));function f(){n("confirm")}function s(){n("reset")}function C(){n("confirm")}return(k,$)=>{const g=e.resolveComponent("el-input"),b=e.resolveComponent("el-date-picker"),m=e.resolveComponent("el-form-item"),u=e.resolveComponent("el-form"),p=e.resolveComponent("el-link"),d=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:"searchBar-container mgt10 mgb10",onKeydown:e.withKeys(f,["enter"])},[e.createElementVNode("div",{class:"searchBar",style:e.normalizeStyle({height:a.value?"auto":"42px"})},[e.createVNode(u,{inline:"",model:o.form.data},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.form.items.filter(c=>!c.hidden),c=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c.key},[c.type=="br"?(e.openBlock(),e.createElementBlock("br",ue)):(e.openBlock(),e.createBlock(m,{key:1,label:c.name},{default:e.withCtx(()=>{var y,S;return[c.type==="input"?(e.openBlock(),e.createBlock(g,{key:0,modelValue:c.value,"onUpdate:modelValue":_=>c.value=_,class:e.normalizeClass(((y=c.option)==null?void 0:y.class)||"w150"),placeholder:k.$t("qing-shu-ru"),clearable:""},null,8,["modelValue","onUpdate:modelValue","class","placeholder"])):c.type==="custom"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.render),{key:1})):e.createCommentVNode("",!0),c.type==="select"?(e.openBlock(),e.createBlock(Z,e.mergeProps({key:2,class:((S=c.option)==null?void 0:S.class)||"w150",modelValue:c.value,"onUpdate:modelValue":_=>c.value=_},{ref_for:!0},c.option,{onChange:f,onClear:f}),null,16,["class","modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),c.type==="date"?(e.openBlock(),e.createBlock(b,{key:3,class:e.normalizeClass({datetimerange:"w300",daterange:"w200"}[c.dateType]||"w100"),modelValue:c.value,"onUpdate:modelValue":_=>c.value=_,"value-format":{datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"}[c.dateType]||"YYYY-MM-DD",type:c.dateType||"date",onFocus:_=>r.value=c,onChange:_=>C(),placeholder:k.$t("qing-xuan-ze"),"start-placeholder":k.$t("kai-shi-shi-jian"),"end-placeholder":k.$t("jie-shu-shi-jian")},null,8,["class","modelValue","onUpdate:modelValue","value-format","type","onFocus","onChange","placeholder","start-placeholder","end-placeholder"])):e.createCommentVNode("",!0)]}),_:2},1032,["label"]))],64))),128))]),_:1},8,["model"])],4),e.createElementVNode("div",fe,[e.createElementVNode("div",de,[e.renderSlot(k.$slots,"table-header-left",{},void 0,!0)]),e.createElementVNode("div",he,[e.createVNode(p,{underline:"never",class:"mgr10",onClick:$[0]||($[0]=c=>a.value=!a.value)},{default:e.withCtx(()=>[e.createVNode(G,{name:a.value?"ArrowUp":"ArrowDown"},null,8,["name"]),e.createTextVNode(" "+e.toDisplayString(l.value),1)]),_:1}),e.createVNode(d,{type:"primary",onClick:f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(k.$t("shai-xuan")),1)]),_:1}),e.createVNode(d,{type:"primary",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(k.$t("chong-zhi")),1)]),_:1}),e.renderSlot(k.$slots,"btn",{},void 0,!0)])])],32)}}},[["__scopeId","data-v-f3f60f9c"]]);function me(o){return o?Array.isArray(o)?o:o.split(",").map(t=>t.trim()).filter(Boolean):[]}function v(o){let t={};return o.forEach(n=>{const{key:a,type:r,option:i={},value:l,dateType:f,toArr:s}=n;if(r=="input"&&(i!=null&&i.multiple))t[a]=me(l);else if(r=="date")if(f.includes("range")){const[C,k]=a;let[$,g]=l||[];$&&f=="daterange"&&($=z.dayjs($).format("YYYY-MM-DD 00:00:00"),g=z.dayjs(g).format("YYYY-MM-DD 23:59:59")),t[C]=$,t[k]=g}else t[a]=l;else r=="select"?t[a]=s?[l]:l:t[a]=l}),t}const ct="",pe={class:"center"},ge=L({__name:"index",props:{id:{type:String,required:!0},loading:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},searchForm:{type:Object,default:()=>({items:[],selections:[],showSearch:!1,showPage:!1,showShadow:!1,showCheckBox:!1})},api:{type:Function},data:{type:Array},tableConfig:{type:Object,default:()=>({})}},setup(o,{expose:t}){const{t:n,locale:a}=U.useI18n(),r=o,i=e.ref(!1),l=e.ref([]),f=N.cloneDeep(r.searchForm.items),s=e.reactive({pageNo:1,pageSize:10,total:0}),C=e.ref(null),k=e.ref(450),$=N.debounce(()=>{e.nextTick(()=>{if(!C.value)return;const T=C.value.getBoundingClientRect(),B=window.innerHeight,F=T.top,I=100,Y=B-F-I,H=200;k.value=Math.max(Y,H)})},100),g=()=>{$()};e.onMounted(()=>{$(),window.addEventListener("resize",g)}),e.onUnmounted(()=>{window.removeEventListener("resize",g)});const b=e.computed(()=>_.value.height||k.value);async function m(w){const{dataFormat:T}=r.tableConfig;i.value=!0;const{code:B,data:F={}}=await r.api(w).finally(()=>{i.value=!1,r.searchForm.selections=[]});if(B==200){let I=F.rows||[];l.value=T?T(I):I,s.total=F.totalRows||0}}function u(w={}){m({...s,...v(r.searchForm.items),...w})}async function p(){const{reset:w}=r.tableConfig;r.searchForm.items.forEach(T=>{const B=f.find(F=>F.key==T.key);B&&(T.value=B.value)}),w&&await w(),u()}r.api&&r.immediate&&u();function d(){return{...s,...v(r.searchForm.items)}}const c=e.ref(null);t({tableRef:c,getList:u,getPrm:d,calculateTableHeight:$});const y=e.reactive({storage:!0}),S=e.reactive({drag:!0,resizable:!0,maxFixedSize:0}),_=e.computed(()=>{const{customConfig:w,columnConfig:T,...B}=r.tableConfig;return{headerAlign:"left",align:"center",customConfig:{...y,...w},"column-config":{...S,...T},"virtual-x-config":{enabled:!1,scrollToLeftOnChange:!0},"virtual-y-config":{enabled:!0,gt:100},...B}}),V=w=>{s.pageNo=w,m({...s,...v(r.searchForm.items)})},x=w=>{s.pageSize=w,s.pageNo=1,m({...s,...v(r.searchForm.items)})};function D(){const w=c.value.getCheckboxRecords();r.searchForm.selections=w}const E=w=>{const T=c.value;if(T){T.toggleCheckboxRow(w);const B=c.value.getCheckboxRecords();r.searchForm.selections=B}};return(w,T)=>{const B=e.resolveComponent("el-button"),F=e.resolveComponent("el-checkbox"),I=e.resolveComponent("el-text"),Y=e.resolveComponent("vxe-column"),H=e.resolveComponent("VxeTable"),Je=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({box:o.searchForm.showShadow})},[o.searchForm.showSearch?(e.openBlock(),e.createBlock(W,{key:0,form:o.searchForm,onReset:p,onConfirm:T[1]||(T[1]=M=>u())},{btn:e.withCtx(()=>[e.renderSlot(w.$slots,"search-bar-btn",{},void 0,!0),e.createVNode(B,{round:"",onClick:T[0]||(T[0]=M=>c.value.openCustom())},{default:e.withCtx(()=>[e.createVNode(G,{name:"Tools"})]),_:1})]),_:3},8,["form"])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"table-header-left",{},void 0,!0),e.createElementVNode("div",{ref_key:"tableContentRef",ref:C},[e.createVNode(H,e.mergeProps({id:o.id,ref_key:"tableRef",ref:c,loading:o.loading||i.value,data:o.api?l.value:o.data},_.value,{height:b.value,onCheckboxChange:D,onCheckboxAll:D,border:""}),{default:e.withCtx(()=>[o.searchForm.showCheckBox?(e.openBlock(),e.createBlock(Y,{key:0,type:"checkbox",width:e.unref(a)=="zh_cn"?80:150,fixed:"left",title:w.$t("xu-hao")},{checkbox:e.withCtx(({rowIndex:M,row:ne,checked:et,disabled:j,indeterminate:ft})=>[e.createElementVNode("div",pe,[et?(e.openBlock(),e.createBlock(F,{key:0,checked:!0,disabled:j,size:"default",onClick:e.withModifiers(tt=>!j&&E(ne),["stop"])},null,8,["disabled","onClick"])):(e.openBlock(),e.createBlock(F,{key:1,disabled:j,checked:!1,size:"default",onClick:e.withModifiers(tt=>!j&&E(ne),["stop"])},null,8,["disabled","onClick"])),e.createVNode(I,{type:"info",class:"mgl5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(M+1),1)]),_:2},1024)])]),_:1},8,["width","title"])):e.createCommentVNode("",!0),e.renderSlot(w.$slots,"default",{},void 0,!0)]),_:3},16,["id","loading","data","height"])],512),o.searchForm.showPage?(e.openBlock(),e.createBlock(Je,{key:1,"current-page":s.pageNo,"onUpdate:currentPage":T[2]||(T[2]=M=>s.pageNo=M),class:"myPagination mgt10",background:"",layout:"total, sizes, prev, pager, next",total:s.total,"page-size":s.pageSize,"page-sizes":[10,50,100,500],onCurrentChange:V,onSizeChange:x},null,8,["current-page","total","page-size"])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-7b74503d"]]);function ye(o,t={}){const n={inForm:!0,required:!0,...t},a={phone:/^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,password:/(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/,email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/}[o],{inForm:r,value:i,required:l,msg:f="请输入正确内容"}=n;return r?function(s,C,k){if(l){a.test(C)?k():k(new Error(f));return}C&&!a.test(C)?k(new Error(f)):k()}:a.test(i)}const Ce={encrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=O.enc.Utf8.parse(t),a=O.enc.Utf8.parse(o),r=O.AES.encrypt(a,n,{mode:O.mode.ECB,padding:O.pad.Pkcs7});return r.toString()},decrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=O.enc.Utf8.parse(t),a=O.AES.decrypt(o,n,{mode:O.mode.ECB,padding:O.pad.Pkcs7});return O.enc.Utf8.stringify(a).toString()}};var Q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function X(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var J={exports:{}};(function(o,t){(function(n,a){o.exports=a()})(Q,function(){var n="minute",a=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(i,l,f){var s=l.prototype;f.utc=function(u){var p={date:u,utc:!0,args:arguments};return new l(p)},s.utc=function(u){var p=f(this.toDate(),{locale:this.$L,utc:!0});return u?p.add(this.utcOffset(),n):p},s.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var C=s.parse;s.parse=function(u){u.utc&&(this.$u=!0),this.$utils().u(u.$offset)||(this.$offset=u.$offset),C.call(this,u)};var k=s.init;s.init=function(){if(this.$u){var u=this.$d;this.$y=u.getUTCFullYear(),this.$M=u.getUTCMonth(),this.$D=u.getUTCDate(),this.$W=u.getUTCDay(),this.$H=u.getUTCHours(),this.$m=u.getUTCMinutes(),this.$s=u.getUTCSeconds(),this.$ms=u.getUTCMilliseconds()}else k.call(this)};var $=s.utcOffset;s.utcOffset=function(u,p){var d=this.$utils().u;if(d(u))return this.$u?0:d(this.$offset)?$.call(this):this.$offset;if(typeof u=="string"&&(u=function(_){_===void 0&&(_="");var V=_.match(a);if(!V)return null;var x=(""+V[0]).match(r)||["-",0,0],D=x[0],E=60*+x[1]+ +x[2];return E===0?0:D==="+"?E:-E}(u),u===null))return this;var c=Math.abs(u)<=16?60*u:u;if(c===0)return this.utc(p);var y=this.clone();if(p)return y.$offset=c,y.$u=!1,y;var S=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(y=this.local().add(c+S,n)).$offset=c,y.$x.$localOffset=S,y};var g=s.format;s.format=function(u){var p=u||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,p)},s.valueOf=function(){var u=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*u},s.isUTC=function(){return!!this.$u},s.toISOString=function(){return this.toDate().toISOString()},s.toString=function(){return this.toDate().toUTCString()};var b=s.toDate;s.toDate=function(u){return u==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():b.call(this)};var m=s.diff;s.diff=function(u,p,d){if(u&&this.$u===u.$u)return m.call(this,u,p,d);var c=this.local(),y=f(u).local();return m.call(c,y,p,d)}}})})(J);var ke=J.exports;const be=X(ke);var ee={exports:{}};(function(o,t){(function(n,a){o.exports=a()})(Q,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},a={};return function(r,i,l){var f,s=function(g,b,m){m===void 0&&(m={});var u=new Date(g),p=function(d,c){c===void 0&&(c={});var y=c.timeZoneName||"short",S=d+"|"+y,_=a[S];return _||(_=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:d,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:y}),a[S]=_),_}(b,m);return p.formatToParts(u)},C=function(g,b){for(var m=s(g,b),u=[],p=0;p<m.length;p+=1){var d=m[p],c=d.type,y=d.value,S=n[c];S>=0&&(u[S]=parseInt(y,10))}var _=u[3],V=_===24?0:_,x=u[0]+"-"+u[1]+"-"+u[2]+" "+V+":"+u[4]+":"+u[5]+":000",D=+g;return(l.utc(x).valueOf()-(D-=D%1e3))/6e4},k=i.prototype;k.tz=function(g,b){g===void 0&&(g=f);var m,u=this.utcOffset(),p=this.toDate(),d=p.toLocaleString("en-US",{timeZone:g}),c=Math.round((p-new Date(d))/1e3/60),y=15*-Math.round(p.getTimezoneOffset()/15)-c;if(!Number(y))m=this.utcOffset(0,b);else if(m=l(d,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(y,!0),b){var S=m.utcOffset();m=m.add(u-S,"minute")}return m.$x.$timezone=g,m},k.offsetName=function(g){var b=this.$x.$timezone||l.tz.guess(),m=s(this.valueOf(),b,{timeZoneName:g}).find(function(u){return u.type.toLowerCase()==="timezonename"});return m&&m.value};var $=k.startOf;k.startOf=function(g,b){if(!this.$x||!this.$x.$timezone)return $.call(this,g,b);var m=l(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return $.call(m,g,b).tz(this.$x.$timezone,!0)},l.tz=function(g,b,m){var u=m&&b,p=m||b||f,d=C(+l(),p);if(typeof g!="string")return l(g).tz(p);var c=function(V,x,D){var E=V-60*x*1e3,w=C(E,D);if(x===w)return[E,x];var T=C(E-=60*(w-x)*1e3,D);return w===T?[E,w]:[V-60*Math.min(w,T)*1e3,Math.max(w,T)]}(l.utc(g,u).valueOf(),d,p),y=c[0],S=c[1],_=l(y).utcOffset(S);return _.$x.$timezone=p,_},l.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},l.tz.setDefault=function(g){f=g}}})})(ee);var we=ee.exports;const _e=X(we);K.extend(be),K.extend(_e);async function $e(o,t){const{fields:n,range:a=1}=t;if(!n)throw new Error("请输入列字段映射");let r=new q.Workbook;await r.xlsx.load(o);const i={};return r.eachSheet(function(l,f){const s=[];l.eachRow(function(C,k){if(k>a){let $={},g=!0;Object.keys(n).forEach(b=>{const m=C.getCell(n[b]).value;$[b]=m,m&&(g=!1)}),g||s.push($)}}),i[l._name]=s}),r=null,i}const Se={columnWidth:30};async function Te(o,t,n=[],a={}){if(!o||!t)return;const{columnStyle:r}=a,{columnWidth:i}=Se;t.forEach(s=>{s.width=s.width?s.width:i});const{workbook:l,worksheet:f}=Ve();f.columns=t,f.addRows(n),r&&await xe(l,f,r);try{const s=await l.xlsx.writeBuffer(),C=new File([s],o,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});oe.saveAs(C)}catch(s){console.log(s)}}function Ve(){const o=new q.Workbook;o.creator="distributor System",o.lastModifiedBy="distributor System",o.created=new Date,o.modified=new Date,o.lastPrinted=new Date;const t=o.addWorksheet("Sheet1");return{workbook:o,worksheet:t}}async function xe(o,t,n){const a=Object.keys(n);for(const r of a){const i=n[r],{type:l}=i;switch(l){case"IMG":await Be(o,t,r);break}}}async function Be(o,t,n,a){const r=t.getColumn(n),i=r.values;t.getColumn(n).width=20,t.eachRow((l,f)=>{f>1&&(l.height=40)});for(let l=0,f=i.length;l<f;l++){if(l<2)continue;let s=i[l];s&&(t.getCell(r.letter+l).value="",await De(o,t,s,{width:100,height:50,col:r._number-1,row:l-1}))}}async function De(o,t,n,a){const{col:r,row:i,width:l,height:f}=a,{success:s,base64:C}=await Ee(n,.3);if(s){const k=o.addImage({base64:C,extension:"jpeg"});t.addImage(k,{tl:{col:r,row:i},ext:{width:l,height:f}})}}function Ee(o,t=1){const n=new Image;return n.setAttribute("crossOrigin","anonymous"),n.crossOrigin="anonymous",n.src=o,new Promise((a,r)=>{n.onload=()=>{const i=document.createElement("canvas");i.width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0,i.width,i.height),a({success:!0,base64:i.toDataURL("image/jpeg",t)})},n.onerror=()=>{a({success:!1})}})}function Oe(o){if(o<26)return String.fromCharCode(65+o);{const t=String.fromCharCode(65+Math.floor((o-26)/26)),n=String.fromCharCode(65+(o-26)%26);return t+n}}class ze{constructor(t={}){this.config={clientCode:t.clientCode||"one-portal",casServerUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com/api`,casPortalUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com`,serviceUrl:t.serviceUrl||window.location.origin+"/cas/callback",tokenKey:t.tokenKey||"one_portal_token",userKey:t.userKey||"one_portal_user",debug:t.debug||!1,autoLogin:t.autoLogin!==!1,loginCallback:t.loginCallback||null,logoutCallback:t.logoutCallback||null,errorCallback:t.errorCallback||null},this.token=null,this.user=null,this.init()}init(){this.log("OnePortal CAS SDK 初始化中..."),this.loadFromStorage();const n=new URLSearchParams(window.location.search).get("ticket");this.isLoggedIn()&&this.config.loginCallback?this.config.loginCallback(this.user,this.token):n?(this.log("检测到ST票据:",n),this.validateTicket(n)):this.config.autoLogin&&!this.isLoggedIn()&&(this.log("用户未登录,准备跳转到CAS登录页面"),this.login())}loadFromStorage(){try{this.token=localStorage.getItem(this.config.tokenKey);const t=localStorage.getItem(this.config.userKey);t&&(this.user=JSON.parse(t)),this.log("从本地存储加载数据:",{token:!!this.token,user:!!this.user})}catch(t){this.log("加载本地存储数据失败:",t)}}saveToStorage(){try{this.token&&localStorage.setItem(this.config.tokenKey,this.token),this.user&&localStorage.setItem(this.config.userKey,JSON.stringify(this.user)),this.log("数据已保存到本地存储")}catch(t){this.log("保存到本地存储失败:",t)}}clearStorage(){try{localStorage.removeItem(this.config.tokenKey),localStorage.removeItem(this.config.userKey),this.log("本地存储已清除")}catch(t){this.log("清除本地存储失败:",t)}}isLoggedIn(){return!!(this.token&&this.user)}getUser(){return this.user}getToken(){return this.token}login(){const t=`${this.config.casPortalUrl}?appCode=${this.config.clientCode}&redirectUrl=${encodeURIComponent(this.config.serviceUrl)}`;this.log("跳转到CAS登录页面:",t),window.location.href=t}async validateTicket(t){try{this.log("验证ST票据:",t);const n=await fetch(`${this.config.casServerUrl}/auth/validateST?ticket=${t}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);const a=await n.json();if(a.success&&a.data)return this.token=a.data.token,this.user=a.data.user,this.saveToStorage(),this.clearTicketFromUrl(),this.log("ST票据验证成功,用户登录成功:",this.user),this.config.loginCallback&&this.config.loginCallback(this.user,this.token),!0;throw new Error(a.message||"ST票据验证失败")}catch(n){return this.log("ST票据验证失败:",n),this.handleError(n),!1}}clearTicketFromUrl(){const t=new URL(window.location);t.searchParams.delete("ticket"),window.history.replaceState({},document.title,t.toString())}async logout(t=!0){try{if(this.log("用户登出"),this.token)try{await fetch(`${this.config.casServerUrl}/auth/logout`,{method:"POST",headers:{AppId:this.config.clientCode,Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"}})}catch(n){this.log("调用服务端登出接口失败:",n)}this.token=null,this.user=null,this.clearStorage(),this.config.logoutCallback&&this.config.logoutCallback(),t&&this.login()}catch(n){this.log("登出失败:",n),this.handleError(n)}}async request(t,n={}){const a={headers:{"Content-Type":"application/json",...n.headers},...n};a.headers.appId=this.config.clientCode,this.token&&(a.headers.Authorization=`Bearer ${this.token}`);try{const r=await fetch(t,a);return r.status===401?(this.log("Token已过期,需要重新登录"),this.logout(),null):r}catch(r){throw this.log("请求失败:",r),r}}async fetchUserInfo(){try{const t=await this.request(`${this.config.casServerUrl}/auth/user`);if(t&&t.ok){const n=await t.json();if(n.success&&n.data)return this.user=n.data,this.saveToStorage(),this.user}return null}catch(t){return this.log("获取用户信息失败:",t),null}}async refreshToken(){this.log("Token刷新功能暂未实现")}handleError(t){this.log("发生错误:",t),this.config.errorCallback&&this.config.errorCallback(t)}log(...t){this.config.debug&&console.log("[OnePortal CAS SDK]",...t)}checkLoginStatus(){return!this.isLoggedIn()&&this.config.autoLogin?(this.login(),!1):this.isLoggedIn()}setConfig(t,n){this.config[t]=n}getConfig(t){return this.config[t]}}function Fe(o){return new Promise(t=>{setTimeout(()=>{t()},o)})}function Ae(o){return JSON.parse(JSON.stringify(o))}function Ie(o){let t=[],n={},a=(r,i)=>Object.prototype.hasOwnProperty.call(r,i);for(const r of o){n[r.id]={...r,children:a(n,r.id)?n[r.id].children:[]};const i=n[r.id];r.pid==-1?t.push(i):(a(n,r.pid)||(n[r.pid]={children:[]}),n[r.pid].children.push(i))}return t}function Le(o,t=" "){return o?o.split(t).filter(n=>n.trim()):[]}class P{constructor(t,n=["label","value","labelEn"]){this.list=t,this.map=new Map(t.map(a=>{let r={...a,label:a[n[0]],value:a[n[1]]};return n[2]&&(r.labelEn=a[n[2]]),[a[n[1]],r]}))}getName(t,n){if(!this.has(t))return"-";const{label:a,labelEn:r}=this.map.get(t);return(n=="zh_cn"?a:r)||a||"-"}getTag(t){if(!this.has(t))return"info";const{tag:n="info"}=this.map.get(t);return n}getItem(t){return this.has(t)?this.map.get(t):null}getColor(t){if(!this.has(t))return null;const{color:n}=this.map.get(t);return n}has(t){return this.map.has(t)}}function Me(o,t=[],n="i18nName"){if(o.length==0)return new P([]);if(t.length<2)throw new Error("keys 长度必须大于2 默认前两位为 label value ");let a=o.map(r=>{let i={};return n&&(i.labelEn=r[n]),t.forEach((l,f)=>{f===0?i.label=r[l]:f===1?i.value=r[l]:i[l]=r[l]}),i});return new P(a)}function Ne(o){return o?o.replace(/<[^>]+>/g,""):""}function Ue(o){return o?(o.includes("\\\\u")&&(o=o.replace(/\\/g,"")),o.replace(/\\u[\dA-F]{4}/gi,t=>String.fromCharCode(parseInt(t.replace(/\\u/g,""),16)))):""}function ve(o,t=10){let n=1048576*t;return!(o.size>n)}function je(o){return Array.from(10).fill(0).map((n,a)=>o+"_"+a)}function Pe(o){let t={};return o.map((n,a)=>{let{key:r,option:i,type:l}=n,f=Oe(a);i?t[r]=`${f}---option`:l==="image"?t[r]=`${f}---image`:t[r]=f}),t}function Re(o,t){return t.split(".").reduce((n,a)=>n&&n[a],o)}function Ye(o,t={}){const a=Object.assign({manual:!1,log:!1,params:null,format:null},t),{manual:r,log:i,params:l={},cb:f,format:s}=a,C=e.ref([]),k=e.ref(!1),$=g=>{const b=g||l;k.value=!0,o(b).then(m=>{const{code:u,data:p,msg:d}=m;if(f){const{records:c,rows:y}=p||{},S=c||y?c||y:p;C.value=R(S,s),f(m)}if(p){if(p.records!=null||p.rows!=null){const{records:c,rows:y,total:S=0}=p||{};b&&b.total!=null&&(l.total=parseInt(S)),C.value=R(c||y||[],s)}else C.value=R(p,s);i&&console.log("useRequest-res",C.value)}}).catch(m=>{f&&(console.log("useRequestErr",m),f({code:500}))}).finally(()=>{k.value=!1})};return r||$(),[k,C,$]}function He(o){const t=e.ref(o),n=e.ref(""),a=e.ref("");return e.watch(t,r=>{const i=r||["",""];n.value=i[0],a.value=i[1]}),[t,n,a]}function qe(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()}function R(o,t){if(!t)return o;if(o instanceof Array)return o.map(a=>{let r={};return t.forEach(i=>r[i]=a[i]),r});let n={};return t.forEach(a=>n[a]=o[a]),n}function Ke(o,t=[]){const{locale:n}=U.useI18n(),a=e.ref(o());return e.watch([n,...t],()=>{a.value=o()},{immediate:!0}),[a]}function Ze(o,t,n="zh_cn"){return o&&(o[e.toValue(t)]||o[n])||"-"}function Ge(o,t){let n=A.mapState;return typeof o=="string"&&o.length>0&&(n=A.createNamespacedHelpers(o).mapState),te(t,n)}function We(o,t){let n=A.mapGetters;return typeof o=="string"&&o.length>0&&(n=A.createNamespacedHelpers(o).mapGetters),te(t,n)}function Qe(o,t){let n=A.mapActions;return typeof o=="string"&&o.length>0&&(n=A.createNamespacedHelpers(o).mapActions),Xe(t,n)}function te(o,t){const n=A.useStore(),a=t(o),r={};return Object.keys(a).forEach(i=>{const l=a[i].bind({$store:n});r[i]=e.computed(l)}),r}function Xe(o,t){const n=A.useStore(),a=t(o),r={};return Object.keys(a).forEach(i=>{r[i]=a[i].bind({$store:n})}),r}h.CmpDictionary=Z,h.ConfrimButton=re,h.ImportButton=ie,h.LayOutForm=ae,h.ListPage=ge,h.OnePortalCasSDK=ze,h.SearchBar=W,h.StatusMap=P,h._toRaw=Ae,h._typeOf=qe,h.arrToStatusMap=Me,h.arrayToTree=Ie,h.checkFileSize=ve,h.creatValidator=ye,h.createImportFields=Pe,h.createListPageId=je,h.crypto=Ce,h.exportExcel=Te,h.getLocaleValue=Ze,h.getValueBykey=Re,h.importExcel=$e,h.sleep=Fe,h.stringToArray=Le,h.stripHtmlTags=Ne,h.unicode2Str=Ue,h.useActions=Qe,h.useDatePicker=He,h.useGetters=We,h.useI18nReState=Ke,h.useRequest=Ye,h.useState=Ge,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joy-admin-components",
3
- "version": "0.1.30",
3
+ "version": "0.1.35",
4
4
  "main": "./dist/joy-admin-components.umd.js",
5
5
  "module": "./dist/joy-admin-components.es.js",
6
6
  "types": "./src/index.d.ts",
@@ -26,6 +26,13 @@
26
26
  "pub-major": "npm run build && npm version major && npm publish"
27
27
  },
28
28
  "dependencies": {},
29
+ "peerDependencies": {
30
+ "vue": "^3.3.4",
31
+ "element-plus": "^2.3.8",
32
+ "@vitejs/plugin-vue": "^4.2.3",
33
+ "vite": "^4.4.6",
34
+ "vue-i18n": "^9.10.1"
35
+ },
29
36
  "devDependencies": {
30
37
  "@vitejs/plugin-vue": "^4.6.2",
31
38
  "element-plus": "^2.13.2",
@@ -191,3 +191,162 @@ export function createImportFields(header: any[]): Record<string, string>;
191
191
  * @param chainKey 链式 key,如 'a.b.c'
192
192
  */
193
193
  export function getValueBykey<T = any>(object: any, chainKey: string): T | undefined;
194
+
195
+ // ============== Hook 函数类型(需要外部项目配置 vue-i18n、vuex 等)==============
196
+
197
+ // common.js hooks
198
+ import type { Ref } from 'vue';
199
+
200
+ /**
201
+ * 请求选项配置
202
+ */
203
+ export interface UseRequestOptions {
204
+ /** 是否手动执行,默认 false */
205
+ manual?: boolean;
206
+ /** 是否打印日志 */
207
+ log?: boolean;
208
+ /** 首次执行传参 */
209
+ params?: any;
210
+ /** 回调函数 */
211
+ cb?: (res: any) => void;
212
+ /** 对返回的数据按属性名进行过滤 */
213
+ format?: string[] | null;
214
+ }
215
+
216
+ /**
217
+ * 请求简单封装
218
+ * @param apiHandle 请求 Promise
219
+ * @param opt 配置选项
220
+ * @returns [loading, resData, run] 加载状态、响应数据、执行函数
221
+ */
222
+ export function useRequest(
223
+ apiHandle: (params?: any) => Promise<any>,
224
+ opt?: UseRequestOptions
225
+ ): [Ref<boolean>, Ref<any>, (params?: any) => void];
226
+
227
+ /**
228
+ * 范围时间选择器值解构
229
+ * @param date 时间组件绑定的数组
230
+ * @returns [dateSource, start, end] 日期源、开始时间、结束时间
231
+ */
232
+ export function useDatePicker(date: string[]): [Ref<string[]>, Ref<string>, Ref<string>];
233
+
234
+ /**
235
+ * 获取值的类型
236
+ * @param value 要检测类型的值
237
+ * @returns 类型字符串(小写),如 'string', 'number', 'array', 'object' 等
238
+ */
239
+ export function _typeOf(value: any): string;
240
+
241
+ /**
242
+ * 创建可枚举访问的对象
243
+ * @param target 目标对象
244
+ * @returns 枚举对象,支持双向访问
245
+ */
246
+ export function createEnum<T extends Record<string, string | number>>(target: T): T & Record<string | number, string>;
247
+
248
+ /**
249
+ * 表格状态格式化选项
250
+ */
251
+ export interface UseTableFormatterOptions {
252
+ /** 是否在表格中使用,默认 true */
253
+ inTable?: boolean;
254
+ /** 返回类型,默认 'text' */
255
+ returnType?: 'text' | 'object';
256
+ }
257
+
258
+ /**
259
+ * 表格状态格式化
260
+ * @param list 状态列表(StatusMap 实例)
261
+ * @param opt 配置选项
262
+ * @returns 格式化函数
263
+ */
264
+ export function useTableFormatter(
265
+ list: StatusMap,
266
+ opt?: UseTableFormatterOptions
267
+ ): ((row: any, column: any, cellValue: any) => any) | ((value: any) => any);
268
+
269
+ // i18n.js hooks
270
+
271
+ /**
272
+ * 国际化响应式状态
273
+ * @param state 返回值的函数
274
+ * @param otherWatch 其他需要监听的值数组
275
+ * @returns [data] 响应式数据
276
+ */
277
+ export function useI18nReState<T>(state: () => T, otherWatch?: any[]): [Ref<T>];
278
+
279
+ /**
280
+ * 后端数据国际化
281
+ * @param sourceData 源数据对象,包含不同语言的值
282
+ * @returns 当前语言的值,找不到则返回中文
283
+ */
284
+ export function getLocaleValue(sourceData: Record<string, string> | null | undefined): string;
285
+
286
+ /**
287
+ * 国际化取值属性配置
288
+ */
289
+ export interface LocaleProp {
290
+ en_us?: string;
291
+ zh_cn?: string;
292
+ }
293
+
294
+ /**
295
+ * 后端数据国际化格式化器
296
+ * @param localeProp 国际化取值属性配置
297
+ * @returns 格式化函数
298
+ */
299
+ export function useLocaleFormatter(localeProp?: LocaleProp): (sourceData: any) => string;
300
+
301
+ // storeHook.js hooks
302
+
303
+ /**
304
+ * 使用 Vuex State(支持模块化)
305
+ * @param moduleName 模块名称(可选)
306
+ * @param mapper state 映射对象或数组
307
+ * @returns 响应式 state 对象
308
+ */
309
+ export function useState(moduleName: string, mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
310
+ export function useState(mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
311
+
312
+ /**
313
+ * 使用 Vuex Getters(支持模块化)
314
+ * @param moduleName 模块名称(可选)
315
+ * @param mapper getters 映射对象或数组
316
+ * @returns 响应式 getters 对象
317
+ */
318
+ export function useGetters(moduleName: string, mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
319
+ export function useGetters(mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
320
+
321
+ /**
322
+ * 使用 Vuex Actions(支持模块化)
323
+ * @param moduleName 模块名称(可选)
324
+ * @param mapper actions 映射对象或数组
325
+ * @returns actions 对象
326
+ */
327
+ export function useActions(moduleName: string, mapper: string[] | Record<string, any>): Record<string, (...args: any[]) => any>;
328
+ export function useActions(mapper: string[] | Record<string, any>): Record<string, (...args: any[]) => any>;
329
+
330
+ /**
331
+ * State 映射器(内部使用)
332
+ * @param mapper 映射配置
333
+ * @param mapFn 映射函数
334
+ * @returns 响应式 state 对象
335
+ */
336
+ export function useStateMapper(mapper: any, mapFn: any): Record<string, Ref<any>>;
337
+
338
+ /**
339
+ * Action 映射器(内部使用)
340
+ * @param mapper 映射配置
341
+ * @param mapFn 映射函数
342
+ * @returns actions 对象
343
+ */
344
+ export function useActionMapper(mapper: any, mapFn: any): Record<string, (...args: any[]) => any>;
345
+
346
+ /**
347
+ * 将下拉列表国际化(用于 VXE Table)
348
+ * @param arr 数组数据
349
+ * @param keys 键名映射数组 [label键, value键, labelEn键]
350
+ * @returns 响应式列表
351
+ */
352
+ export function useVxeEditRenderStatus(arr: any[] | Ref<any[]>, keys?: string[]): Ref<any[]>;