@vtx/modals2 5.0.43 → 5.0.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.
@@ -12,43 +12,40 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { request } from '@vtx/utils';
14
14
  import { useRequest } from 'ahooks';
15
- import { useEffect, useState } from 'react';
15
+ import { useState } from 'react';
16
16
  export default (function (code, tabs) {
17
- var _data$data;
18
17
  var _useState = useState([]),
19
18
  _useState2 = _slicedToArray(_useState, 2),
20
19
  tabsData = _useState2[0],
21
20
  setTabsData = _useState2[1];
22
- var _useRequest = useRequest(function () {
23
- return request.get('/cloud/jcss-reborn/facility/type/config/getByCode', {
24
- data: {
25
- code: code
26
- }
27
- });
28
- }, {
29
- ready: !!code,
30
- refreshDeps: [code]
31
- }),
32
- data = _useRequest.data,
33
- loading = _useRequest.loading;
34
- var tabConfig = (data === null || data === void 0 || (_data$data = data.data) === null || _data$data === void 0 || (_data$data = _data$data.popupConfigJson) === null || _data$data === void 0 ? void 0 : _data$data.filter(function (ele) {
35
- return ele.display;
36
- }).map(function (ele) {
37
- return _objectSpread(_objectSpread({}, ele), {}, {
38
- key: ele.code,
39
- title: ele.name
21
+ useRequest(function () {
22
+ return request.get('/cloud/jcss-reborn/facility/type/config/getByCode', {
23
+ data: {
24
+ code: code
25
+ }
40
26
  });
41
- })) || [];
42
- var visited = !!data;
43
- useEffect(function () {
44
- var tabsC = tabs || [];
45
- if (visited) {
46
- tabsC = (tabConfig === null || tabConfig === void 0 ? void 0 : tabConfig.length) > 0 ? tabConfig : tabs;
27
+ }, {
28
+ ready: !!code,
29
+ refreshDeps: [code],
30
+ onSuccess: function onSuccess(data) {
31
+ var _data$data;
32
+ var tabConfig = (data === null || data === void 0 || (_data$data = data.data) === null || _data$data === void 0 || (_data$data = _data$data.popupConfigJson) === null || _data$data === void 0 ? void 0 : _data$data.filter(function (ele) {
33
+ return ele.display;
34
+ }).map(function (ele) {
35
+ return _objectSpread(_objectSpread({}, ele), {}, {
36
+ key: ele.code,
37
+ title: ele.name
38
+ });
39
+ })) || [];
40
+ var visited = !!data;
41
+ var tabsC = tabs || [];
42
+ if (visited) {
43
+ tabsC = (tabConfig === null || tabConfig === void 0 ? void 0 : tabConfig.length) > 0 ? tabConfig : tabs;
44
+ }
45
+ setTabsData(tabsC);
47
46
  }
48
- setTabsData(tabsC);
49
- }, [JSON.stringify(tabConfig), visited, JSON.stringify(tabs)]);
47
+ });
50
48
  return {
51
- tabsData: tabsData,
52
- loading: loading
49
+ tabsData: tabsData
53
50
  };
54
51
  });
@@ -245,8 +245,7 @@ var VtxCarModal = function VtxCarModal(props) {
245
245
  channels: channels
246
246
  })), TABS_OIL, /*#__PURE__*/_jsx(Common.OilConsumption, {})), TABS_WATER, /*#__PURE__*/_jsx(Common.WaterConsumption, {})), TABS_MAINTENANCE, /*#__PURE__*/_jsx(Common.Maintenance, {})), TABS_DETAIL, /*#__PURE__*/_jsx(Common.DetailInfo, {})), TABS_DEVICE, /*#__PURE__*/_jsx(Common.DeviceInfo, {})), TABS_JXH_BASE, /*#__PURE__*/_jsx(JXH.BaseInfo, {})), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_contents, TABS_JXH_STATIC, /*#__PURE__*/_jsx(JXH.StaticInfo, {})), TABS_JXH_WORK, /*#__PURE__*/_jsx(JXH.WorkRecord, {})), TABS_JXH_ALARM, /*#__PURE__*/_jsx(JXH.AlarmInfo, {})), TABS_LJSY_BASE, /*#__PURE__*/_jsx(Ljsy.BaseInfo, {})), TABS_LJSY_STATIC, /*#__PURE__*/_jsx(Ljsy.StaticInfo, {})), TABS_LJSY_WORK, /*#__PURE__*/_jsx(Ljsy.WorkRecord, {})), TABS_LJSY_ALARM, /*#__PURE__*/_jsx(Ljsy.AlarmInfo, {})), TABS_CC_BASE, /*#__PURE__*/_jsx(Cc.BaseInfo, {})), TABS_CC_ORDER, /*#__PURE__*/_jsx(Cc.OrderInfo, {})), TABS_CC_STATIC, /*#__PURE__*/_jsx(Cc.StaticInfo, {})), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_contents, TABS_CC_WORK, /*#__PURE__*/_jsx(Cc.WorkRecord, {})), TABS_CC_ALARM, /*#__PURE__*/_jsx(Cc.AlarmInfo, {})), TABS_LJZY_BASE, /*#__PURE__*/_jsx(Ljzy.BaseInfo, {})), TABS_LJZY_STATIC, /*#__PURE__*/_jsx(Ljzy.StaticInfo, {})), TABS_LJZY_WORK, /*#__PURE__*/_jsx(Ljzy.WorkRecord, {})), TABS_JZLJ_CAR_BASE, /*#__PURE__*/_jsx(Jzlj.BaseInfo, {})), TABS_JZLJ_CAR_DISPOSE, /*#__PURE__*/_jsx(Jzlj.Dispose, {})), TABS_JZLJ_CAR_COLLECTION, /*#__PURE__*/_jsx(Jzlj.Collection, {})), TABS_JZLJ_CAR_ALARM, /*#__PURE__*/_jsx(Jzlj.Alarm, {})), TABS_JZLJ_CAR_RUNNING_CALENDAR, /*#__PURE__*/_jsx(Jzlj.RunCalendar, {})));
247
247
  var _useGetConfig = useGetConfig(code, tabs),
248
- tabsData = _useGetConfig.tabsData,
249
- loading = _useGetConfig.loading;
248
+ tabsData = _useGetConfig.tabsData;
250
249
  var tabsList = useMemo(function () {
251
250
  var tabsList = tabsData;
252
251
  if (tabsList.findIndex(function (ele) {
@@ -323,7 +322,7 @@ var VtxCarModal = function VtxCarModal(props) {
323
322
  color: info.carStatus === 'OFFLINE' ? 'red' : 'green',
324
323
  value: info.carStatusStr
325
324
  }],
326
- contents: loading ? {} : contents
325
+ contents: contents
327
326
  }), /*#__PURE__*/_jsx(VmIframeModal, _objectSpread(_objectSpread({}, iframeModalInfo), {}, {
328
327
  theme: theme,
329
328
  onCancel: function onCancel() {
@@ -10,7 +10,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { ChartIcon, ListIcon } from "../../../_util/iconSvgHtml";
12
12
  import { useSetState } from 'ahooks';
13
- import { Col, Row, Space, Spin } from 'antd';
13
+ import { Col, Row, Space, Spin, message } from 'antd';
14
14
  import classnames from 'classnames';
15
15
  import dayjs from 'dayjs';
16
16
  import * as echarts from 'echarts';
@@ -434,6 +434,13 @@ var MonitorAnalysis = function MonitorAnalysis(_ref) {
434
434
  },
435
435
  filterType: 'rangePicker',
436
436
  filterChange: function filterChange(date) {
437
+ if (!(date !== null && date !== void 0 && date[0]) || !(date !== null && date !== void 0 && date[1])) {
438
+ return;
439
+ }
440
+ if (date[1].diff(date[0], 'd') > 7) {
441
+ message.warning('时间跨度不能超过7天');
442
+ return;
443
+ }
437
444
  setState({
438
445
  startDate: date[0],
439
446
  endDate: date[1]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/modals2",
3
- "version": "5.0.43",
3
+ "version": "5.0.45",
4
4
  "description": "弹窗组件",
5
5
  "license": "MIT",
6
6
  "module": "lib/index.js",