@zgfe/modules-dm 1.0.57-zhongyuan.44 → 1.0.57-zhongyuan.45

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.
@@ -41,12 +41,11 @@ var AddFormulate = function AddFormulate(_ref) {
41
41
  }, 300);
42
42
  };
43
43
  var onFinish = function onFinish(values) {
44
- console.log(values, 'values');
45
44
  var arr = dataSource.map(function (o) {
46
45
  return {
47
46
  ruleType: o.currentType,
48
- sourceValue: o.sourceValueId,
49
- targetValue: o.targetValueId
47
+ sourceValue: o.sourceValueId || o.sourceValue,
48
+ targetValue: o.targetValueId || o.sourceValue
50
49
  };
51
50
  });
52
51
  var api = detailData ? apis.clearRule.modifyRule : apis.clearRule.addRule;
@@ -434,19 +434,18 @@ var AddRule = function AddRule(_ref) {
434
434
  });
435
435
  }, []);
436
436
  // 数值类型禁用
437
- var _useState13 = useState(_toConsumableArray(shuzhiArr)),
438
- _useState14 = _slicedToArray(_useState13, 2),
439
- shuzhiArr1 = _useState14[0],
440
- setShuzhiArr1 = _useState14[1];
441
- var shuzhisourceValueId = Form.useWatch('sourceValueId', shuzhiForm);
442
- useEffect(function () {
443
- if (!shuzhisourceValueId) return;
444
- var arr = shuzhiArr1.map(function (o) {
445
- o.disabled = shuzhisourceValueId == o.value ? true : false;
446
- return _objectSpread({}, o);
447
- });
448
- setShuzhiArr1(arr);
449
- }, [shuzhisourceValueId]);
437
+ // const [shuzhiArr1, setShuzhiArr1] = useState<
438
+ // { value: number; label: string; disabled?: boolean }[]
439
+ // >([...shuzhiArr]);
440
+ // const shuzhisourceValueId = Form.useWatch('sourceValueId', shuzhiForm);
441
+ // useEffect(() => {
442
+ // if (!shuzhisourceValueId) return;
443
+ // const arr = shuzhiArr1.map((o) => {
444
+ // o.disabled = shuzhisourceValueId == o.value ? true : false;
445
+ // return { ...o };
446
+ // });
447
+ // setShuzhiArr1(arr);
448
+ // }, [shuzhisourceValueId]);
450
449
  var component = null;
451
450
  switch (currentType) {
452
451
  case 1:
@@ -568,7 +567,7 @@ var AddRule = function AddRule(_ref) {
568
567
  message: '请选择属性原类型'
569
568
  }]
570
569
  }, /*#__PURE__*/React.createElement(Select, {
571
- options: shuzhiArr1,
570
+ options: shuzhiArr,
572
571
  disabled: true
573
572
  })), /*#__PURE__*/React.createElement(Form.Item, {
574
573
  label: "\u8F6C\u6362\u540E\u5C5E\u6027\u7C7B\u578B",
@@ -578,7 +577,7 @@ var AddRule = function AddRule(_ref) {
578
577
  message: '请选择转换后的属性类型'
579
578
  }]
580
579
  }, /*#__PURE__*/React.createElement(Select, {
581
- options: shuzhiArr1
580
+ options: shuzhiArr
582
581
  })));
583
582
  break;
584
583
  case 4:
@@ -1,9 +1,6 @@
1
1
  export var typeArr = [{
2
2
  value: 1,
3
3
  label: '值变换'
4
- }, {
5
- value: 2,
6
- label: '日期转换'
7
4
  }, {
8
5
  value: 3,
9
6
  label: '类型转换'
@@ -374,6 +374,17 @@ var FormulateRule = function FormulateRule() {
374
374
  setDownloadDate([]);
375
375
  setIsModalOpen(false);
376
376
  };
377
+ // 选择近两年数据
378
+ var disabledDate = function disabledDate(current) {
379
+ var isAfterToday = current && current > moment().endOf('day');
380
+ var twoYearsAgo = moment().subtract(2, 'year').startOf('day');
381
+ var isBeforeTwoYearsAgo = current && current < twoYearsAgo;
382
+ // 1. 计算上一年的年份(如当前是 2025,则上一年是 2024)
383
+ var lastYear = moment().year() - 1;
384
+ // 2. 上一年的时间边界:开始(1月1日 00:00:00)、结束(12月31日 23:59:59)
385
+ var lastYearStart = moment("".concat(lastYear, "-01-01")).startOf('day'); // 上一年1月1日 00:00
386
+ return isAfterToday || current < lastYearStart;
387
+ };
377
388
  return /*#__PURE__*/React.createElement("div", {
378
389
  className: "clearRule"
379
390
  }, /*#__PURE__*/React.createElement("div", {
@@ -449,6 +460,7 @@ var FormulateRule = function FormulateRule() {
449
460
  }, /*#__PURE__*/React.createElement("div", null, "\u9009\u62E9\u65F6\u95F4\u8303\u56F4\u751F\u6210\u62A5\u544A"), /*#__PURE__*/React.createElement(RangePicker, {
450
461
  open: true,
451
462
  placement: "topRight",
463
+ disabledDate: disabledDate,
452
464
  onChange: handleSelectDate,
453
465
  getPopupContainer: function getPopupContainer(trigger) {
454
466
  var parent = trigger.parentElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-dm",
3
- "version": "1.0.57-zhongyuan.44",
3
+ "version": "1.0.57-zhongyuan.45",
4
4
  "license": "ISC",
5
5
  "module": "es/index.js",
6
6
  "typings": "es/index.d.ts",
@@ -57,7 +57,7 @@
57
57
  "umi-request": "^1.4.0",
58
58
  "yorkie": "^2.0.0"
59
59
  },
60
- "gitHead": "fb39d85c35da015c61f70bc46eeae0bff02d0af8",
60
+ "gitHead": "db3d0cdbcb3ce312ab08166988f614460dfb8066",
61
61
  "gitHooks": {
62
62
  "pre-commit": "lint-staged"
63
63
  }