@vtx/modals2 6.0.0-beta.0 → 6.0.0-beta.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.
Files changed (143) hide show
  1. package/lib/_components/index.js +1 -0
  2. package/lib/_components/vm-appraisal-info/api.js +55 -0
  3. package/lib/_components/vm-appraisal-info/imgs/count.png +0 -0
  4. package/lib/_components/vm-appraisal-info/imgs/count_light.png +0 -0
  5. package/lib/_components/vm-appraisal-info/imgs/subtract.png +0 -0
  6. package/lib/_components/vm-appraisal-info/imgs/subtract_light.png +0 -0
  7. package/lib/_components/vm-appraisal-info/index.js +230 -0
  8. package/lib/_components/vm-appraisal-info/index.less +7 -0
  9. package/lib/_components/vm-calendar/index.js +3 -4
  10. package/lib/_components/vm-factor/index.js +2 -1
  11. package/lib/_components/vm-filter/index.js +8 -8
  12. package/lib/_components/vm-filter/style/index.less +7 -11
  13. package/lib/_components/vm-info-collection/index.js +3 -2
  14. package/lib/_components/vm-line-charts/index.js +4 -1
  15. package/lib/_components/vm-progress/index.js +2 -1
  16. package/lib/_components/vm-repair-maintain/index.js +34 -2
  17. package/lib/_components/vm-table/index.js +3 -3
  18. package/lib/_components/vm-tag/index.js +2 -1
  19. package/lib/_components/vm-title/index.js +2 -1
  20. package/lib/_components/vm-video/HistoryGrid.js +53 -3
  21. package/lib/_components/vm-video/RealtimeGrid.js +24 -3
  22. package/lib/_components/vm-video/index.js +99 -37
  23. package/lib/_components/vm-video/index.less +18 -14
  24. package/lib/_components/vm-wrapper/index.js +1 -1
  25. package/lib/_components/vm-wrapper/style/index.less +4 -2
  26. package/lib/_hooks/useGetChannels.js +20 -6
  27. package/lib/_service/index.js +7 -33
  28. package/lib/_util/http.js +32 -5
  29. package/lib/_util/index.js +6 -5
  30. package/lib/hooks/useTranslation.js +21 -23
  31. package/lib/locales/en.json +140 -1
  32. package/lib/locales/zh-CN.json +142 -3
  33. package/lib/vtx-base-modal/Tabs/index.js +2 -1
  34. package/lib/vtx-base-modal/index.js +2 -1
  35. package/lib/vtx-car-modal/api.js +415 -25
  36. package/lib/vtx-car-modal/components/Info/index.js +1 -1
  37. package/lib/vtx-car-modal/content/Common/EleUse/index.js +218 -0
  38. package/lib/vtx-car-modal/content/Common/EleUse/index.less +19 -0
  39. package/lib/vtx-car-modal/content/Common/OilUse/index.js +230 -0
  40. package/lib/vtx-car-modal/content/Common/OilUse/index.less +19 -0
  41. package/lib/vtx-car-modal/content/Common/OperationAnalysis/index.js +376 -0
  42. package/lib/vtx-car-modal/content/Common/OperationAnalysis/index.less +169 -0
  43. package/lib/vtx-car-modal/content/Common/WaterUse/index.js +201 -0
  44. package/lib/vtx-car-modal/content/Common/WaterUse/index.less +19 -0
  45. package/lib/vtx-car-modal/content/Common/index.js +9 -1
  46. package/lib/vtx-car-modal/content/Ljsy/WorkRecord/Detail.js +2 -1
  47. package/lib/vtx-car-modal/imgs/czb_bg.png +0 -0
  48. package/lib/vtx-car-modal/imgs/czb_bg_dark.png +0 -0
  49. package/lib/vtx-car-modal/imgs/factor/bglyh.png +0 -0
  50. package/lib/vtx-car-modal/imgs/factor/bglyh_dark.png +0 -0
  51. package/lib/vtx-car-modal/imgs/factor/cdcs.png +0 -0
  52. package/lib/vtx-car-modal/imgs/factor/cdcs_dark.png +0 -0
  53. package/lib/vtx-car-modal/imgs/factor/cdje.png +0 -0
  54. package/lib/vtx-car-modal/imgs/factor/cdje_dark.png +0 -0
  55. package/lib/vtx-car-modal/imgs/factor/cdpc.png +0 -0
  56. package/lib/vtx-car-modal/imgs/factor/cdpc_dark.png +0 -0
  57. package/lib/vtx-car-modal/imgs/factor/dccdje.png +0 -0
  58. package/lib/vtx-car-modal/imgs/factor/dccdje_dark.png +0 -0
  59. package/lib/vtx-car-modal/imgs/factor/jscs.png +0 -0
  60. package/lib/vtx-car-modal/imgs/factor/jscs_dark.png +0 -0
  61. package/lib/vtx-car-modal/imgs/factor/jsje.png +0 -0
  62. package/lib/vtx-car-modal/imgs/factor/jsje_dark.png +0 -0
  63. package/lib/vtx-car-modal/imgs/factor/jsl.png +0 -0
  64. package/lib/vtx-car-modal/imgs/factor/jsl_dark.png +0 -0
  65. package/lib/vtx-car-modal/imgs/factor/jspc.png +0 -0
  66. package/lib/vtx-car-modal/imgs/factor/jspc_dark.png +0 -0
  67. package/lib/vtx-car-modal/imgs/factor/jycs.png +0 -0
  68. package/lib/vtx-car-modal/imgs/factor/jycs_dark.png +0 -0
  69. package/lib/vtx-car-modal/imgs/factor/jyje.png +0 -0
  70. package/lib/vtx-car-modal/imgs/factor/jyje_dark.png +0 -0
  71. package/lib/vtx-car-modal/imgs/factor/jyl.png +0 -0
  72. package/lib/vtx-car-modal/imgs/factor/jyl_dark.png +0 -0
  73. package/lib/vtx-car-modal/imgs/factor/ljwbcs.png +0 -0
  74. package/lib/vtx-car-modal/imgs/factor/ljwbcs_dark.png +0 -0
  75. package/lib/vtx-car-modal/imgs/factor/njzfy.png +0 -0
  76. package/lib/vtx-car-modal/imgs/factor/njzfy_dark.png +0 -0
  77. package/lib/vtx-car-modal/imgs/factor/qzxze.png +0 -0
  78. package/lib/vtx-car-modal/imgs/factor/qzxze_dark.png +0 -0
  79. package/lib/vtx-car-modal/imgs/factor/sgcs.png +0 -0
  80. package/lib/vtx-car-modal/imgs/factor/sgcs_dark.png +0 -0
  81. package/lib/vtx-car-modal/imgs/factor/sgfy.png +0 -0
  82. package/lib/vtx-car-modal/imgs/factor/sgfy_dark.png +0 -0
  83. package/lib/vtx-car-modal/imgs/factor/syxze.png +0 -0
  84. package/lib/vtx-car-modal/imgs/factor/syxze_dark.png +0 -0
  85. package/lib/vtx-car-modal/imgs/factor/wbzfy.png +0 -0
  86. package/lib/vtx-car-modal/imgs/factor/wbzfy_dark.png +0 -0
  87. package/lib/vtx-car-modal/imgs/factor/wzcs.png +0 -0
  88. package/lib/vtx-car-modal/imgs/factor/wzcs_dark.png +0 -0
  89. package/lib/vtx-car-modal/imgs/factor/wzkf.png +0 -0
  90. package/lib/vtx-car-modal/imgs/factor/wzkf_dark.png +0 -0
  91. package/lib/vtx-car-modal/imgs/factor/wzkfee.png +0 -0
  92. package/lib/vtx-car-modal/imgs/factor/wzkfee_dark.png +0 -0
  93. package/lib/vtx-car-modal/imgs/factor/xslc.png +0 -0
  94. package/lib/vtx-car-modal/imgs/factor/xslc_dark.png +0 -0
  95. package/lib/vtx-car-modal/imgs/factor/ydcb.png +0 -0
  96. package/lib/vtx-car-modal/imgs/factor/ydcb_dark.png +0 -0
  97. package/lib/vtx-car-modal/imgs/factor/yhcb.png +0 -0
  98. package/lib/vtx-car-modal/imgs/factor/yhcb_dark.png +0 -0
  99. package/lib/vtx-car-modal/imgs/factor/yscb.png +0 -0
  100. package/lib/vtx-car-modal/imgs/factor/yscb_dark.png +0 -0
  101. package/lib/vtx-car-modal/imgs/zjl.png +0 -0
  102. package/lib/vtx-car-modal/imgs/zjl_dark.png +0 -0
  103. package/lib/vtx-car-modal/index.js +31 -9
  104. package/lib/vtx-cc-cp-modal/components/Calendar/index.js +3 -3
  105. package/lib/vtx-cp-modal/components/BaseInfo/CarWork.js +2 -5
  106. package/lib/vtx-cp-modal/components/BaseInfo/TodayWork.js +7 -1
  107. package/lib/vtx-cp-modal/components/ExeceptionInfo/AlarmRecord.js +8 -4
  108. package/lib/vtx-cp-modal/components/SyInfo/Ljcsl.js +2 -2
  109. package/lib/vtx-cp-modal/index.js +12 -12
  110. package/lib/vtx-default-modal/index.js +7 -6
  111. package/lib/vtx-df-modal/components/BaseInfo/Jczbqs.js +2 -2
  112. package/lib/vtx-df-modal/components/BaseInfoZdReborn/Jczbqs.js +2 -2
  113. package/lib/vtx-df-modal/components/WorkCondition/Table.js +2 -2
  114. package/lib/vtx-df-modal/index.js +7 -15
  115. package/lib/vtx-kh-modal/components/Record/index.js +1 -205
  116. package/lib/vtx-restaurant-modal/components/Calendar/index.js +3 -3
  117. package/lib/vtx-restaurant-modal/components/SignAndContract/ContactDetail.js +50 -33
  118. package/lib/vtx-restaurant-modal/components/SignAndContract/index.js +3 -3
  119. package/lib/vtx-road-modal/components/BaseInfo/Work.js +9 -1
  120. package/lib/vtx-road-modal/components/LaneBaseInfo/Work.js +8 -1
  121. package/lib/vtx-road-modal/index.js +6 -3
  122. package/lib/vtx-road-modal/utils/url.js +12 -0
  123. package/lib/vtx-shxq-modal/api.js +2 -2
  124. package/lib/vtx-shxq-modal/components/ThrowCalendar/List.js +2 -2
  125. package/lib/vtx-shxq-modal/index.js +21 -4
  126. package/lib/vtx-staff-modal/components/AlarmInfo/Charts.js +4 -1
  127. package/lib/vtx-tfd-modal/components/BaseInfo/Jczbqs.js +2 -2
  128. package/lib/vtx-wr-modal/index.js +28 -7
  129. package/lib/vtx-zf-modal/components/CkEditorCustom/view.js +4 -1
  130. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/editableDiv/FormView.js +5 -4
  131. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/editableDiv/index.js +10 -5
  132. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/input/FormView.js +7 -6
  133. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/input/date.js +10 -5
  134. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/input/index.js +10 -5
  135. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/radio/FormView.js +6 -5
  136. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/radio/checkbox.js +10 -5
  137. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/radio/index.js +10 -5
  138. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/sign/FormView.js +7 -6
  139. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/sign/index.js +12 -7
  140. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/textarea/FormView.js +6 -5
  141. package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/textarea/index.js +10 -5
  142. package/lib/vtx-zzz-modal/index.js +28 -22
  143. package/package.json +6 -6
@@ -1,15 +1,61 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
7
  import { HistoryPlayer } from '@vtx/player';
2
- import { forwardRef, useRef } from 'react';
8
+ import { forwardRef, useEffect, useRef, useState } from 'react';
3
9
  import VmEmpty from "../vm-empty";
4
10
  import "./index.less";
5
11
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
6
12
  var GridItem = /*#__PURE__*/forwardRef(function (props, ref) {
7
- var _channel$list;
8
13
  var channel = props.channel,
9
14
  onClose = props.onClose;
15
+ var _useState = useState(''),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ url = _useState2[0],
18
+ setUrl = _useState2[1];
19
+ var _useState3 = useState(''),
20
+ _useState4 = _slicedToArray(_useState3, 2),
21
+ startTime = _useState4[0],
22
+ setStartTime = _useState4[1];
23
+ var _useState5 = useState(''),
24
+ _useState6 = _slicedToArray(_useState5, 2),
25
+ endTime = _useState6[0],
26
+ setEndTime = _useState6[1];
10
27
  var name = "".concat(channel === null || channel === void 0 ? void 0 : channel.deviceName, "-").concat(channel === null || channel === void 0 ? void 0 : channel.channelName);
11
- var url = (channel === null || channel === void 0 ? void 0 : channel.totalTimeUrl) || (channel === null || channel === void 0 || (_channel$list = channel.list) === null || _channel$list === void 0 || (_channel$list = _channel$list[0]) === null || _channel$list === void 0 ? void 0 : _channel$list.playbackUrl);
12
28
  var gridItemRef = useRef(null);
29
+ useEffect(function () {
30
+ var _channel$list;
31
+ var src = (channel === null || channel === void 0 ? void 0 : channel.totalTimeUrl) || (channel === null || channel === void 0 || (_channel$list = channel.list) === null || _channel$list === void 0 || (_channel$list = _channel$list[0]) === null || _channel$list === void 0 ? void 0 : _channel$list.playbackUrl);
32
+ if (channel.enableAgent) {
33
+ if (src.indexOf('http') === -1) {
34
+ setUrl("".concat(window.location.origin).concat(src));
35
+ }
36
+ } else {
37
+ setUrl(src);
38
+ }
39
+ if (channel !== null && channel !== void 0 && channel.totalTimeUrl) {
40
+ setStartTime(props === null || props === void 0 ? void 0 : props.startTime);
41
+ setEndTime(props === null || props === void 0 ? void 0 : props.endTime);
42
+ } else {
43
+ var _channel$list2, _channel$list3;
44
+ setStartTime(channel === null || channel === void 0 || (_channel$list2 = channel.list) === null || _channel$list2 === void 0 || (_channel$list2 = _channel$list2[0]) === null || _channel$list2 === void 0 ? void 0 : _channel$list2.beginTime);
45
+ setEndTime(channel === null || channel === void 0 || (_channel$list3 = channel.list) === null || _channel$list3 === void 0 || (_channel$list3 = _channel$list3[0]) === null || _channel$list3 === void 0 ? void 0 : _channel$list3.endTime);
46
+ }
47
+ }, [channel.enableAgent, props.startTime, JSON.stringify(channel)]);
48
+ useEffect(function () {
49
+ var _channel$list4;
50
+ var src = (channel === null || channel === void 0 ? void 0 : channel.totalTimeUrl) || (channel === null || channel === void 0 || (_channel$list4 = channel.list) === null || _channel$list4 === void 0 || (_channel$list4 = _channel$list4[0]) === null || _channel$list4 === void 0 ? void 0 : _channel$list4.playbackUrl);
51
+ if (channel.enableAgent) {
52
+ if (src.indexOf('http') === -1) {
53
+ setUrl("".concat(window.location.origin).concat(src));
54
+ }
55
+ } else {
56
+ setUrl(src);
57
+ }
58
+ }, [JSON.stringify(channel)]);
13
59
  return /*#__PURE__*/_jsx("div", {
14
60
  className: "vm-video-content-container",
15
61
  ref: gridItemRef,
@@ -31,7 +77,11 @@ var GridItem = /*#__PURE__*/forwardRef(function (props, ref) {
31
77
  ref: ref,
32
78
  beenHasVideo: channel.beenHasVideo // 对讲
33
79
  ,
80
+ beenHasAudio: channel.beenHasAudio // 音频
81
+ ,
34
82
  url: url,
83
+ startTime: startTime,
84
+ endTime: endTime,
35
85
  type: channel === null || channel === void 0 ? void 0 : channel.player,
36
86
  deviceIp: channel.deviceIp,
37
87
  devicePort: channel.devicePort,
@@ -1,17 +1,36 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
7
  import { LivePlayer } from '@vtx/player';
2
- import { forwardRef, useRef } from 'react';
8
+ import { forwardRef, useEffect, useRef, useState } from 'react';
3
9
  import VmEmpty from "../vm-empty";
4
10
  import "./index.less";
5
11
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
6
12
  var GridItem = /*#__PURE__*/forwardRef(function (props, ref) {
7
13
  var channel = props.channel,
8
14
  onClose = props.onClose;
15
+ var _useState = useState(''),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ url = _useState2[0],
18
+ setUrl = _useState2[1];
9
19
  var name = "".concat(channel === null || channel === void 0 ? void 0 : channel.deviceName, "-").concat(channel === null || channel === void 0 ? void 0 : channel.channelName);
10
20
  var gridItemRef = useRef(null);
21
+ useEffect(function () {
22
+ if (channel.enableAgent) {
23
+ if ((channel === null || channel === void 0 ? void 0 : channel.url.indexOf('http')) === -1) {
24
+ setUrl("".concat(window.location.origin).concat(channel.url));
25
+ }
26
+ } else {
27
+ setUrl(channel.url);
28
+ }
29
+ }, [channel.enableAgent, channel === null || channel === void 0 ? void 0 : channel.url]);
11
30
  return /*#__PURE__*/_jsx("div", {
12
31
  className: "vm-video-content-container",
13
32
  ref: gridItemRef,
14
- children: channel !== null && channel !== void 0 && channel.url ? /*#__PURE__*/_jsxs(_Fragment, {
33
+ children: url ? /*#__PURE__*/_jsxs(_Fragment, {
15
34
  children: [/*#__PURE__*/_jsxs("div", {
16
35
  className: "vm-video-content-container-header",
17
36
  children: [/*#__PURE__*/_jsx("span", {
@@ -29,7 +48,9 @@ var GridItem = /*#__PURE__*/forwardRef(function (props, ref) {
29
48
  ref: ref,
30
49
  beenHasVideo: channel.beenHasVideo // 对讲
31
50
  ,
32
- url: channel.url,
51
+ beenHasAudio: channel.beenHasAudio // 音频
52
+ ,
53
+ url: url,
33
54
  type: channel === null || channel === void 0 ? void 0 : channel.player,
34
55
  deviceIp: channel.deviceIp,
35
56
  devicePort: channel.devicePort,
@@ -26,6 +26,29 @@ import "./index.less";
26
26
  import RealtimeGrid from "./RealtimeGrid";
27
27
  import { translateLocaleText } from "./../../hooks/useTranslation.js";
28
28
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
29
+ export var VIDEO_TAB_KEY = 'video';
30
+ export var getVideoTab = function getVideoTab() {
31
+ return {
32
+ key: VIDEO_TAB_KEY,
33
+ title: translateLocaleText("t('vtxdevicemodal.video')")
34
+ };
35
+ };
36
+ export var isVideoTab = function isVideoTab(tab) {
37
+ return (tab === null || tab === void 0 ? void 0 : tab.key) === VIDEO_TAB_KEY || "".concat((tab === null || tab === void 0 ? void 0 : tab.key) || '').endsWith('video');
38
+ };
39
+ export var insertVideoTab = function insertVideoTab() {
40
+ var tabs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
41
+ var channels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
42
+ if (!Array.isArray(tabs) || tabs.length === 0) {
43
+ return tabs;
44
+ }
45
+ if (!(channels !== null && channels !== void 0 && channels.length)) {
46
+ return tabs.filter(function (tab) {
47
+ return !isVideoTab(tab);
48
+ });
49
+ }
50
+ return tabs;
51
+ };
29
52
  var VmVideo = function VmVideo(_ref) {
30
53
  var _ref$channels = _ref.channels,
31
54
  channels = _ref$channels === void 0 ? [] : _ref$channels;
@@ -62,6 +85,8 @@ var VmVideo = function VmVideo(_ref) {
62
85
  endTime = state.endTime,
63
86
  history = state.history;
64
87
  useEffect(function () {
88
+ var s,
89
+ e = '';
65
90
  if (dateType === 'custom') {
66
91
  setState({
67
92
  datePickerDisabled: false
@@ -70,42 +95,47 @@ var VmVideo = function VmVideo(_ref) {
70
95
  setState({
71
96
  datePickerDisabled: true
72
97
  });
73
- if (dateType === 'dayBeforeYesterday') {
74
- setState({
75
- startTime: dayjs().subtract(2, 'day').format('YYYY-MM-DD 00:00:00'),
76
- endTime: dayjs().subtract(2, 'day').format('YYYY-MM-DD 23:59:59')
77
- });
78
- } else if (dateType === 'yesterday') {
79
- setState({
80
- startTime: dayjs().subtract(1, 'day').format('YYYY-MM-DD 00:00:00'),
81
- endTime: dayjs().subtract(1, 'day').format('YYYY-MM-DD 23:59:59')
82
- });
83
- } else if (dateType === 'today') {
84
- setState({
85
- startTime: dayjs().format('YYYY-MM-DD 00:00:00'),
86
- endTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
87
- });
88
- }
89
98
  }
99
+ if (dateType === 'dayBeforeYesterday') {
100
+ s = dayjs().subtract(2, 'day').format('YYYY-MM-DD 00:00:00');
101
+ e = dayjs().subtract(2, 'day').format('YYYY-MM-DD 23:59:59');
102
+ } else if (dateType === 'yesterday') {
103
+ s = dayjs().subtract(1, 'day').format('YYYY-MM-DD 00:00:00');
104
+ e = dayjs().subtract(1, 'day').format('YYYY-MM-DD 23:59:59');
105
+ } else {
106
+ s = dayjs().format('YYYY-MM-DD 00:00:00');
107
+ e = dayjs().format('YYYY-MM-DD HH:mm:ss');
108
+ }
109
+ setState({
110
+ startTime: s,
111
+ endTime: e
112
+ });
113
+ form.setFieldsValue({
114
+ beginTime: dayjs(s),
115
+ endTime: dayjs(e)
116
+ });
90
117
  }, [dateType]);
91
118
  useEffect(function () {
92
119
  if (channels !== null && channels !== void 0 && channels.length && tabKey === '1') {
93
- var _channels$filter;
94
- Promise.all(channels === null || channels === void 0 || (_channels$filter = channels.filter(function (ele, index) {
95
- return index < 4;
96
- })) === null || _channels$filter === void 0 ? void 0 : _channels$filter.map(function (ele) {
120
+ var defaultCheckedChannels = channels.map(function (channel, index) {
121
+ return _objectSpread(_objectSpread({}, channel), {}, {
122
+ checked: index < 4
123
+ });
124
+ });
125
+ Promise.all(channels.slice(0, 4).map(function (ele) {
97
126
  return getPreviewUrl({
98
127
  channelNum: ele.channelNum,
99
128
  deviceId: ele.videoDeviceId
100
129
  });
101
130
  })).then(function (res) {
102
- setCheckedChannels(res === null || res === void 0 ? void 0 : res.map(function (ele, index) {
103
- return _objectSpread(_objectSpread({}, ele === null || ele === void 0 ? void 0 : ele.data), {}, {
131
+ setCheckedChannels(defaultCheckedChannels.map(function (channel, index) {
132
+ var _res$index;
133
+ return _objectSpread(_objectSpread(_objectSpread({}, channel), index < 4 ? (_res$index = res[index]) === null || _res$index === void 0 ? void 0 : _res$index.data : {}), {}, {
104
134
  checked: index < 4
105
135
  });
106
136
  }));
107
137
  });
108
- } else {}
138
+ }
109
139
  if (tabKey === '2') {
110
140
  var _channels$;
111
141
  form.setFieldsValue({
@@ -158,13 +188,27 @@ var VmVideo = function VmVideo(_ref) {
158
188
  onChange: function onChange(e) {
159
189
  var list = cloneDeep(checkedChannels);
160
190
  if (e.target.checked) {
191
+ var selectedCount = list.filter(function (channel) {
192
+ return channel.checked;
193
+ }).length + 1;
194
+ if (selectedCount > 9) {
195
+ message.warning('同时播放通道不能超过9路');
196
+ return;
197
+ }
198
+ if (selectedCount > Number(mode)) {
199
+ setMode(selectedCount <= 4 ? '4' : '9');
200
+ }
161
201
  getPreviewUrl({
162
202
  channelNum: ele.channelNum,
163
- deviceId: ele.deviceId
203
+ deviceId: ele.videoDeviceId || ele.deviceId
164
204
  }).then(function (res) {
165
- list[index] = _objectSpread({
205
+ var _res$data, _res$data2;
206
+ var currentChannel = list[index];
207
+ list[index] = _objectSpread(_objectSpread(_objectSpread({}, currentChannel), res.data), {}, {
208
+ channelName: currentChannel.channelName || ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.channelName),
209
+ deviceName: currentChannel.deviceName || ((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.deviceName),
166
210
  checked: true
167
- }, res.data);
211
+ });
168
212
  setCheckedChannels(list);
169
213
  });
170
214
  } else {
@@ -200,8 +244,8 @@ var VmVideo = function VmVideo(_ref) {
200
244
  requiredMark: false,
201
245
  colon: true,
202
246
  initialValues: {
203
- beginTime: startTime ? dayjs(startTime) : dayjs().subtract(1, 'day').startOf('day'),
204
- endTime: endTime ? dayjs(endTime) : dayjs().subtract(1, 'day').endOf('day')
247
+ beginTime: startTime ? dayjs(startTime) : dayjs().startOf('day'),
248
+ endTime: endTime ? dayjs(endTime) : dayjs().endOf('day')
205
249
  },
206
250
  autoComplete: "off",
207
251
  children: [/*#__PURE__*/_jsx(Form.Item, {
@@ -353,15 +397,23 @@ var VmVideo = function VmVideo(_ref) {
353
397
  key: '9'
354
398
  }],
355
399
  onChange: function onChange(key) {
356
- setMode(key);
400
+ var selectedCount = checkedChannels.filter(function (channel) {
401
+ return channel.checked;
402
+ }).length;
403
+ setMode(selectedCount > Number(key) ? selectedCount <= 4 ? '4' : '9' : key);
357
404
  }
358
405
  }) : /*#__PURE__*/_jsx(_Fragment, {})
359
406
  }), /*#__PURE__*/_jsx("div", {
360
407
  className: "vm-video-content _".concat(mode),
361
- children: tabKey === '1' ? getGridItems(mode, checkedChannels === null || checkedChannels === void 0 ? void 0 : checkedChannels.filter(function (ele) {
362
- return ele.checked;
363
- }), setCheckedChannels) : /*#__PURE__*/_jsx(HistoryGrid, {
364
- channel: history
408
+ children: tabKey === '1' ? getGridItems(mode, checkedChannels, setCheckedChannels) : /*#__PURE__*/_jsx(HistoryGrid, {
409
+ channel: history,
410
+ startTime: startTime,
411
+ endTime: endTime,
412
+ onClose: function onClose() {
413
+ setState({
414
+ history: {}
415
+ });
416
+ }
365
417
  })
366
418
  })]
367
419
  })]
@@ -369,18 +421,28 @@ var VmVideo = function VmVideo(_ref) {
369
421
  };
370
422
  export default VmVideo;
371
423
  var getGridItems = function getGridItems(latestGrid, channels, setCheckedChannels) {
424
+ var selectedChannels = channels.filter(function (channel) {
425
+ return channel.checked;
426
+ });
372
427
  var items = [];
373
428
  var _loop = function _loop(i) {
374
429
  var element = /*#__PURE__*/_jsx(RealtimeGrid, {
375
- channel: channels[i] || {
430
+ channel: selectedChannels[i] || {
376
431
  channelNum: '',
377
432
  channelId: ''
378
433
  },
379
434
  onClose: function onClose() {
380
435
  var list = cloneDeep(channels);
381
- list[i].checked = false;
382
- list[i].url = '';
383
- list[i].player = '';
436
+ var channelIndex = list.findIndex(function (channel) {
437
+ var _selectedChannels$i;
438
+ return channel.channelNum === ((_selectedChannels$i = selectedChannels[i]) === null || _selectedChannels$i === void 0 ? void 0 : _selectedChannels$i.channelNum);
439
+ });
440
+ if (channelIndex === -1) {
441
+ return;
442
+ }
443
+ list[channelIndex].checked = false;
444
+ list[channelIndex].url = '';
445
+ list[channelIndex].player = '';
384
446
  setCheckedChannels(list);
385
447
  },
386
448
  scale: 1
@@ -59,13 +59,13 @@
59
59
  padding-top: 12px;
60
60
  overflow-y: auto;
61
61
 
62
- .channels--item {
63
- svg {
64
- transform: translateY(7px);
65
- margin-right: 2px;
66
- }
67
- .ant-checkbox {
68
- transform: translateY(-2px);
62
+ .channels--item {
63
+ svg {
64
+ display: block;
65
+ margin-right: 2px;
66
+ }
67
+ .ant-checkbox {
68
+ top: 0;
69
69
  }
70
70
  .ant-checkbox-checked .ant-checkbox-inner {
71
71
  background-color: var(--check-bg);
@@ -78,13 +78,17 @@
78
78
  width: 15px;
79
79
  height: 15px;
80
80
  }
81
- .ant-checkbox-wrapper {
82
- font-size: 15px;
83
- // color: var(--modal-title-color);
84
- }
85
- .ant-checkbox + span {
86
- padding: 0 4px;
87
- }
81
+ .ant-checkbox-wrapper {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ font-size: 15px;
85
+ // color: var(--modal-title-color);
86
+ }
87
+ .ant-checkbox + span {
88
+ display: inline-flex;
89
+ align-items: center;
90
+ padding: 0 4px;
91
+ }
88
92
  }
89
93
  }
90
94
  }
@@ -90,7 +90,7 @@ export default function VmWrapper(props) {
90
90
  changeList.push({
91
91
  key: 'chart',
92
92
  icon: ListIcon,
93
- name: '图表'
93
+ name: translateLocaleText("t('_components.chart')")
94
94
  });
95
95
  }
96
96
  if (showList) {
@@ -4,7 +4,7 @@
4
4
  --wborder-color: #f1f0f0;
5
5
  --wfilter-bg: #f5f5f5;
6
6
  --wtype-bg: #fff;
7
- --tab-active-color: #1677FF;
7
+ --tab-active-color: #1677ff;
8
8
 
9
9
  &.dark {
10
10
  --wbg-color: rgba(0, 155, 233, 10%);
@@ -12,7 +12,7 @@
12
12
  --wborder-color: #1064a7;
13
13
  --wfilter-bg: #0b588e;
14
14
  --wtype-bg: #0168b0;
15
- --tab-active-color: #009DFF;
15
+ --tab-active-color: #009dff;
16
16
  }
17
17
 
18
18
  &-tabs-wrap {
@@ -55,6 +55,8 @@
55
55
  &-head {
56
56
  padding: 11px 16px;
57
57
  border-bottom: 1px solid var(--wborder-color);
58
+ border-top-left-radius: 8px;
59
+ border-top-right-radius: 8px;
58
60
  }
59
61
 
60
62
  .extra {
@@ -1,13 +1,27 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
1
5
  import { useRequest } from 'ahooks';
2
6
  import http from "../_util/http";
3
7
  export default (function (billId, ready) {
4
- var _useRequest = useRequest(function () {
5
- return http.get("".concat(process.env.PREFIX || '', "/cloud/vis/base/np/videoDevice/loadVideoChannelByBillId.smvc"), {
6
- body: {
7
- billId: billId
8
+ var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9
+ var url;
10
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11
+ while (1) switch (_context.prev = _context.next) {
12
+ case 0:
13
+ url = "".concat(process.env.PREFIX || '', "/cloud/vis/base/np/videoDevice/loadVideoChannelByBillId.smvc");
14
+ return _context.abrupt("return", http.get(url, {
15
+ body: {
16
+ billId: billId
17
+ }
18
+ }));
19
+ case 2:
20
+ case "end":
21
+ return _context.stop();
8
22
  }
9
- });
10
- }, {
23
+ }, _callee);
24
+ })), {
11
25
  ready: ready,
12
26
  refreshDeps: [billId]
13
27
  }),
@@ -1,14 +1,7 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
1
  import { request } from '@vtx/utils';
8
2
  import { useRequest } from 'ahooks';
9
3
  var CommonService = {
10
4
  useBaseInfo: function useBaseInfo(id) {
11
- var _baseInfoRes$data, _baseInfoRes$data2, _tabConfig$data;
12
5
  var coordType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'wgs84';
13
6
  var _useRequest = useRequest(function () {
14
7
  return request.get('/cloud/jcss-reborn/facility/get', {
@@ -22,36 +15,17 @@ var CommonService = {
22
15
  }),
23
16
  baseInfoRes = _useRequest.data;
24
17
  var info = baseInfoRes === null || baseInfoRes === void 0 ? void 0 : baseInfoRes.data;
25
- var _useRequest2 = useRequest(function () {
26
- return request.get('/cloud/jcss-reborn/facility/type/config/getByCode', {
27
- data: {
28
- code: baseInfoRes.data.typeCode
29
- }
30
- });
31
- }, {
32
- ready: !!(baseInfoRes !== null && baseInfoRes !== void 0 && (_baseInfoRes$data = baseInfoRes.data) !== null && _baseInfoRes$data !== void 0 && _baseInfoRes$data.typeCode),
33
- refreshDeps: [baseInfoRes === null || baseInfoRes === void 0 || (_baseInfoRes$data2 = baseInfoRes.data) === null || _baseInfoRes$data2 === void 0 ? void 0 : _baseInfoRes$data2.typeCode]
34
- }),
35
- tabConfig = _useRequest2.data;
36
18
  var photos = info !== null && info !== void 0 && info.photoIds ? JSON.parse(info.photoIds) : info !== null && info !== void 0 && info.typePhotoIds ? JSON.parse(info.typePhotoIds) : [];
37
19
  return {
38
20
  photos: photos,
39
21
  code: info === null || info === void 0 ? void 0 : info.code,
40
- info: info,
41
- tabConfig: (tabConfig === null || tabConfig === void 0 || (_tabConfig$data = tabConfig.data) === null || _tabConfig$data === void 0 || (_tabConfig$data = _tabConfig$data.popupConfigJson) === null || _tabConfig$data === void 0 ? void 0 : _tabConfig$data.filter(function (ele) {
42
- return ele.display;
43
- }).map(function (ele) {
44
- return _objectSpread(_objectSpread({}, ele), {}, {
45
- key: ele.code,
46
- title: ele.name
47
- });
48
- })) || []
22
+ info: info
49
23
  };
50
24
  },
51
25
  //基础设施详情展示字段
52
26
  useGetFields: function useGetFields(code) {
53
27
  var _data$data$baseFields;
54
- var _useRequest3 = useRequest(function () {
28
+ var _useRequest2 = useRequest(function () {
55
29
  return request.get('/cloud/jcss-reborn/facility/type/view/detail', {
56
30
  data: {
57
31
  code: code
@@ -61,14 +35,14 @@ var CommonService = {
61
35
  refreshDeps: [code],
62
36
  ready: !!code
63
37
  }),
64
- data = _useRequest3.data;
38
+ data = _useRequest2.data;
65
39
  return data !== null && data !== void 0 && data.data ? ((_data$data$baseFields = data.data.baseFields) === null || _data$data$baseFields === void 0 ? void 0 : _data$data$baseFields.filter(function (ele) {
66
40
  return !['photoIds', 'geometryInfo', 'orderIndex', 'geoPointLocation', 'geoLineLocation', 'geoPolygonLocation'].includes(ele.key);
67
41
  }).concat(data.data.customFields)) || [] : [];
68
42
  },
69
43
  // 计量详情
70
44
  useLmDetail: function useLmDetail(id, hasConfig) {
71
- var _useRequest4 = useRequest(function () {
45
+ var _useRequest3 = useRequest(function () {
72
46
  return request.get('/cloud/zd/base/api/cp/commonFactory/getCommonFactoryById.smvc', {
73
47
  data: {
74
48
  factoryId: id
@@ -78,14 +52,14 @@ var CommonService = {
78
52
  refreshDeps: [id],
79
53
  ready: hasConfig
80
54
  }),
81
- res = _useRequest4.data;
55
+ res = _useRequest3.data;
82
56
  return {
83
57
  detail: (res === null || res === void 0 ? void 0 : res.data) || {}
84
58
  };
85
59
  },
86
60
  // 计量详情
87
61
  useLmDetailZdReborn: function useLmDetailZdReborn(id) {
88
- var _useRequest5 = useRequest(function () {
62
+ var _useRequest4 = useRequest(function () {
89
63
  return request.post('/cloud/zd-reborn/api/base/commonFactory/getCommonFactoryById?factoryId=' + id, {
90
64
  data: JSON.stringify({
91
65
  factoryId: id
@@ -94,7 +68,7 @@ var CommonService = {
94
68
  }, {
95
69
  refreshDeps: [id]
96
70
  }),
97
- res = _useRequest5.data;
71
+ res = _useRequest4.data;
98
72
  return {
99
73
  detail: (res === null || res === void 0 ? void 0 : res.data) || {}
100
74
  };
package/lib/_util/http.js CHANGED
@@ -15,6 +15,7 @@ import { message } from 'antd';
15
15
  import isObject from 'lodash/isObject';
16
16
  import pickBy from 'lodash/pickBy';
17
17
  import qs from 'qs';
18
+ import { translateLocaleText } from "../hooks/useTranslation.js";
18
19
  var SECOND = 30;
19
20
  var MILL_SECOND = 1000;
20
21
  var baseUrlPrefix = process.env.PREFIX ? "/".concat(process.env.PREFIX) : '';
@@ -77,6 +78,32 @@ var Http = /*#__PURE__*/function () {
77
78
  } : {})
78
79
  });
79
80
  }
81
+
82
+ /**
83
+ * 判断接口是否存在
84
+ * @param {*} url
85
+ */
86
+ }, {
87
+ key: "exists",
88
+ value: function exists(url) {
89
+ var _url = baseUrlPrefix + url;
90
+ var token = getVtxToken('token');
91
+ return axios.head(_url, {
92
+ validateStatus: function validateStatus() {
93
+ return true;
94
+ },
95
+ headers: {
96
+ Authorization: token ? "Bearer ".concat(token) : '',
97
+ tenantId: getVtxToken('tenantId'),
98
+ userId: getVtxToken('userId')
99
+ }
100
+ }).then(function (res) {
101
+ return res.status !== 404;
102
+ }).catch(function (error) {
103
+ var _error$response;
104
+ return (error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) !== 404;
105
+ });
106
+ }
80
107
  /**
81
108
  * get 请求
82
109
  * @param {*} url
@@ -233,7 +260,7 @@ var Http = /*#__PURE__*/function () {
233
260
  if (((_config = config) === null || _config === void 0 || (_config = _config.url) === null || _config === void 0 ? void 0 : _config.indexOf('zdjg/jg/data/getJgDataStatistics')) > -1 || ((_config2 = config) === null || _config2 === void 0 || (_config2 = _config2.url) === null || _config2 === void 0 ? void 0 : _config2.indexOf('/cloud/zd/base/api/cp/commonFactory')) > -1) {
234
261
  return;
235
262
  }
236
- message.error(data.msg || '请求信息错误');
263
+ message.error(data.msg || translateLocaleText("t('common.requestInfoError')"));
237
264
  return;
238
265
  }
239
266
  }
@@ -257,18 +284,18 @@ var Http = /*#__PURE__*/function () {
257
284
  var msg;
258
285
  switch (error.response.status) {
259
286
  case 404:
260
- msg = '接口请求不存在!错误码【404】。';
287
+ msg = translateLocaleText("t('common.apiRequestNotFound404')");
261
288
  break;
262
289
  case 500:
263
- msg = '服务端应用接口异常!错误码【500】。';
290
+ msg = translateLocaleText("t('common.serverApiException500')");
264
291
  break;
265
292
  default:
266
- msg = '请求错误,请检查或刷新重试!';
293
+ msg = translateLocaleText("t('common.requestErrorRetry')");
267
294
  break;
268
295
  }
269
296
  message.error(msg);
270
297
  } else {
271
- message.error('服务不可用');
298
+ message.error(translateLocaleText("t('common.serviceUnavailable')"));
272
299
  }
273
300
  }
274
301