general-basic-form 1.0.34 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,6 +49,7 @@ import { VGeneralBasicForm } from "general-basic-form";
49
49
  size="small"
50
50
  ref="VGeneralBasicFormRef"
51
51
  :labelWidth="formLabelWidth"
52
+ v-bind:loading:sync="loading"
52
53
  :formData: {
53
54
  // 外部传入的表单数据,用于回填
54
55
  }
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- function u(r, e, s, t, n, o, p, d) {
1
+ function u(r, e, n, t, s, o, p, d) {
2
2
  var a = typeof r == "function" ? r.options : r;
3
- e && (a.render = e, a.staticRenderFns = s, a._compiled = !0), t && (a.functional = !0), o && (a._scopeId = "data-v-" + o);
3
+ e && (a.render = e, a.staticRenderFns = n, a._compiled = !0), t && (a.functional = !0), o && (a._scopeId = "data-v-" + o);
4
4
  var l;
5
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(p);
9
- }, a._ssrRegister = l) : n && (l = d ? function() {
10
- n.call(
8
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !i && typeof __VUE_SSR_CONTEXT__ < "u" && (i = __VUE_SSR_CONTEXT__), s && s.call(this, i), i && i._registeredComponents && i._registeredComponents.add(p);
9
+ }, a._ssrRegister = l) : s && (l = d ? function() {
10
+ s.call(
11
11
  this,
12
12
  (a.functional ? this.parent : this).$root.$options.shadowRoot
13
13
  );
14
- } : n), l)
14
+ } : s), l)
15
15
  if (a.functional) {
16
16
  a._injectStyles = l;
17
17
  var _ = a.render;
@@ -76,8 +76,8 @@ const y = {
76
76
  }
77
77
  };
78
78
  var m = function() {
79
- var e = this, s = e._self._c;
80
- return s("el-button", { on: { click: e.buttonClick } }, [e._v(e._s(e.buttonType ? e.defaultText : e.buttonText + "s"))]);
79
+ var e = this, n = e._self._c;
80
+ return n("el-button", { on: { click: e.buttonClick } }, [e._v(e._s(e.buttonType ? e.defaultText : e.buttonText + "s"))]);
81
81
  }, g = [], b = /* @__PURE__ */ u(
82
82
  y,
83
83
  m,
@@ -228,9 +228,9 @@ const k = {
228
228
  methods: {
229
229
  /** 搜索按钮操作 */
230
230
  handleQuery() {
231
- var s;
231
+ var n;
232
232
  const r = { page: 1, limit: 10 }, e = {
233
- ...(s = this.$route) == null ? void 0 : s.query,
233
+ ...(n = this.$route) == null ? void 0 : n.query,
234
234
  ...this.queryParams,
235
235
  ...r
236
236
  };
@@ -255,7 +255,7 @@ const k = {
255
255
  return "input-archive";
256
256
  },
257
257
  getItemRules(r) {
258
- const { type: e, rules: s = [] } = r, t = [...s];
258
+ const { type: e, rules: n = [] } = r, t = [...n];
259
259
  return this.noInputBlank && e === "input" && t.push({
260
260
  pattern: this.trimRegex,
261
261
  message: "请输入(不能仅输入空格)",
@@ -263,66 +263,69 @@ const k = {
263
263
  }), t;
264
264
  },
265
265
  getInputSetting(r) {
266
- const { inputSetting: e } = r;
266
+ const { inputSetting: e, setting: n } = r;
267
267
  return {
268
268
  ...this.inputSetting,
269
- ...e
269
+ ...e,
270
+ ...n
270
271
  };
271
272
  },
272
273
  getSelectSetting(r) {
273
- const { selectSetting: e } = r;
274
+ const { selectSetting: e, setting: n } = r;
274
275
  return {
275
276
  ...this.selectSetting,
276
- ...e
277
+ ...e,
278
+ ...n
277
279
  };
278
280
  },
279
281
  getDatePackerSetting(r) {
280
- const { datePackerSetting: e } = r;
282
+ const { datePackerSetting: e, setting: n } = r;
281
283
  return {
282
284
  ...this.datePackerSetting,
283
- ...e
285
+ ...e,
286
+ ...n
284
287
  };
285
288
  }
286
289
  }
287
290
  };
288
291
  var S = function() {
289
- var e = this, s = e._self._c;
290
- return s("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 s("el-form-item", { key: t.prop, attrs: { label: t.label, prop: t.prop, rules: e.getItemRules(t) } }, [t.type === "input" ? s("el-input", e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(n) {
292
- return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
293
- } }, scopedSlots: e._u([e._l(t.template, function(n, o) {
292
+ var e = this, n = e._self._c;
293
+ return n("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) {
294
+ return n("el-form-item", { key: t.prop, attrs: { label: t.label, prop: t.prop, rules: e.getItemRules(t) } }, [t.type === "input" ? n("el-input", e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(s) {
295
+ return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.getList.apply(null, arguments);
296
+ } }, scopedSlots: e._u([e._l(t.template, function(s, o) {
294
297
  return { key: o, fn: function() {
295
- return [n ? s(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: n } }) : e._e()];
298
+ return [s ? n(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: s } }) : e._e()];
296
299
  }, proxy: !0 };
297
- })], null, !0), model: { value: e.queryParams[t.prop], callback: function(n) {
298
- e.$set(e.queryParams, t.prop, n);
299
- }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1)) : t.type === "input-mobile-verification" ? s("el-input", e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(n) {
300
- return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
301
- } }, scopedSlots: e._u([e._l(t.template, function(n, o) {
300
+ })], null, !0), model: { value: e.queryParams[t.prop], callback: function(s) {
301
+ e.$set(e.queryParams, t.prop, s);
302
+ }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1)) : t.type === "input-mobile-verification" ? n("el-input", e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(s) {
303
+ return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.getList.apply(null, arguments);
304
+ } }, scopedSlots: e._u([e._l(t.template, function(s, o) {
302
305
  return { key: o, fn: function() {
303
- return [n ? s(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: n } }) : e._e()];
306
+ return [s ? n(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: s } }) : e._e()];
304
307
  }, proxy: !0 };
305
- })], null, !0), model: { value: e.queryParams[t.prop], callback: function(n) {
306
- e.$set(e.queryParams, t.prop, n);
307
- }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1), [s("template", { slot: "append" }, [s("verification-button", { attrs: { verificationSetting: t.verificationSetting, getSmscode: t.getSmscode } })], 1)], 2) : t.type === "select" ? s("el-select", e._b({ attrs: { filterable: "", size: e.size }, model: { value: e.queryParams[t.prop], callback: function(n) {
308
- e.$set(e.queryParams, t.prop, n);
309
- }, expression: "queryParams[item.prop]" } }, "el-select", e.getSelectSetting(t), !1), e._l(t.option || [], function(n) {
310
- return s("el-option", { key: n.value, attrs: { label: n.label, value: n.value } });
311
- }), 1) : t.type === "cascader" ? s("el-cascader", e._b({ attrs: { filterable: "", size: e.size, options: t.options || [] }, model: { value: e.queryParams[t.prop], callback: function(n) {
312
- e.$set(e.queryParams, t.prop, n);
313
- }, expression: "queryParams[item.prop]" } }, "el-cascader", e.getSelectSetting(t), !1)) : t.type === "date-picker" ? s("el-date-picker", e._b({ attrs: { size: e.size }, model: { value: e.queryParams[t.prop], callback: function(n) {
314
- e.$set(e.queryParams, t.prop, n);
315
- }, expression: "queryParams[item.prop]" } }, "el-date-picker", e.getDatePackerSetting(t), !1)) : e._e(), t.type === "input-number" ? s("el-input-number", e._b({ attrs: { size: e.size }, model: { value: e.queryParams[t.prop], callback: function(n) {
316
- e.$set(e.queryParams, t.prop, n);
308
+ })], null, !0), model: { value: e.queryParams[t.prop], callback: function(s) {
309
+ e.$set(e.queryParams, t.prop, s);
310
+ }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1), [n("template", { slot: "append" }, [n("verification-button", { attrs: { verificationSetting: t.verificationSetting, getSmscode: t.getSmscode } })], 1)], 2) : t.type === "select" ? n("el-select", e._b({ attrs: { filterable: "", size: e.size }, model: { value: e.queryParams[t.prop], callback: function(s) {
311
+ e.$set(e.queryParams, t.prop, s);
312
+ }, expression: "queryParams[item.prop]" } }, "el-select", e.getSelectSetting(t), !1), e._l(t.option || [], function(s) {
313
+ return n("el-option", { key: s.value, attrs: { label: s.label, value: s.value } });
314
+ }), 1) : t.type === "cascader" ? n("el-cascader", e._b({ attrs: { filterable: "", size: e.size, options: t.options || [] }, model: { value: e.queryParams[t.prop], callback: function(s) {
315
+ e.$set(e.queryParams, t.prop, s);
316
+ }, expression: "queryParams[item.prop]" } }, "el-cascader", e.getSelectSetting(t), !1)) : t.type === "date-picker" ? n("el-date-picker", e._b({ attrs: { size: e.size }, model: { value: e.queryParams[t.prop], callback: function(s) {
317
+ e.$set(e.queryParams, t.prop, s);
318
+ }, expression: "queryParams[item.prop]" } }, "el-date-picker", e.getDatePackerSetting(t), !1)) : e._e(), t.type === "input-number" ? n("el-input-number", e._b({ attrs: { size: e.size }, model: { value: e.queryParams[t.prop], callback: function(s) {
319
+ e.$set(e.queryParams, t.prop, s);
317
320
  }, expression: "queryParams[item.prop]" } }, "el-input-number", e.getInputSetting(t), !1)) : e._e()], 1);
318
- }), e._t("default"), e.formOnly ? e._e() : s("el-form-item", [s("el-button", { attrs: { type: "primary", icon: "el-icon-search", size: e.size, loading: e.formLoading }, on: { click: e.handleQuery } }, [e._v("查询")]), s("el-button", { attrs: { icon: "el-icon-refresh", size: e.size }, on: { click: e.resetQuery } }, [e._v("重置")])], 1), e._t("behind-the-button")], 2);
321
+ }), 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);
319
322
  }, x = [], P = /* @__PURE__ */ u(
320
323
  k,
321
324
  S,
322
325
  x,
323
326
  !1,
324
327
  null,
325
- "1892bd0a",
328
+ "eb469405",
326
329
  null,
327
330
  null
328
331
  );
@@ -375,12 +378,12 @@ const C = {
375
378
  }
376
379
  };
377
380
  var $ = function() {
378
- var e = this, s = e._self._c;
379
- return s("div", { staticClass: "search-box" }, [s("el-input", e._b({ style: { ...e.inputstyle }, attrs: { size: e.size }, nativeOn: { keydown: function(t) {
381
+ var e = this, n = e._self._c;
382
+ return n("div", { staticClass: "search-box" }, [n("el-input", e._b({ style: { ...e.inputstyle }, attrs: { size: e.size }, nativeOn: { keydown: function(t) {
380
383
  return !t.type.indexOf("key") && e._k(t.keyCode, "enter", 13, t.key, "Enter") ? null : e.search.apply(null, arguments);
381
384
  } }, model: { value: e.keyWord, callback: function(t) {
382
385
  e.keyWord = t;
383
- }, expression: "keyWord" } }, "el-input", e.$attrs, !1), [s("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" }, [s("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);
386
+ }, 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);
384
387
  }, w = [], T = /* @__PURE__ */ u(
385
388
  C,
386
389
  $,
@@ -405,8 +408,8 @@ const z = T.exports, I = {
405
408
  }
406
409
  },
407
410
  render(r, e) {
408
- const { props: s } = e, { column: t, formData: n } = s;
409
- return t.render(n);
411
+ const { props: n } = e, { column: t, formData: s } = n;
412
+ return t.render(s);
410
413
  }
411
414
  }, O = {
412
415
  name: "Descriptions",
@@ -428,9 +431,9 @@ const z = T.exports, I = {
428
431
  }
429
432
  };
430
433
  var B = function() {
431
- var e = this, s = e._self._c;
432
- return s("el-descriptions", e._b({ staticClass: "v-descriptions", attrs: { border: "" } }, "el-descriptions", e.$attrs, !1), e._l(e.formItem, function(t, n) {
433
- return s("el-descriptions-item", e._b({ key: t.prop, attrs: { label: t.label } }, "el-descriptions-item", t.descriptionsItemProps, !1), [t.render ? s("DescriptionsColumn", { attrs: { column: t, formData: e.formData } }) : s("span", [e._v(e._s(e.formData[t.prop]))])], 1);
434
+ var e = this, n = e._self._c;
435
+ return n("el-descriptions", e._b({ staticClass: "v-descriptions", attrs: { border: "" } }, "el-descriptions", e.$attrs, !1), e._l(e.formItem, function(t, s) {
436
+ return n("el-descriptions-item", e._b({ key: t.prop, attrs: { label: t.label } }, "el-descriptions-item", t.descriptionsItemProps, !1), [t.render ? n("DescriptionsColumn", { attrs: { column: t, formData: e.formData } }) : n("span", [e._v(e._s(e.formData[t.prop]))])], 1);
434
437
  }), 1);
435
438
  }, D = [], R = /* @__PURE__ */ u(
436
439
  O,
@@ -1 +1 @@
1
- (function(l,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(l=typeof globalThis<"u"?globalThis:l||self,p(l.Index={}))})(this,function(l){"use strict";const p="";function c(r,e,s,t,n,o,f,W){var a=typeof r=="function"?r.options:r;e&&(a.render=e,a.staticRenderFns=s,a._compiled=!0),t&&(a.functional=!0),o&&(a._scopeId="data-v-"+o);var u;if(f?(u=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)},a._ssrRegister=u):n&&(u=W?function(){n.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:n),u)if(a.functional){a._injectStyles=u;var V=a.render;a.render=function(U,h){return u.call(h),V(U,h)}}else{var d=a.beforeCreate;a.beforeCreate=d?[].concat(d,u):[u]}return{exports:r,options:a}}const _={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 y=function(){var e=this,s=e._self._c;return s("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,j="",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:""},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 s;const r={page:1,limit:10},e={...(s=this.$route)==null?void 0:s.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:s=[]}=r,t=[...s];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,s=e._self._c;return s("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 s("el-form-item",{key:t.prop,attrs:{label:t.label,prop:t.prop,rules:e.getItemRules(t)}},[t.type==="input"?s("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?s(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"?s("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?s(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),[s("template",{slot:"append"},[s("verification-button",{attrs:{verificationSetting:t.verificationSetting,getSmscode:t.getSmscode}})],1)],2):t.type==="select"?s("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 s("el-option",{key:n.value,attrs:{label:n.label,value:n.value}})}),1):t.type==="cascader"?s("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"?s("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"?s("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():s("el-form-item",[s("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:e.size,loading:e.formLoading},on:{click:e.handleQuery}},[e._v("查询")]),s("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,"1892bd0a",null,null);const P=x.exports,N="",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,s=e._self._c;return s("div",{staticClass:"search-box"},[s("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),[s("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"},[s("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=c(q,C,$,!1,null,"f4757253",null,null);const w=T.exports,z={name:"Descriptions",components:{DescriptionsColumn:{functional:!0,props:{column:{default:{render:()=>{}},type:Object},formData:{default:{},type:Object}},render(r,e){const{props:s}=e,{column:t,formData:n}=s;return t.render(n)}}},props:{formItem:{type:Array,default:[]},formData:{type:Object,default:()=>{}}}};var I=function(){var e=this,s=e._self._c;return s("el-descriptions",e._b({staticClass:"v-descriptions",attrs:{border:""}},"el-descriptions",e.$attrs,!1),e._l(e.formItem,function(t,n){return s("el-descriptions-item",e._b({key:t.prop,attrs:{label:t.label}},"el-descriptions-item",t.descriptionsItemProps,!1),[t.render?s("DescriptionsColumn",{attrs:{column:t,formData:e.formData}}):s("span",[e._v(e._s(e.formData[t.prop]))])],1)}),1)},B=[],D=c(z,I,B,!1,null,null,null,null);const O=D.exports,F=P,R=w,L=O;l.VDescriptions=L,l.VGeneralBasicForm=F,l.VSearchBox=R,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(l=typeof globalThis<"u"?globalThis:l||self,p(l.Index={}))})(this,function(l){"use strict";const p="";function c(r,e,n,t,s,o,f,W){var a=typeof r=="function"?r.options:r;e&&(a.render=e,a.staticRenderFns=n,a._compiled=!0),t&&(a.functional=!0),o&&(a._scopeId="data-v-"+o);var u;if(f?(u=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__),s&&s.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(f)},a._ssrRegister=u):s&&(u=W?function(){s.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:s),u)if(a.functional){a._injectStyles=u;var V=a.render;a.render=function(U,h){return u.call(h),V(U,h)}}else{var d=a.beforeCreate;a.beforeCreate=d?[].concat(d,u):[u]}return{exports:r,options:a}}const _={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 y=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"))])},m=[],g=c(_,y,m,!1,null,null,null,null);const b=g.exports,j="",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:""},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 n;const r={page:1,limit:10},e={...(n=this.$route)==null?void 0:n.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:n=[]}=r,t=[...n];return this.noInputBlank&&e==="input"&&t.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),t},getInputSetting(r){const{inputSetting:e,setting:n}=r;return{...this.inputSetting,...e,...n}},getSelectSetting(r){const{selectSetting:e,setting:n}=r;return{...this.selectSetting,...e,...n}},getDatePackerSetting(r){const{datePackerSetting:e,setting:n}=r;return{...this.datePackerSetting,...e,...n}}}};var k=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,inline:"","label-position":"left","label-width":e.labelWidth}},"el-form",e.$attrs,!1),[e._l(e.formItem,function(t){return n("el-form-item",{key:t.prop,attrs:{label:t.label,prop:t.prop,rules:e.getItemRules(t)}},[t.type==="input"?n("el-input",e._b({attrs:{size:e.size},nativeOn:{keydown:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(s,o){return{key:o,fn:function(){return[s?n(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:s}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(s){e.$set(e.queryParams,t.prop,s)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1)):t.type==="input-mobile-verification"?n("el-input",e._b({attrs:{size:e.size},nativeOn:{keydown:function(s){return!s.type.indexOf("key")&&e._k(s.keyCode,"enter",13,s.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(s,o){return{key:o,fn:function(){return[s?n(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:s}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(s){e.$set(e.queryParams,t.prop,s)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1),[n("template",{slot:"append"},[n("verification-button",{attrs:{verificationSetting:t.verificationSetting,getSmscode:t.getSmscode}})],1)],2):t.type==="select"?n("el-select",e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[t.prop],callback:function(s){e.$set(e.queryParams,t.prop,s)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(t),!1),e._l(t.option||[],function(s){return n("el-option",{key:s.value,attrs:{label:s.label,value:s.value}})}),1):t.type==="cascader"?n("el-cascader",e._b({attrs:{filterable:"",size:e.size,options:t.options||[]},model:{value:e.queryParams[t.prop],callback:function(s){e.$set(e.queryParams,t.prop,s)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(t),!1)):t.type==="date-picker"?n("el-date-picker",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(s){e.$set(e.queryParams,t.prop,s)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(t),!1)):e._e(),t.type==="input-number"?n("el-input-number",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(s){e.$set(e.queryParams,t.prop,s)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(t),!1)):e._e()],1)}),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)},S=[],x=c(v,k,S,!1,null,"eb469405",null,null);const P=x.exports,N="",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,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(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),[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)},$=[],T=c(q,C,$,!1,null,"f4757253",null,null);const w=T.exports,z={name:"Descriptions",components:{DescriptionsColumn:{functional:!0,props:{column:{default:{render:()=>{}},type:Object},formData:{default:{},type:Object}},render(r,e){const{props:n}=e,{column:t,formData:s}=n;return t.render(s)}}},props:{formItem:{type:Array,default:[]},formData:{type:Object,default:()=>{}}}};var I=function(){var e=this,n=e._self._c;return n("el-descriptions",e._b({staticClass:"v-descriptions",attrs:{border:""}},"el-descriptions",e.$attrs,!1),e._l(e.formItem,function(t,s){return n("el-descriptions-item",e._b({key:t.prop,attrs:{label:t.label}},"el-descriptions-item",t.descriptionsItemProps,!1),[t.render?n("DescriptionsColumn",{attrs:{column:t,formData:e.formData}}):n("span",[e._v(e._s(e.formData[t.prop]))])],1)}),1)},B=[],D=c(z,I,B,!1,null,null,null,null);const O=D.exports,F=P,R=w,L=O;l.VDescriptions=L,l.VGeneralBasicForm=F,l.VSearchBox=R,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
- {
2
- "name": "general-basic-form",
3
- "version": "1.0.34",
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
- "element-plus",
26
- "typescript"
27
- ],
28
- "author": "chendeli419287484@qq.com",
29
- "license": "ISC",
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/Alan1034/GeneralBasicForm.git"
33
- },
34
- "devDependencies": {
35
- "@playwright/test": "^1.36.1",
36
- "@types/node": "^20.8.10",
37
- "@vitejs/plugin-legacy": "^4.1.1",
38
- "@vitejs/plugin-vue2": "^2.3.1",
39
- "@vitejs/plugin-vue2-jsx": "^1.1.1",
40
- "chalk": "^2.4.2",
41
- "cross-env": "^7.0.3",
42
- "less": "^4.2.0",
43
- "npm-run-all": "^4.1.5",
44
- "rimraf": "^5.0.5",
45
- "sass": "^1.77.8",
46
- "tsx": "^4.0.0",
47
- "typescript": "^5.2.2",
48
- "vite-plugin-image-optimizer": "^1.1.6"
49
- },
50
- "peerDependencies": {
51
- "vue": "^2.7.0-0"
52
- },
53
- "typings": "./dist/index.d.ts",
54
- "module": "./dist/index.js",
55
- "exports": {
56
- ".": {
57
- "import": "./dist/index.js",
58
- "require": "./dist/index.umd.cjs",
59
- "types": "./dist/index.d.ts"
60
- },
61
- "./style": "./dist/style.css"
62
- },
63
- "files": [
64
- "/dist"
65
- ]
66
- }
1
+ {
2
+ "name": "general-basic-form",
3
+ "version": "1.0.35",
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
+ "element-plus",
26
+ "typescript"
27
+ ],
28
+ "author": "chendeli419287484@qq.com",
29
+ "license": "ISC",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/Alan1034/GeneralBasicForm.git"
33
+ },
34
+ "devDependencies": {
35
+ "@playwright/test": "^1.36.1",
36
+ "@types/node": "^20.8.10",
37
+ "@vitejs/plugin-legacy": "^4.1.1",
38
+ "@vitejs/plugin-vue2": "^2.3.1",
39
+ "@vitejs/plugin-vue2-jsx": "^1.1.1",
40
+ "chalk": "^2.4.2",
41
+ "cross-env": "^7.0.3",
42
+ "less": "^4.2.0",
43
+ "npm-run-all": "^4.1.5",
44
+ "rimraf": "^5.0.5",
45
+ "sass": "^1.77.8",
46
+ "tsx": "^4.0.0",
47
+ "typescript": "^5.2.2",
48
+ "vite-plugin-image-optimizer": "^1.1.6"
49
+ },
50
+ "peerDependencies": {
51
+ "vue": "^2.7.0-0"
52
+ },
53
+ "typings": "./dist/index.d.ts",
54
+ "module": "./dist/index.js",
55
+ "exports": {
56
+ ".": {
57
+ "import": "./dist/index.js",
58
+ "require": "./dist/index.umd.cjs",
59
+ "types": "./dist/index.d.ts"
60
+ },
61
+ "./style": "./dist/style.css"
62
+ },
63
+ "files": [
64
+ "/dist"
65
+ ]
66
+ }