tplus-components-touch 3.45.1 → 3.46.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.
Files changed (82) hide show
  1. package/dist/components/billSearch/index.js +2 -2
  2. package/dist/components/billSearch/index.js.map +1 -1
  3. package/dist/components/cloudPrint/BTPrintFormatUtil.js +2 -2
  4. package/dist/components/cloudPrint/BTPrintFormatUtil.js.map +1 -1
  5. package/dist/components/cloudPrint/index.js +893 -608
  6. package/dist/components/cloudPrint/index.js.map +1 -1
  7. package/dist/components/cloudPrint/printDispatch.js +184 -48
  8. package/dist/components/cloudPrint/printDispatch.js.map +1 -1
  9. package/dist/components/cloudPrint/printTemplate/dialy_one.json +239 -0
  10. package/dist/components/cloudPrint/printTemplate/duty_one.json +239 -0
  11. package/dist/components/cloudPrint/printTemplate/retail_one.json +204 -0
  12. package/dist/components/cloudPrint/printTemplate/retail_two.json +220 -0
  13. package/dist/components/cloudPrint/printTemplate/storage_one.json +129 -0
  14. package/dist/components/cloudPrint/printTemplate/template.js +52 -0
  15. package/dist/components/cloudPrint/printTemplate/template.js.map +1 -0
  16. package/dist/components/commonForm/addressPicker/index.js +241 -0
  17. package/dist/components/commonForm/addressPicker/index.js.map +1 -0
  18. package/dist/components/commonForm/autoComplete/index.js +260 -0
  19. package/dist/components/commonForm/autoComplete/index.js.map +1 -0
  20. package/dist/components/commonForm/datePicker/index.js +92 -0
  21. package/dist/components/commonForm/datePicker/index.js.map +1 -0
  22. package/dist/components/commonForm/formControl/index.js +144 -0
  23. package/dist/components/commonForm/formControl/index.js.map +1 -0
  24. package/dist/components/commonForm/inputNumber/index.js +272 -0
  25. package/dist/components/commonForm/inputNumber/index.js.map +1 -0
  26. package/dist/components/commonForm/radio/index.js +132 -0
  27. package/dist/components/commonForm/radio/index.js.map +1 -0
  28. package/dist/components/hardwareAPI/index.js +46 -12
  29. package/dist/components/hardwareAPI/index.js.map +1 -1
  30. package/dist/components/input/tplusInput/index.js +81 -0
  31. package/dist/components/input/tplusInput/index.js.map +1 -0
  32. package/dist/components/input/tplusInput/inputContent.js +128 -0
  33. package/dist/components/input/tplusInput/inputContent.js.map +1 -0
  34. package/dist/components/input/tplusInput/inputs.js +151 -0
  35. package/dist/components/input/tplusInput/inputs.js.map +1 -0
  36. package/dist/components/input/utils/index.js +26 -0
  37. package/dist/components/input/utils/index.js.map +1 -0
  38. package/dist/components/message/index.js +4 -3
  39. package/dist/components/message/index.js.map +1 -1
  40. package/dist/components/modalWraper/index.js +1 -16
  41. package/dist/components/modalWraper/index.js.map +1 -1
  42. package/dist/components/modalWraper/style.less +0 -6
  43. package/dist/components/settlement/asyncModal.js +1 -4
  44. package/dist/components/settlement/asyncModal.js.map +1 -1
  45. package/dist/components/settlement/moreCzkTable/index.js +156 -0
  46. package/dist/components/settlement/moreCzkTable/index.js.map +1 -0
  47. package/dist/components/settlement/prototypeTable/index.js +353 -0
  48. package/dist/components/settlement/prototypeTable/index.js.map +1 -0
  49. package/dist/components/settlement/prototypeTable/utils.js +14 -0
  50. package/dist/components/settlement/prototypeTable/utils.js.map +1 -0
  51. package/dist/components/settlement/settlement.js +225 -292
  52. package/dist/components/settlement/settlement.js.map +1 -1
  53. package/dist/components/settlement/settlement.less +0 -3
  54. package/dist/components/settlement/settlementStore.js +2820 -0
  55. package/dist/components/settlement/settlementStore.js.map +1 -0
  56. package/dist/components/settlement/utils.js +249 -0
  57. package/dist/components/settlement/utils.js.map +1 -0
  58. package/dist/components/socket/index.js +221 -0
  59. package/dist/components/socket/index.js.map +1 -0
  60. package/dist/components/spin/index.js +95 -0
  61. package/dist/components/spin/index.js.map +1 -0
  62. package/dist/components/test/index.js +330 -0
  63. package/dist/components/test/index.js.map +1 -0
  64. package/dist/components/ticon/iconfont/iconfont.js +35 -0
  65. package/dist/components/ticon/iconfont/iconfont.js.map +1 -0
  66. package/dist/components/ticon/index.js +60 -0
  67. package/dist/components/ticon/index.js.map +1 -0
  68. package/dist/components/touchScroll/index.js +186 -0
  69. package/dist/components/touchScroll/index.js.map +1 -0
  70. package/dist/components/touchTable/AuthProcess.js +42 -0
  71. package/dist/components/touchTable/AuthProcess.js.map +1 -0
  72. package/dist/components/touchTable/generateWater.js +59 -0
  73. package/dist/components/touchTable/generateWater.js.map +1 -0
  74. package/dist/components/touchTable/index.js +1135 -0
  75. package/dist/components/touchTable/index.js.map +1 -0
  76. package/dist/components/touchTable/utils.js +14 -0
  77. package/dist/components/touchTable/utils.js.map +1 -0
  78. package/dist/index.js +3 -8
  79. package/dist/index.js.map +1 -1
  80. package/package.json +2 -2
  81. package/dist/components/settlement/settlementApi.js +0 -512
  82. package/dist/components/settlement/settlementApi.js.map +0 -1
@@ -0,0 +1,220 @@
1
+ {
2
+ "templateName": "模板2",
3
+ "width": 58,
4
+ "body": [
5
+ {
6
+ "type": "lineFeed",
7
+ "height": 1
8
+ },
9
+ {
10
+ "type": "leftPrintMsg",
11
+ "body": [
12
+ {
13
+ "name": "门店名称",
14
+ "attribute": "Store.Name",
15
+ "type": "string"
16
+ },
17
+ {
18
+ "name": "门店电话",
19
+ "attribute": "Store.Telephone",
20
+ "type": "string"
21
+ },
22
+ {
23
+ "name": "收银员",
24
+ "attribute": "UserName",
25
+ "type": "string"
26
+ },
27
+ {
28
+ "name": "单号",
29
+ "attribute": "Code",
30
+ "type": "string"
31
+ },
32
+ {
33
+ "name": "日期",
34
+ "attribute": "CreatedTime",
35
+ "type": "string"
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "type": "lineFeed",
41
+ "height": 1
42
+ },
43
+ {
44
+ "type": "printMenuMSG",
45
+ "headerList": [
46
+ {
47
+ "headerText": "商品名称",
48
+ "headerWeight":1,
49
+ "isTitle": true,
50
+ "isFoot": false
51
+ },
52
+ {
53
+ "headerText": "数量",
54
+ "headerWeight":1,
55
+ "isTitle": false,
56
+ "isFoot": false
57
+ },
58
+ {
59
+ "headerText": "零售价",
60
+ "headerWeight":1,
61
+ "isTitle": false,
62
+ "isFoot": false
63
+ },
64
+ {
65
+ "headerText": "折后单价",
66
+ "headerWeight":1,
67
+ "isTitle": false,
68
+ "isFoot": false
69
+ },
70
+ {
71
+ "headerText": "金额",
72
+ "headerWeight":1,
73
+ "isTitle": false,
74
+ "isFoot": false
75
+ }
76
+ ],
77
+ "bodyList":{
78
+ "name": "明细数据",
79
+ "attribute":"details",
80
+ "list":[
81
+ {
82
+ "attribute":"Inventory.NameAndCode",
83
+ "type":"string"
84
+ },
85
+ {
86
+ "attribute":"quantityAndUnit",
87
+ "type":"string"
88
+ },
89
+ {
90
+ "attribute":"RetailPrice",
91
+ "type":"price"
92
+ },
93
+ {
94
+ "attribute":"TaxPrice",
95
+ "type":"price"
96
+ },
97
+ {
98
+ "attribute":"TaxAmount",
99
+ "type":"price"
100
+ }
101
+ ]
102
+ }
103
+ },
104
+ {
105
+ "type": "leftPrintMsg",
106
+ "body": [
107
+ {
108
+ "name": "数量",
109
+ "attribute": "TotalCount",
110
+ "type": "number"
111
+ },
112
+ {
113
+ "name": "金额",
114
+ "attribute": "TotalTaxAmount",
115
+ "type": "price"
116
+ },
117
+ {
118
+ "name": "优惠金额",
119
+ "attribute": "TotalDiscountAmount",
120
+ "type": "price"
121
+ },
122
+ {
123
+ "name": "抹零",
124
+ "attribute": "WipeChange",
125
+ "type": "price"
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "type": "separateLine",
131
+ "height":1
132
+ },
133
+ {
134
+ "type": "lineFeed",
135
+ "height": 1
136
+ },
137
+ {
138
+ "type": "printMenuMSG",
139
+ "headerList": [
140
+ {
141
+ "headerText": "支付方式",
142
+ "headerWeight":1,
143
+ "isTitle": false,
144
+ "isFoot": false
145
+ },
146
+ {
147
+ "headerText": "金额",
148
+ "headerWeight":1,
149
+ "isTitle": false,
150
+ "isFoot": false
151
+ }
152
+ ],
153
+ "bodyList":{
154
+ "name": "支付方式",
155
+ "attribute":"RetailPaymentDetails",
156
+ "type": "array",
157
+ "list":[
158
+ {
159
+ "attribute":"NameAndCode",
160
+ "type":"string"
161
+ },
162
+ {
163
+ "attribute":"TotalAmount",
164
+ "type":"string"
165
+ }
166
+ ]
167
+ }
168
+ },
169
+ {
170
+ "type": "leftPrintMsg",
171
+ "body": [
172
+ {
173
+ "name": "会员卡号",
174
+ "attribute": "Member.CardCode",
175
+ "type": "string"
176
+ },
177
+ {
178
+ "name": "会员手机",
179
+ "attribute": "Member.Mobilephone",
180
+ "type": "string"
181
+ },
182
+ {
183
+ "name": "积分余额",
184
+ "attribute": "BalanceIntegral",
185
+ "type": "number"
186
+ },
187
+ {
188
+ "name": "本次积分",
189
+ "attribute": "Integral",
190
+ "type": "number"
191
+ },
192
+ {
193
+ "name": "储值余额",
194
+ "attribute": "BalanceStorage",
195
+ "type": "price"
196
+ }
197
+ ]
198
+ },
199
+ {
200
+ "type": "lineFeed",
201
+ "height": 1
202
+ },
203
+ {
204
+ "type": "separateLine",
205
+ "height":1
206
+ },
207
+ {
208
+ "type": "lineFeed",
209
+ "height": 1
210
+ },
211
+ {
212
+ "type": "text",
213
+ "value": "\t谢谢惠顾,欢迎再次光临"
214
+ },
215
+ {
216
+ "type": "lineFeed",
217
+ "height": 3
218
+ }
219
+ ]
220
+ }
@@ -0,0 +1,129 @@
1
+ {
2
+ "templateName": "模板1",
3
+ "width": 58,
4
+ "body": [
5
+ {
6
+ "type": "lineFeed",
7
+ "height": 1
8
+ },
9
+ {
10
+ "type": "leftPrintMsg",
11
+ "body": [
12
+ {
13
+ "name": "门店名称",
14
+ "attribute": "Store.Name",
15
+ "type": "string"
16
+ },
17
+ {
18
+ "name": "储值业务员",
19
+ "attribute": "Person.Name",
20
+ "type": "string"
21
+ },
22
+ {
23
+ "name": "日期",
24
+ "attribute": "CreatedTime",
25
+ "type": "string"
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "type": "leftPrintMsg",
31
+ "body": [
32
+ {
33
+ "name": "本次储存金额",
34
+ "attribute": "StorageDetails.0.ThisStorageAmount",
35
+ "type": "price"
36
+ },
37
+ {
38
+ "name": "本次赠送金额",
39
+ "attribute": "StorageDetails.0.ThisPresentAmount",
40
+ "type": "price"
41
+ },
42
+ {
43
+ "name": "本次储值后金额",
44
+ "attribute": "StorageDetails.0.AfterBalanceStorage",
45
+ "type": "price"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "type": "separateLine",
51
+ "height":1
52
+ },
53
+ {
54
+ "type": "printMenuMSG",
55
+ "headerList": [
56
+ {
57
+ "headerText": "支付方式",
58
+ "headerWeight":1,
59
+ "isTitle": false,
60
+ "isFoot": false
61
+ },
62
+ {
63
+ "headerText": "金额",
64
+ "headerWeight":1,
65
+ "isTitle": false,
66
+ "isFoot": false
67
+ }
68
+ ],
69
+ "bodyList":{
70
+ "name": "支付方式",
71
+ "attribute":"StorageMutiSettleDetails",
72
+ "list": [
73
+ {
74
+ "attribute":"SettleStyle.Name",
75
+ "type":"price"
76
+ },
77
+ {
78
+ "attribute":"StorageAmount",
79
+ "type":"price"
80
+ }
81
+ ]
82
+ }
83
+ },
84
+ {
85
+ "type": "leftPrintMsg",
86
+ "body": [
87
+ {
88
+ "name": "储值卡号",
89
+ "attribute": "StorageDetails.0.meStorageCard.cardNo",
90
+ "type": "string"
91
+ },
92
+ {
93
+ "name": "会员手机",
94
+ "attribute": "Member.Mobilephone",
95
+ "type": "string"
96
+ },
97
+ {
98
+ "name": "会员姓名",
99
+ "attribute": "Member.Name",
100
+ "type": "string"
101
+ },
102
+ {
103
+ "name": "顾客签名",
104
+ "type": "string"
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "type": "lineFeed",
110
+ "height": 4
111
+ },
112
+ {
113
+ "type": "separateLine",
114
+ "height":1
115
+ },
116
+ {
117
+ "type": "lineFeed",
118
+ "height": 1
119
+ },
120
+ {
121
+ "type": "text",
122
+ "value": "\t谢谢惠顾,欢迎再次光临"
123
+ },
124
+ {
125
+ "type": "lineFeed",
126
+ "height": 3
127
+ }
128
+ ]
129
+ }
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Template = undefined;
7
+
8
+ var _retail_one = require('./retail_one.json');
9
+
10
+ var _retail_one2 = _interopRequireDefault(_retail_one);
11
+
12
+ var _retail_two = require('./retail_two.json');
13
+
14
+ var _retail_two2 = _interopRequireDefault(_retail_two);
15
+
16
+ var _storage_one = require('./storage_one.json');
17
+
18
+ var _storage_one2 = _interopRequireDefault(_storage_one);
19
+
20
+ var _duty_one = require('./duty_one.json');
21
+
22
+ var _duty_one2 = _interopRequireDefault(_duty_one);
23
+
24
+ var _dialy_one = require('./dialy_one.json');
25
+
26
+ var _dialy_one2 = _interopRequireDefault(_dialy_one);
27
+
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+
30
+ var Template = exports.Template = {
31
+ retail: {
32
+ retail_template_one: _retail_one2.default,
33
+ retail_template_two: _retail_two2.default
34
+ },
35
+ storage: {
36
+ storage_template_one: _storage_one2.default
37
+ },
38
+ duty: {
39
+ duty_template_one: _duty_one2.default
40
+ },
41
+ dialy: {
42
+ dialy_template_one: _dialy_one2.default
43
+ }
44
+ }; /*
45
+ * @Descripttion:
46
+ * @version:
47
+ * @Author: chenlongad
48
+ * @Date: 2022-03-07 19:29:29
49
+ * @LastEditors: Lixuhan
50
+ * @LastEditTime: 2022-03-10 11:15:19
51
+ */
52
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["tplus-components-touch/components/cloudPrint/printTemplate/template.js"],"names":["Template","retail","retail_template_one","RetailOne","retail_template_two","RetailTwo","storage","storage_template_one","StorageOne","duty","duty_template_one","DutyOne","dialy","dialy_template_one","DialyOne"],"mappings":";;;;;;;AASA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;;;AAEO,IAAMA,8BAAW;AACtBC,UAAO;AACLC,yBAAoBC,oBADf;AAELC,yBAAoBC;AAFf,GADe;AAKtBC,WAAS;AACPC,0BAAsBC;AADf,GALa;AAQtBC,QAAM;AACJC,uBAAmBC;AADf,GARgB;AAWtBC,SAAO;AACLC,wBAAoBC;AADf;AAXe,CAAjB,C,CAfP","file":"template.js","sourcesContent":["/*\r\n * @Descripttion: \r\n * @version: \r\n * @Author: chenlongad\r\n * @Date: 2022-03-07 19:29:29\r\n * @LastEditors: Lixuhan\r\n * @LastEditTime: 2022-03-10 11:15:19\r\n */\r\n\r\nimport RetailOne from './retail_one.json'\r\nimport RetailTwo from './retail_two.json'\r\nimport StorageOne from './storage_one.json'\r\nimport DutyOne from './duty_one.json'\r\nimport DialyOne from './dialy_one.json'\r\n\r\nexport const Template = {\r\n retail:{\r\n retail_template_one:RetailOne,\r\n retail_template_two:RetailTwo\r\n },\r\n storage: {\r\n storage_template_one: StorageOne\r\n },\r\n duty: {\r\n duty_template_one: DutyOne\r\n },\r\n dialy: {\r\n dialy_template_one: DialyOne\r\n }\r\n}"]}
@@ -0,0 +1,241 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = undefined;
7
+
8
+ var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
9
+
10
+ var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
11
+
12
+ var _regenerator = require('babel-runtime/regenerator');
13
+
14
+ var _regenerator2 = _interopRequireDefault(_regenerator);
15
+
16
+ var _extends2 = require('babel-runtime/helpers/extends');
17
+
18
+ var _extends3 = _interopRequireDefault(_extends2);
19
+
20
+ var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
21
+
22
+ var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
23
+
24
+ var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
25
+
26
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
27
+
28
+ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
29
+
30
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
31
+
32
+ var _createClass2 = require('babel-runtime/helpers/createClass');
33
+
34
+ var _createClass3 = _interopRequireDefault(_createClass2);
35
+
36
+ var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
37
+
38
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
39
+
40
+ var _inherits2 = require('babel-runtime/helpers/inherits');
41
+
42
+ var _inherits3 = _interopRequireDefault(_inherits2);
43
+
44
+ var _form = require('antd/es/form');
45
+
46
+ var _form2 = _interopRequireDefault(_form);
47
+
48
+ var _class; /*
49
+ * @Descripttion:
50
+ * @version:
51
+ * @Author: chenlongad
52
+ * @Date: 2021-01-06 09:40:16
53
+ * @LastEditors: chenlongad
54
+ * @LastEditTime: 2021-10-26 23:41:28
55
+ */
56
+
57
+
58
+ require('antd/es/form/style');
59
+
60
+ var _react = require('react');
61
+
62
+ var _react2 = _interopRequireDefault(_react);
63
+
64
+ var _mobxReact = require('mobx-react');
65
+
66
+ var _acCitySelect = require('../../acCitySelect');
67
+
68
+ var _acCitySelect2 = _interopRequireDefault(_acCitySelect);
69
+
70
+ var _tplusApi = require('tplus-api');
71
+
72
+ require('./style.less');
73
+
74
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
75
+
76
+ var FormItem = _form2.default.Item;
77
+
78
+ var _default = (0, _mobxReact.observer)(_class = function (_Component) {
79
+ (0, _inherits3.default)(_default, _Component);
80
+
81
+ function _default() {
82
+ var _this2 = this;
83
+
84
+ (0, _classCallCheck3.default)(this, _default);
85
+
86
+ var _this = (0, _possibleConstructorReturn3.default)(this, (_default.__proto__ || (0, _getPrototypeOf2.default)(_default)).call(this));
87
+
88
+ _this.getProvinceData = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
89
+ var _this$props, type, dataDto, gql, result, GeoList, data, viewInfo, defaultValue, _defaultValue, geoCode;
90
+
91
+ return _regenerator2.default.wrap(function _callee$(_context) {
92
+ while (1) {
93
+ switch (_context.prev = _context.next) {
94
+ case 0:
95
+ _this$props = _this.props, type = _this$props.type, dataDto = _this$props.dataDto;
96
+ gql = '{\n Geo {\n geoCode\n geoName\n geoLevel\n parentGeoCode\n }\n }';
97
+ _context.next = 4;
98
+ return (0, _tplusApi.gqlQuery)(gql);
99
+
100
+ case 4:
101
+ result = _context.sent;
102
+
103
+ console.log(result);
104
+ GeoList = result.Geo;
105
+ data = _this.dutyProvinceData(GeoList);
106
+
107
+ console.log(data);
108
+ viewInfo = _this.props.viewInfo;
109
+ defaultValue = viewInfo.defaultValue;
110
+ _defaultValue = defaultValue, geoCode = _defaultValue.geoCode;
111
+
112
+ if (type == 'buyer') {
113
+ defaultValue = {
114
+ province: dataDto.Province || defaultValue.province,
115
+ city: dataDto.City || defaultValue.city,
116
+ area: dataDto.District || defaultValue.area
117
+ };
118
+ } else {
119
+ if (geoCode) {
120
+ defaultValue = _this.dutyDefaultValue(result.Geo, geoCode);
121
+ } else {
122
+ defaultValue = _this.state.defaultValue;
123
+ }
124
+ }
125
+ _this.setState({
126
+ defaultValue: defaultValue,
127
+ provinceData: data
128
+ }, function () {
129
+ _this.onChange((0, _extends3.default)({}, _this.state.defaultValue));
130
+ });
131
+
132
+ case 14:
133
+ case 'end':
134
+ return _context.stop();
135
+ }
136
+ }
137
+ }, _callee, _this2);
138
+ }));
139
+
140
+ _this.dutyDefaultValue = function (GeoList, geoCode, defaultValue) {
141
+ var findGeo = GeoList.find(function (geo) {
142
+ return geo.geoCode == geoCode;
143
+ });
144
+ if (findGeo) {
145
+ if (!defaultValue) {
146
+ defaultValue = { area: findGeo.geoName };
147
+ return _this.dutyDefaultValue(GeoList, findGeo.parentGeoCode, defaultValue);
148
+ } else {
149
+ if (!defaultValue.city) {
150
+ defaultValue.city = findGeo.geoName;
151
+ return _this.dutyDefaultValue(GeoList, findGeo.parentGeoCode, defaultValue);
152
+ } else {
153
+ defaultValue.province = findGeo.geoName;
154
+ return defaultValue;
155
+ }
156
+ }
157
+ }
158
+ };
159
+
160
+ _this.dutyProvinceData = function (GeoList) {
161
+ var obj = [];
162
+ GeoList.forEach(function (geo, index) {
163
+ if (geo.geoLevel === 1) {
164
+ obj.push(_this.findOneProvinceDataToDuty(GeoList, index));
165
+ }
166
+ });
167
+ return obj;
168
+ };
169
+
170
+ _this.findOneProvinceDataToDuty = function (GeoList, index) {
171
+ var singleGeo = GeoList[index];
172
+ var GeoObj = {
173
+ name: singleGeo.geoName,
174
+ city: []
175
+ };
176
+ var newFilterData = GeoList.filter(function (Geo) {
177
+ return Geo.parentGeoCode == singleGeo.geoCode;
178
+ });
179
+ GeoObj.city = newFilterData.map(function (Geo) {
180
+ return { name: Geo.geoName, area: [].concat((0, _toConsumableArray3.default)(GeoList.filter(function (geo) {
181
+ return geo.parentGeoCode == Geo.geoCode;
182
+ }).map(function (geo) {
183
+ return geo.geoName;
184
+ }))) };
185
+ });
186
+ return GeoObj;
187
+ };
188
+
189
+ _this.onChange = function (obj) {
190
+ console.log(obj);
191
+ var viewInfo = _this.props.viewInfo;
192
+ var setFieldsValue = _this.props.form.current.setFieldsValue;
193
+
194
+ var changed = {};
195
+ var FieldName = viewInfo.FieldName;
196
+ changed[FieldName] = obj.province + ',' + obj.city + ',' + obj.area;
197
+ // setFieldsValue(changed);
198
+ _this.props.changeVal && _this.props.changeVal(changed);
199
+ };
200
+
201
+ _this.state = {
202
+ defaultValue: { province: '北京市', city: '北京市', area: '东城区', geoCode: '110101' },
203
+ provinceData: null
204
+ };
205
+
206
+ return _this;
207
+ }
208
+
209
+ (0, _createClass3.default)(_default, [{
210
+ key: 'componentWillMount',
211
+ value: function componentWillMount() {
212
+ this.getProvinceData();
213
+ }
214
+ }, {
215
+ key: 'componentDidMount',
216
+ value: function componentDidMount() {}
217
+ }, {
218
+ key: 'render',
219
+ value: function render() {
220
+ var viewInfo = this.props.viewInfo;
221
+ return _react2.default.createElement(
222
+ FormItem,
223
+ { className: 'time flex', label: _react2.default.createElement(
224
+ 'span',
225
+ null,
226
+ !viewInfo.AllowNone ? _react2.default.createElement(
227
+ 'span',
228
+ { className: 'error-color' },
229
+ '* '
230
+ ) : null,
231
+ viewInfo.Title
232
+ ) },
233
+ this.state.provinceData !== null ? _react2.default.createElement(_acCitySelect2.default, { provinceData: this.state.provinceData, ref: 'city', onChange: this.onChange, defaultValue: this.state.defaultValue }) : null
234
+ );
235
+ }
236
+ }]);
237
+ return _default;
238
+ }(_react.Component)) || _class;
239
+
240
+ exports.default = _default;
241
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["tplus-components-touch/components/commonForm/addressPicker/index.js"],"names":["FormItem","Item","observer","getProvinceData","props","type","dataDto","gql","result","console","log","GeoList","Geo","data","dutyProvinceData","viewInfo","defaultValue","geoCode","province","Province","city","City","area","District","dutyDefaultValue","state","setState","provinceData","onChange","findGeo","find","geo","geoName","parentGeoCode","obj","forEach","index","geoLevel","push","findOneProvinceDataToDuty","singleGeo","GeoObj","name","newFilterData","filter","map","setFieldsValue","form","current","changed","FieldName","changeVal","AllowNone","Title","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAAA;;;;;;;;;;;;AAQA;;;;AACA;;AAEA;;;;AACA;;AACA;;;;AAEA,IAAMA,WAAW,eAAKC,IAAtB;;mBACCC,mB;;;AAGG,wBAAc;AAAA;;AAAA;;AAAA;;AAAA,cAcdC,eAdc,4EAcI;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,0CACY,MAAKC,KADjB,EACNC,IADM,eACNA,IADM,EACAC,OADA,eACAA,OADA;AAERC,+BAFQ;AAAA;AAAA,mCAUO,wBAASA,GAAT,CAVP;;AAAA;AAURC,kCAVQ;;AAWdC,oCAAQC,GAAR,CAAYF,MAAZ;AACMG,mCAZQ,GAYEH,OAAOI,GAZT;AAaVC,gCAbU,GAaH,MAAKC,gBAAL,CAAsBH,OAAtB,CAbG;;AAcdF,oCAAQC,GAAR,CA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r\n * @version:\r\n * @Author: chenlongad\r\n * @Date: 2021-01-06 09:40:16\r\n * @LastEditors: chenlongad\r\n * @LastEditTime: 2021-10-26 23:41:28\r\n */\r\nimport React, { Component } from 'react';\r\nimport { observer } from 'mobx-react';\r\nimport { Form } from 'antd';\r\nimport ACCitySelect from '../../acCitySelect';\r\nimport { gqlQuery } from 'tplus-api';\r\nimport './style.less'\r\n\r\nconst FormItem = Form.Item;\r\n@observer\r\nexport default class extends Component {\r\n\r\n constructor() {\r\n super();\r\n this.state = {\r\n defaultValue: { province: '北京市', city: '北京市', area: '东城区', geoCode: '110101' },\r\n provinceData:null\r\n }\r\n\r\n }\r\n componentWillMount() {\r\n this.getProvinceData();\r\n }\r\n componentDidMount() {\r\n }\r\n\r\n getProvinceData = async () => {\r\n const { type, dataDto } = this.props;\r\n const gql = `{\r\n Geo {\r\n geoCode\r\n geoName\r\n geoLevel\r\n parentGeoCode\r\n }\r\n }`\r\n const result = await gqlQuery(gql);\r\n console.log(result);\r\n const GeoList = result.Geo;\r\n let data = this.dutyProvinceData(GeoList);\r\n console.log(data);\r\n let viewInfo = this.props.viewInfo;\r\n let { defaultValue } = viewInfo\r\n const { geoCode } = defaultValue;\r\n if (type == 'buyer'){\r\n defaultValue = {\r\n province: dataDto.Province || defaultValue.province,\r\n city: dataDto.City || defaultValue.city,\r\n area: dataDto.District || defaultValue.area,\r\n }\r\n } else {\r\n if(geoCode){\r\n defaultValue = this.dutyDefaultValue(result.Geo,geoCode);\r\n }else{\r\n defaultValue = this.state.defaultValue;\r\n }\r\n }\r\n this.setState({\r\n defaultValue,\r\n provinceData:data\r\n }, () => {\r\n this.onChange({\r\n ...this.state.defaultValue\r\n })\r\n })\r\n }\r\n dutyDefaultValue = (GeoList,geoCode,defaultValue) => {\r\n let findGeo = GeoList.find((geo)=>geo.geoCode == geoCode);\r\n if(findGeo){\r\n if(!defaultValue){\r\n defaultValue = {area:findGeo.geoName}\r\n return this.dutyDefaultValue(GeoList,findGeo.parentGeoCode,defaultValue);\r\n }else{\r\n if(!defaultValue.city){\r\n defaultValue.city = findGeo.geoName\r\n return this.dutyDefaultValue(GeoList,findGeo.parentGeoCode,defaultValue);\r\n }else{\r\n defaultValue.province = findGeo.geoName\r\n return defaultValue;\r\n }\r\n }\r\n }\r\n }\r\n\r\n dutyProvinceData = (GeoList) => {\r\n let obj = [];\r\n GeoList.forEach((geo,index) => {\r\n if (geo.geoLevel === 1) {\r\n obj.push(this.findOneProvinceDataToDuty(GeoList,index))\r\n }\r\n })\r\n return obj\r\n }\r\n\r\n findOneProvinceDataToDuty = (GeoList, index) => {\r\n const singleGeo = GeoList[index];\r\n let GeoObj = {\r\n name: singleGeo.geoName,\r\n city: []\r\n };\r\n let newFilterData = GeoList.filter(Geo => Geo.parentGeoCode == singleGeo.geoCode)\r\n GeoObj.city = newFilterData.map(Geo =>{return { name:Geo.geoName,area:[...GeoList.filter(geo => geo.parentGeoCode == Geo.geoCode).map(geo=>geo.geoName)]}});\r\n return GeoObj\r\n }\r\n\r\n onChange = (obj) => {\r\n console.log(obj);\r\n let viewInfo = this.props.viewInfo;\r\n const { setFieldsValue } = this.props.form.current;\r\n const changed = {}\r\n const FieldName = viewInfo.FieldName;\r\n changed[FieldName] = `${obj.province},${obj.city},${obj.area}`;\r\n // setFieldsValue(changed);\r\n this.props.changeVal && this.props.changeVal(changed);\r\n }\r\n\r\n render() {\r\n let viewInfo = this.props.viewInfo;\r\n return <FormItem className='time flex' label={<span>{!viewInfo.AllowNone ? <span className=\"error-color\">* </span> : null}{viewInfo.Title}</span>}>\r\n {\r\n this.state.provinceData !== null?<ACCitySelect provinceData = { this.state.provinceData} ref='city' onChange={this.onChange} defaultValue={this.state.defaultValue} />:null\r\n }\r\n </FormItem>\r\n }\r\n}\r\n"]}