ol-base-components 2.8.13 → 2.8.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "2.8.13",
3
+ "version": "2.8.15",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
@@ -345,31 +345,6 @@ export default {
345
345
  const rangeTimeCloumns = await this.autoDetectRangeTimeFields(swaggersearchColumns);
346
346
  this.formSearchData.tableSearch = [...this.formSearchData.tableSearch, ...rangeTimeCloumns];
347
347
 
348
- // const tableHasCreatedTime = this.formSearchData.tableSearch.some(
349
- // e => e.value === "createdTime"
350
- // );
351
- // if (!tableHasCreatedTime) {
352
- // // 单独处理创建时间 就是BeginTime,EndTime
353
- // const requiredNames = ["BeginTime", "EndTime"];
354
- // const hseCreatedTime = requiredNames.every(name =>
355
- // swaggersearchColumns.some(item => item.name === name)
356
- // );
357
- // if (hseCreatedTime) {
358
- // this.formSearchData.tableSearch.push({
359
- // label: "创建时间",
360
- // value: "createdTime",
361
- // inputType: "picker",
362
- // props: {
363
- // type: "datetimerange",
364
- // startPlaceholder: "开始时间",
365
- // endPlaceholder: "结束时间",
366
- // placeholder: "选择时间范围",
367
- // valueFormat: "yyyy-MM-dd HH:mm:ss",
368
- // format: "yyyy/MM/dd HH:mm:ss",
369
- // },
370
- // });
371
- // }
372
- // }
373
348
  this.findTableSearch =
374
349
  this.formSearchData.tableSearch.length > this.tableSearchSlice
375
350
  ? this.formSearchData.tableSearch.slice(0, this.tableSearchSlice)
@@ -410,23 +385,21 @@ export default {
410
385
  }
411
386
 
412
387
  // 2. 自动识别 xxxxBegin 和 xxxxEnd 格式的范围时间字段
413
- const beginFields = swaggersearchColumns
414
- .filter(item => item.name.endsWith("Begin"))
415
- .map(item => item.name);
388
+ const beginFields = swaggersearchColumns.filter(item => item.name.endsWith("Begin"));
416
389
 
417
- const endFields = swaggersearchColumns
418
- .filter(item => item.name.endsWith("End"))
419
- .map(item => item.name);
390
+ const endFields = swaggersearchColumns.filter(item => item.name.endsWith("End"));
420
391
 
421
392
  // 找出匹配的 Begin 和 End 字段对
422
393
  const rangeTimePairs = [];
423
- beginFields.forEach(beginField => {
424
- const prefix = beginField.replace("Begin", "");
394
+ beginFields.forEach(item => {
395
+ const prefix = item.name.replace("Begin", "");
425
396
  const correspondingEndField = prefix + "End";
426
-
427
- if (endFields.includes(correspondingEndField)) {
397
+ const endTemp = endFields.find(e => e.name === correspondingEndField);
398
+ if (endTemp) {
428
399
  rangeTimePairs.push({
429
- beginField,
400
+ ...item,
401
+ description: item.description || endTemp.description || "", //先用Begin的中文,没有就用End的
402
+ beginField: item.name,
430
403
  endField: correspondingEndField,
431
404
  timeField: prefix + "Time",
432
405
  label: prefix,
@@ -436,7 +409,7 @@ export default {
436
409
 
437
410
  // 使用 for...of 循环等待所有异步操作完成
438
411
  for (const pair of rangeTimePairs) {
439
- const { beginField, endField, timeField, label } = pair;
412
+ const { beginField, endField, timeField, description } = pair;
440
413
 
441
414
  // 检查是否已经存在该时间字段
442
415
  const timeFieldExists = this.formSearchData.tableSearch.some(
@@ -444,7 +417,8 @@ export default {
444
417
  );
445
418
 
446
419
  if (!timeFieldExists) {
447
- const labelCHN = await camelCaseToChinese(label);
420
+ // const labelCHN = await camelCaseToChinese(label); //内网项目无法使用
421
+ const labelCHN = description;
448
422
 
449
423
  // 从 formSearchData.value 中移除原始字段
450
424
  this.removeOriginalFieldsFromValue([beginField, endField]);
@@ -492,6 +466,21 @@ export default {
492
466
  this.formSearch.BeginTime = null;
493
467
  this.formSearch.EndTime = null;
494
468
  }
469
+ // 以Time结尾,并在this.formSearch.tableSearch中通过prop获取后取type为datetimerange的
470
+ Object.keys(this.formSearch).forEach(key => {
471
+ const fieldConfig = this.formSearchData.tableSearch.find(item => item.value === key);
472
+ if (fieldConfig && fieldConfig.originalFields) {
473
+ const { begin, end } = fieldConfig.originalFields;
474
+ if (this.formSearch[key] && Array.isArray(this.formSearch[key])) {
475
+ this.formSearch[begin] = this.formSearch[key][0];
476
+ this.formSearch[end] = this.formSearch[key][1];
477
+ } else {
478
+ this.formSearch[begin] = null;
479
+ this.formSearch[end] = null;
480
+ }
481
+ }
482
+ });
483
+
495
484
  const tempFormSearch = Object.assign({}, this.formSearch);
496
485
  if (this.formSearchData.rules) {
497
486
  return this.$refs[formName].validate(valid => {