@zgfe/modules-dm 1.0.2-dm.27 → 1.0.2-dm.29

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.
@@ -11,7 +11,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import { IconFont } from '@zgfe/business-lib';
14
- import { Tabs } from 'antd';
14
+ import { Tabs, Popover } from 'antd';
15
15
  import React, { useState, useEffect } from 'react';
16
16
  import './styles/index.less';
17
17
  import { DmContext, upDatedDmFun } from '../../store';
@@ -20,9 +20,8 @@ import PlanList from '../dataPlan';
20
20
  import DataCollection from '../dataCollection';
21
21
 
22
22
  var DataManage = function DataManage(props) {
23
- console.log('DataManage-key', props);
24
23
  var classPrefix = 'data-manage';
25
- var updateEventMetas = props.updateEventMetas; // const { state, dispatch } = useContext(DmContext);
24
+ var updateEventMetas = props.updateEventMetas;
26
25
 
27
26
  var _upDatedDmFun = upDatedDmFun(),
28
27
  _upDatedDmFun2 = _slicedToArray(_upDatedDmFun, 2),
@@ -38,36 +37,18 @@ var DataManage = function DataManage(props) {
38
37
 
39
38
  var _useState = useState('0'),
40
39
  _useState2 = _slicedToArray(_useState, 2),
41
- menuTab = _useState2[0],
42
- setMenuTab = _useState2[1];
43
-
44
- var onSelect = function onSelect(e) {
45
- setMenuTab(e.key);
46
- };
47
-
48
- var items = [{
49
- label: '埋点管理',
50
- key: '0',
51
- icon: /*#__PURE__*/React.createElement(IconFont, {
52
- type: "maidianguanli"
53
- })
54
- }, {
55
- label: '埋点方案管理',
56
- key: '1',
57
- icon: /*#__PURE__*/React.createElement(IconFont, {
58
- type: "maidianfanganguanli"
59
- })
60
- }];
61
-
62
- var _useState3 = useState('0'),
63
- _useState4 = _slicedToArray(_useState3, 2),
64
- listTab = _useState4[0],
65
- setListTab = _useState4[1];
40
+ listTab = _useState2[0],
41
+ setListTab = _useState2[1];
66
42
 
67
43
  var tabsChange = function tabsChange(activeKey) {
68
44
  setListTab(activeKey);
69
45
  };
70
46
 
47
+ var _useState3 = useState(false),
48
+ _useState4 = _slicedToArray(_useState3, 2),
49
+ collapsed = _useState4[0],
50
+ setCollapsed = _useState4[1];
51
+
71
52
  return /*#__PURE__*/React.createElement(DmContext.Provider, {
72
53
  value: {
73
54
  state: state,
@@ -76,7 +57,7 @@ var DataManage = function DataManage(props) {
76
57
  }, /*#__PURE__*/React.createElement("div", {
77
58
  className: classPrefix
78
59
  }, /*#__PURE__*/React.createElement("div", {
79
- className: "tabs-box"
60
+ className: "tabs-box ".concat(collapsed && 'tabs-collapsed')
80
61
  }, /*#__PURE__*/React.createElement(Tabs, {
81
62
  className: "tabs",
82
63
  defaultActiveKey: "0",
@@ -85,18 +66,42 @@ var DataManage = function DataManage(props) {
85
66
  }, /*#__PURE__*/React.createElement(Tabs.TabPane, {
86
67
  tab: /*#__PURE__*/React.createElement("div", {
87
68
  className: "tab"
69
+ }, collapsed && /*#__PURE__*/React.createElement(Popover, {
70
+ content: "\u57CB\u70B9\u7BA1\u7406",
71
+ placement: "right"
88
72
  }, /*#__PURE__*/React.createElement(IconFont, {
89
73
  type: "maidianguanli"
90
- }), "\u57CB\u70B9\u7BA1\u7406"),
74
+ })), !collapsed && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconFont, {
75
+ type: "maidianguanli"
76
+ }), "\u57CB\u70B9\u7BA1\u7406")),
91
77
  key: "0"
92
78
  }), /*#__PURE__*/React.createElement(Tabs.TabPane, {
93
79
  tab: /*#__PURE__*/React.createElement("div", {
94
80
  className: "tab"
81
+ }, collapsed && /*#__PURE__*/React.createElement(Popover, {
82
+ content: "\u57CB\u70B9\u65B9\u6848\u7BA1\u7406",
83
+ placement: "right"
95
84
  }, /*#__PURE__*/React.createElement(IconFont, {
96
85
  type: "maidianfanganguanli"
97
- }), "\u57CB\u70B9\u65B9\u6848\u7BA1\u7406"),
86
+ })), !collapsed && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconFont, {
87
+ type: "maidianfanganguanli"
88
+ }), "\u57CB\u70B9\u65B9\u6848\u7BA1\u7406")),
98
89
  key: "1"
99
- }))), listTab == '0' && /*#__PURE__*/React.createElement(DataCollection, null), listTab == '1' && /*#__PURE__*/React.createElement(PlanList, null)));
90
+ })), /*#__PURE__*/React.createElement("div", {
91
+ className: "zhidie-botton"
92
+ }, !collapsed && /*#__PURE__*/React.createElement(IconFont, {
93
+ type: "zhedie",
94
+ onClick: function onClick() {
95
+ setCollapsed(!collapsed);
96
+ }
97
+ }), collapsed && /*#__PURE__*/React.createElement(IconFont, {
98
+ type: "zhankai",
99
+ onClick: function onClick() {
100
+ setCollapsed(!collapsed);
101
+ }
102
+ }))), /*#__PURE__*/React.createElement("div", {
103
+ className: "dmcontent ".concat(collapsed && 'dmcontent-collapsed')
104
+ }, listTab == '0' && /*#__PURE__*/React.createElement(DataCollection, null), listTab == '1' && /*#__PURE__*/React.createElement(PlanList, null))));
100
105
  };
101
106
 
102
107
  export default DataManage;
@@ -17,43 +17,75 @@
17
17
  .data-manage {
18
18
  position: relative;
19
19
  display: flex;
20
- height: 100%;
21
20
  background: #f5f5f5;
22
21
  .tabs-box {
23
22
  position: relative;
24
23
  min-width: 240px;
25
24
  margin-right: 24px;
26
25
  background: #fff;
27
- }
28
- .tabs {
29
- position: fixed;
30
- top: 48px;
31
- left: 0;
32
- min-width: 240px;
33
- margin-right: 24px;
34
- padding-top: 16px;
35
- background: #fff;
36
- .ant-tabs-nav {
37
- width: 100%;
38
- .ant-tabs-tab {
39
- padding-left: 0;
26
+ .tabs {
27
+ position: fixed;
28
+ top: 48px;
29
+ left: 0;
30
+ min-width: 240px;
31
+ margin-right: 24px;
32
+ padding-top: 16px;
33
+ background: #fff;
34
+ .ant-tabs-nav {
35
+ width: 100%;
36
+ .ant-tabs-tab {
37
+ padding: 7px 0;
38
+ }
39
+ .ant-tabs-tab + .ant-tabs-tab {
40
+ margin: 0;
41
+ }
42
+ .ant-tabs-tab-active {
43
+ background: #e8efff;
44
+ }
45
+ .ant-tabs-tab-btn {
46
+ width: 100%;
47
+ font-size: 16px;
48
+ text-align: left;
49
+ .bsicon {
50
+ margin-right: 12px;
51
+ margin-left: 19px;
52
+ font-size: 20px !important;
53
+ }
54
+ }
40
55
  }
41
- .ant-tabs-tab-active {
42
- background: #e8efff;
56
+ .ant-tabs-content-holder {
57
+ display: none;
43
58
  }
44
- .ant-tabs-tab-btn {
45
- width: 100%;
46
- font-size: 16px;
47
- text-align: left;
59
+ }
60
+ .zhidie-botton {
61
+ position: absolute;
62
+ bottom: 0;
63
+ left: 0;
64
+ width: 100%;
65
+ height: 40px;
66
+ font-size: 24px !important;
67
+ border-top: 1px solid #e8efff;
68
+ .bsicon {
69
+ margin-left: 19px;
70
+ }
71
+ }
72
+ }
73
+ .tabs-collapsed {
74
+ min-width: 80px;
75
+ .tabs {
76
+ min-width: 80px;
77
+ .tab {
78
+ text-align: center;
48
79
  .bsicon {
49
- margin-right: 15px;
50
- margin-left: 19px;
51
- font-size: 20px !important;
80
+ margin: 0 !important;
52
81
  }
53
82
  }
54
83
  }
55
- .ant-tabs-content-holder {
56
- display: none;
57
- }
84
+ }
85
+ .dmcontent {
86
+ width: calc(100% - 264px);
87
+ }
88
+ .dmcontent-collapsed {
89
+ width: calc(100% - 104px);
58
90
  }
59
91
  }
@@ -21,7 +21,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  import { IconFont } from '@zgfe/business-lib';
24
- import { Input, Button, Select, Table, Modal, Form, message } from 'antd';
24
+ import { Input, Button, Select, Table, Modal, Form, message, Popover } from 'antd';
25
25
  var Option = Select.Option;
26
26
  import React, { useEffect, useState } from 'react';
27
27
  import './styles/index.less';
@@ -152,14 +152,24 @@ var addEventOrUser = function addEventOrUser(props) {
152
152
 
153
153
  var tableColumnsPropsRender = function tableColumnsPropsRender(item) {
154
154
  var render = function render(text, record, index) {
155
- return /*#__PURE__*/React.createElement(React.Fragment, null, item.dataIndex == 'set' ? /*#__PURE__*/React.createElement(IconFont, {
156
- className: "set-del ".concat(tableRowData.length <= 1 ? 'set-del-err' : ''),
155
+ return /*#__PURE__*/React.createElement(React.Fragment, null, item.dataIndex == 'set' ? /*#__PURE__*/React.createElement(React.Fragment, null, tableRowData.length <= 1 ? /*#__PURE__*/React.createElement(IconFont, {
156
+ className: "set-del set-del-err",
157
157
  disabled: true,
158
158
  type: "shanchu1",
159
159
  onClick: function onClick() {
160
160
  handleRow('del', record);
161
161
  }
162
- }) : /*#__PURE__*/React.createElement(Form.Item, {
162
+ }) : /*#__PURE__*/React.createElement(Popover, {
163
+ content: "\u5220\u9664",
164
+ placement: "right"
165
+ }, /*#__PURE__*/React.createElement(IconFont, {
166
+ className: "set-del",
167
+ disabled: true,
168
+ type: "shanchu1",
169
+ onClick: function onClick() {
170
+ handleRow('del', record);
171
+ }
172
+ }))) : /*#__PURE__*/React.createElement(Form.Item, {
163
173
  name: "".concat(item.dataIndex, "-").concat(record.key),
164
174
  rules: rulesData(item)
165
175
  }, /*#__PURE__*/React.createElement(Input, null)));
@@ -162,8 +162,8 @@ var AddPlan = function AddPlan(props) {
162
162
  setSpinning(true);
163
163
  var fileType = file.name.split('.');
164
164
 
165
- if (fileType[fileType.length - 1] != 'xlsx' && fileType[fileType.length - 1] != 'xsl') {
166
- message.error('仅支持excel(xsl、xlsx)格式文件,请检查后重新上传');
165
+ if (fileType[fileType.length - 1] != 'xlsx' && fileType[fileType.length - 1] != 'xls') {
166
+ message.error('仅支持excel(xls、xlsx)格式文件,请检查后重新上传');
167
167
  setSpinning(false);
168
168
  return;
169
169
  }
@@ -17,6 +17,7 @@ import React, { useEffect, useState, useContext } from 'react';
17
17
  import './styles/index.less';
18
18
  import request from '../../utils/ajax';
19
19
  import apis from '../../constants/api';
20
+ import { getAppID } from '../../utils';
20
21
  import AddPlan from './addPlan';
21
22
 
22
23
  var PlanList = function PlanList(props) {
@@ -26,7 +27,7 @@ var PlanList = function PlanList(props) {
26
27
  currentApp = _useContext.currentApp,
27
28
  isDemo = _useContext.isDemo;
28
29
 
29
- console.log('②埋点方案管理', currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId); // 查看方案
30
+ console.log('②埋点方案管理', currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, getAppID(currentApp)); // 查看方案
30
31
 
31
32
  var tableSee = function tableSee(data) {
32
33
  setDetailId(data.id);
@@ -51,7 +52,7 @@ var PlanList = function PlanList(props) {
51
52
  request(apis.deletePlan, {
52
53
  method: 'post',
53
54
  data: {
54
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
55
+ appId: getAppID(currentApp),
55
56
  planName: data
56
57
  }
57
58
  }).then(function (res) {
@@ -123,7 +124,7 @@ var PlanList = function PlanList(props) {
123
124
  request(apis.getAllPlan, {
124
125
  method: 'get',
125
126
  params: {
126
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
127
+ appId: getAppID(currentApp)
127
128
  }
128
129
  }).then(function (res) {
129
130
  res.data && res.data.planList && setListData(res.data.planList);
@@ -163,7 +164,7 @@ var PlanList = function PlanList(props) {
163
164
  request(apis.queryControlSwitch, {
164
165
  method: 'get',
165
166
  params: {
166
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
167
+ appId: getAppID(currentApp)
167
168
  }
168
169
  }).then(function (res) {
169
170
  var _res$data;
@@ -181,7 +182,7 @@ var PlanList = function PlanList(props) {
181
182
  request(apis.updateControlSwitch, {
182
183
  method: 'post',
183
184
  data: {
184
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
185
+ appId: getAppID(currentApp),
185
186
  isOpen: !isOpen ? '1' : '0'
186
187
  }
187
188
  }).then(function (res) {
@@ -203,7 +204,11 @@ var PlanList = function PlanList(props) {
203
204
  className: "".concat(classPrefix, "-switchbox clearfix")
204
205
  }, /*#__PURE__*/React.createElement("div", {
205
206
  className: "switch-div"
206
- }, /*#__PURE__*/React.createElement("span", null, "\u57CB\u70B9\u65B9\u6848\u63A7\u5236"), /*#__PURE__*/React.createElement(Switch, {
207
+ }, /*#__PURE__*/React.createElement("span", {
208
+ style: {
209
+ lineHeight: '32px'
210
+ }
211
+ }, "\u57CB\u70B9\u65B9\u6848\u63A7\u5236"), /*#__PURE__*/React.createElement(Switch, {
207
212
  onChange: isOpenChang,
208
213
  checkedChildren: "\u5F00",
209
214
  unCheckedChildren: "\u5173",
@@ -28,7 +28,7 @@ var Search = function Search(props) {
28
28
  type: "tianjia",
29
29
  style: {
30
30
  marginRight: '5px',
31
- verticalAlign: '-2px'
31
+ verticalAlign: '-1px'
32
32
  }
33
33
  }),
34
34
  type: "primary",
@@ -1,12 +1,12 @@
1
1
  @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
2
  .plan-list {
3
3
  position: relative;
4
- width: calc(100% - 264px);
4
+ // width: calc(100% - 264px);
5
5
  height: 100%;
6
6
  margin-top: 16px;
7
7
  margin-right: 24px;
8
8
  margin-bottom: 24px;
9
- padding: 24px;
9
+ padding: 20px 24px 24px 24px;
10
10
  background: #fff;
11
11
  border-radius: 8px;
12
12
  .clearfix:after {
@@ -47,6 +47,7 @@
47
47
  float: left;
48
48
  .ant-switch {
49
49
  width: 24px;
50
+ margin-top: -2px;
50
51
  }
51
52
  span {
52
53
  margin-right: 20px;
@@ -157,7 +158,7 @@
157
158
  &-tabs {
158
159
  position: relative;
159
160
  // display: flex;
160
- margin-bottom: 15px;
161
+ // margin-bottom: 15px;
161
162
  > :nth-child(1) {
162
163
  border-radius: 4px 0 0 4px !important;
163
164
  }
@@ -167,7 +168,7 @@
167
168
  .handle-box {
168
169
  position: absolute;
169
170
  top: 5px;
170
- right: 20px;
171
+ right: 0;
171
172
  .bsicon {
172
173
  margin-right: 10px;
173
174
  }
@@ -189,21 +190,17 @@
189
190
  .ant-table {
190
191
  border-radius: 8px 8px 0 0 !important;
191
192
  }
192
- // display: flex;
193
- // margin: 0;
194
- // padding: 0;
195
- // list-style-type: none;
196
- // background: #fff;
197
- // li {
198
- // width: 25%;
199
- // padding: 16px;
200
- // border: 1px solid #e8efff;
201
- // }
202
193
  }
203
194
  &-table-header.empty {
195
+ .ant-table {
196
+ border-radius: 8px !important;
197
+ }
204
198
  .ant-table-tbody {
205
199
  display: contents;
206
200
  }
201
+ .ant-table-tbody > tr > td {
202
+ border-bottom: 0px solid #e8efff;
203
+ }
207
204
  }
208
205
  .user-list,
209
206
  .event-list {
@@ -281,6 +278,7 @@
281
278
  }
282
279
  .set-del-err {
283
280
  color: #cacdd4;
281
+ cursor: not-allowed;
284
282
  }
285
283
  .ant-modal-body {
286
284
  padding: 5px 24px 24px 24px;
@@ -314,7 +312,8 @@
314
312
  }
315
313
  &-add-button {
316
314
  position: absolute;
317
- right: 20px;
315
+ right: 0;
316
+ line-height: 20px;
318
317
  }
319
318
  }
320
319
  }
@@ -49,7 +49,6 @@ var UserAttributeList = function UserAttributeList(props) {
49
49
  className: "".concat(classPrefix, "-table"),
50
50
  columns: columns,
51
51
  dataSource: props.userAttrData,
52
- bordered: true,
53
52
  pagination: false
54
53
  }));
55
54
  };
package/es/store/index.js CHANGED
@@ -10,17 +10,24 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
+
17
+ 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; }
18
+
13
19
  import { useReducer, createContext } from 'react';
14
20
  import { initState } from './state';
15
21
  import { ActionType } from './action';
16
22
 
17
23
  var DmReducer = function DmReducer(prevState, action) {
18
- // console.log('DmReducer', prevState, action);
24
+ console.log('DmReducer', prevState, action);
25
+
19
26
  switch (action.type) {
20
27
  case ActionType.SET_GLOBAL:
21
- return {
28
+ return _objectSpread(_objectSpread({}, prevState), {}, {
22
29
  updateEventMetas: action.payload
23
- };
30
+ });
24
31
 
25
32
  default:
26
33
  return initState;
@@ -0,0 +1 @@
1
+ export declare const getAppID: (currentApp: any) => any;
@@ -0,0 +1,9 @@
1
+ export var getAppID = function getAppID(currentApp) {
2
+ var href = window.location.href;
3
+
4
+ if (href.indexOf('/app/') != -1 && href.indexOf('localhost') == -1) {
5
+ return href.split('/app/')[1].split('/')[0];
6
+ } else {
7
+ return currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId;
8
+ }
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-dm",
3
- "version": "1.0.2-dm.27",
3
+ "version": "1.0.2-dm.29",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "license": "ISC",
@@ -53,7 +53,7 @@
53
53
  "umi-request": "^1.4.0",
54
54
  "yorkie": "^2.0.0"
55
55
  },
56
- "gitHead": "40b9ba4db922193b4bd91f814850a1e67a484c48",
56
+ "gitHead": "cc080cf3bbabd5ba7eb4c88bb49695de615f63a7",
57
57
  "gitHooks": {
58
58
  "pre-commit": "lint-staged"
59
59
  }