@zgfe/modules-page 1.0.1-alpha.0 → 1.0.1-alpha.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.
- package/dist/esm/components/content/index.d.ts +1 -1
- package/dist/esm/components/content/index.js +1 -0
- package/dist/esm/components/content/utils.d.ts +4 -15
- package/dist/esm/components/content/utils.js +10 -11
- package/dist/esm/components/detail/index.js +33 -54
- package/dist/esm/components/groupModal/index.d.ts +2 -6
- package/dist/esm/components/groupModal/index.js +40 -34
- package/dist/esm/components/groupModal/index.less +17 -0
- package/dist/esm/components/groupModal/inputSelect.d.ts +9 -0
- package/dist/esm/components/groupModal/inputSelect.js +67 -0
- package/dist/esm/components/groupModal/pageItem.js +47 -58
- package/dist/esm/components/groupModal/types.d.ts +2 -2
- package/dist/esm/components/groupModal/utils.js +9 -12
- package/dist/esm/components/pageSelect/index.js +27 -4
- package/dist/esm/components/pageSelect/types.d.ts +0 -2
- package/dist/esm/components/searchPanel/index.js +2 -1
- package/dist/esm/components/searchPanel/index.less +3 -5
- package/dist/esm/components/searchPanel/util.d.ts +3 -11
- package/dist/esm/components/searchPanel/util.js +7 -11
- package/dist/esm/constants/api.js +1 -1
- package/dist/esm/modules/empty/index.less +11 -11
- package/dist/esm/modules/home/base64.d.ts +23 -0
- package/dist/esm/modules/home/base64.js +132 -0
- package/dist/esm/modules/home/demo/index.js +1 -1
- package/dist/esm/modules/home/index.js +31 -23
- package/dist/esm/modules/home/types.d.ts +5 -1
- package/dist/esm/modules/home/utils.d.ts +3 -3
- package/dist/esm/modules/home/utils.js +31 -7
- package/package.json +4 -3
- package/dist/esm/components/groupModal/mock.d.ts +0 -5
- package/dist/esm/components/groupModal/mock.js +0 -16
|
@@ -7,7 +7,7 @@ declare const PageContent: React.FC<{
|
|
|
7
7
|
value?: PageColumnType[];
|
|
8
8
|
groupId?: number;
|
|
9
9
|
hasUserGroup?: boolean;
|
|
10
|
-
onClick?: (data:
|
|
10
|
+
onClick?: (data: ModulesPageTypes.PageGroup | ModulesPageTypes.Page) => void;
|
|
11
11
|
onEdit?: (data: ModulesPageTypes.PageGroup) => void;
|
|
12
12
|
onCreate?: () => void;
|
|
13
13
|
}>;
|
|
@@ -43,6 +43,7 @@ var PageContent = function PageContent(props) {
|
|
|
43
43
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
44
|
className: classPrefix
|
|
45
45
|
}, /*#__PURE__*/React.createElement(BizTable, {
|
|
46
|
+
rowKey: props.type === 'pageGroup' ? 'id' : 'pageUrl',
|
|
46
47
|
dataSource: props.type === 'pageGroup' ? groupList : props.value,
|
|
47
48
|
columns: getColumns(props.type, props.hasUserGroup, props.onClick, props.onEdit)
|
|
48
49
|
}));
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
dataIndex: string;
|
|
6
|
-
key: string;
|
|
7
|
-
render: (txt: string, record: any) => React.JSX.Element;
|
|
8
|
-
width?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
title: string;
|
|
11
|
-
dataIndex: string;
|
|
12
|
-
key: string;
|
|
13
|
-
width: number;
|
|
14
|
-
render?: undefined;
|
|
15
|
-
})[];
|
|
1
|
+
import { ColumnsType } from 'antd/lib/table';
|
|
2
|
+
import { PageColumnType } from './types';
|
|
3
|
+
import { ModulesPageTypes } from '../../modules/home/types';
|
|
4
|
+
export declare const getColumns: (type: string, hasUserGroup?: boolean, onClickCallback?: Function, onEditCallback?: Function) => ColumnsType<PageColumnType> | ColumnsType<ModulesPageTypes.PageGroup>;
|
|
16
5
|
export declare const getNumPer: (viewUser: number, clickUser: number) => string;
|
|
17
6
|
export declare const toThousands: (num?: number) => string | number | undefined;
|
|
@@ -19,7 +19,10 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
|
|
|
19
19
|
return /*#__PURE__*/React.createElement("div", {
|
|
20
20
|
className: "table-td-page",
|
|
21
21
|
onClick: function onClick() {
|
|
22
|
-
return onClickCallback && onClickCallback(
|
|
22
|
+
return onClickCallback && onClickCallback({
|
|
23
|
+
pageTitle: record.pageTitle,
|
|
24
|
+
pageUrl: record.pageUrl
|
|
25
|
+
});
|
|
23
26
|
}
|
|
24
27
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
25
28
|
title: record.pageTitle
|
|
@@ -37,9 +40,10 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
|
|
|
37
40
|
onClick: function onClick(e) {
|
|
38
41
|
var _navigator, _navigator$clipboard;
|
|
39
42
|
e.stopPropagation();
|
|
40
|
-
|
|
43
|
+
if (!(record !== null && record !== void 0 && record.pageUrl)) return;
|
|
44
|
+
(_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$clipboard = _navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText(record === null || record === void 0 ? void 0 : record.pageUrl).catch(function () {
|
|
41
45
|
var el = document.createElement('textarea');
|
|
42
|
-
el.value = record.pageUrl;
|
|
46
|
+
el.value = record.pageUrl || '';
|
|
43
47
|
document.body.appendChild(el);
|
|
44
48
|
el.select();
|
|
45
49
|
document.execCommand('copy');
|
|
@@ -117,7 +121,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
|
|
|
117
121
|
},
|
|
118
122
|
showSorterTooltip: false,
|
|
119
123
|
render: function render(_txt, record) {
|
|
120
|
-
return getNumPer(record.viewUser, record.clickUser);
|
|
124
|
+
return getNumPer(record.viewUser || 0, record.clickUser || 0);
|
|
121
125
|
}
|
|
122
126
|
}];
|
|
123
127
|
if (hasUserGroup) {
|
|
@@ -140,7 +144,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
|
|
|
140
144
|
onClick: function onClick() {
|
|
141
145
|
return onClickCallback && onClickCallback(record);
|
|
142
146
|
}
|
|
143
|
-
},
|
|
147
|
+
}, txt), /*#__PURE__*/React.createElement(IconFont, {
|
|
144
148
|
type: "bianji1",
|
|
145
149
|
onClick: function onClick() {
|
|
146
150
|
return onEditCallback && onEditCallback(record);
|
|
@@ -156,7 +160,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
|
|
|
156
160
|
return type === 'page' ? pageColumns : groupColumns;
|
|
157
161
|
};
|
|
158
162
|
export var getNumPer = function getNumPer(viewUser, clickUser) {
|
|
159
|
-
if (viewUser === -1) {
|
|
163
|
+
if (!viewUser || viewUser === -1) {
|
|
160
164
|
return '-';
|
|
161
165
|
}
|
|
162
166
|
return viewUser ? (clickUser / viewUser * 100).toFixed(1) + '%' : 0 + '%';
|
|
@@ -166,9 +170,4 @@ export var toThousands = function toThousands(num) {
|
|
|
166
170
|
return num === -1 ? '-' : util.toThousands(num);
|
|
167
171
|
}
|
|
168
172
|
return num;
|
|
169
|
-
};
|
|
170
|
-
var sorter = function sorter(a, b) {
|
|
171
|
-
if (a.viewUser === -1 || !a.viewUser) return 0;
|
|
172
|
-
if (b.viewUser === -1 || !b.viewUser) return 1;
|
|
173
|
-
return a.clickUser / a.viewUser - b.clickUser / b.viewUser;
|
|
174
173
|
};
|
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
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; }
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
13
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
14
14
|
import "./index.less";
|
|
15
15
|
import { BizGlobalDataContext, IconFont, SocketClient, ajax } from '@zgfe/business-lib';
|
|
16
16
|
import { Tooltip } from 'antd';
|
|
@@ -18,40 +18,29 @@ import { getNumPer, toThousands } from "../content/utils";
|
|
|
18
18
|
import percentImg from "./images/color_pallete_percent.png";
|
|
19
19
|
import renderImg from "./images/empty.png";
|
|
20
20
|
import { ModulesPageContext } from "../../modules/home/types";
|
|
21
|
-
import api from "../../constants/api";
|
|
22
21
|
import { getSocketSecret } from "../../modules/home/utils";
|
|
22
|
+
import api from "../../constants/api";
|
|
23
23
|
var DetailContent = function DetailContent(props) {
|
|
24
24
|
var classPrefix = 'detail-content';
|
|
25
|
-
var _useState = useState([]),
|
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
-
detailList = _useState2[0],
|
|
28
|
-
setDetailList = _useState2[1];
|
|
29
|
-
var _useState3 = useState(true),
|
|
30
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
31
|
-
loading = _useState4[0],
|
|
32
|
-
setLoading = _useState4[1];
|
|
33
|
-
var _useState5 = useState(0),
|
|
34
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
35
|
-
timer = _useState6[0],
|
|
36
|
-
setTimer = _useState6[1];
|
|
37
25
|
var _useContext = useContext(BizGlobalDataContext),
|
|
38
26
|
currentApp = _useContext.currentApp;
|
|
39
27
|
var _useContext2 = useContext(ModulesPageContext),
|
|
40
28
|
pageGroupList = _useContext2.pageGroupList,
|
|
41
29
|
pageList = _useContext2.pageList,
|
|
42
30
|
setCurrentClickPage = _useContext2.setCurrentClickPage;
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
client =
|
|
46
|
-
setClient =
|
|
31
|
+
var _useState = useState(),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
client = _useState2[0],
|
|
34
|
+
setClient = _useState2[1];
|
|
47
35
|
// 当前url
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
pageUrl =
|
|
51
|
-
setPageUrl =
|
|
36
|
+
var _useState3 = useState(),
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
pageUrl = _useState4[0],
|
|
39
|
+
setPageUrl = _useState4[1];
|
|
52
40
|
useEffect(function () {
|
|
53
41
|
var secret = getSocketSecret();
|
|
54
|
-
var
|
|
42
|
+
var url = "wss://".concat(location.host).concat(api.socket);
|
|
43
|
+
var socket = new SocketClient(url, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appKey, {
|
|
55
44
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
56
45
|
origin: 4,
|
|
57
46
|
role: 'server',
|
|
@@ -88,8 +77,8 @@ var DetailContent = function DetailContent(props) {
|
|
|
88
77
|
});
|
|
89
78
|
client.onConnected(function () {
|
|
90
79
|
client.emit('openAutoTrack', _objectSpread({
|
|
91
|
-
|
|
92
|
-
platform:
|
|
80
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
81
|
+
platform: 3
|
|
93
82
|
}, props.params));
|
|
94
83
|
});
|
|
95
84
|
client.onError(function (err) {
|
|
@@ -99,8 +88,7 @@ var DetailContent = function DetailContent(props) {
|
|
|
99
88
|
console.log('连接已存在');
|
|
100
89
|
});
|
|
101
90
|
client.on('pageInfo', function (message) {
|
|
102
|
-
|
|
103
|
-
if (message.href !== pageUrl) {
|
|
91
|
+
if (message.href !== openUrl) {
|
|
104
92
|
setPageUrl(message.href);
|
|
105
93
|
// 如果当前类型是单页面,则更新页面选择
|
|
106
94
|
if (props.type === 'page') {
|
|
@@ -131,33 +119,24 @@ var DetailContent = function DetailContent(props) {
|
|
|
131
119
|
href: pageUrl
|
|
132
120
|
});
|
|
133
121
|
client.emit('updateAutoTrackParam', _objectSpread({
|
|
134
|
-
|
|
135
|
-
platform:
|
|
122
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
123
|
+
platform: 3
|
|
136
124
|
}, props.params));
|
|
137
|
-
// if (timer) {
|
|
138
|
-
// clearTimeout(timer);
|
|
139
|
-
// }
|
|
140
|
-
// setTimer(
|
|
141
|
-
// setTimeout(() => {
|
|
142
|
-
// setLoading(true);
|
|
143
|
-
// ajax(api.getDetailResult, {
|
|
144
|
-
// method:'post',
|
|
145
|
-
// data: {
|
|
146
|
-
// appId: currentApp?.appId,
|
|
147
|
-
// platform: currentApp?.platform || 0,
|
|
148
|
-
// // ...props.params,
|
|
149
|
-
// },
|
|
150
|
-
// })
|
|
151
|
-
// .then((res) => {
|
|
152
|
-
// if (!res) return;
|
|
153
|
-
// setDetailList(res.data as PageColumnType[]);
|
|
154
|
-
// })
|
|
155
|
-
// .finally(() => {
|
|
156
|
-
// setLoading(false);
|
|
157
|
-
// });
|
|
158
|
-
// }, 500),
|
|
159
|
-
// );
|
|
160
125
|
}, [props.params]);
|
|
126
|
+
var openUrl = useMemo(function () {
|
|
127
|
+
if (!pageUrl) return '';
|
|
128
|
+
var pUrl = pageUrl,
|
|
129
|
+
url = '';
|
|
130
|
+
var hash = pUrl.match(/#\S*$/) || [''];
|
|
131
|
+
if (hash) pUrl = pUrl.replace(hash[0], '');
|
|
132
|
+
var secret = 'autoTrack-' + getSocketSecret();
|
|
133
|
+
if (/\?/.test(pageUrl)) {
|
|
134
|
+
url = "".concat(pUrl.replace(/\/$/, ''), "&zgSecret=").concat(secret).concat(hash);
|
|
135
|
+
} else {
|
|
136
|
+
url = "".concat(pUrl.replace(/\/$/, ''), "?zgSecret=").concat(secret).concat(hash);
|
|
137
|
+
}
|
|
138
|
+
return url;
|
|
139
|
+
}, [pageUrl]);
|
|
161
140
|
return /*#__PURE__*/React.createElement("div", {
|
|
162
141
|
className: classPrefix
|
|
163
142
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -170,7 +149,7 @@ var DetailContent = function DetailContent(props) {
|
|
|
170
149
|
title: pageUrl
|
|
171
150
|
}, /*#__PURE__*/React.createElement("span", {
|
|
172
151
|
className: "".concat(classPrefix, "-top-value")
|
|
173
|
-
}, pageUrl))), /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
}, decodeURI(pageUrl || '')))), /*#__PURE__*/React.createElement("div", {
|
|
174
153
|
className: "".concat(classPrefix, "-top-content")
|
|
175
154
|
}, props.result.map(function (item, index) {
|
|
176
155
|
var _props$params2, _props$params$userGro;
|
|
@@ -193,7 +172,7 @@ var DetailContent = function DetailContent(props) {
|
|
|
193
172
|
}, /*#__PURE__*/React.createElement("img", {
|
|
194
173
|
src: renderImg
|
|
195
174
|
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
196
|
-
href:
|
|
175
|
+
href: openUrl,
|
|
197
176
|
target: "_blank"
|
|
198
177
|
}, "\u6253\u5F00\u65B0\u6807\u7B7E\u9875", /*#__PURE__*/React.createElement(IconFont, {
|
|
199
178
|
type: "zhuanfa"
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
|
+
import { GroupModalType } from './types';
|
|
3
4
|
export declare const classPrefix = "group-modal";
|
|
4
|
-
declare const GroupModal: React.FC<
|
|
5
|
-
value?: any;
|
|
6
|
-
type?: string;
|
|
7
|
-
onOk?: () => void;
|
|
8
|
-
onCancel?: () => void;
|
|
9
|
-
}>;
|
|
5
|
+
declare const GroupModal: React.FC<GroupModalType.Props>;
|
|
10
6
|
export default GroupModal;
|
|
@@ -11,12 +11,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import { BizDialog, BizGlobalDataContext, IconFont, ajax } from '@zgfe/business-lib';
|
|
14
|
-
import { Button, Form, Input } from 'antd';
|
|
14
|
+
import { Button, Form, Input, Spin, message } from 'antd';
|
|
15
15
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
16
16
|
import "./index.less";
|
|
17
17
|
import PageItem from "./pageItem";
|
|
18
|
-
import { getPageEsData } from "./utils";
|
|
19
|
-
import mockData from "./mock";
|
|
20
18
|
import api from "../../constants/api";
|
|
21
19
|
export var classPrefix = 'group-modal';
|
|
22
20
|
var GroupModal = function GroupModal(props) {
|
|
@@ -24,31 +22,21 @@ var GroupModal = function GroupModal(props) {
|
|
|
24
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25
23
|
loading = _useState2[0],
|
|
26
24
|
setLoading = _useState2[1];
|
|
27
|
-
var _useState3 = useState(false),
|
|
28
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
-
delLoading = _useState4[0],
|
|
30
|
-
setDelLoading = _useState4[1];
|
|
31
25
|
var _useContext = useContext(BizGlobalDataContext),
|
|
32
26
|
currentApp = _useContext.currentApp,
|
|
33
27
|
isDemo = _useContext.isDemo;
|
|
34
28
|
var refForm = useRef();
|
|
35
|
-
// 默认的url数组
|
|
36
|
-
var _useState5 = useState(mockData),
|
|
37
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
38
|
-
defaultOption = _useState6[0],
|
|
39
|
-
setDefaultOption = _useState6[1];
|
|
40
29
|
// 是否校验
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
validate =
|
|
44
|
-
setValidate =
|
|
30
|
+
var _useState3 = useState(false),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
validate = _useState4[0],
|
|
33
|
+
setValidate = _useState4[1];
|
|
45
34
|
// 按钮组
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
btnList =
|
|
49
|
-
setBtnList =
|
|
35
|
+
var _useState5 = useState([]),
|
|
36
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
37
|
+
btnList = _useState6[0],
|
|
38
|
+
setBtnList = _useState6[1];
|
|
50
39
|
useEffect(function () {
|
|
51
|
-
getPageEsData('', setDefaultOption, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
|
|
52
40
|
setBtnList(function () {
|
|
53
41
|
var btnGroup = [/*#__PURE__*/React.createElement(Button, {
|
|
54
42
|
key: "cancel",
|
|
@@ -57,7 +45,6 @@ var GroupModal = function GroupModal(props) {
|
|
|
57
45
|
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
58
46
|
key: "submit",
|
|
59
47
|
type: "primary",
|
|
60
|
-
loading: loading,
|
|
61
48
|
onClick: onOk
|
|
62
49
|
}, "\u786E\u5B9A")];
|
|
63
50
|
if (props.value) {
|
|
@@ -66,7 +53,6 @@ var GroupModal = function GroupModal(props) {
|
|
|
66
53
|
type: "text",
|
|
67
54
|
className: "".concat(classPrefix, "-footer-del"),
|
|
68
55
|
onClick: onDelete,
|
|
69
|
-
loading: delLoading,
|
|
70
56
|
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
71
57
|
type: "shanchu2"
|
|
72
58
|
})
|
|
@@ -76,17 +62,24 @@ var GroupModal = function GroupModal(props) {
|
|
|
76
62
|
});
|
|
77
63
|
}, []);
|
|
78
64
|
var onDelete = function onDelete() {
|
|
79
|
-
|
|
65
|
+
var _props$value;
|
|
66
|
+
setLoading(true);
|
|
80
67
|
ajax(api.deletePageGroup, {
|
|
81
68
|
method: 'post',
|
|
82
69
|
data: {
|
|
83
70
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
84
|
-
platform:
|
|
85
|
-
id: props.value.id
|
|
71
|
+
platform: 3,
|
|
72
|
+
id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
|
|
73
|
+
}
|
|
74
|
+
}).then(function (res) {
|
|
75
|
+
if (!res) {
|
|
76
|
+
message.error("\u5220\u9664\u5931\u8D25");
|
|
77
|
+
return;
|
|
86
78
|
}
|
|
87
|
-
|
|
88
|
-
setDelLoading(false);
|
|
79
|
+
message.success("\u5220\u9664\u6210\u529F");
|
|
89
80
|
props.onOk && props.onOk();
|
|
81
|
+
}).finally(function () {
|
|
82
|
+
setLoading(false);
|
|
90
83
|
});
|
|
91
84
|
};
|
|
92
85
|
var onOk = function onOk() {
|
|
@@ -94,10 +87,10 @@ var GroupModal = function GroupModal(props) {
|
|
|
94
87
|
(_refForm$current = refForm.current) === null || _refForm$current === void 0 ? void 0 : _refForm$current.submit();
|
|
95
88
|
};
|
|
96
89
|
var onSubmit = function onSubmit(data) {
|
|
97
|
-
var _props$
|
|
90
|
+
var _props$value2;
|
|
98
91
|
setValidate(true);
|
|
99
92
|
var flag = true;
|
|
100
|
-
data.
|
|
93
|
+
data.filters.forEach(function (item) {
|
|
101
94
|
if (!item.param) {
|
|
102
95
|
flag = false;
|
|
103
96
|
}
|
|
@@ -106,11 +99,23 @@ var GroupModal = function GroupModal(props) {
|
|
|
106
99
|
setLoading(true);
|
|
107
100
|
var url = props.value ? api.updatePageGroup : api.addPageGroup;
|
|
108
101
|
ajax(url, {
|
|
102
|
+
method: 'post',
|
|
109
103
|
data: _objectSpread({
|
|
110
|
-
|
|
104
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
105
|
+
platform: 3,
|
|
106
|
+
id: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id
|
|
111
107
|
}, data)
|
|
112
|
-
}).then(function () {
|
|
108
|
+
}).then(function (res) {
|
|
109
|
+
var _props$value4;
|
|
110
|
+
if (!res) {
|
|
111
|
+
var _props$value3;
|
|
112
|
+
message.error("".concat((_props$value3 = props.value) !== null && _props$value3 !== void 0 && _props$value3.id ? '修改' : '创建', "\u5931\u8D25"));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
message.success("".concat((_props$value4 = props.value) !== null && _props$value4 !== void 0 && _props$value4.id ? '修改' : '创建', "\u6210\u529F"));
|
|
113
116
|
props.onOk && props.onOk();
|
|
117
|
+
}).finally(function () {
|
|
118
|
+
setLoading(false);
|
|
114
119
|
});
|
|
115
120
|
};
|
|
116
121
|
return /*#__PURE__*/React.createElement(BizDialog, {
|
|
@@ -123,7 +128,9 @@ var GroupModal = function GroupModal(props) {
|
|
|
123
128
|
disabled: isDemo
|
|
124
129
|
},
|
|
125
130
|
footer: btnList
|
|
126
|
-
}, /*#__PURE__*/React.createElement(
|
|
131
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
132
|
+
spinning: loading
|
|
133
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
127
134
|
ref: refForm,
|
|
128
135
|
onFinish: onSubmit,
|
|
129
136
|
initialValues: props.value,
|
|
@@ -158,7 +165,6 @@ var GroupModal = function GroupModal(props) {
|
|
|
158
165
|
}, " \u6DFB\u52A0\u9875\u9762"), /*#__PURE__*/React.createElement(Form.Item, {
|
|
159
166
|
name: "filters"
|
|
160
167
|
}, /*#__PURE__*/React.createElement(PageItem, {
|
|
161
|
-
defaultOption: defaultOption,
|
|
162
168
|
validate: validate
|
|
163
169
|
}))), /*#__PURE__*/React.createElement(Button, null)));
|
|
164
170
|
};
|
|
@@ -137,6 +137,23 @@
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
&-dropdown {
|
|
141
|
+
width: 300px;
|
|
142
|
+
&-handle {
|
|
143
|
+
width: 300px;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
&-dropdown-panel {
|
|
147
|
+
.__select-panel();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.ant-input {
|
|
151
|
+
border-color: #fafafb;
|
|
152
|
+
&:not([disabled]):hover,
|
|
153
|
+
&:not([disabled]):focus {
|
|
154
|
+
border-color: @primary-color;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
140
157
|
.ant-modal-content {
|
|
141
158
|
.ant-modal-body {
|
|
142
159
|
padding-bottom: 0;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { Dropdown, Input } from 'antd';
|
|
8
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { classPrefix } from '.';
|
|
10
|
+
import { IconFont } from '@zgfe/business-lib';
|
|
11
|
+
var InputSelect = function InputSelect(props) {
|
|
12
|
+
var _useState = useState(props.value),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
searchValue = _useState2[0],
|
|
15
|
+
setSearchValue = _useState2[1];
|
|
16
|
+
useEffect(function () {}, []);
|
|
17
|
+
var options = useMemo(function () {
|
|
18
|
+
if (!props.options) return [];
|
|
19
|
+
return props.options.map(function (item) {
|
|
20
|
+
return {
|
|
21
|
+
key: item,
|
|
22
|
+
label: item,
|
|
23
|
+
title: item
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}, [props.options]);
|
|
27
|
+
var onChange = function onChange(e) {
|
|
28
|
+
var val = e.target.value;
|
|
29
|
+
if (searchValue === val) return;
|
|
30
|
+
setSearchValue(val);
|
|
31
|
+
props.onSearch && props.onSearch(val);
|
|
32
|
+
};
|
|
33
|
+
var onClick = function onClick(data) {
|
|
34
|
+
setSearchValue(data.key);
|
|
35
|
+
props.onChange && props.onChange(data.key);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
38
|
+
overlayClassName: "".concat(classPrefix, "-dropdown"),
|
|
39
|
+
trigger: ['click'],
|
|
40
|
+
menu: {
|
|
41
|
+
items: options,
|
|
42
|
+
selectedKeys: props.value ? [props.value] : undefined,
|
|
43
|
+
onClick: onClick
|
|
44
|
+
},
|
|
45
|
+
dropdownRender: function dropdownRender(menus) {
|
|
46
|
+
var _props$options;
|
|
47
|
+
if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
|
|
48
|
+
return menus;
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "".concat(classPrefix, "-dropdown-panel")
|
|
52
|
+
}, "\u6682\u65E0\u6570\u636E");
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
55
|
+
className: "".concat(classPrefix, "-dropdown-handle"),
|
|
56
|
+
value: searchValue,
|
|
57
|
+
allowClear: true,
|
|
58
|
+
title: searchValue,
|
|
59
|
+
status: props.status,
|
|
60
|
+
onChange: onChange,
|
|
61
|
+
suffix: /*#__PURE__*/React.createElement(IconFont, {
|
|
62
|
+
className: "".concat(classPrefix, "-item-down-icon"),
|
|
63
|
+
type: "xiangxia"
|
|
64
|
+
})
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
export default InputSelect;
|