@zgfe/modules-dm 1.0.56-zhongyuan.27 → 1.0.56-zhongyuan.28

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.
@@ -52,6 +52,7 @@ declare let apis: {
52
52
  deleteUserPropMeta: string;
53
53
  delEventAttr: string;
54
54
  addEvent: string;
55
+ addEventAttr: string;
55
56
  uploadEvent: string;
56
57
  exportEvent: string;
57
58
  companyUsers: string;
@@ -101,6 +101,8 @@ var apis = {
101
101
  delEventAttr: '/zg/web/v2/event/delEventAttr',
102
102
  // 事件新增
103
103
  addEvent: '/zg/web/v2/event/addEvent',
104
+ //事件属性列表新增
105
+ addEventAttr: '/zg/web/v2/event/addEventAttr',
104
106
  // 用户属性-导入
105
107
  uploadEvent: '/zg/web/v2/event/upload',
106
108
  // 用户属性-导出
@@ -15,7 +15,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
15
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
16
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
17
17
  import { BizGlobalDataContext, IconFont, ajax } from '@zgfe/business-lib';
18
- import { Input, Button, Select, Table, message, Modal, Upload, Popover, Checkbox } from 'antd';
18
+ import { Input, Button, Select, Table, message, Modal, Upload, Popover, Checkbox, notification } from 'antd';
19
19
  import React, { useEffect, useState, useContext } from 'react';
20
20
  import './styles/index.less';
21
21
  import request from '../../utils/ajax';
@@ -25,6 +25,7 @@ import { getAppID, getTableScroll } from '../../utils';
25
25
  import CreateAttrDrawer from './components/createAttrDrawer';
26
26
  import ImportModal from './components/importAttrDialog';
27
27
  import DelConfirm from './components/deleteUserAttrConfirm';
28
+ import BizEditText from './components/editTxt';
28
29
  import _ from 'lodash';
29
30
  import moment from 'moment';
30
31
  var CollectionAttributeList = function CollectionAttributeList(props) {
@@ -674,11 +675,285 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
674
675
  }, "\u5220\u9664");
675
676
  }
676
677
  }]);
677
- // 删除属性
678
- var _useState29 = useState(),
678
+ // 新增属性
679
+ var _useState29 = useState(false),
679
680
  _useState30 = _slicedToArray(_useState29, 2),
680
- removeAttrData = _useState30[0],
681
- setRemoveAttrData = _useState30[1];
681
+ addAttrNameShow = _useState30[0],
682
+ setAddAttrNameShow = _useState30[1];
683
+ // 事件内容
684
+ var _useState31 = useState([]),
685
+ _useState32 = _slicedToArray(_useState31, 2),
686
+ eventAttrList = _useState32[0],
687
+ setEventAttrList = _useState32[1];
688
+ //新增表格属性
689
+ var addColumns = [{
690
+ title: '序号',
691
+ dataIndex: 'event_name',
692
+ key: 'event_name',
693
+ width: 64,
694
+ render: function render(text, record, index) {
695
+ return /*#__PURE__*/React.createElement("span", null, index + 1);
696
+ }
697
+ }, {
698
+ title: (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
699
+ style: {
700
+ color: '#FB5547',
701
+ marginRight: 8
702
+ }
703
+ }, "*"), "\u4E8B\u4EF6\u5C5E\u6027\u540D\u79F0")),
704
+ dataIndex: 'name',
705
+ key: 'name',
706
+ width: 264,
707
+ render: function render(text, record, index) {
708
+ return /*#__PURE__*/React.createElement("div", {
709
+ style: {
710
+ margin: '-10px 0'
711
+ }
712
+ }, /*#__PURE__*/React.createElement(BizEditText, {
713
+ value: text,
714
+ max: 128,
715
+ placeholder: '请输入事件属性名',
716
+ onChange: function onChange(e) {
717
+ // setIsChange(true);
718
+ changeItemInfo(index, 'name', e);
719
+ }
720
+ }));
721
+ }
722
+ }, {
723
+ title: '属性别名',
724
+ dataIndex: 'aliasName',
725
+ key: 'aliasName',
726
+ width: 264,
727
+ render: function render(aliasName, record, index) {
728
+ return /*#__PURE__*/React.createElement("div", {
729
+ style: {
730
+ margin: '-10px 0'
731
+ }
732
+ }, /*#__PURE__*/React.createElement(BizEditText, {
733
+ value: aliasName,
734
+ max: 128,
735
+ placeholder: '请输入属性别名',
736
+ onChange: function onChange(e) {
737
+ // setIsChange(true);
738
+ changeItemInfo(index, 'aliasName', e);
739
+ }
740
+ }));
741
+ }
742
+ }, {
743
+ title: (/*#__PURE__*/React.createElement("div", {
744
+ className: "".concat(classPrefix, "-content-select")
745
+ }, /*#__PURE__*/React.createElement("span", {
746
+ style: {
747
+ color: '#FB5547',
748
+ marginRight: 8
749
+ }
750
+ }, "*"), /*#__PURE__*/React.createElement(Select, {
751
+ defaultValue: 0,
752
+ style: {
753
+ width: 120,
754
+ margin: '-10px 0'
755
+ },
756
+ onChange: function onChange(e) {
757
+ return setType(e);
758
+ },
759
+ bordered: false,
760
+ className: "select-style",
761
+ suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
762
+ type: "xiangxia",
763
+ style: {
764
+ color: '#5f6085'
765
+ }
766
+ }),
767
+ // onChange={(e) => props.eventActiveFilter(e, 'event_hidden')}
768
+ options: [{
769
+ value: 0,
770
+ label: '属性类型'
771
+ }, {
772
+ value: 1,
773
+ label: '字符串'
774
+ }, {
775
+ value: 2,
776
+ label: '数值'
777
+ }, {
778
+ value: 3,
779
+ label: '日期'
780
+ }]
781
+ }))),
782
+ dataIndex: 'type',
783
+ key: 'type',
784
+ width: 148,
785
+ render: function render(type, record, index) {
786
+ return /*#__PURE__*/React.createElement("div", {
787
+ className: "".concat(classPrefix, "-content-select")
788
+ }, /*#__PURE__*/React.createElement(Select
789
+ // defaultValue={record.event_hidden}
790
+ , {
791
+ // defaultValue={record.event_hidden}
792
+ style: {
793
+ width: 120,
794
+ margin: '-10px 0'
795
+ },
796
+ value: type,
797
+ suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
798
+ type: "xiangxia",
799
+ style: {
800
+ color: '#5f6085'
801
+ }
802
+ }),
803
+ // disabled={rowClassNameHandle(record) == 'error-row' || isDemo ? true : false}
804
+ onChange: function onChange(e) {
805
+ // setIsChange(true);
806
+ changeItemInfo(index, 'type', e);
807
+ },
808
+ options: [{
809
+ value: 1,
810
+ label: '字符串'
811
+ }, {
812
+ value: 2,
813
+ label: '数值'
814
+ }, {
815
+ value: 3,
816
+ label: '日期'
817
+ }]
818
+ }));
819
+ }
820
+ }, {
821
+ title: (/*#__PURE__*/React.createElement("div", {
822
+ className: "".concat(classPrefix, "-content-select")
823
+ }, /*#__PURE__*/React.createElement("span", {
824
+ style: {
825
+ color: '#FB5547',
826
+ marginRight: 8
827
+ }
828
+ }, "*"), /*#__PURE__*/React.createElement(Select, {
829
+ defaultValue: -1,
830
+ bordered: false,
831
+ onChange: function onChange(e) {
832
+ return setEncryptionType(e);
833
+ },
834
+ style: {
835
+ width: 120,
836
+ margin: '-10px 0'
837
+ },
838
+ suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
839
+ type: "xiangxia",
840
+ style: {
841
+ color: '#5f6085'
842
+ }
843
+ }),
844
+ // onChange={(e) => props.eventActiveFilter(e, 'is_stop')}
845
+ options: [{
846
+ value: -1,
847
+ label: '加密方式'
848
+ }, {
849
+ value: 0,
850
+ label: '不加密'
851
+ }, {
852
+ value: 1,
853
+ label: '半加密'
854
+ }, {
855
+ value: 2,
856
+ label: '全加密'
857
+ }]
858
+ }))),
859
+ dataIndex: 'encryptionType',
860
+ key: 'encryptionType',
861
+ width: 148,
862
+ render: function render(encryptionType, record, index) {
863
+ return /*#__PURE__*/React.createElement("div", {
864
+ className: "".concat(classPrefix, "-content-select")
865
+ }, /*#__PURE__*/React.createElement(Select, {
866
+ value: encryptionType,
867
+ style: {
868
+ width: 120,
869
+ margin: '-10px 0'
870
+ },
871
+ suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
872
+ type: "xiangxia",
873
+ style: {
874
+ color: '#5f6085'
875
+ }
876
+ }),
877
+ // disabled={rowClassNameHandle(record) == 'error-row' || isDemo ? true : false}
878
+ onChange: function onChange(e) {
879
+ // setIsChange(true);
880
+ changeItemInfo(index, 'encryptionType', e);
881
+ },
882
+ options: [{
883
+ value: 0,
884
+ label: '不加密'
885
+ }, {
886
+ value: 1,
887
+ label: '半加密'
888
+ }, {
889
+ value: 2,
890
+ label: '全加密'
891
+ }]
892
+ }));
893
+ }
894
+ }, {
895
+ title: '操作',
896
+ dataIndex: 'set',
897
+ key: 'set',
898
+ width: 64,
899
+ render: function render(_, record, index) {
900
+ return /*#__PURE__*/React.createElement("a", {
901
+ className: "set ".concat(record.owner == 'zg_abp' ? 'set-error' : ''),
902
+ onClick: function onClick() {
903
+ return dealEventAttr(index);
904
+ }
905
+ }, "\u5220\u9664");
906
+ }
907
+ }];
908
+ // 删除新增属性
909
+ var dealEventAttr = function dealEventAttr(index) {
910
+ var dealData = _.clone(eventAttrList);
911
+ dealData.splice(index, 1);
912
+ setEventAttrList(dealData);
913
+ };
914
+ var changeItemInfo = function changeItemInfo(i, key, v) {
915
+ var dealData = _.clone(eventAttrList);
916
+ dealData[i][key] = v;
917
+ setEventAttrList(dealData);
918
+ };
919
+ //新增事件属性
920
+ var addAttrNameEdit = function addAttrNameEdit() {
921
+ if (eventAttrList.filter(function (item) {
922
+ return !item.name;
923
+ }).length) {
924
+ notification.warning({
925
+ message: '请输入事件属性名称'
926
+ });
927
+ return;
928
+ }
929
+ request(apis.addEventAttr, {
930
+ method: 'POST',
931
+ data: {
932
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
933
+ eventId: eventAttrsData === null || eventAttrsData === void 0 ? void 0 : eventAttrsData.event_id,
934
+ eventAttrList: eventAttrList
935
+ }
936
+ }).then(function (res) {
937
+ if ((res === null || res === void 0 ? void 0 : res.code) === '100000') {
938
+ notification.success({
939
+ message: '添加成功'
940
+ });
941
+ //重新获取列表
942
+ queryUserPropMeta();
943
+ setAddAttrNameShow(false);
944
+ } else {
945
+ notification.error({
946
+ message: '添加失败'
947
+ });
948
+ }
949
+ });
950
+ // setAddAttrNameShow(false);
951
+ };
952
+ // 删除属性
953
+ var _useState33 = useState(),
954
+ _useState34 = _slicedToArray(_useState33, 2),
955
+ removeAttrData = _useState34[0],
956
+ setRemoveAttrData = _useState34[1];
682
957
  var saveRemoveAttrData = function saveRemoveAttrData(record) {
683
958
  if (isDemo) {
684
959
  message.error('demo环境,无法删除');
@@ -715,26 +990,26 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
715
990
  title: '属性值别名',
716
991
  dataIndex: 'mapping_value'
717
992
  }];
718
- var _useState31 = useState([]),
719
- _useState32 = _slicedToArray(_useState31, 2),
720
- attrExcelData = _useState32[0],
721
- setAttrExcelData = _useState32[1];
722
- var _useState33 = useState(false),
723
- _useState34 = _slicedToArray(_useState33, 2),
724
- attrAliasNameShow = _useState34[0],
725
- setAttrAliasNameShow = _useState34[1];
726
- var _useState35 = useState(0),
993
+ var _useState35 = useState([]),
727
994
  _useState36 = _slicedToArray(_useState35, 2),
728
- attrId = _useState36[0],
729
- setattrId = _useState36[1];
730
- var _useState37 = useState(0),
995
+ attrExcelData = _useState36[0],
996
+ setAttrExcelData = _useState36[1];
997
+ var _useState37 = useState(false),
731
998
  _useState38 = _slicedToArray(_useState37, 2),
732
- batchId = _useState38[0],
733
- setBatchId = _useState38[1];
734
- var _useState39 = useState(false),
999
+ attrAliasNameShow = _useState38[0],
1000
+ setAttrAliasNameShow = _useState38[1];
1001
+ var _useState39 = useState(0),
735
1002
  _useState40 = _slicedToArray(_useState39, 2),
736
- exportAliasTmp = _useState40[0],
737
- setExportAliasTmp = _useState40[1];
1003
+ attrId = _useState40[0],
1004
+ setattrId = _useState40[1];
1005
+ var _useState41 = useState(0),
1006
+ _useState42 = _slicedToArray(_useState41, 2),
1007
+ batchId = _useState42[0],
1008
+ setBatchId = _useState42[1];
1009
+ var _useState43 = useState(false),
1010
+ _useState44 = _slicedToArray(_useState43, 2),
1011
+ exportAliasTmp = _useState44[0],
1012
+ setExportAliasTmp = _useState44[1];
738
1013
  var uploadProps = {
739
1014
  maxCount: 1,
740
1015
  showUploadList: false,
@@ -764,10 +1039,10 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
764
1039
  }
765
1040
  };
766
1041
  // 清空属性值别名excel数据
767
- var _useState41 = useState(false),
768
- _useState42 = _slicedToArray(_useState41, 2),
769
- clearFlag = _useState42[0],
770
- setClearFlag = _useState42[1];
1042
+ var _useState45 = useState(false),
1043
+ _useState46 = _slicedToArray(_useState45, 2),
1044
+ clearFlag = _useState46[0],
1045
+ setClearFlag = _useState46[1];
771
1046
  var clearData = function clearData() {
772
1047
  setAttrExcelData([]);
773
1048
  setClearFlag(true);
@@ -824,12 +1099,13 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
824
1099
  setAttrAliasNameShow(false);
825
1100
  setClearFlag(false);
826
1101
  setValueLoading(false);
1102
+ setAddAttrNameShow(false);
827
1103
  setAttrExcelData([]);
828
1104
  };
829
- var _useState43 = useState(''),
830
- _useState44 = _slicedToArray(_useState43, 2),
831
- scrollY = _useState44[0],
832
- setScrollY = _useState44[1];
1105
+ var _useState47 = useState(''),
1106
+ _useState48 = _slicedToArray(_useState47, 2),
1107
+ scrollY = _useState48[0],
1108
+ setScrollY = _useState48[1];
833
1109
  //页面加载完成后才能获取到对应的元素及其位置
834
1110
  useEffect(function () {
835
1111
  var _Y = getTableScroll(60, 'dataManageAttrTable');
@@ -905,7 +1181,60 @@ var CollectionAttributeList = function CollectionAttributeList(props) {
905
1181
  return owner == '' || item.owner === owner;
906
1182
  }),
907
1183
  pagination: false
908
- }), /*#__PURE__*/React.createElement(Modal, {
1184
+ }), /*#__PURE__*/React.createElement(Button, {
1185
+ className: "button-add",
1186
+ type: "primary",
1187
+ onClick: function onClick() {
1188
+ setAddAttrNameShow(true);
1189
+ setEventAttrList([]); // 清空新增事件属性
1190
+ }
1191
+ }, "\u65B0\u589E\u4E8B\u4EF6\u5C5E\u6027"), /*#__PURE__*/React.createElement(Modal, {
1192
+ width: "80%",
1193
+ title: "\u65B0\u589E\u4E8B\u4EF6\u5C5E\u6027",
1194
+ getContainer: false,
1195
+ open: addAttrNameShow,
1196
+ onOk: addAttrNameEdit,
1197
+ onCancel: closeHandle
1198
+ }, /*#__PURE__*/React.createElement("div", {
1199
+ className: "".concat(classPrefix, "-info"),
1200
+ style: {
1201
+ marginBottom: 15
1202
+ }
1203
+ }, /*#__PURE__*/React.createElement("div", {
1204
+ className: "".concat(classPrefix, "-info-input")
1205
+ }, /*#__PURE__*/React.createElement(Button, {
1206
+ shape: "round",
1207
+ className: "button",
1208
+ onClick: function onClick() {
1209
+ setEventAttrList([].concat(_toConsumableArray(eventAttrList), [{
1210
+ name: '',
1211
+ aliasName: '',
1212
+ type: 1,
1213
+ encryptionType: 0
1214
+ }]));
1215
+ }
1216
+ }, /*#__PURE__*/React.createElement(IconFont, {
1217
+ type: "tianjia1",
1218
+ style: {
1219
+ marginRight: 8,
1220
+ marginBottom: 15
1221
+ }
1222
+ }), "\u6DFB\u52A0\u4E8B\u4EF6\u5C5E\u6027"))), /*#__PURE__*/React.createElement(Table, {
1223
+ className: "".concat(classPrefix, "-table"),
1224
+ id: "dataManageCreateMetaTable",
1225
+ columns: addColumns,
1226
+ rowKey: "key",
1227
+ dataSource: eventAttrList.filter(function (item) {
1228
+ return type < 1 || item.type === type;
1229
+ }).filter(function (item) {
1230
+ return encryption_type < 0 || item.encryption_type === encryption_type;
1231
+ }),
1232
+ scroll: {
1233
+ y: 'calc(100vh - 400px)'
1234
+ },
1235
+ pagination: false,
1236
+ sticky: true
1237
+ })), /*#__PURE__*/React.createElement(Modal, {
909
1238
  title: "\u5C5E\u6027\u503C\u522B\u540D",
910
1239
  getContainer: false,
911
1240
  open: attrAliasNameShow,