cnhis-design-vue 0.2.66-beta → 0.2.69-beta

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 (116) hide show
  1. package/es/affix/index.js +8 -8
  2. package/es/age/index.js +10 -10
  3. package/es/alert/index.js +8 -8
  4. package/es/anchor/index.js +8 -8
  5. package/es/auto-complete/index.js +8 -8
  6. package/es/avatar/index.js +8 -8
  7. package/es/back-top/index.js +8 -8
  8. package/es/badge/index.js +8 -8
  9. package/es/base/index.js +8 -8
  10. package/es/big-table/index.js +1808 -1302
  11. package/es/big-table/style.css +1 -1
  12. package/es/breadcrumb/index.js +8 -8
  13. package/es/button/index.js +28 -28
  14. package/es/calendar/index.js +8 -8
  15. package/es/captcha/index.js +3 -3
  16. package/es/card/index.js +8 -8
  17. package/es/carousel/index.js +8 -8
  18. package/es/cascader/index.js +8 -8
  19. package/es/checkbox/index.js +9 -9
  20. package/es/col/index.js +8 -8
  21. package/es/collapse/index.js +8 -8
  22. package/es/color-picker/index.js +1 -1
  23. package/es/comment/index.js +8 -8
  24. package/es/config-provider/index.js +8 -8
  25. package/es/date-picker/index.js +8 -8
  26. package/es/descriptions/index.js +8 -8
  27. package/es/divider/index.js +8 -8
  28. package/es/drag-layout/index.js +3 -3
  29. package/es/drawer/index.js +8 -8
  30. package/es/dropdown/index.js +8 -8
  31. package/es/editor/index.js +1 -1
  32. package/es/empty/index.js +8 -8
  33. package/es/fabric-chart/index.js +9 -9
  34. package/es/form/index.js +8 -8
  35. package/es/form-model/index.js +8 -8
  36. package/es/form-table/index.js +62 -62
  37. package/es/index/index.js +2206 -1720
  38. package/es/index/style.css +1 -1
  39. package/es/input/index.js +9 -9
  40. package/es/input-number/index.js +8 -8
  41. package/es/layout/index.js +8 -8
  42. package/es/list/index.js +8 -8
  43. package/es/locale-provider/index.js +8 -8
  44. package/es/map/index.js +9 -9
  45. package/es/mentions/index.js +8 -8
  46. package/es/menu/index.js +8 -8
  47. package/es/message/index.js +8 -8
  48. package/es/multi-chat/index.js +75 -75
  49. package/es/multi-chat-client/index.js +69 -69
  50. package/es/multi-chat-history/index.js +4 -4
  51. package/es/multi-chat-record/index.js +14 -14
  52. package/es/multi-chat-setting/index.js +22 -22
  53. package/es/multi-chat-sip/index.js +1 -1
  54. package/es/notification/index.js +8 -8
  55. package/es/page-header/index.js +8 -8
  56. package/es/pagination/index.js +8 -8
  57. package/es/popconfirm/index.js +8 -8
  58. package/es/popover/index.js +8 -8
  59. package/es/progress/index.js +8 -8
  60. package/es/radio/index.js +9 -9
  61. package/es/rate/index.js +8 -8
  62. package/es/result/index.js +8 -8
  63. package/es/row/index.js +8 -8
  64. package/es/scale-view/index.js +24 -24
  65. package/es/select/index.js +11 -11
  66. package/es/select-label/index.js +11 -11
  67. package/es/select-person/index.js +2 -2
  68. package/es/skeleton/index.js +8 -8
  69. package/es/slider/index.js +8 -8
  70. package/es/space/index.js +8 -8
  71. package/es/spin/index.js +8 -8
  72. package/es/statistic/index.js +8 -8
  73. package/es/steps/index.js +8 -8
  74. package/es/switch/index.js +8 -8
  75. package/es/table-filter/index.js +199 -177
  76. package/es/table-filter/style.css +1 -1
  77. package/es/tabs/index.js +8 -8
  78. package/es/tag/index.js +9 -9
  79. package/es/time-picker/index.js +8 -8
  80. package/es/timeline/index.js +8 -8
  81. package/es/tooltip/index.js +8 -8
  82. package/es/transfer/index.js +8 -8
  83. package/es/tree/index.js +8 -8
  84. package/es/tree-select/index.js +8 -8
  85. package/es/upload/index.js +8 -8
  86. package/es/utils/utils-map.js +33 -0
  87. package/es/utils/vexutils.js +21 -0
  88. package/es/verification-code/index.js +2 -2
  89. package/lib/cui.common.js +4824 -3817
  90. package/lib/cui.umd.js +4824 -3817
  91. package/lib/cui.umd.min.js +67 -67
  92. package/package.json +1 -1
  93. package/packages/big-table/src/BigTable.vue +107 -221
  94. package/packages/big-table/src/assets/style/table-base.less +16 -0
  95. package/packages/big-table/src/components/edit-form/EditForm.vue +27 -9
  96. package/packages/big-table/src/components/edit-form/edit-component/config-data/index.js +2 -1
  97. package/packages/big-table/src/components/edit-form/edit-component/edit-search/edit-search.vue +2 -3
  98. package/packages/big-table/src/components/edit-form/edit-component/edit-search-more/edit-search-more.vue +2 -2
  99. package/packages/big-table/src/components/edit-form/edit-component/edit-select/edit-select.vue +1 -1
  100. package/packages/big-table/src/components/edit-form/edit-component/edit-select-multiple/edit-select-multiple.vue +1 -1
  101. package/packages/big-table/src/components/edit-form/edit-component/edit-switch/edit-switch.vue +43 -0
  102. package/packages/big-table/src/components/edit-form/edit-component/mixins/dateType.js +5 -4
  103. package/packages/big-table/src/components/edit-form/edit-component/mixins/item-default.js +50 -5
  104. package/packages/big-table/src/components/edit-form/edit-component/mixins/search.js +202 -153
  105. package/packages/big-table/src/components/edit-form/edit-item/form-event.js +3 -2
  106. package/packages/big-table/src/components/edit-form/edit-item/validate-rules.js +6 -6
  107. package/packages/big-table/src/components/edit-form/edit-mixins/form-commom.js +25 -20
  108. package/packages/big-table/src/components/player-vod/video-list.vue +3 -2
  109. package/packages/big-table/src/utils/batchEditing.js +144 -75
  110. package/packages/big-table/src/utils/bigTableProps.js +9 -13
  111. package/packages/table-filter/src/base-search-com/BaseSearch.vue +45 -47
  112. package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +3 -0
  113. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +9 -4
  114. package/packages/table-filter/src/components/search-filter/SearchFilter.vue +11 -3
  115. package/src/utils/utils-map.js +34 -0
  116. package/src/utils/vexutils.js +96 -77
@@ -1,16 +1,17 @@
1
+ import vexutils from '@/utils/vexutils';
1
2
  export const formCommom = {
2
3
  /** 这里的方法 basefrom formitem 都引用, 注意使用 this.xxx 的值 */
3
- props: { styleSetting: { type: Object, default: () => {} } },
4
+ props: { styleSetting: { type: Object, default: () => { } } },
4
5
  computed: {
5
6
  isFormBoldOpen() {
6
- return function(item) {
7
+ return function (item) {
7
8
  let res = item.is_null == '0' && this.styleSetting.formBoldOpen;
8
9
  return res;
9
10
  };
10
11
  },
11
12
  // 组合组件 是否显示拖拽icon
12
13
  showDragIcon() {
13
- return function(item) {
14
+ return function (item) {
14
15
  let { combinationList = [] } = item || {};
15
16
  if (!combinationList.length) return false;
16
17
  // delete 之后是软删除 过滤 isCombinationHide=true
@@ -19,8 +20,8 @@ export const formCommom = {
19
20
  };
20
21
  }
21
22
  },
22
- beforeCreate() {},
23
- created() {},
23
+ beforeCreate() { },
24
+ created() { },
24
25
  methods: {
25
26
  // 获取表单默认值
26
27
  handleGetdef(item) {
@@ -93,13 +94,15 @@ export const formCommom = {
93
94
  defVal = this.getInitializeDef(item);
94
95
  defVal = this.transformNumber(defVal);
95
96
  break;
96
- case 'EVALUATE':
97
97
  case 'SWITCH_COMPONENT':
98
+ defVal = this.getSwitchDef(item);
99
+ break;
100
+ case 'EVALUATE':
98
101
  defVal = this.getInitializeDef(item);
99
102
  break;
100
103
  case 'AGE_JSON':
101
104
  var d = this.getInitializeDef(item) || {};
102
- if (this.$utils.isJSON(d)) {
105
+ if (vexutils.isJSON(d)) {
103
106
  d = JSON.parse(d);
104
107
  }
105
108
  if (typeof d == 'object') {
@@ -122,6 +125,11 @@ export const formCommom = {
122
125
  }
123
126
  return defVal;
124
127
  },
128
+ getSwitchDef(item) {
129
+ let tempDef = this.getInitializeDef(item)
130
+ return tempDef === item?.open?.value
131
+
132
+ },
125
133
  getInitializeDef(item) {
126
134
  return this.handleSysParams(this.defaultValue[item.name] || item.default_val || '');
127
135
  },
@@ -142,7 +150,7 @@ export const formCommom = {
142
150
  var checkboxList = [];
143
151
  checkboxVal = this.handleSysParams(checkboxVal);
144
152
  if (typeof checkboxVal === 'string') {
145
- if (this.$utils.isJSON(checkboxVal)) {
153
+ if (vexutils.isJSON(checkboxVal)) {
146
154
  checkboxList = JSON.parse(checkboxVal);
147
155
  } else {
148
156
  checkboxList = checkboxVal ? checkboxVal.split(',') : [];
@@ -193,9 +201,6 @@ export const formCommom = {
193
201
  propsDate = this.handleSysParams(propsDate);
194
202
  }
195
203
  let dateType = this.handlerGetDateType(item);
196
- // if (!this.$utils.isDate(propsDate)) {
197
- // return null;
198
- // }
199
204
  if (dateType == 'HH:mm:ss' || dateType == 'HH:mm') {
200
205
  return propsDate && this.$moment(propsDate, dateType).isValid() ? this.$moment(propsDate, dateType) : null;
201
206
  } else {
@@ -235,7 +240,7 @@ export const formCommom = {
235
240
  handlerDefaultUpload(data, type = 'default') {
236
241
  let currentData;
237
242
  let fileList;
238
- if (this.$utils.isJSON(data)) {
243
+ if (vexutils.isJSON(data)) {
239
244
  currentData = JSON.parse(data);
240
245
  } else {
241
246
  currentData = data;
@@ -278,7 +283,7 @@ export const formCommom = {
278
283
  let defaultValue = this.defaultValue[v.name] || v.default_val;
279
284
  if (typeof defaultValue === 'string') {
280
285
  defaultValue = this.handleSysParams(defaultValue);
281
- if (!this.$utils.isJSON(defaultValue)) {
286
+ if (!vexutils.isJSON(defaultValue)) {
282
287
  return [];
283
288
  }
284
289
  }
@@ -353,13 +358,13 @@ export const formCommom = {
353
358
  handleGetJsonStr(str) {
354
359
  // {objs:[],objstr:''}, {type: 'jsonb', value: "{objs:[],objstr:''}"}
355
360
  let resObj = {};
356
- if (this.$utils.isJSON(str)) {
361
+ if (vexutils.isJSON(str)) {
357
362
  resObj = JSON.parse(str);
358
363
  } else {
359
364
  resObj = typeof str === 'string' ? {} : str;
360
365
  }
361
366
  if (resObj && !resObj.objs && resObj.value) {
362
- if (this.$utils.isJSON(resObj.value)) {
367
+ if (vexutils.isJSON(resObj.value)) {
363
368
  resObj = JSON.parse(resObj.value);
364
369
  // loop
365
370
  if (resObj.type === 'jsonb') {
@@ -387,7 +392,7 @@ export const formCommom = {
387
392
  // let isEmpty = v => Object.keys(v || {}).length;
388
393
  const that = this;
389
394
  const getVal = (t, r, k) => {
390
- return t.replace(r, function() {
395
+ return t.replace(r, function () {
391
396
  var pKey = arguments[1];
392
397
  var pls = pKey.split('!');
393
398
  var plsList = pls.slice(1);
@@ -512,14 +517,14 @@ export const formCommom = {
512
517
  }
513
518
  if (!v || v.type === 'blur') return;
514
519
  const curDateStr = v.format('YYYY-MM-DD');
515
- const nowDateStr = this.$utils.toDateString(new Date(), 'yyyy-MM-dd');
520
+ const nowDateStr = vexutils.toDateString(new Date(), 'yyyy-MM-dd');
516
521
  let timeDiff;
517
522
  if (CompareDate(curDateStr, nowDateStr)) {
518
- timeDiff = this.$utils.getDateDiff(curDateStr, nowDateStr);
523
+ timeDiff = vexutils.getDateDiff(curDateStr, nowDateStr);
519
524
  } else if (curDateStr == nowDateStr) {
520
525
  timeDiff = { time: 0 };
521
526
  } else if (CompareDate(nowDateStr, curDateStr)) {
522
- timeDiff = this.$utils.getDateDiff(nowDateStr, curDateStr);
527
+ timeDiff = vexutils.getDateDiff(nowDateStr, curDateStr);
523
528
  timeDiff.time = -timeDiff.time;
524
529
  }
525
530
  if (!timeDiff) return;
@@ -538,7 +543,7 @@ export const formCommom = {
538
543
  let dueDateM = parseInt(month) + 9 > 12 ? parseInt(month) - 3 : parseInt(month) + 9;
539
544
  dueDateM = dueDateM >= 10 ? dueDateM : '0' + dueDateM;
540
545
  const dueDateY = parseInt(month) + 9 > 12 ? parseInt(year) + 1 : year;
541
- dueDate = this.$utils.toDateString(this.$utils.getWhatDay(`${dueDateY}-${dueDateM}-${day}`, 7), 'yyyy-MM-dd');
546
+ dueDate = vexutils.toDateString(vexutils.getWhatDay(`${dueDateY}-${dueDateM}-${day}`, 7), 'yyyy-MM-dd');
542
547
  // function CompareDate(param) { }
543
548
  mapList.forEach(item => {
544
549
  const { validate } = item;
@@ -23,6 +23,7 @@
23
23
  <script>
24
24
  import videoModal from './video-modal';
25
25
  import { Icon } from 'ant-design-vue';
26
+ import vexutils from '@/utils/vexutils';
26
27
  export default {
27
28
  name: 'videoList',
28
29
  data() {
@@ -114,13 +115,13 @@ export default {
114
115
  handleGetJsonStr(str) {
115
116
  // [], {type: 'jsonb', value: "[]"}
116
117
  let resList = [];
117
- if (this.$utils.isJSON(str)) {
118
+ if (vexutils.isJSON(str)) {
118
119
  resList = JSON.parse(str);
119
120
  } else {
120
121
  resList = typeof str === 'string' ? [] : str;
121
122
  }
122
123
  if (resList && resList.type === 'jsonb') {
123
- if (this.$utils.isJSON(resList.value)) {
124
+ if (vexutils.isJSON(resList.value)) {
124
125
  resList = JSON.parse(resList.value);
125
126
  // loop
126
127
  if (resList.type === 'jsonb') {
@@ -1,4 +1,5 @@
1
1
  // import { mapMutations, mapActions } from "vuex";
2
+ import utils from "@/utils/utils-map";
2
3
  export default {
3
4
  props: {
4
5
  // 曾经的getters
@@ -23,7 +24,10 @@ export default {
23
24
  editColumnMap: {},
24
25
  fieldLength: 0,
25
26
  originFormatList: [],
26
- isSaveForm: false
27
+ isSaveForm: false,
28
+ isLoadData: false,
29
+ isLoadColumn: false,
30
+ addInlineEditPrimaryKey: ''
27
31
  };
28
32
  },
29
33
  computed: {
@@ -34,19 +38,39 @@ export default {
34
38
  switchConfig: this.switchConfig || {},
35
39
  hospitalConfigData: this.iconObj || {}
36
40
  };
41
+ },
42
+ tableLoad() {
43
+ return {
44
+ isLoadData: this.isLoadData,
45
+ isLoadColumn: this.isLoadColumn
46
+ }
47
+ },
48
+ isTableEdit() {
49
+ return this.isInlineOperating || this.isInlineAdding
37
50
  }
38
51
  },
39
52
  watch: {
53
+ tableLoad(obj) {
54
+ if (!obj) return;
55
+ let { isLoadData, isLoadColumn } = obj;
56
+ if (!(isLoadData && isLoadColumn)) return;
57
+ if (this.isBatchEditing) return;
58
+ this.$emit('tableLoad', true)
59
+ },
40
60
  /**
41
61
  * 编辑
42
62
  */
43
- isBatchEditing(val) {
63
+ async isBatchEditing(val) {
44
64
  if (!val || this.isNestTable) return false;
45
65
  if (this.isTree != 0 || !this.isMatchComponent) return false;
46
66
  if (!this.checkOperateCurrentTable()) {
47
67
  this.resetBatchOperationRowStatus();
48
68
  return false;
49
69
  }
70
+ // 非行内按钮触发
71
+ if (!this.isRowEditing) {
72
+ await this.toggleColumn()
73
+ }
50
74
  this.hideSelectCloumns();
51
75
  this.handleClickBatchEditBtnByInline();
52
76
  },
@@ -62,10 +86,11 @@ export default {
62
86
  /**
63
87
  * 取消
64
88
  */
65
- isBatchCancel(val) {
89
+ async isBatchCancel(val) {
66
90
  if (!val || this.isNestTable) return false;
67
91
  if (this.isTree != 0 || !this.isMatchComponent) return false;
68
92
  if (!this.checkOperateCurrentTable()) return false;
93
+ await this.toggleColumn('showColumn')
69
94
  this.handleClickBatchCancelBtnByInline();
70
95
  },
71
96
  /**
@@ -76,20 +101,58 @@ export default {
76
101
  if (this.isTree != 0 || !this.isMatchComponent) return false;
77
102
  if (!this.checkOperateCurrentTable()) return false;
78
103
  this.submitBatchInlineForm(obj);
104
+ },
105
+ async isInlineAdding(val) {
106
+ if (!val || this.isNestTable) return false;
107
+ if (this.isTree != 0 || !this.isMatchComponent) return false;
108
+ if (!this.checkOperateCurrentTable()) {
109
+ this.resetBatchOperationRowStatus();
110
+ return false;
111
+ }
112
+ await this.toggleColumn()
113
+ this.hideSelectCloumns();
114
+ this.handleClickAddRow()
79
115
  }
80
116
  },
81
117
  methods: {
118
+ toggleColumn(key) {
119
+ let method = key || 'hideColumn'
120
+ const xGrid = this.$refs.xGrid;
121
+ if (!xGrid) return Promise.resolve();
122
+ let operate = xGrid.getColumnByField("operatorColumn")
123
+ if (method === 'showColumn' && operate.visible) {
124
+ return Promise.resolve();
125
+ }
126
+ return xGrid[method](operate);
127
+ },
128
+ /**
129
+ * 获取配置的 api 方法
130
+ * @param {*} params 调用参数
131
+ * @param {String} key 方法名
132
+ * @param {Object} config 其他配置
133
+ */
134
+ async handleGetConfigApi(params, key, config = {}) {
135
+ try {
136
+ // TODO: 判断 fn 是异步函数还是同步
137
+ const editFormApiConfig = this?.editFormApiConfig || {};
138
+ const fn = editFormApiConfig[key] || null;
139
+ if (typeof fn === 'function') {
140
+ let res = await fn(params, config);
141
+ return Promise.resolve(res);
142
+ } else {
143
+ return Promise.reject(new Error(`${key} Is not a function`));
144
+ }
145
+ } catch (error) {
146
+ return Promise.reject(error);
147
+ }
148
+ },
82
149
  /**
83
150
  * 设置row 为编辑样式
84
151
  */
85
- getBatchOpreateRows() {
152
+ getBatchOpreateRows(arr) {
86
153
  let vxeTable = this.$refs.xGrid;
87
- let arr = this.checkedRows;
88
154
  let { tableData } = vxeTable.getTableData();
89
- // 全部行编辑
90
- if (this.isEditAllRow) {
91
- arr = tableData;
92
- }
155
+ if (!arr.length) return;
93
156
  // 重置状态时使用
94
157
 
95
158
  arr.forEach((item, i) => {
@@ -100,7 +163,7 @@ export default {
100
163
  rowIndex = matchIndex;
101
164
  }
102
165
  }
103
- this.setRowStatus(vxeTable.$el, rowIndex, '66');
166
+ this.setRowStatus(vxeTable.$el, rowIndex, 66);
104
167
  this.$set(item, '__isInlineEditing', true);
105
168
  });
106
169
  },
@@ -117,11 +180,29 @@ export default {
117
180
  vxeTable.clearActived();
118
181
  vxeTable.resetColumn();
119
182
  tableData.forEach((row, index) => {
120
- // row && vxeTable.revertData(row);
121
183
  this.setRowStatus(vxeTable.$el, index, null);
122
184
  this.$set(row, '__isInlineEditing', false);
123
185
  this.$set(row, '__isDisableInlineEdit', false);
124
186
  });
187
+ this.checkedRows = [];
188
+ },
189
+ async handleClickAddRow() {
190
+ if (!this.checkListFormUnionSettingParamsList()) {
191
+ this.handleClickCancelBtnByInline();
192
+ return false;
193
+ }
194
+ this.addInlineEditPrimaryKey = Date.now();
195
+ let formData = {
196
+ [this.handleRowId]: this.addInlineEditPrimaryKey,
197
+ __isInsertRow: true
198
+ };
199
+ let vxeTable = this.$refs.xGrid;
200
+ await vxeTable.insert(formData);
201
+ await vxeTable.loadData([formData]);
202
+ await this.resetInlineBatchEdit();
203
+
204
+ this.setAllRowInlineStatus(true);
205
+ this.setRowStatus(vxeTable.$el, 0, 66);
125
206
  },
126
207
  /**
127
208
  * 批量编辑
@@ -131,7 +212,6 @@ export default {
131
212
  this.handleClickCancelBtnByInline();
132
213
  return false;
133
214
  }
134
-
135
215
  let vxeTable = this.$refs.xGrid;
136
216
  let arr = this.checkedRows;
137
217
  let { tableData } = vxeTable.getTableData();
@@ -140,19 +220,10 @@ export default {
140
220
  arr = tableData;
141
221
  }
142
222
  await vxeTable.loadData(arr);
143
-
144
- // 去掉更新后台时间
145
- // let userInfo = await this.GetRealtimeSysParams();
146
- // userInfo &&
147
- // Object.assign(this.configuration, {
148
- // userInfo
149
- // });
150
-
151
223
  await this.resetInlineBatchEdit();
152
224
 
153
225
  this.setAllRowInlineStatus(true);
154
-
155
- this.getBatchOpreateRows();
226
+ this.getBatchOpreateRows(arr);
156
227
  },
157
228
  /**
158
229
  * 批量保存
@@ -202,7 +273,6 @@ export default {
202
273
  */
203
274
  // 避免每次点击都查询
204
275
  async handleFormTheUniqueKey() {
205
- this.$emit('initInlineEditFormConfig', { listFormUnionSetting: this.listFormUnionSetting, inlineEditFormConfig: this.inlineEditFormConfig });
206
276
  let hasEditRow = this.btnList?.find(item => {
207
277
  let trigger_type = item.settingObj && item.settingObj[0]?.trigger_type;
208
278
  if (item.isShow == 1 && trigger_type == 'EDIT_ROW') return true;
@@ -217,7 +287,7 @@ export default {
217
287
  handleFieldTheUniqueKey() {
218
288
  return new Promise((resolve, reject) => {
219
289
  let { paramsList = [] } = this.listFormUnionSetting || {};
220
- let { fieldList = [] } = this.inlineEditFormConfig;
290
+ let { fieldList = [] } = this.inlineEditFormConfig || {};
221
291
  fieldList = JSON.parse(JSON.stringify(fieldList));
222
292
  this.batchFieldList = [];
223
293
  let batchFieldList = [];
@@ -269,25 +339,34 @@ export default {
269
339
  });
270
340
  return editColumnMap;
271
341
  },
272
- handleRequestedUniqueKey(id) {
273
- return this.axios
274
- .get('tableList/getPrimaryKey', { params: { tableId: id } })
275
- .then(({ data }) => {
276
- let result;
277
- if (data.result == 'SUCCESS') {
278
- const { map = {} } = data;
279
- result = map.primaryKey || undefined;
280
- } else {
281
- result = undefined;
282
- }
283
- this.cacheUniqueKey[id] = { value: result, status: true };
284
- return result;
285
- })
286
- .catch(err => {
287
- console.log(err);
288
- this.cacheUniqueKey[id] = { value: undefined, status: true };
289
- return undefined;
290
- });
342
+ async handleRequestedUniqueKey(id) {
343
+ let handleEditFormRequestedUniqueKey = this.editFormApiConfig?.handleEditFormRequestedUniqueKey
344
+ if (!handleEditFormRequestedUniqueKey || typeof handleEditFormRequestedUniqueKey !== 'function') {
345
+ handleEditFormRequestedUniqueKey = this.getPrimaryKeyRequest;
346
+ }
347
+ return handleEditFormRequestedUniqueKey({ tableId: id }).then((val) => {
348
+ val && (this.cacheUniqueKey[id] = { value: val, status: true })
349
+ })
350
+
351
+ },
352
+ getPrimaryKeyRequest(params) {
353
+ return new Promise((resolve, reject) => {
354
+ this.axios
355
+ .get("tableList/getPrimaryKey", { params })
356
+ .then(({ data }) => {
357
+ let result;
358
+ if (data.result == "SUCCESS") {
359
+ const { map = {} } = data;
360
+ result = map.primaryKey || undefined;
361
+ } else {
362
+ result = undefined;
363
+ }
364
+ resolve(result);
365
+ })
366
+ .catch(err => {
367
+ reject(err);
368
+ });
369
+ });
291
370
  },
292
371
  /**
293
372
  * 判断是否渲染EditForm
@@ -297,7 +376,7 @@ export default {
297
376
  */
298
377
  showEditForm(row, column, $rowIndex) {
299
378
  if (!this.isMatchComponent || this.isNestTable || this.isScanMultiTable) return false;
300
- if (this.isBatchEditing || this.isInlineEditing || this.isInlineAdding) {
379
+ if (this.isBatchEditing || this.isInlineAdding) {
301
380
  let matchObj = this.editColumnMap[column.property];
302
381
  if (!matchObj || !matchObj.matchItem || !matchObj.fieldItem) return false;
303
382
  // 批量编辑 未选择全部行编辑
@@ -305,12 +384,8 @@ export default {
305
384
  let matchIndex = this.checkedRows.findIndex(v => v[this.primaryKey] == row[this.primaryKey]);
306
385
  if (matchIndex < 0) return false;
307
386
  }
308
- // 当行编辑
309
- // if (this.isInlineEditing) {
310
- // let { index } = this.currentClickBtnInfo || {};
311
- // if ($rowIndex !== index) return false;
312
- // }
313
- if (this.isInlineEditing || this.isInlineAdding) {
387
+ // 新增
388
+ if (this.isInlineAdding) {
314
389
  if ($rowIndex !== 0) return false;
315
390
  }
316
391
  return matchObj.matchItem;
@@ -335,7 +410,11 @@ export default {
335
410
  let { fieldItem = {} } = matchObj || {};
336
411
  let defaultCombinationForm = {};
337
412
  if (!this.isInlineAdding) {
338
- let originalRow = this.pageIndexOldtableData.find(item => item[this.primaryKey] == row[this.primaryKey]);
413
+ let originalRow = this.pageIndexOldtableData.find(item => {
414
+ let oldItemVal = utils.handleCurValue(item[this.primaryKey]);
415
+ let rowVal = utils.handleCurValue(row[this.primaryKey]);
416
+ return oldItemVal == rowVal
417
+ });
339
418
  defaultCombinationForm = this.setDefaultFormData(column.property, fieldItem, originalRow);
340
419
  }
341
420
  let tempFieldItem = JSON.parse(JSON.stringify(fieldItem));
@@ -357,7 +436,9 @@ export default {
357
436
  isPure: true,
358
437
  isOpenShortcut: false,
359
438
  cacheUniqueKey: this.cacheUniqueKey,
360
- styleSetting: {}
439
+ styleSetting: {},
440
+ editFormApiConfig: this.editFormApiConfig,
441
+ btnList: this.btnList
361
442
  },
362
443
  on: {
363
444
  handleSubmit: this.handleSubmitEditForm,
@@ -376,33 +457,14 @@ export default {
376
457
  * @param {*} obj formData
377
458
  */
378
459
  handleSubmitEditForm(obj = {}) {
379
- // 单行编辑
380
- if (this.isInlineEditing || this.isInlineAdding) {
381
- this.$emit('submitEditFormSuccess', obj);
382
- return;
383
- }
384
-
385
- // 批量编辑
386
- if (this.isBatchEditing) {
387
- this.$emit('submitEditFormSuccessBatch', obj);
388
- return;
389
- }
460
+ this.$emit('submitEditFormSuccessBatch', obj);
390
461
  },
391
462
  /**
392
463
  * 单个form提交失败
393
464
  * @param {*} obj
394
465
  */
395
466
  banSubmit(obj) {
396
- // 单行编辑
397
- if (this.isInlineEditing || this.isInlineAdding) {
398
- this.$emit('submitEditFormError');
399
- return;
400
- }
401
- // 批量编辑
402
- if (this.isBatchEditing) {
403
- this.$emit('submitEditFormErrorBatch', obj);
404
- return;
405
- }
467
+ this.$emit('submitEditFormErrorBatch', obj);
406
468
  },
407
469
  formatFieldItem(fieldItem) {
408
470
  return Object.assign({}, fieldItem, {
@@ -457,7 +519,7 @@ export default {
457
519
  this.$emit('triggerSpinning', false);
458
520
  if (data.result !== 'SUCCESS') {
459
521
  this.isSaveForm = false;
460
- this.$message.error(data.resultMsg);
522
+ this.$message.error(data.resultMsg || '保存失败');
461
523
  this.resetBatchEditRowStatus();
462
524
  return false;
463
525
  }
@@ -494,7 +556,14 @@ export default {
494
556
  return arr;
495
557
  },
496
558
  savaForm(formId, params) {
497
- let url = `/form/editRows/update/${formId}`;
559
+ let handleEditFormSavaForm = this.editFormApiConfig?.handleEditFormSavaForm
560
+ if (!handleEditFormSavaForm || typeof handleEditFormSavaForm !== 'function') {
561
+ handleEditFormSavaForm = this.savaFormRequest
562
+ }
563
+ return handleEditFormSavaForm(params, { formId })
564
+ },
565
+ savaFormRequest(params, config) {
566
+ let url = `/form/editRows/update/${config.formId}`;
498
567
  return this.axios({
499
568
  method: 'post',
500
569
  url,
@@ -58,37 +58,33 @@ const bigTableProps = {
58
58
  btnList: { type: Array, default: () => [] },
59
59
  spinning: Boolean,
60
60
  rowGroupSetting: { type: Object, default: () => ({}) },
61
- inlineEditFormSubmitDone: Boolean,
62
61
  isInlineOperating: Boolean,
63
62
  inlineEditCurrentOperateBtnId: String,
64
63
  tableRefreshCache: { type: Object, default: () => ({}) }, // 记录需要刷新的列表,当切换到当前列表时更新
65
64
  userInfo: { type: Object, default: () => ({}) },
66
- isInlineEditing: Boolean,
67
65
  isInlineAdding: Boolean,
68
- isInlineSave: Boolean,
69
- isInlineCancel: Boolean,
70
- inlineError: Boolean,
71
- resetInlineEdit: Function, // 重置状态(不包含编辑、新增状态)
72
- resetEditRowStatus: Function, // 重置编辑行保存表单相关状态
66
+ isRowEditing: Boolean,
73
67
  pageIndexOldtableData: {
74
68
  // 原始数据
75
69
  type: Array,
76
70
  default: () => []
77
71
  },
78
72
  submitForm: Function,
79
- isMatchComponent: Boolean,
73
+ isMatchComponent: { type: Boolean, default: true }, // 为了兼容低代码(组件内部)与二次开发平台(vuex)
80
74
  asyncCount: Boolean,
81
75
  showSettings: { type: Object, default: () => ({}) },
82
- inlineFormData: { type: Object, default: () => ({}) },
83
- inlineOriginalTableRow: { type: Object, default: () => ({}) },
84
- filterDomPortal:{ // 表头筛选挂载的地方
76
+ filterDomPortal: { // 表头筛选挂载的地方
85
77
  type: String,
86
78
  default: "body"
87
79
  },
88
- filterTopOffset:{ // 表头 top 调节
80
+ filterTopOffset: { // 表头 top 调节
89
81
  type: Number,
90
82
  default: 0
91
- }
83
+ },
84
+ editFormApiConfig: Object, // 编辑表格api
85
+ defaultEditAllRow: Boolean,
86
+ editTableUid: [String, Number],
87
+ curBatchBtnData: { type: Object, default: () => ({}) }
92
88
  };
93
89
 
94
90
  export default bigTableProps;