@luck-design-biz/luckda 0.0.9 → 0.0.11-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.
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData"];
5
+ var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData", "formRef", "formMode"];
6
6
  import React, { useContext, useRef, useState } from 'react';
7
7
  import { useCreation, useMemoizedFn } from 'ahooks';
8
8
  import { transform } from 'lodash';
@@ -41,6 +41,8 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
41
41
  } : _ref$defaultDataSourc,
42
42
  _ref$ticketData = _ref.ticketData,
43
43
  ticketData = _ref$ticketData === void 0 ? {} : _ref$ticketData,
44
+ formRef = _ref.formRef,
45
+ formMode = _ref.formMode,
44
46
  props = _objectWithoutProperties(_ref, _excluded);
45
47
  var _ref2 = useContext(LuckDaContext) || {},
46
48
  setFieldProps = _ref2.setFieldProps;
@@ -55,7 +57,12 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
55
57
  return field.name === col.field;
56
58
  }) || {};
57
59
  _defaultValues = _objectSpread(_objectSpread({}, _defaultValues), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, col.field, col['optDefaultValue']), _defineProperty(_objectSpread2, "".concat(col.field, "_virtual"), col['optDefaultValueCvt']), _objectSpread2));
58
- result.push(getFormItem(col, _objectSpread(_objectSpread({}, customFiled), {}, {
60
+ result.push(getFormItem(col, _objectSpread(_objectSpread({
61
+ formId: ldId,
62
+ moduleCode: moduleCode,
63
+ formRef: formRef,
64
+ formMode: formMode
65
+ }, customFiled), {}, {
59
66
  handleValueChange: function handleValueChange(value) {
60
67
  return onValueChange(_defineProperty({}, ldId, _defineProperty({}, col.field, value)));
61
68
  }
@@ -85,11 +92,13 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
85
92
  return behaviorCall(get, post, formData);
86
93
  },
87
94
  get: function get() {
88
- return {
95
+ var _get = {
89
96
  moduleCode: moduleCode,
90
97
  datasetCode: dataSetKey,
91
98
  behaviorKey: behaviorKey
92
99
  };
100
+ if (!isMain) _get.relationDs = mainDataSetKey;
101
+ return _get;
93
102
  }
94
103
  }, _onOperate), {}, {
95
104
  post: function post(_ref3) {
@@ -81,8 +81,8 @@ var LdFormList = function LdFormList(_ref) {
81
81
  var _ref5 = formListRef.current || {},
82
82
  formRefs = _ref5.formRefs;
83
83
  var data = formRefs && Object.keys(formRefs).map(function (key) {
84
- var _formRefs$key$current;
85
- var getValue = formRefs[key].getData || ((_formRefs$key$current = formRefs[key].current) === null || _formRefs$key$current === void 0 ? void 0 : _formRefs$key$current.getFieldsValue);
84
+ var _formRefs$key, _formRefs$key$formRef, _formRefs$key$current;
85
+ var getValue = (((_formRefs$key = formRefs[key]) === null || _formRefs$key === void 0 ? void 0 : (_formRefs$key$formRef = _formRefs$key.formRef) === null || _formRefs$key$formRef === void 0 ? void 0 : _formRefs$key$formRef.current) ? formRefs[key].getData : null) || ((_formRefs$key$current = formRefs[key].current) === null || _formRefs$key$current === void 0 ? void 0 : _formRefs$key$current.getFieldsValue);
86
86
  return _defineProperty({}, key, getValue && getValue());
87
87
  });
88
88
  onValueChange(change, data);
@@ -122,25 +122,30 @@ var LdFormList = function LdFormList(_ref) {
122
122
  } else {
123
123
  var _formListRef$current;
124
124
  props.parentModelName && ((_formListRef$current = formListRef.current) === null || _formListRef$current === void 0 ? void 0 : _formListRef$current.doParentsQuery());
125
- if (!formWindow && formMode === 'add' && window.__INJECTED_FLOAT_MICRO_APP_BY_QIANKUN) {
126
- var _history$location = history.location,
127
- pathname = _history$location.pathname,
128
- query = _history$location.query;
129
- var _pathname = pathname.replace(/\/0(?=[?]|[\/]$|$)/g, "/".concat(indocno, "?"));
130
- window.openUrl("layer:".concat(_pathname).concat(stringify(_objectSpread(_objectSpread({}, query), {}, {
131
- title: window.__INJECTED_APP_NAME_BY_QIANKUN__
132
- }))));
133
- } else {
134
- formListRef.current.onQuery(null, _defineProperty({}, mainFormLdId, {
135
- indocno: indocno
136
- }), function () {
137
- return formListRef.current.setFormMode('info');
138
- });
139
- }
125
+ // if (
126
+ // !formWindow &&
127
+ // formMode === 'add' &&
128
+ // window.__INJECTED_FLOAT_MICRO_APP_BY_QIANKUN
129
+ // ) {
130
+ // const { pathname, query } = history.location;
131
+ // window.openUrl(
132
+ // `layer:${pathname}?${stringify({
133
+ // ...query,
134
+ // title: window.__INJECTED_APP_NAME_BY_QIANKUN__,
135
+ // })}`,
136
+ // );
137
+ // } else {
138
+ formListRef.current.onQuery(null, _defineProperty({}, mainFormLdId, {
139
+ indocno: indocno
140
+ }), function () {
141
+ return formListRef.current.setFormMode('info');
142
+ });
143
+ // }
140
144
  }
141
145
  }
142
146
  });
143
147
  };
148
+
144
149
  var formConfig = _objectSpread(_objectSpread({
145
150
  formState: formState,
146
151
  formMode: formMode,
@@ -189,19 +194,21 @@ var LdFormList = function LdFormList(_ref) {
189
194
  var _props$type = _props.type,
190
195
  type = _props$type === void 0 ? 'auto' : _props$type;
191
196
  var renderForm = type === 'auto' ? buildLdAutoForm : buildLdGridForm;
192
- if (header === 'collapse') return /*#__PURE__*/React.createElement(Collapse, {
197
+ if (header === 'collapse' || header === 'collapseFollow') return /*#__PURE__*/React.createElement(Collapse, {
193
198
  title: title || ldId,
194
199
  extra: renderExtra(ldId, extraConfig),
195
200
  id: ldId,
196
201
  key: ldId,
197
- mode: ldId !== mainFormLdId && 'tab'
202
+ mode: header === 'collapse' && ldId !== mainFormLdId && 'tab'
198
203
  }, renderForm(_objectSpread(_objectSpread({}, _props), {}, {
199
204
  ldId: ldId,
200
205
  mainFormLdId: mainFormLdId,
201
206
  mainDataSetKey: mainDataSetKey,
202
207
  readOnly: readOnly || _readOnly,
203
208
  onValueChange: handleValueChange,
204
- ticketData: props.ticketData
209
+ ticketData: props.ticketData,
210
+ formRef: formListRef,
211
+ formMode: formMode
205
212
  })));
206
213
  return /*#__PURE__*/React.createElement(Fragment, {
207
214
  key: ldId
@@ -218,7 +225,9 @@ var LdFormList = function LdFormList(_ref) {
218
225
  mainDataSetKey: mainDataSetKey,
219
226
  readOnly: readOnly || _readOnly,
220
227
  onValueChange: handleValueChange,
221
- ticketData: props.ticketData
228
+ ticketData: props.ticketData,
229
+ formRef: formListRef,
230
+ formMode: formMode
222
231
  })));
223
232
  }), ChildrenUtil.deepMap(renderFormExtra(formConfig), function (child) {
224
233
  var _child$type;
@@ -106,16 +106,20 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
106
106
  return behaviorCall(_objectSpread(_objectSpread({}, get), {}, _defineProperty({}, isMain ? 'indocno' : 'relationId', ((_formData$mainFormLdI = formData[mainFormLdId]) === null || _formData$mainFormLdI === void 0 ? void 0 : _formData$mainFormLdI.indocno) || ticketData.indocno)), post, formData);
107
107
  },
108
108
  get: function get() {
109
- return {
109
+ var _get = {
110
110
  moduleCode: moduleCode,
111
111
  datasetCode: dataSetKey,
112
112
  behaviorKey: behaviorKey
113
113
  };
114
+ if (!isMain) _get.relationDs = mainDataSetKey;
115
+ return _get;
114
116
  }
115
117
  }, _onOperate), {}, {
116
118
  post: function post(data) {
117
119
  var _submitData = data.map(function (item) {
118
- return dataFormat(gridColumns, item);
120
+ return behaviorKey === 'add' ? _objectSpread(_objectSpread({}, dataFormat(gridColumns, item)), {}, {
121
+ indocno: null
122
+ }) : dataFormat(gridColumns, item);
119
123
  });
120
124
  if (_onOperate === null || _onOperate === void 0 ? void 0 : _onOperate.post) return _onOperate.post(_submitData); // 以预设为主
121
125
  return _defineProperty({}, dataSetKey, _defineProperty({}, "".concat(behaviorKey, "List"), _submitData));
@@ -21,19 +21,23 @@ var _excluded = ["onBlur"],
21
21
  _excluded17 = ["onChange"],
22
22
  _excluded18 = ["handleValueChange", "config"],
23
23
  _excluded19 = ["handleValueChange"],
24
- _excluded20 = ["handleValueChange", "config"];
24
+ _excluded20 = ["handleValueChange", "config"],
25
+ _excluded21 = ["onBlur"],
26
+ _excluded22 = ["handleValueChange", "config"],
27
+ _excluded23 = ["onBlur"],
28
+ _excluded24 = ["handleValueChange", "config"];
25
29
  import React, { useState, useEffect } from 'react';
26
30
  import { getDvaApp } from 'umi';
27
31
  import { BasicFormItem } from 'luck-design';
28
- import { TreeSelector, RegionFormItem } from '@luck-design-biz/base';
32
+ import { TreeSelector, RegionFormItem, UploadFormItemV3 } from '@luck-design-biz/base';
29
33
  import { DatadicDropDown, UserSelectDropDown as UserItem } from '@luck-design-biz/base/sys/dropdown';
30
34
  export var getNumberItem = function getNumberItem() {
31
35
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
32
36
  handleValueChange = _ref.handleValueChange,
33
- _ref$config = _ref.config;
34
- _ref$config = _ref$config === void 0 ? {} : _ref$config;
35
- var _onBlur = _ref$config.onBlur,
36
- _config = _objectWithoutProperties(_ref$config, _excluded),
37
+ _ref$config = _ref.config,
38
+ _ref$config2 = _ref$config === void 0 ? {} : _ref$config,
39
+ _onBlur = _ref$config2.onBlur,
40
+ _config = _objectWithoutProperties(_ref$config2, _excluded),
37
41
  props = _objectWithoutProperties(_ref, _excluded2);
38
42
  return /*#__PURE__*/React.createElement(BasicFormItem, _extends({}, props, {
39
43
  type: "input",
@@ -48,10 +52,10 @@ export var getNumberItem = function getNumberItem() {
48
52
  };
49
53
  export var getStringItem = function getStringItem(_ref2) {
50
54
  var handleValueChange = _ref2.handleValueChange,
51
- _ref2$config = _ref2.config;
52
- _ref2$config = _ref2$config === void 0 ? {} : _ref2$config;
53
- var _onBlur2 = _ref2$config.onBlur,
54
- _config = _objectWithoutProperties(_ref2$config, _excluded3),
55
+ _ref2$config = _ref2.config,
56
+ _ref2$config2 = _ref2$config === void 0 ? {} : _ref2$config,
57
+ _onBlur2 = _ref2$config2.onBlur,
58
+ _config = _objectWithoutProperties(_ref2$config2, _excluded3),
55
59
  props = _objectWithoutProperties(_ref2, _excluded4);
56
60
  return /*#__PURE__*/React.createElement(BasicFormItem, _extends({}, props, {
57
61
  config: _objectSpread(_objectSpread({}, _config), {}, {
@@ -66,10 +70,10 @@ export var getStringItem = function getStringItem(_ref2) {
66
70
  export var getTextareaItem = function getTextareaItem() {
67
71
  var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
68
72
  handleValueChange = _ref3.handleValueChange,
69
- _ref3$config = _ref3.config;
70
- _ref3$config = _ref3$config === void 0 ? {} : _ref3$config;
71
- var _onBlur3 = _ref3$config.onBlur,
72
- _config = _objectWithoutProperties(_ref3$config, _excluded5),
73
+ _ref3$config = _ref3.config,
74
+ _ref3$config2 = _ref3$config === void 0 ? {} : _ref3$config,
75
+ _onBlur3 = _ref3$config2.onBlur,
76
+ _config = _objectWithoutProperties(_ref3$config2, _excluded5),
73
77
  props = _objectWithoutProperties(_ref3, _excluded6);
74
78
  return /*#__PURE__*/React.createElement(BasicFormItem, _extends({}, props, {
75
79
  type: "input",
@@ -85,10 +89,10 @@ export var getTextareaItem = function getTextareaItem() {
85
89
  export var getDateItem = function getDateItem() {
86
90
  var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
87
91
  handleValueChange = _ref4.handleValueChange,
88
- _ref4$config = _ref4.config;
89
- _ref4$config = _ref4$config === void 0 ? {} : _ref4$config;
90
- var _onChange = _ref4$config.onChange,
91
- _config = _objectWithoutProperties(_ref4$config, _excluded7),
92
+ _ref4$config = _ref4.config,
93
+ _ref4$config2 = _ref4$config === void 0 ? {} : _ref4$config,
94
+ _onChange = _ref4$config2.onChange,
95
+ _config = _objectWithoutProperties(_ref4$config2, _excluded7),
92
96
  props = _objectWithoutProperties(_ref4, _excluded8);
93
97
  return /*#__PURE__*/React.createElement(BasicFormItem, _extends({}, props, {
94
98
  type: "datePicker",
@@ -114,10 +118,10 @@ export var getUserItem = function getUserItem(_ref5) {
114
118
  };
115
119
  export var getSelectItem = function getSelectItem(_ref6) {
116
120
  var handleValueChange = _ref6.handleValueChange,
117
- _ref6$config = _ref6.config;
118
- _ref6$config = _ref6$config === void 0 ? {} : _ref6$config;
119
- var _onChange3 = _ref6$config.onChange,
120
- _config = _objectWithoutProperties(_ref6$config, _excluded10),
121
+ _ref6$config = _ref6.config,
122
+ _ref6$config2 = _ref6$config === void 0 ? {} : _ref6$config,
123
+ _onChange3 = _ref6$config2.onChange,
124
+ _config = _objectWithoutProperties(_ref6$config2, _excluded10),
121
125
  props = _objectWithoutProperties(_ref6, _excluded11);
122
126
  var config = _objectSpread(_objectSpread({}, _config), {}, {
123
127
  onChange: function onChange(value, e) {
@@ -180,10 +184,10 @@ export var getRadioItem = function getRadioItem() {
180
184
  };
181
185
  export var getGroupItem = function getGroupItem(_ref8) {
182
186
  var handleValueChange = _ref8.handleValueChange,
183
- _ref8$config = _ref8.config;
184
- _ref8$config = _ref8$config === void 0 ? {} : _ref8$config;
185
- var _onChange4 = _ref8$config.onChange,
186
- _config = _objectWithoutProperties(_ref8$config, _excluded13),
187
+ _ref8$config = _ref8.config,
188
+ _ref8$config2 = _ref8$config === void 0 ? {} : _ref8$config,
189
+ _onChange4 = _ref8$config2.onChange,
190
+ _config = _objectWithoutProperties(_ref8$config2, _excluded13),
187
191
  props = _objectWithoutProperties(_ref8, _excluded14);
188
192
  return /*#__PURE__*/React.createElement(TreeSelector, _extends({}, props, {
189
193
  api: "/api/base/group/sysGroupTree/noAuthReadJurisTree?sclassKey=".concat(props.sclassKey),
@@ -197,10 +201,10 @@ export var getGroupItem = function getGroupItem(_ref8) {
197
201
  };
198
202
  export var getColorItem = function getColorItem(_ref9) {
199
203
  var handleValueChange = _ref9.handleValueChange,
200
- _ref9$config = _ref9.config;
201
- _ref9$config = _ref9$config === void 0 ? {} : _ref9$config;
202
- var _onClose = _ref9$config.onClose,
203
- _config = _objectWithoutProperties(_ref9$config, _excluded15),
204
+ _ref9$config = _ref9.config,
205
+ _ref9$config2 = _ref9$config === void 0 ? {} : _ref9$config,
206
+ _onClose = _ref9$config2.onClose,
207
+ _config = _objectWithoutProperties(_ref9$config2, _excluded15),
204
208
  props = _objectWithoutProperties(_ref9, _excluded16);
205
209
  return /*#__PURE__*/React.createElement(BasicFormItem, _extends({
206
210
  formOptions: {
@@ -218,10 +222,10 @@ export var getColorItem = function getColorItem(_ref9) {
218
222
  };
219
223
  export var getSwitchItem = function getSwitchItem(_ref10) {
220
224
  var handleValueChange = _ref10.handleValueChange,
221
- _ref10$config = _ref10.config;
222
- _ref10$config = _ref10$config === void 0 ? {} : _ref10$config;
223
- var _onChange5 = _ref10$config.onChange,
224
- _config = _objectWithoutProperties(_ref10$config, _excluded17),
225
+ _ref10$config = _ref10.config,
226
+ _ref10$config2 = _ref10$config === void 0 ? {} : _ref10$config,
227
+ _onChange5 = _ref10$config2.onChange,
228
+ _config = _objectWithoutProperties(_ref10$config2, _excluded17),
225
229
  props = _objectWithoutProperties(_ref10, _excluded18);
226
230
  return /*#__PURE__*/React.createElement(BasicFormItem, _extends({}, props, {
227
231
  type: "switch",
@@ -264,4 +268,46 @@ export var getYearItem = function getYearItem() {
264
268
  }
265
269
  })
266
270
  }));
271
+ };
272
+ export var getEditorItem = function getEditorItem() {
273
+ var _ref13 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
274
+ handleValueChange = _ref13.handleValueChange,
275
+ _ref13$config = _ref13.config,
276
+ _ref13$config2 = _ref13$config === void 0 ? {} : _ref13$config,
277
+ _onBlur4 = _ref13$config2.onBlur,
278
+ _config = _objectWithoutProperties(_ref13$config2, _excluded21),
279
+ props = _objectWithoutProperties(_ref13, _excluded22);
280
+ return /*#__PURE__*/React.createElement(BasicFormItem, _extends({}, props, {
281
+ type: "editor",
282
+ config: _objectSpread(_objectSpread({
283
+ language: 'zh-cn',
284
+ headers: {
285
+ Authorization: "Bearer "
286
+ }
287
+ }, _config), {}, {
288
+ onBlur: function onBlur(value) {
289
+ handleValueChange && handleValueChange(value);
290
+ _onBlur4 && _onBlur4(value);
291
+ }
292
+ })
293
+ }));
294
+ };
295
+ export var getUploadItem = function getUploadItem() {
296
+ var _ref14 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
297
+ handleValueChange = _ref14.handleValueChange,
298
+ _ref14$config = _ref14.config,
299
+ _ref14$config2 = _ref14$config === void 0 ? {} : _ref14$config,
300
+ _onBlur5 = _ref14$config2.onBlur,
301
+ _config = _objectWithoutProperties(_ref14$config2, _excluded23),
302
+ props = _objectWithoutProperties(_ref14, _excluded24);
303
+ return /*#__PURE__*/React.createElement(UploadFormItemV3, _extends({}, props, {
304
+ config: _objectSpread(_objectSpread({
305
+ listType: 'picture-card'
306
+ }, _config), {}, {
307
+ onBlur: function onBlur(value) {
308
+ handleValueChange && handleValueChange(value);
309
+ _onBlur5 && _onBlur5(value);
310
+ }
311
+ })
312
+ }));
267
313
  };
@@ -21,9 +21,7 @@ export var doAction = function doAction(action) {
21
21
  showConfirm = _ref$showConfirm === void 0 ? true : _ref$showConfirm,
22
22
  callback = _ref.callback,
23
23
  _ref$showPopWhenSucce = _ref.showPopWhenSuccess,
24
- showPopWhenSuccess = _ref$showPopWhenSucce === void 0 ? true : _ref$showPopWhenSucce,
25
- form_id = _ref.form_id,
26
- effcode = _ref.effcode;
24
+ showPopWhenSuccess = _ref$showPopWhenSucce === void 0 ? true : _ref$showPopWhenSucce;
27
25
  var _ref2 = arguments.length > 3 ? arguments[3] : undefined,
28
26
  _ref2$actions = _ref2.actions,
29
27
  actions = _ref2$actions === void 0 ? {} : _ref2$actions,
@@ -45,16 +43,20 @@ export var doAction = function doAction(action) {
45
43
  onOk: onOk
46
44
  });
47
45
  };
46
+ var get = data.get,
47
+ post = data.post;
48
+ if (!get && !post) {
49
+ get = {};
50
+ post = data;
51
+ }
48
52
  var handleAction = function handleAction() {
49
- behaviorCall({
53
+ behaviorCall(_objectSpread({
50
54
  behaviorKey: action,
51
- moduleCode: moduleCode,
52
- form_id: form_id,
53
- effcode: effcode
54
- }, data).then(function (res) {
55
+ moduleCode: moduleCode
56
+ }, get), post).then(function (res) {
55
57
  var code = res.code,
56
- data = res.data;
57
- callback && callback(code === 1, data, res);
58
+ _data = res.data;
59
+ callback && callback(code === 1, _data, res);
58
60
  if (code === 1 && showPopWhenSuccess) {
59
61
  showPop(formatMessage({
60
62
  id: 'app.base.tip.operate.success'
@@ -109,7 +111,9 @@ export var onBatchSubmitAction = function onBatchSubmitAction(_ref3, callback) {
109
111
  if (isArray(values[value.id])) {
110
112
  _submitData = {
111
113
  addList: values[value.id].map(function (item) {
112
- return dataFormat(gridColumns, item);
114
+ return _objectSpread(_objectSpread({}, dataFormat(gridColumns, item)), {}, {
115
+ indocno: null
116
+ });
113
117
  })
114
118
  };
115
119
  } else {
@@ -127,11 +131,15 @@ export var onBatchSubmitAction = function onBatchSubmitAction(_ref3, callback) {
127
131
  }, {});
128
132
  beforeSubmit(data, values).then(function (backData) {
129
133
  if (backData) {
130
- doAction(action, backData, {
134
+ doAction(action, {
135
+ get: {
136
+ form_id: form_id,
137
+ effcode: effcode
138
+ },
139
+ post: backData
140
+ }, {
131
141
  showConfirm: false,
132
- callback: callback,
133
- form_id: form_id,
134
- effcode: effcode
142
+ callback: callback
135
143
  });
136
144
  }
137
145
  });
package/es/helper/form.js CHANGED
@@ -19,7 +19,8 @@ export var defaultComName = {
19
19
  code: 'string',
20
20
  color: 'color',
21
21
  zone: 'region',
22
- year: 'year'
22
+ year: 'year',
23
+ rte: 'editor'
23
24
  };
24
25
 
25
26
  /**
package/es/services.js CHANGED
@@ -9,14 +9,12 @@ export function readModlue(_x) {
9
9
  function _readModlue() {
10
10
  _readModlue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(get) {
11
11
  return _regeneratorRuntime().wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", request("".concat(api.LUCKDA_HOST, "/ui/builder/noAuthFetchModule?").concat(stringify(get))));
16
- case 1:
17
- case "end":
18
- return _context.stop();
19
- }
12
+ while (1) switch (_context.prev = _context.next) {
13
+ case 0:
14
+ return _context.abrupt("return", request("".concat(api.LUCKDA_HOST, "/ui/builder/noAuthFetchModule?").concat(stringify(get))));
15
+ case 1:
16
+ case "end":
17
+ return _context.stop();
20
18
  }
21
19
  }, _callee);
22
20
  }));
@@ -28,17 +26,15 @@ export function readBehaviorCall(_x2, _x3) {
28
26
  function _readBehaviorCall() {
29
27
  _readBehaviorCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(get, post) {
30
28
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
31
- while (1) {
32
- switch (_context2.prev = _context2.next) {
33
- case 0:
34
- return _context2.abrupt("return", request("".concat(api.LUCKDA_HOST, "/to/behavior/call?").concat(stringify(get)), {
35
- method: 'POST',
36
- body: post
37
- }));
38
- case 1:
39
- case "end":
40
- return _context2.stop();
41
- }
29
+ while (1) switch (_context2.prev = _context2.next) {
30
+ case 0:
31
+ return _context2.abrupt("return", request("".concat(api.LUCKDA_HOST, "/to/behavior/call?").concat(stringify(get)), {
32
+ method: 'POST',
33
+ body: post
34
+ }));
35
+ case 1:
36
+ case "end":
37
+ return _context2.stop();
42
38
  }
43
39
  }, _callee2);
44
40
  }));
@@ -13,19 +13,17 @@ function _behaviorCall() {
13
13
  datasetCode,
14
14
  _args = arguments;
15
15
  return _regeneratorRuntime().wrap(function _callee$(_context) {
16
- while (1) {
17
- switch (_context.prev = _context.next) {
18
- case 0:
19
- get = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
20
- post = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
21
- datasetCode = get.datasetCode;
22
- return _context.abrupt("return", readBehaviorCall(_objectSpread(_objectSpread({}, get), {}, {
23
- datasetCode: datasetCode || Object.keys(post).join(',')
24
- }), post));
25
- case 4:
26
- case "end":
27
- return _context.stop();
28
- }
16
+ while (1) switch (_context.prev = _context.next) {
17
+ case 0:
18
+ get = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
19
+ post = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
20
+ datasetCode = get.datasetCode;
21
+ return _context.abrupt("return", readBehaviorCall(_objectSpread(_objectSpread({}, get), {}, {
22
+ datasetCode: datasetCode || Object.keys(post).join(',')
23
+ }), post));
24
+ case 4:
25
+ case "end":
26
+ return _context.stop();
29
27
  }
30
28
  }, _callee);
31
29
  }));
package/es/utils/form.js CHANGED
@@ -63,6 +63,7 @@ export var formItemDataFormat = function formItemDataFormat() {
63
63
  var propsList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
64
64
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
65
65
  var data = transform(propsList, function (result, n) {
66
+ var _values$name, _values$name2;
66
67
  var _ref2 = n || {},
67
68
  comName = _ref2.comName,
68
69
  property = _ref2.property,
@@ -99,6 +100,9 @@ export var formItemDataFormat = function formItemDataFormat() {
99
100
  case 'radio':
100
101
  result[name] = values[name];
101
102
  break;
103
+ case 'upload':
104
+ result[name] = ((_values$name = values[name]) === null || _values$name === void 0 ? void 0 : _values$name.spath) || ((_values$name2 = values[name]) === null || _values$name2 === void 0 ? void 0 : _values$name2.url);
105
+ break;
102
106
  default:
103
107
  if (!isNil(values["".concat(name, "_virtual")] || values[name])) result[name] = values["".concat(name, "_virtual")] || values[name];
104
108
  }
package/es/utils/grid.js CHANGED
@@ -2,7 +2,6 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
2
2
  var _excluded = ["comName", "property"],
3
3
  _excluded2 = ["name"],
4
4
  _excluded3 = ["filter", "filterParams"];
5
- var _getDvaApp;
6
5
  import React from "react";
7
6
  import { getDvaApp } from 'umi';
8
7
  import { merge, isNil, isArray, includes } from 'lodash';
@@ -10,8 +9,9 @@ import { Switch, Tag } from 'antd';
10
9
  import moment from 'moment';
11
10
  import { defaultComName, translator, formatCustomProps } from '../helper/form';
12
11
  import { formatMessage } from '@luck-design-biz/base/utils';
13
- var _getDvaApp$_store = (_getDvaApp = getDvaApp()) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp._store,
14
- dispatch = _getDvaApp$_store.dispatch;
12
+
13
+ // const { dispatch } = getDvaApp()?._store;
14
+
15
15
  export function getColumnRender(name, type) {
16
16
  var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
17
17
  var render = function render(text, record) {
@@ -130,12 +130,14 @@ export var getGridColumn = function getGridColumn() {
130
130
  data.filter = 'select';
131
131
  data.filterParams = {
132
132
  options: function options() {
133
- return dispatch({
133
+ var _getDvaApp, _getDvaApp$_store;
134
+ return (_getDvaApp = getDvaApp()) === null || _getDvaApp === void 0 ? void 0 : (_getDvaApp$_store = _getDvaApp._store) === null || _getDvaApp$_store === void 0 ? void 0 : _getDvaApp$_store.dispatch({
134
135
  type: 'global/getUser'
135
136
  });
136
137
  },
137
138
  searchData: function searchData(str) {
138
- return dispatch({
139
+ var _getDvaApp2, _getDvaApp2$_store;
140
+ return (_getDvaApp2 = getDvaApp()) === null || _getDvaApp2 === void 0 ? void 0 : (_getDvaApp2$_store = _getDvaApp2._store) === null || _getDvaApp2$_store === void 0 ? void 0 : _getDvaApp2$_store.dispatch({
139
141
  type: "global/getUser",
140
142
  payload: str
141
143
  });
@@ -152,7 +154,8 @@ export var getGridColumn = function getGridColumn() {
152
154
  var _props$config3;
153
155
  data.filterParams = {
154
156
  options: function options() {
155
- return dispatch({
157
+ var _getDvaApp3, _getDvaApp3$_store;
158
+ return (_getDvaApp3 = getDvaApp()) === null || _getDvaApp3 === void 0 ? void 0 : (_getDvaApp3$_store = _getDvaApp3._store) === null || _getDvaApp3$_store === void 0 ? void 0 : _getDvaApp3$_store.dispatch({
156
159
  type: 'global/getDatadic',
157
160
  payload: {
158
161
  snamealias: _props.alias
@@ -168,7 +171,8 @@ export var getGridColumn = function getGridColumn() {
168
171
  data.filter = 'treeSelect';
169
172
  data.filterParams = {
170
173
  options: function options() {
171
- return dispatch({
174
+ var _getDvaApp4, _getDvaApp4$_store;
175
+ return (_getDvaApp4 = getDvaApp()) === null || _getDvaApp4 === void 0 ? void 0 : (_getDvaApp4$_store = _getDvaApp4._store) === null || _getDvaApp4$_store === void 0 ? void 0 : _getDvaApp4$_store.dispatch({
172
176
  type: 'global/readGroup',
173
177
  payload: {
174
178
  sclassKey: _props.sclassKey
@@ -176,7 +180,8 @@ export var getGridColumn = function getGridColumn() {
176
180
  });
177
181
  },
178
182
  searchData: function searchData(str) {
179
- return dispatch({
183
+ var _getDvaApp5, _getDvaApp5$_store;
184
+ return (_getDvaApp5 = getDvaApp()) === null || _getDvaApp5 === void 0 ? void 0 : (_getDvaApp5$_store = _getDvaApp5._store) === null || _getDvaApp5$_store === void 0 ? void 0 : _getDvaApp5$_store.dispatch({
180
185
  type: 'global/readGroup',
181
186
  payload: {
182
187
  sclassKey: _props.sclassKey,
@@ -17,7 +17,7 @@ var _FormList = require("@luck-design-biz/base/FormList");
17
17
  var _ldBuilder = _interopRequireDefault(require("../../helper/ldBuilder"));
18
18
  var _utils = require("../../utils");
19
19
  var _Builder = require("../Builder");
20
- var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData"];
20
+ var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData", "formRef", "formMode"];
21
21
  var defaultOpe = ['read', 'add', 'update', 'delete'];
22
22
  var buildLdAutoForm = function buildLdAutoForm(_ref) {
23
23
  var _ref$columns = _ref.columns,
@@ -49,6 +49,8 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
49
49
  } : _ref$defaultDataSourc,
50
50
  _ref$ticketData = _ref.ticketData,
51
51
  ticketData = _ref$ticketData === void 0 ? {} : _ref$ticketData,
52
+ formRef = _ref.formRef,
53
+ formMode = _ref.formMode,
52
54
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
53
55
  var _ref2 = (0, _react.useContext)(_Builder.LuckDaContext) || {},
54
56
  setFieldProps = _ref2.setFieldProps;
@@ -63,7 +65,12 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
63
65
  return field.name === col.field;
64
66
  }) || {};
65
67
  _defaultValues = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, _defaultValues), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, col.field, col['optDefaultValue']), (0, _defineProperty2.default)(_objectSpread2, "".concat(col.field, "_virtual"), col['optDefaultValueCvt']), _objectSpread2));
66
- result.push((0, _utils.getFormItem)(col, (0, _objectSpread3.default)((0, _objectSpread3.default)({}, customFiled), {}, {
68
+ result.push((0, _utils.getFormItem)(col, (0, _objectSpread3.default)((0, _objectSpread3.default)({
69
+ formId: ldId,
70
+ moduleCode: moduleCode,
71
+ formRef: formRef,
72
+ formMode: formMode
73
+ }, customFiled), {}, {
67
74
  handleValueChange: function handleValueChange(value) {
68
75
  return onValueChange((0, _defineProperty2.default)({}, ldId, (0, _defineProperty2.default)({}, col.field, value)));
69
76
  }
@@ -93,11 +100,13 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
93
100
  return (0, _utils.behaviorCall)(get, post, formData);
94
101
  },
95
102
  get: function get() {
96
- return {
103
+ var _get = {
97
104
  moduleCode: moduleCode,
98
105
  datasetCode: dataSetKey,
99
106
  behaviorKey: behaviorKey
100
107
  };
108
+ if (!isMain) _get.relationDs = mainDataSetKey;
109
+ return _get;
101
110
  }
102
111
  }, _onOperate), {}, {
103
112
  post: function post(_ref3) {
@@ -88,8 +88,8 @@ var LdFormList = function LdFormList(_ref) {
88
88
  var _ref5 = formListRef.current || {},
89
89
  formRefs = _ref5.formRefs;
90
90
  var data = formRefs && Object.keys(formRefs).map(function (key) {
91
- var _formRefs$key$current;
92
- var getValue = formRefs[key].getData || ((_formRefs$key$current = formRefs[key].current) === null || _formRefs$key$current === void 0 ? void 0 : _formRefs$key$current.getFieldsValue);
91
+ var _formRefs$key, _formRefs$key$formRef, _formRefs$key$current;
92
+ var getValue = (((_formRefs$key = formRefs[key]) === null || _formRefs$key === void 0 ? void 0 : (_formRefs$key$formRef = _formRefs$key.formRef) === null || _formRefs$key$formRef === void 0 ? void 0 : _formRefs$key$formRef.current) ? formRefs[key].getData : null) || ((_formRefs$key$current = formRefs[key].current) === null || _formRefs$key$current === void 0 ? void 0 : _formRefs$key$current.getFieldsValue);
93
93
  return (0, _defineProperty2.default)({}, key, getValue && getValue());
94
94
  });
95
95
  onValueChange(change, data);
@@ -129,25 +129,30 @@ var LdFormList = function LdFormList(_ref) {
129
129
  } else {
130
130
  var _formListRef$current;
131
131
  props.parentModelName && ((_formListRef$current = formListRef.current) === null || _formListRef$current === void 0 ? void 0 : _formListRef$current.doParentsQuery());
132
- if (!formWindow && formMode === 'add' && window.__INJECTED_FLOAT_MICRO_APP_BY_QIANKUN) {
133
- var _history$location = _umi.history.location,
134
- pathname = _history$location.pathname,
135
- query = _history$location.query;
136
- var _pathname = pathname.replace(/\/0(?=[?]|[\/]$|$)/g, "/".concat(indocno, "?"));
137
- window.openUrl("layer:".concat(_pathname).concat((0, _querystring.stringify)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, query), {}, {
138
- title: window.__INJECTED_APP_NAME_BY_QIANKUN__
139
- }))));
140
- } else {
141
- formListRef.current.onQuery(null, (0, _defineProperty2.default)({}, mainFormLdId, {
142
- indocno: indocno
143
- }), function () {
144
- return formListRef.current.setFormMode('info');
145
- });
146
- }
132
+ // if (
133
+ // !formWindow &&
134
+ // formMode === 'add' &&
135
+ // window.__INJECTED_FLOAT_MICRO_APP_BY_QIANKUN
136
+ // ) {
137
+ // const { pathname, query } = history.location;
138
+ // window.openUrl(
139
+ // `layer:${pathname}?${stringify({
140
+ // ...query,
141
+ // title: window.__INJECTED_APP_NAME_BY_QIANKUN__,
142
+ // })}`,
143
+ // );
144
+ // } else {
145
+ formListRef.current.onQuery(null, (0, _defineProperty2.default)({}, mainFormLdId, {
146
+ indocno: indocno
147
+ }), function () {
148
+ return formListRef.current.setFormMode('info');
149
+ });
150
+ // }
147
151
  }
148
152
  }
149
153
  });
150
154
  };
155
+
151
156
  var formConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({
152
157
  formState: formState,
153
158
  formMode: formMode,
@@ -196,19 +201,21 @@ var LdFormList = function LdFormList(_ref) {
196
201
  var _props$type = _props.type,
197
202
  type = _props$type === void 0 ? 'auto' : _props$type;
198
203
  var renderForm = type === 'auto' ? _LdAutoForm.default : _LdGridForm.default;
199
- if (header === 'collapse') return /*#__PURE__*/_react.default.createElement(_base.Collapse, {
204
+ if (header === 'collapse' || header === 'collapseFollow') return /*#__PURE__*/_react.default.createElement(_base.Collapse, {
200
205
  title: title || ldId,
201
206
  extra: renderExtra(ldId, extraConfig),
202
207
  id: ldId,
203
208
  key: ldId,
204
- mode: ldId !== mainFormLdId && 'tab'
209
+ mode: header === 'collapse' && ldId !== mainFormLdId && 'tab'
205
210
  }, renderForm((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _props), {}, {
206
211
  ldId: ldId,
207
212
  mainFormLdId: mainFormLdId,
208
213
  mainDataSetKey: mainDataSetKey,
209
214
  readOnly: readOnly || _readOnly,
210
215
  onValueChange: handleValueChange,
211
- ticketData: props.ticketData
216
+ ticketData: props.ticketData,
217
+ formRef: formListRef,
218
+ formMode: formMode
212
219
  })));
213
220
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
214
221
  key: ldId
@@ -225,7 +232,9 @@ var LdFormList = function LdFormList(_ref) {
225
232
  mainDataSetKey: mainDataSetKey,
226
233
  readOnly: readOnly || _readOnly,
227
234
  onValueChange: handleValueChange,
228
- ticketData: props.ticketData
235
+ ticketData: props.ticketData,
236
+ formRef: formListRef,
237
+ formMode: formMode
229
238
  })));
230
239
  }), _utils.ChildrenUtil.deepMap(renderFormExtra(formConfig), function (child) {
231
240
  var _child$type;
@@ -114,16 +114,20 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
114
114
  return (0, _utils.behaviorCall)((0, _objectSpread4.default)((0, _objectSpread4.default)({}, get), {}, (0, _defineProperty2.default)({}, isMain ? 'indocno' : 'relationId', ((_formData$mainFormLdI = formData[mainFormLdId]) === null || _formData$mainFormLdI === void 0 ? void 0 : _formData$mainFormLdI.indocno) || ticketData.indocno)), post, formData);
115
115
  },
116
116
  get: function get() {
117
- return {
117
+ var _get = {
118
118
  moduleCode: moduleCode,
119
119
  datasetCode: dataSetKey,
120
120
  behaviorKey: behaviorKey
121
121
  };
122
+ if (!isMain) _get.relationDs = mainDataSetKey;
123
+ return _get;
122
124
  }
123
125
  }, _onOperate), {}, {
124
126
  post: function post(data) {
125
127
  var _submitData = data.map(function (item) {
126
- return (0, _utils.dataFormat)(gridColumns, item);
128
+ return behaviorKey === 'add' ? (0, _objectSpread4.default)((0, _objectSpread4.default)({}, (0, _utils.dataFormat)(gridColumns, item)), {}, {
129
+ indocno: null
130
+ }) : (0, _utils.dataFormat)(gridColumns, item);
127
131
  });
128
132
  if (_onOperate === null || _onOperate === void 0 ? void 0 : _onOperate.post) return _onOperate.post(_submitData); // 以预设为主
129
133
  return (0, _defineProperty2.default)({}, dataSetKey, (0, _defineProperty2.default)({}, "".concat(behaviorKey, "List"), _submitData));
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getYearItem = exports.getUserItem = exports.getTextareaItem = exports.getSwitchItem = exports.getStringItem = exports.getSelectItem = exports.getRegionItem = exports.getRadioItem = exports.getNumberItem = exports.getGroupItem = exports.getDateItem = exports.getColorItem = void 0;
8
+ exports.getYearItem = exports.getUserItem = exports.getUploadItem = exports.getTextareaItem = exports.getSwitchItem = exports.getStringItem = exports.getSelectItem = exports.getRegionItem = exports.getRadioItem = exports.getNumberItem = exports.getGroupItem = exports.getEditorItem = exports.getDateItem = exports.getColorItem = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
@@ -34,14 +34,18 @@ var _excluded = ["onBlur"],
34
34
  _excluded17 = ["onChange"],
35
35
  _excluded18 = ["handleValueChange", "config"],
36
36
  _excluded19 = ["handleValueChange"],
37
- _excluded20 = ["handleValueChange", "config"];
37
+ _excluded20 = ["handleValueChange", "config"],
38
+ _excluded21 = ["onBlur"],
39
+ _excluded22 = ["handleValueChange", "config"],
40
+ _excluded23 = ["onBlur"],
41
+ _excluded24 = ["handleValueChange", "config"];
38
42
  var getNumberItem = function getNumberItem() {
39
43
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
40
44
  handleValueChange = _ref.handleValueChange,
41
- _ref$config = _ref.config;
42
- _ref$config = _ref$config === void 0 ? {} : _ref$config;
43
- var _onBlur = _ref$config.onBlur,
44
- _config = (0, _objectWithoutProperties2.default)(_ref$config, _excluded),
45
+ _ref$config = _ref.config,
46
+ _ref$config2 = _ref$config === void 0 ? {} : _ref$config,
47
+ _onBlur = _ref$config2.onBlur,
48
+ _config = (0, _objectWithoutProperties2.default)(_ref$config2, _excluded),
45
49
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
46
50
  return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({}, props, {
47
51
  type: "input",
@@ -57,10 +61,10 @@ var getNumberItem = function getNumberItem() {
57
61
  exports.getNumberItem = getNumberItem;
58
62
  var getStringItem = function getStringItem(_ref2) {
59
63
  var handleValueChange = _ref2.handleValueChange,
60
- _ref2$config = _ref2.config;
61
- _ref2$config = _ref2$config === void 0 ? {} : _ref2$config;
62
- var _onBlur2 = _ref2$config.onBlur,
63
- _config = (0, _objectWithoutProperties2.default)(_ref2$config, _excluded3),
64
+ _ref2$config = _ref2.config,
65
+ _ref2$config2 = _ref2$config === void 0 ? {} : _ref2$config,
66
+ _onBlur2 = _ref2$config2.onBlur,
67
+ _config = (0, _objectWithoutProperties2.default)(_ref2$config2, _excluded3),
64
68
  props = (0, _objectWithoutProperties2.default)(_ref2, _excluded4);
65
69
  return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({}, props, {
66
70
  config: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _config), {}, {
@@ -76,10 +80,10 @@ exports.getStringItem = getStringItem;
76
80
  var getTextareaItem = function getTextareaItem() {
77
81
  var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
78
82
  handleValueChange = _ref3.handleValueChange,
79
- _ref3$config = _ref3.config;
80
- _ref3$config = _ref3$config === void 0 ? {} : _ref3$config;
81
- var _onBlur3 = _ref3$config.onBlur,
82
- _config = (0, _objectWithoutProperties2.default)(_ref3$config, _excluded5),
83
+ _ref3$config = _ref3.config,
84
+ _ref3$config2 = _ref3$config === void 0 ? {} : _ref3$config,
85
+ _onBlur3 = _ref3$config2.onBlur,
86
+ _config = (0, _objectWithoutProperties2.default)(_ref3$config2, _excluded5),
83
87
  props = (0, _objectWithoutProperties2.default)(_ref3, _excluded6);
84
88
  return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({}, props, {
85
89
  type: "input",
@@ -96,10 +100,10 @@ exports.getTextareaItem = getTextareaItem;
96
100
  var getDateItem = function getDateItem() {
97
101
  var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
98
102
  handleValueChange = _ref4.handleValueChange,
99
- _ref4$config = _ref4.config;
100
- _ref4$config = _ref4$config === void 0 ? {} : _ref4$config;
101
- var _onChange = _ref4$config.onChange,
102
- _config = (0, _objectWithoutProperties2.default)(_ref4$config, _excluded7),
103
+ _ref4$config = _ref4.config,
104
+ _ref4$config2 = _ref4$config === void 0 ? {} : _ref4$config,
105
+ _onChange = _ref4$config2.onChange,
106
+ _config = (0, _objectWithoutProperties2.default)(_ref4$config2, _excluded7),
103
107
  props = (0, _objectWithoutProperties2.default)(_ref4, _excluded8);
104
108
  return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({}, props, {
105
109
  type: "datePicker",
@@ -127,10 +131,10 @@ var getUserItem = function getUserItem(_ref5) {
127
131
  exports.getUserItem = getUserItem;
128
132
  var getSelectItem = function getSelectItem(_ref6) {
129
133
  var handleValueChange = _ref6.handleValueChange,
130
- _ref6$config = _ref6.config;
131
- _ref6$config = _ref6$config === void 0 ? {} : _ref6$config;
132
- var _onChange3 = _ref6$config.onChange,
133
- _config = (0, _objectWithoutProperties2.default)(_ref6$config, _excluded10),
134
+ _ref6$config = _ref6.config,
135
+ _ref6$config2 = _ref6$config === void 0 ? {} : _ref6$config,
136
+ _onChange3 = _ref6$config2.onChange,
137
+ _config = (0, _objectWithoutProperties2.default)(_ref6$config2, _excluded10),
134
138
  props = (0, _objectWithoutProperties2.default)(_ref6, _excluded11);
135
139
  var config = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _config), {}, {
136
140
  onChange: function onChange(value, e) {
@@ -195,10 +199,10 @@ var getRadioItem = function getRadioItem() {
195
199
  exports.getRadioItem = getRadioItem;
196
200
  var getGroupItem = function getGroupItem(_ref8) {
197
201
  var handleValueChange = _ref8.handleValueChange,
198
- _ref8$config = _ref8.config;
199
- _ref8$config = _ref8$config === void 0 ? {} : _ref8$config;
200
- var _onChange4 = _ref8$config.onChange,
201
- _config = (0, _objectWithoutProperties2.default)(_ref8$config, _excluded13),
202
+ _ref8$config = _ref8.config,
203
+ _ref8$config2 = _ref8$config === void 0 ? {} : _ref8$config,
204
+ _onChange4 = _ref8$config2.onChange,
205
+ _config = (0, _objectWithoutProperties2.default)(_ref8$config2, _excluded13),
202
206
  props = (0, _objectWithoutProperties2.default)(_ref8, _excluded14);
203
207
  return /*#__PURE__*/_react.default.createElement(_base.TreeSelector, (0, _extends2.default)({}, props, {
204
208
  api: "/api/base/group/sysGroupTree/noAuthReadJurisTree?sclassKey=".concat(props.sclassKey),
@@ -213,10 +217,10 @@ var getGroupItem = function getGroupItem(_ref8) {
213
217
  exports.getGroupItem = getGroupItem;
214
218
  var getColorItem = function getColorItem(_ref9) {
215
219
  var handleValueChange = _ref9.handleValueChange,
216
- _ref9$config = _ref9.config;
217
- _ref9$config = _ref9$config === void 0 ? {} : _ref9$config;
218
- var _onClose = _ref9$config.onClose,
219
- _config = (0, _objectWithoutProperties2.default)(_ref9$config, _excluded15),
220
+ _ref9$config = _ref9.config,
221
+ _ref9$config2 = _ref9$config === void 0 ? {} : _ref9$config,
222
+ _onClose = _ref9$config2.onClose,
223
+ _config = (0, _objectWithoutProperties2.default)(_ref9$config2, _excluded15),
220
224
  props = (0, _objectWithoutProperties2.default)(_ref9, _excluded16);
221
225
  return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({
222
226
  formOptions: {
@@ -235,10 +239,10 @@ var getColorItem = function getColorItem(_ref9) {
235
239
  exports.getColorItem = getColorItem;
236
240
  var getSwitchItem = function getSwitchItem(_ref10) {
237
241
  var handleValueChange = _ref10.handleValueChange,
238
- _ref10$config = _ref10.config;
239
- _ref10$config = _ref10$config === void 0 ? {} : _ref10$config;
240
- var _onChange5 = _ref10$config.onChange,
241
- _config = (0, _objectWithoutProperties2.default)(_ref10$config, _excluded17),
242
+ _ref10$config = _ref10.config,
243
+ _ref10$config2 = _ref10$config === void 0 ? {} : _ref10$config,
244
+ _onChange5 = _ref10$config2.onChange,
245
+ _config = (0, _objectWithoutProperties2.default)(_ref10$config2, _excluded17),
242
246
  props = (0, _objectWithoutProperties2.default)(_ref10, _excluded18);
243
247
  return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({}, props, {
244
248
  type: "switch",
@@ -284,4 +288,48 @@ var getYearItem = function getYearItem() {
284
288
  })
285
289
  }));
286
290
  };
287
- exports.getYearItem = getYearItem;
291
+ exports.getYearItem = getYearItem;
292
+ var getEditorItem = function getEditorItem() {
293
+ var _ref13 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
294
+ handleValueChange = _ref13.handleValueChange,
295
+ _ref13$config = _ref13.config,
296
+ _ref13$config2 = _ref13$config === void 0 ? {} : _ref13$config,
297
+ _onBlur4 = _ref13$config2.onBlur,
298
+ _config = (0, _objectWithoutProperties2.default)(_ref13$config2, _excluded21),
299
+ props = (0, _objectWithoutProperties2.default)(_ref13, _excluded22);
300
+ return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({}, props, {
301
+ type: "editor",
302
+ config: (0, _objectSpread2.default)((0, _objectSpread2.default)({
303
+ language: 'zh-cn',
304
+ headers: {
305
+ Authorization: "Bearer "
306
+ }
307
+ }, _config), {}, {
308
+ onBlur: function onBlur(value) {
309
+ handleValueChange && handleValueChange(value);
310
+ _onBlur4 && _onBlur4(value);
311
+ }
312
+ })
313
+ }));
314
+ };
315
+ exports.getEditorItem = getEditorItem;
316
+ var getUploadItem = function getUploadItem() {
317
+ var _ref14 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
318
+ handleValueChange = _ref14.handleValueChange,
319
+ _ref14$config = _ref14.config,
320
+ _ref14$config2 = _ref14$config === void 0 ? {} : _ref14$config,
321
+ _onBlur5 = _ref14$config2.onBlur,
322
+ _config = (0, _objectWithoutProperties2.default)(_ref14$config2, _excluded23),
323
+ props = (0, _objectWithoutProperties2.default)(_ref14, _excluded24);
324
+ return /*#__PURE__*/_react.default.createElement(_base.UploadFormItemV3, (0, _extends2.default)({}, props, {
325
+ config: (0, _objectSpread2.default)((0, _objectSpread2.default)({
326
+ listType: 'picture-card'
327
+ }, _config), {}, {
328
+ onBlur: function onBlur(value) {
329
+ handleValueChange && handleValueChange(value);
330
+ _onBlur5 && _onBlur5(value);
331
+ }
332
+ })
333
+ }));
334
+ };
335
+ exports.getUploadItem = getUploadItem;
@@ -28,9 +28,7 @@ var doAction = function doAction(action) {
28
28
  showConfirm = _ref$showConfirm === void 0 ? true : _ref$showConfirm,
29
29
  callback = _ref.callback,
30
30
  _ref$showPopWhenSucce = _ref.showPopWhenSuccess,
31
- showPopWhenSuccess = _ref$showPopWhenSucce === void 0 ? true : _ref$showPopWhenSucce,
32
- form_id = _ref.form_id,
33
- effcode = _ref.effcode;
31
+ showPopWhenSuccess = _ref$showPopWhenSucce === void 0 ? true : _ref$showPopWhenSucce;
34
32
  var _ref2 = arguments.length > 3 ? arguments[3] : undefined,
35
33
  _ref2$actions = _ref2.actions,
36
34
  actions = _ref2$actions === void 0 ? {} : _ref2$actions,
@@ -52,16 +50,20 @@ var doAction = function doAction(action) {
52
50
  onOk: onOk
53
51
  });
54
52
  };
53
+ var get = data.get,
54
+ post = data.post;
55
+ if (!get && !post) {
56
+ get = {};
57
+ post = data;
58
+ }
55
59
  var handleAction = function handleAction() {
56
- (0, _utils2.behaviorCall)({
60
+ (0, _utils2.behaviorCall)((0, _objectSpread2.default)({
57
61
  behaviorKey: action,
58
- moduleCode: moduleCode,
59
- form_id: form_id,
60
- effcode: effcode
61
- }, data).then(function (res) {
62
+ moduleCode: moduleCode
63
+ }, get), post).then(function (res) {
62
64
  var code = res.code,
63
- data = res.data;
64
- callback && callback(code === 1, data, res);
65
+ _data = res.data;
66
+ callback && callback(code === 1, _data, res);
65
67
  if (code === 1 && showPopWhenSuccess) {
66
68
  (0, _utils.showPop)((0, _utils.formatMessage)({
67
69
  id: 'app.base.tip.operate.success'
@@ -117,7 +119,9 @@ var onBatchSubmitAction = function onBatchSubmitAction(_ref3, callback) {
117
119
  if ((0, _lodash.isArray)(values[value.id])) {
118
120
  _submitData = {
119
121
  addList: values[value.id].map(function (item) {
120
- return (0, _utils2.dataFormat)(gridColumns, item);
122
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _utils2.dataFormat)(gridColumns, item)), {}, {
123
+ indocno: null
124
+ });
121
125
  })
122
126
  };
123
127
  } else {
@@ -135,11 +139,15 @@ var onBatchSubmitAction = function onBatchSubmitAction(_ref3, callback) {
135
139
  }, {});
136
140
  beforeSubmit(data, values).then(function (backData) {
137
141
  if (backData) {
138
- doAction(action, backData, {
142
+ doAction(action, {
143
+ get: {
144
+ form_id: form_id,
145
+ effcode: effcode
146
+ },
147
+ post: backData
148
+ }, {
139
149
  showConfirm: false,
140
- callback: callback,
141
- form_id: form_id,
142
- effcode: effcode
150
+ callback: callback
143
151
  });
144
152
  }
145
153
  });
@@ -28,7 +28,8 @@ var defaultComName = {
28
28
  code: 'string',
29
29
  color: 'color',
30
30
  zone: 'region',
31
- year: 'year'
31
+ year: 'year',
32
+ rte: 'editor'
32
33
  };
33
34
 
34
35
  /**
package/lib/services.js CHANGED
@@ -17,14 +17,12 @@ function readModlue(_x) {
17
17
  function _readModlue() {
18
18
  _readModlue = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(get) {
19
19
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
20
- while (1) {
21
- switch (_context.prev = _context.next) {
22
- case 0:
23
- return _context.abrupt("return", (0, _utils.request)("".concat(_ApiConfig.default.LUCKDA_HOST, "/ui/builder/noAuthFetchModule?").concat((0, _querystring.stringify)(get))));
24
- case 1:
25
- case "end":
26
- return _context.stop();
27
- }
20
+ while (1) switch (_context.prev = _context.next) {
21
+ case 0:
22
+ return _context.abrupt("return", (0, _utils.request)("".concat(_ApiConfig.default.LUCKDA_HOST, "/ui/builder/noAuthFetchModule?").concat((0, _querystring.stringify)(get))));
23
+ case 1:
24
+ case "end":
25
+ return _context.stop();
28
26
  }
29
27
  }, _callee);
30
28
  }));
@@ -36,17 +34,15 @@ function readBehaviorCall(_x2, _x3) {
36
34
  function _readBehaviorCall() {
37
35
  _readBehaviorCall = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(get, post) {
38
36
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
39
- while (1) {
40
- switch (_context2.prev = _context2.next) {
41
- case 0:
42
- return _context2.abrupt("return", (0, _utils.request)("".concat(_ApiConfig.default.LUCKDA_HOST, "/to/behavior/call?").concat((0, _querystring.stringify)(get)), {
43
- method: 'POST',
44
- body: post
45
- }));
46
- case 1:
47
- case "end":
48
- return _context2.stop();
49
- }
37
+ while (1) switch (_context2.prev = _context2.next) {
38
+ case 0:
39
+ return _context2.abrupt("return", (0, _utils.request)("".concat(_ApiConfig.default.LUCKDA_HOST, "/to/behavior/call?").concat((0, _querystring.stringify)(get)), {
40
+ method: 'POST',
41
+ body: post
42
+ }));
43
+ case 1:
44
+ case "end":
45
+ return _context2.stop();
50
46
  }
51
47
  }, _callee2);
52
48
  }));
@@ -20,19 +20,17 @@ function _behaviorCall() {
20
20
  datasetCode,
21
21
  _args = arguments;
22
22
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
23
- while (1) {
24
- switch (_context.prev = _context.next) {
25
- case 0:
26
- get = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
27
- post = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
28
- datasetCode = get.datasetCode;
29
- return _context.abrupt("return", (0, _services.readBehaviorCall)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, get), {}, {
30
- datasetCode: datasetCode || Object.keys(post).join(',')
31
- }), post));
32
- case 4:
33
- case "end":
34
- return _context.stop();
35
- }
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ get = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
26
+ post = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
27
+ datasetCode = get.datasetCode;
28
+ return _context.abrupt("return", (0, _services.readBehaviorCall)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, get), {}, {
29
+ datasetCode: datasetCode || Object.keys(post).join(',')
30
+ }), post));
31
+ case 4:
32
+ case "end":
33
+ return _context.stop();
36
34
  }
37
35
  }, _callee);
38
36
  }));
package/lib/utils/form.js CHANGED
@@ -71,6 +71,7 @@ var formItemDataFormat = function formItemDataFormat() {
71
71
  var propsList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
72
72
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
73
73
  var data = (0, _lodash.transform)(propsList, function (result, n) {
74
+ var _values$name, _values$name2;
74
75
  var _ref2 = n || {},
75
76
  comName = _ref2.comName,
76
77
  property = _ref2.property,
@@ -107,6 +108,9 @@ var formItemDataFormat = function formItemDataFormat() {
107
108
  case 'radio':
108
109
  result[name] = values[name];
109
110
  break;
111
+ case 'upload':
112
+ result[name] = ((_values$name = values[name]) === null || _values$name === void 0 ? void 0 : _values$name.spath) || ((_values$name2 = values[name]) === null || _values$name2 === void 0 ? void 0 : _values$name2.url);
113
+ break;
110
114
  default:
111
115
  if (!(0, _lodash.isNil)(values["".concat(name, "_virtual")] || values[name])) result[name] = values["".concat(name, "_virtual")] || values[name];
112
116
  }
package/lib/utils/grid.js CHANGED
@@ -17,9 +17,8 @@ var _utils = require("@luck-design-biz/base/utils");
17
17
  var _excluded = ["comName", "property"],
18
18
  _excluded2 = ["name"],
19
19
  _excluded3 = ["filter", "filterParams"];
20
- var _getDvaApp;
21
- var _getDvaApp$_store = (_getDvaApp = (0, _umi.getDvaApp)()) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp._store,
22
- dispatch = _getDvaApp$_store.dispatch;
20
+ // const { dispatch } = getDvaApp()?._store;
21
+
23
22
  function getColumnRender(name, type) {
24
23
  var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25
24
  var render = function render(text, record) {
@@ -138,12 +137,14 @@ var getGridColumn = function getGridColumn() {
138
137
  data.filter = 'select';
139
138
  data.filterParams = {
140
139
  options: function options() {
141
- return dispatch({
140
+ var _getDvaApp, _getDvaApp$_store;
141
+ return (_getDvaApp = (0, _umi.getDvaApp)()) === null || _getDvaApp === void 0 ? void 0 : (_getDvaApp$_store = _getDvaApp._store) === null || _getDvaApp$_store === void 0 ? void 0 : _getDvaApp$_store.dispatch({
142
142
  type: 'global/getUser'
143
143
  });
144
144
  },
145
145
  searchData: function searchData(str) {
146
- return dispatch({
146
+ var _getDvaApp2, _getDvaApp2$_store;
147
+ return (_getDvaApp2 = (0, _umi.getDvaApp)()) === null || _getDvaApp2 === void 0 ? void 0 : (_getDvaApp2$_store = _getDvaApp2._store) === null || _getDvaApp2$_store === void 0 ? void 0 : _getDvaApp2$_store.dispatch({
147
148
  type: "global/getUser",
148
149
  payload: str
149
150
  });
@@ -160,7 +161,8 @@ var getGridColumn = function getGridColumn() {
160
161
  var _props$config3;
161
162
  data.filterParams = {
162
163
  options: function options() {
163
- return dispatch({
164
+ var _getDvaApp3, _getDvaApp3$_store;
165
+ return (_getDvaApp3 = (0, _umi.getDvaApp)()) === null || _getDvaApp3 === void 0 ? void 0 : (_getDvaApp3$_store = _getDvaApp3._store) === null || _getDvaApp3$_store === void 0 ? void 0 : _getDvaApp3$_store.dispatch({
164
166
  type: 'global/getDatadic',
165
167
  payload: {
166
168
  snamealias: _props.alias
@@ -176,7 +178,8 @@ var getGridColumn = function getGridColumn() {
176
178
  data.filter = 'treeSelect';
177
179
  data.filterParams = {
178
180
  options: function options() {
179
- return dispatch({
181
+ var _getDvaApp4, _getDvaApp4$_store;
182
+ return (_getDvaApp4 = (0, _umi.getDvaApp)()) === null || _getDvaApp4 === void 0 ? void 0 : (_getDvaApp4$_store = _getDvaApp4._store) === null || _getDvaApp4$_store === void 0 ? void 0 : _getDvaApp4$_store.dispatch({
180
183
  type: 'global/readGroup',
181
184
  payload: {
182
185
  sclassKey: _props.sclassKey
@@ -184,7 +187,8 @@ var getGridColumn = function getGridColumn() {
184
187
  });
185
188
  },
186
189
  searchData: function searchData(str) {
187
- return dispatch({
190
+ var _getDvaApp5, _getDvaApp5$_store;
191
+ return (_getDvaApp5 = (0, _umi.getDvaApp)()) === null || _getDvaApp5 === void 0 ? void 0 : (_getDvaApp5$_store = _getDvaApp5._store) === null || _getDvaApp5$_store === void 0 ? void 0 : _getDvaApp5$_store.dispatch({
188
192
  type: 'global/readGroup',
189
193
  payload: {
190
194
  sclassKey: _props.sclassKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luck-design-biz/luckda",
3
- "version": "0.0.9",
3
+ "version": "0.0.11-1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -40,33 +40,14 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@babel/runtime": "^7.18.9",
43
- "@province-city-china/level": "^8.5.4",
44
43
  "ahooks": "^3.7.0",
45
44
  "antd": "^3.26.6",
46
- "bpmn-js": "^7.3.0",
47
- "bpmn-js-properties-panel": "^0.35.0",
48
45
  "classnames": "^2.3.1",
49
- "d3-fetch": "^1.2.0",
50
- "d3-selection": "^1.4.1",
51
- "file-saver": "^2.0.2",
52
- "jointjs": "^3.5.4",
53
- "js-file-download": "^0.4.4",
54
46
  "lodash": "^4.17.11",
55
47
  "moment": "^2.24.0",
56
- "nprogress": "^0.2.0",
57
- "path-to-regexp": "^2.4.0",
58
- "postcss-hash-classname": "^0.4.0",
59
- "postcss-prefixer": "^2.1.3",
60
- "promise-sequential": "^1.1.1",
61
48
  "prop-types": "^15.8.1",
62
49
  "querystring": "^0.2.0",
63
- "raphael": "^2.3.0",
64
- "rc-form": "^2.4.10",
65
- "react": "^16.12.0",
66
- "react-copy-to-clipboard": "^5.0.1",
67
- "react-country-flag": "^2.3.0",
68
- "react-dom": "16.8.0",
69
- "uuid": "^3.3.2"
50
+ "react": "^16.12.0"
70
51
  },
71
52
  "devDependencies": {
72
53
  "@umijs/test": "^3.0.5",