@cloud-app-dev/vidc 1.0.6 → 1.0.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.
@@ -1,18 +1,16 @@
1
- .ant-layout.app-skeleton-lingmou-container {
2
- width: 100vw;
3
- height: 100vh;
4
- overflow: hidden;
1
+ .app-style-container {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
5
  }
6
- .ant-layout.app-skeleton-poga-container {
7
- width: 100vw;
8
- height: 100vh;
9
- overflow: hidden;
6
+ .app-style-container .app-inline-layout {
7
+ padding-left: 72px;
10
8
  }
11
- .ant-layout.app-skeleton-poga-container .app-skeleton-poga-content {
12
- flex: 1;
13
- }
14
- .ant-layout.app-skeleton-poga-container .app-skeleton-poga-header {
15
- height: 44px;
9
+ .app-style-container .app-layout-header {
10
+ min-height: var(--nav-height);
11
+ height: max-content;
16
12
  padding: 0;
17
- line-height: 44px;
13
+ line-height: var(--nav-height);
14
+ color: var(--app-header-color);
15
+ background-color: var(--app-header-bg);
18
16
  }
File without changes
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+
3
+ export interface InitialConfigProps {
4
+ children: (isUpdate: boolean) => React.ReactNode;
5
+ mode?: 'local' | 'server';
6
+ }
7
+
8
+ declare const InitialConfig: React.StatelessComponent<InitialConfig>;
9
+
10
+ export default InitialConfig;
@@ -0,0 +1,70 @@
1
+ import _Config from "@cloud-app-dev/basic-components/es/Config";
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ 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."); }
6
+
7
+ 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); }
8
+
9
+ 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; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ import React, { useState, useEffect } from 'react';
16
+ import { formatAppConfig, querySystemConfig, queryThemeConfig, queryMapConfig, queryMicroApplicationList, querySystemUpdate, queryLogoConfig } from './utils';
17
+ import "./index.css";
18
+
19
+ function InitialConfig(_ref) {
20
+ var children = _ref.children,
21
+ _ref$mode = _ref.mode,
22
+ mode = _ref$mode === void 0 ? 'server' : _ref$mode;
23
+
24
+ var _useState = useState({
25
+ isInit: false,
26
+ isUpdate: false
27
+ }),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ state = _useState2[0],
30
+ setState = _useState2[1];
31
+
32
+ useEffect(function () {
33
+ Promise.all([querySystemConfig(mode), queryMapConfig(mode), queryThemeConfig(mode), queryMicroApplicationList(mode), queryLogoConfig(), querySystemUpdate()]).then(function (res) {
34
+ var _res = _slicedToArray(res, 6),
35
+ BSConfig = _res[0],
36
+ LMapConfig = _res[1],
37
+ themeConfig = _res[2],
38
+ AppConfig = _res[3],
39
+ LogConfig = _res[4],
40
+ SystemConfig = _res[5];
41
+
42
+ _Config.registerBSConfig(BSConfig);
43
+
44
+ _Config.registerLMapConfig(LMapConfig);
45
+
46
+ _Config.registerAppConfig(formatAppConfig(AppConfig));
47
+
48
+ _Config.registerThemeConfig(themeConfig);
49
+
50
+ _Config.registerLogConfig(LogConfig);
51
+
52
+ setState(function () {
53
+ return {
54
+ isUpdate: SystemConfig.isUpdate,
55
+ isInit: true
56
+ };
57
+ });
58
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
59
+ }, []);
60
+ var isInit = state.isInit,
61
+ isUpdate = state.isUpdate;
62
+
63
+ if (!isInit) {
64
+ return null;
65
+ }
66
+
67
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children(isUpdate));
68
+ }
69
+
70
+ export default InitialConfig;
@@ -0,0 +1,185 @@
1
+ import _Service from "@cloud-app-dev/basic-components/es/Service";
2
+
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
+
5
+ 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); }); }; }
6
+
7
+ export function formatAppConfig(appConfig) {
8
+ var dataMap = {};
9
+ appConfig.forEach(function (item) {
10
+ var urls = item.url.split(',');
11
+ dataMap[item.alias] = {
12
+ id: item.id,
13
+ name: item.alias,
14
+ script: "".concat(urls[0], "?version=").concat(item.version),
15
+ style: "".concat(urls[1], "?version=").concat(item.version),
16
+ appTitle: item.name,
17
+ appType: item.type,
18
+ version: item.version,
19
+ status: item.status,
20
+ describe: item.describe,
21
+ tag: item.tag,
22
+ group: item.group
23
+ };
24
+ });
25
+ return dataMap;
26
+ }
27
+ export function querySystemConfig() {
28
+ return _querySystemConfig.apply(this, arguments);
29
+ }
30
+
31
+ function _querySystemConfig() {
32
+ _querySystemConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
33
+ return regeneratorRuntime.wrap(function _callee$(_context) {
34
+ while (1) {
35
+ switch (_context.prev = _context.next) {
36
+ case 0:
37
+ return _context.abrupt("return", _Service.$http({
38
+ url: "/micro-apps/micro-dep-librarys/config/systemConfig.json?".concat(Date.now()),
39
+ requestId: 'systemConfig'
40
+ }));
41
+
42
+ case 1:
43
+ case "end":
44
+ return _context.stop();
45
+ }
46
+ }
47
+ }, _callee);
48
+ }));
49
+ return _querySystemConfig.apply(this, arguments);
50
+ }
51
+
52
+ export function queryThemeConfig() {
53
+ return _queryThemeConfig.apply(this, arguments);
54
+ }
55
+
56
+ function _queryThemeConfig() {
57
+ _queryThemeConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
58
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
59
+ while (1) {
60
+ switch (_context2.prev = _context2.next) {
61
+ case 0:
62
+ return _context2.abrupt("return", _Service.$http({
63
+ url: "/micro-apps/micro-dep-librarys/config/themeConfig.json?".concat(Date.now()),
64
+ requestId: 'themeConfig'
65
+ }));
66
+
67
+ case 1:
68
+ case "end":
69
+ return _context2.stop();
70
+ }
71
+ }
72
+ }, _callee2);
73
+ }));
74
+ return _queryThemeConfig.apply(this, arguments);
75
+ }
76
+
77
+ export function queryMapConfig() {
78
+ return _queryMapConfig.apply(this, arguments);
79
+ }
80
+
81
+ function _queryMapConfig() {
82
+ _queryMapConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
83
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
84
+ while (1) {
85
+ switch (_context3.prev = _context3.next) {
86
+ case 0:
87
+ return _context3.abrupt("return", _Service.$http({
88
+ url: "/micro-apps/micro-dep-librarys/config/map.json?".concat(Date.now()),
89
+ requestId: 'mapConfig'
90
+ }));
91
+
92
+ case 1:
93
+ case "end":
94
+ return _context3.stop();
95
+ }
96
+ }
97
+ }, _callee3);
98
+ }));
99
+ return _queryMapConfig.apply(this, arguments);
100
+ }
101
+
102
+ export function queryMicroApplicationList() {
103
+ return _queryMicroApplicationList.apply(this, arguments);
104
+ }
105
+
106
+ function _queryMicroApplicationList() {
107
+ _queryMicroApplicationList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
108
+ var res;
109
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
110
+ while (1) {
111
+ switch (_context4.prev = _context4.next) {
112
+ case 0:
113
+ _context4.next = 2;
114
+ return _Service.$http({
115
+ url: "/api/micro/microApplication/v1/queryMicroApplicationList",
116
+ requestId: 'appConfig'
117
+ });
118
+
119
+ case 2:
120
+ res = _context4.sent;
121
+ return _context4.abrupt("return", res.data);
122
+
123
+ case 4:
124
+ case "end":
125
+ return _context4.stop();
126
+ }
127
+ }
128
+ }, _callee4);
129
+ }));
130
+ return _queryMicroApplicationList.apply(this, arguments);
131
+ }
132
+
133
+ export function queryLogoConfig() {
134
+ return _queryLogoConfig.apply(this, arguments);
135
+ }
136
+
137
+ function _queryLogoConfig() {
138
+ _queryLogoConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
139
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
140
+ while (1) {
141
+ switch (_context5.prev = _context5.next) {
142
+ case 0:
143
+ return _context5.abrupt("return", _Service.$http({
144
+ url: "/micro-apps/micro-dep-librarys/config/logConfig.json?".concat(Date.now()),
145
+ requestId: 'queryLogoConfig'
146
+ }).catch(function () {
147
+ return {};
148
+ }));
149
+
150
+ case 1:
151
+ case "end":
152
+ return _context5.stop();
153
+ }
154
+ }
155
+ }, _callee5);
156
+ }));
157
+ return _queryLogoConfig.apply(this, arguments);
158
+ }
159
+
160
+ export function querySystemUpdate() {
161
+ return _querySystemUpdate.apply(this, arguments);
162
+ }
163
+
164
+ function _querySystemUpdate() {
165
+ _querySystemUpdate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
166
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
167
+ while (1) {
168
+ switch (_context6.prev = _context6.next) {
169
+ case 0:
170
+ return _context6.abrupt("return", _Service.$http({
171
+ url: "/micro-apps/micro-dep-librarys/config/systemUpdate.json?".concat(Date.now()),
172
+ requestId: 'querySystemUpdate'
173
+ }).catch(function () {
174
+ return {};
175
+ }));
176
+
177
+ case 1:
178
+ case "end":
179
+ return _context6.stop();
180
+ }
181
+ }
182
+ }, _callee6);
183
+ }));
184
+ return _querySystemUpdate.apply(this, arguments);
185
+ }
File without changes
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+
3
+ export interface InitialRequestProps {
4
+ children: React.ReactNode;
5
+ Spin?: React.ReactNode;
6
+ }
7
+
8
+ declare const InitialRequest: React.StatelessComponent<InitialRequestProps>;
9
+
10
+ export default InitialRequest;
@@ -0,0 +1,77 @@
1
+ import _Store from "@cloud-app-dev/basic-components/es/Store";
2
+
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+
5
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+
13
+ 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."); }
14
+
15
+ 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); }
16
+
17
+ 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; }
18
+
19
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20
+
21
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
+
23
+ import React, { useState, useEffect } from 'react';
24
+ import { initialization, authFormat } from './utils';
25
+ import "./index.css";
26
+ var _BASE_DATA_INIT = false;
27
+
28
+ function InitialRequest(_ref) {
29
+ var children = _ref.children,
30
+ Spin = _ref.Spin;
31
+
32
+ var _useState = useState(false),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ isInit = _useState2[0],
35
+ setIsInit = _useState2[1];
36
+
37
+ useEffect(function () {
38
+ if (_BASE_DATA_INIT) {
39
+ setIsInit(true);
40
+ return;
41
+ }
42
+
43
+ initialization().then(function (res) {
44
+ var userPrivileges = res.userPrivileges,
45
+ allPrivileges = res.allPrivileges,
46
+ centerPrivileges = res.centerPrivileges,
47
+ centerInfo = res.centerInfo,
48
+ systemInfo = res.systemInfo,
49
+ userInfo = res.userInfo;
50
+ var userRoles = (userPrivileges.data || []).map(function (item) {
51
+ return item.functionCodes;
52
+ }).flat();
53
+
54
+ _Store.app.updateUserInfo(userInfo);
55
+
56
+ _Store.app.updateAppInfo(centerInfo.data);
57
+
58
+ _Store.app.updateSystemConfig(systemInfo.data);
59
+
60
+ var userAuth = [].concat(authFormat(userRoles, centerPrivileges.data, userInfo.userType));
61
+ var globalAuth = [].concat(authFormat([], allPrivileges.data, userInfo.userType));
62
+
63
+ _Store.auth.initAuthData([].concat(_toConsumableArray(userAuth), _toConsumableArray(globalAuth)));
64
+
65
+ _BASE_DATA_INIT = true;
66
+ }).then(function () {
67
+ return setIsInit(true);
68
+ }).catch(function (e) {
69
+ return console.error('接口初始化失败!', e);
70
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ }, []);
72
+ return isInit ? children : Spin ? /*#__PURE__*/React.createElement(Spin, {
73
+ spinning: true
74
+ }) : null;
75
+ }
76
+
77
+ export default InitialRequest;
@@ -0,0 +1,574 @@
1
+ import _Config from "@cloud-app-dev/basic-components/es/Config";
2
+ import _Service from "@cloud-app-dev/basic-components/es/Service";
3
+
4
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
+
6
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+
10
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
+
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+
14
+ 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."); }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
21
+
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
25
+
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
+
28
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
+
30
+ 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); } }
31
+
32
+ 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); }); }; }
33
+
34
+ import { cache } from '@cloud-app-dev/utils';
35
+
36
+ function catchPromise(fn) {
37
+ return new Promise(function (resolve) {
38
+ fn.then(function (res) {
39
+ return resolve(res);
40
+ }, function (err) {
41
+ console.error(err);
42
+ resolve();
43
+ });
44
+ });
45
+ }
46
+
47
+ var method = 'post';
48
+ export function initialization() {
49
+ return _initialization.apply(this, arguments);
50
+ }
51
+
52
+ function _initialization() {
53
+ _initialization = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
54
+ var headers, result, userInfo, userId, operationCenterId, data, data2, centerUrl, centerInfo, userPrivilegesUrl, centerPrivilegesUrl, allPrivilegesUrl, systemInfoUrl, _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, userPrivileges, _yield$Promise$all2$2, centerPrivileges, _yield$Promise$all2$3, allPrivileges, systemInfo;
55
+
56
+ return regeneratorRuntime.wrap(function _callee$(_context) {
57
+ while (1) {
58
+ switch (_context.prev = _context.next) {
59
+ case 0:
60
+ headers = {
61
+ Authorization: cache.getCache('token', 'session')
62
+ };
63
+ _context.next = 3;
64
+ return _Service.$http({
65
+ url: '/api/user/v1/getUserByToken',
66
+ method: method,
67
+ headers: headers,
68
+ requestId: 'getUserInfo'
69
+ });
70
+
71
+ case 3:
72
+ result = _context.sent;
73
+ userInfo = result.data;
74
+ userId = userInfo.id;
75
+ operationCenterId = userInfo.operationCenterId;
76
+ data = {
77
+ id: userId
78
+ };
79
+ data2 = {
80
+ id: operationCenterId
81
+ };
82
+ centerUrl = "/api/user/operationCenter/v1/operationCenters/".concat(operationCenterId);
83
+ _context.next = 12;
84
+ return _Service.$http({
85
+ data: data2,
86
+ method: method,
87
+ url: centerUrl,
88
+ headers: headers,
89
+ requestId: 'operationCenterInfo'
90
+ });
91
+
92
+ case 12:
93
+ centerInfo = _context.sent;
94
+ userPrivilegesUrl = "/api/user/role/v1/queryUserRoles/".concat(userId);
95
+ centerPrivilegesUrl = "/api/micro/applicationSystemScene/v1/queryAllFunctionByApplicationSystemId/".concat(operationCenterId);
96
+ allPrivilegesUrl = "/api/micro/function/v1/queryFunctionList";
97
+ systemInfoUrl = "/api/user/v1/systemInfo/".concat(userId);
98
+ _context.next = 19;
99
+ return Promise.all([catchPromise(_Service.$http({
100
+ data: data,
101
+ method: method,
102
+ url: userPrivilegesUrl,
103
+ headers: headers,
104
+ requestId: 'queryUserRoles'
105
+ })), catchPromise(_Service.$http({
106
+ data: data2,
107
+ method: 'get',
108
+ url: centerPrivilegesUrl,
109
+ headers: headers,
110
+ requestId: 'centerPrivilegesUrl'
111
+ })), catchPromise(_Service.$http({
112
+ method: 'get',
113
+ url: allPrivilegesUrl,
114
+ headers: headers,
115
+ requestId: 'allPrivilegesUrl'
116
+ })), catchPromise(_Service.$http({
117
+ data: data,
118
+ method: method,
119
+ url: systemInfoUrl,
120
+ headers: headers,
121
+ requestId: 'systemInfoUrl'
122
+ })) //获取用户系统信息
123
+ ]);
124
+
125
+ case 19:
126
+ _yield$Promise$all = _context.sent;
127
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 4);
128
+ _yield$Promise$all2$ = _yield$Promise$all2[0];
129
+ userPrivileges = _yield$Promise$all2$ === void 0 ? {
130
+ data: []
131
+ } : _yield$Promise$all2$;
132
+ _yield$Promise$all2$2 = _yield$Promise$all2[1];
133
+ centerPrivileges = _yield$Promise$all2$2 === void 0 ? {
134
+ data: []
135
+ } : _yield$Promise$all2$2;
136
+ _yield$Promise$all2$3 = _yield$Promise$all2[2];
137
+ allPrivileges = _yield$Promise$all2$3 === void 0 ? {
138
+ data: []
139
+ } : _yield$Promise$all2$3;
140
+ systemInfo = _yield$Promise$all2[3];
141
+ return _context.abrupt("return", {
142
+ userInfo: userInfo,
143
+ userPrivileges: userPrivileges,
144
+ centerPrivileges: centerPrivileges,
145
+ allPrivileges: allPrivileges,
146
+ centerInfo: centerInfo,
147
+ systemInfo: systemInfo
148
+ });
149
+
150
+ case 29:
151
+ case "end":
152
+ return _context.stop();
153
+ }
154
+ }
155
+ }, _callee);
156
+ }));
157
+ return _initialization.apply(this, arguments);
158
+ }
159
+
160
+ export function queryOrganizationsList(options) {
161
+ var headers = {
162
+ Authorization: cache.getCache('token', 'session')
163
+ };
164
+ var url = '/api/user/v1/organization/queryChildOrganizationsById';
165
+ return catchPromise(_Service.$http({
166
+ headers: headers,
167
+ url: url,
168
+ method: 'post',
169
+ requestId: 'queryOrganizationsList',
170
+ data: _objectSpread({
171
+ selectChildOrganization: true
172
+ }, options)
173
+ }));
174
+ }
175
+ export function queryPlacesList(_x) {
176
+ return _queryPlacesList.apply(this, arguments);
177
+ }
178
+
179
+ function _queryPlacesList() {
180
+ _queryPlacesList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(orgId) {
181
+ var headers, url, url2, data, res, _res, _res$, placeDeviceList, _res$2, placeAuthList;
182
+
183
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
184
+ while (1) {
185
+ switch (_context2.prev = _context2.next) {
186
+ case 0:
187
+ headers = {
188
+ Authorization: cache.getCache('token', 'session')
189
+ };
190
+ url = '/api/place/v1/getPlacesByHasDevice';
191
+ url2 = '/api/user/v1/organization/queryPlacesByOrganizationId';
192
+ data = {
193
+ organizationId: orgId,
194
+ includeSubOrgIds: true
195
+ };
196
+ _context2.next = 6;
197
+ return Promise.all([catchPromise(_Service.$http({
198
+ method: method,
199
+ url: url,
200
+ headers: headers,
201
+ data: {},
202
+ requestId: 'getPlacesByHasDevice'
203
+ })), catchPromise(_Service.$http({
204
+ method: method,
205
+ url: url2,
206
+ headers: headers,
207
+ data: data,
208
+ requestId: 'queryPlacesByOrganizationId'
209
+ })) //获取运营中心菜单
210
+ ]);
211
+
212
+ case 6:
213
+ res = _context2.sent;
214
+ _res = _slicedToArray(res, 2), _res$ = _res[0], placeDeviceList = _res$ === void 0 ? {
215
+ data: []
216
+ } : _res$, _res$2 = _res[1], placeAuthList = _res$2 === void 0 ? {
217
+ data: []
218
+ } : _res$2;
219
+ return _context2.abrupt("return", [placeDeviceList.data, placeAuthList.data]);
220
+
221
+ case 9:
222
+ case "end":
223
+ return _context2.stop();
224
+ }
225
+ }
226
+ }, _callee2);
227
+ }));
228
+ return _queryPlacesList.apply(this, arguments);
229
+ }
230
+
231
+ function queryUserDevicesNew(data) {
232
+ var headers = {
233
+ Authorization: cache.getCache('token', 'session')
234
+ };
235
+ var url = '/api/device/v1/queryDevices4User';
236
+ return _Service.$http({
237
+ url: url,
238
+ method: 'post',
239
+ data: data,
240
+ headers: headers,
241
+ requestId: 'queryDevices4User'
242
+ });
243
+ }
244
+
245
+ function queryUserDevicesStatusNew(data) {
246
+ var headers = {
247
+ Authorization: cache.getCache('token', 'session')
248
+ };
249
+ var url = '/api/device/v1/queryDeviceStatus4User';
250
+ return _Service.$http({
251
+ url: url,
252
+ method: 'post',
253
+ data: data,
254
+ headers: headers,
255
+ requestId: 'queryDeviceStatus4User'
256
+ });
257
+ }
258
+
259
+ function queryDeviceLocalRecordAbilityList(data) {
260
+ var headers = {
261
+ Authorization: cache.getCache('token', 'session')
262
+ };
263
+ var url = '/api/device/v1/queryDeviceLocalRecordAbilityList';
264
+ return _Service.$http({
265
+ url: url,
266
+ method: 'post',
267
+ data: data,
268
+ headers: headers,
269
+ requestId: 'queryDeviceLocalRecordAbilityList'
270
+ });
271
+ }
272
+
273
+ function emptyPromise() {
274
+ return new Promise(function (resolve) {
275
+ return resolve(false);
276
+ });
277
+ }
278
+
279
+ export function formatDeviceMap() {
280
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
281
+ var groupLibs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
282
+ var deviceState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
283
+ var deviceFrontEnd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
284
+ var deviceStorage = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
285
+ var deviceList = [];
286
+ data.forEach(function (item) {
287
+ var _item$split = item.split('|'),
288
+ _item$split2 = _slicedToArray(_item$split, 21),
289
+ cid = _item$split2[0],
290
+ deviceName = _item$split2[1],
291
+ deviceType = _item$split2[3],
292
+ id = _item$split2[4],
293
+ latitude = _item$split2[5],
294
+ longitude = _item$split2[6],
295
+ lygroupIndex = _item$split2[7],
296
+ manufacturerDeviceId = _item$split2[8],
297
+ manufacturerDeviceType = _item$split2[9],
298
+ organizationIds = _item$split2[10],
299
+ pathId = _item$split2[11],
300
+ placeId = _item$split2[12],
301
+ sn = _item$split2[13],
302
+ boxNum = _item$split2[14],
303
+ cameraType = _item$split2[15],
304
+ villageLocationType = _item$split2[16],
305
+ placeTags = _item$split2[17],
306
+ parentId = _item$split2[18],
307
+ accessType = _item$split2[19],
308
+ createTime = _item$split2[20];
309
+
310
+ try {
311
+ organizationIds = JSON.parse(organizationIds).map(function (v) {
312
+ return v.toString();
313
+ });
314
+ } catch (e) {
315
+ organizationIds = [];
316
+ }
317
+
318
+ try {
319
+ pathId = JSON.parse(pathId);
320
+ } catch (e) {
321
+ pathId = [];
322
+ }
323
+
324
+ try {
325
+ placeTags = JSON.parse(placeTags).map(function (v) {
326
+ return v.toString();
327
+ });
328
+ } catch (e) {
329
+ placeTags = [];
330
+ }
331
+
332
+ try {
333
+ cameraType = JSON.parse(cameraType);
334
+ } catch (e) {
335
+ cameraType = null;
336
+ }
337
+
338
+ deviceList.push({
339
+ cid: cid,
340
+ deviceName: deviceName,
341
+ deviceStatus: deviceState[id],
342
+ deviceType: deviceType,
343
+ id: id,
344
+ latitude: latitude,
345
+ longitude: longitude,
346
+ lygroupId: groupLibs[lygroupIndex],
347
+ manufacturerDeviceId: manufacturerDeviceId,
348
+ manufacturerDeviceType: manufacturerDeviceType,
349
+ organizationIds: organizationIds,
350
+ pathId: pathId,
351
+ placeId: placeId,
352
+ sn: sn,
353
+ boxNum: boxNum,
354
+ cameraType: cameraType,
355
+ hasFrontEnd: +deviceFrontEnd[id] !== 0,
356
+ hasStorage: +deviceStorage[id] !== 0,
357
+ parentId: parentId,
358
+ accessType: accessType,
359
+ villageLocationType: villageLocationType,
360
+ placeTags: placeTags,
361
+ createTime: createTime
362
+ });
363
+ });
364
+ return deviceList;
365
+ }
366
+ export function queryUserDevice(_x2) {
367
+ return _queryUserDevice.apply(this, arguments);
368
+ }
369
+
370
+ function _queryUserDevice() {
371
+ _queryUserDevice = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(options) {
372
+ var needDeviceLocalRecordAbility,
373
+ devices,
374
+ _devices,
375
+ listRes,
376
+ statusRes,
377
+ frontEndRes,
378
+ deviceState,
379
+ deviceFrontEnd,
380
+ deviceStorage,
381
+ _args3 = arguments;
382
+
383
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
384
+ while (1) {
385
+ switch (_context3.prev = _context3.next) {
386
+ case 0:
387
+ needDeviceLocalRecordAbility = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : true;
388
+ _context3.next = 3;
389
+ return Promise.all([queryUserDevicesNew(options ? options : {
390
+ offset: 0,
391
+ limit: 100000
392
+ }), queryUserDevicesStatusNew(options ? options : {
393
+ offset: 0,
394
+ limit: 100000
395
+ }), needDeviceLocalRecordAbility ? queryDeviceLocalRecordAbilityList(options ? options : {
396
+ queryType: 2
397
+ }) : emptyPromise()]);
398
+
399
+ case 3:
400
+ devices = _context3.sent;
401
+ _devices = _slicedToArray(devices, 3), listRes = _devices[0], statusRes = _devices[1], frontEndRes = _devices[2];
402
+ deviceState = {};
403
+ statusRes.data.split('|').forEach(function (res) {
404
+ var _res$split = res.split(','),
405
+ _res$split2 = _slicedToArray(_res$split, 2),
406
+ id = _res$split2[0],
407
+ state = _res$split2[1];
408
+
409
+ deviceState[id] = "".concat(state);
410
+ });
411
+ deviceFrontEnd = {};
412
+ deviceStorage = {};
413
+ frontEndRes && frontEndRes.data.split('|').forEach(function (res_1) {
414
+ var _res_1$split = res_1.split(','),
415
+ _res_1$split2 = _slicedToArray(_res_1$split, 3),
416
+ id_1 = _res_1$split2[0],
417
+ state_1 = _res_1$split2[1],
418
+ storage = _res_1$split2[2];
419
+
420
+ deviceFrontEnd[id_1] = state_1;
421
+ deviceStorage[id_1] = storage;
422
+ });
423
+ return _context3.abrupt("return", formatDeviceMap(listRes.data.list, listRes.data.other, deviceState, deviceFrontEnd, deviceStorage));
424
+
425
+ case 11:
426
+ case "end":
427
+ return _context3.stop();
428
+ }
429
+ }
430
+ }, _callee3);
431
+ }));
432
+ return _queryUserDevice.apply(this, arguments);
433
+ }
434
+
435
+ export function authFormat() {
436
+ var userRoles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
437
+ var systemFeatures = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
438
+ var userType = arguments.length > 2 ? arguments[2] : undefined;
439
+ var features = [];
440
+ /* prettier-ignore */
441
+
442
+ var appIds = Object.values(_Config.AppConfig).filter(function (v) {
443
+ return v.appType === 0;
444
+ }).map(function (v) {
445
+ return v.id;
446
+ });
447
+ userRoles = userRoles.map(function (v) {
448
+ return "".concat(v);
449
+ });
450
+ systemFeatures.forEach(function (item) {
451
+ var _item$extJson;
452
+
453
+ if (Array.isArray((_item$extJson = item.extJson) === null || _item$extJson === void 0 ? void 0 : _item$extJson.relations) && userRoles.includes("".concat(item.code))) {
454
+ var _userRoles;
455
+
456
+ /* prettier-ignore */
457
+ var relationCodes = item.extJson.relations.map(function (v) {
458
+ return systemFeatures.find(function (v2) {
459
+ return v2.alias === v;
460
+ });
461
+ }).filter(function (v) {
462
+ return !!v;
463
+ }).map(function (v) {
464
+ return "".concat(v.code);
465
+ });
466
+
467
+ (_userRoles = userRoles).push.apply(_userRoles, _toConsumableArray(relationCodes));
468
+ }
469
+
470
+ if (appIds.includes(item.microApplicationId)) {
471
+ userRoles.push("".concat(item.code));
472
+ }
473
+ });
474
+ systemFeatures.forEach(function (item) {
475
+ if (userRoles.includes("".concat(item.code)) || +userType === 100702 && userRoles.includes(item.parentCode)) {
476
+ if (item.groups && item.groups.group1) {
477
+ features.push({
478
+ id: item.groups.group1.key,
479
+ name: item.groups.group1.label,
480
+ code: item.groups.group1.key,
481
+ alias: item.groups.group1.key,
482
+ sort: item.groups.group1.sort || item.sort,
483
+ icon: item.groups.group1.icon,
484
+ isMenu: 1,
485
+ level: 1,
486
+ microApplicationId: item.microApplicationId
487
+ });
488
+
489
+ if (item.groups.group2) {
490
+ var _item$groups$group;
491
+
492
+ features.push({
493
+ id: item.groups.group2.key,
494
+ name: item.groups.group2.label,
495
+ code: item.groups.group2.key,
496
+ alias: item.groups.group2.key,
497
+ sort: item.groups.group2.sort || ((_item$groups$group = item.groups.group1) === null || _item$groups$group === void 0 ? void 0 : _item$groups$group.sort) || item.sort,
498
+ icon: item.groups.group2.icon,
499
+ isMenu: 1,
500
+ level: 2,
501
+ microApplicationId: item.microApplicationId,
502
+ parentCode: item.groups.group1.key
503
+ });
504
+ item.parentCode = item.groups.group2.key;
505
+ } else {
506
+ features.push({
507
+ id: item.groups.group1.key + 'lv2',
508
+ name: item.groups.group1.label,
509
+ code: item.groups.group1.key + 'lv2',
510
+ alias: item.groups.group1.key + 'lv2',
511
+ sort: item.groups.group1.sort || item.sort,
512
+ isMenu: 1,
513
+ level: 2,
514
+ microApplicationId: item.microApplicationId,
515
+ parentCode: item.groups.group1.key
516
+ });
517
+ item.parentCode = item.groups.group1.key + 'lv2';
518
+ }
519
+ }
520
+
521
+ item.level = item.isMenu === 1 ? 3 : 4;
522
+ features.push(item);
523
+ }
524
+ });
525
+ (window._HOT_FEATURES_ || []).forEach(function (item) {
526
+ if (item.groups && item.groups.group1) {
527
+ features.push({
528
+ id: item.groups.group1.key,
529
+ name: item.groups.group1.label,
530
+ code: item.groups.group1.key,
531
+ alias: item.groups.group1.key,
532
+ sort: item.groups.group1.sort || item.sort,
533
+ icon: item.groups.group1.icon,
534
+ isMenu: 1,
535
+ microApplicationId: item.microApplicationId
536
+ });
537
+
538
+ if (item.groups.group2) {
539
+ var _item$groups$group2;
540
+
541
+ features.push({
542
+ id: item.groups.group2.key,
543
+ name: item.groups.group2.label,
544
+ code: item.groups.group2.key,
545
+ sort: item.groups.group2.sort || ((_item$groups$group2 = item.groups.group1) === null || _item$groups$group2 === void 0 ? void 0 : _item$groups$group2.sort) || item.sort,
546
+ alias: item.groups.group2.key,
547
+ icon: item.groups.group2.icon,
548
+ isMenu: 1,
549
+ microApplicationId: item.microApplicationId,
550
+ parentCode: item.groups.group1.key
551
+ });
552
+ item.parentCode = item.groups.group2.key;
553
+ } else {
554
+ features.push({
555
+ id: item.groups.group1.key + 'lv2',
556
+ name: item.groups.group1.label,
557
+ code: item.groups.group1.key + 'lv2',
558
+ alias: item.groups.group1.key + 'lv2',
559
+ sort: item.groups.group1.sort || item.sort,
560
+ icon: item.groups.group1.icon,
561
+ isMenu: 1,
562
+ level: 2,
563
+ microApplicationId: item.microApplicationId,
564
+ parentCode: item.groups.group1.key
565
+ });
566
+ item.parentCode = item.groups.group1.key + 'lv2';
567
+ }
568
+ }
569
+
570
+ item.level = 3;
571
+ features.push(item);
572
+ });
573
+ return features;
574
+ }
@@ -79,8 +79,8 @@ function InitialRequest(_ref) {
79
79
  });
80
80
 
81
81
  _Store.app.updateThemeStyle({
82
- menuStyle: (_themeConfigInfo$styl = themeConfigInfo.style) === null || _themeConfigInfo$styl === void 0 ? void 0 : _themeConfigInfo$styl.menuStyle,
83
- tabType: !!((_themeConfigInfo$styl2 = themeConfigInfo.style) === null || _themeConfigInfo$styl2 === void 0 ? void 0 : _themeConfigInfo$styl2.tabStyle)
82
+ menuStyle: (themeConfigInfo === null || themeConfigInfo === void 0 ? void 0 : (_themeConfigInfo$styl = themeConfigInfo.style) === null || _themeConfigInfo$styl === void 0 ? void 0 : _themeConfigInfo$styl.menuStyle) || 'horizontal',
83
+ tabType: themeConfigInfo === null || themeConfigInfo === void 0 ? void 0 : (_themeConfigInfo$styl2 = themeConfigInfo.style) === null || _themeConfigInfo$styl2 === void 0 ? void 0 : _themeConfigInfo$styl2.tabStyle
84
84
  });
85
85
 
86
86
  _BASE_DATA_INIT = true;
@@ -52,7 +52,7 @@ export function initialization() {
52
52
 
53
53
  function _initialization() {
54
54
  _initialization = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
55
- var headers, result, userInfo, userId, operationCenterId, data, data2, centerUrl, centerInfo, themeInfo, themeConfig, themeStyle, themeId, themeConfigInfo, themeUrl, themeRes, _themeRes$data, _themeRes$data2, userPrivilegesUrl, centerPrivilegesUrl, allPrivilegesUrl, systemInfoUrl, _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, userPrivileges, _yield$Promise$all2$2, centerPrivileges, _yield$Promise$all2$3, allPrivileges, systemInfo;
55
+ var headers, result, userInfo, userId, operationCenterId, data, data2, centerUrl, centerInfo, themeInfo, themeConfig, themeStyle, themeId, themeConfigInfo, _themeRes$data, themeUrl, themeRes, _themeRes$data2, _themeRes$data3, userPrivilegesUrl, centerPrivilegesUrl, allPrivilegesUrl, systemInfoUrl, _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, userPrivileges, _yield$Promise$all2$2, centerPrivileges, _yield$Promise$all2$3, allPrivileges, systemInfo;
56
56
 
57
57
  return regeneratorRuntime.wrap(function _callee$(_context) {
58
58
  while (1) {
@@ -129,12 +129,10 @@ function _initialization() {
129
129
  case 25:
130
130
  themeRes = _context.sent;
131
131
 
132
- try {
133
- themeConfigInfo = (_themeRes$data = themeRes.data) === null || _themeRes$data === void 0 ? void 0 : _themeRes$data.info;
132
+ if ((_themeRes$data = themeRes.data) === null || _themeRes$data === void 0 ? void 0 : _themeRes$data.info) {
133
+ themeConfigInfo = (_themeRes$data2 = themeRes.data) === null || _themeRes$data2 === void 0 ? void 0 : _themeRes$data2.info;
134
134
 
135
- _Config.registerThemeConfig((_themeRes$data2 = themeRes.data) === null || _themeRes$data2 === void 0 ? void 0 : _themeRes$data2.info);
136
- } catch (e) {
137
- console.error(e);
135
+ _Config.registerThemeConfig((_themeRes$data3 = themeRes.data) === null || _themeRes$data3 === void 0 ? void 0 : _themeRes$data3.info);
138
136
  }
139
137
 
140
138
  case 27:
package/es/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { default as AppLayout } from './AppLayout';
2
+ export { default as DagInitialConfig } from './DagInitialConfig';
3
+ export { default as DagInitialRequest } from './DagInitialRequest';
2
4
  export { default as DeviceIcon } from './DeviceIcon';
3
5
  export { default as DeviceList } from './DeviceList';
4
6
  export { default as FormContent } from './FormContent';
package/es/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export { default as AppLayout } from './AppLayout';
2
+ export { default as DagInitialConfig } from './DagInitialConfig';
3
+ export { default as DagInitialRequest } from './DagInitialRequest';
2
4
  export { default as DeviceIcon } from './DeviceIcon';
3
5
  export { default as DeviceList } from './DeviceList';
4
6
  export { default as FormContent } from './FormContent';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "@cloud-app-dev/vidc",
4
4
  "description": "Video Image Data Componennts",
5
- "version": "1.0.6",
5
+ "version": "1.0.10",
6
6
  "scripts": {
7
7
  "start": "dumi dev",
8
8
  "docs:build": "dumi build",