general-basic-form 1.1.4 → 1.2.1
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.
- package/README.assets/image-20210820173738506.png +0 -0
- package/README.md +15 -5
- package/dist/index.js +866 -275
- package/dist/index.umd.cjs +1 -1
- package/package.json +7 -17
- package/public/index.d.ts +17 -0
- package/script/initialization.ts +24 -0
- package/script/link.ts +14 -0
- package/script/linkNode.ts +14 -0
- package/script/unlinkModule.ts +48 -0
- package/script/unlinkNode.ts +38 -0
- package/tsconfig.json +14 -0
- package/vite.config.js +121 -0
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(i=typeof globalThis<"u"?globalThis:i||self,f(i.Index={},i.Vue))})(this,function(i,f){"use strict";const ne="";function c(t,e,n,r,a,o,p,ee){var s=typeof t=="function"?t.options:t;e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),r&&(s.functional=!0),o&&(s._scopeId="data-v-"+o);var u;if(p?(u=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__<"u"&&(l=__VUE_SSR_CONTEXT__),a&&a.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(p)},s._ssrRegister=u):a&&(u=ee?function(){a.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:a),u)if(s.functional){s._injectStyles=u;var te=s.render;s.render=function(re,_){return u.call(_),te(re,_)}}else{var h=s.beforeCreate;s.beforeCreate=h?[].concat(h,u):[u]}return{exports:t,options:s}}const y={props:{verificationSetting:{type:Object,default:()=>{}},getSmscode:{type:Function,default:()=>{}}},data(){return{defaultText:this.verificationSetting.defaultText||"获取验证码",buttonText:this.verificationSetting.defaultText||"获取验证码",restTime:this.verificationSetting.restTime||60,timer:null}},computed:{buttonType(){return this.buttonText===this.defaultText}},destroyed(){this.reset()},methods:{reset(){this.timer&&(clearInterval(this.timer),this.timer=null,this.buttonText=this.defaultText)},async buttonClick(){if(this.buttonText===this.defaultText)if(this.buttonText=this.restTime,this.timer=setInterval(()=>{if(Number(this.buttonText)<=0||!this.buttonText){this.reset();return}else this.buttonText=Number(this.buttonText)-1},1e3),this.getSmscode)await this.getSmscode()===!1&&this.reset();else return}}};var m=function(){var e=this,n=e._self._c;return n("el-button",{on:{click:e.buttonClick}},[e._v(e._s(e.buttonType?e.defaultText:e.buttonText+"s"))])},g=[],b=c(y,m,g,!1,null,null,null,null);const v=b.exports,k=(t={})=>{for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];Object.prototype.toString.call(n)==="[object Object]"&&(t[e]=JSON.stringify(n))}return t},x=(t={})=>{for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];try{/[{]+/g.test(n)&&/[}]+/g.test(n)&&(t[e]=JSON.parse(n))}catch{}}return t},S={paramsToQuery:k,queryToData:x},d=S,ae="",T={name:"GeneralBasicForm",components:{InputArchive:t=>{const{templateEle:e}=t;return e()},VerificationButton:v},props:{showSearch:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:()=>[]},size:{type:String,default:""},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}},noInputBlank:{type:Boolean,default:()=>!1},currentPageKey:{type:String,default:"page"},pageSizeKey:{type:String,default:"limit"},defCurrentPage:{type:Number,default:1},defPageSize:{type:Number,default:10}},data(){var t;return{queryParams:{...this.noUrlParameters?{}:d.queryToData((t=this.$route)==null?void 0:t.query)},formLoading:this.loading||!1,selectSetting:{placeholder:"请选择",filterable:!0,clearable:!0,style:"width: 200px"},inputSetting:{placeholder:"请输入",style:"width: 200px",clearable:!0},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"},attrs:{inline:!0,"label-position":"left"}}},watch:{formData:{handler(t,e){JSON.stringify(t)!==JSON.stringify(e)&&(this.queryParams={...this.queryParams,...t})},immediate:!0},queryParams:{handler(t){this.$emit("update:formData",{...t})},deep:!0},$attrs:{handler(t){this.attrs={...this.attrs,...t}},immediate:!0,deep:!0},loading(t){this.formLoading!==t&&(this.formLoading=t)},formLoading(t){this.loading!==t&&this.$emit("update:loading",t)}},methods:{handleQuery(t={}){var r,a;t.defaultPageFirst??(t.defaultPageFirst=!0);const e={[this.currentPageKey]:this.defCurrentPage,[this.pageSizeKey]:this.defPageSize},n=d.paramsToQuery(t.defaultPageFirst?{...(r=this.$route)==null?void 0:r.query,...this.queryParams,...e}:{...e,...(a=this.$route)==null?void 0:a.query,...this.queryParams});this.noUrlParameters||this.$router.push({query:{...n}}),this.getList({...n})},async resetQuery(){var e;this.$refs.queryFormRef.resetFields();const t={[this.currentPageKey]:this.defCurrentPage};this.noUrlParameters||await this.$router.push({query:{...t}}),this.queryParams={...this.noUrlParameters?{}:d.queryToData((e=this.$route)==null?void 0:e.query)},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"},getItemRules(t){const{type:e,rules:n=[]}=t,r=[...n];return this.noInputBlank&&e==="input"&&r.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),r},getInputSetting(t){const{inputSetting:e,setting:n}=t;return{...this.inputSetting,...e,...n}},defaultFunction(){},getInputEvents(t){return{blur:t.blur||this.defaultFunction,focus:t.focus||this.defaultFunction,change:t.change||this.defaultFunction,input:t.input||this.defaultFunction,clear:t.clear||this.defaultFunction}},getSelectSetting(t){const{selectSetting:e,setting:n}=t;return{...this.selectSetting,...e,...n}},getSelectEvents(t){return{change:t.change||this.defaultFunction,"visible-change":t["visible-change"]||this.defaultFunction,"remove-tag":t["remove-tag"]||this.defaultFunction,"expand-change":t["expand-change"]||this.defaultFunction,clear:t.clear||this.defaultFunction,blur:t.blur||this.defaultFunction,focus:t.focus||this.defaultFunction}},getDatePackerSetting(t){const{datePackerSetting:e,setting:n}=t;return{...this.datePackerSetting,...e,...n}},getDatePackerEvents(t){return{change:t.change||this.defaultFunction,blur:t.blur||this.defaultFunction,focus:t.focus||this.defaultFunction}},getCheckboxGroupSetting(t){const{checkboxGroupSetting:e,setting:n}=t;return{...e,...n}},getCheckboxGroupEvents(t){return{change:t.change||this.defaultFunction}}}};var P=function(){var e=this,n=e._self._c;return n("el-form",e._b({directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryFormRef",attrs:{model:e.queryParams,"label-width":e.labelWidth}},"el-form",e.attrs,!1),[e._l(e.formItem,function(r){return n("el-form-item",e._b({key:r.prop,attrs:{rules:e.getItemRules(r)}},"el-form-item",r,!1),[r.type==="input"?n("el-input",e._g(e._b({attrs:{size:e.size},nativeOn:{keydown:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(r.template,function(a,o){return{key:o,fn:function(){return[a?n(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:a}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[r.prop],callback:function(a){e.$set(e.queryParams,r.prop,a)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(r),!1),e.getInputEvents(r))):r.type==="input-mobile-verification"?n("el-input",e._g(e._b({attrs:{size:e.size},nativeOn:{keydown:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(r.template,function(a,o){return{key:o,fn:function(){return[a?n(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:a}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[r.prop],callback:function(a){e.$set(e.queryParams,r.prop,a)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(r),!1),e.getInputEvents(r)),[n("template",{slot:"append"},[n("verification-button",{attrs:{verificationSetting:r.verificationSetting,getSmscode:r.getSmscode}})],1)],2):r.type==="select"?n("el-select",e._g(e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[r.prop],callback:function(a){e.$set(e.queryParams,r.prop,a)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(r),!1),e.getSelectEvents(r)),e._l(r.option||[],function(a){return n("el-option",{key:a.key||a.value,attrs:{label:a.label,value:a.value}})}),1):r.type==="cascader"?n("el-cascader",e._g(e._b({attrs:{filterable:"",size:e.size,options:r.options||[]},model:{value:e.queryParams[r.prop],callback:function(a){e.$set(e.queryParams,r.prop,a)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(r),!1),e.getSelectEvents(r))):r.type==="date-picker"?n("el-date-picker",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[r.prop],callback:function(a){e.$set(e.queryParams,r.prop,a)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(r),!1),e.getDatePackerEvents(r))):e._e(),r.type==="input-number"?n("el-input-number",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[r.prop],callback:function(a){e.$set(e.queryParams,r.prop,a)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(r),!1),e.getInputEvents(r))):r.type==="checkbox"?n("el-checkbox-group",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[r.prop],callback:function(a){e.$set(e.queryParams,r.prop,a)},expression:"queryParams[item.prop]"}},"el-checkbox-group",e.getCheckboxGroupSetting(r),!1),e.getCheckboxGroupEvents(r)),e._l(r.option||[],function(a){return n("el-checkbox",e._b({key:a.key||a.value||a.label},"el-checkbox",a,!1))}),1):e._e(),/^form-item-slot$/i.test(r.type)?e._t(r.name):e._e()],2)}),e._t("default"),e.formOnly?e._e():n("el-form-item",[n("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:e.size,loading:e.formLoading},on:{click:e.handleQuery}},[e._v("查询")]),n("el-button",{attrs:{icon:"el-icon-refresh",size:e.size},on:{click:e.resetQuery}},[e._v("重置")])],1),e._t("behind-the-button")],2)},$=[],C=c(T,P,$,!1,null,"b0880d48",null,null);const F=C.exports,se="",q={components:{},props:{query:{type:Object,default:()=>({prefCode:sessionStorage.getItem("prefCode")})},routePath:{type:String,default:()=>"/search/searchDetail"},inputstyle:{type:Object,default:()=>({width:"1280px"})},openHref:{type:Boolean,default:()=>!1},size:{type:String,default:()=>"medium"}},data(){var t,e;return{keyWord:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.keyWord)||"",attrs:{}}},watch:{$attrs:{handler(t){this.attrs={...this.attrs,...t}},immediate:!0,deep:!0}},methods:{search(){const t={path:this.routePath,query:{...this.query,keyWord:this.keyWord}};if(this.openHref){const e=this.$router.resolve(t);window.open(e.href,"_blank")}else this.$router.push(t)}}};var N=function(){var e=this,n=e._self._c;return n("div",{staticClass:"search-box"},[n("el-input",e._b({style:{...e.inputstyle},attrs:{size:e.size},nativeOn:{keydown:function(r){return!r.type.indexOf("key")&&e._k(r.keyCode,"enter",13,r.key,"Enter")?null:e.search.apply(null,arguments)}},model:{value:e.keyWord,callback:function(r){e.keyWord=r},expression:"keyWord"}},"el-input",e.attrs,!1),[n("svg",{staticClass:"el-input__icon",attrs:{slot:"prefix",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},slot:"prefix"},[n("path",{attrs:{d:"M9.51033 10.2186C8.69189 10.8814 7.64943 11.2784 6.51424 11.2784C3.88302 11.2784 1.75 9.14541 1.75 6.51421C1.75 3.88301 3.88302 1.75 6.51424 1.75C9.14545 1.75 11.2785 3.88301 11.2785 6.51421C11.2785 7.64942 10.8814 8.69189 10.2186 9.51034L13.75 13.0417L13.0417 13.75L9.51033 10.2186ZM10.2768 6.51421C10.2768 4.43623 8.59224 2.75168 6.51424 2.75168C4.43623 2.75168 2.75168 4.43623 2.75168 6.51421C2.75168 8.59219 4.43623 10.2767 6.51424 10.2767C8.59224 10.2767 10.2768 8.59219 10.2768 6.51421Z",fill:"#959A9F"}})])])],1)},w=[],O=c(q,N,w,!1,null,"ef706e31",null,null);const D=O.exports,z={name:"Descriptions",components:{DescriptionsColumn:{functional:!0,props:{column:{default:{render:()=>{}},type:Object},formData:{default:{},type:Object}},render(t,e){const{props:n}=e,{column:r,formData:a}=n;return r.render(a)}}},data(){return{attrs:{border:!0,class:"v-descriptions"}}},props:{formItem:{type:Array,default:()=>[]},formData:{type:Object,default:()=>{}}},watch:{$attrs:{handler(t){this.attrs={...this.attrs,...t}},immediate:!0,deep:!0}}};var I=function(){var e=this,n=e._self._c;return n("el-descriptions",e._b({},"el-descriptions",e.attrs,!1),e._l(e.formItem,function(r,a){return n("el-descriptions-item",e._b({key:r.prop,attrs:{label:r.label}},"el-descriptions-item",r.descriptionsItemProps,!1),[r.render?n("DescriptionsColumn",{attrs:{column:r,formData:e.formData}}):n("span",[e._v(e._s(e.formData[r.prop]))])],1)}),1)},B=[],K=c(z,I,B,!1,null,null,null,null);const L=K.exports,oe="",R={props:{nodeKey:{type:String,default:"id"},filterable:{type:Boolean,default:!1},dataSource:{type:Array,default:()=>[]},checkedKeys:{type:Array,default:()=>[]}},watch:{sourceFilterText(t){this.$refs.sourceTree.filter(t)},selectedFilterText(t){this.$refs.selectTree.filter(t)},checkedKeys(t){this.$refs.sourceTree.setCheckedKeys(t),f.nextTick(()=>{this.getSelectedData(),this.$refs.selectTree.setCheckedKeys(t)})}},data(){return{defaultTreeAttributes:{"default-expand-all":!0,"show-checkbox":!0},selectedList:[],sourceFilterText:"",selectedFilterText:""}},methods:{sourceFilterNode(t,e){return t?e.label.indexOf(t)!==-1:!0},getSelectedData(){let t=!0,e;const n=this.$refs.sourceTree.getCheckedNodes(t,e);this.selectedList=n},removeSelectedData(){let t,e;const n=this.$refs.selectTree.getCheckedNodes(t,e),r={};n.forEach(a=>{r[a[this.nodeKey]]=a}),this.selectedList=this.selectedList.filter(a=>!r[a[this.nodeKey]])}}};var E=function(){var e=this,n=e._self._c;return n("div",{staticClass:"tree-box"},[n("div",{staticClass:"left-box"},[e.filterable?n("el-input",{attrs:{placeholder:"输入关键字进行过滤"},model:{value:e.sourceFilterText,callback:function(r){e.sourceFilterText=r},expression:"sourceFilterText"}}):e._e(),n("el-tree",e._b({ref:"sourceTree",attrs:{data:e.dataSource,"filter-node-method":e.sourceFilterNode,nodeKey:e.nodeKey}},"el-tree",{...e.defaultTreeAttributes},!1))],1),n("div",{staticClass:"mid-box"},[n("el-button",{attrs:{icon:"el-icon-arrow-right",circle:""},on:{click:e.getSelectedData}}),n("el-button",{attrs:{icon:"el-icon-arrow-left",circle:""},on:{click:e.removeSelectedData}})],1),n("div",{staticClass:"right-box"},[e.filterable?n("el-input",{attrs:{placeholder:"输入关键字进行过滤"},model:{value:e.selectedFilterText,callback:function(r){e.selectedFilterText=r},expression:"selectedFilterText"}}):e._e(),n("el-tree",e._b({ref:"selectTree",attrs:{data:e.selectedList,"filter-node-method":e.sourceFilterNode,nodeKey:e.nodeKey}},"el-tree",{...e.defaultTreeAttributes},!1))],1)])},A=[],V=c(R,E,A,!1,null,"49dbad2a",null,null);const j=V.exports,le="",U={name:"VTabs",data(){return{activeName:this.activeNameInit()}},props:{tabPanes:{type:Array,default:()=>[]},noUrlParameters:{type:Boolean,default:()=>!1},activeNameKey:{type:String,default:"activeName"},defActiveName:{type:String},getList:{type:Function,default:()=>{}}},watch:{defActiveName:{handler(t,e){JSON.stringify(t)!==JSON.stringify(e)&&(this.activeName=t)},immediate:!0},activeName:{handler(t){this.$emit(`update:${this.activeNameKey}`,t)}}},methods:{handleClick(t,e){var r;const n=d.paramsToQuery({...(r=this.$route)==null?void 0:r.query,[this.activeNameKey]:this.activeName});this.noUrlParameters||this.$router.push({query:{...n}}),this.getList({...n})},activeNameInit(){var n,r,a;let t="";(n=this.tabPanes[0])!=null&&n.name&&(t=(r=this.tabPanes[0])==null?void 0:r.name);const e=d.queryToData(Number((a=this.$route)==null?void 0:a.query[this.activeNameKey]));return!this.noUrlParameters&&e&&(t=e),this.defActiveName&&(t=this.defActiveName),`${t}`}}};var G=function(){var e=this,n=e._self._c;return n("el-tabs",e._b({on:{"tab-click":e.handleClick},model:{value:e.activeName,callback:function(r){e.activeName=r},expression:"activeName"}},"el-tabs",e.$attrs,!1),[e._l(e.tabPanes,function(r){return n("el-tab-pane",e._b({key:r.name},"el-tab-pane",r,!1),[e._v(" "+e._s(r.render&&r.render(r))+" ")])}),e._t("default")],2)},W=[],Q=c(U,G,W,!1,null,"91cf6f01",null,null);const J=Q.exports,H=F,M=D,X=L,Z=j,Y=J;i.VDescriptions=X,i.VGeneralBasicForm=H,i.VSearchBox=M,i.VTabs=Y,i.VTreeTransfer=Z,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(D,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],$):(D=typeof globalThis<"u"?globalThis:D||self,$(D.Index={},D.Vue))})(this,function(D,$){"use strict";const ot="";function k(r,e,t,a,n,o,s,c){var i=typeof r=="function"?r.options:r;e&&(i.render=e,i.staticRenderFns=t,i._compiled=!0),a&&(i.functional=!0),o&&(i._scopeId="data-v-"+o);var l;if(s?(l=function(u){u=u||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!u&&typeof __VUE_SSR_CONTEXT__<"u"&&(u=__VUE_SSR_CONTEXT__),n&&n.call(this,u),u&&u._registeredComponents&&u._registeredComponents.add(s)},i._ssrRegister=l):n&&(l=c?function(){n.call(this,(i.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(i.functional){i._injectStyles=l;var d=i.render;i.render=function(f,h){return l.call(h),d(f,h)}}else{var p=i.beforeCreate;i.beforeCreate=p?[].concat(p,l):[l]}return{exports:r,options:i}}const ae={props:{verificationSetting:{type:Object,default:()=>{}},getSmscode:{type:Function,default:()=>{}}},data(){return{defaultText:this.verificationSetting.defaultText||"获取验证码",buttonText:this.verificationSetting.defaultText||"获取验证码",restTime:this.verificationSetting.restTime||60,timer:null}},computed:{buttonType(){return this.buttonText===this.defaultText}},destroyed(){this.reset()},methods:{reset(){this.timer&&(clearInterval(this.timer),this.timer=null,this.buttonText=this.defaultText)},async buttonClick(){if(this.buttonText===this.defaultText)if(this.buttonText=this.restTime,this.timer=setInterval(()=>{if(Number(this.buttonText)<=0||!this.buttonText){this.reset();return}else this.buttonText=Number(this.buttonText)-1},1e3),this.getSmscode)await this.getSmscode()===!1&&this.reset();else return}}};var ne=function(){var e=this,t=e._self._c;return t("el-button",{on:{click:e.buttonClick}},[e._v(e._s(e.buttonType?e.defaultText:e.buttonText+"s"))])},se=[],oe=k(ae,ne,se,!1,null,null,null,null);const ie=oe.exports,ce=(r={})=>{for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const t=r[e];Object.prototype.toString.call(t)==="[object Object]"&&(r[e]=JSON.stringify(t))}return r},le=(r={})=>{for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){const t=r[e];try{/[{]+/g.test(t)&&/[}]+/g.test(t)&&(r[e]=JSON.parse(t))}catch{}}return r},W={paramsToQuery:ce,queryToData:le},S=K;(function(r,e){const t=K,a=r();for(;;)try{if(parseInt(t(224))/1*(-parseInt(t(262))/2)+parseInt(t(271))/3*(-parseInt(t(273))/4)+-parseInt(t(281))/5*(-parseInt(t(257))/6)+-parseInt(t(250))/7*(-parseInt(t(253))/8)+-parseInt(t(261))/9+-parseInt(t(247))/10+-parseInt(t(276))/11*(-parseInt(t(256))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(j,932279);const g={};let I=null;const M=async(r,e)=>{const t=K;!window.indexedDB&&window[t(252)](t(236));const{DBName:a="",DBVersion:n=1}=r;let o,s=!1;try{const c=window[t(265)].open(a,n);await new Promise((i,l)=>{const d=t;c[d(231)]=async function(p){const u=d,f=p[u(286)][u(228)],{stores:h=[]}=r;await Promise[u(269)](h[u(242)](async y=>{const m=u,{DBStoreName:b="",properties:w={}}=y;try{const B={};B[m(237)]=r[m(238)];const O=p[m(234)].result[m(289)](b,B);if(Object[m(241)](w)[m(282)]===0){console[m(226)](b+m(275));return}for(const T in w)if(w[m(223)][m(268)](w,T)){const z=w[T],N={...z[m(258)]};O[m(258)](T,T,N)}}catch(B){console.warn(B)}})),o=f,s=!0},c[d(288)]=async function(p){const u=d;if(o=this[u(228)],s){const{stores:f=[]}=r;await Promise[u(269)](f[u(242)](async h=>{const y=u,{DBStoreName:m=""}=h,b=o[y(246)]([m],y(251)),w=b[y(274)](m),B={};B[r[y(238)]]=e,w[y(285)](B);try{await new Promise((O,T)=>{const z=y;b.onabort=function(N){const V=K;console[V(230)](V(254),N),T()},b[z(272)]=function(N){O()},b[z(260)]=function(N){const V=z;console[V(230)](V(239),N),T()}})}catch(O){console[y(226)](y(270),O)}}))}i()},c[d(260)]=function(p){l(p)}})}catch(c){console.error(c,t(266))}return o};function j(){const r=["1464mvMiei","237864JBnTLr","createIndex","info","onerror","10438893QpczMy","2762094YVzJZu","update","Database connection closed, reconnecting...","indexedDB","打开数据库报错,可能是数据库版本不对,或者储存容量不足等原因","传入结构化克隆算法不支持的数据类型可能导致报错","call","all","目前所有数据都在用户ID的主键下面,所以没有主键的话做重新载入页面处理","4860399kEbqOd","oncomplete","4VdzWwr","objectStore","没有设置默认值","235378QpXYjE","deleteDB","close","事务失败","数据库删除失败","140VRAbTP","length","store不存在,请更新schema和DBVersion并重启前端服务","getDB","add","target","DBName","onsuccess","createObjectStore","hasOwnProperty","1UrIRyX","updateStore","warn","openCursor","result","put","error","onupgradeneeded","deleteStore","主键查询结果:","currentTarget","mapDB","您的浏览器不支持IndexedDB的稳定版本。离线数据功能将不可用。Your browser doesn't support a stable version of IndexedDB. offline data feature will not be available.","keyPath","primaryKey","主键插入失败","数据更新成功","keys","map","delete","get","数据更新失败没有request","transaction","4043600olVeJQ","数据更新失败","addEventListener","163681jsedKz","readwrite","alert","608zfClSO","主键插入中止","continue"];return j=function(){return r},j()}function K(r,e){const t=j();return K=function(a,n){return a=a-223,t[a]},K(r,e)}let R=!1;g[S(284)]=async r=>{const e=S,{mapDB:t,primaryKey:a}=r;return t?a?(R&&await new Promise(async(n,o)=>{const s=()=>{R?setTimeout(()=>{s()},200):n()};s()}),!I&&(R=!0,I=await M(t,a),I==null||I[e(249)](e(278),async()=>{const n=e;console[n(259)](n(264)),I=await M(t,a)}),R=!1),I):(console[e(226)]("获取Database缺乏用户信息,请先传入对primaryKey的赋值"),!1):(console[e(226)]("必须传入数据库配置信息"),!1)},g.getDataByKey=async(r,e)=>{const t=S,{mapDB:a,tableName:n,primaryKey:o}=r,s={};s[t(235)]=a,s[t(238)]=o;const c=await g[t(284)](s);if(!c)return;const i=c.transaction([n]),l=i[t(274)](n),d=l[t(244)](o);return new Promise((p,u)=>{const f=t;d[f(288)]=function(h){const y=f;e(n+y(233)+d[y(228)]),p(d[y(228)])},d[f(260)]=function(h){const y=f;console[y(230)](n+y(279)+h),u()}})},g[S(225)]=async(r,e)=>{var t;const a=S,{mapDB:n,tableName:o,updateData:s}=r;!s[n==null?void 0:n[a(238)]]&&console[a(226)]("请传入主键"+n[a(238)]);const c={};c[a(235)]=n,c[a(238)]=s[n==null?void 0:n[a(238)]];const i=await g.getDB(c);if(!i)return;let l=null;try{l=i[a(246)]([o],"readwrite").objectStore(o)}catch(f){console[a(230)](a(283),f)}let d=null,p=null;const u=await new Promise((f,h)=>{const y=a,m=l[y(227)](s[n==null?void 0:n.primaryKey]);m[y(288)]=b=>{f(b)},m.onerror=b=>{h(b)}});p=(t=u==null?void 0:u[a(286)])==null?void 0:t[a(228)];try{p&&(p==null?void 0:p[a(238)])===s[n==null?void 0:n.primaryKey]?d=p[a(263)](s):d=l[a(229)](s)}catch(f){console[a(230)](a(267),f,s)}new Promise((f,h)=>{const y=a;!d&&(console[y(230)](o+y(245)),h()),d[y(288)]=function(m){e(o+y(240)),f()},d[y(260)]=function(m){const b=y;console[b(230)](o+b(248),m),h()}}),p&&p[a(255)]()},g[S(232)]=async(r,e)=>{const t=S,{mapDB:a,tableName:n,primaryKey:o}=r,s={};s[t(235)]=a,s[t(238)]=o;const c=await g[t(284)](s);if(!c)return;const i=c[t(246)]([n],t(251))[t(274)](n)[t(243)](o);return new Promise((l,d)=>{const p=t;i[p(288)]=function(u){e(n+"数据删除成功"),l()},i.onerror=function(u){console[p(230)](n+"数据删除失败"+u),d()}})},g[S(277)]=async(r,e)=>{const t=S,{mapDB:a}=r,n=window[t(265)].deleteDatabase(a[t(287)]);return new Promise((o,s)=>{const c=t;n[c(288)]=i=>{e(a[c(287)]+"数据库已删除"),o()},n[c(260)]=i=>{const l=c;console[l(230)](a[l(287)]+l(280)+i),s()}})};const G=P;function E(){const r=["error","18qzGcVH","4682604GbULBa","6016003SPdUIY","20065atPLOQ","updateStore","65UvpzlD","6700512ZDDSvv","handleData","为空,请先调用handleData","mapDB","13110xITriW","primaryKey","deleteStore","getDataByKey","clearData","7689BMhWoa","404ipIPIB","22929dseKps","426mZTQfR","8660kGxzIL","tableName","9mGIzFA","updateData"];return E=function(){return r},E()}(function(r,e){const t=P,a=r();for(;;)try{if(parseInt(t(400))/1*(-parseInt(t(405))/2)+parseInt(t(398))/3*(-parseInt(t(397))/4)+parseInt(t(408))/5*(parseInt(t(399))/6)+-parseInt(t(407))/7+parseInt(t(387))/8*(-parseInt(t(402))/9)+-parseInt(t(391))/10*(-parseInt(t(396))/11)+parseInt(t(406))/12*(parseInt(t(410))/13)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(E,605521);async function ue(r,e){const t=P,{tableName:a,propertiesKey:n,parameter:o,primaryKey:s,mapDB:c}=r;let i=null,l={[c[t(392)]]:s};const d={};d[t(390)]=c,d[t(401)]=a,d[t(392)]=s;const p=await g[t(394)](d);p&&(l={...p,[c[t(392)]]:s}),l[n]=o;const u={};return u[t(390)]=c,u[t(401)]=a,u.updateData=l,await g[t(409)](u),o&&(i=o),e(i),i}async function pe(r,e){const t=P,{tableName:a,propertiesKey:n,primaryKey:o,mapDB:s}=r;let c=null;const i={};i[t(390)]=s,i[t(401)]=a,i.primaryKey=o;const l=await g[t(394)](i);return l&&(c=l[n]),e(c),c}async function de(r,e){const t=P,{tableName:a,propertiesKey:n,parameter:o,primaryKey:s,mapDB:c}=r;let i={};const l={};l[t(390)]=c,l[t(401)]=a,l[t(392)]=s;const d=await g.getDataByKey(l);try{if(d){i={...d[n],...o};const p={[c[t(392)]]:s},u=p;u[n]=i;const f={};f[t(390)]=c,f[t(401)]=a,f[t(403)]=u,await g[t(409)](f)}else console.warn(a+t(389))}catch(p){console.error(p)}return e(i),i}function P(r,e){const t=E();return P=function(a,n){return a=a-387,t[a]},P(r,e)}async function fe(r,e){const t=P,{tableName:a,primaryKey:n,mapDB:o}=r;let s=null;try{const c={};c[t(390)]=o,c.tableName=a,c.primaryKey=n,await g[t(393)](c)}catch(c){console[t(404)](c)}return e(s),s}const C={};C[G(388)]=ue,C.getData=pe,C[G(403)]=de,C[G(395)]=fe;var v=Q;(function(r,e){for(var t=Q,a=r();;)try{var n=-parseInt(t(195))/1*(-parseInt(t(179))/2)+-parseInt(t(196))/3*(-parseInt(t(194))/4)+-parseInt(t(197))/5+parseInt(t(183))/6*(-parseInt(t(191))/7)+-parseInt(t(190))/8+-parseInt(t(202))/9*(-parseInt(t(199))/10)+-parseInt(t(203))/11*(-parseInt(t(201))/12);if(n===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(L,291935);var U={};function L(){var r=["mapDB-indexeddb-form-schema","778390VHiMPL","stores","3383508RfiKTD","63UERWuz","22gvbCFO","509514cRHqzj","DBVersion","formParams","properties","49908OxCuGa","createIndex","DBName","primaryKey","userId","default","unique","562896ZFvrwm","392gQpHIY","DBStoreName","queryParams","8eQWvIE","1FtIDQF","5259FOfsNi","2694745YrsVgs"];return L=function(){return r},L()}U[v(189)]=!1;var H={};function Q(r,e){var t=L();return Q=function(a,n){a=a-179;var o=t[a];return o},Q(r,e)}H[v(184)]=U,H[v(188)]={};var Y={};Y[v(193)]=H;var J={};J[v(192)]=v(181),J[v(182)]=Y;var F={};F[v(186)]=v(187),F[v(185)]=v(198),F[v(180)]=1,F[v(200)]=[J];const ye={formSchema:F},me=C,{handleData:he,getData:be}=me,{formSchema:Z}=ye,ge=async(r,e)=>{var t;return e.parametersType==="url"&&(r={...W.queryToData((t=e.$route)==null?void 0:t.query),...r}),e.parametersType==="indexDB"&&(r={...await be({tableName:"formParams",propertiesKey:e.$route.path||"defQueryParams",primaryKey:e.DBPrimaryKey||"default",mapDB:Z}),...r}),r},_e=async(r,e)=>{e.parametersType==="url"&&await e.$router.push({query:W.paramsToQuery({...r})}),e.parametersType==="indexDB"&&await he({tableName:"formParams",propertiesKey:e.$route.path||"defQueryParams",parameter:{...r},primaryKey:e.DBPrimaryKey||"default",mapDB:Z})},ve={makeParamsByType:ge,saveParamsByType:_e},X=W,q=ve,_={};let x=null;const ee=async(r,e)=>{window.indexedDB||window.alert("您的浏览器不支持IndexedDB的稳定版本。离线数据功能将不可用。Your browser doesn't support a stable version of IndexedDB. offline data feature will not be available.");const{DBName:t="",DBVersion:a=1}=r;let n,o=!1;try{const s=window.indexedDB.open(t,a);await new Promise((c,i)=>{s.onupgradeneeded=async function(l){const d=l.target.result,{stores:p=[]}=r;await Promise.all(p.map(async u=>{const{DBStoreName:f="",properties:h={}}=u;try{const y=l.currentTarget.result.createObjectStore(f,{keyPath:r.primaryKey});if(Object.keys(h).length===0){console.warn(`${f}没有设置默认值`);return}for(const m in h)if(h.hasOwnProperty.call(h,m)){const b=h[m];y.createIndex(m,m,{...b.createIndex})}}catch(y){console.warn(y)}})),n=d,o=!0},s.onsuccess=async function(l){if(n=this.result,o){const{stores:d=[]}=r;await Promise.all(d.map(async p=>{const{DBStoreName:u=""}=p,f=n.transaction([u],"readwrite"),h=f.objectStore(u),y={};y[r.primaryKey]=e,h.add(y);try{await new Promise((m,b)=>{f.onabort=function(w){console.error("主键插入中止",w),b()},f.oncomplete=function(w){m()},f.onerror=function(w){console.error("主键插入失败",w),b()}})}catch(m){console.warn("目前所有数据都在用户ID的主键下面,所以没有主键的话做重新载入页面处理",m)}}))}c()},s.onerror=function(l){i(l)}})}catch(s){console.error(s,"打开数据库报错,可能是数据库版本不对,或者储存容量不足等原因")}return n};let A=!1;_.getDB=async(r,e)=>{const{mapDB:t,primaryKey:a}=r;return t?a?(A&&await new Promise(async(n,o)=>{const s=()=>{A?setTimeout(()=>{s()},200):n()};s()}),x||(A=!0,x=await ee(t,a),x==null||x.addEventListener("close",async()=>{console.info("Database connection closed, reconnecting..."),x=await ee(t,a)}),A=!1),e&&e(x),x):(console.warn("获取Database缺乏用户信息,请先传入对primaryKey的赋值"),!1):(console.warn("必须传入数据库配置信息"),!1)},_.getDataByKey=async(r,e)=>{const{mapDB:t,tableName:a,primaryKey:n}=r,o=await _.getDB({mapDB:t,primaryKey:n});if(!o)return;const i=o.transaction([a]).objectStore(a).get(n);return new Promise((l,d)=>{i.onsuccess=function(p){e&&e(`${a}主键查询结果:${i.result}`),l(i.result)},i.onerror=function(p){console.error(`${a}事务失败`+p),d()}})},_.updateStore=async(r,e)=>{var d;const{mapDB:t,tableName:a,updateData:n}=r;n[t==null?void 0:t.primaryKey]||console.warn(`请传入主键${t.primaryKey}`);const o=await _.getDB({mapDB:t,primaryKey:n[t==null?void 0:t.primaryKey]});if(!o)return;let s=null;try{s=o.transaction([a],"readwrite").objectStore(a)}catch(p){console.error("store不存在,请更新schema和DBVersion并重启前端服务",p)}let c=null,i=null;const l=await new Promise((p,u)=>{const f=s.openCursor(n[t==null?void 0:t.primaryKey]);f.onsuccess=h=>{p(h)},f.onerror=h=>{u(h)}});i=(d=l==null?void 0:l.target)==null?void 0:d.result;try{i&&(i==null?void 0:i.primaryKey)===n[t==null?void 0:t.primaryKey]?c=i.update(n):c=s.put(n)}catch(p){console.error("传入结构化克隆算法不支持的数据类型可能导致报错",p,n)}new Promise((p,u)=>{c||(console.error(`${a}数据更新失败没有request`),u()),c.onsuccess=function(f){e&&e(`${a}数据更新成功`),p()},c.onerror=function(f){console.error(`${a}数据更新失败`,f),u()}}),i&&i.continue()},_.deleteStore=async(r,e)=>{const{mapDB:t,tableName:a,primaryKey:n}=r,o=await _.getDB({mapDB:t,primaryKey:n});if(!o)return;const s=o.transaction([a],"readwrite").objectStore(a).delete(n);return new Promise((c,i)=>{s.onsuccess=function(l){e&&e(`${a}数据删除成功`),c()},s.onerror=function(l){console.error(`${a}数据删除失败`+l),i()}})},_.deleteDB=async(r,e)=>{const{mapDB:t}=r,a=window.indexedDB.deleteDatabase(t.DBName);return new Promise((n,o)=>{a.onsuccess=s=>{e&&e(`${t.DBName}数据库已删除`),n()},a.onerror=s=>{console.error(`${t.DBName}数据库删除失败`+s),o()}})};async function we(r,e){const{tableName:t,propertiesKey:a,parameter:n,primaryKey:o,mapDB:s}=r;let c=null,i={[s.primaryKey]:o};const l=await _.getDataByKey({mapDB:s,tableName:t,primaryKey:o});return l&&(i={...l,[s.primaryKey]:o}),i[a]=n,await _.updateStore({mapDB:s,tableName:t,updateData:i}),n&&(c=n),e&&e(c),c}async function De(r,e){const{tableName:t,propertiesKey:a,primaryKey:n,mapDB:o}=r;let s=null;const c=await _.getDataByKey({mapDB:o,tableName:t,primaryKey:n});return c&&(s=c[a]),e&&e(s),s}async function Se(r,e){const{tableName:t,propertiesKey:a,parameter:n,primaryKey:o,mapDB:s}=r;let c={};const i=await _.getDataByKey({mapDB:s,tableName:t,primaryKey:o});try{if(i){c={...i[a],...n};const d={[s.primaryKey]:o};d[a]=c,await _.updateStore({mapDB:s,tableName:t,updateData:d})}else console.warn(`${t}为空,请先调用handleData`)}catch(l){console.error(l)}return e&&e(c),c}async function Pe(r,e){const{tableName:t,primaryKey:a,mapDB:n}=r;let o=null;try{await _.deleteStore({mapDB:n,tableName:t,primaryKey:a})}catch(s){console.error(s)}return e&&e(o),o}const xe={handleData:we,getData:De,updateData:Se,clearData:Pe},te={formSchema:{primaryKey:"userId",DBName:"mapDB-indexeddb-form-schema",DBVersion:1,stores:[{DBStoreName:"formParams",properties:{queryParams:{createIndex:{unique:!1},default:{}}}}]}},re=xe,ct="",{getData:Be}=re,{formSchema:Te}=te,ke={name:"GeneralBasicForm",components:{InputArchive:r=>{const{templateEle:e}=r;return e()},VerificationButton:ie},props:{showSearch:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:()=>[]},size:{type:String,default:""},labelWidth:{type:String,default:"90px"},parametersType:{type:String,default:"url"},DBPrimaryKey:{type:[String,Number],required:!1},formData:{type:Object,default:()=>{}},noInputBlank:{type:Boolean,default:()=>!1},currentPageKey:{type:String,default:"page"},pageSizeKey:{type:String,default:"limit"},defCurrentPage:{type:Number,default:1},defPageSize:{type:Number,default:10},queryWhenReady:{type:Boolean,default:()=>!1}},data(){return{queryParams:this.initQueryParams(),formLoading:this.loading||!1,selectSetting:{placeholder:"请选择",filterable:!0,clearable:!0,style:"width: 200px"},inputSetting:{placeholder:"请输入",style:"width: 200px",clearable:!0},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"},attrs:{inline:!0,"label-position":"left"}}},watch:{formData:{handler(r,e){JSON.stringify(r)!==JSON.stringify(this.queryParams)&&(this.queryParams={...this.queryParams,...r})},immediate:!0,deep:!0},queryParams:{handler(r){this.$emit("update:formData",{...r})},deep:!0},$attrs:{handler(r){this.attrs={...this.attrs,...r}},immediate:!0,deep:!0},loading(r){this.formLoading!==r&&(this.formLoading=r)},formLoading(r){this.loading!==r&&this.$emit("update:loading",r)}},methods:{async handleQuery(r={}){r.defaultPageFirst??(r.defaultPageFirst=!0);const e={[this.currentPageKey]:this.defCurrentPage};let t={...e,...this.queryParams};console.log(t,"searchParams1"),t=await q.makeParamsByType(t,this),console.log(t,"searchParams2"),r.defaultPageFirst&&(t={...t,...e}),await q.saveParamsByType(t,this),this.getList({...t})},async resetQuery(){this.$refs.queryFormRef.resetFields();const r={[this.currentPageKey]:this.defCurrentPage};await q.saveParamsByType(r,this),this.queryParams={...r},this.afterReset(),this.handleQuery()},initQueryParams(){var e;let r={[this.pageSizeKey]:this.defPageSize};return this.parametersType==="url"&&(r={...r,...X.queryToData((e=this.$route)==null?void 0:e.query)}),this.parametersType==="indexDB"&&Be({tableName:"formParams",propertiesKey:this.$route.path||"defQueryParams",primaryKey:this.DBPrimaryKey||"default",mapDB:Te},t=>{this.queryParams={...r,...t}}),this.queryWhenReady&&this.$nextTick(()=>{this.handleQuery({defaultPageFirst:!1})}),r},currentInputComponent(){return"input-archive"},getItemRules(r){const{type:e,rules:t=[]}=r,a=[...t];return this.noInputBlank&&e==="input"&&a.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),a},getInputSetting(r){const{inputSetting:e,setting:t}=r;return{...this.inputSetting,...e,...t}},defaultFunction(){},getInputEvents(r){return{blur:r.blur||this.defaultFunction,focus:r.focus||this.defaultFunction,change:r.change||this.defaultFunction,input:r.input||this.defaultFunction,clear:r.clear||this.defaultFunction}},getSelectSetting(r){const{selectSetting:e,setting:t}=r;return{...this.selectSetting,...e,...t}},getSelectEvents(r){return{change:r.change||this.defaultFunction,"visible-change":r["visible-change"]||this.defaultFunction,"remove-tag":r["remove-tag"]||this.defaultFunction,"expand-change":r["expand-change"]||this.defaultFunction,clear:r.clear||this.defaultFunction,blur:r.blur||this.defaultFunction,focus:r.focus||this.defaultFunction}},getDatePackerSetting(r){const{datePackerSetting:e,setting:t}=r;return{...this.datePackerSetting,...e,...t}},getDatePackerEvents(r){return{change:r.change||this.defaultFunction,blur:r.blur||this.defaultFunction,focus:r.focus||this.defaultFunction}},getCheckboxGroupSetting(r){const{checkboxGroupSetting:e,setting:t}=r;return{...e,...t}},getCheckboxGroupEvents(r){return{change:r.change||this.defaultFunction}}}};var Ie=function(){var e=this,t=e._self._c;return t("el-form",e._b({directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryFormRef",attrs:{model:e.queryParams,"label-width":e.labelWidth}},"el-form",e.attrs,!1),[e._l(e.formItem,function(a){return t("el-form-item",e._b({key:a.prop,attrs:{rules:e.getItemRules(a)}},"el-form-item",a,!1),[a.type==="input"?t("el-input",e._g(e._b({attrs:{size:e.size},nativeOn:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(a.template,function(n,o){return{key:o,fn:function(){return[n?t(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[a.prop],callback:function(n){e.$set(e.queryParams,a.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(a),!1),e.getInputEvents(a))):a.type==="input-mobile-verification"?t("el-input",e._g(e._b({attrs:{size:e.size},nativeOn:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(a.template,function(n,o){return{key:o,fn:function(){return[n?t(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[a.prop],callback:function(n){e.$set(e.queryParams,a.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(a),!1),e.getInputEvents(a)),[t("template",{slot:"append"},[t("verification-button",{attrs:{verificationSetting:a.verificationSetting,getSmscode:a.getSmscode}})],1)],2):a.type==="select"?t("el-select",e._g(e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[a.prop],callback:function(n){e.$set(e.queryParams,a.prop,n)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(a),!1),e.getSelectEvents(a)),e._l(a.option||[],function(n){return t("el-option",{key:n.key||n.value,attrs:{label:n.label,value:n.value}})}),1):a.type==="cascader"?t("el-cascader",e._g(e._b({attrs:{filterable:"",size:e.size,options:a.options||[]},model:{value:e.queryParams[a.prop],callback:function(n){e.$set(e.queryParams,a.prop,n)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(a),!1),e.getSelectEvents(a))):a.type==="date-picker"?t("el-date-picker",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[a.prop],callback:function(n){e.$set(e.queryParams,a.prop,n)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(a),!1),e.getDatePackerEvents(a))):e._e(),a.type==="input-number"?t("el-input-number",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[a.prop],callback:function(n){e.$set(e.queryParams,a.prop,n)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(a),!1),e.getInputEvents(a))):a.type==="checkbox"?t("el-checkbox-group",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[a.prop],callback:function(n){e.$set(e.queryParams,a.prop,n)},expression:"queryParams[item.prop]"}},"el-checkbox-group",e.getCheckboxGroupSetting(a),!1),e.getCheckboxGroupEvents(a)),e._l(a.option||[],function(n){return t("el-checkbox",e._b({key:n.key||n.value||n.label},"el-checkbox",n,!1))}),1):e._e(),/^form-item-slot$/i.test(a.type)?e._t(a.name):e._e()],2)}),e._t("default"),e.formOnly?e._e():t("el-form-item",[t("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:e.size,loading:e.formLoading},on:{click:e.handleQuery}},[e._v("查询")]),t("el-button",{attrs:{icon:"el-icon-refresh",size:e.size},on:{click:e.resetQuery}},[e._v("重置")])],1),e._t("behind-the-button")],2)},Ke=[],Ne=k(ke,Ie,Ke,!1,null,"1bb4e2ca",null,null);const $e=Ne.exports,lt="",Ce={components:{},props:{query:{type:Object,default:()=>({prefCode:sessionStorage.getItem("prefCode")})},routePath:{type:String,default:()=>"/search/searchDetail"},inputstyle:{type:Object,default:()=>({width:"1280px"})},openHref:{type:Boolean,default:()=>!1},size:{type:String,default:()=>"medium"}},data(){var r,e;return{keyWord:((e=(r=this.$route)==null?void 0:r.query)==null?void 0:e.keyWord)||"",attrs:{}}},watch:{$attrs:{handler(r){this.attrs={...this.attrs,...r}},immediate:!0,deep:!0}},methods:{search(){const r={path:this.routePath,query:{...this.query,keyWord:this.keyWord}};if(this.openHref){const e=this.$router.resolve(r);window.open(e.href,"_blank")}else this.$router.push(r)}}};var Fe=function(){var e=this,t=e._self._c;return t("div",{staticClass:"search-box"},[t("el-input",e._b({style:{...e.inputstyle},attrs:{size:e.size},nativeOn:{keydown:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.search.apply(null,arguments)}},model:{value:e.keyWord,callback:function(a){e.keyWord=a},expression:"keyWord"}},"el-input",e.attrs,!1),[t("svg",{staticClass:"el-input__icon",attrs:{slot:"prefix",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},slot:"prefix"},[t("path",{attrs:{d:"M9.51033 10.2186C8.69189 10.8814 7.64943 11.2784 6.51424 11.2784C3.88302 11.2784 1.75 9.14541 1.75 6.51421C1.75 3.88301 3.88302 1.75 6.51424 1.75C9.14545 1.75 11.2785 3.88301 11.2785 6.51421C11.2785 7.64942 10.8814 8.69189 10.2186 9.51034L13.75 13.0417L13.0417 13.75L9.51033 10.2186ZM10.2768 6.51421C10.2768 4.43623 8.59224 2.75168 6.51424 2.75168C4.43623 2.75168 2.75168 4.43623 2.75168 6.51421C2.75168 8.59219 4.43623 10.2767 6.51424 10.2767C8.59224 10.2767 10.2768 8.59219 10.2768 6.51421Z",fill:"#959A9F"}})])])],1)},qe=[],Oe=k(Ce,Fe,qe,!1,null,"ef706e31",null,null);const ze=Oe.exports,Ve={name:"Descriptions",components:{DescriptionsColumn:{functional:!0,props:{column:{default:{render:()=>{}},type:Object},formData:{default:{},type:Object}},render(r,e){const{props:t}=e,{column:a,formData:n}=t;return a.render(n)}}},data(){return{attrs:{border:!0,class:"v-descriptions"}}},props:{formItem:{type:Array,default:()=>[]},formData:{type:Object,default:()=>{}}},watch:{$attrs:{handler(r){this.attrs={...this.attrs,...r}},immediate:!0,deep:!0}}};var je=function(){var e=this,t=e._self._c;return t("el-descriptions",e._b({},"el-descriptions",e.attrs,!1),e._l(e.formItem,function(a,n){return t("el-descriptions-item",e._b({key:a.prop,attrs:{label:a.label}},"el-descriptions-item",a.descriptionsItemProps,!1),[a.render?t("DescriptionsColumn",{attrs:{column:a,formData:e.formData}}):t("span",[e._v(e._s(e.formData[a.prop]))])],1)}),1)},Re=[],Ee=k(Ve,je,Re,!1,null,null,null,null);const Le=Ee.exports,pt="",Qe={props:{nodeKey:{type:String,default:"id"},filterable:{type:Boolean,default:!1},dataSource:{type:Array,default:()=>[]},checkedKeys:{type:Array,default:()=>[]}},watch:{sourceFilterText(r){this.$refs.sourceTree.filter(r)},selectedFilterText(r){this.$refs.selectTree.filter(r)},checkedKeys(r){this.$refs.sourceTree.setCheckedKeys(r),$.nextTick(()=>{this.getSelectedData(),this.$refs.selectTree.setCheckedKeys(r)})}},data(){return{defaultTreeAttributes:{"default-expand-all":!0,"show-checkbox":!0},selectedList:[],sourceFilterText:"",selectedFilterText:""}},methods:{sourceFilterNode(r,e){return r?e.label.indexOf(r)!==-1:!0},getSelectedData(){let r=!0,e;const t=this.$refs.sourceTree.getCheckedNodes(r,e);this.selectedList=t},removeSelectedData(){let r,e;const t=this.$refs.selectTree.getCheckedNodes(r,e),a={};t.forEach(n=>{a[n[this.nodeKey]]=n}),this.selectedList=this.selectedList.filter(n=>!a[n[this.nodeKey]])}}};var Ae=function(){var e=this,t=e._self._c;return t("div",{staticClass:"tree-box"},[t("div",{staticClass:"left-box"},[e.filterable?t("el-input",{attrs:{placeholder:"输入关键字进行过滤"},model:{value:e.sourceFilterText,callback:function(a){e.sourceFilterText=a},expression:"sourceFilterText"}}):e._e(),t("el-tree",e._b({ref:"sourceTree",attrs:{data:e.dataSource,"filter-node-method":e.sourceFilterNode,nodeKey:e.nodeKey}},"el-tree",{...e.defaultTreeAttributes},!1))],1),t("div",{staticClass:"mid-box"},[t("el-button",{attrs:{icon:"el-icon-arrow-right",circle:""},on:{click:e.getSelectedData}}),t("el-button",{attrs:{icon:"el-icon-arrow-left",circle:""},on:{click:e.removeSelectedData}})],1),t("div",{staticClass:"right-box"},[e.filterable?t("el-input",{attrs:{placeholder:"输入关键字进行过滤"},model:{value:e.selectedFilterText,callback:function(a){e.selectedFilterText=a},expression:"selectedFilterText"}}):e._e(),t("el-tree",e._b({ref:"selectTree",attrs:{data:e.selectedList,"filter-node-method":e.sourceFilterNode,nodeKey:e.nodeKey}},"el-tree",{...e.defaultTreeAttributes},!1))],1)])},We=[],Ge=k(Qe,Ae,We,!1,null,"49dbad2a",null,null);const He=Ge.exports,dt="",{getData:Je}=re,{formSchema:Me}=te,Ue={name:"VTabs",data(){return{activeName:this.activeNameInit()}},props:{tabPanes:{type:Array,default:()=>[]},parametersType:{type:String,default:"url"},DBPrimaryKey:{type:[String,Number],required:!1},activeNameKey:{type:String,default:"activeName"},defActiveName:{type:String},getList:{type:Function,default:()=>{}}},watch:{defActiveName:{handler(r,e){JSON.stringify(r)!==JSON.stringify(this.activeName)&&(this.activeName=r)},immediate:!0},activeName:{handler(r){this.$emit(`update:${this.activeNameKey}`,r)}}},methods:{async handleClick(r,e){const t=await q.makeParamsByType({[this.activeNameKey]:this.activeName},this);await q.saveParamsByType(t,this),this.getList({...t})},activeNameInit(){var t,a,n;let r="";(t=this.tabPanes[0])!=null&&t.name&&(r=(a=this.tabPanes[0])==null?void 0:a.name);const e=X.queryToData(Number((n=this.$route)==null?void 0:n.query[this.activeNameKey]));return this.parametersType==="url"&&e&&(r=e),this.parametersType==="indexDB"&&Je({tableName:"formParams",propertiesKey:this.$route.path||"defQueryParams",primaryKey:this.DBPrimaryKey||"default",mapDB:Me},o=>{this.activeName=o==null?void 0:o[this.activeNameKey]}),this.defActiveName&&(r=this.defActiveName),`${r}`}}};var Ye=function(){var e=this,t=e._self._c;return t("el-tabs",e._b({on:{"tab-click":e.handleClick},model:{value:e.activeName,callback:function(a){e.activeName=a},expression:"activeName"}},"el-tabs",e.$attrs,!1),[e._l(e.tabPanes,function(a){return t("el-tab-pane",e._b({key:a.name},"el-tab-pane",a,!1),[e._v(" "+e._s(a.render&&a.render(a))+" ")])}),e._t("default")],2)},Ze=[],Xe=k(Ue,Ye,Ze,!1,null,"27244d13",null,null);const et=Xe.exports,tt=$e,rt=ze,at=Le,nt=He,st=et;D.VDescriptions=at,D.VGeneralBasicForm=tt,D.VSearchBox=rt,D.VTabs=st,D.VTreeTransfer=nt,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "general-basic-form",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "cross-env CURRENT_ENV=prod run-p type-check && run-p build-only",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"vue",
|
|
23
23
|
"vue2",
|
|
24
24
|
"vue3",
|
|
25
|
+
"vue-router",
|
|
25
26
|
"element-plus",
|
|
26
27
|
"element",
|
|
27
28
|
"typescript"
|
|
@@ -51,20 +52,9 @@
|
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"vue": "^2.7.0-0"
|
|
53
54
|
},
|
|
54
|
-
"typings": "./
|
|
55
|
+
"typings": "./publish/index.d.ts",
|
|
55
56
|
"dependencies": {
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"exports": {
|
|
60
|
-
".": {
|
|
61
|
-
"import": "./dist/index.js",
|
|
62
|
-
"require": "./dist/index.umd.cjs",
|
|
63
|
-
"types": "./dist/index.d.ts"
|
|
64
|
-
},
|
|
65
|
-
"./style": "./dist/style.css"
|
|
66
|
-
},
|
|
67
|
-
"files": [
|
|
68
|
-
"/dist"
|
|
69
|
-
]
|
|
57
|
+
"general-basic-indexdb": "^1.0.3",
|
|
58
|
+
"network-spanner": "^1.2.11"
|
|
59
|
+
}
|
|
70
60
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-07 17:55:59
|
|
4
|
+
* @LastEditTime: 2023-11-08 10:24:14
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description:
|
|
8
|
+
* @FilePath: \GeneralBasicForm\public\index.d.ts
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
/// <reference types="vite/client" />
|
|
12
|
+
declare module "*.vue" {
|
|
13
|
+
import { DefineComponent } from "vue"
|
|
14
|
+
const component: DefineComponent<{}, {}, any>
|
|
15
|
+
export default component
|
|
16
|
+
}
|
|
17
|
+
declare module "general-basic-form";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import chalk from 'chalk'
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
|
+
const __filenameNew = fileURLToPath(import.meta.url)
|
|
6
|
+
const __dirnameNew = path.dirname(__filenameNew)
|
|
7
|
+
export const updateMain = (mainDir:string) => {
|
|
8
|
+
try {
|
|
9
|
+
const packageTxt = fs.readFileSync(path.join(__dirnameNew, '../package.json'), 'utf8');
|
|
10
|
+
const packageJson = JSON.parse(packageTxt);
|
|
11
|
+
|
|
12
|
+
delete packageJson.files
|
|
13
|
+
delete packageJson.module
|
|
14
|
+
delete packageJson.exports
|
|
15
|
+
packageJson.typings = "./publish/index.d.ts"
|
|
16
|
+
packageJson.main = mainDir
|
|
17
|
+
const versionData = JSON.stringify(packageJson, null, 2);
|
|
18
|
+
fs.writeFileSync(path.join(__dirnameNew, '../package.json'), versionData, 'utf8');
|
|
19
|
+
console.log(chalk.green.bold('修改入口配置成功!当前入口路径为为:' + mainDir));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.log(chalk.red.bold('修改入口配置出错:', error.toString()));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
package/script/link.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-10 09:39:59
|
|
4
|
+
* @LastEditTime: 2023-11-15 18:38:43
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: link处理流程
|
|
8
|
+
* @FilePath: \VueNpmFrame\script\link.ts
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import { updateMain } from "./initialization";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
updateMain("./src/index.ts")
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-10 09:39:59
|
|
4
|
+
* @LastEditTime: 2024-03-01 11:27:02
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: link处理流程
|
|
8
|
+
* @FilePath: \VueNpmFrame\script\linkNode.ts
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import { updateMain } from "./initialization";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
updateMain("./dist/src/index.js")
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-10 09:39:59
|
|
4
|
+
* @LastEditTime: 2023-11-25 23:52:27
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: unlink处理流程
|
|
8
|
+
* @FilePath: \vite-plugin-update-version\script\unlinkModule.ts
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import path from "path";
|
|
12
|
+
import fs from 'fs'
|
|
13
|
+
import chalk from 'chalk'
|
|
14
|
+
import { fileURLToPath } from 'url'
|
|
15
|
+
const __filenameNew = fileURLToPath(import.meta.url)
|
|
16
|
+
const __dirnameNew = path.dirname(__filenameNew)
|
|
17
|
+
const updateMain = () => {
|
|
18
|
+
try {
|
|
19
|
+
const packageTxt = fs.readFileSync(path.join(__dirnameNew, '../package.json'), 'utf8');
|
|
20
|
+
const packageJson = JSON.parse(packageTxt);
|
|
21
|
+
const umdDir = "./dist/index.umd.cjs"
|
|
22
|
+
const esDir = "./dist/index.js"
|
|
23
|
+
const types = "./dist/index.d.ts"
|
|
24
|
+
packageJson.type = "module"
|
|
25
|
+
packageJson.main = umdDir
|
|
26
|
+
packageJson.module = esDir
|
|
27
|
+
packageJson.exports = {
|
|
28
|
+
".": {
|
|
29
|
+
"import": esDir,
|
|
30
|
+
"require": umdDir,
|
|
31
|
+
"types": types
|
|
32
|
+
},
|
|
33
|
+
"./style": "./dist/style.css"
|
|
34
|
+
}
|
|
35
|
+
packageJson.typings = types
|
|
36
|
+
packageJson.files = [
|
|
37
|
+
"/dist"
|
|
38
|
+
]
|
|
39
|
+
const versionData = JSON.stringify(packageJson, null, 2);
|
|
40
|
+
fs.writeFileSync(path.join(__dirnameNew, '../package.json'), versionData, 'utf8');
|
|
41
|
+
console.log(chalk.green.bold('修改入口配置成功!当前入口路径为为:' + umdDir));
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.log(chalk.red.bold('修改入口配置出错:', error.toString()));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
updateMain()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
+
* @Date: 2023-11-10 09:39:59
|
|
4
|
+
* @LastEditTime: 2024-03-01 11:33:05
|
|
5
|
+
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
+
* @Github: https://github.com/Alan1034
|
|
7
|
+
* @Description: unlink处理流程
|
|
8
|
+
* @FilePath: \VueNpmFrame\script\unlinkNode.ts
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
import path from "path";
|
|
12
|
+
import fs from 'fs'
|
|
13
|
+
import chalk from 'chalk'
|
|
14
|
+
import { fileURLToPath } from 'url'
|
|
15
|
+
const __filenameNew = fileURLToPath(import.meta.url)
|
|
16
|
+
const __dirnameNew = path.dirname(__filenameNew)
|
|
17
|
+
const updateMain = () => {
|
|
18
|
+
try {
|
|
19
|
+
const packageTxt = fs.readFileSync(path.join(__dirnameNew, '../package.json'), 'utf8');
|
|
20
|
+
const packageJson = JSON.parse(packageTxt);
|
|
21
|
+
const cjsDir = "./dist/src/index.js"
|
|
22
|
+
const types = "./dist/src/index.d.ts"
|
|
23
|
+
delete packageJson.type
|
|
24
|
+
packageJson.main = cjsDir
|
|
25
|
+
packageJson.typings = types
|
|
26
|
+
packageJson.files = [
|
|
27
|
+
"/dist"
|
|
28
|
+
]
|
|
29
|
+
const versionData = JSON.stringify(packageJson, null, 2);
|
|
30
|
+
fs.writeFileSync(path.join(__dirnameNew, '../package.json'), versionData, 'utf8');
|
|
31
|
+
console.log(chalk.green.bold('修改入口配置成功!当前入口路径为为:' + cjsDir));
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.log(chalk.red.bold('修改入口配置出错:', error.toString()));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
updateMain()
|
package/tsconfig.json
ADDED
package/vite.config.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import legacy from '@vitejs/plugin-legacy'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
import { defineConfig, loadEnv, splitVendorChunkPlugin } from 'vite'
|
|
4
|
+
import vue from '@vitejs/plugin-vue2'
|
|
5
|
+
import vueJsx from '@vitejs/plugin-vue2-jsx'
|
|
6
|
+
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
const __filenameNew = fileURLToPath(import.meta.url)
|
|
9
|
+
const __dirnameNew = path.dirname(__filenameNew)
|
|
10
|
+
const resolve = (dir) => path.resolve(__dirnameNew, dir);
|
|
11
|
+
// https://vitejs.dev/config/
|
|
12
|
+
export default defineConfig(({ command, mode }) => {
|
|
13
|
+
// 根据当前工作目录中的 `mode` 加载 .env 文件
|
|
14
|
+
// 设置第三个参数为 '' 来加载所有环境变量,而不管是否有 `VITE_` 前缀。
|
|
15
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
16
|
+
// console.log(command)
|
|
17
|
+
// console.log(env)
|
|
18
|
+
// console.log(env.CURRENT_ENV)
|
|
19
|
+
// console.log(env.APP_ENV)
|
|
20
|
+
// console.log(env.VUE_APP_BASE_API)
|
|
21
|
+
return {
|
|
22
|
+
// vite环境变量配置
|
|
23
|
+
define: {
|
|
24
|
+
"CURRENT_ENV": JSON.stringify(env.CURRENT_ENV),
|
|
25
|
+
},
|
|
26
|
+
server: {
|
|
27
|
+
open: true,
|
|
28
|
+
},
|
|
29
|
+
resolve: {
|
|
30
|
+
alias: {
|
|
31
|
+
'@': resolve('src'),//路径化名
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
plugins: [
|
|
38
|
+
/**
|
|
39
|
+
* @description: vite自带的文件分割配置
|
|
40
|
+
* @return {*}
|
|
41
|
+
*/
|
|
42
|
+
{
|
|
43
|
+
...splitVendorChunkPlugin(),
|
|
44
|
+
apply: 'build',
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* @description: 图片压缩插件
|
|
48
|
+
* @return {*}
|
|
49
|
+
*/
|
|
50
|
+
{
|
|
51
|
+
...ViteImageOptimizer({
|
|
52
|
+
/* pass your config */
|
|
53
|
+
}),
|
|
54
|
+
// enforce: 'pre',
|
|
55
|
+
apply: 'build',
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* @description: 兼容旧版本浏览器
|
|
59
|
+
* @return {*}
|
|
60
|
+
*/
|
|
61
|
+
{
|
|
62
|
+
...legacy({
|
|
63
|
+
targets: ['defaults'],
|
|
64
|
+
}),
|
|
65
|
+
apply: 'build',
|
|
66
|
+
},
|
|
67
|
+
vue(),
|
|
68
|
+
vueJsx(),
|
|
69
|
+
],
|
|
70
|
+
css: {
|
|
71
|
+
preprocessorOptions: {
|
|
72
|
+
less: {
|
|
73
|
+
// 支持内联 JavaScript
|
|
74
|
+
javascriptEnabled: true,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* @description: 打包时才调用
|
|
80
|
+
* @return {*}
|
|
81
|
+
*/
|
|
82
|
+
build: {
|
|
83
|
+
lib: {
|
|
84
|
+
// Could also be a dictionary or array of multiple entry points
|
|
85
|
+
// 添加打包入口文件夹
|
|
86
|
+
entry: resolve(`${__dirnameNew}/src`, 'index.ts'),
|
|
87
|
+
// formats: ['es', 'cjs', 'umd', 'iife'],
|
|
88
|
+
name: 'Index',
|
|
89
|
+
// the proper extensions will be added
|
|
90
|
+
// fileName: (format) => `index.${format}.js`,
|
|
91
|
+
fileName: "index",
|
|
92
|
+
},
|
|
93
|
+
rollupOptions: {
|
|
94
|
+
// 确保外部化处理那些你不想打包进库的依赖
|
|
95
|
+
external: ['vue'],
|
|
96
|
+
output: {
|
|
97
|
+
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
|
|
98
|
+
globals: {
|
|
99
|
+
vue: 'Vue',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
// minify: 'terser',
|
|
104
|
+
//打包环境移除console.log,debugger
|
|
105
|
+
// terserOptions: {
|
|
106
|
+
// compress: {
|
|
107
|
+
// drop_console: true,
|
|
108
|
+
// drop_debugger: true,
|
|
109
|
+
// },
|
|
110
|
+
// },
|
|
111
|
+
//打包文件按照类型分文件夹显示(貌似会导致性能下降)
|
|
112
|
+
// rollupOptions: {
|
|
113
|
+
// output: {
|
|
114
|
+
// chunkFileNames: 'js/[name]-chunk-[hash:7].js',
|
|
115
|
+
// entryFileNames: 'js/[name]-app-[hash:7].js',
|
|
116
|
+
// assetFileNames: '[ext]/[name]-chunk-[hash:7].[ext]',
|
|
117
|
+
// },
|
|
118
|
+
// },
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
})
|