joy-admin-components 0.1.45 → 0.1.46
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,2 @@
|
|
|
1
|
-
(function(m,H){typeof exports=="object"&&typeof module<"u"?H(exports,require("element-plus"),require("vue"),require("file-saver"),require("exceljs"),require("dayjs"),require("vue-i18n"),require("lodash"),require("vue-router"),require("vuex"),require("vxe-pc-ui")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","file-saver","exceljs","dayjs","vue-i18n","lodash","vue-router","vuex","vxe-pc-ui"],H):(m=typeof globalThis<"u"?globalThis:m||self,H(m.JoyAdminComponents={},m.ElementPlus,m.Vue,m.fileSaver,m.ExcelJS,m.dayjs,m.VueI18n,m._,m.VueRouter,m.Vuex,m.VxeUI))})(this,function(m,H,e,qe,ke,ae,Q,te,_e,J,oe){"use strict";const je=e.defineComponent({name:"LayOutForm",setup(o,{slots:t,attrs:n,emit:l}){const a=e.ref(null),r=()=>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 u;return e.h(H.ElCol,{span:((u=f.props)==null?void 0:u.span)||24},{default:()=>f})}):null;e.onMounted(()=>{l("ref",a.value)});function s(){return e.h(H.ElForm,{...n,ref:a},()=>e.h(H.ElRow,{gutter:n.gutter??20},{default:()=>r()}))}return s}});var Se=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $e(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ie={exports:{}};(function(o,t){(function(n,l){o.exports=l()})(Se,function(){var n="minute",l=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(r,s,f){var u=s.prototype;f.utc=function(d){var h={date:d,utc:!0,args:arguments};return new s(h)},u.utc=function(d){var h=f(this.toDate(),{locale:this.$L,utc:!0});return d?h.add(this.utcOffset(),n):h},u.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var S=u.parse;u.parse=function(d){d.utc&&(this.$u=!0),this.$utils().u(d.$offset)||(this.$offset=d.$offset),S.call(this,d)};var k=u.init;u.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds()}else k.call(this)};var w=u.utcOffset;u.utcOffset=function(d,h){var I=this.$utils().u;if(I(d))return this.$u?0:I(this.$offset)?w.call(this):this.$offset;if(typeof d=="string"&&(d=function(E){E===void 0&&(E="");var A=E.match(l);if(!A)return null;var T=(""+A[0]).match(a)||["-",0,0],b=T[0],q=60*+T[1]+ +T[2];return q===0?0:b==="+"?q:-q}(d),d===null))return this;var p=Math.abs(d)<=16?60*d:d;if(p===0)return this.utc(h);var C=this.clone();if(h)return C.$offset=p,C.$u=!1,C;var L=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(C=this.local().add(p+L,n)).$offset=p,C.$x.$localOffset=L,C};var g=u.format;u.format=function(d){var h=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,h)},u.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var _=u.toDate;u.toDate=function(d){return d==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():_.call(this)};var y=u.diff;u.diff=function(d,h,I){if(d&&this.$u===d.$u)return y.call(this,d,h,I);var p=this.local(),C=f(d).local();return y.call(p,C,h,I)}}})})(Ie);var Ue=Ie.exports;const Pe=$e(Ue);var Ee={exports:{}};(function(o,t){(function(n,l){o.exports=l()})(Se,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},l={};return function(a,r,s){var f,u=function(g,_,y){y===void 0&&(y={});var d=new Date(g),h=function(I,p){p===void 0&&(p={});var C=p.timeZoneName||"short",L=I+"|"+C,E=l[L];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:I,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:C}),l[L]=E),E}(_,y);return h.formatToParts(d)},S=function(g,_){for(var y=u(g,_),d=[],h=0;h<y.length;h+=1){var I=y[h],p=I.type,C=I.value,L=n[p];L>=0&&(d[L]=parseInt(C,10))}var E=d[3],A=E===24?0:E,T=d[0]+"-"+d[1]+"-"+d[2]+" "+A+":"+d[4]+":"+d[5]+":000",b=+g;return(s.utc(T).valueOf()-(b-=b%1e3))/6e4},k=r.prototype;k.tz=function(g,_){g===void 0&&(g=f);var y,d=this.utcOffset(),h=this.toDate(),I=h.toLocaleString("en-US",{timeZone:g}),p=Math.round((h-new Date(I))/1e3/60),C=15*-Math.round(h.getTimezoneOffset()/15)-p;if(!Number(C))y=this.utcOffset(0,_);else if(y=s(I,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(C,!0),_){var L=y.utcOffset();y=y.add(d-L,"minute")}return y.$x.$timezone=g,y},k.offsetName=function(g){var _=this.$x.$timezone||s.tz.guess(),y=u(this.valueOf(),_,{timeZoneName:g}).find(function(d){return d.type.toLowerCase()==="timezonename"});return y&&y.value};var w=k.startOf;k.startOf=function(g,_){if(!this.$x||!this.$x.$timezone)return w.call(this,g,_);var y=s(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return w.call(y,g,_).tz(this.$x.$timezone,!0)},s.tz=function(g,_,y){var d=y&&_,h=y||_||f,I=S(+s(),h);if(typeof g!="string")return s(g).tz(h);var p=function(A,T,b){var q=A-60*T*1e3,j=S(q,b);if(T===j)return[q,T];var B=S(q-=60*(j-T)*1e3,b);return j===B?[q,j]:[A-60*Math.min(j,B)*1e3,Math.max(j,B)]}(s.utc(g,d).valueOf(),I,h),C=p[0],L=p[1],E=s(C).utcOffset(L);return E.$x.$timezone=h,E},s.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},s.tz.setDefault=function(g){f=g}}})})(Ee);var Ye=Ee.exports;const He=$e(Ye),se={"dao-ru":"导入","quan-xuan":"全选","xia-zai-dao-ru-mo-ban":"下载导入模板","xu-hao":"序号","qing-shu-ru":"请输入","qing-xuan-ze":"请选择","kai-shi-shi-jian":"开始时间","jie-shu-shi-jian":"结束时间","shai-xuan":"筛选","chong-zhi":"重置","guan-bi":"关闭","zhan-kai":"展开",excel:{fieldsMappingRequired:"请输入列字段映射",invalidInput:"非法输入",invalidOption:"请输入有效选项!",copyFailed:"复制失败",sheetNameTooLong:'Sheet名称 "{0}" 长度超过31个字符,已自动截断为 "{1}"'},validate:{invalidInput:"请输入正确内容"},tools:{keysLengthError:"keys 长度必须大于2 默认前两位为 label value"}},ie={"dao-ru":"Import","quan-xuan":"Select All","xia-zai-dao-ru-mo-ban":"Download Import Template","xu-hao":"No.","qing-shu-ru":"Please enter","qing-xuan-ze":"Please select","kai-shi-shi-jian":"Start Time","jie-shu-shi-jian":"End Time","shai-xuan":"Filter","chong-zhi":"Reset","guan-bi":"Collapse","zhan-kai":"Expand",excel:{fieldsMappingRequired:"Please enter column field mapping",invalidInput:"Invalid input",invalidOption:"Please enter a valid option!",copyFailed:"Copy failed",sheetNameTooLong:'Sheet name "{0}" exceeds 31 characters, automatically truncated to "{1}"'},validate:{invalidInput:"Please enter valid content"},tools:{keysLengthError:"Keys length must be greater than 2, default first two are label and value"}},Te={zh_cn:se,en:ie};let ne=null;function ve(o=null){if(o){const{global:t}=o;return t.messages.value.zh_cn?t.mergeLocaleMessage("zh_cn",se):t.setLocaleMessage("zh_cn",se),t.messages.value.en?t.mergeLocaleMessage("en",ie):t.setLocaleMessage("en",ie),ne=o,o}return ne||(ne=Q.createI18n({legacy:!1,locale:"zh_cn",fallbackLocale:"zh_cn",messages:Te})),ne}function ue(){return ne||ve()}function ce(){return ue().global.t}ae.extend(Pe),ae.extend(He);async function Ke(o,t){const{fields:n,range:l=1}=t;if(!n){const s=ce();throw new Error(s("excel.fieldsMappingRequired"))}let a=new ke.Workbook;await a.xlsx.load(o);const r={};return a.eachSheet(function(s,f){const u=[];s.eachRow(function(S,k){if(k>l){let w={},g=!0;Object.keys(n).forEach(_=>{const y=S.getCell(n[_]).value;w[_]=y,y&&(g=!1)}),g||u.push(w)}}),r[s._name]=u}),a=null,r}const Ze={columnWidth:30};async function Le(o,t,n=[],l={}){if(!o||!t)return;const{columnStyle:a}=l,{columnWidth:r}=Ze;t.forEach(u=>{u.width=u.width?u.width:r});const{workbook:s,worksheet:f}=Ge();f.columns=t,f.addRows(n),a&&await We(s,f,a);try{const u=await s.xlsx.writeBuffer(),S=new File([u],o,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});qe.saveAs(S)}catch(u){console.log(u)}}function Ge(){const o=new ke.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 We(o,t,n){const l=Object.keys(n);for(const a of l){const r=n[a],{type:s}=r;switch(s){case"IMG":await Je(o,t,a);break}}}async function Je(o,t,n,l){const a=t.getColumn(n),r=a.values;t.getColumn(n).width=20,t.eachRow((s,f)=>{f>1&&(s.height=40)});for(let s=0,f=r.length;s<f;s++){if(s<2)continue;let u=r[s];u&&(t.getCell(a.letter+s).value="",await Qe(o,t,u,{width:100,height:50,col:a._number-1,row:s-1}))}}async function Qe(o,t,n,l){const{col:a,row:r,width:s,height:f}=l,{success:u,base64:S}=await Xe(n,.3);if(u){const k=o.addImage({base64:S,extension:"jpeg"});t.addImage(k,{tl:{col:a,row:r},ext:{width:s,height:f}})}}function Xe(o,t=1){const n=new Image;return n.setAttribute("crossOrigin","anonymous"),n.crossOrigin="anonymous",n.src=o,new Promise((l,a)=>{n.onload=()=>{const r=document.createElement("canvas");r.width=n.width,r.height=n.height,r.getContext("2d").drawImage(n,0,0,r.width,r.height),l({success:!0,base64:r.toDataURL("image/jpeg",t)})},n.onerror=()=>{l({success:!1})}})}function et(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}}function tt(o){return new Promise(t=>{setTimeout(()=>{t()},o)})}function nt(o){return JSON.parse(JSON.stringify(o))}function ot(o){let t=[],n={},l=(a,r)=>Object.prototype.hasOwnProperty.call(a,r);for(const a of o){n[a.id]={...a,children:l(n,a.id)?n[a.id].children:[]};const r=n[a.id];a.pid==-1?t.push(r):(l(n,a.pid)||(n[a.pid]={children:[]}),n[a.pid].children.push(r))}return t}function de(o,t=" "){return o?o.split(t).filter(n=>n.trim()):[]}class fe{constructor(t,n=["label","value","labelEn"]){this.list=t,this.map=new Map(t.map(l=>{let a={...l,label:l[n[0]],value:l[n[1]]};return n[2]&&(a.labelEn=l[n[2]]),[l[n[1]],a]}))}getName(t,n){if(!this.has(t))return"-";const{label:l,labelEn:a}=this.map.get(t);return(n=="zh_cn"?l:a)||l||"-"}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 lt(o,t=[],n="i18nName"){if(o.length==0)return new fe([]);if(t.length<2){const a=ce();throw new Error(a("tools.keysLengthError"))}let l=o.map(a=>{let r={};return n&&(r.labelEn=a[n]),t.forEach((s,f)=>{f===0?r.label=a[s]:f===1?r.value=a[s]:r[s]=a[s]}),r});return new fe(l)}function rt(o){return o?o.replace(/<[^>]+>/g,""):""}function at(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 st(o,t=10){let n=1048576*t;return!(o.size>n)}function it(o){return Array.from(10).fill(0).map((n,l)=>o+"_"+l)}function ct(o){let t={};return o.map((n,l)=>{let{key:a,option:r,type:s}=n,f=et(l);r?t[a]=`${f}---option`:s==="image"?t[a]=`${f}---image`:t[a]=f}),t}function ut(o,t){return t.split(".").reduce((n,l)=>n&&n[l],o)}const At="",le=(o,t)=>{const n=o.__vccOpts||o;for(const[l,a]of t)n[l]=a;return n},Ve=le({__name:"index",props:e.mergeModels({api:{type:Function},showCheckAll:{type:Boolean,default:!0},maxLimit:{type:Number,default:void 0},optionClick:{type:Function,default:()=>{}},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,l=e.useAttrs(),{t:a,locale:r}=Q.useI18n(),s=e.useModel(o,"modelValue"),f=e.ref(""),u=e.computed(()=>{if(l.remote!==void 0)return n.data;const p=de(f.value),{data:C,labelValue:L}=n,E=C||w.value;if(p.length==0)return E;const{label:A,labelEn:T}=L;let b=r.value=="en_us"?T||"i18nName":A;return p.length==1?E.filter(j=>j[b].toLowerCase().includes(p[0].toLowerCase())):E.filter(j=>{let B=!1;return B=p.some($=>j[b].toLowerCase()==$.toLowerCase()),B})}),S=e.computed({get(){return l.multiple==null||s.value==null?!1:s.value.length==u.value.length},set(p){return p}}),k=t,w=e.ref([]),g=async()=>{const{data:p}=await n.api();w.value=[...p],k("success",w)};n.api&&g();const _=n.labelValue.label.split("-"),y=p=>{if(_.length==1){if(n.changeLocal)return a(p[n.labelValue.label]);let C=r.value=="en_us"?p[n.labelValue.labelEn||"i18nName"]:p[n.labelValue.label];return C=C||p[n.labelValue.label],C}else{let C=[];return _.forEach(L=>{C.push(p[L])}),C.join("-")}};function d(p){s.value=p?u.value.map(C=>C[n.labelValue.value]):[],k("change",s.value)}function h(p){n.optionClick(p),k("change",l["value-key"]?p:p[n.labelValue.value])}function I(p){return s.value.length>=n.maxLimit&&!s.value.includes(p[n.labelValue.value])}return(p,C)=>{const L=e.resolveComponent("el-checkbox"),E=e.resolveComponent("el-option"),A=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(A,e.mergeProps({modelValue:s.value,"onUpdate:modelValue":C[1]||(C[1]=T=>s.value=T),filterable:"","collapse-tags":"","collapse-tags-tooltip":"","filter-method":e.unref(l).remote!=null?void 0:T=>f.value=T,clearable:""},e.unref(l),{onClear:o.optionClick}),{default:e.withCtx(()=>[e.unref(l).multiple!=null&&o.showCheckAll&&o.maxLimit==null?e.renderSlot(p.$slots,"header",{key:0},()=>[e.createVNode(L,{class:"mgl20",modelValue:S.value,"onUpdate:modelValue":C[0]||(C[0]=T=>S.value=T),onChange:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.$t("quan-xuan")),1)]),_:1},8,["modelValue"])],!0):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(T,b)=>(e.openBlock(),e.createBlock(E,{key:b,label:y(T),disabled:e.unref(l).multiple!=null&&o.maxLimit>0?I(T):!1,onClick:e.withModifiers(q=>h(T),["stop"]),value:e.unref(l)["value-key"]?T:T[o.labelValue.value]},null,8,["label","disabled","onClick","value"]))),128))]),_:3},16,["modelValue","filter-method","onClear"])}}},[["__scopeId","data-v-34eb8641"]]),jt="",dt=e.defineComponent({props:{name:{tyepe:String,required:!0}}});function ft(o,t,n,l,a,r){const s=e.resolveComponent("el-icon");return e.openBlock(),e.createBlock(s,{class:"cmp-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.name)))]),_:1})}const he=le(dt,[["render",ft],["__scopeId","data-v-733f9daa"]]),ht={__name:"index",emits:["ok","no"],setup(o,{emit:t}){const n=t,l=te.debounce(()=>{n("ok")},500);function a(){n("no")}return(r,s)=>{const f=e.resolveComponent("el-link"),u=e.resolveComponent("el-popconfirm");return e.openBlock(),e.createBlock(u,e.mergeProps(r.$attrs,{onConfirm:e.unref(l),onCancel:a}),{reference:e.withCtx(()=>[e.createVNode(f,{underline:"never",type:r.$attrs.type},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3},8,["type"])]),_:3},16,["onConfirm"])}}},Ut="",mt=["accept"],pt=le({__name:"index",props:{accept:{type:String,default:".xlsx,.xls"},loading:{type:Boolean,default:!1}},emits:["fileChange"],setup(o,{emit:t}){const n=t,l=e.ref(null);function a(r){let s=r.target.files[0];n("fileChange",s),l.value.value=null}return(r,s)=>{const f=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("span",null,[e.createVNode(f,{loading:o.loading,class:"mgr10",onClick:s[0]||(s[0]=u=>l.value.click())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.$t("dao-ru")),1)]),_:1},8,["loading"]),e.createElementVNode("input",{onChange:a,ref_key:"input",ref:l,accept:o.accept,style:{position:"absolute",width:"0px",height:"0px",opacity:"0"},type:"file"},null,40,mt)])}}},[["__scopeId","data-v-5f1449ad"]]);function me(o){let t={};return o.forEach(n=>{const{key:l,type:a,option:r={},value:s,dateType:f}=n;if(l)if(a=="input"&&(r!=null&&r.multiple))t[l]=de(s);else if(a=="date")if(f.includes("range")){const[u,S]=l;let[k,w]=s||[];k&&f=="daterange"&&(k=ae(k).format("YYYY-MM-DD 00:00:00"),w=ae(w).format("YYYY-MM-DD 23:59:59")),t[u]=k,t[S]=w}else t[l]=s;else t[l]=s}),t}const Yt="",gt={key:0},Ct={class:"btns"},yt={class:"left"},bt={class:"right"},Fe=le({__name:"index",props:{form:{type:Object,required:!0}},emits:["confirm","reset","visibleChange"],setup(o,{expose:t,emit:n}){const l=o,a=n,r=e.ref(!0),s=e.ref(null),{t:f}=Q.useI18n(),u=e.computed(()=>r.value?f("guan-bi"):f("zhan-kai"));function S(){a("confirm")}function k(h){h.option.onClear&&h.option.onClear(),a("confirm")}function w(){a("reset")}function g(){a("confirm")}function _(){return me(l.form.items)}const y=te.cloneDeep(l.form.items);function d(){l.form.items.forEach(h=>{const I=y.find(p=>p.key==h.key);I&&(h.value=I.value)})}return t({getPrm:_,reset:d}),(h,I)=>{const p=e.resolveComponent("el-input"),C=e.resolveComponent("el-date-picker"),L=e.resolveComponent("el-form-item"),E=e.resolveComponent("el-form"),A=e.resolveComponent("el-link"),T=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:"searchBar-container mgt10 mgb10",onKeydown:e.withKeys(S,["enter"])},[e.createElementVNode("div",{class:"searchBar",style:e.normalizeStyle({height:r.value?"auto":"42px"})},[e.createVNode(E,{inline:"",model:o.form.data},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.form.items.filter(b=>!b.hidden),b=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b.key},[b.type=="br"?(e.openBlock(),e.createElementBlock("br",gt)):(e.openBlock(),e.createBlock(L,{key:1,label:b.name},{default:e.withCtx(()=>{var q,j;return[b.type==="input"?(e.openBlock(),e.createBlock(p,{key:0,modelValue:b.value,"onUpdate:modelValue":B=>b.value=B,class:e.normalizeClass(((q=b.option)==null?void 0:q.class)||"w150"),placeholder:h.$t("qing-shu-ru"),clearable:""},null,8,["modelValue","onUpdate:modelValue","class","placeholder"])):b.type==="custom"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.render),{key:1})):e.createCommentVNode("",!0),b.type==="select"?(e.openBlock(),e.createBlock(Ve,e.mergeProps({key:2,class:((j=b.option)==null?void 0:j.class)||"w150",modelValue:b.value,"onUpdate:modelValue":B=>b.value=B},{ref_for:!0},b.option,{onChange:S,onClear:B=>k(b)}),null,16,["class","modelValue","onUpdate:modelValue","onClear"])):e.createCommentVNode("",!0),b.type==="date"?(e.openBlock(),e.createBlock(C,{key:3,class:e.normalizeClass({datetimerange:"w300",daterange:"w200"}[b.dateType]||"w100"),modelValue:b.value,"onUpdate:modelValue":B=>b.value=B,"value-format":{datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"}[b.dateType]||"YYYY-MM-DD",type:b.dateType||"date",onFocus:B=>s.value=b,onChange:B=>g(),placeholder:h.$t("qing-xuan-ze"),"start-placeholder":h.$t("kai-shi-shi-jian"),"end-placeholder":h.$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",Ct,[e.createElementVNode("div",yt,[e.renderSlot(h.$slots,"table-header-left",{},void 0,!0)]),e.createElementVNode("div",bt,[e.createVNode(A,{underline:"never",class:"mgr10",onClick:I[0]||(I[0]=()=>{a("visibleChange",!r.value),r.value=!r.value})},{default:e.withCtx(()=>[e.createVNode(he,{name:r.value?"ArrowUp":"ArrowDown"},null,8,["name"]),e.createTextVNode(" "+e.toDisplayString(u.value),1)]),_:1}),e.createVNode(T,{type:"primary",onClick:S},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.$t("shai-xuan")),1)]),_:1}),e.createVNode(T,{type:"primary",onClick:w},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.$t("chong-zhi")),1)]),_:1}),e.renderSlot(h.$slots,"btn",{},void 0,!0)])])],32)}}},[["__scopeId","data-v-32ac9990"]]),Kt="",wt={class:"center"},xt=le({__name:"index",props:{id:{type:String,required:!1},loading:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},searchForm:{type:Object,default:()=>({items:[],selections:[],showSearch:!1,showPage:!1,showShadow:!1,showCheckBox:!1,enableCellCopy:!0})},api:{type:Function},data:{type:Array},tableConfig:{type:Object,default:()=>({})}},setup(o,{expose:t}){const{t:n,locale:l}=Q.useI18n(),a=_e.useRoute(),r=o,s=e.ref(!1),f=e.ref([]);r.searchForm.selections=[];const u=e.computed(()=>{const c=a.path.replace(/\//g,"-").replace(/^-/,"")||"default-table";return r.id?`listPageId-${c}-${r.id}`:`listPageId-${c}`});r.searchForm.enableCellCopy==null&&(r.searchForm.enableCellCopy=!0);const S=te.cloneDeep(r.searchForm.items),k=r.searchForm.pageNoKey||"pageNo",w=e.reactive({[k]:1,pageSize:10,total:0}),g=e.ref(null),_=e.ref(null),y=e.ref(450),d=te.debounce(()=>{e.nextTick(()=>{if(!_.value)return;const i=_.value.getBoundingClientRect(),x=window.innerHeight,V=i.top,z=100,Y=x-V-z,M=200;y.value=Math.max(Y,M)})},100),h=()=>{d()},I=()=>{if(!r.searchForm.enableCellCopy)return!1;const c=g.value;if(!c||!c.$el)return!1;const i=c.$el;return i.classList.add("cell-copy-enabled"),i.setAttribute("tabindex","-1"),i.removeEventListener("mousedown",ge),i.removeEventListener("mousemove",Ce),i.removeEventListener("mouseup",ye),i.removeEventListener("keydown",we),i.addEventListener("mousedown",ge),i.addEventListener("mousemove",Ce),i.addEventListener("mouseup",ye),i.addEventListener("keydown",we),!0};e.onMounted(()=>{d(),window.addEventListener("resize",h),r.searchForm.enableCellCopy&&(document.addEventListener("mouseup",Me),document.addEventListener("mousedown",Ne),setTimeout(()=>{I()},500))}),e.onUpdated(()=>{r.searchForm.enableCellCopy&&setTimeout(()=>{I()},500)}),e.onUnmounted(()=>{if(window.removeEventListener("resize",h),r.searchForm.enableCellCopy){document.removeEventListener("mouseup",Me),document.removeEventListener("mousedown",Ne);const c=g.value;if(c&&c.$el){const i=c.$el;i.removeEventListener("mousedown",ge),i.removeEventListener("mousemove",Ce),i.removeEventListener("mouseup",ye),i.removeEventListener("keydown",we)}}});const p=e.computed(()=>B.value.height||y.value);let C;async function L(c){const{dataFormat:i}=r.tableConfig;c.pageNo!=1&&(c.nextSearchAfter=C),s.value=!0;const{code:x,data:V={}}=await r.api(c).finally(()=>{s.value=!1,r.searchForm.selections=[]});if(x==200){let z=V.rows||V.records||[];f.value=i?i(z):z,w.total=V.totalRows||V.total||0,C=V.nextSearchAfter,r.searchForm.enableCellCopy&&e.nextTick(()=>{setTimeout(()=>{I()},100)})}}function E(c={}){const{searchData:i=()=>({})}=r.tableConfig,x=i();L({...w,...me(r.searchForm.items),...c,...x})}function A(){const{reset:c}=r.tableConfig;c&&c(),r.searchForm.items.forEach(i=>{const x=S.find(V=>te.isArray(i.key)&&te.isArray(V.key)?i.key.join(",")==V.key.join(","):V.key==i.key);x&&(i.value=x.value)}),E()}r.api&&r.immediate&&E();function T(){return{...w,...me(r.searchForm.items)}}const b=()=>{const c=g.value;c&&c.clearSort()},q=e.reactive({storage:!0}),j=e.reactive({drag:!0,resizable:!0,maxFixedSize:0}),B=e.computed(()=>{const{customConfig:c,columnConfig:i,...x}=r.tableConfig;return{headerAlign:"left",align:"center",customConfig:{...q,...c},columnConfig:{...j,...i},"virtual-x-config":{enabled:!1,scrollToLeftOnChange:!1},"virtual-y-config":{enabled:!0,gt:100},...x}}),$=e.reactive({isSelecting:!1,startCell:null,endCell:null,selectedCells:[]}),Be=c=>{const i=c.closest(".vxe-body--column");if(!i||i.classList.contains("col--checkbox")||i.classList.contains("col--seq"))return null;const x=i.closest(".vxe-body--row");if(!x)return null;const V=g.value;if(!V)return null;let z=-1;const Y=x.getAttribute("data-rowid");if(Y!=null)z=parseInt(Y,10);else{const F=x.parentElement;z=Array.from(F.querySelectorAll(".vxe-body--row")).indexOf(x)}if(z<0)return null;let M=-1;const W=i.getAttribute("data-colid");if(W&&(M=V.getColumns().findIndex(v=>v.id===W)),M<0){const v=Array.from(x.querySelectorAll(".vxe-body--column")).indexOf(i),N=!!i.closest(".vxe-table--fixed-left-wrapper"),U=!!i.closest(".vxe-table--fixed-right-wrapper"),O=V.getColumns();if(N){const P=O.filter(R=>R.fixed==="left");v<P.length&&(M=O.indexOf(P[v]))}else if(U){const P=O.filter(R=>R.fixed==="right");v<P.length&&(M=O.indexOf(P[v]))}else{const P=r.searchForm.showCheckBox?1:0;M=O.filter(K=>K.fixed==="left").length+v-P}}return M<0?null:{rowIndex:z,colIndex:M,cell:i}},ge=c=>{const i=Be(c.target);if(!i){be();return}$.isSelecting=!0,$.startCell={rowIndex:i.rowIndex,colIndex:i.colIndex},$.endCell={...$.startCell},Oe(),ze()},Ce=c=>{if(!$.isSelecting)return;const i=Be(c.target);i&&($.endCell={rowIndex:i.rowIndex,colIndex:i.colIndex},Oe(),ze())},ye=()=>{$.isSelecting=!1},be=()=>{$.selectedCells=[],$.startCell=null,$.endCell=null;const c=g.value;if(!c)return;c.$el.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(x=>{x.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")})},Oe=()=>{if(!$.startCell||!$.endCell){$.selectedCells=[];return}const c=$.startCell.rowIndex,i=$.endCell.rowIndex,x=$.startCell.colIndex,V=$.endCell.colIndex,z=Math.min(c,i),Y=Math.max(c,i),M=Math.min(x,V),W=Math.max(x,V);$.selectedCells=[];for(let F=z;F<=Y;F++)for(let v=M;v<=W;v++)$.selectedCells.push({rowIndex:F,colIndex:v})},ze=()=>{e.nextTick(()=>{const c=g.value;if(!c)return;const i=c.$el;if(i.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(N=>{N.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")}),$.selectedCells.length===0)return;const x=c.getColumns(),V=$.selectedCells.map(N=>N.rowIndex),z=$.selectedCells.map(N=>N.colIndex),Y=Math.min(...V),M=Math.max(...V),W=Math.min(...z),F=Math.max(...z),v=[i.querySelector(".vxe-table--body-wrapper tbody"),i.querySelector(".vxe-table--fixed-left-wrapper tbody"),i.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean);$.selectedCells.forEach(({rowIndex:N,colIndex:U})=>{const O=x[U];if(!O)return;const P=O.fixed==="left",R=O.fixed==="right";for(const K of v){const re=K.querySelectorAll(".vxe-body--row")[N];if(!re)continue;const X=Array.from(re.querySelectorAll(".vxe-body--column"));let D=null;if(P&&K.closest(".vxe-table--fixed-left-wrapper")){const Z=x.filter(G=>G.fixed==="left").indexOf(O);D=X[Z]}else if(R&&K.closest(".vxe-table--fixed-right-wrapper")){const Z=x.filter(G=>G.fixed==="right").indexOf(O);D=X[Z]}else if(!P&&!R&&K.closest(".vxe-table--body-wrapper")){const ee=r.searchForm.showCheckBox?1:0,Z=x.filter(xe=>xe.fixed==="left").length,G=U-Z;D=X[G+ee]}if(D&&!D.classList.contains("col--checkbox")&&!D.classList.contains("col--seq")){D.classList.add("cell-selected"),N===Y&&D.classList.add("cell-border-top"),N===M&&D.classList.add("cell-border-bottom"),U===W&&D.classList.add("cell-border-left"),U===F&&D.classList.add("cell-border-right");break}}})})},zt=async()=>{if($.selectedCells.length===0)return;const c=g.value;if(!c)return;const i=c.$el,x=c.getColumns(),V=[...new Set($.selectedCells.map(F=>F.rowIndex))].sort((F,v)=>F-v),z=[...new Set($.selectedCells.map(F=>F.colIndex))].sort((F,v)=>F-v),Y=[i.querySelector(".vxe-table--body-wrapper tbody"),i.querySelector(".vxe-table--fixed-left-wrapper tbody"),i.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean),M=[];V.forEach(F=>{const v=[];z.forEach(N=>{const U=x[N];if(!U){v.push("");return}const O=U.fixed==="left",P=U.fixed==="right";let R="";for(const K of Y){const re=K.querySelectorAll(".vxe-body--row")[F];if(!re)continue;const X=Array.from(re.querySelectorAll(".vxe-body--column"));let D=null;if(O&&K.closest(".vxe-table--fixed-left-wrapper")){const Z=x.filter(G=>G.fixed==="left").indexOf(U);D=X[Z]}else if(P&&K.closest(".vxe-table--fixed-right-wrapper")){const Z=x.filter(G=>G.fixed==="right").indexOf(U);D=X[Z]}else if(!O&&!P&&K.closest(".vxe-table--body-wrapper")){const ee=r.searchForm.showCheckBox?1:0,Z=x.filter(xe=>xe.fixed==="left").length,G=N-Z;D=X[G+ee]}if(D&&!D.classList.contains("col--checkbox")&&!D.classList.contains("col--seq")){R=D.innerText||D.textContent||"",R=R.trim(),R=R.replace(/\n/g," ").replace(/\s+/g," ");break}}v.push(R)}),M.push(v.join(" "))});const W=M.join(`
|
|
2
|
-
`);try{await navigator.clipboard.writeText(W)}catch(F){console.error("复制失败:",F)}},we=c=>{r.searchForm.enableCellCopy&&((c.ctrlKey||c.metaKey)&&c.key==="c"?$.selectedCells.length>0&&(c.preventDefault(),c.stopPropagation(),zt()):c.key==="Escape"&&be())},Me=()=>{$.isSelecting=!1},Ne=c=>{const i=g.value;if(!i||!i.$el)return;i.$el.contains(c.target)||be()},Mt=c=>{w.pageNo=c,E()},Nt=c=>{w.pageSize=c,w[k]=1,E()};function Re(){const c=g.value.getCheckboxRecords();r.searchForm.selections=c}const Ae=c=>{const i=g.value;if(i){i.toggleCheckboxRow(c);const x=g.value.getCheckboxRecords();r.searchForm.selections=x}};return t({tableRef:g,getList:E,getPrm:T,clearSort:b,calculateTableHeight:d}),(c,i)=>{var F;const x=e.resolveComponent("el-button"),V=e.resolveComponent("el-checkbox"),z=e.resolveComponent("el-text"),Y=e.resolveComponent("vxe-column"),M=e.resolveComponent("VxeTable"),W=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({box:o.searchForm.showShadow})},[o.searchForm.showSearch?(e.openBlock(),e.createBlock(Fe,{key:0,form:o.searchForm,onReset:A,onConfirm:i[1]||(i[1]=v=>E()),onVisibleChange:e.unref(d)},{btn:e.withCtx(()=>[e.renderSlot(c.$slots,"search-bar-btn",{},void 0,!0),e.createVNode(x,{round:"",onClick:i[0]||(i[0]=v=>g.value.openCustom())},{default:e.withCtx(()=>[e.createVNode(he,{name:"Tools"})]),_:1})]),_:3},8,["form","onVisibleChange"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"table-header-left",{},void 0,!0),e.createElementVNode("div",{ref_key:"tableContentRef",ref:_},[e.createVNode(M,e.mergeProps({id:u.value,ref_key:"tableRef",ref:g,loading:o.loading||s.value,data:o.api?f.value:o.data,border:""},B.value,{height:p.value,onCheckboxChange:Re,onCheckboxAll:Re,onSortChange:(F=B.value["sort-config"])==null?void 0:F.sortChange}),{default:e.withCtx(()=>[o.searchForm.showCheckBox==null||o.searchForm.showCheckBox?(e.openBlock(),e.createBlock(Y,{key:0,type:"checkbox",width:e.unref(l)=="zh_cn"?80:150,title:c.$t("xu-hao"),fixed:"left"},{checkbox:e.withCtx(({rowIndex:v,row:N,checked:U,disabled:O,indeterminate:P})=>[e.createElementVNode("div",wt,[U?(e.openBlock(),e.createBlock(V,{key:0,checked:!0,disabled:O,size:"default",onClick:e.withModifiers(R=>!O&&Ae(N),["stop"])},null,8,["disabled","onClick"])):(e.openBlock(),e.createBlock(V,{key:1,disabled:O,checked:!1,size:"default",onClick:e.withModifiers(R=>!O&&Ae(N),["stop"])},null,8,["disabled","onClick"])),e.createVNode(z,{type:"info",class:"mgl5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v+1),1)]),_:2},1024)])]),_:1},8,["width","title"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",{},void 0,!0)]),_:3},16,["id","loading","data","height","onSortChange"])],512),o.searchForm.showPage?(e.openBlock(),e.createBlock(W,{key:1,"current-page":w[e.unref(k)],"onUpdate:currentPage":i[2]||(i[2]=v=>w[e.unref(k)]=v),class:"myPagination mgt10",background:"",layout:"total, sizes, prev, pager, next",total:w.total,"page-size":w.pageSize,"page-sizes":[10,50,100,500],onCurrentChange:Mt,onSizeChange:Nt},null,8,["current-page","total","page-size"])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-b945dd6e"]]),kt={__name:"index",props:{sheetsConfig:{type:Object,required:!0},fileName:{type:String,required:!0}},setup(o){const t=o;function n(){Le(t.fileName,t.sheetsConfig)}return(l,a)=>{const r=e.resolveComponent("el-link");return e.openBlock(),e.createBlock(r,e.mergeProps({type:"primary",underline:"never"},l.$attrs,{onClick:n}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.$t("xia-zai-dao-ru-mo-ban")),1)]),_:1},16)}}};function _t(o,t={}){const n=ce(),l={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:s,required:f,msg:u=n("validate.invalidInput")}=l;return r?function(S,k,w){if(f){a.test(k)?w():w(new Error(u));return}k&&!a.test(k)?w(new Error(u)):w()}:a.test(s)}class St{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 l=await n.json();if(l.success&&l.data)return this.token=l.data.token,this.user=l.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(l.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 l={headers:{"Content-Type":"application/json",...n.headers},...n};l.headers.appId=this.config.clientCode,this.token&&(l.headers.Authorization=`Bearer ${this.token}`);try{const a=await fetch(t,l);return a.status===401?(this.log("Token已过期,需要重新登录"),this.logout(),null):a}catch(a){throw this.log("请求失败:",a),a}}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 $t(o,t={}){const l=Object.assign({manual:!1,log:!1,params:null,format:null},t),{manual:a,log:r,params:s={},cb:f,format:u}=l,S=e.ref([]),k=e.ref(!1),w=g=>{const _=g||s;k.value=!0,o(_).then(y=>{const{code:d,data:h,msg:I}=y;if(f){const{records:p,rows:C}=h||{},L=p||C?p||C:h;S.value=pe(L,u),f(y)}if(h){if(h.records!=null||h.rows!=null){const{records:p,rows:C,total:L=0}=h||{};_&&_.total!=null&&(s.total=parseInt(L)),S.value=pe(p||C||[],u)}else S.value=pe(h,u);r&&console.log("useRequest-res",S.value)}}).catch(y=>{f&&(console.log("useRequestErr",y),f({code:500}))}).finally(()=>{k.value=!1})};return a||w(),[k,S,w]}function It(o){const t=e.ref(o),n=e.ref(""),l=e.ref("");return e.watch(t,a=>{const r=a||["",""];n.value=r[0],l.value=r[1]}),[t,n,l]}function Et(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()}function pe(o,t){if(!t)return o;if(o instanceof Array)return o.map(l=>{let a={};return t.forEach(r=>a[r]=l[r]),a});let n={};return t.forEach(l=>n[l]=o[l]),n}function Tt(o,t=[]){const{locale:n}=Q.useI18n(),l=e.ref(o());return e.watch([n,...t],()=>{l.value=o()},{immediate:!0}),l}function vt(o,t="zh_cn",n="en_us"){if(!o)return"-";const l={en_us:n,zh_cn:t},r=ue().global.locale.value;return o[l[r]]||o[t]||"-"}function Lt(o,t){let n=J.mapState;return typeof o=="string"&&o.length>0&&(n=J.createNamespacedHelpers(o).mapState),De(t,n)}function Vt(o,t){let n=J.mapGetters;return typeof o=="string"&&o.length>0&&(n=J.createNamespacedHelpers(o).mapGetters),De(t,n)}function Ft(o,t){let n=J.mapActions;return typeof o=="string"&&o.length>0&&(n=J.createNamespacedHelpers(o).mapActions),Dt(t,n)}function De(o,t){const n=J.useStore(),l=t(o),a={};return Object.keys(l).forEach(r=>{const s=l[r].bind({$store:n});a[r]=e.computed(s)}),a}function Dt(o,t){const n=J.useStore(),l=t(o),a={};return Object.keys(l).forEach(r=>{a[r]=l[r].bind({$store:n})}),a}const Bt={__name:"EnumRender",props:{renderOpts:{type:Object,default:()=>({enum:{}})},params:{type:Object}},setup(o){const t=o,n=t.params.row[t.params.column.field];return(l,a)=>{const r=e.resolveComponent("el-text");return o.renderOpts.text?(e.openBlock(),e.createBlock(r,{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1})):(e.openBlock(),e.createBlock(r,{key:1,type:o.renderOpts.enum.getTag(e.unref(n))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1},8,["type"]))}}};function Ot(){oe.VxeUI.renderer.add("Enum",{renderTableDefault(o,t){return[null,void 0].includes(t.row[t.column.field])?"-":React.createElement(Bt,{renderOpts:o,params:t})}}),oe.VxeUI.renderer.add("InputNumber",{renderTableDefault(o,t){return React.createElement(H.ElInputNumber,{"v-model":t.row[t.column.field],...o.props,"step-strictly":!0,"value-on-clear":0})}}),oe.VxeUI.renderer.add("TrueFalse",{renderTableDefault(o,t){const{locale:n}=Q.useI18n();let l=n.value=="zh_cn";return React.createElement(H.ElText,{type:t.row[t.column.field]?"success":"danger"},t.row[t.column.field]?l?"是":"YES":l?"否":"NO")}}),oe.VxeUI.renderer.add("I18n",{renderTableDefault(o,t){const{locale:n}=Q.useI18n();let l=n.value=="zh_cn"?t.column.field:o.fieldEn;return t.row[l]||t.row[t.column.field]}}),oe.VxeUI.renderer.add("Link",{renderTableDefault(o,t){var f;let n=t.column.field;const l=_e.useRouter(),{multiple:a,to:r}=o;if(!a)return React.createElement(H.ElLink,{underline:"never",type:"primary",onclick:()=>l.push({path:r,query:{[n]:t.row[n]}})},t.row[n]);const s=((f=t.row[n])==null?void 0:f.split(","))||[];return s.map((u,S)=>React.createElement("span",null,React.createElement(H.ElLink,{underline:"never",type:"primary",onclick:()=>l.push({path:r,query:{[n]:u}})},u),S<s.length-1?",":""))}})}m.CmpDictionary=Ve,m.CmpIcon=he,m.ConfrimButton=ht,m.DownExcelTemp=kt,m.ImportButton=pt,m.LayOutForm=je,m.ListPage=xt,m.OnePortalCasSDK=St,m.SearchBar=Fe,m.StatusMap=fe,m._toRaw=nt,m._typeOf=Et,m.arrToStatusMap=lt,m.arrayToTree=ot,m.checkFileSize=st,m.creatValidator=_t,m.createImportFields=ct,m.createListPageId=it,m.en=ie,m.exportExcel=Le,m.getI18n=ue,m.getI18nT=ce,m.getLocaleValue=vt,m.getValueBykey=ut,m.importExcel=Ke,m.messages=Te,m.registerVxeRenderers=Ot,m.setupI18n=ve,m.sleep=tt,m.stringToArray=de,m.stripHtmlTags=rt,m.unicode2Str=at,m.useActions=Ft,m.useDatePicker=It,m.useGetters=Vt,m.useI18nReState=Tt,m.useRequest=$t,m.useState=Lt,m.zhCn=se,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(h,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("element-plus"),require("vue"),require("file-saver"),require("exceljs"),require("dayjs"),require("vue-i18n"),require("lodash"),require("vue-router"),require("vuex"),require("vxe-pc-ui")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","file-saver","exceljs","dayjs","vue-i18n","lodash","vue-router","vuex","vxe-pc-ui"],K):(h=typeof globalThis<"u"?globalThis:h||self,K(h.JoyAdminComponents={},h.ElementPlus,h.Vue,h.fileSaver,h.ExcelJS,h.dayjs,h.VueI18n,h._,h.VueRouter,h.Vuex,h.VxeUI))})(this,function(h,K,e,Ke,$e,se,Q,te,Ie,J,oe){"use strict";const He=e.defineComponent({name:"LayOutForm",setup(o,{slots:t,attrs:n,emit:r}){const a=e.ref(null),s=()=>t.default?t.default().filter(d=>d.type!==Symbol.for("v-cmt")).map(d=>d.type===Symbol.for("v-fgt")?d.children:d).flat().map(d=>{var u;return e.h(K.ElCol,{span:((u=d.props)==null?void 0:u.span)||24},{default:()=>d})}):null;e.onMounted(()=>{r("ref",a.value)});function l(){return e.h(K.ElForm,{...n,ref:a},()=>e.h(K.ElRow,{gutter:n.gutter??20},{default:()=>s()}))}return l}});var Ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Te(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Le={exports:{}};(function(o,t){(function(n,r){o.exports=r()})(Ee,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(s,l,d){var u=l.prototype;d.utc=function(f){var m={date:f,utc:!0,args:arguments};return new l(m)},u.utc=function(f){var m=d(this.toDate(),{locale:this.$L,utc:!0});return f?m.add(this.utcOffset(),n):m},u.local=function(){return d(this.toDate(),{locale:this.$L,utc:!1})};var _=u.parse;u.parse=function(f){f.utc&&(this.$u=!0),this.$utils().u(f.$offset)||(this.$offset=f.$offset),_.call(this,f)};var $=u.init;u.init=function(){if(this.$u){var f=this.$d;this.$y=f.getUTCFullYear(),this.$M=f.getUTCMonth(),this.$D=f.getUTCDate(),this.$W=f.getUTCDay(),this.$H=f.getUTCHours(),this.$m=f.getUTCMinutes(),this.$s=f.getUTCSeconds(),this.$ms=f.getUTCMilliseconds()}else $.call(this)};var S=u.utcOffset;u.utcOffset=function(f,m){var I=this.$utils().u;if(I(f))return this.$u?0:I(this.$offset)?S.call(this):this.$offset;if(typeof f=="string"&&(f=function(v){v===void 0&&(v="");var A=v.match(r);if(!A)return null;var x=(""+A[0]).match(a)||["-",0,0],b=x[0],q=60*+x[1]+ +x[2];return q===0?0:b==="+"?q:-q}(f),f===null))return this;var p=Math.abs(f)<=16?60*f:f;if(p===0)return this.utc(m);var C=this.clone();if(m)return C.$offset=p,C.$u=!1,C;var L=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(C=this.local().add(p+L,n)).$offset=p,C.$x.$localOffset=L,C};var k=u.format;u.format=function(f){var m=f||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return k.call(this,m)},u.valueOf=function(){var f=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*f},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var y=u.toDate;u.toDate=function(f){return f==="s"&&this.$offset?d(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var g=u.diff;u.diff=function(f,m,I){if(f&&this.$u===f.$u)return g.call(this,f,m,I);var p=this.local(),C=d(f).local();return g.call(p,C,m,I)}}})})(Le);var Ze=Le.exports;const Ge=Te(Ze);var Fe={exports:{}};(function(o,t){(function(n,r){o.exports=r()})(Ee,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,s,l){var d,u=function(k,y,g){g===void 0&&(g={});var f=new Date(k),m=function(I,p){p===void 0&&(p={});var C=p.timeZoneName||"short",L=I+"|"+C,v=r[L];return v||(v=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:I,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:C}),r[L]=v),v}(y,g);return m.formatToParts(f)},_=function(k,y){for(var g=u(k,y),f=[],m=0;m<g.length;m+=1){var I=g[m],p=I.type,C=I.value,L=n[p];L>=0&&(f[L]=parseInt(C,10))}var v=f[3],A=v===24?0:v,x=f[0]+"-"+f[1]+"-"+f[2]+" "+A+":"+f[4]+":"+f[5]+":000",b=+k;return(l.utc(x).valueOf()-(b-=b%1e3))/6e4},$=s.prototype;$.tz=function(k,y){k===void 0&&(k=d);var g,f=this.utcOffset(),m=this.toDate(),I=m.toLocaleString("en-US",{timeZone:k}),p=Math.round((m-new Date(I))/1e3/60),C=15*-Math.round(m.getTimezoneOffset()/15)-p;if(!Number(C))g=this.utcOffset(0,y);else if(g=l(I,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(C,!0),y){var L=g.utcOffset();g=g.add(f-L,"minute")}return g.$x.$timezone=k,g},$.offsetName=function(k){var y=this.$x.$timezone||l.tz.guess(),g=u(this.valueOf(),y,{timeZoneName:k}).find(function(f){return f.type.toLowerCase()==="timezonename"});return g&&g.value};var S=$.startOf;$.startOf=function(k,y){if(!this.$x||!this.$x.$timezone)return S.call(this,k,y);var g=l(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return S.call(g,k,y).tz(this.$x.$timezone,!0)},l.tz=function(k,y,g){var f=g&&y,m=g||y||d,I=_(+l(),m);if(typeof k!="string")return l(k).tz(m);var p=function(A,x,b){var q=A-60*x*1e3,P=_(q,b);if(x===P)return[q,x];var M=_(q-=60*(P-x)*1e3,b);return P===M?[q,P]:[A-60*Math.min(P,M)*1e3,Math.max(P,M)]}(l.utc(k,f).valueOf(),I,m),C=p[0],L=p[1],v=l(C).utcOffset(L);return v.$x.$timezone=m,v},l.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},l.tz.setDefault=function(k){d=k}}})})(Fe);var We=Fe.exports;const Je=Te(We),ie={"dao-ru":"导入","quan-xuan":"全选","xia-zai-dao-ru-mo-ban":"下载导入模板","xu-hao":"序号","qing-shu-ru":"请输入","qing-xuan-ze":"请选择","kai-shi-shi-jian":"开始时间","jie-shu-shi-jian":"结束时间","shai-xuan":"筛选","chong-zhi":"重置","guan-bi":"关闭","zhan-kai":"展开",excel:{fieldsMappingRequired:"请输入列字段映射",invalidInput:"非法输入",invalidOption:"请输入有效选项!",copyFailed:"复制失败",sheetNameTooLong:'Sheet名称 "{0}" 长度超过31个字符,已自动截断为 "{1}"'},validate:{invalidInput:"请输入正确内容"},tools:{keysLengthError:"keys 长度必须大于2 默认前两位为 label value"}},ce={"dao-ru":"Import","quan-xuan":"Select All","xia-zai-dao-ru-mo-ban":"Download Import Template","xu-hao":"No.","qing-shu-ru":"Please enter","qing-xuan-ze":"Please select","kai-shi-shi-jian":"Start Time","jie-shu-shi-jian":"End Time","shai-xuan":"Filter","chong-zhi":"Reset","guan-bi":"Collapse","zhan-kai":"Expand",excel:{fieldsMappingRequired:"Please enter column field mapping",invalidInput:"Invalid input",invalidOption:"Please enter a valid option!",copyFailed:"Copy failed",sheetNameTooLong:'Sheet name "{0}" exceeds 31 characters, automatically truncated to "{1}"'},validate:{invalidInput:"Please enter valid content"},tools:{keysLengthError:"Keys length must be greater than 2, default first two are label and value"}},ve={zh_cn:ie,en:ce};let ne=null;function Ve(o=null){if(o){const{global:t}=o;return t.messages.value.zh_cn?t.mergeLocaleMessage("zh_cn",ie):t.setLocaleMessage("zh_cn",ie),t.messages.value.en?t.mergeLocaleMessage("en",ce):t.setLocaleMessage("en",ce),ne=o,o}return ne||(ne=Q.createI18n({legacy:!1,locale:"zh_cn",fallbackLocale:"zh_cn",messages:ve})),ne}function de(){return ne||Ve()}function ue(){return de().global.t}se.extend(Ge),se.extend(Je);async function Qe(o,t){const{fields:n,range:r=1}=t;if(!n){const l=ue();throw new Error(l("excel.fieldsMappingRequired"))}let a=new $e.Workbook;await a.xlsx.load(o);const s={};return a.eachSheet(function(l,d){const u=[];l.eachRow(function(_,$){if($>r){let S={},k=!0;Object.keys(n).forEach(y=>{const g=_.getCell(n[y]).value;S[y]=g,g&&(k=!1)}),k||u.push(S)}}),s[l._name]=u}),a=null,s}const Xe={columnWidth:30};async function De(o,t,n=[],r={}){if(!o||!t)return;const{columnStyle:a}=r,{columnWidth:s}=Xe;t.forEach(u=>{u.width=u.width?u.width:s});const{workbook:l,worksheet:d}=et();d.columns=t,d.addRows(n),a&&await tt(l,d,a);try{const u=await l.xlsx.writeBuffer(),_=new File([u],o,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Ke.saveAs(_)}catch(u){console.log(u)}}function et(){const o=new $e.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 tt(o,t,n){const r=Object.keys(n);for(const a of r){const s=n[a],{type:l}=s;switch(l){case"IMG":await nt(o,t,a);break}}}async function nt(o,t,n,r){const a=t.getColumn(n),s=a.values;t.getColumn(n).width=20,t.eachRow((l,d)=>{d>1&&(l.height=40)});for(let l=0,d=s.length;l<d;l++){if(l<2)continue;let u=s[l];u&&(t.getCell(a.letter+l).value="",await ot(o,t,u,{width:100,height:50,col:a._number-1,row:l-1}))}}async function ot(o,t,n,r){const{col:a,row:s,width:l,height:d}=r,{success:u,base64:_}=await lt(n,.3);if(u){const $=o.addImage({base64:_,extension:"jpeg"});t.addImage($,{tl:{col:a,row:s},ext:{width:l,height:d}})}}function lt(o,t=1){const n=new Image;return n.setAttribute("crossOrigin","anonymous"),n.crossOrigin="anonymous",n.src=o,new Promise((r,a)=>{n.onload=()=>{const s=document.createElement("canvas");s.width=n.width,s.height=n.height,s.getContext("2d").drawImage(n,0,0,s.width,s.height),r({success:!0,base64:s.toDataURL("image/jpeg",t)})},n.onerror=()=>{r({success:!1})}})}function rt(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}}function at(o){return new Promise(t=>{setTimeout(()=>{t()},o)})}function st(o){return JSON.parse(JSON.stringify(o))}function it(o){let t=[],n={},r=(a,s)=>Object.prototype.hasOwnProperty.call(a,s);for(const a of o){n[a.id]={...a,children:r(n,a.id)?n[a.id].children:[]};const s=n[a.id];a.pid==-1?t.push(s):(r(n,a.pid)||(n[a.pid]={children:[]}),n[a.pid].children.push(s))}return t}function fe(o,t=" "){return o?o.split(t).filter(n=>n.trim()):[]}class he{constructor(t,n=["label","value","labelEn"]){this.list=t,this.map=new Map(t.map(r=>{let a={...r,label:r[n[0]],value:r[n[1]]};return n[2]&&(a.labelEn=r[n[2]]),[r[n[1]],a]}))}getName(t,n){if(!this.has(t))return"-";const{label:r,labelEn:a}=this.map.get(t);return(n=="zh_cn"?r:a)||r||"-"}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 ct(o,t=[],n="i18nName"){if(o.length==0)return new he([]);if(t.length<2){const a=ue();throw new Error(a("tools.keysLengthError"))}let r=o.map(a=>{let s={};return n&&(s.labelEn=a[n]),t.forEach((l,d)=>{d===0?s.label=a[l]:d===1?s.value=a[l]:s[l]=a[l]}),s});return new he(r)}function ut(o){return o?o.replace(/<[^>]+>/g,""):""}function dt(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 ft(o,t=10){let n=1048576*t;return!(o.size>n)}function ht(o){return Array.from(10).fill(0).map((n,r)=>o+"_"+r)}function mt(o){let t={};return o.map((n,r)=>{let{key:a,option:s,type:l}=n,d=rt(r);s?t[a]=`${d}---option`:l==="image"?t[a]=`${d}---image`:t[a]=d}),t}function pt(o,t){return t.split(".").reduce((n,r)=>n&&n[r],o)}const Ht="",le=(o,t)=>{const n=o.__vccOpts||o;for(const[r,a]of t)n[r]=a;return n},Be=le({__name:"index",props:e.mergeModels({api:{type:Function},showCheckAll:{type:Boolean,default:!0},maxLimit:{type:Number,default:void 0},optionClick:{type:Function,default:()=>{}},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,r=e.useAttrs(),{t:a,locale:s}=Q.useI18n(),l=e.useModel(o,"modelValue"),d=e.ref(""),u=e.computed(()=>{if(r.remote!==void 0)return n.data;const p=fe(d.value),{data:C,labelValue:L}=n,v=C||S.value;if(p.length==0)return v;const{label:A,labelEn:x}=L;let b=s.value=="en_us"?x||"i18nName":A;return p.length==1?v.filter(P=>P[b].toLowerCase().includes(p[0].toLowerCase())):v.filter(P=>{let M=!1;return M=p.some(Ce=>P[b].toLowerCase()==Ce.toLowerCase()),M})}),_=e.computed({get(){return r.multiple==null||l.value==null?!1:l.value.length==u.value.length},set(p){return p}}),$=t,S=e.ref([]),k=async()=>{const{data:p}=await n.api();S.value=[...p],$("success",S)};n.api&&k();const y=n.labelValue.label.split("-"),g=p=>{if(y.length==1){if(n.changeLocal)return a(p[n.labelValue.label]);let C=s.value=="en_us"?p[n.labelValue.labelEn||"i18nName"]:p[n.labelValue.label];return C=C||p[n.labelValue.label],C}else{let C=[];return y.forEach(L=>{C.push(p[L])}),C.join("-")}};function f(p){l.value=p?u.value.map(C=>C[n.labelValue.value]):[],$("change",l.value)}function m(p){n.optionClick(p),$("change",r["value-key"]?p:p[n.labelValue.value])}function I(p){return l.value.length>=n.maxLimit&&!l.value.includes(p[n.labelValue.value])}return(p,C)=>{const L=e.resolveComponent("el-checkbox"),v=e.resolveComponent("el-option"),A=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(A,e.mergeProps({modelValue:l.value,"onUpdate:modelValue":C[1]||(C[1]=x=>l.value=x),filterable:"","collapse-tags":"","collapse-tags-tooltip":"","filter-method":e.unref(r).remote!=null?void 0:x=>d.value=x,clearable:""},e.unref(r),{onClear:o.optionClick}),{default:e.withCtx(()=>[e.unref(r).multiple!=null&&o.showCheckAll&&o.maxLimit==null?e.renderSlot(p.$slots,"header",{key:0},()=>[e.createVNode(L,{class:"mgl20",modelValue:_.value,"onUpdate:modelValue":C[0]||(C[0]=x=>_.value=x),onChange:f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.$t("quan-xuan")),1)]),_:1},8,["modelValue"])],!0):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(x,b)=>(e.openBlock(),e.createBlock(v,{key:b,label:g(x),disabled:e.unref(r).multiple!=null&&o.maxLimit>0?I(x):!1,onClick:e.withModifiers(q=>m(x),["stop"]),value:e.unref(r)["value-key"]?x:x[o.labelValue.value]},null,8,["label","disabled","onClick","value"]))),128))]),_:3},16,["modelValue","filter-method","onClear"])}}},[["__scopeId","data-v-34eb8641"]]),Gt="",gt=e.defineComponent({props:{name:{tyepe:String,required:!0}}});function Ct(o,t,n,r,a,s){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 me=le(gt,[["render",Ct],["__scopeId","data-v-733f9daa"]]),yt={__name:"index",emits:["ok","no"],setup(o,{emit:t}){const n=t,r=te.debounce(()=>{n("ok")},500);function a(){n("no")}return(s,l)=>{const d=e.resolveComponent("el-link"),u=e.resolveComponent("el-popconfirm");return e.openBlock(),e.createBlock(u,e.mergeProps(s.$attrs,{onConfirm:e.unref(r),onCancel:a}),{reference:e.withCtx(()=>[e.createVNode(d,{underline:"never",type:s.$attrs.type},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3},8,["type"])]),_:3},16,["onConfirm"])}}},Wt="",bt=["accept"],wt=le({__name:"index",props:{accept:{type:String,default:".xlsx,.xls"},loading:{type:Boolean,default:!1}},emits:["fileChange"],setup(o,{emit:t}){const n=t,r=e.ref(null);function a(s){let l=s.target.files[0];n("fileChange",l),r.value.value=null}return(s,l)=>{const d=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("span",null,[e.createVNode(d,{loading:o.loading,class:"mgr10",onClick:l[0]||(l[0]=u=>r.value.click())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.$t("dao-ru")),1)]),_:1},8,["loading"]),e.createElementVNode("input",{onChange:a,ref_key:"input",ref:r,accept:o.accept,style:{position:"absolute",width:"0px",height:"0px",opacity:"0"},type:"file"},null,40,bt)])}}},[["__scopeId","data-v-5f1449ad"]]);function pe(o){let t={};return o.forEach(n=>{const{key:r,type:a,option:s={},value:l,dateType:d}=n;if(r)if(a=="input"&&(s!=null&&s.multiple))t[r]=fe(l);else if(a=="date")if(d.includes("range")){const[u,_]=r;let[$,S]=l||[];$&&d=="daterange"&&($=se($).format("YYYY-MM-DD 00:00:00"),S=se(S).format("YYYY-MM-DD 23:59:59")),t[u]=$,t[_]=S}else t[r]=l;else t[r]=l}),t}const Qt="",kt={key:0},xt={class:"btns"},St={class:"left"},_t={class:"right"},ze=le({__name:"index",props:{form:{type:Object,required:!0}},emits:["confirm","reset","visibleChange"],setup(o,{expose:t,emit:n}){const r=o,a=n,s=e.ref(!0),l=e.ref(null),{t:d}=Q.useI18n(),u=e.computed(()=>s.value?d("guan-bi"):d("zhan-kai"));function _(){a("confirm")}function $(m){m.option.onClear&&m.option.onClear(),a("confirm")}function S(){a("reset")}function k(){a("confirm")}function y(){return pe(r.form.items)}const g=te.cloneDeep(r.form.items);function f(){r.form.items.forEach(m=>{const I=g.find(p=>p.key==m.key);I&&(m.value=I.value)})}return t({getPrm:y,reset:f}),(m,I)=>{const p=e.resolveComponent("el-input"),C=e.resolveComponent("el-date-picker"),L=e.resolveComponent("el-form-item"),v=e.resolveComponent("el-form"),A=e.resolveComponent("el-link"),x=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:"searchBar-container mgt10 mgb10",onKeydown:e.withKeys(_,["enter"])},[e.createElementVNode("div",{class:"searchBar",style:e.normalizeStyle({height:s.value?"auto":"42px"})},[e.createVNode(v,{inline:"",model:o.form.data},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.form.items.filter(b=>!b.hidden),b=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b.key},[b.type=="br"?(e.openBlock(),e.createElementBlock("br",kt)):(e.openBlock(),e.createBlock(L,{key:1,label:b.name},{default:e.withCtx(()=>{var q,P;return[b.type==="input"?(e.openBlock(),e.createBlock(p,{key:0,modelValue:b.value,"onUpdate:modelValue":M=>b.value=M,class:e.normalizeClass(((q=b.option)==null?void 0:q.class)||"w150"),placeholder:m.$t("qing-shu-ru"),clearable:""},null,8,["modelValue","onUpdate:modelValue","class","placeholder"])):b.type==="custom"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.render),{key:1})):e.createCommentVNode("",!0),b.type==="select"?(e.openBlock(),e.createBlock(Be,e.mergeProps({key:2,class:((P=b.option)==null?void 0:P.class)||"w150",modelValue:b.value,"onUpdate:modelValue":M=>b.value=M},{ref_for:!0},b.option,{onChange:_,onClear:M=>$(b)}),null,16,["class","modelValue","onUpdate:modelValue","onClear"])):e.createCommentVNode("",!0),b.type==="date"?(e.openBlock(),e.createBlock(C,{key:3,class:e.normalizeClass({datetimerange:"w300",daterange:"w200"}[b.dateType]||"w100"),modelValue:b.value,"onUpdate:modelValue":M=>b.value=M,"value-format":{datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"}[b.dateType]||"YYYY-MM-DD",type:b.dateType||"date",onFocus:M=>l.value=b,onChange:M=>k(),placeholder:m.$t("qing-xuan-ze"),"start-placeholder":m.$t("kai-shi-shi-jian"),"end-placeholder":m.$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",xt,[e.createElementVNode("div",St,[e.renderSlot(m.$slots,"table-header-left",{},void 0,!0)]),e.createElementVNode("div",_t,[e.createVNode(A,{underline:"never",class:"mgr10",onClick:I[0]||(I[0]=()=>{a("visibleChange",!s.value),s.value=!s.value})},{default:e.withCtx(()=>[e.createVNode(me,{name:s.value?"ArrowUp":"ArrowDown"},null,8,["name"]),e.createTextVNode(" "+e.toDisplayString(u.value),1)]),_:1}),e.createVNode(x,{type:"primary",onClick:_},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.$t("shai-xuan")),1)]),_:1}),e.createVNode(x,{type:"primary",onClick:S},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.$t("chong-zhi")),1)]),_:1}),e.renderSlot(m.$slots,"btn",{},void 0,!0)])])],32)}}},[["__scopeId","data-v-32ac9990"]]),Oe={pageNoKey:"pageNo",pageSizeKey:"pageSize",totalKey:"total",defaultPageSize:10,pageSizes:[10,50,100,500],responseDataKeys:{rows:["rows","records"],total:["totalRows","total"]},showSearch:!1,showPage:!1,showShadow:!1,showCheckBox:!1,enableCellCopy:!0};let re={...Oe};function $t(o){re={...re,...o,responseDataKeys:{...re.responseDataKeys,...o.responseDataKeys||{}}}}function Me(){return re}function It(){re={...Oe}}const en="",Et={class:"center"},Tt=le({__name:"index",props:{id:{type:String,required:!1},loading:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},searchForm:{type:Object,default:()=>({items:[],selections:[]})},api:{type:Function},data:{type:Array},tableConfig:{type:Object,default:()=>({})}},setup(o,{expose:t}){const{t:n,locale:r}=Q.useI18n(),a=Ie.useRoute(),s=Me(),l=o,d=e.ref(!1),u=e.ref([]);l.searchForm.showSearch===void 0&&(l.searchForm.showSearch=s.showSearch),l.searchForm.showPage===void 0&&(l.searchForm.showPage=s.showPage),l.searchForm.showShadow===void 0&&(l.searchForm.showShadow=s.showShadow),l.searchForm.showCheckBox===void 0&&(l.searchForm.showCheckBox=s.showCheckBox),l.searchForm.enableCellCopy===void 0&&(l.searchForm.enableCellCopy=s.enableCellCopy),l.searchForm.selections||(l.searchForm.selections=[]);const _=e.computed(()=>{const c=a.path.replace(/\//g,"-").replace(/^-/,"")||"default-table";return l.id?`listPageId-${c}-${l.id}`:`listPageId-${c}`}),$=te.cloneDeep(l.searchForm.items),S=l.searchForm.pageNoKey||s.pageNoKey,k=l.searchForm.pageSizeKey||s.pageSizeKey,y=e.reactive({[S]:1,[k]:l.searchForm.defaultPageSize||s.defaultPageSize,total:0}),g=e.ref(null),f=e.ref(null),m=e.ref(450),I=te.debounce(()=>{e.nextTick(()=>{if(!f.value)return;const i=f.value.getBoundingClientRect(),w=window.innerHeight,F=i.top,z=100,j=w-F-z,V=200;m.value=Math.max(j,V)})},100),p=()=>{I()},C=()=>{if(!l.searchForm.enableCellCopy)return!1;const c=g.value;if(!c||!c.$el)return!1;const i=c.$el;return i.classList.add("cell-copy-enabled"),i.setAttribute("tabindex","-1"),i.removeEventListener("mousedown",be),i.removeEventListener("mousemove",we),i.removeEventListener("mouseup",ke),i.removeEventListener("keydown",Se),i.addEventListener("mousedown",be),i.addEventListener("mousemove",we),i.addEventListener("mouseup",ke),i.addEventListener("keydown",Se),!0};e.onMounted(()=>{I(),window.addEventListener("resize",p),l.searchForm.enableCellCopy&&(document.addEventListener("mouseup",Pe),document.addEventListener("mousedown",je),setTimeout(()=>{C()},500))}),e.onUpdated(()=>{l.searchForm.enableCellCopy&&setTimeout(()=>{C()},500)}),e.onUnmounted(()=>{if(window.removeEventListener("resize",p),l.searchForm.enableCellCopy){document.removeEventListener("mouseup",Pe),document.removeEventListener("mousedown",je);const c=g.value;if(c&&c.$el){const i=c.$el;i.removeEventListener("mousedown",be),i.removeEventListener("mousemove",we),i.removeEventListener("mouseup",ke),i.removeEventListener("keydown",Se)}}});const L=e.computed(()=>ye.value.height||m.value);let v;async function A(c){const{dataFormat:i}=l.tableConfig;c[S]!=1&&(c.nextSearchAfter=v),d.value=!0;const{code:w,data:F={}}=await l.api(c).finally(()=>{d.value=!1,l.searchForm.selections=[]});if(w==200){let z=[];for(const V of s.responseDataKeys.rows)if(F[V]){z=F[V];break}let j=0;for(const V of s.responseDataKeys.total)if(F[V]!==void 0){j=F[V];break}u.value=i?i(z):z,y.total=j,v=F.nextSearchAfter,l.searchForm.enableCellCopy&&e.nextTick(()=>{setTimeout(()=>{C()},100)})}}function x(c={}){const{searchData:i=()=>({})}=l.tableConfig,w=i();A({...y,...pe(l.searchForm.items),...c,...w})}function b(){const{reset:c}=l.tableConfig;c&&c(),l.searchForm.items.forEach(i=>{const w=$.find(F=>te.isArray(i.key)&&te.isArray(F.key)?i.key.join(",")==F.key.join(","):F.key==i.key);w&&(i.value=w.value)}),x()}l.api&&l.immediate&&x();function q(){return{...y,...pe(l.searchForm.items)}}const P=()=>{const c=g.value;c&&c.clearSort()},M=e.reactive({storage:!0}),Ce=e.reactive({drag:!0,resizable:!0,maxFixedSize:0}),ye=e.computed(()=>{const{customConfig:c,columnConfig:i,...w}=l.tableConfig;return{headerAlign:"left",align:"center",customConfig:{...M,...c},columnConfig:{...Ce,...i},"virtual-x-config":{enabled:!1,scrollToLeftOnChange:!1},"virtual-y-config":{enabled:!0,gt:100},...w}}),E=e.reactive({isSelecting:!1,startCell:null,endCell:null,selectedCells:[]}),Re=c=>{const i=c.closest(".vxe-body--column");if(!i||i.classList.contains("col--checkbox")||i.classList.contains("col--seq"))return null;const w=i.closest(".vxe-body--row");if(!w)return null;const F=g.value;if(!F)return null;let z=-1;const j=w.getAttribute("data-rowid");if(j!=null)z=parseInt(j,10);else{const D=w.parentElement;z=Array.from(D.querySelectorAll(".vxe-body--row")).indexOf(w)}if(z<0)return null;let V=-1;const W=i.getAttribute("data-colid");if(W&&(V=F.getColumns().findIndex(T=>T.id===W)),V<0){const T=Array.from(w.querySelectorAll(".vxe-body--column")).indexOf(i),N=!!i.closest(".vxe-table--fixed-left-wrapper"),U=!!i.closest(".vxe-table--fixed-right-wrapper"),O=F.getColumns();if(N){const Y=O.filter(R=>R.fixed==="left");T<Y.length&&(V=O.indexOf(Y[T]))}else if(U){const Y=O.filter(R=>R.fixed==="right");T<Y.length&&(V=O.indexOf(Y[T]))}else{const Y=l.searchForm.showCheckBox?1:0;V=O.filter(H=>H.fixed==="left").length+T-Y}}return V<0?null:{rowIndex:z,colIndex:V,cell:i}},be=c=>{const i=Re(c.target);if(!i){xe();return}E.isSelecting=!0,E.startCell={rowIndex:i.rowIndex,colIndex:i.colIndex},E.endCell={...E.startCell},Ae(),qe()},we=c=>{if(!E.isSelecting)return;const i=Re(c.target);i&&(E.endCell={rowIndex:i.rowIndex,colIndex:i.colIndex},Ae(),qe())},ke=()=>{E.isSelecting=!1},xe=()=>{E.selectedCells=[],E.startCell=null,E.endCell=null;const c=g.value;if(!c)return;c.$el.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(w=>{w.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")})},Ae=()=>{if(!E.startCell||!E.endCell){E.selectedCells=[];return}const c=E.startCell.rowIndex,i=E.endCell.rowIndex,w=E.startCell.colIndex,F=E.endCell.colIndex,z=Math.min(c,i),j=Math.max(c,i),V=Math.min(w,F),W=Math.max(w,F);E.selectedCells=[];for(let D=z;D<=j;D++)for(let T=V;T<=W;T++)E.selectedCells.push({rowIndex:D,colIndex:T})},qe=()=>{e.nextTick(()=>{const c=g.value;if(!c)return;const i=c.$el;if(i.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(N=>{N.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")}),E.selectedCells.length===0)return;const w=c.getColumns(),F=E.selectedCells.map(N=>N.rowIndex),z=E.selectedCells.map(N=>N.colIndex),j=Math.min(...F),V=Math.max(...F),W=Math.min(...z),D=Math.max(...z),T=[i.querySelector(".vxe-table--body-wrapper tbody"),i.querySelector(".vxe-table--fixed-left-wrapper tbody"),i.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean);E.selectedCells.forEach(({rowIndex:N,colIndex:U})=>{const O=w[U];if(!O)return;const Y=O.fixed==="left",R=O.fixed==="right";for(const H of T){const ae=H.querySelectorAll(".vxe-body--row")[N];if(!ae)continue;const X=Array.from(ae.querySelectorAll(".vxe-body--column"));let B=null;if(Y&&H.closest(".vxe-table--fixed-left-wrapper")){const Z=w.filter(G=>G.fixed==="left").indexOf(O);B=X[Z]}else if(R&&H.closest(".vxe-table--fixed-right-wrapper")){const Z=w.filter(G=>G.fixed==="right").indexOf(O);B=X[Z]}else if(!Y&&!R&&H.closest(".vxe-table--body-wrapper")){const ee=l.searchForm.showCheckBox?1:0,Z=w.filter(_e=>_e.fixed==="left").length,G=U-Z;B=X[G+ee]}if(B&&!B.classList.contains("col--checkbox")&&!B.classList.contains("col--seq")){B.classList.add("cell-selected"),N===j&&B.classList.add("cell-border-top"),N===V&&B.classList.add("cell-border-bottom"),U===W&&B.classList.add("cell-border-left"),U===D&&B.classList.add("cell-border-right");break}}})})},jt=async()=>{if(E.selectedCells.length===0)return;const c=g.value;if(!c)return;const i=c.$el,w=c.getColumns(),F=[...new Set(E.selectedCells.map(D=>D.rowIndex))].sort((D,T)=>D-T),z=[...new Set(E.selectedCells.map(D=>D.colIndex))].sort((D,T)=>D-T),j=[i.querySelector(".vxe-table--body-wrapper tbody"),i.querySelector(".vxe-table--fixed-left-wrapper tbody"),i.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean),V=[];F.forEach(D=>{const T=[];z.forEach(N=>{const U=w[N];if(!U){T.push("");return}const O=U.fixed==="left",Y=U.fixed==="right";let R="";for(const H of j){const ae=H.querySelectorAll(".vxe-body--row")[D];if(!ae)continue;const X=Array.from(ae.querySelectorAll(".vxe-body--column"));let B=null;if(O&&H.closest(".vxe-table--fixed-left-wrapper")){const Z=w.filter(G=>G.fixed==="left").indexOf(U);B=X[Z]}else if(Y&&H.closest(".vxe-table--fixed-right-wrapper")){const Z=w.filter(G=>G.fixed==="right").indexOf(U);B=X[Z]}else if(!O&&!Y&&H.closest(".vxe-table--body-wrapper")){const ee=l.searchForm.showCheckBox?1:0,Z=w.filter(_e=>_e.fixed==="left").length,G=N-Z;B=X[G+ee]}if(B&&!B.classList.contains("col--checkbox")&&!B.classList.contains("col--seq")){R=B.innerText||B.textContent||"",R=R.trim(),R=R.replace(/\n/g," ").replace(/\s+/g," ");break}}T.push(R)}),V.push(T.join(" "))});const W=V.join(`
|
|
2
|
+
`);try{await navigator.clipboard.writeText(W)}catch(D){console.error("复制失败:",D)}},Se=c=>{l.searchForm.enableCellCopy&&((c.ctrlKey||c.metaKey)&&c.key==="c"?E.selectedCells.length>0&&(c.preventDefault(),c.stopPropagation(),jt()):c.key==="Escape"&&xe())},Pe=()=>{E.isSelecting=!1},je=c=>{const i=g.value;if(!i||!i.$el)return;i.$el.contains(c.target)||xe()},Ut=c=>{y[S]=c,x()},Yt=c=>{y[k]=c,y[S]=1,x()};function Ue(){const c=g.value.getCheckboxRecords();l.searchForm.selections=c}const Ye=c=>{const i=g.value;if(i){i.toggleCheckboxRow(c);const w=g.value.getCheckboxRecords();l.searchForm.selections=w}};return t({tableRef:g,getList:x,getPrm:q,clearSort:P,calculateTableHeight:I}),(c,i)=>{var D;const w=e.resolveComponent("el-button"),F=e.resolveComponent("el-checkbox"),z=e.resolveComponent("el-text"),j=e.resolveComponent("vxe-column"),V=e.resolveComponent("VxeTable"),W=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({box:o.searchForm.showShadow})},[o.searchForm.showSearch?(e.openBlock(),e.createBlock(ze,{key:0,form:o.searchForm,onReset:b,onConfirm:i[1]||(i[1]=T=>x()),onVisibleChange:e.unref(I)},{btn:e.withCtx(()=>[e.renderSlot(c.$slots,"search-bar-btn",{},void 0,!0),e.createVNode(w,{round:"",onClick:i[0]||(i[0]=T=>g.value.openCustom())},{default:e.withCtx(()=>[e.createVNode(me,{name:"Tools"})]),_:1})]),_:3},8,["form","onVisibleChange"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"table-header-left",{},void 0,!0),e.createElementVNode("div",{ref_key:"tableContentRef",ref:f},[e.createVNode(V,e.mergeProps({id:_.value,ref_key:"tableRef",ref:g,loading:o.loading||d.value,data:o.api?u.value:o.data,border:""},ye.value,{height:L.value,onCheckboxChange:Ue,onCheckboxAll:Ue,onSortChange:(D=ye.value["sort-config"])==null?void 0:D.sortChange}),{default:e.withCtx(()=>[o.searchForm.showCheckBox==null||o.searchForm.showCheckBox?(e.openBlock(),e.createBlock(j,{key:0,type:"checkbox",width:e.unref(r)=="zh_cn"?80:150,title:c.$t("xu-hao"),fixed:"left"},{checkbox:e.withCtx(({rowIndex:T,row:N,checked:U,disabled:O,indeterminate:Y})=>[e.createElementVNode("div",Et,[U?(e.openBlock(),e.createBlock(F,{key:0,checked:!0,disabled:O,size:"default",onClick:e.withModifiers(R=>!O&&Ye(N),["stop"])},null,8,["disabled","onClick"])):(e.openBlock(),e.createBlock(F,{key:1,disabled:O,checked:!1,size:"default",onClick:e.withModifiers(R=>!O&&Ye(N),["stop"])},null,8,["disabled","onClick"])),e.createVNode(z,{type:"info",class:"mgl5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(T+1),1)]),_:2},1024)])]),_:1},8,["width","title"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",{},void 0,!0)]),_:3},16,["id","loading","data","height","onSortChange"])],512),o.searchForm.showPage?(e.openBlock(),e.createBlock(W,{key:1,"current-page":y[e.unref(S)],"onUpdate:currentPage":i[2]||(i[2]=T=>y[e.unref(S)]=T),class:"myPagination mgt10",background:"",layout:"total, sizes, prev, pager, next",total:y.total,"page-size":y[e.unref(k)],"page-sizes":o.searchForm.pageSizes||e.unref(s).pageSizes,onCurrentChange:Ut,onSizeChange:Yt},null,8,["current-page","total","page-size","page-sizes"])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-de0d59d6"]]),Lt={__name:"index",props:{sheetsConfig:{type:Object,required:!0},fileName:{type:String,required:!0}},setup(o){const t=o;function n(){De(t.fileName,t.sheetsConfig)}return(r,a)=>{const s=e.resolveComponent("el-link");return e.openBlock(),e.createBlock(s,e.mergeProps({type:"primary",underline:"never"},r.$attrs,{onClick:n}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.$t("xia-zai-dao-ru-mo-ban")),1)]),_:1},16)}}};function Ft(o,t={}){const n=ue(),r={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:s,value:l,required:d,msg:u=n("validate.invalidInput")}=r;return s?function(_,$,S){if(d){a.test($)?S():S(new Error(u));return}$&&!a.test($)?S(new Error(u)):S()}:a.test(l)}class vt{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 r=await n.json();if(r.success&&r.data)return this.token=r.data.token,this.user=r.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(r.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 r={headers:{"Content-Type":"application/json",...n.headers},...n};r.headers.appId=this.config.clientCode,this.token&&(r.headers.Authorization=`Bearer ${this.token}`);try{const a=await fetch(t,r);return a.status===401?(this.log("Token已过期,需要重新登录"),this.logout(),null):a}catch(a){throw this.log("请求失败:",a),a}}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 Vt(o,t={}){const r=Object.assign({manual:!1,log:!1,params:null,format:null},t),{manual:a,log:s,params:l={},cb:d,format:u}=r,_=e.ref([]),$=e.ref(!1),S=k=>{const y=k||l;$.value=!0,o(y).then(g=>{const{code:f,data:m,msg:I}=g;if(d){const{records:p,rows:C}=m||{},L=p||C?p||C:m;_.value=ge(L,u),d(g)}if(m){if(m.records!=null||m.rows!=null){const{records:p,rows:C,total:L=0}=m||{};y&&y.total!=null&&(l.total=parseInt(L)),_.value=ge(p||C||[],u)}else _.value=ge(m,u);s&&console.log("useRequest-res",_.value)}}).catch(g=>{d&&(console.log("useRequestErr",g),d({code:500}))}).finally(()=>{$.value=!1})};return a||S(),[$,_,S]}function Dt(o){const t=e.ref(o),n=e.ref(""),r=e.ref("");return e.watch(t,a=>{const s=a||["",""];n.value=s[0],r.value=s[1]}),[t,n,r]}function Bt(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()}function ge(o,t){if(!t)return o;if(o instanceof Array)return o.map(r=>{let a={};return t.forEach(s=>a[s]=r[s]),a});let n={};return t.forEach(r=>n[r]=o[r]),n}function zt(o,t=[]){const{locale:n}=Q.useI18n(),r=e.ref(o());return e.watch([n,...t],()=>{r.value=o()},{immediate:!0}),r}function Ot(o,t="zh_cn",n="en_us"){if(!o)return"-";const r={en_us:n,zh_cn:t},s=de().global.locale.value;return o[r[s]]||o[t]||"-"}function Mt(o,t){let n=J.mapState;return typeof o=="string"&&o.length>0&&(n=J.createNamespacedHelpers(o).mapState),Ne(t,n)}function Nt(o,t){let n=J.mapGetters;return typeof o=="string"&&o.length>0&&(n=J.createNamespacedHelpers(o).mapGetters),Ne(t,n)}function Rt(o,t){let n=J.mapActions;return typeof o=="string"&&o.length>0&&(n=J.createNamespacedHelpers(o).mapActions),At(t,n)}function Ne(o,t){const n=J.useStore(),r=t(o),a={};return Object.keys(r).forEach(s=>{const l=r[s].bind({$store:n});a[s]=e.computed(l)}),a}function At(o,t){const n=J.useStore(),r=t(o),a={};return Object.keys(r).forEach(s=>{a[s]=r[s].bind({$store:n})}),a}const qt={__name:"EnumRender",props:{renderOpts:{type:Object,default:()=>({enum:{}})},params:{type:Object}},setup(o){const t=o,n=t.params.row[t.params.column.field];return(r,a)=>{const s=e.resolveComponent("el-text");return o.renderOpts.text?(e.openBlock(),e.createBlock(s,{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1})):(e.openBlock(),e.createBlock(s,{key:1,type:o.renderOpts.enum.getTag(e.unref(n))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1},8,["type"]))}}};function Pt(){oe.VxeUI.renderer.add("Enum",{renderTableDefault(o,t){return[null,void 0].includes(t.row[t.column.field])?"-":React.createElement(qt,{renderOpts:o,params:t})}}),oe.VxeUI.renderer.add("InputNumber",{renderTableDefault(o,t){return React.createElement(K.ElInputNumber,{"v-model":t.row[t.column.field],...o.props,"step-strictly":!0,"value-on-clear":0})}}),oe.VxeUI.renderer.add("TrueFalse",{renderTableDefault(o,t){const{locale:n}=Q.useI18n();let r=n.value=="zh_cn";return React.createElement(K.ElText,{type:t.row[t.column.field]?"success":"danger"},t.row[t.column.field]?r?"是":"YES":r?"否":"NO")}}),oe.VxeUI.renderer.add("I18n",{renderTableDefault(o,t){const{locale:n}=Q.useI18n();let r=n.value=="zh_cn"?t.column.field:o.fieldEn;return t.row[r]||t.row[t.column.field]}}),oe.VxeUI.renderer.add("Link",{renderTableDefault(o,t){var d;let n=t.column.field;const r=Ie.useRouter(),{multiple:a,to:s}=o;if(!a)return React.createElement(K.ElLink,{underline:"never",type:"primary",onclick:()=>r.push({path:s,query:{[n]:t.row[n]}})},t.row[n]);const l=((d=t.row[n])==null?void 0:d.split(","))||[];return l.map((u,_)=>React.createElement("span",null,React.createElement(K.ElLink,{underline:"never",type:"primary",onclick:()=>r.push({path:s,query:{[n]:u}})},u),_<l.length-1?",":""))}})}h.CmpDictionary=Be,h.CmpIcon=me,h.ConfrimButton=yt,h.DownExcelTemp=Lt,h.ImportButton=wt,h.LayOutForm=He,h.ListPage=Tt,h.OnePortalCasSDK=vt,h.SearchBar=ze,h.StatusMap=he,h._toRaw=st,h._typeOf=Bt,h.arrToStatusMap=ct,h.arrayToTree=it,h.checkFileSize=ft,h.creatValidator=Ft,h.createImportFields=mt,h.createListPageId=ht,h.en=ce,h.exportExcel=De,h.getI18n=de,h.getI18nT=ue,h.getListPageConfig=Me,h.getLocaleValue=Ot,h.getValueBykey=pt,h.importExcel=Qe,h.messages=ve,h.registerVxeRenderers=Pt,h.resetListPageConfig=It,h.setListPageConfig=$t,h.setupI18n=Ve,h.sleep=at,h.stringToArray=fe,h.stripHtmlTags=ut,h.unicode2Str=dt,h.useActions=Rt,h.useDatePicker=Dt,h.useGetters=Nt,h.useI18nReState=zt,h.useRequest=Vt,h.useState=Mt,h.zhCn=ie,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.cmp-icon[data-v-34eb8641],.cmp-icon[data-v-733f9daa],.cmp-icon[data-v-5f1449ad]{padding:0!important}.searchBar-container .searchBar[data-v-32ac9990]{overflow:hidden;transition:all .3s}.searchBar-container .btns[data-v-32ac9990]{display:flex;justify-content:space-between;align-items:center}.searchBar-container .btns .left[data-v-32ac9990]{display:flex;align-items:center}.searchBar-container .btns .left[data-v-32ac9990] .el-tabs__header{margin:0}.searchBar-container .btns .right[data-v-32ac9990]{text-align:right}[data-v-
|
|
1
|
+
.cmp-icon[data-v-34eb8641],.cmp-icon[data-v-733f9daa],.cmp-icon[data-v-5f1449ad]{padding:0!important}.searchBar-container .searchBar[data-v-32ac9990]{overflow:hidden;transition:all .3s}.searchBar-container .btns[data-v-32ac9990]{display:flex;justify-content:space-between;align-items:center}.searchBar-container .btns .left[data-v-32ac9990]{display:flex;align-items:center}.searchBar-container .btns .left[data-v-32ac9990] .el-tabs__header{margin:0}.searchBar-container .btns .right[data-v-32ac9990]{text-align:right}[data-v-de0d59d6] .vxe-table-custom-wrapper.placement--top-right.is--active{max-height:400px!important}[data-v-de0d59d6] .vxe-table.cell-copy-enabled .vxe-body--column{-webkit-user-select:none;user-select:none}[data-v-de0d59d6] .vxe-table.cell-copy-enabled .vxe-body--column.cell-selected{background-color:#409eff26!important;position:relative}[data-v-de0d59d6] .vxe-table.cell-copy-enabled .vxe-body--column.cell-border-top:before{content:"";position:absolute;top:0;left:0;right:0;height:1px;background-color:#409eff;pointer-events:none;z-index:10}[data-v-de0d59d6] .vxe-table.cell-copy-enabled .vxe-body--column.cell-border-bottom:after{content:"";position:absolute;bottom:0;left:0;right:0;height:1px;background-color:#409eff;pointer-events:none;z-index:10}[data-v-de0d59d6] .vxe-table.cell-copy-enabled .vxe-body--column.cell-border-left{border-left:1px solid #409eff!important}[data-v-de0d59d6] .vxe-table.cell-copy-enabled .vxe-body--column.cell-border-right{border-right:1px solid #409eff!important}
|
package/package.json
CHANGED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# ListPage 全局配置使用指南
|
|
2
|
+
|
|
3
|
+
## 快速开始
|
|
4
|
+
|
|
5
|
+
### 1. 在项目入口配置一次(main.js)
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { setListPageConfig } from 'joy-admin-components';
|
|
9
|
+
|
|
10
|
+
// 配置全局分页参数(根据后端接口规范配置)
|
|
11
|
+
setListPageConfig({
|
|
12
|
+
// 分页参数名
|
|
13
|
+
pageNoKey: 'pageNum', // 页码参数名,默认 'pageNo'
|
|
14
|
+
pageSizeKey: 'pageSize', // 每页条数参数名,默认 'pageSize'
|
|
15
|
+
|
|
16
|
+
// 分页默认值
|
|
17
|
+
defaultPageSize: 20, // 默认每页条数,默认 10
|
|
18
|
+
pageSizes: [20, 50, 100], // 分页选项,默认 [10, 50, 100, 500]
|
|
19
|
+
|
|
20
|
+
// 响应数据字段映射(支持多种格式,按优先级尝试)
|
|
21
|
+
responseDataKeys: {
|
|
22
|
+
rows: ['data', 'list', 'rows'], // 数据列表字段,默认 ['rows', 'records']
|
|
23
|
+
total: ['totalCount', 'total'], // 总条数字段,默认 ['totalRows', 'total']
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
// UI 功能默认配置
|
|
27
|
+
showSearch: true, // 是否显示搜索栏,默认 false
|
|
28
|
+
showPage: true, // 是否显示分页,默认 false
|
|
29
|
+
showShadow: true, // 是否显示阴影,默认 false
|
|
30
|
+
showCheckBox: true, // 是否显示复选框列,默认 false
|
|
31
|
+
enableCellCopy: true, // 是否启用单元格复制,默认 true
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. 组件中无需再传配置参数
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<!-- 之前:每次都要传各种配置 -->
|
|
40
|
+
<ListPage
|
|
41
|
+
:api="getListApi"
|
|
42
|
+
:searchForm="{
|
|
43
|
+
pageNoKey: 'pageNum', // ❌ 不需要了!
|
|
44
|
+
showSearch: true, // ❌ 不需要了!
|
|
45
|
+
showPage: true, // ❌ 不需要了!
|
|
46
|
+
showCheckBox: true, // ❌ 不需要了!
|
|
47
|
+
items: []
|
|
48
|
+
}"
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<!-- 现在:直接使用,自动采用全局配置 -->
|
|
52
|
+
<ListPage
|
|
53
|
+
:api="getListApi"
|
|
54
|
+
:searchForm="{ items: [] }"
|
|
55
|
+
/>
|
|
56
|
+
</template>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 配置项详解
|
|
60
|
+
|
|
61
|
+
### 完整配置项
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
setListPageConfig({
|
|
65
|
+
// === 请求参数配置 ===
|
|
66
|
+
pageNoKey: 'pageNo', // 页码参数名
|
|
67
|
+
pageSizeKey: 'pageSize', // 每页条数参数名
|
|
68
|
+
|
|
69
|
+
// === 默认值配置 ===
|
|
70
|
+
defaultPageSize: 10, // 默认每页显示条数
|
|
71
|
+
pageSizes: [10, 50, 100, 500], // 分页器下拉选项
|
|
72
|
+
|
|
73
|
+
// === 响应数据字段映射 ===
|
|
74
|
+
responseDataKeys: {
|
|
75
|
+
rows: ['rows', 'records'], // 数据列表字段名(优先级从左到右)
|
|
76
|
+
total: ['totalRows', 'total'], // 总条数字段名
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// === UI 功能默认配置 ===
|
|
80
|
+
showSearch: false, // 是否显示搜索栏
|
|
81
|
+
showPage: false, // 是否显示分页
|
|
82
|
+
showShadow: false, // 是否显示阴影
|
|
83
|
+
showCheckBox: false, // 是否显示复选框列
|
|
84
|
+
enableCellCopy: true, // 是否启用单元格复制功能
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 按需覆盖(特殊场景)
|
|
89
|
+
|
|
90
|
+
如果某个页面的配置与全局配置不同,可以单独覆盖:
|
|
91
|
+
|
|
92
|
+
```vue
|
|
93
|
+
<template>
|
|
94
|
+
<!-- 覆盖分页参数名 -->
|
|
95
|
+
<ListPage
|
|
96
|
+
:api="getListApi"
|
|
97
|
+
:searchForm="{
|
|
98
|
+
pageNoKey: 'page', // 覆盖全局的 pageNoKey
|
|
99
|
+
pageSizeKey: 'limit', // 覆盖全局的 pageSizeKey
|
|
100
|
+
items: []
|
|
101
|
+
}"
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<!-- 覆盖分页默认值和选项 -->
|
|
105
|
+
<ListPage
|
|
106
|
+
:api="getListApi"
|
|
107
|
+
:searchForm="{
|
|
108
|
+
defaultPageSize: 50, // 覆盖默认每页条数
|
|
109
|
+
pageSizes: [50, 100], // 覆盖分页选项
|
|
110
|
+
items: []
|
|
111
|
+
}"
|
|
112
|
+
/>
|
|
113
|
+
|
|
114
|
+
<!-- 覆盖 UI 功能配置 -->
|
|
115
|
+
<ListPage
|
|
116
|
+
:api="getListApi"
|
|
117
|
+
:searchForm="{
|
|
118
|
+
showSearch: false, // 这个表格不显示搜索栏
|
|
119
|
+
showCheckBox: false, // 这个表格不显示复选框
|
|
120
|
+
enableCellCopy: false, // 这个表格禁用单元格复制
|
|
121
|
+
items: []
|
|
122
|
+
}"
|
|
123
|
+
/>
|
|
124
|
+
</template>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 常见后端接口格式示例
|
|
128
|
+
|
|
129
|
+
### 示例 1:标准格式
|
|
130
|
+
|
|
131
|
+
**接口规范:**
|
|
132
|
+
- 请求:`{ pageNo: 1, pageSize: 10 }`
|
|
133
|
+
- 响应:`{ code: 200, data: { rows: [], total: 100 } }`
|
|
134
|
+
|
|
135
|
+
**配置:**
|
|
136
|
+
```js
|
|
137
|
+
// 默认配置,无需额外设置
|
|
138
|
+
setListPageConfig({
|
|
139
|
+
pageNoKey: 'pageNo',
|
|
140
|
+
pageSizeKey: 'pageSize',
|
|
141
|
+
responseDataKeys: {
|
|
142
|
+
rows: ['rows', 'records'],
|
|
143
|
+
total: ['totalRows', 'total'],
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 示例 2:自定义格式
|
|
149
|
+
|
|
150
|
+
**接口规范:**
|
|
151
|
+
- 请求:`{ pageNum: 1, limit: 10 }`
|
|
152
|
+
- 响应:`{ code: 0, data: { list: [], totalCount: 100 } }`
|
|
153
|
+
|
|
154
|
+
**配置:**
|
|
155
|
+
```js
|
|
156
|
+
setListPageConfig({
|
|
157
|
+
pageNoKey: 'pageNum',
|
|
158
|
+
pageSizeKey: 'limit',
|
|
159
|
+
responseDataKeys: {
|
|
160
|
+
rows: ['list'],
|
|
161
|
+
total: ['totalCount'],
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 示例 3:兼容多种格式
|
|
167
|
+
|
|
168
|
+
**接口规范:**
|
|
169
|
+
- 有的接口返回 `rows`,有的返回 `records`,还有的返回 `list`
|
|
170
|
+
- 有的接口返回 `total`,有的返回 `totalCount`
|
|
171
|
+
|
|
172
|
+
**配置:**
|
|
173
|
+
```js
|
|
174
|
+
setListPageConfig({
|
|
175
|
+
responseDataKeys: {
|
|
176
|
+
// 按优先级尝试,找到第一个存在的字段
|
|
177
|
+
rows: ['list', 'rows', 'records', 'data'],
|
|
178
|
+
total: ['totalCount', 'total', 'totalRows'],
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## API 文档
|
|
184
|
+
|
|
185
|
+
### setListPageConfig(config)
|
|
186
|
+
|
|
187
|
+
设置全局配置。
|
|
188
|
+
|
|
189
|
+
**参数:**
|
|
190
|
+
- `config` (Object) - 配置对象
|
|
191
|
+
- `pageNoKey` (String) - 页码参数名
|
|
192
|
+
- `pageSizeKey` (String) - 每页条数参数名
|
|
193
|
+
- `defaultPageSize` (Number) - 默认每页条数
|
|
194
|
+
- `pageSizes` (Array\<Number\>) - 分页选项
|
|
195
|
+
- `responseDataKeys` (Object) - 响应数据字段映射
|
|
196
|
+
- `rows` (Array\<String\>) - 数据列表字段名
|
|
197
|
+
- `total` (Array\<String\>) - 总条数字段名
|
|
198
|
+
- `showSearch` (Boolean) - 是否显示搜索栏
|
|
199
|
+
- `showPage` (Boolean) - 是否显示分页
|
|
200
|
+
- `showShadow` (Boolean) - 是否显示阴影
|
|
201
|
+
- `showCheckBox` (Boolean) - 是否显示复选框列
|
|
202
|
+
- `enableCellCopy` (Boolean) - 是否启用单元格复制功能
|
|
203
|
+
|
|
204
|
+
**示例:**
|
|
205
|
+
```js
|
|
206
|
+
setListPageConfig({
|
|
207
|
+
pageNoKey: 'pageNum',
|
|
208
|
+
defaultPageSize: 20,
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### getListPageConfig()
|
|
213
|
+
|
|
214
|
+
获取当前全局配置。
|
|
215
|
+
|
|
216
|
+
**返回:**
|
|
217
|
+
- (Object) 当前配置对象
|
|
218
|
+
|
|
219
|
+
**示例:**
|
|
220
|
+
```js
|
|
221
|
+
const config = getListPageConfig();
|
|
222
|
+
console.log(config.pageNoKey); // 'pageNo'
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### resetListPageConfig()
|
|
226
|
+
|
|
227
|
+
重置为默认配置。
|
|
228
|
+
|
|
229
|
+
**示例:**
|
|
230
|
+
```js
|
|
231
|
+
resetListPageConfig();
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## 优势
|
|
235
|
+
|
|
236
|
+
✅ **配置一次,全项目生效** - 不用每个页面都传分页参数和 UI 配置
|
|
237
|
+
✅ **灵活覆盖** - 特殊场景可单独配置
|
|
238
|
+
✅ **兼容多种接口格式** - 支持配置多个字段名按优先级尝试
|
|
239
|
+
✅ **统一管理** - 所有表格的默认行为统一管理,易于维护
|
|
240
|
+
✅ **向后兼容** - 不影响现有代码
|
|
241
|
+
|
|
242
|
+
## 典型使用场景
|
|
243
|
+
|
|
244
|
+
### 场景 1:全项目表格都需要搜索、分页和复选框
|
|
245
|
+
|
|
246
|
+
```js
|
|
247
|
+
// main.js - 全局配置
|
|
248
|
+
setListPageConfig({
|
|
249
|
+
showSearch: true,
|
|
250
|
+
showPage: true,
|
|
251
|
+
showCheckBox: true,
|
|
252
|
+
});
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
```vue
|
|
256
|
+
<!-- 各个页面中 - 简洁! -->
|
|
257
|
+
<ListPage :api="getUserList" :searchForm="{ items: searchItems }" />
|
|
258
|
+
<ListPage :api="getOrderList" :searchForm="{ items: searchItems }" />
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### 场景 2:个别页面不需要某些功能
|
|
262
|
+
|
|
263
|
+
```vue
|
|
264
|
+
<!-- 某个简单的查看页面,只需要展示数据 -->
|
|
265
|
+
<ListPage
|
|
266
|
+
:api="getLogList"
|
|
267
|
+
:searchForm="{
|
|
268
|
+
showSearch: false, // 不需要搜索
|
|
269
|
+
showCheckBox: false, // 不需要复选框
|
|
270
|
+
items: []
|
|
271
|
+
}"
|
|
272
|
+
/>
|
|
273
|
+
```
|