general-basic-form 1.0.31 → 1.0.33

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.md CHANGED
@@ -1,6 +1,11 @@
1
- # GeneralBasicForm
1
+ # GeneralBasicForm 一个兼容 Vue2 和 Vue3 的表单组件,支持typescript,vue2请使用@1版本,Vue3请使用@2版本
2
2
 
3
- 一个兼容 Vue2 Vue3 的表单组件,支持typescript,vue2请使用@1版本,Vue3请使用@2版本 <br/>
3
+ | 组件\兼容性 | vue2 | vue3 |
4
+ | ------------------- | ---- | ---- |
5
+ | GeneralBasicForm | √ | √ |
6
+ | SearchBox | √ | |
7
+ | VInfiniteScrollList | | √ |
8
+ | VDescriptions | | √ |
4
9
 
5
10
  示例:
6
11
 
@@ -138,7 +143,8 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
138
143
  type: "input",
139
144
  inputSetting: {
140
145
  placeholder: '请输入手机验证码',
141
- style: 'width: 100%'
146
+ style: 'width: 100%',
147
+ "prefix-icon": "el-icon-search"
142
148
  },
143
149
  rules: [
144
150
  {
@@ -149,11 +155,6 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
149
155
  message: "请输入正确的Invoice单号"
150
156
  }
151
157
  ],
152
- template: {
153
- suffix: () => {
154
- return <svg-icon icon-class="baifenbi" />;
155
- },
156
- },
157
158
  },
158
159
  {
159
160
  label: "二次工艺",
@@ -357,6 +358,29 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
357
358
  //divider支持template:
358
359
  //default
359
360
 
360
-
361
361
  安装:npm i general-basic-form<br/>
362
- install: npm i general-basic-form
362
+ install: npm i general-basic-form
363
+
364
+ # SearchBox 对搜索框的单独封装
365
+
366
+ ```
367
+ import { VSearchBox } from "general-basic-form";
368
+ ```
369
+
370
+ ![image-20240802200107233](C:\Users\陈德立\AppData\Roaming\Typora\typora-user-images\image-20240802200107233.png)
371
+
372
+ ```
373
+ <VSearchBox placeholder="请输入您想搜索的商品" openHref :inputstyle="{ display: 'block', width: 'auto', margin: '0 90px' }">
374
+ </VSearchBox>
375
+ ```
376
+
377
+
378
+
379
+ ```
380
+ query:Object //搜索条件,会带到跳转后的路由query里
381
+ routePath:String //搜索后跳转路径
382
+ inputstyle:Object//输入框样式
383
+ openHref:Boolean//是否在新标签页中打开搜索结果
384
+ size:String//el-input的size
385
+ ```
386
+
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- function f(r, e, a, t, n, o, u, d) {
1
+ function u(r, e, a, t, n, o, p, d) {
2
2
  var s = typeof r == "function" ? r.options : r;
3
3
  e && (s.render = e, s.staticRenderFns = a, s._compiled = !0), t && (s.functional = !0), o && (s._scopeId = "data-v-" + o);
4
4
  var l;
5
- if (u ? (l = function(i) {
5
+ if (p ? (l = function(i) {
6
6
  i = i || // cached call
7
7
  this.$vnode && this.$vnode.ssrContext || // stateful
8
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !i && typeof __VUE_SSR_CONTEXT__ < "u" && (i = __VUE_SSR_CONTEXT__), n && n.call(this, i), i && i._registeredComponents && i._registeredComponents.add(u);
8
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !i && typeof __VUE_SSR_CONTEXT__ < "u" && (i = __VUE_SSR_CONTEXT__), n && n.call(this, i), i && i._registeredComponents && i._registeredComponents.add(p);
9
9
  }, s._ssrRegister = l) : n && (l = d ? function() {
10
10
  n.call(
11
11
  this,
@@ -15,19 +15,19 @@ function f(r, e, a, t, n, o, u, d) {
15
15
  if (s.functional) {
16
16
  s._injectStyles = l;
17
17
  var h = s.render;
18
- s.render = function(y, c) {
19
- return l.call(c), h(y, c);
18
+ s.render = function(y, f) {
19
+ return l.call(f), h(y, f);
20
20
  };
21
21
  } else {
22
- var p = s.beforeCreate;
23
- s.beforeCreate = p ? [].concat(p, l) : [l];
22
+ var c = s.beforeCreate;
23
+ s.beforeCreate = c ? [].concat(c, l) : [l];
24
24
  }
25
25
  return {
26
26
  exports: r,
27
27
  options: s
28
28
  };
29
29
  }
30
- const m = {
30
+ const _ = {
31
31
  props: {
32
32
  verificationSetting: {
33
33
  type: Object,
@@ -75,12 +75,12 @@ const m = {
75
75
  }
76
76
  }
77
77
  };
78
- var _ = function() {
78
+ var m = function() {
79
79
  var e = this, a = e._self._c;
80
80
  return a("el-button", { on: { click: e.buttonClick } }, [e._v(e._s(e.buttonType ? e.defaultText : e.buttonText + "s"))]);
81
- }, g = [], b = /* @__PURE__ */ f(
82
- m,
81
+ }, g = [], b = /* @__PURE__ */ u(
83
82
  _,
83
+ m,
84
84
  g,
85
85
  !1,
86
86
  null,
@@ -89,7 +89,7 @@ var _ = function() {
89
89
  null
90
90
  );
91
91
  const v = b.exports;
92
- const S = {
92
+ const k = {
93
93
  name: "GeneralBasicForm",
94
94
  components: {
95
95
  InputArchive: (r) => {
@@ -285,10 +285,10 @@ const S = {
285
285
  }
286
286
  }
287
287
  };
288
- var k = function() {
288
+ var S = function() {
289
289
  var e = this, a = e._self._c;
290
290
  return a("el-form", e._b({ directives: [{ name: "show", rawName: "v-show", value: e.showSearch, expression: "showSearch" }], ref: "queryFormRef", attrs: { model: e.queryParams, inline: "", "label-position": "left", "label-width": e.labelWidth } }, "el-form", e.$attrs, !1), [e._l(e.formItem, function(t) {
291
- return a("el-form-item", { key: t.prop, attrs: { label: t.label, prop: t.prop, rules: e.getItemRules(t) } }, [t.type === "input" ? a("el-input", e._b({ attrs: { size: e.size }, on: { keydown: function(n) {
291
+ return a("el-form-item", { key: t.prop, attrs: { label: t.label, prop: t.prop, rules: e.getItemRules(t) } }, [t.type === "input" ? a("el-input", e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(n) {
292
292
  return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
293
293
  } }, scopedSlots: e._u([e._l(t.template, function(n, o) {
294
294
  return { key: o, fn: function() {
@@ -296,7 +296,7 @@ var k = function() {
296
296
  }, proxy: !0 };
297
297
  })], null, !0), model: { value: e.queryParams[t.prop], callback: function(n) {
298
298
  e.$set(e.queryParams, t.prop, n);
299
- }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1)) : t.type === "input-mobile-verification" ? a("el-input", e._b({ attrs: { size: e.size }, on: { keydown: function(n) {
299
+ }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1)) : t.type === "input-mobile-verification" ? a("el-input", e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(n) {
300
300
  return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
301
301
  } }, scopedSlots: e._u([e._l(t.template, function(n, o) {
302
302
  return { key: o, fn: function() {
@@ -316,17 +316,83 @@ var k = function() {
316
316
  e.$set(e.queryParams, t.prop, n);
317
317
  }, expression: "queryParams[item.prop]" } }, "el-input-number", e.getInputSetting(t), !1)) : e._e()], 1);
318
318
  }), e._t("default"), e.formOnly ? e._e() : a("el-form-item", [a("el-button", { attrs: { type: "primary", icon: "el-icon-search", size: e.size, loading: e.formLoading }, on: { click: e.handleQuery } }, [e._v("查询")]), a("el-button", { attrs: { icon: "el-icon-refresh", size: e.size }, on: { click: e.resetQuery } }, [e._v("重置")])], 1), e._t("behind-the-button")], 2);
319
- }, P = [], q = /* @__PURE__ */ f(
320
- S,
319
+ }, x = [], P = /* @__PURE__ */ u(
321
320
  k,
322
- P,
321
+ S,
322
+ x,
323
+ !1,
324
+ null,
325
+ "1a16ba8f",
326
+ null,
327
+ null
328
+ );
329
+ const q = P.exports;
330
+ const C = {
331
+ components: {},
332
+ props: {
333
+ query: {
334
+ type: Object,
335
+ default: () => ({
336
+ prefCode: sessionStorage.getItem("prefCode")
337
+ })
338
+ },
339
+ // 搜索后跳转
340
+ routePath: {
341
+ type: String,
342
+ default: () => "/search/searchDetail"
343
+ },
344
+ inputstyle: {
345
+ type: Object,
346
+ default: () => ({
347
+ width: "1280px"
348
+ })
349
+ },
350
+ // 是否在新标签页中打开搜索结果
351
+ openHref: {
352
+ type: Boolean,
353
+ default: () => !1
354
+ },
355
+ size: {
356
+ type: String,
357
+ default: () => "medium"
358
+ }
359
+ },
360
+ data() {
361
+ var r, e;
362
+ return {
363
+ keyWord: ((e = (r = this.$route) == null ? void 0 : r.query) == null ? void 0 : e.keyWord) || ""
364
+ };
365
+ },
366
+ methods: {
367
+ search() {
368
+ const r = { path: this.routePath, query: { ...this.query, keyWord: this.keyWord } };
369
+ if (this.openHref) {
370
+ const e = this.$router.resolve(r);
371
+ window.open(e.href, "_blank");
372
+ } else
373
+ this.$router.push(r);
374
+ }
375
+ }
376
+ };
377
+ var w = function() {
378
+ var e = this, a = e._self._c;
379
+ return a("div", { staticClass: "search-box" }, [a("el-input", e._b({ style: { ...e.inputstyle }, attrs: { size: e.size }, nativeOn: { keydown: function(t) {
380
+ return !t.type.indexOf("key") && e._k(t.keyCode, "enter", 13, t.key, "Enter") ? null : e.search.apply(null, arguments);
381
+ } }, model: { value: e.keyWord, callback: function(t) {
382
+ e.keyWord = t;
383
+ }, expression: "keyWord" } }, "el-input", e.$attrs, !1), [a("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" }, [a("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);
384
+ }, $ = [], T = /* @__PURE__ */ u(
385
+ C,
386
+ w,
387
+ $,
323
388
  !1,
324
389
  null,
325
- "58b33ecf",
390
+ "f4757253",
326
391
  null,
327
392
  null
328
393
  );
329
- const x = q.exports, T = x;
394
+ const z = T.exports, B = q, I = z;
330
395
  export {
331
- T as VGeneralBasicForm
396
+ B as VGeneralBasicForm,
397
+ I as VSearchBox
332
398
  };
@@ -1 +1 @@
1
- (function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.Index={}))})(this,function(u){"use strict";const p="";function c(r,e,a,t,n,o,f,x){var s=typeof r=="function"?r.options:r;e&&(s.render=e,s.staticRenderFns=a,s._compiled=!0),t&&(s.functional=!0),o&&(s._scopeId="data-v-"+o);var l;if(f?(l=function(i){i=i||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!i&&typeof __VUE_SSR_CONTEXT__<"u"&&(i=__VUE_SSR_CONTEXT__),n&&n.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(f)},s._ssrRegister=l):n&&(l=x?function(){n.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(s.functional){s._injectStyles=l;var T=s.render;s.render=function($,h){return l.call(h),T($,h)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,l):[l]}return{exports:r,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,a=e._self._c;return a("el-button",{on:{click:e.buttonClick}},[e._v(e._s(e.buttonType?e.defaultText:e.buttonText+"s"))])},_=[],g=c(y,m,_,!1,null,null,null,null);const b=g.exports,z="",v={name:"GeneralBasicForm",components:{InputArchive:r=>{const{templateEle:e}=r;return e()},VerificationButton:b},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:"default"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}},noInputBlank:{type:Boolean,default:()=>!1}},data(){var r;return{queryParams:{...this.noUrlParameters?{}:(r=this.$route)==null?void 0:r.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"}}},watch:{formData:{handler(r,e){JSON.stringify(r)!==JSON.stringify(e)&&(this.queryParams={...this.noUrlParameters?{}:this.queryParams,...r})},immediate:!0},queryParams:{handler(r){this.$emit("update:formData",r)},deep:!0},loading(r){this.formLoading!==r&&(this.formLoading=r)},formLoading(r){this.loading!==r&&this.$emit("update:loading",r)}},methods:{handleQuery(){var a;const r={page:1,limit:10},e={...(a=this.$route)==null?void 0:a.query,...this.queryParams,...r};this.noUrlParameters||this.$router.push({query:{...e}}),this.getList({...e})},async resetQuery(){var e;this.$refs.queryFormRef.resetFields();const r={page:1};this.noUrlParameters||await this.$router.push({query:{...r}}),this.queryParams={...this.noUrlParameters?{}:(e=this.$route)==null?void 0:e.query},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"},getItemRules(r){const{type:e,rules:a=[]}=r,t=[...a];return this.noInputBlank&&e==="input"&&t.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),t},getInputSetting(r){const{inputSetting:e}=r;return{...this.inputSetting,...e}},getSelectSetting(r){const{selectSetting:e}=r;return{...this.selectSetting,...e}},getDatePackerSetting(r){const{datePackerSetting:e}=r;return{...this.datePackerSetting,...e}}}};var S=function(){var e=this,a=e._self._c;return a("el-form",e._b({directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryFormRef",attrs:{model:e.queryParams,inline:"","label-position":"left","label-width":e.labelWidth}},"el-form",e.$attrs,!1),[e._l(e.formItem,function(t){return a("el-form-item",{key:t.prop,attrs:{label:t.label,prop:t.prop,rules:e.getItemRules(t)}},[t.type==="input"?a("el-input",e._b({attrs:{size:e.size},on:{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(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1)):t.type==="input-mobile-verification"?a("el-input",e._b({attrs:{size:e.size},on:{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(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1),[a("template",{slot:"append"},[a("verification-button",{attrs:{verificationSetting:t.verificationSetting,getSmscode:t.getSmscode}})],1)],2):t.type==="select"?a("el-select",e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(t),!1),e._l(t.option||[],function(n){return a("el-option",{key:n.value,attrs:{label:n.label,value:n.value}})}),1):t.type==="cascader"?a("el-cascader",e._b({attrs:{filterable:"",size:e.size,options:t.options||[]},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(t),!1)):t.type==="date-picker"?a("el-date-picker",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(t),!1)):e._e(),t.type==="input-number"?a("el-input-number",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(t),!1)):e._e()],1)}),e._t("default"),e.formOnly?e._e():a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:e.size,loading:e.formLoading},on:{click:e.handleQuery}},[e._v("查询")]),a("el-button",{attrs:{icon:"el-icon-refresh",size:e.size},on:{click:e.resetQuery}},[e._v("重置")])],1),e._t("behind-the-button")],2)},k=[],P=c(v,S,k,!1,null,"58b33ecf",null,null);const q=P.exports;u.VGeneralBasicForm=q,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
1
+ (function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.Index={}))})(this,function(u){"use strict";const p="";function c(r,e,a,t,n,o,f,I){var s=typeof r=="function"?r.options:r;e&&(s.render=e,s.staticRenderFns=a,s._compiled=!0),t&&(s.functional=!0),o&&(s._scopeId="data-v-"+o);var l;if(f?(l=function(i){i=i||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!i&&typeof __VUE_SSR_CONTEXT__<"u"&&(i=__VUE_SSR_CONTEXT__),n&&n.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(f)},s._ssrRegister=l):n&&(l=I?function(){n.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(s.functional){s._injectStyles=l;var O=s.render;s.render=function(F,h){return l.call(h),O(F,h)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,l):[l]}return{exports:r,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 _=function(){var e=this,a=e._self._c;return a("el-button",{on:{click:e.buttonClick}},[e._v(e._s(e.buttonType?e.defaultText:e.buttonText+"s"))])},m=[],g=c(y,_,m,!1,null,null,null,null);const b=g.exports,R="",v={name:"GeneralBasicForm",components:{InputArchive:r=>{const{templateEle:e}=r;return e()},VerificationButton:b},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:"default"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}},noInputBlank:{type:Boolean,default:()=>!1}},data(){var r;return{queryParams:{...this.noUrlParameters?{}:(r=this.$route)==null?void 0:r.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"}}},watch:{formData:{handler(r,e){JSON.stringify(r)!==JSON.stringify(e)&&(this.queryParams={...this.noUrlParameters?{}:this.queryParams,...r})},immediate:!0},queryParams:{handler(r){this.$emit("update:formData",r)},deep:!0},loading(r){this.formLoading!==r&&(this.formLoading=r)},formLoading(r){this.loading!==r&&this.$emit("update:loading",r)}},methods:{handleQuery(){var a;const r={page:1,limit:10},e={...(a=this.$route)==null?void 0:a.query,...this.queryParams,...r};this.noUrlParameters||this.$router.push({query:{...e}}),this.getList({...e})},async resetQuery(){var e;this.$refs.queryFormRef.resetFields();const r={page:1};this.noUrlParameters||await this.$router.push({query:{...r}}),this.queryParams={...this.noUrlParameters?{}:(e=this.$route)==null?void 0:e.query},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"},getItemRules(r){const{type:e,rules:a=[]}=r,t=[...a];return this.noInputBlank&&e==="input"&&t.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),t},getInputSetting(r){const{inputSetting:e}=r;return{...this.inputSetting,...e}},getSelectSetting(r){const{selectSetting:e}=r;return{...this.selectSetting,...e}},getDatePackerSetting(r){const{datePackerSetting:e}=r;return{...this.datePackerSetting,...e}}}};var k=function(){var e=this,a=e._self._c;return a("el-form",e._b({directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryFormRef",attrs:{model:e.queryParams,inline:"","label-position":"left","label-width":e.labelWidth}},"el-form",e.$attrs,!1),[e._l(e.formItem,function(t){return a("el-form-item",{key:t.prop,attrs:{label:t.label,prop:t.prop,rules:e.getItemRules(t)}},[t.type==="input"?a("el-input",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(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1)):t.type==="input-mobile-verification"?a("el-input",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(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1),[a("template",{slot:"append"},[a("verification-button",{attrs:{verificationSetting:t.verificationSetting,getSmscode:t.getSmscode}})],1)],2):t.type==="select"?a("el-select",e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(t),!1),e._l(t.option||[],function(n){return a("el-option",{key:n.value,attrs:{label:n.label,value:n.value}})}),1):t.type==="cascader"?a("el-cascader",e._b({attrs:{filterable:"",size:e.size,options:t.options||[]},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(t),!1)):t.type==="date-picker"?a("el-date-picker",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(t),!1)):e._e(),t.type==="input-number"?a("el-input-number",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(t),!1)):e._e()],1)}),e._t("default"),e.formOnly?e._e():a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:e.size,loading:e.formLoading},on:{click:e.handleQuery}},[e._v("查询")]),a("el-button",{attrs:{icon:"el-icon-refresh",size:e.size},on:{click:e.resetQuery}},[e._v("重置")])],1),e._t("behind-the-button")],2)},S=[],x=c(v,k,S,!1,null,"1a16ba8f",null,null);const P=x.exports,L="",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 r,e;return{keyWord:((e=(r=this.$route)==null?void 0:r.query)==null?void 0:e.keyWord)||""}},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 C=function(){var e=this,a=e._self._c;return a("div",{staticClass:"search-box"},[a("el-input",e._b({style:{...e.inputstyle},attrs:{size:e.size},nativeOn:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.search.apply(null,arguments)}},model:{value:e.keyWord,callback:function(t){e.keyWord=t},expression:"keyWord"}},"el-input",e.$attrs,!1),[a("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"},[a("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)},T=[],w=c(q,C,T,!1,null,"f4757253",null,null);const $=w.exports,z=P,B=$;u.VGeneralBasicForm=z,u.VSearchBox=B,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css CHANGED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.search-box[data-v-f4757253]{position:absolute;left:50%;top:0;transform:translate(-50%) translateY(-50%)}.search-box[data-v-f4757253] .el-input{font-size:16px;font-weight:400;line-height:24px}.search-box[data-v-f4757253] .el-input svg{width:32px;height:100%}.search-box[data-v-f4757253] .el-input .el-input__prefix{left:24px;font-size:32px}.search-box[data-v-f4757253] .el-input .el-input__suffix{right:24px;font-size:32px}.search-box[data-v-f4757253] .el-input .el-input__icon{line-height:60px}.search-box[data-v-f4757253] .el-input .el-input__inner{padding:14px 24px 14px 72px;height:60px;border-radius:37px;background:#FFF;box-shadow:0 0 8px #2b2e3105,0 6px 8px #2b2e3114;border-color:#fff}.search-box[data-v-f4757253] .el-input .el-input__inner::placeholder{color:#959a9f}.search-box[data-v-f4757253] .el-input .el-input__inner:hover{border:1px solid #00B5F2}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "general-basic-form",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "type": "module",
@@ -42,6 +42,7 @@
42
42
  "less": "^4.2.0",
43
43
  "npm-run-all": "^4.1.5",
44
44
  "rimraf": "^5.0.5",
45
+ "sass": "^1.77.8",
45
46
  "tsx": "^4.0.0",
46
47
  "typescript": "^5.2.2",
47
48
  "vite-plugin-image-optimizer": "^1.1.6"