ls-pro-common 3.0.98 → 3.1.0

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.
@@ -244,25 +244,29 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
244
244
  };
245
245
  }();
246
246
  var initName = function initName(val) {
247
- var _columns$find;
247
+ var updateTxt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
248
248
  if (!val) return;
249
- var fieldName = ((_columns$find = columns.find(function (o) {
249
+ // 当返回值列不在表格配置中不查询,因为有可能会导致查询别名问题报错。
250
+ var valueColumn = columns.find(function (o) {
250
251
  return o.dataIndex === valueField;
251
- })) === null || _columns$find === void 0 ? void 0 : _columns$find.searchField) || valueField;
252
+ });
253
+ if (!valueColumn) return;
254
+ var fieldName = valueColumn.searchField; //优先取开发人员配置的searchField,没有配置取valueField
255
+ if (!fieldName) {
256
+ fieldName = (isV2 ? 'search.' : '') + valueField;
257
+ }
252
258
  var param = {
253
259
  current: 1,
254
260
  pageSize: 1000
255
261
  };
256
262
  if (Array.isArray(val)) val = val.join(',');
257
263
  if (val.toString().includes(',')) {
258
- fieldName += '_in';
259
- }
260
- if (isV2) {
261
- fieldName = 'search.' + fieldName;
264
+ fieldName = fieldName.split('_')[0] + '_in';
262
265
  }
263
266
  param[fieldName] = val;
264
267
  loadData(param).then(function (result) {
265
268
  initRows.current = result.data;
269
+ if (!updateTxt) return;
266
270
  var rows = (result.data || []).filter(function (o) {
267
271
  return o;
268
272
  });
@@ -284,12 +288,15 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
284
288
  var txt = (_formValue$textNamePr = formValue === null || formValue === void 0 ? void 0 : formValue[textNameProp]) !== null && _formValue$textNamePr !== void 0 ? _formValue$textNamePr : record === null || record === void 0 ? void 0 : record[textNameProp];
285
289
  var val = (_formValue$name = formValue === null || formValue === void 0 ? void 0 : formValue[name]) !== null && _formValue$name !== void 0 ? _formValue$name : record === null || record === void 0 ? void 0 : record[name];
286
290
  setText(txt !== null && txt !== void 0 ? txt : val);
287
- if (val && !txt) {
288
- formValue[textNameProp] = val;
289
- setFormValue(formValue);
290
- // 多值选择或选择的初始值不在第一页时显示有问题
291
- if (textField !== valueField) {
292
- initName(val);
291
+ if (val) {
292
+ if (!txt) {
293
+ formValue[textNameProp] = val;
294
+ setFormValue(formValue);
295
+ if (textField !== valueField) {
296
+ initName(val);
297
+ }
298
+ } else if (multiple) {
299
+ initName(val, false);
293
300
  }
294
301
  }
295
302
  }, [rowKey]);
package/es/utils/modal.js CHANGED
@@ -198,7 +198,7 @@ export var reLogin = function reLogin() {
198
198
  getContainer: getFullScreenElement() || document.body,
199
199
  afterClose: function afterClose() {
200
200
  timeout = false;
201
- (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
201
+ (window.top || window).location.href = location.pathname === '/' ? '/login/' : '/login/?redirect=' + encodeURIComponent(location.href);
202
202
  }
203
203
  });
204
204
  };
@@ -244,25 +244,29 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
244
244
  };
245
245
  }();
246
246
  var initName = function initName(val) {
247
- var _columns$find;
247
+ var updateTxt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
248
248
  if (!val) return;
249
- var fieldName = ((_columns$find = columns.find(function (o) {
249
+ // 当返回值列不在表格配置中不查询,因为有可能会导致查询别名问题报错。
250
+ var valueColumn = columns.find(function (o) {
250
251
  return o.dataIndex === valueField;
251
- })) === null || _columns$find === void 0 ? void 0 : _columns$find.searchField) || valueField;
252
+ });
253
+ if (!valueColumn) return;
254
+ var fieldName = valueColumn.searchField; //优先取开发人员配置的searchField,没有配置取valueField
255
+ if (!fieldName) {
256
+ fieldName = (isV2 ? 'search.' : '') + valueField;
257
+ }
252
258
  var param = {
253
259
  current: 1,
254
260
  pageSize: 1000
255
261
  };
256
262
  if (Array.isArray(val)) val = val.join(',');
257
263
  if (val.toString().includes(',')) {
258
- fieldName += '_in';
259
- }
260
- if (isV2) {
261
- fieldName = 'search.' + fieldName;
264
+ fieldName = fieldName.split('_')[0] + '_in';
262
265
  }
263
266
  param[fieldName] = val;
264
267
  loadData(param).then(function (result) {
265
268
  initRows.current = result.data;
269
+ if (!updateTxt) return;
266
270
  var rows = (result.data || []).filter(function (o) {
267
271
  return o;
268
272
  });
@@ -284,12 +288,15 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
284
288
  var txt = (_formValue$textNamePr = formValue === null || formValue === void 0 ? void 0 : formValue[textNameProp]) !== null && _formValue$textNamePr !== void 0 ? _formValue$textNamePr : record === null || record === void 0 ? void 0 : record[textNameProp];
285
289
  var val = (_formValue$name = formValue === null || formValue === void 0 ? void 0 : formValue[name]) !== null && _formValue$name !== void 0 ? _formValue$name : record === null || record === void 0 ? void 0 : record[name];
286
290
  setText(txt !== null && txt !== void 0 ? txt : val);
287
- if (val && !txt) {
288
- formValue[textNameProp] = val;
289
- setFormValue(formValue);
290
- // 多值选择或选择的初始值不在第一页时显示有问题
291
- if (textField !== valueField) {
292
- initName(val);
291
+ if (val) {
292
+ if (!txt) {
293
+ formValue[textNameProp] = val;
294
+ setFormValue(formValue);
295
+ if (textField !== valueField) {
296
+ initName(val);
297
+ }
298
+ } else if (multiple) {
299
+ initName(val, false);
293
300
  }
294
301
  }
295
302
  }, [rowKey]);
@@ -198,7 +198,7 @@ export var reLogin = function reLogin() {
198
198
  getContainer: getFullScreenElement() || document.body,
199
199
  afterClose: function afterClose() {
200
200
  timeout = false;
201
- (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
201
+ (window.top || window).location.href = location.pathname === '/' ? '/login/' : '/login/?redirect=' + encodeURIComponent(location.href);
202
202
  }
203
203
  });
204
204
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.98",
3
+ "version": "3.1.0",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [