@zgfe/business-lib 1.1.54 → 1.1.55-beta.1

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.
@@ -15,6 +15,10 @@ var chartTypes = [{
15
15
  label: '汇总图',
16
16
  value: 'bar',
17
17
  icon: 'huizongtu'
18
+ }, {
19
+ label: '占比图',
20
+ value: 'pie',
21
+ icon: 'huizongtu'
18
22
  }, {
19
23
  label: '地图',
20
24
  value: 'map',
@@ -32,6 +36,10 @@ var chartTypes = [{
32
36
  label: '汇总图',
33
37
  value: 'bar',
34
38
  icon: 'huizongtu'
39
+ }, {
40
+ label: '占比图',
41
+ value: 'pie',
42
+ icon: 'huizongtu'
35
43
  }]
36
44
  }, {
37
45
  label: '分数',
@@ -43,6 +43,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
43
43
  router = _useContext.router,
44
44
  routes = _useContext.routes,
45
45
  isDemo = _useContext.isDemo;
46
+ var showTypes = ['line', 'bar', 'pie'];
46
47
  useEffect(function () {
47
48
  queryGroups();
48
49
  }, []);
@@ -166,8 +167,8 @@ var BizAddToPanel = function BizAddToPanel(props) {
166
167
  }
167
168
  return /*#__PURE__*/React.createElement(BizDialog, {
168
169
  open: true,
170
+ width: "auto",
169
171
  title: props.type === 'edit' ? '修改当前看板指标' : '向看板添加指标',
170
- width: 503,
171
172
  maskClosable: false,
172
173
  onCancel: props.onCancel,
173
174
  onOk: onAdd,
@@ -249,7 +250,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
249
250
  }, function (_ref) {
250
251
  var getFieldValue = _ref.getFieldValue;
251
252
  var type = getFieldValue('chartType');
252
- return type === 'line' || type === 'bar' ? /*#__PURE__*/React.createElement(Form.Item, {
253
+ return showTypes.indexOf(type) > -1 ? /*#__PURE__*/React.createElement(Form.Item, {
253
254
  label: "\u663E\u793A",
254
255
  name: "showList",
255
256
  colon: false,
@@ -4,5 +4,6 @@ declare const DemoHeader: React.FC<{
4
4
  defaultApp?: number;
5
5
  onChangeApp?: (app: AppInfoProps) => void;
6
6
  onLoading?: (loading: boolean) => void;
7
+ onLogin?: () => void;
7
8
  }>;
8
9
  export default DemoHeader;
@@ -4,13 +4,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
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
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
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { Select, Skeleton } from 'antd';
7
+ import { Select, Skeleton, message } from 'antd';
8
8
  import React, { useEffect, useState } from 'react';
9
9
  import request from '../utils/ajax';
10
10
  var DemoHeader = function DemoHeader(_ref) {
11
11
  var defaultApp = _ref.defaultApp,
12
12
  onChangeApp = _ref.onChangeApp,
13
- onLoading = _ref.onLoading;
13
+ onLoading = _ref.onLoading,
14
+ onLogin = _ref.onLogin;
14
15
  var _useState = useState([]),
15
16
  _useState2 = _slicedToArray(_useState, 2),
16
17
  appList = _useState2[0],
@@ -28,6 +29,11 @@ var DemoHeader = function DemoHeader(_ref) {
28
29
  function queryAppList() {
29
30
  setLoading(true);
30
31
  request('/zg/web/v2/data/v2ajaxGetDataByApp').then(function (res) {
32
+ if (!res.data) {
33
+ message.error('获取应用列表失败,请重新登录');
34
+ onLogin && onLogin();
35
+ return;
36
+ }
31
37
  setAppList(res.data.appList);
32
38
  if (defaultApp) {
33
39
  _onChange(res.data.appList.find(function (item) {
@@ -60,7 +60,10 @@ var DemoWrapper = function DemoWrapper(_ref) {
60
60
  title: /*#__PURE__*/React.createElement(DemoHeader, {
61
61
  defaultApp: defaultApp,
62
62
  onChangeApp: setApp,
63
- onLoading: setAppListLoading
63
+ onLoading: setAppListLoading,
64
+ onLogin: function onLogin() {
65
+ return setNotLogin(true);
66
+ }
64
67
  }),
65
68
  className: className,
66
69
  bodyStyle: {
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import BizTargetFromPanel from '..';
3
+ export default (function () {
4
+ return /*#__PURE__*/React.createElement(BizTargetFromPanel, null, /*#__PURE__*/React.createElement("div", null, "\u65E0\u64CD\u4F5C\u680F\u5C55\u793A"));
5
+ });
@@ -19,12 +19,12 @@ import Apis from '../../constants/apis';
19
19
  import { Spin, message } from 'antd';
20
20
  export var classPrefix = 'biz-layout-panel';
21
21
  var BizTargetFromPanel = function BizTargetFromPanel(props) {
22
- var _props$value$target$p;
22
+ var _props$value, _props$value10, _props$value$target$p;
23
23
  var _useState = useState([]),
24
24
  _useState2 = _slicedToArray(_useState, 2),
25
25
  options = _useState2[0],
26
26
  setOptions = _useState2[1];
27
- var _useState3 = useState(props.value.target.name || '洞察'),
27
+ var _useState3 = useState(((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.target.name) || '洞察'),
28
28
  _useState4 = _slicedToArray(_useState3, 2),
29
29
  title = _useState4[0],
30
30
  setTitle = _useState4[1];
@@ -42,11 +42,14 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
42
42
  setLoading = _useState10[1];
43
43
  var titleRef = useRef(null);
44
44
  useEffect(function () {
45
- setOptions(props.value.target.id ? panelBtn(onClick) : panelCreateBtn(onClick));
45
+ var _props$value2, _props$value3;
46
+ if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.panelId)) return;
47
+ setOptions(((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.target.id) ? panelBtn(onClick) : panelCreateBtn(onClick));
46
48
  }, []);
47
49
  var onClick = function onClick(type) {
48
50
  if (type === BizOptionTitleProps.OptionTypes.CANCEL) {
49
- var param = props.value.target.id ? {
51
+ var _props$value4;
52
+ var param = ((_props$value4 = props.value) === null || _props$value4 === void 0 ? void 0 : _props$value4.target.id) ? {
50
53
  panelId: props.value.panelId,
51
54
  elementId: props.value.target.id,
52
55
  name: title
@@ -62,12 +65,13 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
62
65
  }
63
66
  };
64
67
  var onDelete = function onDelete() {
68
+ var _props$value5, _props$value6;
65
69
  setLoading(true);
66
70
  ajax(Apis.delPanelElement, {
67
71
  method: 'post',
68
72
  data: {
69
- panelId: props.value.panelId,
70
- elementId: props.value.target.id
73
+ panelId: (_props$value5 = props.value) === null || _props$value5 === void 0 ? void 0 : _props$value5.panelId,
74
+ elementId: (_props$value6 = props.value) === null || _props$value6 === void 0 ? void 0 : _props$value6.target.id
71
75
  }
72
76
  }).then(function (res) {
73
77
  if (!res) return;
@@ -80,6 +84,7 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
80
84
  });
81
85
  };
82
86
  var onService = function onService(value, callback) {
87
+ var _props$value7, _props$value8;
83
88
  setTitle(value);
84
89
  setBtnOptions(!value);
85
90
  if (!value) return;
@@ -87,8 +92,8 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
87
92
  ajax(Apis.updateElementName, {
88
93
  method: 'post',
89
94
  data: {
90
- panelId: props.value.panelId,
91
- elementId: props.value.target.id,
95
+ panelId: (_props$value7 = props.value) === null || _props$value7 === void 0 ? void 0 : _props$value7.panelId,
96
+ elementId: (_props$value8 = props.value) === null || _props$value8 === void 0 ? void 0 : _props$value8.target.id,
92
97
  name: value
93
98
  }
94
99
  }).then(function (res) {
@@ -112,20 +117,27 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
112
117
  };
113
118
  var setBtnOptions = function setBtnOptions(disabled) {
114
119
  setOptions(function (option) {
120
+ var _props$value9;
115
121
  if (!option.length) return [];
116
122
  option[option.length - 1].disabled = disabled;
117
- if (props.value.target.id) {
123
+ if ((_props$value9 = props.value) === null || _props$value9 === void 0 ? void 0 : _props$value9.target.id) {
118
124
  option[option.length - 2].disabled = disabled;
119
125
  }
120
126
  return _toConsumableArray(option);
121
127
  });
122
128
  };
129
+ if (!((_props$value10 = props.value) === null || _props$value10 === void 0 ? void 0 : _props$value10.panelId)) {
130
+ return /*#__PURE__*/React.createElement("div", {
131
+ className: "".concat(classPrefix, "-content")
132
+ }, props.children);
133
+ }
123
134
  return /*#__PURE__*/React.createElement(BizTargetFromPanelContext.Provider, {
124
135
  value: {
125
136
  handleSearch: setBtnOptions
126
137
  }
127
138
  }, /*#__PURE__*/React.createElement(Spin, {
128
- spinning: loading
139
+ spinning: loading,
140
+ wrapperClassName: classPrefix
129
141
  }, /*#__PURE__*/React.createElement(BizOptionLayout, {
130
142
  ref: titleRef,
131
143
  value: title,
@@ -136,7 +148,9 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
136
148
  onBack: function onBack() {
137
149
  return onClick(BizOptionTitleProps.OptionTypes.CANCEL);
138
150
  }
139
- }, props.children, showDialog && /*#__PURE__*/React.createElement(BizAddToPanel, {
151
+ }, /*#__PURE__*/React.createElement("div", {
152
+ className: "".concat(classPrefix, "-content ").concat(classPrefix, "-content2")
153
+ }, props.children), showDialog && /*#__PURE__*/React.createElement(BizAddToPanel, {
140
154
  defaultValue: {
141
155
  panel: {
142
156
  id: props.value.panelId
@@ -7,7 +7,7 @@ var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
7
7
  var className = props.className;
8
8
  var classPrefix = 'biz-option-layout';
9
9
  return /*#__PURE__*/React.createElement("div", {
10
- className: "".concat(classPrefix, " ").concat(className)
10
+ className: "".concat(classPrefix, " ").concat(className || '')
11
11
  }, /*#__PURE__*/React.createElement("div", {
12
12
  className: "".concat(classPrefix, "-header")
13
13
  }, /*#__PURE__*/React.createElement("div", {
@@ -1,6 +1,11 @@
1
1
  @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
2
 
3
3
  .biz-layout-panel {
4
+ width: 100%;
5
+ height: 100%;
6
+ & > .ant-spin-container {
7
+ height: 100%;
8
+ }
4
9
  /*更多按钮*/
5
10
  &-btn-more {
6
11
  width: @height-base;
@@ -16,4 +21,14 @@
16
21
  .__default-hover();
17
22
  }
18
23
  }
24
+
25
+ &-content {
26
+ width: 100%;
27
+ height: 100%;
28
+ overflow: auto;
29
+ }
30
+ &-content2 {
31
+ height: calc(100% - 64px);
32
+ border-bottom: 1px solid @border-color-base;
33
+ }
19
34
  }
@@ -11,7 +11,6 @@
11
11
  width: 100%;
12
12
  height: 64px;
13
13
  padding: 0 16px;
14
- border-bottom: 1px solid @border-color-base;
15
14
 
16
15
  &-title {
17
16
  display: flex;
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import AddToPanel from '../../addToPanel/types';
3
3
  export declare namespace BizOptionTitleProps {
4
4
  export interface Props {
5
- value: Value;
6
- styleOptions: AddToPanel.TabItem[];
5
+ value?: Value;
6
+ styleOptions?: AddToPanel.TabItem[];
7
7
  children: React.ReactNode;
8
8
  afterEditTarget?: (type: string, value?: any) => void;
9
9
  }
package/es/utils/ajax.js CHANGED
@@ -80,6 +80,7 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
80
80
  msg = '账户未登录或登录已失效';
81
81
  } else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
82
82
  msg = '账户没有权限';
83
+ throw new Error(apiResult.msg);
83
84
  }
84
85
  if (!flag) {
85
86
  msg = apiResult.msg || msg;
@@ -88,6 +89,7 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
88
89
  description: msg
89
90
  });
90
91
  message.error(msg);
92
+ throw new Error(msg);
91
93
  }
92
94
  return apiResult;
93
95
  }
@@ -1,7 +1,6 @@
1
1
  import { Button } from 'antd';
2
2
  import React from 'react';
3
- import { ajax } from '@zgfe/business-lib';
4
- import { DemoWrapper } from '@zgfe/business-lib';
3
+ import { ajax, DemoWrapper } from '@zgfe/business-lib';
5
4
  export default (function () {
6
5
  var onDownload = function onDownload() {
7
6
  ajax('/zg/web/v2/openapi/label/excel/export', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.54",
3
+ "version": "1.1.55-beta.1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.12.0 || ^17.0.0",
61
61
  "yorkie": "^2.0.0"
62
62
  },
63
- "gitHead": "e9ce0312ab0ccfee25abf8221aaccc95db814bab"
63
+ "gitHead": "0973fcf26dc2e3a4d0ddfa017f80348528cea00d"
64
64
  }