general-basic-form 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(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(I,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],j):(I=typeof globalThis<"u"?globalThis:I||self,j(I.Index={},I.Vue))})(this,function(I,j){"use strict";const vt="";function z(a,e,t,r,n,o,i,s){var c=typeof a=="function"?a.options:a;e&&(c.render=e,c.staticRenderFns=t,c._compiled=!0),r&&(c.functional=!0),o&&(c._scopeId="data-v-"+o);var f;if(i?(f=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__),n&&n.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(i)},c._ssrRegister=f):n&&(f=s?function(){n.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:n),f)if(c.functional){c._injectStyles=f;var p=c.render;c.render=function(y,b){return f.call(b),p(y,b)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,f):[f]}return{exports:a,options:c}}const _e={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 ge=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"))])},ve=[],De=z(_e,ge,ve,!1,null,null,null,null);const we=De.exports,Se=(a={})=>{for(const e in a)if(Object.prototype.hasOwnProperty.call(a,e)){const t=a[e];Object.prototype.toString.call(t)==="[object Object]"&&(a[e]=JSON.stringify(t))}return a},Be=(a={})=>{for(const e in a)if(Object.prototype.hasOwnProperty.call(a,e)){const t=a[e];try{/[{]+/g.test(t)&&/[}]+/g.test(t)&&(a[e]=JSON.parse(t))}catch{}}return a},ae={paramsToQuery:Se,queryToData:Be},N=q;(function(a,e){const t=q,r=a();for(;;)try{if(parseInt(t(561))/1+-parseInt(t(558))/2+parseInt(t(521))/3*(parseInt(t(527))/4)+-parseInt(t(506))/5*(parseInt(t(510))/6)+-parseInt(t(550))/7*(parseInt(t(503))/8)+parseInt(t(540))/9+-parseInt(t(546))/10*(-parseInt(t(562))/11)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(Q,819524);const w={};let C=null;const ce=async(a,e)=>{const t=q;!window[t(543)]&&window[t(498)]("您的浏览器不支持IndexedDB的稳定版本。离线数据功能将不可用。Your browser doesn't support a stable version of IndexedDB. offline data feature will not be available.");const{DBName:r="",DBVersion:n=1}=a;let o,i=!1;try{const s=window[t(543)][t(519)](r,n);await new Promise((c,f)=>{const p=t;s[p(551)]=async function(u){const l=p,y=u.target.result,{stores:b=[]}=a;await Promise.all(b[l(509)](async d=>{const m=l,{DBStoreName:h="",properties:_={}}=d;try{const g={};g[m(536)]=a[m(557)];const P=u[m(541)][m(520)][m(554)](h,g);if(Object[m(548)](_)[m(500)]===0){console[m(559)](h+"没有设置默认值");return}for(const v in _)if(_[m(556)][m(515)](_,v)){const D=_[v],B={...D.createIndex};P[m(504)](v,v,B)}}catch(g){console[m(559)](g)}})),o=y,i=!0},s[p(535)]=async function(u){const l=p;if(o=this[l(520)],i){const{stores:y=[]}=a;await Promise[l(528)](y[l(509)](async b=>{const d=l,{DBStoreName:m=""}=b,h=o[d(552)]([m],d(547)),_=h[d(496)](m),g={};g[a[d(557)]]=e,_[d(502)](g);try{await new Promise((P,v)=>{const D=d;h[D(525)]=function(B){const T=D;console[T(513)](T(512),B),v()},h[D(544)]=function(B){P()},h[D(529)]=function(B){const T=D;console[T(513)](T(534),B),v()}})}catch(P){console.warn(d(511),P)}}))}c()},s.onerror=function(u){f(u)}})}catch(s){console[t(513)](s,t(526))}return o};function Q(){const a=["transaction","DBName","createObjectStore","close","hasOwnProperty","primaryKey","208156ZfrAJr","warn","delete","1575928bFmnZg","154LBDnQZ","objectStore","数据更新失败","alert","store不存在,请更新schema和DBVersion并重启前端服务","length","openCursor","add","15752fkogxb","createIndex","deleteDB","299045NkkBTh","请传入主键","mapDB","map","102uEoUGM","目前所有数据都在用户ID的主键下面,所以没有主键的话做重新载入页面处理","主键插入中止","error","数据库删除失败","call","continue","update","deleteStore","open","result","66891DVCnfv","get","getDataByKey","数据删除失败","onabort","打开数据库报错,可能是数据库版本不对,或者储存容量不足等原因","52JGzdMb","all","onerror","put","数据更新失败没有request","Database connection closed, reconnecting...","target","主键插入失败","onsuccess","keyPath","数据更新成功","主键查询结果:","传入结构化克隆算法不支持的数据类型可能导致报错","4779333CtWPbr","currentTarget","获取Database缺乏用户信息,请先传入对primaryKey的赋值","indexedDB","oncomplete","事务失败","634540WpNScH","readwrite","keys","getDB","4781SEkDBZ","onupgradeneeded"];return Q=function(){return a},Q()}function q(a,e){const t=Q();return q=function(r,n){return r=r-496,t[r]},q(a,e)}let J=!1;w[N(549)]=async(a,e)=>{const t=N,{mapDB:r,primaryKey:n}=a;return r?n?(J&&await new Promise(async(o,i)=>{const s=()=>{J?setTimeout(()=>{s()},200):o()};s()}),!C&&(J=!0,C=await ce(r,n),C==null||C.addEventListener(t(555),async()=>{console.info(t(532)),C=await ce(r,n)}),J=!1),e&&e(C),C):(console[t(559)](t(542)),!1):(console[t(559)]("必须传入数据库配置信息"),!1)},w[N(523)]=async(a,e)=>{const t=N,{mapDB:r,tableName:n,primaryKey:o}=a,i={};i[t(508)]=r,i[t(557)]=o;const s=await w.getDB(i);if(!s)return;const c=s.transaction([n]),f=c[t(496)](n),p=f[t(522)](o);return new Promise((u,l)=>{const y=t;p.onsuccess=function(b){const d=q;e&&e(n+d(538)+p[d(520)]),u(p[d(520)])},p[y(529)]=function(b){console.error(n+y(545)+b),l()}})},w.updateStore=async(a,e)=>{var t;const r=N,{mapDB:n,tableName:o,updateData:i}=a;!i[n==null?void 0:n[r(557)]]&&console[r(559)](r(507)+n[r(557)]);const s={};s.mapDB=n,s[r(557)]=i[n==null?void 0:n[r(557)]];const c=await w[r(549)](s);if(!c)return;let f=null;try{f=c[r(552)]([o],r(547)).objectStore(o)}catch(y){console[r(513)](r(499),y)}let p=null,u=null;const l=await new Promise((y,b)=>{const d=r,m=f[d(501)](i[n==null?void 0:n[d(557)]]);m[d(535)]=h=>{y(h)},m.onerror=h=>{b(h)}});u=(t=l==null?void 0:l[r(533)])==null?void 0:t[r(520)];try{u&&(u==null?void 0:u.primaryKey)===i[n==null?void 0:n.primaryKey]?p=u[r(517)](i):p=f[r(530)](i)}catch(y){console[r(513)](r(539),y,i)}new Promise((y,b)=>{const d=r;!p&&(console[d(513)](o+d(531)),b()),p[d(535)]=function(m){e&&e(o+d(537)),y()},p[d(529)]=function(m){const h=d;console[h(513)](o+h(497),m),b()}}),u&&u[r(516)]()},w[N(518)]=async(a,e)=>{const t=N,{mapDB:r,tableName:n,primaryKey:o}=a,i={};i[t(508)]=r,i[t(557)]=o;const s=await w.getDB(i);if(!s)return;const c=s[t(552)]([n],t(547))[t(496)](n)[t(560)](o);return new Promise((f,p)=>{const u=t;c[u(535)]=function(l){e&&e(n+"数据删除成功"),f()},c.onerror=function(l){const y=u;console[y(513)](n+y(524)+l),p()}})},w[N(505)]=async(a,e)=>{const{mapDB:t}=a,r=window.indexedDB.deleteDatabase(t.DBName);return new Promise((n,o)=>{const i=q;r[i(535)]=s=>{e&&e(t[i(553)]+"数据库已删除"),n()},r[i(529)]=s=>{const c=i;console[c(513)](t[c(553)]+c(514)+s),o()}})};function K(a,e){const t=W();return K=function(r,n){return r=r-125,t[r]},K(a,e)}function W(){const a=["updateData","error","getDataByKey","531aQoQZo","primaryKey","handleData","2kSsgxs","777jFjQPc","1271805RJVSFy","546pnZEJw","3522904vvFeGW","4wGSwDA","tableName","780ChApSf","deleteStore","655364nEjUrb","3705144rIEFqv","updateStore","getData","clearData","mapDB","3003845nIJAzp"];return W=function(){return a},W()}const Z=K;(function(a,e){const t=K,r=a();for(;;)try{if(-parseInt(t(140))/1*(-parseInt(t(127))/2)+parseInt(t(142))/3*(parseInt(t(145))/4)+-parseInt(t(133))/5+-parseInt(t(143))/6*(parseInt(t(141))/7)+-parseInt(t(128))/8+parseInt(t(137))/9*(parseInt(t(125))/10)+parseInt(t(144))/11===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(W,330152);async function ke(a,e){const t=K,{tableName:r,propertiesKey:n,parameter:o,primaryKey:i,mapDB:s}=a;let c=null,f={[s[t(138)]]:i};const p={};p[t(132)]=s,p.tableName=r,p[t(138)]=i;const u=await w[t(136)](p);u&&(f={...u,[s.primaryKey]:i}),f[n]=o;const l={};return l[t(132)]=s,l.tableName=r,l[t(134)]=f,await w[t(129)](l),o&&(c=o),e&&e(c),c}async function xe(a,e){const t=K,{tableName:r,propertiesKey:n,primaryKey:o,mapDB:i}=a;let s=null;const c={};c[t(132)]=i,c[t(146)]=r,c.primaryKey=o;const f=await w[t(136)](c);return f&&(s=f[n]),e&&e(s),s}async function Ie(a,e){const t=K,{tableName:r,propertiesKey:n,parameter:o,primaryKey:i,mapDB:s}=a;let c={};const f={};f.mapDB=s,f[t(146)]=r,f[t(138)]=i;const p=await w[t(136)](f);try{if(p){c={...p[n],...o};const u={[s[t(138)]]:i},l=u;l[n]=c;const y={};y[t(132)]=s,y[t(146)]=r,y[t(134)]=l,await w.updateStore(y)}else console.warn(r+"为空,请先调用handleData")}catch(u){console[t(135)](u)}return e&&e(c),c}async function Pe(a,e){const t=K,{tableName:r,primaryKey:n,mapDB:o}=a;let i=null;try{const s={};s.mapDB=o,s[t(146)]=r,s[t(138)]=n,await w[t(126)](s)}catch(s){console.error(s)}return e&&e(i),i}const A={};A[Z(139)]=ke,A[Z(130)]=xe,A[Z(134)]=Ie,A[Z(131)]=Pe;var k=U;(function(a,e){for(var t=U,r=a();;)try{var n=-parseInt(t(385))/1+parseInt(t(387))/2+-parseInt(t(389))/3+-parseInt(t(398))/4*(parseInt(t(394))/5)+-parseInt(t(402))/6+-parseInt(t(399))/7+-parseInt(t(386))/8*(-parseInt(t(400))/9);if(n===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(M,363872);var le={};le[k(397)]=!1;var ne={};ne[k(384)]=le,ne[k(392)]={};var ue={};function M(){var a=["default","mapDB-indexeddb-form-schema","663915ecCGKl","primaryKey","stores","unique","12QKZOdu","2103521TxMjSC","1212714qgZAmF","formParams","3534618LLAImJ","DBName","properties","createIndex","464644FTRsMp","128qSoFyx","33606razpoB","DBVersion","168804drPGaG","queryParams","DBStoreName"];return M=function(){return a},M()}ue[k(390)]=ne;function U(a,e){var t=M();return U=function(r,n){r=r-382;var o=t[r];return o},U(a,e)}var se={};se[k(391)]=k(401),se[k(383)]=ue;var L={};L[k(395)]="userId",L[k(382)]=k(393),L[k(388)]=1,L[k(396)]=[se];const Te={formSchema:L},Ne=A,{handleData:Ke,getData:$e}=Ne,{formSchema:pe}=Te,Fe=async(a,e)=>{var t;return e.parametersType==="url"&&(a={...ae.queryToData((t=e.$route)==null?void 0:t.query),...a}),e.parametersType==="indexDB"&&(a={...await $e({tableName:"formParams",propertiesKey:e.$route.path||"defQueryParams",primaryKey:e.DBPrimaryKey||"default",mapDB:pe}),...a}),a},Ce=async(a,e)=>{e.parametersType==="url"&&await e.$router.push({query:ae.paramsToQuery({...a})}),e.parametersType==="indexDB"&&await Ke({tableName:"formParams",propertiesKey:e.$route.path||"defQueryParams",parameter:{...a},primaryKey:e.DBPrimaryKey||"default",mapDB:pe})},qe={makeParamsByType:Fe,saveParamsByType:Ce},fe=ae,V=qe,$=E;(function(a,e){const t=E,r=a();for(;;)try{if(parseInt(t(561))/1+-parseInt(t(558))/2+parseInt(t(521))/3*(parseInt(t(527))/4)+-parseInt(t(506))/5*(parseInt(t(510))/6)+-parseInt(t(550))/7*(parseInt(t(503))/8)+parseInt(t(540))/9+-parseInt(t(546))/10*(-parseInt(t(562))/11)===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(H,819524);const S={};let O=null;const de=async(a,e)=>{const t=E;!window[t(543)]&&window[t(498)]("您的浏览器不支持IndexedDB的稳定版本。离线数据功能将不可用。Your browser doesn't support a stable version of IndexedDB. offline data feature will not be available.");const{DBName:r="",DBVersion:n=1}=a;let o,i=!1;try{const s=window[t(543)][t(519)](r,n);await new Promise((c,f)=>{const p=t;s[p(551)]=async function(u){const l=p,y=u.target.result,{stores:b=[]}=a;await Promise.all(b[l(509)](async d=>{const m=l,{DBStoreName:h="",properties:_={}}=d;try{const g={};g[m(536)]=a[m(557)];const P=u[m(541)][m(520)][m(554)](h,g);if(Object[m(548)](_)[m(500)]===0){console[m(559)](h+"没有设置默认值");return}for(const v in _)if(_[m(556)][m(515)](_,v)){const D=_[v],B={...D.createIndex};P[m(504)](v,v,B)}}catch(g){console[m(559)](g)}})),o=y,i=!0},s[p(535)]=async function(u){const l=p;if(o=this[l(520)],i){const{stores:y=[]}=a;await Promise[l(528)](y[l(509)](async b=>{const d=l,{DBStoreName:m=""}=b,h=o[d(552)]([m],d(547)),_=h[d(496)](m),g={};g[a[d(557)]]=e,_[d(502)](g);try{await new Promise((P,v)=>{const D=d;h[D(525)]=function(B){const T=D;console[T(513)](T(512),B),v()},h[D(544)]=function(B){P()},h[D(529)]=function(B){const T=D;console[T(513)](T(534),B),v()}})}catch(P){console.warn(d(511),P)}}))}c()},s.onerror=function(u){f(u)}})}catch(s){console[t(513)](s,t(526))}return o};function H(){const a=["transaction","DBName","createObjectStore","close","hasOwnProperty","primaryKey","208156ZfrAJr","warn","delete","1575928bFmnZg","154LBDnQZ","objectStore","数据更新失败","alert","store不存在,请更新schema和DBVersion并重启前端服务","length","openCursor","add","15752fkogxb","createIndex","deleteDB","299045NkkBTh","请传入主键","mapDB","map","102uEoUGM","目前所有数据都在用户ID的主键下面,所以没有主键的话做重新载入页面处理","主键插入中止","error","数据库删除失败","call","continue","update","deleteStore","open","result","66891DVCnfv","get","getDataByKey","数据删除失败","onabort","打开数据库报错,可能是数据库版本不对,或者储存容量不足等原因","52JGzdMb","all","onerror","put","数据更新失败没有request","Database connection closed, reconnecting...","target","主键插入失败","onsuccess","keyPath","数据更新成功","主键查询结果:","传入结构化克隆算法不支持的数据类型可能导致报错","4779333CtWPbr","currentTarget","获取Database缺乏用户信息,请先传入对primaryKey的赋值","indexedDB","oncomplete","事务失败","634540WpNScH","readwrite","keys","getDB","4781SEkDBZ","onupgradeneeded"];return H=function(){return a},H()}function E(a,e){const t=H();return E=function(r,n){return r=r-496,t[r]},E(a,e)}let X=!1;S[$(549)]=async(a,e)=>{const t=$,{mapDB:r,primaryKey:n}=a;return r?n?(X&&await new Promise(async(o,i)=>{const s=()=>{X?setTimeout(()=>{s()},200):o()};s()}),!O&&(X=!0,O=await de(r,n),O==null||O.addEventListener(t(555),async()=>{console.info(t(532)),O=await de(r,n)}),X=!1),e&&e(O),O):(console[t(559)](t(542)),!1):(console[t(559)]("必须传入数据库配置信息"),!1)},S[$(523)]=async(a,e)=>{const t=$,{mapDB:r,tableName:n,primaryKey:o}=a,i={};i[t(508)]=r,i[t(557)]=o;const s=await S.getDB(i);if(!s)return;const c=s.transaction([n]),f=c[t(496)](n),p=f[t(522)](o);return new Promise((u,l)=>{const y=t;p.onsuccess=function(b){const d=E;e&&e(n+d(538)+p[d(520)]),u(p[d(520)])},p[y(529)]=function(b){console.error(n+y(545)+b),l()}})},S.updateStore=async(a,e)=>{var t;const r=$,{mapDB:n,tableName:o,updateData:i}=a;!i[n==null?void 0:n[r(557)]]&&console[r(559)](r(507)+n[r(557)]);const s={};s.mapDB=n,s[r(557)]=i[n==null?void 0:n[r(557)]];const c=await S[r(549)](s);if(!c)return;let f=null;try{f=c[r(552)]([o],r(547)).objectStore(o)}catch(y){console[r(513)](r(499),y)}let p=null,u=null;const l=await new Promise((y,b)=>{const d=r,m=f[d(501)](i[n==null?void 0:n[d(557)]]);m[d(535)]=h=>{y(h)},m.onerror=h=>{b(h)}});u=(t=l==null?void 0:l[r(533)])==null?void 0:t[r(520)];try{u&&(u==null?void 0:u.primaryKey)===i[n==null?void 0:n.primaryKey]?p=u[r(517)](i):p=f[r(530)](i)}catch(y){console[r(513)](r(539),y,i)}new Promise((y,b)=>{const d=r;!p&&(console[d(513)](o+d(531)),b()),p[d(535)]=function(m){e&&e(o+d(537)),y()},p[d(529)]=function(m){const h=d;console[h(513)](o+h(497),m),b()}}),u&&u[r(516)]()},S[$(518)]=async(a,e)=>{const t=$,{mapDB:r,tableName:n,primaryKey:o}=a,i={};i[t(508)]=r,i[t(557)]=o;const s=await S.getDB(i);if(!s)return;const c=s[t(552)]([n],t(547))[t(496)](n)[t(560)](o);return new Promise((f,p)=>{const u=t;c[u(535)]=function(l){e&&e(n+"数据删除成功"),f()},c.onerror=function(l){const y=u;console[y(513)](n+y(524)+l),p()}})},S[$(505)]=async(a,e)=>{const{mapDB:t}=a,r=window.indexedDB.deleteDatabase(t.DBName);return new Promise((n,o)=>{const i=E;r[i(535)]=s=>{e&&e(t[i(553)]+"数据库已删除"),n()},r[i(529)]=s=>{const c=i;console[c(513)](t[c(553)]+c(514)+s),o()}})};function F(a,e){const t=Y();return F=function(r,n){return r=r-125,t[r]},F(a,e)}function Y(){const a=["updateData","error","getDataByKey","531aQoQZo","primaryKey","handleData","2kSsgxs","777jFjQPc","1271805RJVSFy","546pnZEJw","3522904vvFeGW","4wGSwDA","tableName","780ChApSf","deleteStore","655364nEjUrb","3705144rIEFqv","updateStore","getData","clearData","mapDB","3003845nIJAzp"];return Y=function(){return a},Y()}const ee=F;(function(a,e){const t=F,r=a();for(;;)try{if(-parseInt(t(140))/1*(-parseInt(t(127))/2)+parseInt(t(142))/3*(parseInt(t(145))/4)+-parseInt(t(133))/5+-parseInt(t(143))/6*(parseInt(t(141))/7)+-parseInt(t(128))/8+parseInt(t(137))/9*(parseInt(t(125))/10)+parseInt(t(144))/11===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(Y,330152);async function Oe(a,e){const t=F,{tableName:r,propertiesKey:n,parameter:o,primaryKey:i,mapDB:s}=a;let c=null,f={[s[t(138)]]:i};const p={};p[t(132)]=s,p.tableName=r,p[t(138)]=i;const u=await S[t(136)](p);u&&(f={...u,[s.primaryKey]:i}),f[n]=o;const l={};return l[t(132)]=s,l.tableName=r,l[t(134)]=f,await S[t(129)](l),o&&(c=o),e&&e(c),c}async function Ee(a,e){const t=F,{tableName:r,propertiesKey:n,primaryKey:o,mapDB:i}=a;let s=null;const c={};c[t(132)]=i,c[t(146)]=r,c.primaryKey=o;const f=await S[t(136)](c);return f&&(s=f[n]),e&&e(s),s}async function ze(a,e){const t=F,{tableName:r,propertiesKey:n,parameter:o,primaryKey:i,mapDB:s}=a;let c={};const f={};f.mapDB=s,f[t(146)]=r,f[t(138)]=i;const p=await S[t(136)](f);try{if(p){c={...p[n],...o};const u={[s[t(138)]]:i},l=u;l[n]=c;const y={};y[t(132)]=s,y[t(146)]=r,y[t(134)]=l,await S.updateStore(y)}else console.warn(r+"为空,请先调用handleData")}catch(u){console[t(135)](u)}return e&&e(c),c}async function je(a,e){const t=F,{tableName:r,primaryKey:n,mapDB:o}=a;let i=null;try{const s={};s.mapDB=o,s[t(146)]=r,s[t(138)]=n,await S[t(126)](s)}catch(s){console.error(s)}return e&&e(i),i}const R={};R[ee(139)]=Oe,R[ee(130)]=Ee,R[ee(134)]=ze,R[ee(131)]=je;var x=re;(function(a,e){for(var t=re,r=a();;)try{var n=-parseInt(t(385))/1+parseInt(t(387))/2+-parseInt(t(389))/3+-parseInt(t(398))/4*(parseInt(t(394))/5)+-parseInt(t(402))/6+-parseInt(t(399))/7+-parseInt(t(386))/8*(-parseInt(t(400))/9);if(n===e)break;r.push(r.shift())}catch{r.push(r.shift())}})(te,363872);var ye={};ye[x(397)]=!1;var oe={};oe[x(384)]=ye,oe[x(392)]={};var me={};function te(){var a=["default","mapDB-indexeddb-form-schema","663915ecCGKl","primaryKey","stores","unique","12QKZOdu","2103521TxMjSC","1212714qgZAmF","formParams","3534618LLAImJ","DBName","properties","createIndex","464644FTRsMp","128qSoFyx","33606razpoB","DBVersion","168804drPGaG","queryParams","DBStoreName"];return te=function(){return a},te()}me[x(390)]=oe;function re(a,e){var t=te();return re=function(r,n){r=r-382;var o=t[r];return o},re(a,e)}var ie={};ie[x(391)]=x(401),ie[x(383)]=me;var G={};G[x(395)]="userId",G[x(382)]=x(393),G[x(388)]=1,G[x(396)]=[ie];const he={formSchema:G},be=R,Dt="",{getData:Ae}=be,{formSchema:Le}=he,Ve={name:"GeneralBasicForm",components:{InputArchive:a=>{const{templateEle:e}=a;return e()},VerificationButton:we},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(a,e){JSON.stringify(a)!==JSON.stringify(this.queryParams)&&(this.queryParams={...this.queryParams,...a})},immediate:!0,deep:!0},queryParams:{handler(a){this.$emit("update:formData",{...a})},deep:!0},$attrs:{handler(a){this.attrs={...this.attrs,...a}},immediate:!0,deep:!0},loading(a){this.formLoading!==a&&(this.formLoading=a)},formLoading(a){this.loading!==a&&this.$emit("update:loading",a)}},methods:{async handleQuery(a={}){a.defaultPageFirst??(a.defaultPageFirst=!0);const e={[this.currentPageKey]:this.defCurrentPage};let t={...e,...this.queryParams};t=await V.makeParamsByType(t,this),a.defaultPageFirst&&(t={...t,...e}),await V.saveParamsByType(t,this),this.getList({...t})},async resetQuery(){this.$refs.queryFormRef.resetFields();const a={[this.currentPageKey]:this.defCurrentPage};await V.saveParamsByType(a,this),this.queryParams={...a},this.afterReset(),this.handleQuery()},initQueryParams(){var e;let a={[this.pageSizeKey]:this.defPageSize};return this.parametersType==="url"&&(a={...a,...fe.queryToData((e=this.$route)==null?void 0:e.query)}),this.parametersType==="indexDB"&&Ae({tableName:"formParams",propertiesKey:this.$route.path||"defQueryParams",primaryKey:this.DBPrimaryKey||"default",mapDB:Le},t=>{this.queryParams={...a,...t}}),this.queryWhenReady&&this.$nextTick(()=>{this.handleQuery({defaultPageFirst:!1})}),a},currentInputComponent(){return"input-archive"},getItemRules(a){const{type:e,rules:t=[]}=a,r=[...t];return this.noInputBlank&&e==="input"&&r.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),r},getInputSetting(a){const{inputSetting:e,setting:t}=a;return{...this.inputSetting,...e,...t}},defaultFunction(){},getInputEvents(a){return{blur:a.blur||this.defaultFunction,focus:a.focus||this.defaultFunction,change:a.change||this.defaultFunction,input:a.input||this.defaultFunction,clear:a.clear||this.defaultFunction}},getSelectSetting(a){const{selectSetting:e,setting:t}=a;return{...this.selectSetting,...e,...t}},getSelectEvents(a){return{change:a.change||this.defaultFunction,"visible-change":a["visible-change"]||this.defaultFunction,"remove-tag":a["remove-tag"]||this.defaultFunction,"expand-change":a["expand-change"]||this.defaultFunction,clear:a.clear||this.defaultFunction,blur:a.blur||this.defaultFunction,focus:a.focus||this.defaultFunction}},getDatePackerSetting(a){const{datePackerSetting:e,setting:t}=a;return{...this.datePackerSetting,...e,...t}},getDatePackerEvents(a){return{change:a.change||this.defaultFunction,blur:a.blur||this.defaultFunction,focus:a.focus||this.defaultFunction}},getCheckboxGroupSetting(a){const{checkboxGroupSetting:e,setting:t}=a;return{...e,...t}},getCheckboxGroupEvents(a){return{change:a.change||this.defaultFunction}}}};var Re=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(r){return t("el-form-item",e._b({key:r.prop,attrs:{rules:e.getItemRules(r)}},"el-form-item",r,!1),[r.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(r.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[r.prop],callback:function(n){e.$set(e.queryParams,r.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(r),!1),e.getInputEvents(r))):r.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(r.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[r.prop],callback:function(n){e.$set(e.queryParams,r.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(r),!1),e.getInputEvents(r)),[t("template",{slot:"append"},[t("verification-button",{attrs:{verificationSetting:r.verificationSetting,getSmscode:r.getSmscode}})],1)],2):r.type==="select"?t("el-select",e._g(e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[r.prop],callback:function(n){e.$set(e.queryParams,r.prop,n)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(r),!1),e.getSelectEvents(r)),e._l(r.option||[],function(n){return t("el-option",{key:n.key||n.value,attrs:{label:n.label,value:n.value}})}),1):r.type==="cascader"?t("el-cascader",e._g(e._b({attrs:{filterable:"",size:e.size,options:r.options||[]},model:{value:e.queryParams[r.prop],callback:function(n){e.$set(e.queryParams,r.prop,n)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(r),!1),e.getSelectEvents(r))):r.type==="date-picker"?t("el-date-picker",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[r.prop],callback:function(n){e.$set(e.queryParams,r.prop,n)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(r),!1),e.getDatePackerEvents(r))):e._e(),r.type==="input-number"?t("el-input-number",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[r.prop],callback:function(n){e.$set(e.queryParams,r.prop,n)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(r),!1),e.getInputEvents(r))):r.type==="checkbox"?t("el-checkbox-group",e._g(e._b({attrs:{size:e.size},model:{value:e.queryParams[r.prop],callback:function(n){e.$set(e.queryParams,r.prop,n)},expression:"queryParams[item.prop]"}},"el-checkbox-group",e.getCheckboxGroupSetting(r),!1),e.getCheckboxGroupEvents(r)),e._l(r.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(r.type)?e._t(r.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)},Ge=[],Qe=z(Ve,Re,Ge,!1,null,"e0143289",null,null);const Je=Qe.exports,wt="",We={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 a,e;return{keyWord:((e=(a=this.$route)==null?void 0:a.query)==null?void 0:e.keyWord)||"",attrs:{}}},watch:{$attrs:{handler(a){this.attrs={...this.attrs,...a}},immediate:!0,deep:!0}},methods:{search(){const a={path:this.routePath,query:{...this.query,keyWord:this.keyWord}};if(this.openHref){const e=this.$router.resolve(a);window.open(e.href,"_blank")}else this.$router.push(a)}}};var Ze=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(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),[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)},Me=[],Ue=z(We,Ze,Me,!1,null,"ef706e31",null,null);const He=Ue.exports,Xe={name:"Descriptions",components:{DescriptionsColumn:{functional:!0,props:{column:{default:{render:()=>{}},type:Object},formData:{default:{},type:Object}},render(a,e){const{props:t}=e,{column:r,formData:n}=t;return r.render(n)}}},data(){return{attrs:{border:!0,class:"v-descriptions"}}},props:{formItem:{type:Array,default:()=>[]},formData:{type:Object,default:()=>{}}},watch:{$attrs:{handler(a){this.attrs={...this.attrs,...a}},immediate:!0,deep:!0}}};var Ye=function(){var e=this,t=e._self._c;return t("el-descriptions",e._b({},"el-descriptions",e.attrs,!1),e._l(e.formItem,function(r,n){return t("el-descriptions-item",e._b({key:r.prop,attrs:{label:r.label}},"el-descriptions-item",r.descriptionsItemProps,!1),[r.render?t("DescriptionsColumn",{attrs:{column:r,formData:e.formData}}):t("span",[e._v(e._s(e.formData[r.prop]))])],1)}),1)},et=[],tt=z(Xe,Ye,et,!1,null,null,null,null);const rt=tt.exports,Bt="",at={props:{nodeKey:{type:String,default:"id"},filterable:{type:Boolean,default:!1},dataSource:{type:Array,default:()=>[]},checkedKeys:{type:Array,default:()=>[]}},watch:{sourceFilterText(a){this.$refs.sourceTree.filter(a)},selectedFilterText(a){this.$refs.selectTree.filter(a)},checkedKeys(a){this.$refs.sourceTree.setCheckedKeys(a),j.nextTick(()=>{this.getSelectedData(),this.$refs.selectTree.setCheckedKeys(a)})}},data(){return{defaultTreeAttributes:{"default-expand-all":!0,"show-checkbox":!0},selectedList:[],sourceFilterText:"",selectedFilterText:""}},methods:{sourceFilterNode(a,e){return a?e.label.indexOf(a)!==-1:!0},getSelectedData(){let a=!0,e;const t=this.$refs.sourceTree.getCheckedNodes(a,e);this.selectedList=t},removeSelectedData(){let a,e;const t=this.$refs.selectTree.getCheckedNodes(a,e),r={};t.forEach(n=>{r[n[this.nodeKey]]=n}),this.selectedList=this.selectedList.filter(n=>!r[n[this.nodeKey]])}}};var nt=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(r){e.sourceFilterText=r},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(r){e.selectedFilterText=r},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)])},st=[],ot=z(at,nt,st,!1,null,"49dbad2a",null,null);const it=ot.exports,kt="",{getData:ct}=be,{formSchema:lt}=he,ut={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(a,e){JSON.stringify(a)!==JSON.stringify(this.activeName)&&(this.activeName=a)},immediate:!0},activeName:{handler(a){this.$emit(`update:${this.activeNameKey}`,a)}}},methods:{async handleClick(a,e){const t=await V.makeParamsByType({[this.activeNameKey]:this.activeName},this);await V.saveParamsByType(t,this),this.getList({...t})},activeNameInit(){var t,r,n;let a="";(t=this.tabPanes[0])!=null&&t.name&&(a=(r=this.tabPanes[0])==null?void 0:r.name);const e=fe.queryToData(Number((n=this.$route)==null?void 0:n.query[this.activeNameKey]));return this.parametersType==="url"&&e&&(a=e),this.parametersType==="indexDB"&&ct({tableName:"formParams",propertiesKey:this.$route.path||"defQueryParams",primaryKey:this.DBPrimaryKey||"default",mapDB:lt},o=>{this.activeName=o==null?void 0:o[this.activeNameKey]}),this.defActiveName&&(a=this.defActiveName),`${a}`}}};var pt=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(r){e.activeName=r},expression:"activeName"}},"el-tabs",e.$attrs,!1),[e._l(e.tabPanes,function(r){return t("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)},ft=[],dt=z(ut,pt,ft,!1,null,"ebedcae9",null,null);const yt=dt.exports,mt=Je,ht=He,bt=rt,_t=it,gt=yt;I.VDescriptions=bt,I.VGeneralBasicForm=mt,I.VSearchBox=ht,I.VTabs=gt,I.VTreeTransfer=_t,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,60 +1,72 @@
1
- {
2
- "name": "general-basic-form",
3
- "version": "1.2.0",
4
- "description": "",
5
- "main": "./src/index.ts",
6
- "type": "module",
7
- "scripts": {
8
- "build": "cross-env CURRENT_ENV=prod run-p type-check && run-p build-only",
9
- "test:e2e": "playwright test",
10
- "build-only": "vite build",
11
- "type-check": "tsc --noEmit -p tsconfig.json --composite false",
12
- "link": "tsx script/link.ts && yarn link",
13
- "unlink": "tsx script/unlinkModule.ts && yarn unlink && run-p build",
14
- "linkNode": "tsx script/linkNode.ts && yarn link && run-p dev",
15
- "unlinkNode": "tsx script/unlinkNode.ts && yarn unlink && run-p buildts",
16
- "dev": "tsc -w -p .",
17
- "buildts": "rimraf dist && tsc -p ."
18
- },
19
- "keywords": [
20
- "general-basic-form",
21
- "form",
22
- "vue",
23
- "vue2",
24
- "vue3",
25
- "vue-router",
26
- "element-plus",
27
- "element",
28
- "typescript"
29
- ],
30
- "author": "chendeli419287484@qq.com",
31
- "license": "ISC",
32
- "repository": {
33
- "type": "git",
34
- "url": "git+https://github.com/Alan1034/GeneralBasicForm.git"
35
- },
36
- "devDependencies": {
37
- "@playwright/test": "^1.36.1",
38
- "@types/node": "^20.8.10",
39
- "@vitejs/plugin-legacy": "^4.1.1",
40
- "@vitejs/plugin-vue2": "^2.3.1",
41
- "@vitejs/plugin-vue2-jsx": "^1.1.1",
42
- "chalk": "^2.4.2",
43
- "cross-env": "^7.0.3",
44
- "less": "^4.2.0",
45
- "npm-run-all": "^4.1.5",
46
- "rimraf": "^5.0.5",
47
- "sass": "^1.77.8",
48
- "tsx": "^4.0.0",
49
- "typescript": "^5.2.2",
50
- "vite-plugin-image-optimizer": "^1.1.6"
51
- },
52
- "peerDependencies": {
53
- "vue": "^2.7.0-0"
54
- },
55
- "typings": "./publish/index.d.ts",
56
- "dependencies": {
57
- "general-basic-indexdb": "^1.0.1",
58
- "network-spanner": "^1.2.8"
59
- }
60
- }
1
+ {
2
+ "name": "general-basic-form",
3
+ "version": "1.2.2",
4
+ "description": "",
5
+ "main": "./dist/index.umd.cjs",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "cross-env CURRENT_ENV=prod run-p type-check && run-p build-only",
9
+ "test:e2e": "playwright test",
10
+ "build-only": "vite build",
11
+ "type-check": "tsc --noEmit -p tsconfig.json --composite false",
12
+ "link": "tsx script/link.ts && yarn link",
13
+ "unlink": "tsx script/unlinkModule.ts && yarn unlink && run-p build",
14
+ "linkNode": "tsx script/linkNode.ts && yarn link && run-p dev",
15
+ "unlinkNode": "tsx script/unlinkNode.ts && yarn unlink && run-p buildts",
16
+ "dev": "tsc -w -p .",
17
+ "buildts": "rimraf dist && tsc -p ."
18
+ },
19
+ "keywords": [
20
+ "general-basic-form",
21
+ "form",
22
+ "vue",
23
+ "vue2",
24
+ "vue3",
25
+ "vue-router",
26
+ "element-plus",
27
+ "element",
28
+ "typescript"
29
+ ],
30
+ "author": "chendeli419287484@qq.com",
31
+ "license": "ISC",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/Alan1034/GeneralBasicForm.git"
35
+ },
36
+ "devDependencies": {
37
+ "@playwright/test": "^1.36.1",
38
+ "@types/node": "^20.8.10",
39
+ "@vitejs/plugin-legacy": "^4.1.1",
40
+ "@vitejs/plugin-vue2": "^2.3.1",
41
+ "@vitejs/plugin-vue2-jsx": "^1.1.1",
42
+ "chalk": "^2.4.2",
43
+ "cross-env": "^7.0.3",
44
+ "less": "^4.2.0",
45
+ "npm-run-all": "^4.1.5",
46
+ "rimraf": "^5.0.5",
47
+ "sass": "^1.77.8",
48
+ "tsx": "^4.0.0",
49
+ "typescript": "^5.2.2",
50
+ "vite-plugin-image-optimizer": "^1.1.6"
51
+ },
52
+ "peerDependencies": {
53
+ "vue": "^2.7.0-0"
54
+ },
55
+ "typings": "./dist/index.d.ts",
56
+ "dependencies": {
57
+ "general-basic-indexdb": "^1.0.3",
58
+ "network-spanner": "^1.2.11"
59
+ },
60
+ "module": "./dist/index.js",
61
+ "exports": {
62
+ ".": {
63
+ "import": "./dist/index.js",
64
+ "require": "./dist/index.umd.cjs",
65
+ "types": "./dist/index.d.ts"
66
+ },
67
+ "./style": "./dist/style.css"
68
+ },
69
+ "files": [
70
+ "/dist"
71
+ ]
72
+ }
package/public/index.d.ts DELETED
@@ -1,17 +0,0 @@
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";
@@ -1,24 +0,0 @@
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 DELETED
@@ -1,14 +0,0 @@
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")
@@ -1,14 +0,0 @@
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")
@@ -1,48 +0,0 @@
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()
@@ -1,38 +0,0 @@
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 DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "include": [
3
- "public/index.d.tsex.d.ts",
4
- "src/**/*",
5
- "src/**/*.vue",
6
- "public/*",
7
- ],
8
- "exclude": [],
9
- "compilerOptions": {
10
- "declaration": true,
11
- "allowJs": true,
12
- "composite": true
13
- }
14
- }
package/vite.config.js DELETED
@@ -1,121 +0,0 @@
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
- })