ljs-tools 0.2.9 → 0.2.10

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/index.js CHANGED
@@ -12321,10 +12321,10 @@ const _export_sfc = (sfc, props) => {
12321
12321
  return target;
12322
12322
  };
12323
12323
  const _sfc_main$7 = index$3;
12324
- const _withScopeId$2 = (n) => (pushScopeId("data-v-295da8be"), n = n(), popScopeId(), n);
12324
+ const _withScopeId$3 = (n) => (pushScopeId("data-v-295da8be"), n = n(), popScopeId(), n);
12325
12325
  const _hoisted_1$6 = { class: "text" };
12326
12326
  const _hoisted_2$4 = { class: "g-container" };
12327
- const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("div", { class: "g-circle" }, null, -1));
12327
+ const _hoisted_3$2 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("div", { class: "g-circle" }, null, -1));
12328
12328
  const _hoisted_4 = { class: "g-bubbles" };
12329
12329
  function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
12330
12330
  return openBlock(), createElementBlock("div", {
@@ -12713,6 +12713,16 @@ const index$1 = {
12713
12713
  dictValue: String,
12714
12714
  // 日期类型字典数据
12715
12715
  datetypeData: Array,
12716
+ // 清除按钮
12717
+ clearable: {
12718
+ type: Boolean,
12719
+ default: false
12720
+ },
12721
+ disabledDate: {
12722
+ type: Function,
12723
+ default: () => {
12724
+ }
12725
+ },
12716
12726
  // 字典key值对应的value值,按照年月日的顺序,默认年为1日为3
12717
12727
  dateTypeKeyValue: {
12718
12728
  type: Array,
@@ -12737,7 +12747,9 @@ const index$1 = {
12737
12747
  date_type: [],
12738
12748
  // 日期参数
12739
12749
  opts: {
12740
- dateType: "daterange",
12750
+ startDate: null,
12751
+ endDate: null,
12752
+ dateType: "date",
12741
12753
  // 日期类型,年year,月month,日date
12742
12754
  dateTypeTag: true,
12743
12755
  // 日期控件是否显示
@@ -12753,14 +12765,6 @@ const index$1 = {
12753
12765
  set(val) {
12754
12766
  this.$emit("update:dictValue", val);
12755
12767
  }
12756
- },
12757
- dateValue: {
12758
- get() {
12759
- return this.date;
12760
- },
12761
- set(val) {
12762
- this.$emit("update:date", val);
12763
- }
12764
12768
  }
12765
12769
  },
12766
12770
  watch: {
@@ -12785,12 +12789,23 @@ const index$1 = {
12785
12789
  this.init();
12786
12790
  },
12787
12791
  methods: {
12788
- yearChange() {
12789
- if (Number(this.dateValue[1]) < Number(this.dateValue[0])) {
12790
- const temp0 = this.dateValue[0];
12791
- const temp1 = this.dateValue[1];
12792
- this.dateValue = [temp1, temp0];
12792
+ // 切换日期
12793
+ dateChange() {
12794
+ if (this.opts.startDate === null || this.opts.endDate === null) {
12795
+ return;
12796
+ }
12797
+ let start = this.opts.startDate;
12798
+ let end = this.opts.startDate;
12799
+ if (this.dateType !== "year") {
12800
+ start = new Date(this.opts.startDate).getTime();
12801
+ end = new Date(this.opts.endDate).getTime();
12793
12802
  }
12803
+ if (Number(start) > Number(end)) {
12804
+ const temp = this.opts.startDate;
12805
+ this.opts.startDate = this.opts.endDate;
12806
+ this.opts.endDate = temp;
12807
+ }
12808
+ this.$emit("update:date", [this.opts.startDate, this.opts.endDate]);
12794
12809
  },
12795
12810
  init() {
12796
12811
  this.initData();
@@ -12811,6 +12826,10 @@ const index$1 = {
12811
12826
  });
12812
12827
  this.date_type = res1;
12813
12828
  }
12829
+ if (!LJSbase.fieldCheck(this.date) && this.date.length === 2) {
12830
+ this.opts.startDate = this.date[0];
12831
+ this.opts.endDate = this.date[1];
12832
+ }
12814
12833
  this.dateTypeF(this.dateType);
12815
12834
  },
12816
12835
  // 日期类型切换
@@ -12818,47 +12837,58 @@ const index$1 = {
12818
12837
  this.opts.dateTypeTag = false;
12819
12838
  this.dateType = val;
12820
12839
  let dateValue = [];
12821
- const date = /* @__PURE__ */ new Date();
12840
+ let date = null;
12822
12841
  switch (val) {
12823
12842
  case this.dateTypeKeyValue[3]:
12824
- this.opts.dateType = "daterange";
12825
- this.opts.valueFormat = "YYYY-MM-DD";
12826
- dateValue = [LJSdate.formatTime(date, "{y}-{m}-{d}"), LJSdate.formatTime(date, "{y}-{m}-{d}")];
12843
+ this.opts.dateType = "datetime";
12844
+ this.opts.valueFormat = "YYYY-MM-DD HH:mm:ss";
12827
12845
  break;
12828
12846
  case this.dateTypeKeyValue[2]:
12829
- this.opts.dateType = "daterange";
12847
+ this.opts.dateType = "date";
12830
12848
  this.opts.valueFormat = "YYYY-MM-DD";
12831
- dateValue = [LJSdate.formatTime(date, "{y}-{m}-01"), LJSdate.formatTime(date, "{y}-{m}-{d}")];
12832
12849
  break;
12833
12850
  case this.dateTypeKeyValue[1]:
12834
- this.opts.dateType = "monthrange";
12851
+ this.opts.dateType = "month";
12835
12852
  this.opts.valueFormat = "YYYY-MM";
12836
- dateValue = [LJSdate.formatTime(date, "{y}-01"), LJSdate.formatTime(date, "{y}-{m}")];
12837
12853
  break;
12838
12854
  case this.dateTypeKeyValue[0]:
12839
12855
  this.opts.dateType = "year";
12840
12856
  this.opts.valueFormat = "YYYY";
12841
- dateValue = [(date.getFullYear() - 4).toString(), date.getFullYear().toString()];
12842
12857
  break;
12843
12858
  }
12844
- this.dateValue = dateValue;
12859
+ if (!LJSbase.fieldCheck(this.date) && this.date.length === 2) {
12860
+ date = [this.date[0], this.date[1]];
12861
+ switch (val) {
12862
+ case this.dateTypeKeyValue[3]:
12863
+ dateValue = [LJSdate.formatTime(date[0], "{y}-{m}-{d}"), LJSdate.formatTime(date[1], "{y}-{m}-{d}")];
12864
+ break;
12865
+ case this.dateTypeKeyValue[2]:
12866
+ dateValue = [LJSdate.formatTime(date[0], "{y}-{m}-{d}"), LJSdate.formatTime(date[1], "{y}-{m}-{d}")];
12867
+ break;
12868
+ case this.dateTypeKeyValue[1]:
12869
+ dateValue = [LJSdate.formatTime(date[0], "{y}-{m}"), LJSdate.formatTime(date[1], "{y}-{m}")];
12870
+ break;
12871
+ case this.dateTypeKeyValue[0]:
12872
+ dateValue = date;
12873
+ break;
12874
+ }
12875
+ this.dateValue = dateValue;
12876
+ }
12845
12877
  setTimeout(() => {
12846
12878
  this.opts.dateTypeTag = true;
12847
12879
  }, 0);
12848
12880
  }
12849
12881
  }
12850
12882
  };
12851
- const index_vue_vue_type_style_index_0_scoped_df1ad931_lang = "";
12883
+ const index_vue_vue_type_style_index_0_scoped_e45b32bb_lang = "";
12852
12884
  const _sfc_main$3 = index$1;
12885
+ const _withScopeId$2 = (n) => (pushScopeId("data-v-e45b32bb"), n = n(), popScopeId(), n);
12853
12886
  const _hoisted_1$3 = ["onClick"];
12854
12887
  const _hoisted_2$1 = {
12855
12888
  key: 0,
12856
12889
  class: "frequencyDate"
12857
12890
  };
12858
- const _hoisted_3$1 = {
12859
- key: 2,
12860
- class: "zhi"
12861
- };
12891
+ const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "zhi" }, "~", -1));
12862
12892
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
12863
12893
  const _component_el_date_picker = resolveComponent("el-date-picker");
12864
12894
  const _component_el_form_item = resolveComponent("el-form-item");
@@ -12884,45 +12914,35 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
12884
12914
  createVNode(Transition, { name: "frequencyDate" }, {
12885
12915
  default: withCtx(() => [
12886
12916
  _ctx.opts.dateTypeTag ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
12887
- _ctx.opts.dateType !== "year" ? (openBlock(), createBlock(_component_el_date_picker, {
12888
- key: 0,
12889
- modelValue: _ctx.dateValue,
12890
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.dateValue = $event),
12891
- style: { "width": "240px" },
12892
- "value-format": _ctx.opts.valueFormat,
12893
- type: _ctx.opts.dateType,
12894
- placeholder: "请选择",
12895
- editable: false,
12896
- clearable: false,
12897
- "disabled-date": _ctx.LJSfc.pickerOptions()
12898
- }, null, 8, ["modelValue", "value-format", "type", "disabled-date"])) : createCommentVNode("", true),
12899
- _ctx.opts.dateType === "year" ? (openBlock(), createBlock(_component_el_date_picker, {
12900
- key: 1,
12901
- modelValue: _ctx.dateValue[0],
12902
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.dateValue[0] = $event),
12903
- style: { "width": "100px !important" },
12917
+ createVNode(_component_el_date_picker, {
12918
+ modelValue: _ctx.opts.startDate,
12919
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.opts.startDate = $event),
12920
+ style: normalizeStyle({
12921
+ width: `${_ctx.opts.dateType === "year" ? 100 : _ctx.opts.dateType === "month" ? 120 : _ctx.opts.dateType === "date" ? 140 : _ctx.opts.dateType === "datetime" ? 200 : 200}px !important`
12922
+ }),
12904
12923
  "value-format": _ctx.opts.valueFormat,
12905
12924
  type: _ctx.opts.dateType,
12906
12925
  placeholder: "请选择",
12907
12926
  editable: false,
12908
- clearable: false,
12909
- "disabled-date": _ctx.LJSfc.pickerOptions(),
12910
- onChange: _ctx.yearChange
12911
- }, null, 8, ["modelValue", "value-format", "type", "disabled-date", "onChange"])) : createCommentVNode("", true),
12912
- _ctx.opts.dateType === "year" ? (openBlock(), createElementBlock("span", _hoisted_3$1, "~")) : createCommentVNode("", true),
12913
- _ctx.opts.dateType === "year" ? (openBlock(), createBlock(_component_el_date_picker, {
12914
- key: 3,
12915
- modelValue: _ctx.dateValue[1],
12916
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.dateValue[1] = $event),
12917
- style: { "width": "100px !important" },
12927
+ clearable: _ctx.clearable,
12928
+ "disabled-date": _ctx.disabledDate,
12929
+ onChange: _ctx.dateChange
12930
+ }, null, 8, ["modelValue", "style", "value-format", "type", "clearable", "disabled-date", "onChange"]),
12931
+ _hoisted_3$1,
12932
+ createVNode(_component_el_date_picker, {
12933
+ modelValue: _ctx.opts.endDate,
12934
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.opts.endDate = $event),
12935
+ style: normalizeStyle({
12936
+ width: `${_ctx.opts.dateType === "year" ? 100 : _ctx.opts.dateType === "month" ? 120 : _ctx.opts.dateType === "date" ? 140 : _ctx.opts.dateType === "datetime" ? 200 : 200}px !important`
12937
+ }),
12918
12938
  "value-format": _ctx.opts.valueFormat,
12919
12939
  type: _ctx.opts.dateType,
12920
12940
  placeholder: "请选择",
12921
12941
  editable: false,
12922
- clearable: false,
12923
- "disabled-date": _ctx.LJSfc.pickerOptions(),
12924
- onChange: _ctx.yearChange
12925
- }, null, 8, ["modelValue", "value-format", "type", "disabled-date", "onChange"])) : createCommentVNode("", true)
12942
+ clearable: _ctx.clearable,
12943
+ "disabled-date": _ctx.disabledDate,
12944
+ onChange: _ctx.dateChange
12945
+ }, null, 8, ["modelValue", "style", "value-format", "type", "clearable", "disabled-date", "onChange"])
12926
12946
  ])) : createCommentVNode("", true)
12927
12947
  ]),
12928
12948
  _: 1
@@ -12931,7 +12951,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
12931
12951
  _: 1
12932
12952
  }, 8, ["label"]);
12933
12953
  }
12934
- const DatetypeChooseDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-df1ad931"]]);
12954
+ const DatetypeChooseDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-e45b32bb"]]);
12935
12955
  const index = {
12936
12956
  name: "DatetypeChooseDateRange",
12937
12957
  props: {
@@ -12945,7 +12965,7 @@ const index = {
12945
12965
  // 默认类型,默认值:日。字典value
12946
12966
  formItemLabel: {
12947
12967
  type: String,
12948
- default: "日期区间"
12968
+ default: "日期"
12949
12969
  },
12950
12970
  // 清除按钮
12951
12971
  clearable: {
@@ -12960,8 +12980,6 @@ const index = {
12960
12980
  },
12961
12981
  data() {
12962
12982
  return {
12963
- LJSfc,
12964
- date_type: [],
12965
12983
  // 日期参数
12966
12984
  opts: {
12967
12985
  startDate: null,
@@ -13026,9 +13044,9 @@ const index = {
13026
13044
  }
13027
13045
  }
13028
13046
  };
13029
- const index_vue_vue_type_style_index_0_scoped_9216c7d9_lang = "";
13047
+ const index_vue_vue_type_style_index_0_scoped_bb586ec7_lang = "";
13030
13048
  const _sfc_main$2 = index;
13031
- const _withScopeId$1 = (n) => (pushScopeId("data-v-9216c7d9"), n = n(), popScopeId(), n);
13049
+ const _withScopeId$1 = (n) => (pushScopeId("data-v-bb586ec7"), n = n(), popScopeId(), n);
13032
13050
  const _hoisted_1$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "and" }, "~", -1));
13033
13051
  function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
13034
13052
  const _component_el_date_picker = resolveComponent("el-date-picker");
@@ -13071,7 +13089,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
13071
13089
  _: 1
13072
13090
  }, 8, ["label"]);
13073
13091
  }
13074
- const DateRange = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-9216c7d9"]]);
13092
+ const DateRange = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-bb586ec7"]]);
13075
13093
  const index_vue_vue_type_style_index_0_scoped_f2de2f23_lang = "";
13076
13094
  const _sfc_main$1 = {
13077
13095
  name: "DictTag",