cloud-web-corejs 1.0.54-dev.202 → 1.0.54-dev.204

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 (20) hide show
  1. package/package.json +1 -1
  2. package/src/components/excelExport/mixins.js +1 -1
  3. package/src/components/xform/form-designer/designer.js +0 -1
  4. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +245 -1
  5. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +30 -36
  6. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
  7. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +1 -1
  8. package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
  9. package/src/components/xform/form-designer/setting-panel/indexMixin.js +2 -0
  10. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +23 -4
  11. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +214 -129
  12. package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +8 -3
  13. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +2 -0
  14. package/src/components/xform/form-render/container-item/data-table-item.vue +7 -4
  15. package/src/components/xform/form-render/container-item/data-table-mixin.js +225 -34
  16. package/src/components/xform/form-render/container-item/data-table-mixin2.js +2169 -0
  17. package/src/components/xform/form-render/indexMixin.js +65 -16
  18. package/src/components/xform/utils/formula-util.js +33 -12
  19. package/src/components/xform/utils/util.js +762 -999
  20. package/src/views/bd/setting/form_script/edit1.vue +8 -1
@@ -10,6 +10,9 @@ import {
10
10
  assembleAxiosConfig,
11
11
  getReportGlobalMap,
12
12
  generateId,
13
+ deepClone,
14
+ loopHandleWidget,
15
+ columnFormatMap
13
16
  } from "../../../../components/xform/utils/util";
14
17
  import {tableTreeMixins} from "../../../../mixins/tableTree/index.js";
15
18
 
@@ -109,7 +112,11 @@ modules = {
109
112
  tableConfig: {},
110
113
  showTableFormDialogContent: true,
111
114
  widgetMap: {},
112
- rowWidgetList: []
115
+ rowWidgetList: [],
116
+
117
+ rowIdData: [],
118
+ fieldSchemaMap: {},
119
+ fieldSchemaData: [],
113
120
  };
114
121
  },
115
122
  watch: {
@@ -162,6 +169,8 @@ modules = {
162
169
  if (!this.formModel[this.fieldKeyName])
163
170
  this.formModel[this.fieldKeyName] = [];
164
171
  this.initRefList();
172
+ this.initConfig();
173
+ this.registerTableRefList();
165
174
  this.handleOnCreated();
166
175
  },
167
176
  mounted: async function () {
@@ -172,42 +181,73 @@ modules = {
172
181
  this.unregisterFromRefList();
173
182
  },
174
183
  methods: {
184
+ initConfig() {
185
+ let formRef = this.getFormRef();
186
+ this.widget.options.tableColumns.forEach(row => {
187
+ let type = columnFormatMap[row.formatS];
188
+ if (type && row.columnOption && !row.widget) {
189
+ let fieldWidget = formRef.copyNewFieldWidget(
190
+ formRef.getFieldWidgetByType(type)
191
+ );
192
+ fieldWidget.options = row.columnOption;
193
+ row.widget = fieldWidget;
194
+ }
195
+ let type2 = columnFormatMap[row.editFormatS];
196
+ if (type2 && row.editColumnOption && !row.editWidget) {
197
+ let fieldWidget = formRef.copyNewFieldWidget(
198
+ formRef.getFieldWidgetByType(type2)
199
+ );
200
+ fieldWidget.options = row.editColumnOption;
201
+ row.editWidget = fieldWidget;
202
+ }
203
+ })
204
+ },
205
+ registerTableRefList() {
206
+ this.sfRefList[this.widget.options.name] = this
207
+ },
175
208
  getRowRefKey(row, name) {
176
209
  let keyVal = row._X_ROW_KEY;
177
210
  let key = name + "_" + keyVal;
178
211
  return key;
179
212
  },
180
213
  getWidgetByTableRow(index, name) {
181
- let target = this.getWidgetRefByTableRow(index, name)
182
- let widget = target.field || target.widget;
214
+ // let target = this.getWidgetRefByTableRow(index, name)
215
+ // let widget = target.field || target.widget;
216
+ // let row = this.getGridTable().getTableData().fullData[index];
217
+ let formRows = this.formModel[this.fieldKeyName];
218
+ let row = formRows[index];
219
+ let widget = this.getWidgetByTableRowData(row, name)
183
220
  return widget
184
221
  },
185
222
  getWidgetRefByTableRow(index, name) {
186
- let row = this.getGridTable().getTableData().fullData[index];
223
+ // let row = this.getGridTable().getTableData().fullData[index];
224
+ let formRows = this.formModel[this.fieldKeyName];
225
+ let row = formRows[index];
226
+ return this.getWidgetRefByTableRowData(row, name);
227
+ },
228
+ getWidgetByTableRowData(row, name) {
229
+ let target = this.getWidgetRefByTableRowData(row, name);
230
+ let widget = target.field || target.widget;
231
+ return widget
232
+ },
233
+ getWidgetRefByTableRowData(row, name) {
187
234
  let key = this.getRowRefKey(row, name);
188
235
  return this.getWidgetRef(key);
189
236
  },
237
+
190
238
  getWidgetRefByTableParam(tableParam) {
191
- let index = tableParam.rowIndex;
192
- let params = tableParam.column.params;
193
- let name = params.widget.options.name;
194
- return this.getWidgetRefByTableRow(index, name);
239
+ // let params = tableParam.column.params;
240
+ // let name = params.widget.options.name;
241
+ // let key = this.getRowRefKey(tableParam.row, name);
242
+ return this.getWidgetRefByTableRowData(tableParam.row, name)
243
+ // return this.getWidgetRef(key);
195
244
  },
196
245
  getRowWidget(rowParam, fieldWidget) {
197
246
  let row = rowParam.row;
198
247
  let params = rowParam.column.params;
199
- let name = fieldWidget ? fieldWidget.options.name : params.widget.options.name;
200
- let key = this.getRowRefKey(row, name);
201
- let widget = this.widgetMap[key];
202
- if (!widget) {
203
- this.$set(
204
- this.widgetMap,
205
- key,
206
- this.$baseLodash.cloneDeep(fieldWidget ? fieldWidget : params.widget)
207
- );
208
- }
209
-
210
- return this.widgetMap[key];
248
+ let widgetId = fieldWidget ? fieldWidget.id : params.widget.id;
249
+ let widget = this.fieldSchemaMap[row._X_ROW_KEY][widgetId]
250
+ return widget;
211
251
  },
212
252
  loopHandleWidgetByName(name, callback) {
213
253
  let rows = this.getValue();
@@ -228,10 +268,8 @@ modules = {
228
268
  return option
229
269
  },
230
270
  getRowWidgetKey(rowParam, fieldWidget) {
231
- let row = rowParam.row;
232
- let params = rowParam.column.params;
233
- let name = fieldWidget ? fieldWidget.options.name : params.widget.options.name;
234
- let key = this.getRowRefKey(row, name);
271
+ let widget = this.getRowWidget(rowParam, fieldWidget);
272
+ let key = widget.id
235
273
  return key;
236
274
  },
237
275
  getGridTableName() {
@@ -249,13 +287,40 @@ modules = {
249
287
  this.formModel[this.fieldKeyName] = rows;
250
288
  }
251
289
  },
290
+ initFieldSchema(val) {
291
+ let rows = val || [];
292
+ this.formModel[this.fieldKeyName] = rows;
293
+ this.fieldModel = rows;
294
+ this.initRowIdData(true)
295
+ this.initFieldSchemaData()
296
+ },
297
+ initValue(val) {
298
+ // this.clearRowWidgets()
299
+ let rows = val || [];
300
+ rows.forEach((row, index) => {
301
+ row._X_ROW_KEY = "row_" + generateId()
302
+ })
303
+ this.formModel[this.fieldKeyName] = rows;
304
+ this.fieldModel = rows;
305
+ this.initRowIdData(true)
306
+ this.initFieldSchemaData(true)
307
+
308
+ },
252
309
  setValue(val) {
253
310
  // console.log("rows:",val);
254
311
  this.clearRowWidgets()
255
312
  let rows = val || [];
313
+ rows.forEach((row, index) => {
314
+ if (!row._X_ROW_KEY) {
315
+ row._X_ROW_KEY = "row_" + generateId()
316
+ }
317
+ })
256
318
  this.formModel[this.fieldKeyName] = rows;
257
319
  let $grid = this.getGridTable();
258
320
  this.fieldModel = rows;
321
+
322
+ this.initRowIdData()
323
+ this.initFieldSchemaData()
259
324
  // $grid.loadData(rows);
260
325
  },
261
326
  getValue() {
@@ -472,7 +537,7 @@ modules = {
472
537
  };
473
538
 
474
539
  const addColumProperty = (col, t) => {
475
- let columnOption;
540
+ /*let columnOption;
476
541
  let widget;
477
542
  let columnWidgetConfig = this.getColumnWidgetConfig(t);
478
543
  let {columnSelectedWidget, columnEditFields} = columnWidgetConfig;
@@ -486,11 +551,18 @@ modules = {
486
551
  let {columnSelectedWidget: editWidget} = this.getColumnWidgetConfig(
487
552
  t,
488
553
  true
489
- );
554
+ );*/
490
555
 
556
+
557
+ let widget = t.widget ?? null;
558
+ let editWidget = t.editWidget ?? null;
559
+ let columnOption = {};
560
+ if (widget) {
561
+ columnOption = widget.options;
562
+ }
491
563
  let params = {
492
564
  ...columnOption,
493
- widget: widget,
565
+ widget,
494
566
  formatS: t.formatS,
495
567
  required: t.required || false,
496
568
  columnConfig: t,
@@ -503,7 +575,7 @@ modules = {
503
575
  col.slots.default = (params, h) => {
504
576
  return r ? r.call(this, params, h) : "";
505
577
  };
506
- } else if (columnSelectedWidget) {
578
+ } else if (widget) {
507
579
  // col.slots.default = columnSelectedWidget.id;
508
580
  col.slots.default = "widget";
509
581
  } else if (t.formatS == "editTreeButtonGroup") {
@@ -898,11 +970,13 @@ modules = {
898
970
  // let f = new Function("dataId", "formCode", "param", "done", accessScript);
899
971
  let done = (res) => {
900
972
  this.clearRowWidgets();
973
+ let rows = res.objx
974
+ ? res.objx.records || res.objx || []
975
+ : [];
976
+ this.initValue(rows)
901
977
  resolve(res);
902
978
  if (res.type == "success") {
903
- let rows = res.objx
904
- ? res.objx.records || res.objx || []
905
- : [];
979
+
906
980
  if (that.widget.options.isTreeTable) {
907
981
  if (rows.length > 0) {
908
982
  let fullAllDataRowMap =
@@ -1184,7 +1258,7 @@ modules = {
1184
1258
  ...row,
1185
1259
  };
1186
1260
  });
1187
- this.setValue(rows);
1261
+ this.initValue(rows);
1188
1262
  this.$nextTick(() => {
1189
1263
  /*if (this.widget.options.isTreeTable) {
1190
1264
  let $grid = this.getGridTable();
@@ -1401,7 +1475,15 @@ modules = {
1401
1475
  );
1402
1476
  let tmpId = generateId();
1403
1477
  let idVal = row.prop ? row.prop : type + tmpId;
1404
- columnSelectedWidget.id = idVal;
1478
+ /*
1479
+ columnSelectedWidget.id = idVal;*/
1480
+ /*if(isEdit){
1481
+ columnSelectedWidget.id = "edit_"+row.columnId;
1482
+ }else{
1483
+ columnSelectedWidget.id = row.columnId;
1484
+ }*/
1485
+ // columnSelectedWidget.id = row.columnId;
1486
+
1405
1487
  columnSelectedWidget.options.name = idVal;
1406
1488
 
1407
1489
  let columnOption;
@@ -2160,9 +2242,118 @@ modules = {
2160
2242
  let key = this.getRowRefKey(row, widget.options.name);
2161
2243
  delete this.widgetMap[key];
2162
2244
  })
2163
- }
2245
+ },
2164
2246
  /**end*/
2165
2247
 
2248
+ //begin1
2249
+ initAllFieldSchema() {
2250
+ this.initRowIdData(true);
2251
+ this.initFieldSchemaData();
2252
+ },
2253
+ initRowIdData(initFlag) {
2254
+ this.rowIdData.splice(0, this.rowIdData.length) //清除数组必须用splice,length=0不会响应式更新!!
2255
+ let subFormModel = this.formModel[this.fieldKeyName]
2256
+ if (!!subFormModel && (subFormModel.length > 0)) {
2257
+ subFormModel.forEach((row) => {
2258
+ if (!row._X_ROW_KEY) row._X_ROW_KEY = "row_" + generateId();
2259
+ this.rowIdData.push(row._X_ROW_KEY)
2260
+ })
2261
+
2262
+ /*if (!!initFlag) {
2263
+ //注意:事件触发需延期执行,SumFormDataChange事件处理代码中可能存在尚未创建完成的组件!!
2264
+ setTimeout(() => {
2265
+ this.handleSubFormRowChange(subFormModel)
2266
+ }, 800)
2267
+ }*/
2268
+ }
2269
+ },
2270
+ initFieldSchemaData(initFlag) { //初始化fieldSchemaData!!!
2271
+ /*if (this.widget.type !== 'sub-form') {
2272
+ return
2273
+ }*/
2274
+
2275
+ let rows = this.formModel[this.fieldKeyName];
2276
+ let rowIdData = this.rowIdData;
2277
+ let rowLength = this.rowIdData.length
2278
+ // this.fieldSchemaData.splice(0, this.fieldSchemaData.length) //清除数组必须用splice,length=0不会响应式更新!!
2279
+ // if(initFlag)this.fieldSchemaMap = {};
2280
+ if (rowLength > 0) {
2281
+ let target = this.getGridTable();
2282
+ let {fullColumn} = target.getTableColumn();
2283
+ let allWidgets = [];
2284
+ let fieldSchemaMap = {}
2285
+ let fieldSchemaMap0 = this.fieldSchemaMap;
2286
+ for (let i = 0; i < rowLength; i++) {
2287
+ let rowId = rowIdData[i];
2288
+ let fieldSchemas = []
2289
+ let fieldSchemaMap2 = null;
2290
+ if (initFlag) {
2291
+ fieldSchemaMap2 = this.createRowFieldSchemaMap();
2292
+ } else {
2293
+ let fieldSchemaMap01 = fieldSchemaMap0[rowId]
2294
+ fieldSchemaMap2 = fieldSchemaMap01 ? this.$baseLodash.cloneDeep(fieldSchemaMap01) : this.createRowFieldSchemaMap();
2295
+ }
2296
+ fieldSchemaMap[rowId] = fieldSchemaMap2;
2297
+ }
2298
+ this.fieldSchemaMap = fieldSchemaMap;
2299
+ }
2300
+ },
2301
+ createRowFieldSchemaMap() {
2302
+ let target = this.getGridTable();
2303
+ let {fullColumn} = target.getTableColumn();
2304
+
2305
+ let fieldSchemaMap2 = {};
2306
+ fullColumn.forEach((column) => {
2307
+ let params = column.params;
2308
+ if (params) {
2309
+ if (params.widget) {
2310
+ let item1 = this.cloneFieldSchema(params.widget)
2311
+ fieldSchemaMap2[params.widget.id] = item1;
2312
+ }
2313
+ if (params.editWidget) {
2314
+ let item1 = this.cloneFieldSchema(params.editWidget)
2315
+ fieldSchemaMap2[params.editWidget.id] = item1;
2316
+ }
2317
+ if (params.widgetList) {
2318
+ let widgetList = this.$baseLodash.cloneDeep(params.widgetList)
2319
+ loopHandleWidget(widgetList, (w, p) => {
2320
+ // let item1 = this.cloneFieldSchema(w)
2321
+ let id = w.id
2322
+ w.id = w.type + generateId()
2323
+ fieldSchemaMap2[id] = w;
2324
+ })
2325
+ params.widgetList.forEach(widget => {
2326
+
2327
+ })
2328
+ }
2329
+ }
2330
+ })
2331
+ return fieldSchemaMap2;
2332
+ },
2333
+ addToFieldSchemaData(rowIndex) {
2334
+ let fieldSchemas = []
2335
+ this.widget.widgetList.forEach(swItem => {
2336
+ fieldSchemas.push(this.cloneFieldSchema(swItem))
2337
+ })
2338
+
2339
+ if (rowIndex === undefined) {
2340
+ this.fieldSchemaData.push(fieldSchemas)
2341
+ } else {
2342
+ this.fieldSchemaData.splice(rowIndex, 0, fieldSchemas)
2343
+ }
2344
+ },
2345
+
2346
+ deleteFromFieldSchemaData(rowIndex) {
2347
+ this.fieldSchemaData.splice(rowIndex, 1)
2348
+ },
2349
+
2350
+ cloneFieldSchema(fieldWidget) {
2351
+ let newFieldSchema = deepClone(fieldWidget)
2352
+ newFieldSchema.id = fieldWidget.type + generateId()
2353
+ return newFieldSchema
2354
+ },
2355
+ //end1
2356
+
2166
2357
  },
2167
2358
  };
2168
2359