@zgfe/modules-dm 1.0.42-alpha.8 → 1.0.56-zhongyuan.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.
- package/es/components/demo.js +1 -1
- package/es/constants/api.d.ts +37 -0
- package/es/constants/api.js +62 -1
- package/es/index.d.ts +4 -3
- package/es/index.js +4 -3
- package/es/modules/CutsModal.d.ts +66 -0
- package/es/modules/CutsModal.js +52 -0
- package/es/modules/{dataCollection → dataManage}/collectionAttributeList.d.ts +3 -0
- package/es/modules/dataManage/collectionAttributeList.js +943 -0
- package/es/modules/{dataCollection → dataManage}/collectionEventList.d.ts +6 -0
- package/es/modules/dataManage/collectionEventList.js +883 -0
- package/es/modules/dataManage/components/createAttrDrawer.d.ts +4 -0
- package/es/modules/dataManage/components/createAttrDrawer.js +264 -0
- package/es/modules/dataManage/components/createMetaDrawer.d.ts +4 -0
- package/es/modules/dataManage/components/createMetaDrawer.js +618 -0
- package/es/modules/{dataCollection → dataManage}/components/createVirtualDrawer.js +20 -20
- package/es/modules/dataManage/components/creditPop/imgs/link.png +0 -0
- package/es/modules/dataManage/components/creditPop/imgs/png01.png +0 -0
- package/es/modules/dataManage/components/creditPop/imgs/png02.png +0 -0
- package/es/modules/dataManage/components/creditPop/imgs/png03.png +0 -0
- package/es/modules/dataManage/components/creditPop/imgs/png04.png +0 -0
- package/es/modules/dataManage/components/creditPop/index.d.ts +5 -0
- package/es/modules/dataManage/components/creditPop/index.js +89 -0
- package/es/modules/dataManage/components/creditPop/index.less +121 -0
- package/es/modules/dataManage/components/deleteConfirm.d.ts +9 -0
- package/es/modules/dataManage/components/deleteConfirm.js +36 -0
- package/es/modules/dataManage/components/deleteUserAttrConfirm.d.ts +9 -0
- package/es/modules/dataManage/components/deleteUserAttrConfirm.js +57 -0
- package/es/modules/dataManage/components/depositPop/imgs/link.png +0 -0
- package/es/modules/dataManage/components/depositPop/imgs/png01.png +0 -0
- package/es/modules/dataManage/components/depositPop/imgs/png02.png +0 -0
- package/es/modules/dataManage/components/depositPop/index.d.ts +5 -0
- package/es/modules/dataManage/components/depositPop/index.js +89 -0
- package/es/modules/dataManage/components/depositPop/index.less +115 -0
- package/es/modules/dataManage/components/developModal/index.css +36 -0
- package/es/modules/dataManage/components/developModal/index.d.ts +5 -0
- package/es/modules/dataManage/components/developModal/index.js +224 -0
- package/es/modules/dataManage/components/developModal/index.less +36 -0
- package/es/modules/dataManage/components/editTxt/index.d.ts +5 -0
- package/es/modules/dataManage/components/editTxt/index.js +123 -0
- package/es/modules/dataManage/components/editTxt/index.less +44 -0
- package/es/modules/dataManage/components/editTxt/types.d.ts +48 -0
- package/es/modules/{dataCollection → dataManage}/components/eventFilter/index.js +13 -13
- package/es/modules/{dataCollection → dataManage}/components/eventFilter/styles/index.less +1 -1
- package/es/modules/{dataCollection → dataManage}/components/eventGroupingDrawer.js +44 -47
- package/es/modules/dataManage/components/importAttrDialog/demo/index.d.ts +2 -0
- package/es/modules/dataManage/components/importAttrDialog/demo/index.js +28 -0
- package/es/modules/dataManage/components/importAttrDialog/index.d.ts +7 -0
- package/es/modules/dataManage/components/importAttrDialog/index.js +157 -0
- package/es/modules/dataManage/components/importAttrDialog/styles/index.less +90 -0
- package/es/modules/dataManage/components/importMetaDialog/demo/index.d.ts +2 -0
- package/es/modules/dataManage/components/importMetaDialog/demo/index.js +28 -0
- package/es/modules/dataManage/components/importMetaDialog/index.d.ts +7 -0
- package/es/modules/dataManage/components/importMetaDialog/index.js +157 -0
- package/es/modules/dataManage/components/importMetaDialog/styles/index.less +91 -0
- package/es/modules/{dataCollection → dataManage}/components/selectAttributes.js +10 -10
- package/es/modules/{dataCollection → dataManage}/components/tablePlus.d.ts +4 -0
- package/es/modules/dataManage/components/tablePlus.js +1207 -0
- package/es/modules/{dataCollection → dataManage}/components/virtualTablePlus.js +10 -10
- package/es/modules/dataManage/demo/index.js +79 -16
- package/es/modules/dataManage/detailedData/DetailedDataForm.d.ts +5 -0
- package/es/modules/dataManage/detailedData/DetailedDataForm.js +216 -0
- package/es/modules/dataManage/detailedData/index.d.ts +24 -0
- package/es/modules/dataManage/detailedData/index.js +403 -0
- package/es/modules/dataManage/detailedData/useColumns.d.ts +34 -0
- package/es/modules/dataManage/detailedData/useColumns.js +135 -0
- package/es/modules/dataManage/index.d.ts +9 -19
- package/es/modules/dataManage/index.js +176 -17
- package/es/modules/dataManage/styles/detailed.less +74 -0
- package/es/modules/dataManage/styles/index.less +1177 -18
- package/es/modules/{dataCollection → dataManage}/types.d.ts +8 -0
- package/es/modules/dataManage/types.js +1 -0
- package/es/modules/{dataCollection → dataManage}/virtualEventList.js +13 -13
- package/es/modules/dataMap/component/data.d.ts +7 -0
- package/es/modules/dataMap/component/data.js +257 -0
- package/es/modules/dataMap/component/drawerAdd.d.ts +6 -0
- package/es/modules/dataMap/component/drawerAdd.js +376 -0
- package/es/modules/dataMap/component/leftTree.d.ts +6 -0
- package/es/modules/dataMap/component/leftTree.js +227 -0
- package/es/modules/dataMap/component/rightDetail.d.ts +7 -0
- package/es/modules/dataMap/component/rightDetail.js +680 -0
- package/es/modules/dataMap/component/selectAttr.d.ts +7 -0
- package/es/modules/dataMap/component/selectAttr.js +92 -0
- package/es/modules/dataMap/css/index.css +163 -0
- package/es/modules/dataMap/css/index.less +177 -0
- package/es/modules/dataMap/demo/index.d.ts +2 -0
- package/es/modules/dataMap/demo/index.js +6 -0
- package/es/modules/dataMap/img/empty-data.png +0 -0
- package/es/modules/dataMap/index.d.ts +2 -0
- package/es/modules/dataMap/index.js +80 -0
- package/es/modules/dataMap/mapDetail.d.ts +3 -0
- package/es/modules/dataMap/mapDetail.js +44 -0
- package/es/modules/dataMap/mapSetting.d.ts +6 -0
- package/es/modules/dataMap/mapSetting.js +148 -0
- package/es/modules/dataPlan/addEventOrUser.js +31 -30
- package/es/modules/dataPlan/addPlan.js +29 -27
- package/es/modules/dataPlan/eventList.js +2 -2
- package/es/modules/dataPlan/index.js +10 -10
- package/es/modules/dataPlan/search.js +6 -5
- package/es/modules/dataPlan/tablePlus.js +3 -3
- package/es/modules/dataPlan/userAttributeList.js +5 -5
- package/es/modules/dataReal/css/index.css +48 -0
- package/es/modules/dataReal/css/index.less +51 -0
- package/es/modules/dataReal/demo/index.d.ts +2 -0
- package/es/modules/dataReal/demo/index.js +6 -0
- package/es/modules/dataReal/index1.d.ts +28 -0
- package/es/modules/dataReal/index1.js +215 -0
- package/es/modules/dataReal/table.d.ts +5 -0
- package/es/modules/dataReal/table.js +258 -0
- package/es/store/index.js +11 -11
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +9 -1
- package/package.json +8 -4
- package/es/modules/dataCollection/collectionAttributeList.js +0 -508
- package/es/modules/dataCollection/collectionEventList.js +0 -466
- package/es/modules/dataCollection/components/tablePlus.js +0 -676
- package/es/modules/dataCollection/index.d.ts +0 -19
- package/es/modules/dataCollection/index.js +0 -93
- package/es/modules/dataCollection/styles/index.less +0 -842
- /package/es/modules/{dataCollection → dataManage}/components/createVirtualDrawer.d.ts +0 -0
- /package/es/modules/{dataCollection/components/eventFilter → dataManage/components/editTxt}/types.js +0 -0
- /package/es/modules/{dataCollection → dataManage}/components/eventFilter/index.d.ts +0 -0
- /package/es/modules/{dataCollection → dataManage}/components/eventFilter/types.d.ts +0 -0
- /package/es/modules/{dataCollection → dataManage/components/eventFilter}/types.js +0 -0
- /package/es/modules/{dataCollection → dataManage}/components/eventGroupingDrawer.d.ts +0 -0
- /package/es/modules/{dataCollection → dataManage}/components/eventItem.d.ts +0 -0
- /package/es/modules/{dataCollection → dataManage}/components/eventItem.js +0 -0
- /package/es/modules/{dataCollection → dataManage}/components/selectAttributes.d.ts +0 -0
- /package/es/modules/{dataCollection → dataManage}/components/virtualTablePlus.d.ts +0 -0
- /package/es/modules/{dataCollection → dataManage}/virtualEventList.d.ts +0 -0
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
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
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
7
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
|
+
import { BizGlobalDataContext, IconFont, ajax } from '@zgfe/business-lib';
|
|
18
|
+
import { Input, Button, Select, Table, message, Modal, Upload, Popover, Checkbox } from 'antd';
|
|
19
|
+
import React, { useEffect, useState, useContext } from 'react';
|
|
20
|
+
import './styles/index.less';
|
|
21
|
+
import request from '../../utils/ajax';
|
|
22
|
+
import apis from '../../constants/api';
|
|
23
|
+
import { DmContext } from '../../store';
|
|
24
|
+
import { getAppID, getTableScroll } from '../../utils';
|
|
25
|
+
import CreateAttrDrawer from './components/createAttrDrawer';
|
|
26
|
+
import ImportModal from './components/importAttrDialog';
|
|
27
|
+
import DelConfirm from './components/deleteUserAttrConfirm';
|
|
28
|
+
import _ from 'lodash';
|
|
29
|
+
import moment from 'moment';
|
|
30
|
+
var CollectionAttributeList = function CollectionAttributeList(props) {
|
|
31
|
+
var classPrefix = 'attr-list';
|
|
32
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
33
|
+
currentApp = _useContext.currentApp,
|
|
34
|
+
isDemo = _useContext.isDemo,
|
|
35
|
+
authority = _useContext.authority;
|
|
36
|
+
var isOpen = props.isOpen,
|
|
37
|
+
queryPlanData = props.queryPlanData,
|
|
38
|
+
source = props.source,
|
|
39
|
+
eventAttrsData = props.eventAttrsData;
|
|
40
|
+
// 属性列表加载中
|
|
41
|
+
var _useState = useState(true),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
loading = _useState2[0],
|
|
44
|
+
setLoading = _useState2[1];
|
|
45
|
+
// 属性值弹窗列表加载中
|
|
46
|
+
var _useState3 = useState(false),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
valueLoading = _useState4[0],
|
|
49
|
+
setValueLoading = _useState4[1];
|
|
50
|
+
var _useContext2 = useContext(DmContext),
|
|
51
|
+
state = _useContext2.state;
|
|
52
|
+
// 创建元事件
|
|
53
|
+
var _useState5 = useState(false),
|
|
54
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
+
createAttrShow = _useState6[0],
|
|
56
|
+
setCreateAttrShow = _useState6[1];
|
|
57
|
+
// 导入事件弹窗
|
|
58
|
+
var _useState7 = useState(false),
|
|
59
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
60
|
+
openImportModal = _useState8[0],
|
|
61
|
+
setOpenImportModal = _useState8[1];
|
|
62
|
+
// 确认删除弹窗
|
|
63
|
+
var _useState9 = useState(false),
|
|
64
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
65
|
+
isShowDel = _useState10[0],
|
|
66
|
+
setIsShowDel = _useState10[1];
|
|
67
|
+
// 内置属性(名称, 用户id)可编辑加密状态
|
|
68
|
+
var uniqueAttrs = ['name', 'app_user_id'];
|
|
69
|
+
// 判断是否在方案中: 处理表格class添加异常样式 | 处理表格行异常信息展示, true异常
|
|
70
|
+
var rowRenderHandle = function rowRenderHandle(name) {
|
|
71
|
+
if (source == 'event' && eventAttrsData.owner == 'zg_abp') {
|
|
72
|
+
// 内置事件属性
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (source == 'user') {
|
|
76
|
+
var _queryPlanData$unexpe;
|
|
77
|
+
return (queryPlanData === null || queryPlanData === void 0 ? void 0 : (_queryPlanData$unexpe = queryPlanData.unexpectedPropList) === null || _queryPlanData$unexpe === void 0 ? void 0 : _queryPlanData$unexpe.indexOf(name)) != -1 && isOpen == 1 ? true : false;
|
|
78
|
+
} else {
|
|
79
|
+
if (isOpen != 1) {
|
|
80
|
+
return false;
|
|
81
|
+
} else {
|
|
82
|
+
var _temp2, _temp2$attrList;
|
|
83
|
+
var _temp = {};
|
|
84
|
+
queryPlanData.eventPlanAndRealDataDiff.map(function (item) {
|
|
85
|
+
if (item.eventName == (eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_name)) _temp = item;
|
|
86
|
+
});
|
|
87
|
+
return Object.keys(_temp).length <= 0 ? true : ((_temp2 = _temp) === null || _temp2 === void 0 ? void 0 : (_temp2$attrList = _temp2.attrList) === null || _temp2$attrList === void 0 ? void 0 : _temp2$attrList.indexOf(name)) == -1 ? true : false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// 用户属性列表
|
|
92
|
+
var _useState11 = useState([]),
|
|
93
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
94
|
+
userAttrData = _useState12[0],
|
|
95
|
+
setUserAttrData = _useState12[1];
|
|
96
|
+
var queryUserPropMeta = function queryUserPropMeta() {
|
|
97
|
+
request(apis.getUserPropMeta, {
|
|
98
|
+
method: 'post',
|
|
99
|
+
data: {
|
|
100
|
+
appId: getAppID(currentApp),
|
|
101
|
+
platform: 0
|
|
102
|
+
}
|
|
103
|
+
}).then(function (res) {
|
|
104
|
+
if (!res) throw new Error();
|
|
105
|
+
var afterData = res.data.filter(function (item) {
|
|
106
|
+
if (item.dimension_sub == 'user_attr' || uniqueAttrs.includes(item.dimension_sub)) {
|
|
107
|
+
return item;
|
|
108
|
+
}
|
|
109
|
+
}) // 业务不展示
|
|
110
|
+
.filter(function (item) {
|
|
111
|
+
return item.attr_id != 31415926;
|
|
112
|
+
});
|
|
113
|
+
setUserAttrData(afterData);
|
|
114
|
+
setLoading(false);
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
useEffect(function () {
|
|
118
|
+
if (source == 'user') {
|
|
119
|
+
queryUserPropMeta();
|
|
120
|
+
} else {
|
|
121
|
+
var _temp = eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_attrs.map(function (item) {
|
|
122
|
+
item.name = item.attr_name;
|
|
123
|
+
item.type = item.prop_type;
|
|
124
|
+
return item;
|
|
125
|
+
}) // 业务不展示
|
|
126
|
+
.filter(function (item) {
|
|
127
|
+
return item.attr_id != 31415926;
|
|
128
|
+
});
|
|
129
|
+
setUserAttrData(_temp);
|
|
130
|
+
setLoading(false);
|
|
131
|
+
}
|
|
132
|
+
}, [source, eventAttrsData]);
|
|
133
|
+
// 复制属性名称
|
|
134
|
+
var copyAttrName = function copyAttrName(name) {
|
|
135
|
+
if (navigator.clipboard) {
|
|
136
|
+
navigator.clipboard.writeText(name);
|
|
137
|
+
message.success('复制成功');
|
|
138
|
+
} else {
|
|
139
|
+
var eventCopyer = function eventCopyer(event) {
|
|
140
|
+
event.preventDefault();
|
|
141
|
+
event.clipboardData.setData('text/plain', name);
|
|
142
|
+
};
|
|
143
|
+
document.addEventListener('copy', eventCopyer);
|
|
144
|
+
document.execCommand('copy');
|
|
145
|
+
document.removeEventListener('copy', eventCopyer);
|
|
146
|
+
message.success('复制成功');
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
// 别名foucs
|
|
150
|
+
var _useState13 = useState(''),
|
|
151
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
152
|
+
aliasFocusData = _useState14[0],
|
|
153
|
+
setAliasFocusData = _useState14[1];
|
|
154
|
+
var aliasFocus = function aliasFocus(e) {
|
|
155
|
+
setAliasFocusData(e.currentTarget.value);
|
|
156
|
+
};
|
|
157
|
+
// 修改属性
|
|
158
|
+
var attrChangeHandle = function attrChangeHandle(value, record, type) {
|
|
159
|
+
if (aliasFocusData == value && type == 'alias_name') return; // 失焦判断,内容无修改不请求接口
|
|
160
|
+
if (source == 'event') {
|
|
161
|
+
var _data;
|
|
162
|
+
request(apis.updateEventAttr, {
|
|
163
|
+
method: 'post',
|
|
164
|
+
data: (_data = {
|
|
165
|
+
appId: getAppID(currentApp),
|
|
166
|
+
attrId: record.attr_id
|
|
167
|
+
}, _defineProperty(_data, type, value), _defineProperty(_data, "eventId", eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id), _data)
|
|
168
|
+
}).then(function (res) {
|
|
169
|
+
if (res) {
|
|
170
|
+
message.success('修改成功');
|
|
171
|
+
props.Refresh();
|
|
172
|
+
state.updateEventMetas && state.updateEventMetas(); // 更新store
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
} else {
|
|
176
|
+
var _params;
|
|
177
|
+
request(apis.updateUserAttr, {
|
|
178
|
+
method: 'post',
|
|
179
|
+
params: (_params = {
|
|
180
|
+
app_id: getAppID(currentApp),
|
|
181
|
+
attr_id: record.id
|
|
182
|
+
}, _defineProperty(_params, type, value), _defineProperty(_params, "event_id", null), _params)
|
|
183
|
+
}).then(function (res) {
|
|
184
|
+
if (res) {
|
|
185
|
+
message.success('修改成功');
|
|
186
|
+
queryUserPropMeta();
|
|
187
|
+
state.updateEventMetas && state.updateEventMetas(); // 更新store
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
// 勾选数据
|
|
193
|
+
var _useState15 = useState([]),
|
|
194
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
195
|
+
checkedData = _useState16[0],
|
|
196
|
+
setCheckedData = _useState16[1];
|
|
197
|
+
useEffect(function () {
|
|
198
|
+
props.selectAttrList && setCheckedData(props.selectAttrList.map(function (item) {
|
|
199
|
+
return item.id;
|
|
200
|
+
}));
|
|
201
|
+
}, [props.selectAttrList]);
|
|
202
|
+
var attrItemCheckbox = function attrItemCheckbox(e, data) {
|
|
203
|
+
var _checkedData = _.cloneDeep(checkedData);
|
|
204
|
+
if (e.target.checked) {
|
|
205
|
+
_checkedData.push(data.id);
|
|
206
|
+
} else {
|
|
207
|
+
_.remove(_checkedData, function (x) {
|
|
208
|
+
return x === data.id;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
setCheckedData(_checkedData);
|
|
212
|
+
props.setSelectEventList && props.setSelectEventList(userAttrData.filter(function (item) {
|
|
213
|
+
return _checkedData.includes(item.id);
|
|
214
|
+
}));
|
|
215
|
+
};
|
|
216
|
+
// 表格列表筛选项
|
|
217
|
+
var _useState17 = useState(''),
|
|
218
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
219
|
+
name = _useState18[0],
|
|
220
|
+
setName = _useState18[1];
|
|
221
|
+
var _useState19 = useState(0),
|
|
222
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
223
|
+
type = _useState20[0],
|
|
224
|
+
setType = _useState20[1];
|
|
225
|
+
var _useState21 = useState(-1),
|
|
226
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
227
|
+
hidden = _useState22[0],
|
|
228
|
+
setHidden = _useState22[1];
|
|
229
|
+
var _useState23 = useState(-1),
|
|
230
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
231
|
+
encryption_type = _useState24[0],
|
|
232
|
+
setEncryptionType = _useState24[1];
|
|
233
|
+
var _useState25 = useState(''),
|
|
234
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
235
|
+
category = _useState26[0],
|
|
236
|
+
setCategory = _useState26[1];
|
|
237
|
+
var _useState27 = useState(''),
|
|
238
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
239
|
+
owner = _useState28[0],
|
|
240
|
+
setOwner = _useState28[1];
|
|
241
|
+
// 表格列
|
|
242
|
+
var columns = [{
|
|
243
|
+
title: '属性名称',
|
|
244
|
+
dataIndex: 'name',
|
|
245
|
+
fixed: 'left',
|
|
246
|
+
width: 200,
|
|
247
|
+
render: function render(text, record, index) {
|
|
248
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
249
|
+
className: "attr-name"
|
|
250
|
+
}, props.isSelect && (/*#__PURE__*/React.createElement(Checkbox, {
|
|
251
|
+
checked: checkedData.includes(record.id),
|
|
252
|
+
onChange: function onChange(e) {
|
|
253
|
+
return attrItemCheckbox(e, record);
|
|
254
|
+
}
|
|
255
|
+
})), rowRenderHandle(record.name) && (/*#__PURE__*/React.createElement(Popover, {
|
|
256
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
257
|
+
style: {
|
|
258
|
+
color: 'red'
|
|
259
|
+
}
|
|
260
|
+
}, "\u4E0D\u5728\u65B9\u6848\u4E2D")
|
|
261
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
262
|
+
type: "tishiicon"
|
|
263
|
+
}))), /*#__PURE__*/React.createElement(Popover, {
|
|
264
|
+
content: text
|
|
265
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
266
|
+
className: "attr-name-text"
|
|
267
|
+
}, text)), /*#__PURE__*/React.createElement(IconFont, {
|
|
268
|
+
onClick: function onClick() {
|
|
269
|
+
return copyAttrName(record.name);
|
|
270
|
+
},
|
|
271
|
+
type: "fuzhi"
|
|
272
|
+
}));
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
275
|
+
title: '别名',
|
|
276
|
+
dataIndex: 'alias_name',
|
|
277
|
+
width: 180,
|
|
278
|
+
render: function render(text, record, index) {
|
|
279
|
+
if (!record.alias_name) {
|
|
280
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
281
|
+
className: "alias_name",
|
|
282
|
+
placeholder: "\u7F16\u8F91\u522B\u540D",
|
|
283
|
+
disabled: isDemo || !authority[1722838507] || record.isIdMappingProp || record.category === 'fixed',
|
|
284
|
+
defaultValue: record.alias_name,
|
|
285
|
+
onFocus: aliasFocus,
|
|
286
|
+
onBlur: function onBlur(e) {
|
|
287
|
+
attrChangeHandle(e.currentTarget.value, record, 'alias_name');
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
} else {
|
|
291
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
292
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
style: {
|
|
294
|
+
width: '200px',
|
|
295
|
+
wordBreak: 'break-all'
|
|
296
|
+
}
|
|
297
|
+
}, record.alias_name),
|
|
298
|
+
trigger: "hover",
|
|
299
|
+
placement: "top"
|
|
300
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
301
|
+
className: "alias_name",
|
|
302
|
+
placeholder: "\u7F16\u8F91\u522B\u540D",
|
|
303
|
+
disabled: isDemo || !authority[1722838507] || record.isIdMappingProp || record.category === 'fixed',
|
|
304
|
+
defaultValue: record.alias_name,
|
|
305
|
+
onFocus: aliasFocus,
|
|
306
|
+
onBlur: function onBlur(e) {
|
|
307
|
+
attrChangeHandle(e.currentTarget.value, record, 'alias_name');
|
|
308
|
+
}
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}].concat(_toConsumableArray(source == 'event' ? [{
|
|
313
|
+
title: '属性值别名',
|
|
314
|
+
width: 120,
|
|
315
|
+
render: function render(record) {
|
|
316
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && (/*#__PURE__*/React.createElement("span", {
|
|
317
|
+
className: "attr_alias_name ".concat(isDemo || record.isIdMappingProp || record.category === 'fixed' ? 'disabled' : ''),
|
|
318
|
+
onClick: function onClick() {
|
|
319
|
+
if (record.isIdMappingProp || record.category === 'fixed') return;
|
|
320
|
+
if (isDemo) {
|
|
321
|
+
message.error('demo环境,无法编辑');
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
setattrId(record.attr_id);
|
|
325
|
+
setAttrAliasNameShow(true);
|
|
326
|
+
}
|
|
327
|
+
}, record.value_dict ? '已编辑' : '编辑')));
|
|
328
|
+
}
|
|
329
|
+
}] : []), [{
|
|
330
|
+
title: (/*#__PURE__*/React.createElement(Select, {
|
|
331
|
+
defaultValue: 0,
|
|
332
|
+
style: {
|
|
333
|
+
width: 100
|
|
334
|
+
},
|
|
335
|
+
onChange: function onChange(e) {
|
|
336
|
+
return setType(e);
|
|
337
|
+
},
|
|
338
|
+
options: [{
|
|
339
|
+
value: 0,
|
|
340
|
+
label: '属性类型'
|
|
341
|
+
}, {
|
|
342
|
+
value: 1,
|
|
343
|
+
label: '字符串'
|
|
344
|
+
}, {
|
|
345
|
+
value: 2,
|
|
346
|
+
label: '数值'
|
|
347
|
+
}, {
|
|
348
|
+
value: 3,
|
|
349
|
+
label: '日期'
|
|
350
|
+
}],
|
|
351
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
352
|
+
type: "xiangxia",
|
|
353
|
+
style: {
|
|
354
|
+
color: '#021429'
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
})),
|
|
358
|
+
dataIndex: 'type',
|
|
359
|
+
width: 120,
|
|
360
|
+
render: function render(text, record, index) {
|
|
361
|
+
var json = {
|
|
362
|
+
1: '字符串',
|
|
363
|
+
2: '数值',
|
|
364
|
+
3: '日期'
|
|
365
|
+
};
|
|
366
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && (/*#__PURE__*/React.createElement(Select, {
|
|
367
|
+
defaultValue: record.type,
|
|
368
|
+
style: {
|
|
369
|
+
width: 100
|
|
370
|
+
},
|
|
371
|
+
disabled: isDemo || record.isIdMappingProp || record.category === 'fixed',
|
|
372
|
+
onChange: function onChange(e) {
|
|
373
|
+
return attrChangeHandle(e, record, 'type');
|
|
374
|
+
},
|
|
375
|
+
options: [{
|
|
376
|
+
value: 1,
|
|
377
|
+
label: '字符串'
|
|
378
|
+
}, {
|
|
379
|
+
value: 2,
|
|
380
|
+
label: '数值'
|
|
381
|
+
}, {
|
|
382
|
+
value: 3,
|
|
383
|
+
label: '日期'
|
|
384
|
+
}],
|
|
385
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
386
|
+
type: "xiangxia",
|
|
387
|
+
style: {
|
|
388
|
+
color: '#021429'
|
|
389
|
+
}
|
|
390
|
+
})
|
|
391
|
+
})), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, json[record.type]));
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
title: (/*#__PURE__*/React.createElement(Select, {
|
|
395
|
+
defaultValue: -1,
|
|
396
|
+
style: {
|
|
397
|
+
width: 100
|
|
398
|
+
},
|
|
399
|
+
onChange: function onChange(e) {
|
|
400
|
+
return setHidden(e);
|
|
401
|
+
},
|
|
402
|
+
options: [{
|
|
403
|
+
value: -1,
|
|
404
|
+
label: '显示状态'
|
|
405
|
+
}, {
|
|
406
|
+
value: 1,
|
|
407
|
+
label: '隐藏'
|
|
408
|
+
}, {
|
|
409
|
+
value: 0,
|
|
410
|
+
label: '显示'
|
|
411
|
+
}],
|
|
412
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
413
|
+
type: "xiangxia",
|
|
414
|
+
style: {
|
|
415
|
+
color: '#021429'
|
|
416
|
+
}
|
|
417
|
+
})
|
|
418
|
+
})),
|
|
419
|
+
dataIndex: 'hidden',
|
|
420
|
+
width: 120,
|
|
421
|
+
render: function render(text, record, index) {
|
|
422
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && (/*#__PURE__*/React.createElement(Select, {
|
|
423
|
+
defaultValue: record.hidden || 0,
|
|
424
|
+
style: {
|
|
425
|
+
width: 100
|
|
426
|
+
},
|
|
427
|
+
disabled: isDemo || record.isIdMappingProp || record.category === 'fixed',
|
|
428
|
+
onChange: function onChange(e) {
|
|
429
|
+
return attrChangeHandle(e, record, 'hidden');
|
|
430
|
+
},
|
|
431
|
+
options: [{
|
|
432
|
+
value: 1,
|
|
433
|
+
label: '隐藏'
|
|
434
|
+
}, {
|
|
435
|
+
value: 0,
|
|
436
|
+
label: '显示'
|
|
437
|
+
}],
|
|
438
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
439
|
+
type: "xiangxia",
|
|
440
|
+
style: {
|
|
441
|
+
color: '#021429'
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
})), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, record.hidden == 1 ? '隐藏' : '显示'));
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
447
|
+
title: (/*#__PURE__*/React.createElement(Select, {
|
|
448
|
+
defaultValue: -1,
|
|
449
|
+
style: {
|
|
450
|
+
width: 100
|
|
451
|
+
},
|
|
452
|
+
onChange: function onChange(e) {
|
|
453
|
+
return setEncryptionType(e);
|
|
454
|
+
},
|
|
455
|
+
options: [{
|
|
456
|
+
value: -1,
|
|
457
|
+
label: '加密方式'
|
|
458
|
+
}, {
|
|
459
|
+
value: 0,
|
|
460
|
+
label: '不加密'
|
|
461
|
+
}, {
|
|
462
|
+
value: 1,
|
|
463
|
+
label: '半加密'
|
|
464
|
+
}, {
|
|
465
|
+
value: 2,
|
|
466
|
+
label: '全加密'
|
|
467
|
+
}],
|
|
468
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
469
|
+
type: "xiangxia",
|
|
470
|
+
style: {
|
|
471
|
+
color: '#021429'
|
|
472
|
+
}
|
|
473
|
+
})
|
|
474
|
+
})),
|
|
475
|
+
dataIndex: 'encryption_type',
|
|
476
|
+
width: 120,
|
|
477
|
+
render: function render(text, record, index) {
|
|
478
|
+
var json = {
|
|
479
|
+
0: '不加密',
|
|
480
|
+
1: '半加密',
|
|
481
|
+
2: '全加密'
|
|
482
|
+
};
|
|
483
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && (/*#__PURE__*/React.createElement(Select, {
|
|
484
|
+
defaultValue: record.encryption_type,
|
|
485
|
+
style: {
|
|
486
|
+
width: 100
|
|
487
|
+
},
|
|
488
|
+
disabled: isDemo || record.isIdMappingProp,
|
|
489
|
+
onChange: function onChange(e) {
|
|
490
|
+
return attrChangeHandle(e, record, 'encryption_type');
|
|
491
|
+
},
|
|
492
|
+
options: [{
|
|
493
|
+
value: 0,
|
|
494
|
+
label: '不加密'
|
|
495
|
+
}, {
|
|
496
|
+
value: 1,
|
|
497
|
+
label: '半加密'
|
|
498
|
+
}, {
|
|
499
|
+
value: 2,
|
|
500
|
+
label: '全加密'
|
|
501
|
+
}],
|
|
502
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
503
|
+
type: "xiangxia",
|
|
504
|
+
style: {
|
|
505
|
+
color: '#021429'
|
|
506
|
+
}
|
|
507
|
+
})
|
|
508
|
+
})), rowRenderHandle(record.name) && /*#__PURE__*/React.createElement("div", null, json[record.encryption_type]));
|
|
509
|
+
}
|
|
510
|
+
}], _toConsumableArray(source === 'user' ? [{
|
|
511
|
+
title: '属性值别名',
|
|
512
|
+
width: 120,
|
|
513
|
+
render: function render(record) {
|
|
514
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !rowRenderHandle(record.name) && (/*#__PURE__*/React.createElement("span", {
|
|
515
|
+
className: "attr_alias_name ".concat(isDemo || record.isIdMappingProp || record.category === 'fixed' ? 'disabled' : ''),
|
|
516
|
+
onClick: function onClick() {
|
|
517
|
+
if (!authority[1722838507]) {
|
|
518
|
+
message.error('无编辑权限');
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
if (record.isIdMappingProp || record.category === 'fixed') return;
|
|
522
|
+
if (isDemo) {
|
|
523
|
+
message.error('demo环境,无法编辑');
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
setattrId(record.id);
|
|
527
|
+
setAttrAliasNameShow(true);
|
|
528
|
+
}
|
|
529
|
+
}, record.value_dict ? '已编辑' : '编辑')));
|
|
530
|
+
}
|
|
531
|
+
}] : []), _toConsumableArray(source === 'user' ? [{
|
|
532
|
+
title: (/*#__PURE__*/React.createElement(Select, {
|
|
533
|
+
defaultValue: '',
|
|
534
|
+
style: {
|
|
535
|
+
width: 100
|
|
536
|
+
},
|
|
537
|
+
onChange: function onChange(e) {
|
|
538
|
+
return setCategory(e);
|
|
539
|
+
},
|
|
540
|
+
options: [{
|
|
541
|
+
value: '',
|
|
542
|
+
label: '来源'
|
|
543
|
+
}, {
|
|
544
|
+
value: 'fixed',
|
|
545
|
+
label: '内置'
|
|
546
|
+
}, {
|
|
547
|
+
value: 'custom',
|
|
548
|
+
label: '自定义'
|
|
549
|
+
}],
|
|
550
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
551
|
+
type: "xiangxia",
|
|
552
|
+
style: {
|
|
553
|
+
color: '#021429'
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
})),
|
|
557
|
+
dataIndex: 'category',
|
|
558
|
+
width: 120,
|
|
559
|
+
render: function render(category) {
|
|
560
|
+
var json = {
|
|
561
|
+
fixed: '内置',
|
|
562
|
+
custom: '自定义'
|
|
563
|
+
};
|
|
564
|
+
return /*#__PURE__*/React.createElement("div", null, json[category]);
|
|
565
|
+
}
|
|
566
|
+
}, {
|
|
567
|
+
title: '创建人',
|
|
568
|
+
dataIndex: 'creatorName',
|
|
569
|
+
width: 100,
|
|
570
|
+
render: function render(creatorName) {
|
|
571
|
+
return /*#__PURE__*/React.createElement("div", null, creatorName || '-');
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
title: '创建时间',
|
|
575
|
+
dataIndex: 'createdTime',
|
|
576
|
+
sorter: function sorter(a, b) {
|
|
577
|
+
return (a.createdTime || 0) - (b.createdTime || 0);
|
|
578
|
+
},
|
|
579
|
+
width: 221,
|
|
580
|
+
render: function render(createdTime) {
|
|
581
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, createdTime ? moment(createdTime).format('YYYY-MM-DD HH:mm:ss') : '-');
|
|
582
|
+
}
|
|
583
|
+
}] : [{
|
|
584
|
+
title: (/*#__PURE__*/React.createElement(Select, {
|
|
585
|
+
defaultValue: '',
|
|
586
|
+
style: {
|
|
587
|
+
width: 100
|
|
588
|
+
},
|
|
589
|
+
onChange: function onChange(e) {
|
|
590
|
+
return setOwner(e);
|
|
591
|
+
},
|
|
592
|
+
options: [{
|
|
593
|
+
value: '',
|
|
594
|
+
label: '来源'
|
|
595
|
+
}, {
|
|
596
|
+
value: 'zg_abp',
|
|
597
|
+
label: '内置'
|
|
598
|
+
}, {
|
|
599
|
+
value: 'zg',
|
|
600
|
+
label: '自定义'
|
|
601
|
+
}],
|
|
602
|
+
suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
603
|
+
type: "xiangxia",
|
|
604
|
+
style: {
|
|
605
|
+
color: '#021429'
|
|
606
|
+
}
|
|
607
|
+
})
|
|
608
|
+
})),
|
|
609
|
+
dataIndex: 'owner',
|
|
610
|
+
width: 120,
|
|
611
|
+
render: function render(owner) {
|
|
612
|
+
var json = {
|
|
613
|
+
zg_abp: '内置',
|
|
614
|
+
zg: '自定义'
|
|
615
|
+
};
|
|
616
|
+
return /*#__PURE__*/React.createElement("div", null, json[owner]);
|
|
617
|
+
}
|
|
618
|
+
}]), [{
|
|
619
|
+
title: '操作',
|
|
620
|
+
width: 72,
|
|
621
|
+
fixed: 'right',
|
|
622
|
+
render: function render(record) {
|
|
623
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
624
|
+
type: "link",
|
|
625
|
+
style: {
|
|
626
|
+
padding: 0
|
|
627
|
+
},
|
|
628
|
+
disabled: record.category === 'fixed' || !authority[1722838563],
|
|
629
|
+
onClick: function onClick() {
|
|
630
|
+
if (!authority[1722838563]) {
|
|
631
|
+
message.error('无删除权限');
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
saveRemoveAttrData(record);
|
|
635
|
+
}
|
|
636
|
+
}, "\u5220\u9664");
|
|
637
|
+
}
|
|
638
|
+
}]);
|
|
639
|
+
// 删除属性
|
|
640
|
+
var _useState29 = useState(),
|
|
641
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
642
|
+
removeAttrData = _useState30[0],
|
|
643
|
+
setRemoveAttrData = _useState30[1];
|
|
644
|
+
var saveRemoveAttrData = function saveRemoveAttrData(record) {
|
|
645
|
+
if (isDemo) {
|
|
646
|
+
message.error('demo环境,无法删除');
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
setRemoveAttrData(record);
|
|
650
|
+
setIsShowDel(true);
|
|
651
|
+
};
|
|
652
|
+
var removeAttr = function removeAttr(callback) {
|
|
653
|
+
request(source === 'event' ? apis.delEventAttr : apis.deleteUserPropMeta, {
|
|
654
|
+
method: 'post',
|
|
655
|
+
data: {
|
|
656
|
+
app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
657
|
+
id: source === 'event' ? removeAttrData === null || removeAttrData === void 0 ? void 0 : removeAttrData.attr_id : removeAttrData === null || removeAttrData === void 0 ? void 0 : removeAttrData.id
|
|
658
|
+
}
|
|
659
|
+
}).then(function (res) {
|
|
660
|
+
if ((res === null || res === void 0 ? void 0 : res.code) === '100000' || (res === null || res === void 0 ? void 0 : res.code) === '108000') {
|
|
661
|
+
message.success('修改成功');
|
|
662
|
+
if (source == 'user') {
|
|
663
|
+
queryUserPropMeta();
|
|
664
|
+
} else {
|
|
665
|
+
props.Refresh();
|
|
666
|
+
}
|
|
667
|
+
callback();
|
|
668
|
+
setIsShowDel(false);
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
};
|
|
672
|
+
// 属性值别名 - 表格列
|
|
673
|
+
var attrColumns = [{
|
|
674
|
+
title: '属性值',
|
|
675
|
+
dataIndex: 'original_value'
|
|
676
|
+
}, {
|
|
677
|
+
title: '属性值别名',
|
|
678
|
+
dataIndex: 'mapping_value'
|
|
679
|
+
}];
|
|
680
|
+
var _useState31 = useState([]),
|
|
681
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
682
|
+
attrExcelData = _useState32[0],
|
|
683
|
+
setAttrExcelData = _useState32[1];
|
|
684
|
+
var _useState33 = useState(false),
|
|
685
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
|
686
|
+
attrAliasNameShow = _useState34[0],
|
|
687
|
+
setAttrAliasNameShow = _useState34[1];
|
|
688
|
+
var _useState35 = useState(0),
|
|
689
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
|
690
|
+
attrId = _useState36[0],
|
|
691
|
+
setattrId = _useState36[1];
|
|
692
|
+
var _useState37 = useState(0),
|
|
693
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
|
694
|
+
batchId = _useState38[0],
|
|
695
|
+
setBatchId = _useState38[1];
|
|
696
|
+
var _useState39 = useState(false),
|
|
697
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
|
698
|
+
exportAliasTmp = _useState40[0],
|
|
699
|
+
setExportAliasTmp = _useState40[1];
|
|
700
|
+
var uploadProps = {
|
|
701
|
+
maxCount: 1,
|
|
702
|
+
showUploadList: false,
|
|
703
|
+
beforeUpload: function beforeUpload(file) {
|
|
704
|
+
setValueLoading(true);
|
|
705
|
+
var formData = new FormData();
|
|
706
|
+
formData.append('file', file, file.name);
|
|
707
|
+
var data = new FormData();
|
|
708
|
+
data.append('upload', file);
|
|
709
|
+
data.append('attr_id', attrId);
|
|
710
|
+
data.append('app_id', getAppID(currentApp));
|
|
711
|
+
source == 'event' ? data.append('event_id', eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id) : null;
|
|
712
|
+
request(apis.propUpload, {
|
|
713
|
+
method: 'post',
|
|
714
|
+
data: data
|
|
715
|
+
}).then(function (res) {
|
|
716
|
+
if (res.code == 10001) {
|
|
717
|
+
message.success('上传成功');
|
|
718
|
+
setBatchId(res.batch_id);
|
|
719
|
+
setAttrExcelData(res.values);
|
|
720
|
+
setValueLoading(false);
|
|
721
|
+
} else {
|
|
722
|
+
message.error(res.msg);
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
// 清空属性值别名excel数据
|
|
729
|
+
var _useState41 = useState(false),
|
|
730
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
731
|
+
clearFlag = _useState42[0],
|
|
732
|
+
setClearFlag = _useState42[1];
|
|
733
|
+
var clearData = function clearData() {
|
|
734
|
+
setAttrExcelData([]);
|
|
735
|
+
setClearFlag(true);
|
|
736
|
+
};
|
|
737
|
+
// 添加&修改用户属性值别名
|
|
738
|
+
var attrAliasNameEdit = function attrAliasNameEdit() {
|
|
739
|
+
setValueLoading(true);
|
|
740
|
+
request(apis.addPropDict, {
|
|
741
|
+
method: 'post',
|
|
742
|
+
params: {
|
|
743
|
+
app_id: getAppID(currentApp),
|
|
744
|
+
attr_id: attrId,
|
|
745
|
+
batch_id: batchId,
|
|
746
|
+
event_id: source == 'event' ? eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id : null,
|
|
747
|
+
status: 'ok',
|
|
748
|
+
clear: clearFlag
|
|
749
|
+
}
|
|
750
|
+
}).then(function (res) {
|
|
751
|
+
if (res) {
|
|
752
|
+
message.success('操作成功');
|
|
753
|
+
closeHandle();
|
|
754
|
+
if (source == 'user') {
|
|
755
|
+
queryUserPropMeta();
|
|
756
|
+
} else {
|
|
757
|
+
props.Refresh();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
};
|
|
762
|
+
// 获取已设置的属性值别名列表
|
|
763
|
+
var getAttrAliasList = function getAttrAliasList() {
|
|
764
|
+
setValueLoading(true);
|
|
765
|
+
request(apis.queryPropDict, {
|
|
766
|
+
method: 'post',
|
|
767
|
+
params: {
|
|
768
|
+
app_id: getAppID(currentApp),
|
|
769
|
+
attr_id: attrId,
|
|
770
|
+
event_id: source == 'event' ? eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id : null
|
|
771
|
+
}
|
|
772
|
+
}).then(function (res) {
|
|
773
|
+
if (res) {
|
|
774
|
+
setAttrExcelData(res.values);
|
|
775
|
+
setValueLoading(false);
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
};
|
|
779
|
+
useEffect(function () {
|
|
780
|
+
if (attrId) {
|
|
781
|
+
getAttrAliasList();
|
|
782
|
+
}
|
|
783
|
+
}, [attrId]);
|
|
784
|
+
var closeHandle = function closeHandle() {
|
|
785
|
+
setattrId(0);
|
|
786
|
+
setAttrAliasNameShow(false);
|
|
787
|
+
setClearFlag(false);
|
|
788
|
+
setValueLoading(false);
|
|
789
|
+
setAttrExcelData([]);
|
|
790
|
+
};
|
|
791
|
+
var _useState43 = useState(''),
|
|
792
|
+
_useState44 = _slicedToArray(_useState43, 2),
|
|
793
|
+
scrollY = _useState44[0],
|
|
794
|
+
setScrollY = _useState44[1];
|
|
795
|
+
//页面加载完成后才能获取到对应的元素及其位置
|
|
796
|
+
useEffect(function () {
|
|
797
|
+
var _Y = getTableScroll(60, 'dataManageAttrTable');
|
|
798
|
+
// console.log('_Y', _Y);
|
|
799
|
+
setScrollY(_Y);
|
|
800
|
+
}, []);
|
|
801
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
802
|
+
className: classPrefix
|
|
803
|
+
}, source == 'user' && (/*#__PURE__*/React.createElement("div", {
|
|
804
|
+
className: "".concat(classPrefix, "-top-box")
|
|
805
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
806
|
+
className: "top-input",
|
|
807
|
+
value: name,
|
|
808
|
+
onChange: function onChange(e) {
|
|
809
|
+
setName(e.target.value);
|
|
810
|
+
},
|
|
811
|
+
placeholder: "\u8BF7\u8F93\u5165\u4E8B\u4EF6\u540D\u79F0\u6216\u522B\u540D",
|
|
812
|
+
prefix: /*#__PURE__*/React.createElement(IconFont, {
|
|
813
|
+
type: "sousuo"
|
|
814
|
+
})
|
|
815
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
816
|
+
className: "top-total"
|
|
817
|
+
}, "\u5171", /*#__PURE__*/React.createElement("span", null, userAttrData.filter(function (item) {
|
|
818
|
+
return new RegExp(_.escapeRegExp(name), 'i').test((item.name || '') + (item.alias_name || ''));
|
|
819
|
+
}).filter(function (item) {
|
|
820
|
+
return type < 1 || item.type === type;
|
|
821
|
+
}).filter(function (item) {
|
|
822
|
+
return hidden < 0 || item.hidden === hidden;
|
|
823
|
+
}).filter(function (item) {
|
|
824
|
+
return encryption_type < 0 || item.encryption_type === encryption_type;
|
|
825
|
+
}).filter(function (item) {
|
|
826
|
+
return category == '' || item.category === category;
|
|
827
|
+
}).length), "\u6761"), /*#__PURE__*/React.createElement("div", {
|
|
828
|
+
className: "top-button"
|
|
829
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
830
|
+
shape: "round",
|
|
831
|
+
type: 'primary',
|
|
832
|
+
disabled: !authority[1722838073],
|
|
833
|
+
className: "button",
|
|
834
|
+
onClick: function onClick() {
|
|
835
|
+
return setCreateAttrShow(true);
|
|
836
|
+
}
|
|
837
|
+
}, "\u521B\u5EFA\u5C5E\u6027"), /*#__PURE__*/React.createElement(Button, {
|
|
838
|
+
shape: "round",
|
|
839
|
+
className: "button",
|
|
840
|
+
disabled: isDemo || !authority[1722838544],
|
|
841
|
+
onClick: function onClick() {
|
|
842
|
+
return setOpenImportModal(true);
|
|
843
|
+
}
|
|
844
|
+
}, "\u5BFC\u5165\u5C5E\u6027")))), /*#__PURE__*/React.createElement(Table, {
|
|
845
|
+
className: "".concat(classPrefix, "-table"),
|
|
846
|
+
columns: columns,
|
|
847
|
+
id: 'dataManageAttrTable',
|
|
848
|
+
rowKey: "name",
|
|
849
|
+
loading: loading,
|
|
850
|
+
scroll: {
|
|
851
|
+
y: scrollY
|
|
852
|
+
},
|
|
853
|
+
rowClassName: function rowClassName(record, index) {
|
|
854
|
+
return rowRenderHandle(record.name) ? 'error-row' : '';
|
|
855
|
+
},
|
|
856
|
+
dataSource: userAttrData.filter(function (item) {
|
|
857
|
+
return new RegExp(_.escapeRegExp(name), 'i').test((item.name || '') + (item.alias_name || ''));
|
|
858
|
+
}).filter(function (item) {
|
|
859
|
+
return type < 1 || item.type === type;
|
|
860
|
+
}).filter(function (item) {
|
|
861
|
+
return hidden < 0 || item.hidden === hidden;
|
|
862
|
+
}).filter(function (item) {
|
|
863
|
+
return encryption_type < 0 || item.encryption_type === encryption_type;
|
|
864
|
+
}).filter(function (item) {
|
|
865
|
+
return category == '' || item.category === category;
|
|
866
|
+
}).filter(function (item) {
|
|
867
|
+
return owner == '' || item.owner === owner;
|
|
868
|
+
}),
|
|
869
|
+
pagination: false
|
|
870
|
+
}), /*#__PURE__*/React.createElement(Modal, {
|
|
871
|
+
title: "\u5C5E\u6027\u503C\u522B\u540D",
|
|
872
|
+
getContainer: false,
|
|
873
|
+
open: attrAliasNameShow,
|
|
874
|
+
onOk: attrAliasNameEdit,
|
|
875
|
+
onCancel: closeHandle
|
|
876
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
877
|
+
className: "button-box"
|
|
878
|
+
}, /*#__PURE__*/React.createElement(Upload, _objectSpread({}, uploadProps), /*#__PURE__*/React.createElement(Button, {
|
|
879
|
+
size: "small",
|
|
880
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
881
|
+
type: "daochu1"
|
|
882
|
+
})
|
|
883
|
+
}, "\u4E0A\u4F20 excel \u6587\u4EF6")), /*#__PURE__*/React.createElement(Button, {
|
|
884
|
+
loading: exportAliasTmp,
|
|
885
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
886
|
+
type: "xiazai1"
|
|
887
|
+
}),
|
|
888
|
+
size: "small",
|
|
889
|
+
onClick: function onClick() {
|
|
890
|
+
setExportAliasTmp(true);
|
|
891
|
+
ajax(apis.exportAliasTmp, {
|
|
892
|
+
method: 'get',
|
|
893
|
+
responseType: 'blob',
|
|
894
|
+
fileName: "".concat(source == 'user' ? (currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) != 'user' ? '主体' : '用户' : '事件', "\u5C5E\u6027\u503C\u6A21\u677F"),
|
|
895
|
+
getResponse: true,
|
|
896
|
+
params: {
|
|
897
|
+
fileName: "".concat(source == 'user' ? (currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) != 'user' ? '主体' : '用户' : '事件', "\u5C5E\u6027\u503C\u6A21\u677F.xlsx")
|
|
898
|
+
}
|
|
899
|
+
}).finally(function () {
|
|
900
|
+
setExportAliasTmp(false);
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
}, "\u6A21\u677F\u4E0B\u8F7D")), attrExcelData.length > 0 && (/*#__PURE__*/React.createElement("div", {
|
|
904
|
+
className: "clearData",
|
|
905
|
+
onClick: clearData
|
|
906
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
907
|
+
type: "qingchu"
|
|
908
|
+
}), "\u6E05\u7A7A\u6570\u636E")), /*#__PURE__*/React.createElement(Table, {
|
|
909
|
+
scroll: {
|
|
910
|
+
y: 200
|
|
911
|
+
},
|
|
912
|
+
loading: valueLoading,
|
|
913
|
+
columns: attrColumns,
|
|
914
|
+
rowKey: "mapping_value",
|
|
915
|
+
dataSource: attrExcelData,
|
|
916
|
+
pagination: false
|
|
917
|
+
})), /*#__PURE__*/React.createElement(CreateAttrDrawer, {
|
|
918
|
+
isShow: createAttrShow,
|
|
919
|
+
onClose: function onClose() {
|
|
920
|
+
return setCreateAttrShow(false);
|
|
921
|
+
},
|
|
922
|
+
onSubmit: function onSubmit() {
|
|
923
|
+
queryUserPropMeta();
|
|
924
|
+
setCreateAttrShow(false);
|
|
925
|
+
}
|
|
926
|
+
}), openImportModal ? (/*#__PURE__*/React.createElement(ImportModal, {
|
|
927
|
+
onCancel: function onCancel() {
|
|
928
|
+
setOpenImportModal(false);
|
|
929
|
+
},
|
|
930
|
+
onSuccess: function onSuccess() {
|
|
931
|
+
queryUserPropMeta();
|
|
932
|
+
setOpenImportModal(false);
|
|
933
|
+
}
|
|
934
|
+
})) : null, isShowDel ? (/*#__PURE__*/React.createElement(DelConfirm, {
|
|
935
|
+
onOk: function onOk(callback) {
|
|
936
|
+
removeAttr(callback);
|
|
937
|
+
},
|
|
938
|
+
onCancel: function onCancel() {
|
|
939
|
+
setIsShowDel(false);
|
|
940
|
+
}
|
|
941
|
+
})) : null);
|
|
942
|
+
};
|
|
943
|
+
export default CollectionAttributeList;
|