@zgfe/business-lib 1.2.50-ht.1 → 1.2.50-ljy.0

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.
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare const WholeChart: React.FC<{
3
+ options?: any[];
4
+ onChange?: (value: any) => void;
5
+ }>;
6
+ export default WholeChart;
@@ -0,0 +1,45 @@
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { Checkbox } from 'antd';
8
+ import React, { useState, useEffect } from 'react';
9
+ var WholeChart = function WholeChart(props) {
10
+ var options = props.options,
11
+ onChange = props.onChange;
12
+ var _useState = useState([]),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ optionList = _useState2[0],
15
+ setPptionList = _useState2[1];
16
+ var _useState3 = useState([]),
17
+ _useState4 = _slicedToArray(_useState3, 2),
18
+ value = _useState4[0],
19
+ setValue = _useState4[1];
20
+ useEffect(function () {
21
+ if (options) {
22
+ setPptionList(options);
23
+ } else {
24
+ setPptionList([]);
25
+ }
26
+ }, [options]);
27
+ useEffect(function () {
28
+ var _value = [];
29
+ optionList.map(function (item) {
30
+ if (item.select) _value.push(item.value);
31
+ });
32
+ setValue(_value);
33
+ onChange && onChange(_value);
34
+ }, [optionList]);
35
+ var onOptionChange = function onOptionChange(option) {
36
+ setValue(option);
37
+ onChange && onChange(option);
38
+ };
39
+ return /*#__PURE__*/React.createElement(Checkbox.Group, {
40
+ options: optionList,
41
+ value: value,
42
+ onChange: onOptionChange
43
+ });
44
+ };
45
+ export default WholeChart;
@@ -24,8 +24,10 @@ import request from '../utils/ajax';
24
24
  import Apis from '../constants/apis';
25
25
  import BizGlobalDataContext from '../context';
26
26
  import _ from 'lodash';
27
+ import WholeChart from './components/wholeChart';
27
28
  export var classPrefix = 'biz-addtopanel';
28
29
  var BizAddToPanel = function BizAddToPanel(props) {
30
+ var _props$params2;
29
31
  var refForm = useRef();
30
32
  var _useState = useState(false),
31
33
  _useState2 = _slicedToArray(_useState, 2),
@@ -96,6 +98,9 @@ var BizAddToPanel = function BizAddToPanel(props) {
96
98
  data: searchParam,
97
99
  chosen_data: form.showList && form.showList === 'dynamic' ? [] : props.showList
98
100
  };
101
+ if (searchParam === null || searchParam === void 0 ? void 0 : searchParam.overall) {
102
+ resData.module = 'overall';
103
+ }
99
104
  var data = {},
100
105
  url = Apis.updatePanelTarget,
101
106
  msgType = '保存';
@@ -168,7 +173,34 @@ var BizAddToPanel = function BizAddToPanel(props) {
168
173
  setLoading(false);
169
174
  });
170
175
  }
171
- var showBox = function showBox(type) {
176
+ var showBox = function showBox(type, module) {
177
+ if (module && ['duration_avg', 'active', 'add', 'duration'].includes(module)) {
178
+ var _props$styleOptions, _props$styleOptions$f, _props$params;
179
+ var options = (_props$styleOptions = props.styleOptions) === null || _props$styleOptions === void 0 ? void 0 : (_props$styleOptions$f = _props$styleOptions.find(function (item) {
180
+ return RegExp(item.value, 'g').test(type);
181
+ })) === null || _props$styleOptions$f === void 0 ? void 0 : _props$styleOptions$f.optionList;
182
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
183
+ label: "\u9644\u52A0",
184
+ name: "extendTarget",
185
+ colon: false,
186
+ rules: [{
187
+ required: true,
188
+ message: '请选择显示'
189
+ }]
190
+ }, /*#__PURE__*/React.createElement(WholeChart, {
191
+ options: options
192
+ })), ((_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.dimension) && !RegExp('grid|map', 'g').test(type) && /*#__PURE__*/React.createElement(Form.Item, {
193
+ label: "\xA0\xA0\xA0\xA0\xA0\xA0",
194
+ name: "showList",
195
+ colon: false,
196
+ rules: [{
197
+ required: true,
198
+ message: '请选择显示'
199
+ }]
200
+ }, /*#__PURE__*/React.createElement(RadioGroup, {
201
+ options: props.showOptions
202
+ })));
203
+ }
172
204
  if (type && type.indexOf('number') !== -1) {
173
205
  return /*#__PURE__*/React.createElement(Form.Item, {
174
206
  label: "\u663E\u793A",
@@ -212,7 +244,10 @@ var BizAddToPanel = function BizAddToPanel(props) {
212
244
  }, /*#__PURE__*/React.createElement(Form, {
213
245
  ref: refForm,
214
246
  onFinish: onSubmit,
215
- initialValues: props.defaultValue,
247
+ initialValues: Object.assign(['duration_avg', 'active', 'add', 'duration'].includes((_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.module) ? {
248
+ showList: 'dynamic',
249
+ chartType: 'line'
250
+ } : {}, props.defaultValue),
216
251
  requiredMark: false
217
252
  }, /*#__PURE__*/React.createElement(Form.Item, {
218
253
  label: "\u770B\u677F",
@@ -280,9 +315,10 @@ var BizAddToPanel = function BizAddToPanel(props) {
280
315
  noStyle: true,
281
316
  shouldUpdate: true
282
317
  }, function (_ref) {
318
+ var _props$params3;
283
319
  var getFieldValue = _ref.getFieldValue;
284
320
  var type = getFieldValue('chartType');
285
- return showBox(type);
321
+ return showBox(type, (_props$params3 = props.params) === null || _props$params3 === void 0 ? void 0 : _props$params3.module);
286
322
  })));
287
323
  };
288
324
  BizAddToPanel.defaultProps = {
@@ -51,6 +51,7 @@ declare namespace AddToPanel {
51
51
  }
52
52
  export interface TabItem extends TabItemChild {
53
53
  children?: Array<TabItemChild>;
54
+ optionList?: any[];
54
55
  }
55
56
  export {};
56
57
  }
@@ -62,6 +62,9 @@ var BizAddToScene = function BizAddToScene(props) {
62
62
  },
63
63
  name: form.name
64
64
  };
65
+ if (params === null || params === void 0 ? void 0 : params.overall) {
66
+ data.json.module = 'overall';
67
+ }
65
68
  if (form.group.groupId === 0) {
66
69
  data.groupName = form.group.groupName;
67
70
  }
@@ -23,7 +23,7 @@ declare namespace AddToScene {
23
23
  groupId: number;
24
24
  groupName?: string;
25
25
  name: string;
26
- json: {};
26
+ json: {} | any;
27
27
  }
28
28
  }
29
29
  export default AddToScene;