cloud-web-corejs 1.0.54-dev.675 → 1.0.54-dev.676
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 +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +135 -58
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +1 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +0 -1
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +2 -2
- package/src/components/xform/form-render/container-item/data-table-mixin.js +137 -77
- package/src/components/xform/form-render/indexMixin.js +15 -9
- package/src/components/xform/mixins/scriptHttp.js +176 -5
- package/src/components/xform/utils/util.js +11 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor copy.vue +0 -988
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onDynamicColumns-editor.vue +0 -44
package/package.json
CHANGED
|
@@ -128,63 +128,119 @@
|
|
|
128
128
|
>{{ i18nt("designer.setting.editAction") }}
|
|
129
129
|
</el-button>
|
|
130
130
|
</el-form-item>
|
|
131
|
+
<div class="dynamic-column-hint">
|
|
132
|
+
动态列来源<strong>二选一</strong>:前端列脚本(同步算列)或接口动态列(后端拉取)。同时配置时<strong>列脚本优先</strong>。
|
|
133
|
+
</div>
|
|
134
|
+
<div class="dynamic-column-block">
|
|
135
|
+
<div class="form-section-label">前端列脚本</div>
|
|
136
|
+
<div class="form-section-desc">不调接口,脚本直接 return 列配置</div>
|
|
137
|
+
<div class="data-table-editor-subsection">
|
|
138
|
+
<el-form-item label="列脚本">
|
|
139
|
+
<a
|
|
140
|
+
href="javascript:void(0);"
|
|
141
|
+
class="a-link link-oneLind"
|
|
142
|
+
@click="
|
|
143
|
+
editEventHandler('dynamicColumnsScript', defaultEventParams)
|
|
144
|
+
"
|
|
145
|
+
>
|
|
146
|
+
<span>{{ optionModel.dynamicColumnsScript }}</span>
|
|
147
|
+
<i class="el-icon-edit"></i>
|
|
148
|
+
</a>
|
|
149
|
+
</el-form-item>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
<div class="dynamic-column-block">
|
|
153
|
+
<div class="form-section-label">接口动态列</div>
|
|
154
|
+
<div class="form-section-desc">打开表单时请求后端脚本,返回列配置</div>
|
|
155
|
+
<div class="data-table-editor-subsection">
|
|
156
|
+
<el-form-item label="启用">
|
|
157
|
+
<el-switch
|
|
158
|
+
v-model="optionModel.dynamicColumnScriptEnabled"
|
|
159
|
+
></el-switch>
|
|
160
|
+
</el-form-item>
|
|
161
|
+
<template v-if="optionModel.dynamicColumnScriptEnabled">
|
|
162
|
+
<el-form-item label="脚本编码">
|
|
163
|
+
<el-input
|
|
164
|
+
v-model="optionModel.dynamicColumnScriptCode"
|
|
165
|
+
clearable
|
|
166
|
+
placeholder="如 getDynamicColumns"
|
|
167
|
+
></el-input>
|
|
168
|
+
</el-form-item>
|
|
169
|
+
<el-form-item label="请求参数">
|
|
170
|
+
<a
|
|
171
|
+
href="javascript:void(0);"
|
|
172
|
+
class="a-link link-oneLind"
|
|
173
|
+
@click="
|
|
174
|
+
editEventHandler('dynamicColumnScriptParam', tableConfigParams)
|
|
175
|
+
"
|
|
176
|
+
>
|
|
177
|
+
<span>{{ optionModel.dynamicColumnScriptParam }}</span>
|
|
178
|
+
<i class="el-icon-edit"></i>
|
|
179
|
+
</a>
|
|
180
|
+
</el-form-item>
|
|
181
|
+
<el-form-item>
|
|
182
|
+
<span slot="label">
|
|
183
|
+
响应转换
|
|
184
|
+
<el-tooltip effect="light" placement="top">
|
|
185
|
+
<div slot="content" style="line-height: 1.4; max-width: 320px">
|
|
186
|
+
将接口返回的
|
|
187
|
+
<code>res</code> 转为列数组;不配置则按平台默认结构解析。
|
|
188
|
+
</div>
|
|
189
|
+
<i class="el-icon-info"></i>
|
|
190
|
+
</el-tooltip>
|
|
191
|
+
</span>
|
|
192
|
+
<a
|
|
193
|
+
href="javascript:void(0);"
|
|
194
|
+
class="a-link link-oneLind"
|
|
195
|
+
@click="editEventHandler('onDynamicColumnsConvert', ['res'])"
|
|
196
|
+
>
|
|
197
|
+
<span>{{ optionModel.onDynamicColumnsConvert }}</span>
|
|
198
|
+
<i class="el-icon-edit"></i>
|
|
199
|
+
</a>
|
|
200
|
+
</el-form-item>
|
|
201
|
+
<el-form-item>
|
|
202
|
+
<span slot="label">
|
|
203
|
+
默认加载判断
|
|
204
|
+
<el-tooltip effect="light" placement="top">
|
|
205
|
+
<div slot="content" style="line-height: 1.4; max-width: 320px">
|
|
206
|
+
启用后打开表单时<strong>默认</strong>自动请求动态列。<br />
|
|
207
|
+
同步:仅写 <code>return false</code> /
|
|
208
|
+
<code>return null</code> 跳过。<br />
|
|
209
|
+
异步:先写异步逻辑,末尾
|
|
210
|
+
<code>return false</code>;条件满足时调用
|
|
211
|
+
<code>done()</code>(无参)。
|
|
212
|
+
</div>
|
|
213
|
+
<i class="el-icon-info"></i>
|
|
214
|
+
</el-tooltip>
|
|
215
|
+
</span>
|
|
216
|
+
<a
|
|
217
|
+
href="javascript:void(0);"
|
|
218
|
+
class="a-link link-oneLind"
|
|
219
|
+
@click="editEventHandler('dynamicColumnAutoLoadScript', ['done'])"
|
|
220
|
+
>
|
|
221
|
+
<span>{{ optionModel.dynamicColumnAutoLoadScript }}</span>
|
|
222
|
+
<i class="el-icon-edit"></i>
|
|
223
|
+
</a>
|
|
224
|
+
</el-form-item>
|
|
225
|
+
</template>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
131
228
|
<el-form-item label="动态列模式">
|
|
229
|
+
<span slot="label">
|
|
230
|
+
动态列模式
|
|
231
|
+
<el-tooltip effect="light" placement="top">
|
|
232
|
+
<div slot="content" style="line-height: 1.4; max-width: 320px">
|
|
233
|
+
对<strong>生效的动态列</strong>与静态列的合并方式:<br />
|
|
234
|
+
追加 — 静态列 + 动态列;替换 — 仅动态列。
|
|
235
|
+
</div>
|
|
236
|
+
<i class="el-icon-info"></i>
|
|
237
|
+
</el-tooltip>
|
|
238
|
+
</span>
|
|
132
239
|
<el-select v-model="optionModel.dynamicColumnMode" style="width: 100%">
|
|
133
240
|
<el-option label="追加到静态列" value="append"></el-option>
|
|
134
241
|
<el-option label="替换静态列" value="replace"></el-option>
|
|
135
242
|
</el-select>
|
|
136
243
|
</el-form-item>
|
|
137
|
-
<el-form-item label="启用接口动态列">
|
|
138
|
-
<el-switch
|
|
139
|
-
v-model="optionModel.dynamicColumnScriptEnabled"
|
|
140
|
-
@change="handleDynamicColumnScriptEnabledChange"
|
|
141
|
-
></el-switch>
|
|
142
|
-
</el-form-item>
|
|
143
|
-
<div
|
|
144
|
-
v-if="optionModel.dynamicColumnScriptEnabled"
|
|
145
|
-
class="data-table-editor-subsection"
|
|
146
|
-
>
|
|
147
|
-
<el-form-item label="脚本编码">
|
|
148
|
-
<el-input
|
|
149
|
-
v-model="optionModel.dynamicColumnScriptCode"
|
|
150
|
-
clearable
|
|
151
|
-
placeholder="如 getDynamicColumns"
|
|
152
|
-
></el-input>
|
|
153
|
-
</el-form-item>
|
|
154
|
-
<el-form-item label="请求参数">
|
|
155
|
-
<a
|
|
156
|
-
href="javascript:void(0);"
|
|
157
|
-
class="a-link link-oneLind"
|
|
158
|
-
@click="editEventHandler('dynamicColumnScriptParam', tableConfigParams)"
|
|
159
|
-
>
|
|
160
|
-
<span>{{ optionModel.dynamicColumnScriptParam }}</span>
|
|
161
|
-
<i class="el-icon-edit"></i>
|
|
162
|
-
</a>
|
|
163
|
-
</el-form-item>
|
|
164
|
-
<el-form-item label="转换脚本">
|
|
165
|
-
<a
|
|
166
|
-
href="javascript:void(0);"
|
|
167
|
-
class="a-link link-oneLind"
|
|
168
|
-
@click="editEventHandler('onDynamicColumnsConvert', ['res'])"
|
|
169
|
-
>
|
|
170
|
-
<span>{{ optionModel.onDynamicColumnsConvert }}</span>
|
|
171
|
-
<i class="el-icon-edit"></i>
|
|
172
|
-
</a>
|
|
173
|
-
</el-form-item>
|
|
174
|
-
<el-form-item>
|
|
175
|
-
<span slot="label">
|
|
176
|
-
加载后自动请求
|
|
177
|
-
<el-tooltip
|
|
178
|
-
effect="light"
|
|
179
|
-
placement="top"
|
|
180
|
-
content="默认开启。打开表单时先请求动态列,再一次性渲染完整表格。"
|
|
181
|
-
>
|
|
182
|
-
<i class="el-icon-info"></i>
|
|
183
|
-
</el-tooltip>
|
|
184
|
-
</span>
|
|
185
|
-
<el-switch v-model="optionModel.dynamicColumnAutoLoad"></el-switch>
|
|
186
|
-
</el-form-item>
|
|
187
|
-
</div>
|
|
188
244
|
<el-form-item label="自定义表格配置">
|
|
189
245
|
<a
|
|
190
246
|
href="javascript:void(0);"
|
|
@@ -616,6 +672,7 @@ export default {
|
|
|
616
672
|
},
|
|
617
673
|
defaultCheckedKeys: [],
|
|
618
674
|
tableConfigParams: ["dataId", "formCode"],
|
|
675
|
+
defaultEventParams: ["dataId", "formCode"],
|
|
619
676
|
showExportItemColumnsDialog: false,
|
|
620
677
|
};
|
|
621
678
|
},
|
|
@@ -668,11 +725,6 @@ export default {
|
|
|
668
725
|
}
|
|
669
726
|
},
|
|
670
727
|
methods: {
|
|
671
|
-
handleDynamicColumnScriptEnabledChange(enabled) {
|
|
672
|
-
if (enabled) {
|
|
673
|
-
this.$set(this.optionModel, "dynamicColumnAutoLoad", true);
|
|
674
|
-
}
|
|
675
|
-
},
|
|
676
728
|
dragSort: function () {
|
|
677
729
|
var e = this.$refs.singleTable.$el.querySelectorAll(
|
|
678
730
|
".el-table__body-wrapper > table > tbody"
|
|
@@ -1008,9 +1060,34 @@ export default {
|
|
|
1008
1060
|
}
|
|
1009
1061
|
|
|
1010
1062
|
.form-section-label {
|
|
1063
|
+
font-size: 13px;
|
|
1064
|
+
font-weight: 500;
|
|
1065
|
+
color: #303133;
|
|
1066
|
+
line-height: 22px;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
.form-section-desc {
|
|
1070
|
+
font-size: 12px;
|
|
1071
|
+
color: #909399;
|
|
1072
|
+
line-height: 18px;
|
|
1073
|
+
margin: 2px 0 8px 8px;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
.dynamic-column-hint {
|
|
1011
1077
|
font-size: 12px;
|
|
1012
1078
|
color: #606266;
|
|
1013
|
-
line-height:
|
|
1014
|
-
margin
|
|
1079
|
+
line-height: 1.5;
|
|
1080
|
+
margin: 0 0 12px;
|
|
1081
|
+
padding: 8px 10px;
|
|
1082
|
+
background: #f4f4f5;
|
|
1083
|
+
border-radius: 4px;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
.dynamic-column-block {
|
|
1087
|
+
margin-bottom: 12px;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.dynamic-column-block .data-table-editor-subsection {
|
|
1091
|
+
margin-top: 0;
|
|
1015
1092
|
}
|
|
1016
1093
|
</style>
|
|
@@ -256,7 +256,6 @@ const EVENT_PROPERTIES = {
|
|
|
256
256
|
onCheckboxChange: "onCheckboxChange-editor",
|
|
257
257
|
onSearchTable: "onSearchTable-editor",
|
|
258
258
|
onResetTable: "onResetTable-editor",
|
|
259
|
-
onDynamicColumns: "onDynamicColumns-editor",
|
|
260
259
|
|
|
261
260
|
//tree事件
|
|
262
261
|
onNodeClick: "onNodeClick-editor",
|
|
@@ -234,13 +234,13 @@ export const containers = [
|
|
|
234
234
|
onCellDblclick: "",
|
|
235
235
|
onSearchTable: "",
|
|
236
236
|
onResetTable: "",
|
|
237
|
-
|
|
237
|
+
dynamicColumnsScript: null,
|
|
238
238
|
dynamicColumnMode: "append",
|
|
239
239
|
dynamicColumnScriptEnabled: false,
|
|
240
240
|
dynamicColumnScriptCode: null,
|
|
241
241
|
dynamicColumnScriptParam: null,
|
|
242
242
|
onDynamicColumnsConvert: null,
|
|
243
|
-
|
|
243
|
+
dynamicColumnAutoLoadScript: null,
|
|
244
244
|
accessType: "1",
|
|
245
245
|
accessUrl: null,
|
|
246
246
|
accessReturnType: "1",
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
deepClone,
|
|
14
14
|
loopHandleWidget,
|
|
15
15
|
columnFormatMap,
|
|
16
|
+
getColumnWidgetOptions,
|
|
16
17
|
traverseAllWidgetsNew,
|
|
17
18
|
} from "../../../../components/xform/utils/util";
|
|
18
19
|
import { applyColumnLabelIcon } from "../../../../components/xform/utils/tableColumnHelper";
|
|
@@ -30,22 +31,6 @@ const baseRefUtil = {
|
|
|
30
31
|
getReportGlobalMap,
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const DYNAMIC_COLUMN_EDIT_FORMATS = [
|
|
34
|
-
"editInput",
|
|
35
|
-
"editNumber",
|
|
36
|
-
"editDate",
|
|
37
|
-
"editSelect",
|
|
38
|
-
"editSearch",
|
|
39
|
-
"editAttachment",
|
|
40
|
-
"editDelete",
|
|
41
|
-
"editButton",
|
|
42
|
-
"addSiblingEditRow",
|
|
43
|
-
"addChildTreeRow",
|
|
44
|
-
"moveUpRow",
|
|
45
|
-
"moveDownRow",
|
|
46
|
-
"removeTreeRow",
|
|
47
|
-
];
|
|
48
|
-
|
|
49
34
|
modules = {
|
|
50
35
|
mixins: [
|
|
51
36
|
baseRefUtil.emitter,
|
|
@@ -195,9 +180,6 @@ modules = {
|
|
|
195
180
|
if (this.widget.options.dynamicColumnScriptEnabled === undefined) {
|
|
196
181
|
this.$set(this.widget.options, "dynamicColumnScriptEnabled", false);
|
|
197
182
|
}
|
|
198
|
-
if (this.widget.options.dynamicColumnAutoLoad === undefined) {
|
|
199
|
-
this.$set(this.widget.options, "dynamicColumnAutoLoad", false);
|
|
200
|
-
}
|
|
201
183
|
this.initRefList();
|
|
202
184
|
// this.initConfig();
|
|
203
185
|
this.initTableCustomEvent();
|
|
@@ -408,19 +390,21 @@ modules = {
|
|
|
408
390
|
let formRef = this.getFormRef();
|
|
409
391
|
this.widget.options.tableColumns.forEach((row) => {
|
|
410
392
|
let type = columnFormatMap[row.formatS];
|
|
411
|
-
|
|
393
|
+
let widgetOptions = getColumnWidgetOptions(row);
|
|
394
|
+
if (type && widgetOptions && !row.widget) {
|
|
412
395
|
let fieldWidget = formRef.copyNewFieldWidget(
|
|
413
396
|
formRef.getFieldWidgetByType(type)
|
|
414
397
|
);
|
|
415
|
-
fieldWidget.options =
|
|
398
|
+
fieldWidget.options = widgetOptions;
|
|
416
399
|
row.widget = fieldWidget;
|
|
417
400
|
}
|
|
418
401
|
let type2 = columnFormatMap[row.editFormatS];
|
|
419
|
-
|
|
402
|
+
let editWidgetOptions = getColumnWidgetOptions(row, true);
|
|
403
|
+
if (type2 && editWidgetOptions && !row.editWidget) {
|
|
420
404
|
let fieldWidget = formRef.copyNewFieldWidget(
|
|
421
405
|
formRef.getFieldWidgetByType(type2)
|
|
422
406
|
);
|
|
423
|
-
fieldWidget.options =
|
|
407
|
+
fieldWidget.options = editWidgetOptions;
|
|
424
408
|
row.editWidget = fieldWidget;
|
|
425
409
|
}
|
|
426
410
|
});
|
|
@@ -712,7 +696,7 @@ modules = {
|
|
|
712
696
|
return this.widget.options.tableColumns || [];
|
|
713
697
|
},
|
|
714
698
|
getDynamicTableColumnsFromScript() {
|
|
715
|
-
const script = this.widget.options.
|
|
699
|
+
const script = this.widget.options.dynamicColumnsScript;
|
|
716
700
|
if (!script) {
|
|
717
701
|
return undefined;
|
|
718
702
|
}
|
|
@@ -720,7 +704,28 @@ modules = {
|
|
|
720
704
|
if (result === null || result === undefined) {
|
|
721
705
|
return undefined;
|
|
722
706
|
}
|
|
723
|
-
return result;
|
|
707
|
+
return this.normalizeDynamicColumnResult(result);
|
|
708
|
+
},
|
|
709
|
+
normalizeDynamicColumnResult(result) {
|
|
710
|
+
if (result === null || result === undefined) {
|
|
711
|
+
return result;
|
|
712
|
+
}
|
|
713
|
+
if (Array.isArray(result)) {
|
|
714
|
+
return this.normalizeDynamicColumns(result);
|
|
715
|
+
}
|
|
716
|
+
if (typeof result !== "object") {
|
|
717
|
+
return result;
|
|
718
|
+
}
|
|
719
|
+
const normalized = { ...result };
|
|
720
|
+
if (Array.isArray(result.columns)) {
|
|
721
|
+
normalized.columns = this.normalizeDynamicColumns(result.columns);
|
|
722
|
+
}
|
|
723
|
+
if (Array.isArray(result.tableColumns)) {
|
|
724
|
+
normalized.tableColumns = this.normalizeDynamicColumns(
|
|
725
|
+
result.tableColumns
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
return normalized;
|
|
724
729
|
},
|
|
725
730
|
mergeDynamicTableColumns(staticColumns, dynamicResult) {
|
|
726
731
|
const staticCols = staticColumns || [];
|
|
@@ -756,24 +761,40 @@ modules = {
|
|
|
756
761
|
}
|
|
757
762
|
return staticColumns;
|
|
758
763
|
},
|
|
759
|
-
|
|
760
|
-
|
|
764
|
+
attachTableColumnWidgets(tableColumns) {
|
|
765
|
+
if (!Array.isArray(tableColumns) || !tableColumns.length) {
|
|
766
|
+
return tableColumns;
|
|
767
|
+
}
|
|
768
|
+
this.loodHandleColumns(tableColumns, (row) => {
|
|
769
|
+
if (row.formatS && columnFormatMap[row.formatS] && !row.editFormatS) {
|
|
770
|
+
row.editFormatS = row.formatS;
|
|
771
|
+
}
|
|
772
|
+
});
|
|
761
773
|
const formRef = this.getFormRef();
|
|
762
774
|
if (!formRef?.handleTableColumnWidget) {
|
|
763
|
-
return;
|
|
775
|
+
return tableColumns;
|
|
764
776
|
}
|
|
765
777
|
const savedColumns = this.widget.options.tableColumns;
|
|
766
|
-
this.widget.options.tableColumns =
|
|
778
|
+
this.widget.options.tableColumns = tableColumns;
|
|
767
779
|
formRef.handleTableColumnWidget(this.widget);
|
|
768
|
-
this.syncEffectiveColumnWidgetFieldKeys(effectiveColumns);
|
|
769
780
|
this.widget.options.tableColumns = savedColumns;
|
|
781
|
+
return tableColumns;
|
|
782
|
+
},
|
|
783
|
+
ensureEffectiveColumnWidgets() {
|
|
784
|
+
const effectiveColumns = this.getEffectiveTableColumns();
|
|
785
|
+
this.attachTableColumnWidgets(effectiveColumns);
|
|
786
|
+
this.syncEffectiveColumnWidgetFieldKeys(effectiveColumns);
|
|
770
787
|
},
|
|
771
788
|
getColumnVisible(columnConfig) {
|
|
772
789
|
if (columnConfig.show === false) {
|
|
773
790
|
return false;
|
|
774
791
|
}
|
|
775
792
|
if (columnConfig.columnShow) {
|
|
776
|
-
const result = this.handleCustomEvent(
|
|
793
|
+
const result = this.handleCustomEvent(
|
|
794
|
+
columnConfig.columnShow,
|
|
795
|
+
["columnConfig"],
|
|
796
|
+
[columnConfig]
|
|
797
|
+
);
|
|
777
798
|
return result !== false && result !== null;
|
|
778
799
|
}
|
|
779
800
|
return true;
|
|
@@ -849,26 +870,14 @@ modules = {
|
|
|
849
870
|
return null;
|
|
850
871
|
}
|
|
851
872
|
const prop =
|
|
852
|
-
item.prop
|
|
853
|
-
const label = item.label
|
|
873
|
+
item.prop ?? item.field ?? item.name ?? item.key ?? undefined;
|
|
874
|
+
const label = item.label ?? item.title ?? undefined;
|
|
854
875
|
let formatS = item.formatS || item.format || null;
|
|
855
876
|
let editFormatS = item.editFormatS || null;
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
// 接口列字段与设计器一致;未配 editFormatS 时,从 formatS(edit*)兼容复制
|
|
860
|
-
if (
|
|
861
|
-
!editFormatS &&
|
|
862
|
-
formatS &&
|
|
863
|
-
DYNAMIC_COLUMN_EDIT_FORMATS.includes(formatS)
|
|
864
|
-
) {
|
|
865
|
-
editFormatS = formatS;
|
|
866
|
-
}
|
|
867
|
-
if (editFormatS && !editColumnOption && columnOption) {
|
|
868
|
-
editColumnOption = columnOption;
|
|
869
|
-
}
|
|
877
|
+
const widgetOptions = item.widgetOptions;
|
|
878
|
+
const editWidgetOptions = item.editWidgetOptions;
|
|
870
879
|
|
|
871
|
-
|
|
880
|
+
const normalized = {
|
|
872
881
|
...item,
|
|
873
882
|
columnId: item.columnId || `${Date.now()}_${index}`,
|
|
874
883
|
prop,
|
|
@@ -880,9 +889,12 @@ modules = {
|
|
|
880
889
|
align: item.align || "left",
|
|
881
890
|
formatS,
|
|
882
891
|
editFormatS: editFormatS || undefined,
|
|
883
|
-
|
|
884
|
-
|
|
892
|
+
widgetOptions,
|
|
893
|
+
editWidgetOptions: editWidgetOptions || undefined,
|
|
885
894
|
};
|
|
895
|
+
delete normalized.columnOption;
|
|
896
|
+
delete normalized.editColumnOption;
|
|
897
|
+
return normalized;
|
|
886
898
|
},
|
|
887
899
|
normalizeDynamicColumns(columns) {
|
|
888
900
|
if (!Array.isArray(columns)) {
|
|
@@ -965,13 +977,59 @@ modules = {
|
|
|
965
977
|
fetchDynamicColumns(options) {
|
|
966
978
|
return this.loadDynamicColumnsFromApi(options);
|
|
967
979
|
},
|
|
968
|
-
|
|
980
|
+
resolveShouldAutoLoadDynamicColumns() {
|
|
969
981
|
const options = this.widget.options;
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
)
|
|
982
|
+
if (!options.dynamicColumnScriptEnabled || !options.dynamicColumnScriptCode) {
|
|
983
|
+
return Promise.resolve(false);
|
|
984
|
+
}
|
|
985
|
+
const script = options.dynamicColumnAutoLoadScript;
|
|
986
|
+
if (!script) {
|
|
987
|
+
return Promise.resolve(true);
|
|
988
|
+
}
|
|
989
|
+
const formRef = this.getFormRef();
|
|
990
|
+
if (!formRef || formRef.designState) {
|
|
991
|
+
return Promise.resolve(false);
|
|
992
|
+
}
|
|
993
|
+
return new Promise((resolve) => {
|
|
994
|
+
let settled = false;
|
|
995
|
+
const finishLoad = () => {
|
|
996
|
+
if (settled) {
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
settled = true;
|
|
1000
|
+
resolve(true);
|
|
1001
|
+
};
|
|
1002
|
+
const finishSkip = () => {
|
|
1003
|
+
if (settled) {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
settled = true;
|
|
1007
|
+
resolve(false);
|
|
1008
|
+
};
|
|
1009
|
+
const done = finishLoad;
|
|
1010
|
+
try {
|
|
1011
|
+
const result = formRef.handleCustomEvent(script, ["done"], [done]);
|
|
1012
|
+
if (settled) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
if (result === null || result === false) {
|
|
1016
|
+
if (result === null) {
|
|
1017
|
+
finishSkip();
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
// return false:异步 defer 等待 done();未调用则视为跳过
|
|
1021
|
+
setTimeout(() => {
|
|
1022
|
+
if (!settled) {
|
|
1023
|
+
finishSkip();
|
|
1024
|
+
}
|
|
1025
|
+
}, 0);
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
finishLoad();
|
|
1029
|
+
} catch (e) {
|
|
1030
|
+
finishSkip();
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
975
1033
|
},
|
|
976
1034
|
isTableColumnGridInitialized() {
|
|
977
1035
|
return !!this.vxeOption;
|
|
@@ -1008,30 +1066,29 @@ modules = {
|
|
|
1008
1066
|
});
|
|
1009
1067
|
},
|
|
1010
1068
|
bootstrapDynamicColumnsBeforeInit() {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1069
|
+
return this.resolveShouldAutoLoadDynamicColumns().then((shouldLoad) => {
|
|
1070
|
+
if (!shouldLoad) {
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
this.dynamicColumnsPreloaded = true;
|
|
1074
|
+
const mode = this.widget.options.dynamicColumnMode;
|
|
1075
|
+
return this.requestDynamicColumnsFromApi({ isLoading: true })
|
|
1076
|
+
.then(({ columns }) => this.assignDynamicTableColumns(columns, { mode }))
|
|
1077
|
+
.catch(() => {
|
|
1078
|
+
this.dynamicColumnsPreloaded = false;
|
|
1079
|
+
});
|
|
1080
|
+
});
|
|
1021
1081
|
},
|
|
1022
1082
|
tryAutoLoadDynamicColumns() {
|
|
1023
1083
|
if (this.dynamicColumnsPreloaded) {
|
|
1024
1084
|
return Promise.resolve();
|
|
1025
1085
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
)
|
|
1032
|
-
return Promise.resolve();
|
|
1033
|
-
}
|
|
1034
|
-
return this.loadDynamicColumnsFromApi({ isLoading: true }).catch(() => {});
|
|
1086
|
+
return this.resolveShouldAutoLoadDynamicColumns().then((shouldLoad) => {
|
|
1087
|
+
if (!shouldLoad) {
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
return this.loadDynamicColumnsFromApi({ isLoading: true }).catch(() => {});
|
|
1091
|
+
});
|
|
1035
1092
|
},
|
|
1036
1093
|
getTableData: function () {
|
|
1037
1094
|
return this.widget.options.tableData;
|
|
@@ -1123,7 +1180,9 @@ modules = {
|
|
|
1123
1180
|
},
|
|
1124
1181
|
createColumns() {
|
|
1125
1182
|
let rowWidgetList = [];
|
|
1126
|
-
let tableColumns = this.
|
|
1183
|
+
let tableColumns = this.attachTableColumnWidgets(
|
|
1184
|
+
this.getEffectiveTableColumns()
|
|
1185
|
+
);
|
|
1127
1186
|
let newColumns = [];
|
|
1128
1187
|
if (!this.widget.options.hideGridCheckBox) {
|
|
1129
1188
|
newColumns.push({
|
|
@@ -2243,7 +2302,8 @@ modules = {
|
|
|
2243
2302
|
let result = vailColumns
|
|
2244
2303
|
.filter((item) => {
|
|
2245
2304
|
return (
|
|
2246
|
-
item.formatS === "editSearch" &&
|
|
2305
|
+
item.formatS === "editSearch" &&
|
|
2306
|
+
getColumnWidgetOptions(item)?.multipleChoices
|
|
2247
2307
|
);
|
|
2248
2308
|
})
|
|
2249
2309
|
.map((item) => item.prop); */
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
loopHandleWidget,
|
|
23
23
|
traverseAllWidgetsNew,
|
|
24
24
|
columnFormatMap,
|
|
25
|
+
getColumnWidgetOptions,
|
|
25
26
|
} from "../../../components/xform/utils/util";
|
|
26
27
|
import {
|
|
27
28
|
containers,
|
|
@@ -995,8 +996,9 @@ modules = {
|
|
|
995
996
|
loopDo(item);
|
|
996
997
|
});
|
|
997
998
|
} else {
|
|
998
|
-
|
|
999
|
-
|
|
999
|
+
const opts = getColumnWidgetOptions(t);
|
|
1000
|
+
if (opts) {
|
|
1001
|
+
toDo2(null, opts);
|
|
1000
1002
|
}
|
|
1001
1003
|
}
|
|
1002
1004
|
};
|
|
@@ -1121,8 +1123,9 @@ modules = {
|
|
|
1121
1123
|
loopDo(item);
|
|
1122
1124
|
});
|
|
1123
1125
|
} else {
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
+
const opts = getColumnWidgetOptions(t);
|
|
1127
|
+
if (opts) {
|
|
1128
|
+
handleWfConfigData(null, opts);
|
|
1126
1129
|
}
|
|
1127
1130
|
}
|
|
1128
1131
|
};
|
|
@@ -2207,7 +2210,8 @@ modules = {
|
|
|
2207
2210
|
fieldDesc: item.label + "ID",
|
|
2208
2211
|
fieldName: item.prop,
|
|
2209
2212
|
});
|
|
2210
|
-
let vabSearchName =
|
|
2213
|
+
let vabSearchName =
|
|
2214
|
+
getColumnWidgetOptions(item)?.vabSearchName;
|
|
2211
2215
|
if (vabSearchName) {
|
|
2212
2216
|
itemFields.push({
|
|
2213
2217
|
fieldDesc: item.label,
|
|
@@ -2707,22 +2711,24 @@ modules = {
|
|
|
2707
2711
|
if (row.editWidget) {
|
|
2708
2712
|
return row.editWidget;
|
|
2709
2713
|
}
|
|
2710
|
-
|
|
2714
|
+
const editWidgetOptions = getColumnWidgetOptions(row, true);
|
|
2715
|
+
if (editWidgetOptions) {
|
|
2711
2716
|
let fieldWidget = this.copyNewFieldWidget(
|
|
2712
2717
|
this.getFieldWidgetByType(type)
|
|
2713
2718
|
);
|
|
2714
|
-
fieldWidget.options =
|
|
2719
|
+
fieldWidget.options = editWidgetOptions;
|
|
2715
2720
|
return fieldWidget;
|
|
2716
2721
|
}
|
|
2717
2722
|
} else {
|
|
2718
2723
|
if (row.widget) {
|
|
2719
2724
|
return row.widget;
|
|
2720
2725
|
}
|
|
2721
|
-
|
|
2726
|
+
const widgetOptions = getColumnWidgetOptions(row);
|
|
2727
|
+
if (widgetOptions) {
|
|
2722
2728
|
let fieldWidget = this.copyNewFieldWidget(
|
|
2723
2729
|
this.getFieldWidgetByType(type)
|
|
2724
2730
|
);
|
|
2725
|
-
fieldWidget.options =
|
|
2731
|
+
fieldWidget.options = widgetOptions;
|
|
2726
2732
|
return fieldWidget;
|
|
2727
2733
|
}
|
|
2728
2734
|
}
|