cloud-web-corejs 1.0.281 → 1.1.0-dev.4

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 (158) hide show
  1. package/package.json +6 -2
  2. package/src/components/VabUpload/image-viewer.vue +442 -442
  3. package/src/components/VabUpload/index.vue +44 -2
  4. package/src/components/VabUpload/mixins.js +126 -19
  5. package/src/components/VabUpload/view.vue +247 -209
  6. package/src/components/baseTabs/mixins.js +181 -181
  7. package/src/components/bizTab/BizBillActions.vue +129 -0
  8. package/src/components/bizTab/BizTabListPage.vue +391 -0
  9. package/src/components/bizTab/README.md +378 -0
  10. package/src/components/bizTab/billTableUtil.js +48 -0
  11. package/src/components/bizTab/billValidators.js +136 -0
  12. package/src/components/bizTab/bizBillDetailMixin.js +705 -0
  13. package/src/components/bizTab/index.js +24 -0
  14. package/src/components/excelExport/exportFieldDialog.vue +23 -12
  15. package/src/components/excelExport/exportItemConfigUtil.js +30 -0
  16. package/src/components/excelExport/mixins.js +3 -3
  17. package/src/components/mobile/statusTag/mixins.js +1 -61
  18. package/src/components/mobile/wf/content.vue +1662 -1556
  19. package/src/components/mobile/wf/mixins/wfModifyDialogMixin.js +8 -6
  20. package/src/components/table/config.js +78 -78
  21. package/src/components/table/index.js +1276 -1276
  22. package/src/components/table/plugins/cell-area/index.js +1055 -0
  23. package/src/components/table/plugins/cell-area/index.scss +77 -0
  24. package/src/components/table/plugins/cell-area/util.js +224 -0
  25. package/src/components/table/tableForm.vue +330 -330
  26. package/src/components/table/tableFormMixin.js +318 -318
  27. package/src/components/table/vxeFilter/index.js +163 -163
  28. package/src/components/table/vxeFilter/mixin.js +316 -316
  29. package/src/components/wf/content.vue +1188 -1188
  30. package/src/components/wf/wf.js +40 -20
  31. package/src/components/wf/wfActionDropdown.vue +1 -1
  32. package/src/components/wf/wfActionItems.js +1 -1
  33. package/src/components/xform/docs/2026-08 xform H5 P0 /345/256/236/347/216/260/350/247/204/346/240/274.md" +528 -0
  34. package/src/components/xform/docs/2026-08 xform H5 P1 /345/256/236/347/216/260/350/247/204/346/240/274.md" +412 -0
  35. package/src/components/xform/docs/2026-08 xform H5 P2 /345/256/236/347/216/260/350/247/204/346/240/274.md" +287 -0
  36. package/src/components/xform/docs/2026-08 xform /347/247/273/345/212/250/347/253/257/345/270/203/345/261/200/345/257/271/351/275/220 bill_setting /346/226/271/346/241/210.md" +400 -0
  37. package/src/components/xform/form-designer/designer.js +15 -0
  38. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +269 -269
  39. package/src/components/xform/form-designer/form-widget/container-widget/detail-temp-widget.vue +132 -0
  40. package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +250 -250
  41. package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +319 -320
  42. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +365 -365
  43. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +554 -555
  44. package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +409 -409
  45. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +150 -132
  46. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +114 -114
  47. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +154 -154
  48. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +47 -1
  49. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +178 -178
  50. package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +77 -77
  51. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +6 -0
  52. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +139 -139
  53. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +106 -106
  54. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +134 -134
  55. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +1 -0
  56. package/src/components/xform/form-designer/setting-panel/form-setting.vue +39 -39
  57. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +10 -10
  58. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +438 -432
  59. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +2103 -2103
  60. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +90 -0
  61. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +82 -82
  62. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +19 -5
  63. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +8 -8
  64. package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +137 -137
  65. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +237 -237
  66. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +43 -43
  67. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +43 -43
  68. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +96 -96
  69. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +51 -0
  70. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +42 -42
  71. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +43 -43
  72. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +158 -158
  73. package/src/components/xform/form-designer/setting-panel/property-editor/h5Span-editor.vue +51 -0
  74. package/src/components/xform/form-designer/setting-panel/property-editor/itemStyle-editor.vue +39 -0
  75. package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +188 -188
  76. package/src/components/xform/form-designer/setting-panel/property-editor/styleTempClass-editor.vue +51 -0
  77. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +347 -347
  78. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +4 -0
  79. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +59 -3
  80. package/src/components/xform/form-render/container-item/data-table-mixin.js +151 -93
  81. package/src/components/xform/form-render/container-item/detail-h5-item.vue +183 -32
  82. package/src/components/xform/form-render/container-item/detail-temp-item.vue +110 -0
  83. package/src/components/xform/form-render/container-item/h5-card-pane-item.vue +160 -140
  84. package/src/components/xform/form-render/container-item/list-h5-item.vue +1688 -1700
  85. package/src/components/xform/form-render/index.vue +153 -147
  86. package/src/components/xform/form-render/indexMixin.js +12 -0
  87. package/src/components/xform/lang/en-US.js +10 -0
  88. package/src/components/xform/lang/zh-CN.js +12 -0
  89. package/src/components/xform/mixins/defaultHandle.js +707 -707
  90. package/src/components/xform/styles/h5.scss +1992 -0
  91. package/src/components/xform/utils/textMaskUtil.js +182 -179
  92. package/src/components/xform/utils/treeTableUtil.js +1292 -1265
  93. package/src/components/xform/utils/util.js +56 -11
  94. package/src/index.js +9 -4
  95. package/src/layout/components/extractedCode/viewDialog.vue +7 -7
  96. package/src/router/index.js +21 -0
  97. package/src/router/modules/customer.js +71 -14
  98. package/src/store/modules/permission.js +17 -18
  99. package/src/utils/pdfUtil.js +429 -429
  100. package/src/utils/resolveViewComponent.js +142 -16
  101. package/src/views/bd/project/branch/bd_branch/edit.vue +145 -0
  102. package/src/views/bd/project/branch/bd_branch/list.vue +72 -0
  103. package/src/views/bd/project/branch/bd_branch/menuKindDialog.vue +106 -0
  104. package/src/views/bd/project/branch/bd_branch/mixins/edit.js +189 -0
  105. package/src/views/bd/project/branch/bd_branch/mixins/list.js +124 -0
  106. package/src/views/bd/project/branch/bd_branch/mixins/menuKindDialog.js +85 -0
  107. package/src/views/bd/project/branch/form_script/list.vue +31 -0
  108. package/src/views/bd/project/branch/form_template/list.vue +30 -0
  109. package/src/views/bd/project/branch/menu_kind/list.vue +31 -0
  110. package/src/views/bd/project/common/form_script/list.vue +16 -0
  111. package/src/views/bd/project/common/form_template/list.vue +15 -0
  112. package/src/views/bd/project/common/menu_kind/list.vue +15 -0
  113. package/src/views/bd/project/core/branchContext.js +100 -0
  114. package/src/views/bd/project/core/branchPage.js +78 -0
  115. package/src/views/bd/project/core/branchPageWrap.vue +225 -0
  116. package/src/views/bd/project/core/branchScope.js +44 -0
  117. package/src/views/bd/project/core/branchSearchPage.js +285 -0
  118. package/src/views/bd/project/core/branchSelect.vue +85 -0
  119. package/src/views/bd/project/core/branchTreeBar.vue +81 -0
  120. package/src/views/bd/project/core/httpBranchPatch.js +58 -0
  121. package/src/views/bd/project/datatable/menu_kind/list.vue +15 -0
  122. package/src/views/bd/project/datatable/table_model/list.vue +15 -0
  123. package/src/views/bd/setting/bd_company_env/dialog.vue +174 -174
  124. package/src/views/bd/setting/table_model/edit.vue +1066 -1066
  125. package/src/views/bd/setting/table_model/mixins/edit.js +1455 -1455
  126. package/src/views/bd/setting/table_model/mixins/zdDialog.js +148 -148
  127. package/src/views/demo/bizTab/bill/billConfig.js +41 -0
  128. package/src/views/demo/bizTab/bill/detail.vue +436 -0
  129. package/src/views/demo/bizTab/bill/list.vue +288 -0
  130. package/src/views/demo/bizTab/bill/productDialog.vue +176 -0
  131. package/src/views/demo/bizTab/simple/billApi.js +123 -0
  132. package/src/views/demo/bizTab/simple/detail.vue +407 -0
  133. package/src/views/demo/bizTab/simple/list.vue +217 -0
  134. package/src/views/demo/bizTab/standalone/index.vue +121 -0
  135. package/src/views/demo/bizTab/wf/billConfig.js +44 -0
  136. package/src/views/demo/bizTab/wf/detail.vue +661 -0
  137. package/src/views/demo/bizTab/wf/list.vue +242 -0
  138. package/src/views/support/form-dialog-demo/demoPickerDialog.vue +72 -0
  139. package/src/views/support/form-dialog-demo/index.vue +537 -0
  140. package/src/views/user/file_view_ins/list.vue +3 -3
  141. package/src/views/user/home/index.vue +8 -6
  142. package/src/views/user/home/wjl/content.vue +1569 -0
  143. package/src/views/user/notify_message/dialog.vue +7 -5
  144. package/src/views/user/outLink/cc_form_view.vue +188 -0
  145. package/src/views/user/outLink/form_view.vue +2 -2
  146. package/src/views/user/outLink/index.vue +4 -4
  147. package/src/views/user/outLink/view.vue +3 -3
  148. package/src/views/user/role/edit.vue +632 -632
  149. package/src/views/user/role/list.vue +260 -260
  150. package/src/views/user/wf/iframe/index.vue +3 -3
  151. package/src/views/user/wf/iframe/index2.vue +3 -3
  152. package/src/views/user/wf/wf_manage/list.vue +1112 -1116
  153. package/src/views/user/wf/wf_manage/list2.vue +9 -13
  154. package/src/views/user/wf/wf_manage/wfContentDialog.vue +8 -5
  155. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +0 -106
  156. package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +0 -99
  157. package/src/components/xform/form-render/container-item/list-h5-item2.vue +0 -1340
  158. package/src/utils/wf.js +0 -766
@@ -1,2103 +1,2103 @@
1
- <template>
2
- <el-dialog
3
- custom-class="dialog-style list-dialog table-column-config-dialog"
4
- :title="i18nt('designer.setting.tableColEdit')"
5
- :visible.sync="showDialog"
6
- :modal="false"
7
- :show-close="!0"
8
- :close-on-click-modal="!1"
9
- :close-on-press-escape="!1"
10
- :destroy-on-close="false"
11
- top="5vh"
12
- width="1220px"
13
- v-dialog-drag
14
- :before-close="closeHandle"
15
- >
16
- <div
17
- class="cont table-column-dialog-cont"
18
- v-loading="!tableReady"
19
- element-loading-background="rgba(0, 0, 0, 0)"
20
- element-loading-text="数据正在加载中"
21
- element-loading-spinner="el-icon-loading"
22
- >
23
- <el-table
24
- v-if="tableReady"
25
- ref="singleTable"
26
- width="100%"
27
- :data="tableData"
28
- height="500"
29
- border=""
30
- row-key="columnId"
31
- stripe=""
32
- :tree-props="{ children: 'children' }"
33
- :default-expand-all="shouldExpandAllTable"
34
- >
35
- <el-table-column label="" width="80" fixed="left">
36
- <template #default="scope">
37
- <span>{{ scope.$index + 1 }}</span>
38
- </template>
39
- </el-table-column>
40
- <el-table-column label="" width="35" fixed="left"
41
- ><i class="el-icon-s-operation drag-option"></i>
42
- </el-table-column>
43
- <el-table-column
44
- :label="i18nt('designer.setting.columnLabel')"
45
- width="150"
46
- prop="label"
47
- fixed="left"
48
- >
49
- <template #default="scope">
50
- <el-input
51
- v-model="scope.row.label"
52
- @change="changeRowLabel(scope.row)"
53
- ></el-input>
54
- </template>
55
- </el-table-column>
56
- <el-table-column
57
- :label="i18nt('designer.setting.columnName')"
58
- width="150"
59
- prop="prop"
60
- >
61
- <template #default="scope">
62
- <el-input
63
- v-model="scope.row.prop"
64
- @change="changeRowProp(scope.row)"
65
- :disabled="'editAttachment' == scope.row.formatS"
66
- ></el-input>
67
- </template>
68
- </el-table-column>
69
- <el-table-column
70
- :label="i18nt('designer.setting.columnWidth')"
71
- width="100"
72
- prop="width"
73
- >
74
- <template #default="scope">
75
- <el-input v-model="scope.row.width"></el-input>
76
- </template>
77
- </el-table-column>
78
-
79
- <el-table-column :label="i18nt('必填')" width="70" prop="required">
80
- <template #default="scope">
81
- <el-switch
82
- v-model="scope.row.required"
83
- @change="changeRowRequired(scope.row)"
84
- ></el-switch>
85
- </template>
86
- </el-table-column>
87
- <el-table-column
88
- :label="i18nt('designer.setting.fixedColumn')"
89
- width="100"
90
- prop="fixed"
91
- >
92
- <template #default="scope">
93
- <el-select v-model="scope.row.fixed" clearable>
94
- <el-option value="left">left</el-option>
95
- <el-option value="right">right</el-option>
96
- </el-select>
97
- </template>
98
- </el-table-column>
99
- <el-table-column
100
- :label="i18nt('designer.setting.formatOfColumn')"
101
- width="200"
102
- prop="formatS"
103
- >
104
- <template #default="scope">
105
- <el-select
106
- v-model="scope.row.formatS"
107
- @change="changeFormatS(scope.row, false)"
108
- clearable
109
- >
110
- <el-option-group
111
- :label="i18nt('designer.setting.customRenderGroup')"
112
- >
113
- <el-option value="render" label="render"></el-option>
114
- </el-option-group>
115
- <el-option-group v-for="t in op" :key="t.label" :label="t.label">
116
- <el-option
117
- v-for="e in t.options"
118
- :key="e.value"
119
- :value="e.value"
120
- :label="e.label"
121
- ></el-option>
122
- </el-option-group>
123
- </el-select>
124
- </template>
125
- </el-table-column>
126
- <el-table-column label="格式化配置" width="90" align="center">
127
- <template #default="scope">
128
- <el-button
129
- size="mini"
130
- plain=""
131
- round=""
132
- icon="el-icon-edit"
133
- @click="openFormatConfigDialog(scope.row, scope.$index)"
134
- :disabled="
135
- !columnFormatMap[scope.row.formatS] &&
136
- 'widgetRender' !== scope.row.formatS &&
137
- 'editTreeButtonGroup' !== scope.row.formatS
138
- "
139
- ></el-button>
140
- </template>
141
- </el-table-column>
142
- <el-table-column
143
- :label="i18nt('designer.setting.renderFunction')"
144
- width="70"
145
- align="center"
146
- >
147
- <template #default="scope">
148
- <el-button
149
- :disabled="'render' !== scope.row.formatS"
150
- size="mini"
151
- plain=""
152
- round=""
153
- icon="el-icon-edit"
154
- @click="showRenderDialog(scope.row)"
155
- ></el-button>
156
- </template>
157
- </el-table-column>
158
- <el-table-column
159
- :label="i18nt('designer.setting.visibleColumn')"
160
- width="70"
161
- prop="show"
162
- >
163
- <template #default="scope">
164
- <el-switch v-model="scope.row.show"></el-switch>
165
- </template>
166
- </el-table-column>
167
- <el-table-column
168
- :label="i18nt('designer.setting.sortableColumn')"
169
- width="70"
170
- prop="sortable"
171
- >
172
- <template #default="scope">
173
- <el-switch v-model="scope.row.sortable"></el-switch>
174
- </template>
175
- </el-table-column>
176
- <el-table-column label="显示筛选" width="70" prop="filterable">
177
- <template #default="scope">
178
- <el-switch v-model="scope.row.filterable"></el-switch>
179
- </template>
180
- </el-table-column>
181
- <el-table-column label="UTC时差转换" width="90" align="center">
182
- <template #default="scope">
183
- <el-switch
184
- v-if="isUtcTransformColumn(scope.row)"
185
- v-model="scope.row.utcTransformEnabled"
186
- ></el-switch>
187
- </template>
188
- </el-table-column>
189
- <el-table-column
190
- label="编辑更多属性"
191
- width="100"
192
- align="center"
193
- fixed="right"
194
- >
195
- <template #default="scope">
196
- <el-button
197
- size="mini"
198
- plain=""
199
- round=""
200
- icon="el-icon-edit"
201
- @click="openRowEditDialog(scope.row, scope.$index)"
202
- ></el-button>
203
- </template>
204
- </el-table-column>
205
- <el-table-column label="操作" width="150" fixed="right">
206
- <template slot="header">
207
- <el-tooltip
208
- :hide-after="500"
209
- class="item"
210
- effect="dark"
211
- content="添加根节点"
212
- placement="top"
213
- >
214
- <el-button
215
- size="mini"
216
- type=""
217
- circle=""
218
- icon="el-icon-plus"
219
- @click="onAddRoot"
220
- />
221
- </el-tooltip>
222
- </template>
223
- <template #default="{ row, $index }">
224
- <el-tooltip
225
- :hide-after="hideAfter"
226
- :open-delay="openDelay"
227
- effect="dark"
228
- content="添加兄弟节点"
229
- placement="top"
230
- >
231
- <el-button
232
- size="mini"
233
- type=""
234
- circle=""
235
- icon="el-icon-plus"
236
- @click="onAddSibling(row, $index)"
237
- />
238
- </el-tooltip>
239
-
240
- <el-tooltip
241
- :hide-after="hideAfter"
242
- :open-delay="openDelay"
243
- effect="dark"
244
- content="添加子节点"
245
- placement="top"
246
- >
247
- <el-button
248
- size="mini"
249
- type=""
250
- circle=""
251
- icon="el-icon-circle-plus-outline"
252
- @click="onAddChild(row, $index)"
253
- />
254
- </el-tooltip>
255
- <el-tooltip
256
- :hide-after="hideAfter"
257
- :open-delay="openDelay"
258
- effect="dark"
259
- content="删除"
260
- placement="top"
261
- >
262
- <el-button
263
- size="mini"
264
- type=""
265
- circle=""
266
- icon="el-icon-delete"
267
- @click="onDelete(row, $index)"
268
- />
269
- </el-tooltip>
270
- </template>
271
- </el-table-column>
272
- </el-table>
273
- <columnRenderDialog
274
- :column="currentTableColumn"
275
- :sourceData="sourceData"
276
- v-if="showColumnRenderDialog"
277
- :visiable.sync="showColumnRenderDialog"
278
- @confirm="confirmWidgetRenderDialog"
279
- ></columnRenderDialog>
280
- <editTreeButtonGroupConfigDialog
281
- v-if="showEditTreeButtonGroupConfigDialog && editTreeButtonGroupRowData"
282
- :visible.sync="showEditTreeButtonGroupConfigDialog"
283
- :row="editTreeButtonGroupRowData"
284
- @confirm="confirmEditTreeButtonGroupConfig"
285
- />
286
- </div>
287
- <div class="dialog-footer" slot="footer">
288
- <el-button @click="closeHandle" class="button-sty" icon="el-icon-close">
289
- {{ i18nt("designer.hint.cancel") }}
290
- </el-button>
291
- <el-button
292
- type="primary"
293
- @click="colSubmit"
294
- class="button-sty"
295
- icon="el-icon-check"
296
- >
297
- {{ i18nt("designer.hint.confirm") }}
298
- </el-button>
299
- </div>
300
- <el-dialog
301
- v-if="showRenderDialogFlag"
302
- :title="i18nt('designer.setting.renderFunction')"
303
- :visible.sync="showRenderDialogFlag"
304
- :modal="false"
305
- :show-close="!0"
306
- custom-class="dialog-style list-dialog"
307
- :close-on-click-modal="!1"
308
- :close-on-press-escape="!1"
309
- :destroy-on-close="!0"
310
- v-dialog-drag
311
- top="7vh"
312
- :append-to-body="true"
313
- >
314
- <el-alert
315
- type="info"
316
- :closable="!1"
317
- title="function customRender(params,h) {"
318
- />
319
- <code-editor
320
- ref="dsResultEditor"
321
- mode="javascript"
322
- :readonly="!1"
323
- v-model="renderJson"
324
- ></code-editor>
325
- <el-alert type="info" :closable="!1" title="}" />
326
- <div class="dialog-footer" slot="footer">
327
- <el-button
328
- @click="showRenderDialogFlag = !1"
329
- class="button-sty"
330
- icon="el-icon-close"
331
- >
332
- {{ i18nt("designer.hint.cancel") }}
333
- </el-button>
334
- <el-button
335
- type="primary"
336
- @click="saveColumnRender"
337
- class="button-sty"
338
- icon="el-icon-check"
339
- >
340
- {{ i18nt("designer.hint.confirm") }}
341
- </el-button>
342
- </div>
343
- </el-dialog>
344
- <el-dialog
345
- :title="tableColumnConfigTitle"
346
- :visible.sync="showTableColumnConfigDialog"
347
- v-if="showTableColumnConfigDialog"
348
- :show-close="true"
349
- custom-class="dialog-style list-dialog"
350
- v-dialog-drag
351
- :close-on-click-modal="false"
352
- :close-on-press-escape="false"
353
- :destroy-on-close="true"
354
- :append-to-body="true"
355
- :modal-append-to-body="true"
356
- top="5vh"
357
- >
358
- <div class="cont">
359
- <el-alert
360
- type="info"
361
- :closable="false"
362
- :title="tableColumnConfigHeader"
363
- ></el-alert>
364
- <code-editor
365
- :mode="'javascript'"
366
- :readonly="false"
367
- v-model="tableColumnConfigCode"
368
- ref="ecEditor"
369
- ></code-editor>
370
- <el-alert type="info" :closable="false" title="}"></el-alert>
371
- </div>
372
- <div slot="footer" class="dialog-footer">
373
- <el-button
374
- @click="showTableColumnConfigDialog = false"
375
- class="button-sty"
376
- icon="el-icon-close"
377
- >
378
- {{ i18nt("designer.hint.cancel") }}
379
- </el-button>
380
- <el-button
381
- type="primary"
382
- @click="saveTableColumnConfigDialog"
383
- class="button-sty"
384
- icon="el-icon-check"
385
- >
386
- {{ i18nt("designer.hint.confirm") }}
387
- </el-button>
388
- </div>
389
- </el-dialog>
390
- <el-dialog
391
- :title="i18nt('designer.setting.editFormEventHandler')"
392
- :visible.sync="showFormEventDialogFlag"
393
- v-if="showFormEventDialogFlag"
394
- :show-close="true"
395
- custom-class="dialog-style list-dialog"
396
- v-dialog-drag
397
- :close-on-click-modal="false"
398
- :close-on-press-escape="false"
399
- :destroy-on-close="true"
400
- :append-to-body="true"
401
- :modal-append-to-body="true"
402
- top="5vh"
403
- >
404
- <div class="cont">
405
- <el-alert
406
- type="info"
407
- :closable="false"
408
- :title="'form.' + eventParamsMap[curEventName]"
409
- ></el-alert>
410
- <code-editor
411
- :mode="'javascript'"
412
- :readonly="false"
413
- v-model="formEventHandlerCode"
414
- ref="ecEditor"
415
- ></code-editor>
416
- <el-alert type="info" :closable="false" title="}"></el-alert>
417
- </div>
418
- <div slot="footer" class="dialog-footer">
419
- <el-button
420
- @click="showFormEventDialogFlag = false"
421
- class="button-sty"
422
- icon="el-icon-close"
423
- >
424
- {{ i18nt("designer.hint.cancel") }}
425
- </el-button>
426
- <el-button
427
- type="primary"
428
- @click="saveFormEventHandler"
429
- class="button-sty"
430
- icon="el-icon-check"
431
- >
432
- {{ i18nt("designer.hint.confirm") }}
433
- </el-button>
434
- </div>
435
- </el-dialog>
436
-
437
- <el-dialog
438
- custom-class="dialog-style list-dialog table-column-row-edit-dialog"
439
- :title="i18nt('designer.setting.tableColEdit')"
440
- :visible.sync="showRowEditDialog"
441
- v-if="showRowEditDialog"
442
- :modal="false"
443
- :show-close="!0"
444
- :close-on-click-modal="!1"
445
- :close-on-press-escape="!1"
446
- :destroy-on-close="!0"
447
- :append-to-body="true"
448
- :modal-append-to-body="true"
449
- top="5vh"
450
- width="480px"
451
- v-dialog-drag
452
- >
453
- <div class="cont table-column-row-edit-cont">
454
- <el-form :model="rowData" class="form-m2" label-position="top">
455
- <el-form-item :label="i18nt('designer.setting.columnLabel')">
456
- <el-input
457
- v-model="rowData.label"
458
- @change="changeRowLabel(rowData)"
459
- ></el-input>
460
- </el-form-item>
461
- <el-form-item :label="i18nt('designer.setting.columnName')">
462
- <el-input
463
- v-model="rowData.prop"
464
- @change="changeRowProp(rowData)"
465
- :disabled="'editAttachment' == rowData.formatS"
466
- ></el-input>
467
- </el-form-item>
468
- <el-form-item :label="i18nt('designer.setting.columnWidth')">
469
- <el-input v-model="rowData.width"></el-input>
470
- </el-form-item>
471
- <el-form-item :label="i18nt('必填')">
472
- <el-switch
473
- v-model="rowData.required"
474
- @change="changeRowRequired(rowData)"
475
- ></el-switch>
476
- </el-form-item>
477
- <el-form-item :label="i18nt('designer.setting.fixedColumn')">
478
- <el-select v-model="rowData.fixed" clearable>
479
- <el-option value="left">left</el-option>
480
- <el-option value="right">right</el-option>
481
- </el-select>
482
- </el-form-item>
483
- <el-form-item :label="i18nt('designer.setting.formatOfColumn')">
484
- <el-select
485
- v-model="rowData.formatS"
486
- @change="changeFormatS(rowData, false)"
487
- clearable
488
- >
489
- <el-option-group
490
- :label="i18nt('designer.setting.customRenderGroup')"
491
- >
492
- <el-option value="render" label="render"></el-option>
493
- </el-option-group>
494
- <el-option-group v-for="t in op" :key="t.label" :label="t.label">
495
- <el-option
496
- v-for="e in t.options"
497
- :key="e.value"
498
- :value="e.value"
499
- :label="e.label"
500
- ></el-option>
501
- </el-option-group>
502
- </el-select>
503
- </el-form-item>
504
- <el-form-item label="格式化配置">
505
- <el-button
506
- size="mini"
507
- plain=""
508
- round=""
509
- icon="el-icon-edit"
510
- @click="openFormatConfigDialog(rowData, rowDataIndex)"
511
- :disabled="
512
- !columnFormatMap[rowData.formatS] &&
513
- 'widgetRender' !== rowData.formatS &&
514
- 'editTreeButtonGroup' !== rowData.formatS
515
- "
516
- ></el-button>
517
- </el-form-item>
518
- <el-form-item :label="i18nt('designer.setting.renderFunction')">
519
- <el-button
520
- :disabled="'render' !== rowData.formatS"
521
- size="mini"
522
- plain=""
523
- round=""
524
- icon="el-icon-edit"
525
- @click="showRenderDialog(rowData)"
526
- ></el-button>
527
- </el-form-item>
528
- <el-form-item
529
- v-if="isUtcTransformColumn(rowData)"
530
- label="UTC时差转换"
531
- >
532
- <el-switch v-model="rowData.utcTransformEnabled"></el-switch>
533
- </el-form-item>
534
- <el-form-item :label="i18nt('designer.setting.visibleColumn')">
535
- <el-switch v-model="rowData.show"></el-switch>
536
- </el-form-item>
537
- <el-form-item label="动态显示脚本">
538
- <a
539
- href="javascript:void(0);"
540
- class="a-link link-oneLind"
541
- @click="openColumnShowDialog(rowData)"
542
- >
543
- <span>{{ rowData.columnShow }}</span>
544
- <i class="el-icon-edit"></i>
545
- </a>
546
- </el-form-item>
547
- <el-form-item :label="i18nt('designer.setting.sortableColumn')">
548
- <el-switch v-model="rowData.sortable"></el-switch>
549
- </el-form-item>
550
- <el-form-item label="显示筛选">
551
- <el-switch v-model="rowData.filterable"></el-switch>
552
- </el-form-item>
553
- <el-form-item :label="i18nt('明细行')">
554
- <el-switch v-model="rowData.isItemLine"></el-switch>
555
- </el-form-item>
556
-
557
- <el-form-item :label="i18nt('下拉列')">
558
- <el-switch v-model="rowData.treeNode"></el-switch>
559
- </el-form-item>
560
- <el-form-item :label="i18nt('自定义表格列配置')">
561
- <a
562
- href="javascript:void(0);"
563
- class="a-link link-oneLind"
564
- @click="openTableColumnConfigDialog(rowData, rowDataIndex)"
565
- >
566
- <span>{{ rowData.tableColumnConfig }}</span>
567
- <i class="el-icon-edit"></i>
568
- </a>
569
- </el-form-item>
570
- <el-form-item :label="i18nt('编辑插槽类型')">
571
- <el-select
572
- v-model="rowData.editFormatS"
573
- @change="changeFormatS(rowData, true)"
574
- clearable
575
- >
576
- <el-option
577
- v-for="e in editOp"
578
- :key="e.value"
579
- :value="e.value"
580
- :label="e.label"
581
- ></el-option>
582
- </el-select>
583
- </el-form-item>
584
- <el-form-item label="编辑插槽配置">
585
- <el-button
586
- size="mini"
587
- plain=""
588
- round=""
589
- icon="el-icon-edit"
590
- @click="openEditFormatConfigDialog(rowData, rowDataIndex)"
591
- :disabled="!rowData.editFormatS"
592
- ></el-button>
593
- </el-form-item>
594
- <el-form-item :label="i18nt('导出类型')">
595
- <el-select v-model="rowData.exportType" clearable>
596
- <el-option value="Image2" label="图片"></el-option>
597
- <el-option value="Number" label="数值"></el-option>
598
- </el-select>
599
- </el-form-item>
600
- <el-form-item :label="i18nt('表尾统计行类型')">
601
- <el-select v-model="rowData.footerDataType" clearable>
602
- <el-option value="1" label="合计"></el-option>
603
- <el-option value="2" label="平均"></el-option>
604
- <el-option value="3" label="自定义"></el-option>
605
- </el-select>
606
- </el-form-item>
607
- <el-form-item label="表尾统计行配置">
608
- <el-button
609
- size="mini"
610
- plain=""
611
- round=""
612
- icon="el-icon-edit"
613
- @click="
614
- editFormEventHandler(rowData, rowDataIndex, 'footerMethodConfg')
615
- "
616
- :disabled="rowData.footerDataType !== '3'"
617
- ></el-button>
618
- </el-form-item>
619
- <el-form-item :label="i18nt('显示名称颜色')">
620
- <el-select v-model="rowData.labelColor" clearable>
621
- <el-option value="#e6a23c" label="橙"></el-option>
622
- <el-option value="#2a6494" label="蓝"></el-option>
623
- <el-option value="#30b08f" label="绿"></el-option>
624
- <el-option value="#909399" label="灰"></el-option>
625
- <el-option value="#ea5353" label="红"></el-option>
626
- </el-select>
627
- </el-form-item>
628
- <el-form-item label-width="0" class="form-item-full">
629
- <el-divider class="custom-divider">{{
630
- i18nt("designer.setting.customLabelIcon")
631
- }}</el-divider>
632
- </el-form-item>
633
- <el-form-item :label="i18nt('designer.setting.labelIconClass')">
634
- <icon-picker v-model="rowData.labelIconClass"></icon-picker>
635
- </el-form-item>
636
- <el-form-item :label="i18nt('designer.setting.labelIconPosition')">
637
- <el-select
638
- v-model="rowData.labelIconPosition"
639
- clearable
640
- placeholder="默认后面"
641
- >
642
- <el-option label="前面" value="front"></el-option>
643
- <el-option label="后面" value="rear"></el-option>
644
- </el-select>
645
- </el-form-item>
646
- <el-form-item
647
- :label="i18nt('designer.setting.labelTooltip')"
648
- class="form-item-full"
649
- >
650
- <a
651
- href="javascript:void(0);"
652
- class="a-link link-oneLind"
653
- @click="openLabelTooltipDialog"
654
- >
655
- <span>{{ rowData.labelTooltip }}</span>
656
- <i class="el-icon-edit"></i>
657
- </a>
658
- </el-form-item>
659
- </el-form>
660
- </div>
661
- <el-dialog
662
- v-if="labelTooltipDialogVisible"
663
- custom-class="dialog-style"
664
- :title="i18nt('designer.setting.labelTooltip')"
665
- :visible.sync="labelTooltipDialogVisible"
666
- :show-close="true"
667
- :append-to-body="true"
668
- :modal="false"
669
- :close-on-click-modal="false"
670
- :close-on-press-escape="false"
671
- :destroy-on-close="true"
672
- width="520px"
673
- v-dialog-drag
674
- >
675
- <el-input
676
- type="textarea"
677
- :rows="14"
678
- class="label-tooltip-textarea"
679
- v-model="labelTooltipValue"
680
- clearable
681
- ></el-input>
682
- <div class="dialog-footer" slot="footer">
683
- <el-button
684
- @click="labelTooltipDialogVisible = false"
685
- class="button-sty"
686
- icon="el-icon-close"
687
- >
688
- {{ i18nt("designer.hint.cancel") }}
689
- </el-button>
690
- <el-button
691
- type="primary"
692
- @click="submitLabelTooltipDialog"
693
- class="button-sty"
694
- icon="el-icon-check"
695
- >
696
- {{ i18nt("designer.hint.confirm") }}
697
- </el-button>
698
- </div>
699
- </el-dialog>
700
- <div class="dialog-footer" slot="footer">
701
- <el-button
702
- @click="closeRowEditDialog"
703
- class="button-sty"
704
- icon="el-icon-close"
705
- >
706
- {{ i18nt("designer.hint.cancel") }}
707
- </el-button>
708
- <el-button
709
- type="primary"
710
- @click="submitRowEditDialog"
711
- class="button-sty"
712
- icon="el-icon-check"
713
- >
714
- {{ i18nt("designer.hint.confirm") }}
715
- </el-button>
716
- </div>
717
- </el-dialog>
718
- </el-dialog>
719
- </template>
720
- <script>
721
- import i18n from "../../../../../../components/xform/utils/i18n";
722
- import Sortable from "sortablejs";
723
- import {
724
- generateId,
725
- loopHandleWidget,
726
- deepClone,
727
- columnFormatMap,
728
- } from "../../../../../../components/xform/utils/util";
729
- import columnRenderDialog from "./columnRenderDialog.vue";
730
- import editTreeButtonGroupConfigDialog from "./edit-tree-button-group-config-dialog.vue";
731
- import IconPicker from "@base/components/xform/icon-picker/index.vue";
732
-
733
- let businessOptions = [
734
- {
735
- value: "_createBy",
736
- label: "创建人",
737
- },
738
- {
739
- value: "_modifyBy",
740
- label: "更新人",
741
- },
742
- {
743
- value: "create_date",
744
- label: "创建时间",
745
- },
746
- {
747
- value: "modify_date",
748
- label: "更新时间",
749
- },
750
- ];
751
- let userFields = ["_createBy", "_modifyBy", "create_date", "modify_date"];
752
-
753
- export default {
754
- mixins: [i18n],
755
- props: {
756
- designer: Object,
757
- selectedWidget: Object,
758
- optionModel: Object,
759
- visiable: {
760
- type: Boolean,
761
- default: false,
762
- },
763
- },
764
- components: {
765
- columnRenderDialog,
766
- editTreeButtonGroupConfigDialog,
767
- IconPicker,
768
- },
769
- inject: ["openWidgetPropertyDialog"],
770
- data() {
771
- return {
772
- tableReady: false,
773
- tableColumnConfigTitle: null,
774
- showTableColumnConfigDialog: false,
775
- tableColumnConfigHeader: null,
776
- tableColumnConfigCode: null,
777
- showEditTreeButtonGroupConfigDialog: false,
778
- currentEditTreeButtonGroupRow: null,
779
- editTreeButtonGroupRowData: null,
780
- alignOptions: [
781
- {
782
- value: "left",
783
- label: "left",
784
- },
785
- {
786
- value: "center",
787
- label: "center",
788
- },
789
- {
790
- value: "right",
791
- label: "right",
792
- },
793
- ],
794
- businessOptions,
795
- userFields,
796
- op: [
797
- {
798
- label: "edit Format",
799
- options: [
800
- {
801
- value: "editInput",
802
- label: "文本输入框",
803
- },
804
- {
805
- value: "editNumber",
806
- label: "数字输入框",
807
- },
808
- {
809
- value: "editDate",
810
- label: "日期输入框",
811
- },
812
- {
813
- value: "textarea",
814
- label: "多行文本输入框",
815
- },
816
- {
817
- value: "editScriptInput",
818
- label: "脚本输入框",
819
- },
820
- {
821
- value: "editSelect",
822
- label: "下拉框",
823
- },
824
- {
825
- value: "checkbox",
826
- label: "复选框",
827
- },
828
- {
829
- value: "radio",
830
- label: "单选框",
831
- },
832
- {
833
- value: "editAttachment",
834
- label: "附件",
835
- },
836
- {
837
- value: "editSearch",
838
- label: "搜索框",
839
- },
840
- {
841
- value: "editStatus",
842
- label: "状态",
843
- },
844
- {
845
- value: "text",
846
- label: "文本",
847
- },
848
- {
849
- value: "aText",
850
- label: "超链接文本",
851
- },
852
- {
853
- value: "widgetRender",
854
- label: "自定义组件",
855
- },
856
- ],
857
- },
858
- {
859
- label: "按钮控件",
860
- options: [
861
- {
862
- value: "dropdown",
863
- label: "下拉按钮",
864
- },
865
- {
866
- value: "editDelete",
867
- label: "删除按钮",
868
- },
869
- {
870
- value: "editButton",
871
- label: "查看按钮",
872
- },
873
- {
874
- value: "aLink",
875
- label: "超链接按钮",
876
- },
877
- {
878
- value: "button",
879
- label: "按钮",
880
- },
881
- {
882
- value: "editTreeButtonGroup",
883
- label: "编辑行按钮组",
884
- },
885
- ],
886
- },
887
- {
888
- label: "树控件",
889
- options: [
890
- {
891
- value: "addSiblingEditRow",
892
- label: "新增兄弟节点",
893
- },
894
- {
895
- value: "addChildTreeRow",
896
- label: "新增子节点",
897
- },
898
- {
899
- value: "moveUpRow",
900
- label: "上移",
901
- },
902
- {
903
- value: "moveDownRow",
904
- label: "下移",
905
- },
906
- {
907
- value: "removeTreeRow",
908
- label: "删除树节点",
909
- },
910
- ],
911
- },
912
-
913
- {
914
- label: "业务模块",
915
- options: businessOptions,
916
- },
917
- {
918
- label: "日期格式化",
919
- options: [
920
- {
921
- value: "d1",
922
- label: "yyyy-MM-dd",
923
- },
924
- {
925
- value: "d2",
926
- label: "yyyy/MM/dd",
927
- },
928
- {
929
- value: "d3",
930
- label: "yyyy年MM月dd日",
931
- },
932
- {
933
- value: "d4",
934
- label: "yyyy-MM-dd HH:mm:ss",
935
- },
936
- {
937
- value: "d5",
938
- label: "yyyy-MM-dd hh:mm:ss",
939
- },
940
- ],
941
- },
942
- {
943
- label: "数字格式化",
944
- options: [
945
- {
946
- value: "n1",
947
- label: "###,###,###,##0.######",
948
- },
949
- {
950
- value: "n2",
951
- label: "###,###,###,##0.00####",
952
- },
953
- {
954
- value: "n3",
955
- label: "###,###,###,##0.000000",
956
- },
957
- {
958
- value: "n4",
959
- label: "###,###,###,##0.000",
960
- },
961
- {
962
- value: "n5",
963
- label: "###,###,###,##0.00",
964
- },
965
- {
966
- value: "n6",
967
- label: "###,###,###,##0",
968
- },
969
- {
970
- value: "n7",
971
- label: "###,##0.00##%",
972
- },
973
- ],
974
- },
975
- ],
976
- editOp: [
977
- {
978
- value: "editInput",
979
- label: "文本输入框",
980
- },
981
- {
982
- value: "textarea",
983
- label: "多行文本输入框",
984
- },
985
- {
986
- value: "editNumber",
987
- label: "数字输入框",
988
- },
989
- {
990
- value: "editDate",
991
- label: "日期输入框",
992
- },
993
- {
994
- value: "editSelect",
995
- label: "下拉框",
996
- },
997
- {
998
- value: "editAttachment",
999
- label: "附件",
1000
- },
1001
- {
1002
- value: "editSearch",
1003
- label: "搜索框",
1004
- },
1005
- ],
1006
- showRenderDialogFlag: !1,
1007
- renderJson: "",
1008
- currentTableColumn: null,
1009
- sourceData: null,
1010
-
1011
- hideAfter: 1500,
1012
- openDelay: 500,
1013
- tableData: [], //树形结构数据转的数组
1014
- tableDataArray: [],
1015
- dragSort: null,
1016
- columnFormatMap,
1017
-
1018
- showFormEventDialogFlag: false,
1019
- formEventHandlerCode: "",
1020
- curEventName: "",
1021
- curEventRow: null,
1022
-
1023
- eventParamsMap: {
1024
- footerMethodConfg: "footerMethodConfg(dataId,formCode,param) {",
1025
- columnShow: "columnShow(dataId,formCode,columnConfig) {",
1026
- },
1027
-
1028
- showColumnRenderDialog: false,
1029
-
1030
- editRowData: null,
1031
- rowData: null,
1032
- rowDataIndex: 0,
1033
- showRowEditDialog: false,
1034
- labelTooltipDialogVisible: false,
1035
- labelTooltipValue: "",
1036
- sourceTableColumnsSnapshot: null,
1037
- };
1038
- },
1039
- beforeDestroy() {
1040
- if (this.dragSort) this.dragSort.destroy();
1041
- },
1042
- computed: {
1043
- showDialog: {
1044
- get() {
1045
- return this.visiable;
1046
- },
1047
- set(val) {
1048
- this.$emit("update:visiable", val);
1049
- },
1050
- },
1051
- shouldExpandAllTable() {
1052
- return this.countTreeRows(this.tableData) <= 30;
1053
- },
1054
- },
1055
- watch: {
1056
- visiable(val) {
1057
- if (val) {
1058
- this.onDialogOpen();
1059
- } else {
1060
- this.onDialogClose();
1061
- }
1062
- },
1063
- },
1064
- created() {},
1065
- mounted() {
1066
- if (this.visiable) {
1067
- this.onDialogOpen();
1068
- }
1069
- },
1070
- methods: {
1071
- countTreeRows(rows) {
1072
- if (!Array.isArray(rows) || !rows.length) {
1073
- return 0;
1074
- }
1075
- let count = 0;
1076
- const walk = (list) => {
1077
- list.forEach((item) => {
1078
- count += 1;
1079
- if (item.children && item.children.length) {
1080
- walk(item.children);
1081
- }
1082
- });
1083
- };
1084
- walk(rows);
1085
- return count;
1086
- },
1087
- cloneTableColumnsForEdit(columns) {
1088
- if (!Array.isArray(columns)) {
1089
- return [];
1090
- }
1091
- const refKeys = ["widget", "editWidget", "widgetList"];
1092
- const cloneRow = (row) => {
1093
- if (!row || typeof row !== "object") {
1094
- return row;
1095
- }
1096
- const cloned = {};
1097
- Object.keys(row).forEach((key) => {
1098
- const val = row[key];
1099
- if (key === "children" && Array.isArray(val) && val.length) {
1100
- cloned.children = val.map(cloneRow);
1101
- return;
1102
- }
1103
- if (refKeys.includes(key)) {
1104
- cloned[key] = val;
1105
- return;
1106
- }
1107
- if (key === "columnOption") {
1108
- if (!row.widget) {
1109
- cloned.columnOption =
1110
- val !== null && typeof val === "object" ? deepClone(val) : val;
1111
- }
1112
- return;
1113
- }
1114
- if (key === "editColumnOption") {
1115
- if (!row.editWidget) {
1116
- cloned.editColumnOption =
1117
- val !== null && typeof val === "object" ? deepClone(val) : val;
1118
- }
1119
- return;
1120
- }
1121
- if (val !== null && typeof val === "object") {
1122
- try {
1123
- cloned[key] = deepClone(val);
1124
- } catch (e) {
1125
- cloned[key] = val;
1126
- }
1127
- return;
1128
- }
1129
- cloned[key] = val;
1130
- });
1131
- if (row.widget && !cloned.widget) {
1132
- cloned.widget = row.widget;
1133
- }
1134
- if (row.editWidget && !cloned.editWidget) {
1135
- cloned.editWidget = row.editWidget;
1136
- }
1137
- return cloned;
1138
- };
1139
- return columns.map(cloneRow);
1140
- },
1141
- buildColumnWidgetMap(columns, map = {}) {
1142
- if (!Array.isArray(columns)) {
1143
- return map;
1144
- }
1145
- columns.forEach((col) => {
1146
- if (col && col.columnId) {
1147
- map[col.columnId] = col;
1148
- }
1149
- if (col.children && col.children.length) {
1150
- this.buildColumnWidgetMap(col.children, map);
1151
- }
1152
- });
1153
- return map;
1154
- },
1155
- restoreColumnWidgetRefs(columns, widgetMap) {
1156
- if (!Array.isArray(columns)) {
1157
- return [];
1158
- }
1159
- return columns.map((row) => {
1160
- const next = Object.assign({}, row);
1161
- const orig = widgetMap[next.columnId];
1162
- if (orig) {
1163
- // 仅 formatS 未变更时补回 widget,避免清空 formatS 后又被快照还原
1164
- const formatUnchanged = next.formatS === orig.formatS;
1165
- const editFormatUnchanged = next.editFormatS === orig.editFormatS;
1166
- if (formatUnchanged && !next.widget && orig.widget) {
1167
- next.widget = orig.widget;
1168
- }
1169
- if (editFormatUnchanged && !next.editWidget && orig.editWidget) {
1170
- next.editWidget = orig.editWidget;
1171
- }
1172
- if (
1173
- formatUnchanged &&
1174
- next.formatS === "widgetRender" &&
1175
- (!next.widgetList || !next.widgetList.length) &&
1176
- orig.widgetList &&
1177
- orig.widgetList.length
1178
- ) {
1179
- next.widgetList = orig.widgetList;
1180
- }
1181
- }
1182
- if (next.children && next.children.length) {
1183
- next.children = this.restoreColumnWidgetRefs(
1184
- next.children,
1185
- widgetMap
1186
- );
1187
- }
1188
- return next;
1189
- });
1190
- },
1191
- editFormEventHandler(row, index, eventName) {
1192
- this.curEventRow = row;
1193
- this.curEventName = eventName;
1194
- this.curEventIndex = index;
1195
- this.formEventHandlerCode = row[eventName];
1196
- this.showFormEventDialogFlag = true;
1197
- },
1198
-
1199
- saveFormEventHandler() {
1200
- const codeHints = this.$refs.ecEditor.getEditorAnnotations();
1201
- let syntaxErrorFlag = false;
1202
- if (!!codeHints && codeHints.length > 0) {
1203
- codeHints.forEach((chItem) => {
1204
- if (chItem.type === "error") {
1205
- syntaxErrorFlag = true;
1206
- }
1207
- });
1208
-
1209
- if (syntaxErrorFlag) {
1210
- this.$message.error(
1211
- this.i18nt("designer.setting.syntaxCheckWarning")
1212
- );
1213
- return;
1214
- }
1215
- }
1216
- this.curEventRow[this.curEventName] = this.formEventHandlerCode;
1217
- this.showFormEventDialogFlag = false;
1218
- },
1219
- onDialogClose() {
1220
- this.tableReady = false;
1221
- this.sourceTableColumnsSnapshot = null;
1222
- if (this.dragSort) {
1223
- this.dragSort.destroy();
1224
- this.dragSort = null;
1225
- }
1226
- },
1227
- onDialogOpen() {
1228
- this.tableReady = false;
1229
- if (this.dragSort) {
1230
- this.dragSort.destroy();
1231
- this.dragSort = null;
1232
- }
1233
- this.$nextTick(() => {
1234
- const load = () => {
1235
- this.loadTableData();
1236
- this.tableReady = true;
1237
- this.$nextTick(() => {
1238
- requestAnimationFrame(() => {
1239
- this.rowDrop();
1240
- });
1241
- });
1242
- };
1243
- if (typeof requestIdleCallback === "function") {
1244
- requestIdleCallback(load, { timeout: 80 });
1245
- } else {
1246
- setTimeout(load, 0);
1247
- }
1248
- });
1249
- },
1250
- loadTableData() {
1251
- const source = this.optionModel.tableColumns || [];
1252
- this.sourceTableColumnsSnapshot = source;
1253
- this.tableData = this.cloneTableColumnsForEdit(source);
1254
- },
1255
- colSubmit() {
1256
- this.dialogVisible = !1;
1257
- const widgetMap = this.buildColumnWidgetMap(
1258
- this.sourceTableColumnsSnapshot || []
1259
- );
1260
- this.optionModel.tableColumns = this.restoreColumnWidgetRefs(
1261
- this.tableData,
1262
- widgetMap
1263
- );
1264
- this.sourceTableColumnsSnapshot = null;
1265
- this.closeHandle();
1266
- },
1267
- openWidgetRenderDialog(row, sourceData) {
1268
- this.currentTableColumn = row;
1269
- this.sourceData = sourceData;
1270
-
1271
- // this.widgetList =
1272
-
1273
- // this.designer.widgetList
1274
-
1275
- this.showColumnRenderDialog = true;
1276
- },
1277
- confirmWidgetRenderDialog(widgetList) {
1278
- this.currentTableColumn.widgetList = widgetList;
1279
- this.showColumnRenderDialog = false;
1280
- },
1281
- showRenderDialog: function (e) {
1282
- /*if(e.formatS == 'widgetRender'){
1283
- this.openWidgetRenderDialog(e);
1284
- return
1285
- }*/
1286
-
1287
- (this.currentTableColumn = e),
1288
- (this.renderJson = e.render || ""),
1289
- (this.showRenderDialogFlag = !0);
1290
- },
1291
- saveColumnRender: function () {
1292
- this.$set(this.currentTableColumn, "render", this.renderJson),
1293
- (this.showRenderDialogFlag = !1);
1294
- },
1295
- closeHandle() {
1296
- this.$emit("update:visiable", false);
1297
- this.$emit("close");
1298
- },
1299
- // 添加同级节点
1300
- onAddSibling(row, index) {
1301
- console.log("onAddSibling", row, index);
1302
- const parentId = row.parentId || null;
1303
- // 先判断是不是根节点
1304
- if (!parentId) {
1305
- // 当前节点直接添加
1306
- // this.tableData.push(this.generateRow(parentId))
1307
- let addIndex =
1308
- this.tableData
1309
- .filter((item) => !item.parentId)
1310
- .findIndex((item) => item.columnId == row.columnId) + 1;
1311
- this.tableData.splice(addIndex, 0, this.generateRow(parentId));
1312
- } else {
1313
- this.handleAddOneRow(row, index, "SIBLING");
1314
- }
1315
- },
1316
- // 添加子节点 todo
1317
- onAddChild(row, index) {
1318
- this.handleAddOneRow(row, index, "CHILD");
1319
- },
1320
- /**
1321
- * 处理添加一行数据
1322
- * @param {object} row 当前节点
1323
- * @param {number} index
1324
- * @param {string} type 操作类型 SIBLING 同级 / CHILD 子级
1325
- */
1326
- handleAddOneRow(row, index, type) {
1327
- const { parentId, columnId } = row;
1328
- const curId = type === "SIBLING" ? parentId : columnId;
1329
- let curRow = {};
1330
- // 在 tableData 中,找到当前节点
1331
- const findRow = (data) => {
1332
- data.forEach((item) => {
1333
- if (item.columnId === curId) {
1334
- curRow = item;
1335
- }
1336
- if (item.children && item.children.length) {
1337
- findRow(item.children);
1338
- }
1339
- });
1340
- };
1341
-
1342
- findRow(this.tableData);
1343
-
1344
- const { columnId: generateParentId, children } = curRow;
1345
-
1346
- let newRow = this.generateRow(generateParentId);
1347
- if (children) {
1348
- if (type === "SIBLING") {
1349
- let addIndex =
1350
- children.findIndex((item) => item.columnId == row.columnId) + 1;
1351
- children.splice(addIndex, 0, newRow);
1352
- } else {
1353
- children.push(newRow);
1354
- }
1355
- } else {
1356
- this.$set(curRow, "children", [newRow]);
1357
- }
1358
- },
1359
- getUuid() {
1360
- return new Date().getTime();
1361
- },
1362
- createRowAuthName(type) {
1363
- return `row${type}` + generateId();
1364
- },
1365
- /**
1366
- * 生成一行数据
1367
- */
1368
- generateRow(parentId) {
1369
- let tmpId = "column" + generateId();
1370
- let uuid = this.getUuid();
1371
- var row = {
1372
- columnId: uuid,
1373
- kid: uuid,
1374
- parentId: parentId || null,
1375
- required: false,
1376
- width: 150,
1377
- prop: tmpId,
1378
- label: tmpId,
1379
- align: "left",
1380
- show: true,
1381
- sortable: true,
1382
- filterable: true,
1383
- exportType: null,
1384
- footerDataType: null,
1385
- footerMethodConfg: null,
1386
- widgetList: [],
1387
- labelColor: null,
1388
- rowAddAuthName: this.createRowAuthName("Add"),
1389
- rowEditAuthName: this.createRowAuthName("Edit"),
1390
- rowAddShow: null,
1391
- rowEditShow: null,
1392
- columnShow: null,
1393
- utcTransformEnabled: false,
1394
- labelIconClass: null,
1395
- labelIconPosition: "rear",
1396
- labelTooltip: null,
1397
- // treeNode: false,
1398
- };
1399
- return row;
1400
- },
1401
- isUtcTransformColumn(row) {
1402
- const formatS = row.formatS;
1403
- if (!formatS) {
1404
- return true;
1405
- }
1406
- return [
1407
- "d1",
1408
- "d2",
1409
- "d3",
1410
- "d4",
1411
- "d5",
1412
- "render",
1413
- "create_date",
1414
- "modify_date",
1415
- ].includes(formatS);
1416
- },
1417
- // 添加根节点
1418
- onAddRoot() {
1419
- this.tableData.push(this.generateRow());
1420
- },
1421
- // 删除当前节点及对应子节点数据
1422
- onDelete(row) {
1423
- const { parentId, columnId } = row;
1424
- // 根节点直接删除
1425
- if (!parentId) {
1426
- const delIndex = this.tableData.findIndex(
1427
- (item) => item.columnId === columnId
1428
- );
1429
- this.tableData.splice(delIndex, 1);
1430
- } else {
1431
- // 找到父节点,通过父节点删除
1432
- let parentRow = {};
1433
- const findRow = (data) => {
1434
- data.forEach((item) => {
1435
- if (item.columnId === parentId) {
1436
- parentRow = { ...item };
1437
- }
1438
- if (item.children && item.children.length) {
1439
- findRow(item.children);
1440
- }
1441
- });
1442
- };
1443
- findRow(this.tableData);
1444
-
1445
- const { children } = parentRow;
1446
-
1447
- const delIndex = children.findIndex(
1448
- (item) => item.columnId === columnId
1449
- );
1450
-
1451
- children.splice(delIndex, 1);
1452
- }
1453
- },
1454
- // 数据准备 生成 id 和 parentId
1455
- handleTableDataFormat(data) {
1456
- const tableFormat = (tableData, parentId) => {
1457
- tableData.forEach((item) => {
1458
- // item.parentId = parentId || null
1459
- if (!item.kid) item.kid = item.columnId;
1460
- if (item.children && item.children.length > 0) {
1461
- tableFormat(item.children, item.columnId);
1462
- }
1463
- });
1464
- };
1465
-
1466
- tableFormat(data);
1467
- return data;
1468
- },
1469
- //drag begin
1470
- //行拖拽
1471
- rowDrop() {
1472
- if (this.dragSort) this.dragSort.destroy(); // 防止在Dom上重复绑定事件
1473
- // const tbody = document.querySelector('.drag .el-table__body-wrapper tbody');
1474
- var tbody = this.$refs.singleTable.$el.querySelectorAll(
1475
- ".el-table__fixed-body-wrapper > table > tbody"
1476
- )[0];
1477
- const _this = this;
1478
- this.dragSort = Sortable.create(tbody, {
1479
- ghostClass: "sortable-ghost",
1480
- // draggable: ".drag-option", // 修改可拖拽元素
1481
- handle: ".drag-option", // 指定拖动按钮
1482
- setData: function (e) {
1483
- e.setData("Text", "");
1484
- },
1485
- onEnd({ newIndex, oldIndex }) {
1486
- _this.rowDropEnd(newIndex, oldIndex);
1487
- },
1488
- });
1489
- },
1490
-
1491
- //树转数组
1492
- toArray(data) {
1493
- const result = [];
1494
- data.forEach((item) => {
1495
- const loop = (data) => {
1496
- result.push({
1497
- ...data,
1498
- });
1499
- let child = data.children;
1500
- if (child) {
1501
- for (let i = 0; i < child.length; i++) {
1502
- loop(child[i]);
1503
- }
1504
- }
1505
- };
1506
- loop(item);
1507
- });
1508
- return result;
1509
- },
1510
- //数组转树
1511
- arrToTree(arr, parentId) {
1512
- return arr
1513
- .filter((item) =>
1514
- !parentId ? !item.parentId : item.parentId === parentId
1515
- )
1516
- .map((item) => {
1517
- item.children = this.arrToTree(arr, item.columnId);
1518
- return item;
1519
- });
1520
- },
1521
- //查看树中v2 是否 为 v1的底级
1522
- isTreeBottom(tree, v1, v2) {
1523
- let result = false;
1524
-
1525
- function recursion(tree, v1, v2, flag) {
1526
- for (let i = 0; i < tree.length; i++) {
1527
- const item = tree[i];
1528
- if (item.columnId === v2) {
1529
- result = flag;
1530
- return;
1531
- } else if (item.columnId === v1) {
1532
- item.children ? recursion(item.children, v1, v2, true) : "";
1533
- } else {
1534
- item.children ? recursion(item.children, v1, v2, flag) : "";
1535
- }
1536
- }
1537
- }
1538
-
1539
- recursion(tree, v1, v2, false);
1540
- return result;
1541
- },
1542
- //行结束拖拽事件
1543
- rowDropEnd(newIndex, oldIndex) {
1544
- //判断是否没有更换位置,如果没更换,则不做任何操作
1545
- if (newIndex === oldIndex) return;
1546
- //树形结构转数组
1547
- this.tableDataArray = this.toArray(this.tableData);
1548
-
1549
- let oldRow = this.tableDataArray[oldIndex];
1550
- let newRow = this.tableDataArray[newIndex];
1551
-
1552
- //判断是否把该行 拖拽到 自己的底级中
1553
- if (this.isTreeBottom(this.tableData, oldRow.columnId, newRow.columnId)) {
1554
- this.$message({
1555
- type: "error",
1556
- message: "不能放到子节点",
1557
- });
1558
- let tableData = this.tableData;
1559
- this.tableData = [];
1560
- this.$nextTick(() => {
1561
- this.tableData = tableData;
1562
- });
1563
- return;
1564
- }
1565
-
1566
- if (oldRow.parentId != newRow.parentId) {
1567
- this.$message({
1568
- type: "error",
1569
- message: "不能放到父节点",
1570
- });
1571
- let tableData = this.tableData;
1572
- this.tableData = [];
1573
- this.$nextTick(() => {
1574
- this.tableData = tableData;
1575
- });
1576
- return;
1577
- }
1578
-
1579
- let pid = this.tableDataArray[newIndex].parentId || null;
1580
- //拿到当前行数据,并从数组中删除该数据
1581
- const currRow = this.tableDataArray.splice(oldIndex, 1)[0];
1582
- //把当前行数据的 父id 给 赋值为结束位置的父id,因为当前行与结束行平级.父id相同.
1583
- currRow.parentId = pid;
1584
- //把更改了父id的当前行数据给插入到数组中
1585
- this.tableDataArray.splice(newIndex, 0, currRow);
1586
- //表格显示的数据清空
1587
- this.tableData = [];
1588
- this.$nextTick(() => {
1589
- //表格显示的数据 为 修改了位置的数组转换成的属性结构
1590
- this.tableData = this.arrToTree(this.tableDataArray);
1591
- //新的数组为 表格显示的数据转换
1592
- this.tableDataArray = this.toArray(this.tableData);
1593
- });
1594
- },
1595
- getIsButtontCell(formatS) {
1596
- let isButtontCell = false;
1597
- let widgetType = this.columnFormatMap[formatS];
1598
- if (widgetType) {
1599
- isButtontCell =
1600
- widgetType === "a-link" ||
1601
- widgetType === "button" ||
1602
- widgetType === "dropdown";
1603
- }
1604
- return isButtontCell;
1605
- },
1606
- //drag end
1607
- changeFormatS(row, isEdit) {
1608
- let formatS = isEdit ? row.editFormatS : row.formatS;
1609
- let isButtontCell = this.getIsButtontCell(formatS);
1610
- let attachmentPrefix = this.designer.getAttachmentPrefix();
1611
- let columnSelectedWidget = this.designer.createColumnWidget(row, isEdit);
1612
- if (!isEdit) {
1613
- if (columnSelectedWidget) {
1614
- row.widget = columnSelectedWidget;
1615
- } else {
1616
- row.widget = null;
1617
- }
1618
- row.utcTransformEnabled = false;
1619
- } else {
1620
- if (row.prop && row.prop.startsWith(attachmentPrefix)) {
1621
- let suffix = row.prop.replace(attachmentPrefix, "");
1622
- columnSelectedWidget.options.keyName = row.prop;
1623
- columnSelectedWidget.options.keyNameSuffix = suffix;
1624
- }
1625
- if (columnSelectedWidget) {
1626
- row.editWidget = columnSelectedWidget;
1627
- } else {
1628
- row.editWidget = null;
1629
- }
1630
- }
1631
-
1632
- if (!isEdit) {
1633
- if (row.formatS == "editTreeButtonGroup") {
1634
- row.prop = null;
1635
- row.label = null;
1636
- row.sortable = false;
1637
- row.width = 150;
1638
- row.widget = null;
1639
- } else if (isButtontCell) {
1640
- if (row.formatS == "dropdown") {
1641
- row.width = 100;
1642
- } else if (row.formatS == "aLink" || row.formatS == "button") {
1643
- if (!row.width || row.width == 47) row.width = 150;
1644
- } else {
1645
- row.width = 47;
1646
- }
1647
- row.prop = null;
1648
- row.label = null;
1649
- row.sortable = false;
1650
- row.filterable = false;
1651
- } else {
1652
- let tmpId = "column" + generateId();
1653
- if (!row.width || row.width == 47) row.width = 150;
1654
- if (!row.prop) row.prop = tmpId;
1655
- if (!row.label) row.label = tmpId;
1656
-
1657
- if (this.userFields.includes(row.formatS)) {
1658
- let item = this.businessOptions.find(
1659
- (item) => item.value == row.formatS
1660
- );
1661
- if (item) {
1662
- row.prop = item.value;
1663
- row.label = item.label;
1664
- }
1665
- }
1666
-
1667
- row.sortable = true;
1668
-
1669
- if (!isEdit) {
1670
- if (formatS == "editAttachment") {
1671
- row.prop = columnSelectedWidget.options.keyName;
1672
- } else {
1673
- row.prop = row.prop.replaceAll(attachmentPrefix, "");
1674
- }
1675
- }
1676
- }
1677
- }
1678
- },
1679
- getColumnWidgetConfig(row, isChange, isEdit) {
1680
- let formatS = isEdit ? row.editFormatS : row.formatS;
1681
- let columnSelectedWidget = null;
1682
- let columnEditFields = null;
1683
-
1684
- let type = this.columnFormatMap[formatS];
1685
-
1686
- if (type) {
1687
- const applyNewWidgetDefaults = (widget) => {
1688
- widget.options.required = row.required || false;
1689
- if ("editDelete" == formatS) {
1690
- widget.options.prefixIcon = "el-icon-delete";
1691
- widget.options.label = "删除";
1692
- widget.options.labelHidden = true;
1693
- widget.options.hiddenByWf = true;
1694
- widget.options.onClick =
1695
- "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
1696
- } else if ("editButton" == formatS) {
1697
- widget.options.prefixIcon = "el-icon-edit";
1698
- widget.options.label = "查看";
1699
- widget.options.labelHidden = true;
1700
- widget.options.onClick =
1701
- "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
1702
- } else if ("addSiblingEditRow" == formatS) {
1703
- widget.options.prefixIcon = "el-icon-plus";
1704
- widget.options.label = "新增兄弟节点";
1705
- widget.options.labelHidden = false;
1706
- widget.options.onClick =
1707
- "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
1708
- } else if ("addChildTreeRow" == formatS) {
1709
- widget.options.prefixIcon = "el-icon-plus";
1710
- widget.options.label = "新增子节点";
1711
- widget.options.labelHidden = false;
1712
- widget.options.onClick =
1713
- "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
1714
- } else if ("moveUpRow" == formatS) {
1715
- widget.options.label = "↑上移";
1716
- widget.options.labelHidden = false;
1717
- widget.options.onClick =
1718
- "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
1719
- } else if ("moveDownRow" == formatS) {
1720
- widget.options.label = "↓下移";
1721
- widget.options.labelHidden = false;
1722
- widget.options.onClick =
1723
- "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
1724
- } else if ("removeTreeRow" == formatS) {
1725
- widget.options.prefixIcon = "el-icon-delete";
1726
- widget.options.label = "删除";
1727
- widget.options.labelHidden = true;
1728
- widget.options.onClick =
1729
- "let tableParam = this.tableParam;\nthis.getParentTarget().removeTreeRow(tableParam);";
1730
- }
1731
- };
1732
-
1733
- if (!isChange) {
1734
- const sourceWidget = this.designer.getColumnWidget(row, isEdit);
1735
- if (sourceWidget) {
1736
- columnSelectedWidget = this.$baseLodash.cloneDeep(sourceWidget);
1737
- columnSelectedWidget.options.required = row.required || false;
1738
- if ("editDelete" == formatS) {
1739
- columnSelectedWidget.options.hiddenByWf =
1740
- columnSelectedWidget.options.hiddenByWf ?? true;
1741
- columnSelectedWidget.options.prefixIcon =
1742
- columnSelectedWidget.options.prefixIcon || "el-icon-delete";
1743
- } else if ("editButton" == formatS) {
1744
- columnSelectedWidget.options.prefixIcon =
1745
- columnSelectedWidget.options.prefixIcon || "el-icon-edit";
1746
- }
1747
- } else {
1748
- columnSelectedWidget = this.designer.copyNewFieldWidget(
1749
- this.designer.getFieldWidgetByType(type)
1750
- );
1751
- applyNewWidgetDefaults(columnSelectedWidget);
1752
- }
1753
- } else {
1754
- columnSelectedWidget = this.designer.copyNewFieldWidget(
1755
- this.designer.getFieldWidgetByType(type)
1756
- );
1757
- applyNewWidgetDefaults(columnSelectedWidget);
1758
- }
1759
-
1760
- if (columnSelectedWidget.options.hasOwnProperty("keyName")) {
1761
- columnSelectedWidget.options.keyName = row.prop;
1762
- columnSelectedWidget.options.keyNameEnabled = true;
1763
- } else {
1764
- columnSelectedWidget.options.name = row.prop;
1765
- }
1766
-
1767
- if (type != "button" && type != "a-link") {
1768
- columnSelectedWidget.options.label = row.label;
1769
- columnSelectedWidget.options.labelHidden = true;
1770
- }
1771
- }
1772
- return { columnSelectedWidget, columnEditFields };
1773
- },
1774
- findColumnByColumnId(columnList, columnId) {
1775
- let result = null;
1776
- if (columnList) {
1777
- let column = columnList.find((item) => item.columnId == columnId);
1778
- for (let column of columnList) {
1779
- if (column.columnId == columnId) {
1780
- result = column;
1781
- break;
1782
- } else if (column.children && column.children.length) {
1783
- let subColumn = this.findColumnByColumnId(
1784
- column.children,
1785
- children
1786
- );
1787
- if (subColumn) {
1788
- result = subColumn;
1789
- break;
1790
- }
1791
- }
1792
- }
1793
- }
1794
- return result;
1795
- },
1796
-
1797
- getRowWidget(row) {
1798
- let widget = row.widget;
1799
- if (!widget) {
1800
- widget.options.a = a;
1801
- widget.options.a = a;
1802
- }
1803
- return widget;
1804
- },
1805
- confirmEditTreeButtonGroupConfig(rowConfig) {
1806
- if (this.currentEditTreeButtonGroupRow) {
1807
- Object.assign(this.currentEditTreeButtonGroupRow, rowConfig);
1808
- }
1809
- this.currentEditTreeButtonGroupRow = null;
1810
- this.editTreeButtonGroupRowData = null;
1811
- },
1812
- openFormatConfigDialog(row, index) {
1813
- if (row.formatS === "editTreeButtonGroup") {
1814
- this.currentEditTreeButtonGroupRow = row;
1815
- this.editTreeButtonGroupRowData = this.$baseLodash.cloneDeep(row);
1816
- this.showEditTreeButtonGroupConfigDialog = true;
1817
- return;
1818
- }
1819
- if (row.formatS == "widgetRender") {
1820
- let formWidgetList = deepClone(this.designer.widgetList);
1821
- const widgetMap = this.buildColumnWidgetMap(
1822
- this.sourceTableColumnsSnapshot || this.optionModel.tableColumns || []
1823
- );
1824
- let tableData = this.restoreColumnWidgetRefs(
1825
- this.cloneTableColumnsForEdit(this.tableData),
1826
- widgetMap
1827
- );
1828
- let columnId = row.columnId;
1829
-
1830
- let dataTableName = this.optionModel.name;
1831
-
1832
- let targetColumn = null;
1833
- loopHandleWidget(formWidgetList, (item) => {
1834
- if (item.options.name == dataTableName) {
1835
- item.options.tableColumns = tableData;
1836
- targetColumn = this.findColumnByColumnId(
1837
- item.options.tableColumns,
1838
- columnId
1839
- );
1840
- }
1841
- });
1842
- let getWidgetList = (subWidgetList = []) => {
1843
- targetColumn.widgetList = this.$baseLodash.cloneDeep(subWidgetList);
1844
- return formWidgetList;
1845
- };
1846
- let sourceData = {
1847
- formWidgetList,
1848
- dataTableName,
1849
- columnId,
1850
- getWidgetList,
1851
- };
1852
-
1853
- this.openWidgetRenderDialog(row, sourceData);
1854
- return;
1855
- }
1856
-
1857
- const { columnSelectedWidget, columnEditFields } =
1858
- this.getColumnWidgetConfig(row);
1859
- if (!columnSelectedWidget) {
1860
- this.$message.warning(this.$t1("请先选择列格式化类型"));
1861
- return;
1862
- }
1863
- columnSelectedWidget.options = this.$baseLodash.cloneDeep(
1864
- columnSelectedWidget.options
1865
- );
1866
- this.operateIndex = index;
1867
- this.openWidgetPropertyDialog({
1868
- row: row,
1869
- columnSelectedWidget,
1870
- tableColumns: this.tableData,
1871
- index: index,
1872
- columnEditFields,
1873
- callback: (confirmedWidget) => {
1874
- this.confirmFormatConfigDialog(confirmedWidget, row);
1875
- },
1876
- });
1877
- },
1878
- getFieldKeyNameByOptions(options) {
1879
- let o = options.name;
1880
- return (options.keyNameEnabled && options.keyName) || o;
1881
- },
1882
- confirmFormatConfigDialog(columnSelectedWidget, row) {
1883
- row.widget = columnSelectedWidget;
1884
- const options = columnSelectedWidget.options;
1885
-
1886
- let isButtontCell = this.getIsButtontCell(row.formatS);
1887
- if (!isButtontCell) {
1888
- row.prop = this.getFieldKeyNameByOptions(options);
1889
- row.label = options.label;
1890
- row.required = options.required;
1891
- }
1892
- },
1893
- openEditFormatConfigDialog(row, index) {
1894
- const { columnSelectedWidget, columnEditFields } =
1895
- this.getColumnWidgetConfig(row, false, true);
1896
- if (!columnSelectedWidget) {
1897
- this.$message.warning(this.$t1("请先选择编辑列格式化类型"));
1898
- return;
1899
- }
1900
- columnSelectedWidget.options = this.$baseLodash.cloneDeep(
1901
- columnSelectedWidget.options
1902
- );
1903
- this.operateIndex = index;
1904
- this.openWidgetPropertyDialog({
1905
- row: row,
1906
- tableColumns: this.tableData,
1907
- columnSelectedWidget,
1908
- index: index,
1909
- columnEditFields,
1910
- callback: (confirmedWidget) => {
1911
- this.confirmEditFormatConfigDialog(confirmedWidget, row);
1912
- },
1913
- });
1914
- },
1915
- confirmEditFormatConfigDialog(columnSelectedWidget, row) {
1916
- row.editWidget = columnSelectedWidget;
1917
- },
1918
- openColumnShowDialog(row) {
1919
- this.editFormEventHandler(row, this.rowDataIndex, "columnShow");
1920
- },
1921
- openTableColumnConfigDialog(row, index) {
1922
- this.operateIndex = index;
1923
- this.currentTableColumn = row;
1924
- let eventName = "tableColumnConfig";
1925
- let eventParams = ["dataId", "formCode"];
1926
- this.tableColumnConfigHeader = `${
1927
- this.optionModel.name
1928
- }.${eventName}(${eventParams.join(", ")}) {`;
1929
- this.tableColumnConfigCode = this.$baseLodash.cloneDeep(
1930
- row.tableColumnConfig || ""
1931
- );
1932
-
1933
- this.tableColumnConfigTitle = `自定义表格列属性配置(${row.label})`;
1934
- this.showTableColumnConfigDialog = true;
1935
- },
1936
- saveTableColumnConfigDialog() {
1937
- let row = this.currentTableColumn;
1938
- const codeHints = this.$refs.ecEditor.getEditorAnnotations();
1939
- let syntaxErrorFlag = false;
1940
- if (!!codeHints && codeHints.length > 0) {
1941
- codeHints.forEach((chItem) => {
1942
- if (chItem.type === "error") {
1943
- syntaxErrorFlag = true;
1944
- }
1945
- });
1946
-
1947
- if (syntaxErrorFlag) {
1948
- this.$message.error(
1949
- this.i18nt("designer.setting.syntaxCheckWarning")
1950
- );
1951
- return;
1952
- }
1953
- }
1954
- this.$set(
1955
- row,
1956
- "tableColumnConfig",
1957
- this.$baseLodash.cloneDeep(this.tableColumnConfigCode)
1958
- );
1959
- this.showTableColumnConfigDialog = false;
1960
- },
1961
- changeRowLabel(row) {
1962
- this.setRowWidgetAttars(row, "label", row.label);
1963
- },
1964
- changeRowProp(row) {
1965
- this.setRowWidgetAttars(row, "keyName", row.prop);
1966
- },
1967
- changeRowRequired(row) {
1968
- this.setRowWidgetAttars(row, "required", row.required);
1969
- },
1970
- setRowWidgetAttars(row, key, value) {
1971
- let type1 = this.columnFormatMap[row.formatS];
1972
- let type2 = this.columnFormatMap[row.editFormatS];
1973
- let newWidget = type1
1974
- ? this.designer.copyNewFieldWidget(
1975
- this.designer.getFieldWidgetByType(type1)
1976
- )
1977
- : null;
1978
-
1979
- let newEditWidget = type2
1980
- ? this.designer.copyNewFieldWidget(
1981
- this.designer.getFieldWidgetByType(type2)
1982
- )
1983
- : null;
1984
-
1985
- if (newWidget && newWidget.formItemFlag && row.widget) {
1986
- if (row.widget.options[key] !== undefined) {
1987
- row.widget.options[key] = value;
1988
- }
1989
- }
1990
-
1991
- if (newEditWidget && newEditWidget.formItemFlag && row.editWidget) {
1992
- if (row.editWidget.options[key] !== undefined) {
1993
- row.editWidget.options[key] = value;
1994
- }
1995
- }
1996
- },
1997
- openRowEditDialog(row, index) {
1998
- this.editRowData = row;
1999
- this.rowData = this.cloneTableColumnsForEdit([row])[0];
2000
- this.rowDataIndex = index;
2001
- this.showRowEditDialog = true;
2002
- },
2003
- submitRowEditDialog() {
2004
- Object.assign(this.editRowData, this.rowData);
2005
- if (this.rowData.widget) {
2006
- this.editRowData.widget = this.rowData.widget;
2007
- }
2008
- if (this.rowData.editWidget) {
2009
- this.editRowData.editWidget = this.rowData.editWidget;
2010
- }
2011
- if (this.rowData.widgetList && this.rowData.widgetList.length) {
2012
- this.editRowData.widgetList = this.rowData.widgetList;
2013
- }
2014
- this.showRowEditDialog = false;
2015
- this.labelTooltipDialogVisible = false;
2016
- },
2017
- closeRowEditDialog() {
2018
- this.showRowEditDialog = false;
2019
- this.labelTooltipDialogVisible = false;
2020
- },
2021
- openLabelTooltipDialog() {
2022
- this.labelTooltipValue = this.rowData.labelTooltip || "";
2023
- this.labelTooltipDialogVisible = true;
2024
- },
2025
- submitLabelTooltipDialog() {
2026
- const value = (this.labelTooltipValue || "").trim();
2027
- this.rowData.labelTooltip = value || null;
2028
- this.labelTooltipDialogVisible = false;
2029
- },
2030
- },
2031
- };
2032
- </script>
2033
- <style scoped lang="scss">
2034
- .icon-drag:before {
2035
- content: "\e61d";
2036
- }
2037
-
2038
- /* 固定弹框内容区高度,避免加载前后抖动 */
2039
- ::v-deep .table-column-config-dialog.el-dialog {
2040
- .el-dialog__body {
2041
- height: 532px;
2042
- max-height: 532px;
2043
- overflow: hidden;
2044
- box-sizing: border-box;
2045
- }
2046
- }
2047
-
2048
- .table-column-dialog-cont {
2049
- height: 516px;
2050
- min-height: 516px;
2051
- max-height: 516px;
2052
- overflow: hidden;
2053
- box-sizing: border-box;
2054
- }
2055
-
2056
- /* 完整列配置弹框:挂到 body,内容区可滚动 */
2057
- ::v-deep .table-column-row-edit-dialog.el-dialog {
2058
- .el-dialog__body {
2059
- max-height: calc(90vh - 130px);
2060
- overflow-y: auto;
2061
- overflow-x: hidden;
2062
- box-sizing: border-box;
2063
-
2064
- .cont.table-column-row-edit-cont {
2065
- overflow: visible;
2066
- max-height: none;
2067
- padding-bottom: 12px;
2068
- }
2069
-
2070
- .form-m2 {
2071
- height: auto !important;
2072
- overflow: visible !important;
2073
-
2074
- .el-form-item.form-item-full:last-child {
2075
- margin-bottom: 8px;
2076
- }
2077
- }
2078
- }
2079
- }
2080
-
2081
- .table-column-row-edit-cont {
2082
- box-sizing: border-box;
2083
-
2084
- ::v-deep .form-m2 {
2085
- .form-item-full {
2086
- width: calc(100% - 20px) !important;
2087
- display: block;
2088
- }
2089
-
2090
- .form-item-full .el-input {
2091
- width: 100% !important;
2092
- }
2093
- }
2094
-
2095
- ::v-deep .custom-divider.el-divider--horizontal {
2096
- margin: 10px 0;
2097
- }
2098
- }
2099
-
2100
- ::v-deep .label-tooltip-textarea textarea {
2101
- min-height: 320px;
2102
- }
2103
- </style>
1
+ <template>
2
+ <el-dialog
3
+ custom-class="dialog-style list-dialog table-column-config-dialog"
4
+ :title="i18nt('designer.setting.tableColEdit')"
5
+ :visible.sync="showDialog"
6
+ :modal="false"
7
+ :show-close="!0"
8
+ :close-on-click-modal="!1"
9
+ :close-on-press-escape="!1"
10
+ :destroy-on-close="false"
11
+ top="5vh"
12
+ width="1220px"
13
+ v-dialog-drag
14
+ :before-close="closeHandle"
15
+ >
16
+ <div
17
+ class="cont table-column-dialog-cont"
18
+ v-loading="!tableReady"
19
+ element-loading-background="rgba(0, 0, 0, 0)"
20
+ element-loading-text="数据正在加载中"
21
+ element-loading-spinner="el-icon-loading"
22
+ >
23
+ <el-table
24
+ v-if="tableReady"
25
+ ref="singleTable"
26
+ width="100%"
27
+ :data="tableData"
28
+ height="500"
29
+ border=""
30
+ row-key="columnId"
31
+ stripe=""
32
+ :tree-props="{ children: 'children' }"
33
+ :default-expand-all="shouldExpandAllTable"
34
+ >
35
+ <el-table-column label="" width="80" fixed="left">
36
+ <template #default="scope">
37
+ <span>{{ scope.$index + 1 }}</span>
38
+ </template>
39
+ </el-table-column>
40
+ <el-table-column label="" width="35" fixed="left"
41
+ ><i class="el-icon-s-operation drag-option"></i>
42
+ </el-table-column>
43
+ <el-table-column
44
+ :label="i18nt('designer.setting.columnLabel')"
45
+ width="150"
46
+ prop="label"
47
+ fixed="left"
48
+ >
49
+ <template #default="scope">
50
+ <el-input
51
+ v-model="scope.row.label"
52
+ @change="changeRowLabel(scope.row)"
53
+ ></el-input>
54
+ </template>
55
+ </el-table-column>
56
+ <el-table-column
57
+ :label="i18nt('designer.setting.columnName')"
58
+ width="150"
59
+ prop="prop"
60
+ >
61
+ <template #default="scope">
62
+ <el-input
63
+ v-model="scope.row.prop"
64
+ @change="changeRowProp(scope.row)"
65
+ :disabled="'editAttachment' == scope.row.formatS"
66
+ ></el-input>
67
+ </template>
68
+ </el-table-column>
69
+ <el-table-column
70
+ :label="i18nt('designer.setting.columnWidth')"
71
+ width="100"
72
+ prop="width"
73
+ >
74
+ <template #default="scope">
75
+ <el-input v-model="scope.row.width"></el-input>
76
+ </template>
77
+ </el-table-column>
78
+
79
+ <el-table-column :label="i18nt('必填')" width="70" prop="required">
80
+ <template #default="scope">
81
+ <el-switch
82
+ v-model="scope.row.required"
83
+ @change="changeRowRequired(scope.row)"
84
+ ></el-switch>
85
+ </template>
86
+ </el-table-column>
87
+ <el-table-column
88
+ :label="i18nt('designer.setting.fixedColumn')"
89
+ width="100"
90
+ prop="fixed"
91
+ >
92
+ <template #default="scope">
93
+ <el-select v-model="scope.row.fixed" clearable>
94
+ <el-option value="left">left</el-option>
95
+ <el-option value="right">right</el-option>
96
+ </el-select>
97
+ </template>
98
+ </el-table-column>
99
+ <el-table-column
100
+ :label="i18nt('designer.setting.formatOfColumn')"
101
+ width="200"
102
+ prop="formatS"
103
+ >
104
+ <template #default="scope">
105
+ <el-select
106
+ v-model="scope.row.formatS"
107
+ @change="changeFormatS(scope.row, false)"
108
+ clearable
109
+ >
110
+ <el-option-group
111
+ :label="i18nt('designer.setting.customRenderGroup')"
112
+ >
113
+ <el-option value="render" label="render"></el-option>
114
+ </el-option-group>
115
+ <el-option-group v-for="t in op" :key="t.label" :label="t.label">
116
+ <el-option
117
+ v-for="e in t.options"
118
+ :key="e.value"
119
+ :value="e.value"
120
+ :label="e.label"
121
+ ></el-option>
122
+ </el-option-group>
123
+ </el-select>
124
+ </template>
125
+ </el-table-column>
126
+ <el-table-column label="格式化配置" width="90" align="center">
127
+ <template #default="scope">
128
+ <el-button
129
+ size="mini"
130
+ plain=""
131
+ round=""
132
+ icon="el-icon-edit"
133
+ @click="openFormatConfigDialog(scope.row, scope.$index)"
134
+ :disabled="
135
+ !columnFormatMap[scope.row.formatS] &&
136
+ 'widgetRender' !== scope.row.formatS &&
137
+ 'editTreeButtonGroup' !== scope.row.formatS
138
+ "
139
+ ></el-button>
140
+ </template>
141
+ </el-table-column>
142
+ <el-table-column
143
+ :label="i18nt('designer.setting.renderFunction')"
144
+ width="70"
145
+ align="center"
146
+ >
147
+ <template #default="scope">
148
+ <el-button
149
+ :disabled="'render' !== scope.row.formatS"
150
+ size="mini"
151
+ plain=""
152
+ round=""
153
+ icon="el-icon-edit"
154
+ @click="showRenderDialog(scope.row)"
155
+ ></el-button>
156
+ </template>
157
+ </el-table-column>
158
+ <el-table-column
159
+ :label="i18nt('designer.setting.visibleColumn')"
160
+ width="70"
161
+ prop="show"
162
+ >
163
+ <template #default="scope">
164
+ <el-switch v-model="scope.row.show"></el-switch>
165
+ </template>
166
+ </el-table-column>
167
+ <el-table-column
168
+ :label="i18nt('designer.setting.sortableColumn')"
169
+ width="70"
170
+ prop="sortable"
171
+ >
172
+ <template #default="scope">
173
+ <el-switch v-model="scope.row.sortable"></el-switch>
174
+ </template>
175
+ </el-table-column>
176
+ <el-table-column label="显示筛选" width="70" prop="filterable">
177
+ <template #default="scope">
178
+ <el-switch v-model="scope.row.filterable"></el-switch>
179
+ </template>
180
+ </el-table-column>
181
+ <el-table-column label="UTC时差转换" width="90" align="center">
182
+ <template #default="scope">
183
+ <el-switch
184
+ v-if="isUtcTransformColumn(scope.row)"
185
+ v-model="scope.row.utcTransformEnabled"
186
+ ></el-switch>
187
+ </template>
188
+ </el-table-column>
189
+ <el-table-column
190
+ label="编辑更多属性"
191
+ width="100"
192
+ align="center"
193
+ fixed="right"
194
+ >
195
+ <template #default="scope">
196
+ <el-button
197
+ size="mini"
198
+ plain=""
199
+ round=""
200
+ icon="el-icon-edit"
201
+ @click="openRowEditDialog(scope.row, scope.$index)"
202
+ ></el-button>
203
+ </template>
204
+ </el-table-column>
205
+ <el-table-column label="操作" width="150" fixed="right">
206
+ <template slot="header">
207
+ <el-tooltip
208
+ :hide-after="500"
209
+ class="item"
210
+ effect="dark"
211
+ content="添加根节点"
212
+ placement="top"
213
+ >
214
+ <el-button
215
+ size="mini"
216
+ type=""
217
+ circle=""
218
+ icon="el-icon-plus"
219
+ @click="onAddRoot"
220
+ />
221
+ </el-tooltip>
222
+ </template>
223
+ <template #default="{ row, $index }">
224
+ <el-tooltip
225
+ :hide-after="hideAfter"
226
+ :open-delay="openDelay"
227
+ effect="dark"
228
+ content="添加兄弟节点"
229
+ placement="top"
230
+ >
231
+ <el-button
232
+ size="mini"
233
+ type=""
234
+ circle=""
235
+ icon="el-icon-plus"
236
+ @click="onAddSibling(row, $index)"
237
+ />
238
+ </el-tooltip>
239
+
240
+ <el-tooltip
241
+ :hide-after="hideAfter"
242
+ :open-delay="openDelay"
243
+ effect="dark"
244
+ content="添加子节点"
245
+ placement="top"
246
+ >
247
+ <el-button
248
+ size="mini"
249
+ type=""
250
+ circle=""
251
+ icon="el-icon-circle-plus-outline"
252
+ @click="onAddChild(row, $index)"
253
+ />
254
+ </el-tooltip>
255
+ <el-tooltip
256
+ :hide-after="hideAfter"
257
+ :open-delay="openDelay"
258
+ effect="dark"
259
+ content="删除"
260
+ placement="top"
261
+ >
262
+ <el-button
263
+ size="mini"
264
+ type=""
265
+ circle=""
266
+ icon="el-icon-delete"
267
+ @click="onDelete(row, $index)"
268
+ />
269
+ </el-tooltip>
270
+ </template>
271
+ </el-table-column>
272
+ </el-table>
273
+ <columnRenderDialog
274
+ :column="currentTableColumn"
275
+ :sourceData="sourceData"
276
+ v-if="showColumnRenderDialog"
277
+ :visiable.sync="showColumnRenderDialog"
278
+ @confirm="confirmWidgetRenderDialog"
279
+ ></columnRenderDialog>
280
+ <editTreeButtonGroupConfigDialog
281
+ v-if="showEditTreeButtonGroupConfigDialog && editTreeButtonGroupRowData"
282
+ :visible.sync="showEditTreeButtonGroupConfigDialog"
283
+ :row="editTreeButtonGroupRowData"
284
+ @confirm="confirmEditTreeButtonGroupConfig"
285
+ />
286
+ </div>
287
+ <div class="dialog-footer" slot="footer">
288
+ <el-button @click="closeHandle" class="button-sty" icon="el-icon-close">
289
+ {{ i18nt("designer.hint.cancel") }}
290
+ </el-button>
291
+ <el-button
292
+ type="primary"
293
+ @click="colSubmit"
294
+ class="button-sty"
295
+ icon="el-icon-check"
296
+ >
297
+ {{ i18nt("designer.hint.confirm") }}
298
+ </el-button>
299
+ </div>
300
+ <el-dialog
301
+ v-if="showRenderDialogFlag"
302
+ :title="i18nt('designer.setting.renderFunction')"
303
+ :visible.sync="showRenderDialogFlag"
304
+ :modal="false"
305
+ :show-close="!0"
306
+ custom-class="dialog-style list-dialog"
307
+ :close-on-click-modal="!1"
308
+ :close-on-press-escape="!1"
309
+ :destroy-on-close="!0"
310
+ v-dialog-drag
311
+ top="7vh"
312
+ :append-to-body="true"
313
+ >
314
+ <el-alert
315
+ type="info"
316
+ :closable="!1"
317
+ title="function customRender(params,h) {"
318
+ />
319
+ <code-editor
320
+ ref="dsResultEditor"
321
+ mode="javascript"
322
+ :readonly="!1"
323
+ v-model="renderJson"
324
+ ></code-editor>
325
+ <el-alert type="info" :closable="!1" title="}" />
326
+ <div class="dialog-footer" slot="footer">
327
+ <el-button
328
+ @click="showRenderDialogFlag = !1"
329
+ class="button-sty"
330
+ icon="el-icon-close"
331
+ >
332
+ {{ i18nt("designer.hint.cancel") }}
333
+ </el-button>
334
+ <el-button
335
+ type="primary"
336
+ @click="saveColumnRender"
337
+ class="button-sty"
338
+ icon="el-icon-check"
339
+ >
340
+ {{ i18nt("designer.hint.confirm") }}
341
+ </el-button>
342
+ </div>
343
+ </el-dialog>
344
+ <el-dialog
345
+ :title="tableColumnConfigTitle"
346
+ :visible.sync="showTableColumnConfigDialog"
347
+ v-if="showTableColumnConfigDialog"
348
+ :show-close="true"
349
+ custom-class="dialog-style list-dialog"
350
+ v-dialog-drag
351
+ :close-on-click-modal="false"
352
+ :close-on-press-escape="false"
353
+ :destroy-on-close="true"
354
+ :append-to-body="true"
355
+ :modal-append-to-body="true"
356
+ top="5vh"
357
+ >
358
+ <div class="cont">
359
+ <el-alert
360
+ type="info"
361
+ :closable="false"
362
+ :title="tableColumnConfigHeader"
363
+ ></el-alert>
364
+ <code-editor
365
+ :mode="'javascript'"
366
+ :readonly="false"
367
+ v-model="tableColumnConfigCode"
368
+ ref="ecEditor"
369
+ ></code-editor>
370
+ <el-alert type="info" :closable="false" title="}"></el-alert>
371
+ </div>
372
+ <div slot="footer" class="dialog-footer">
373
+ <el-button
374
+ @click="showTableColumnConfigDialog = false"
375
+ class="button-sty"
376
+ icon="el-icon-close"
377
+ >
378
+ {{ i18nt("designer.hint.cancel") }}
379
+ </el-button>
380
+ <el-button
381
+ type="primary"
382
+ @click="saveTableColumnConfigDialog"
383
+ class="button-sty"
384
+ icon="el-icon-check"
385
+ >
386
+ {{ i18nt("designer.hint.confirm") }}
387
+ </el-button>
388
+ </div>
389
+ </el-dialog>
390
+ <el-dialog
391
+ :title="i18nt('designer.setting.editFormEventHandler')"
392
+ :visible.sync="showFormEventDialogFlag"
393
+ v-if="showFormEventDialogFlag"
394
+ :show-close="true"
395
+ custom-class="dialog-style list-dialog"
396
+ v-dialog-drag
397
+ :close-on-click-modal="false"
398
+ :close-on-press-escape="false"
399
+ :destroy-on-close="true"
400
+ :append-to-body="true"
401
+ :modal-append-to-body="true"
402
+ top="5vh"
403
+ >
404
+ <div class="cont">
405
+ <el-alert
406
+ type="info"
407
+ :closable="false"
408
+ :title="'form.' + eventParamsMap[curEventName]"
409
+ ></el-alert>
410
+ <code-editor
411
+ :mode="'javascript'"
412
+ :readonly="false"
413
+ v-model="formEventHandlerCode"
414
+ ref="ecEditor"
415
+ ></code-editor>
416
+ <el-alert type="info" :closable="false" title="}"></el-alert>
417
+ </div>
418
+ <div slot="footer" class="dialog-footer">
419
+ <el-button
420
+ @click="showFormEventDialogFlag = false"
421
+ class="button-sty"
422
+ icon="el-icon-close"
423
+ >
424
+ {{ i18nt("designer.hint.cancel") }}
425
+ </el-button>
426
+ <el-button
427
+ type="primary"
428
+ @click="saveFormEventHandler"
429
+ class="button-sty"
430
+ icon="el-icon-check"
431
+ >
432
+ {{ i18nt("designer.hint.confirm") }}
433
+ </el-button>
434
+ </div>
435
+ </el-dialog>
436
+
437
+ <el-dialog
438
+ custom-class="dialog-style list-dialog table-column-row-edit-dialog"
439
+ :title="i18nt('designer.setting.tableColEdit')"
440
+ :visible.sync="showRowEditDialog"
441
+ v-if="showRowEditDialog"
442
+ :modal="false"
443
+ :show-close="!0"
444
+ :close-on-click-modal="!1"
445
+ :close-on-press-escape="!1"
446
+ :destroy-on-close="!0"
447
+ :append-to-body="true"
448
+ :modal-append-to-body="true"
449
+ top="5vh"
450
+ width="480px"
451
+ v-dialog-drag
452
+ >
453
+ <div class="cont table-column-row-edit-cont">
454
+ <el-form :model="rowData" class="form-m2" label-position="top">
455
+ <el-form-item :label="i18nt('designer.setting.columnLabel')">
456
+ <el-input
457
+ v-model="rowData.label"
458
+ @change="changeRowLabel(rowData)"
459
+ ></el-input>
460
+ </el-form-item>
461
+ <el-form-item :label="i18nt('designer.setting.columnName')">
462
+ <el-input
463
+ v-model="rowData.prop"
464
+ @change="changeRowProp(rowData)"
465
+ :disabled="'editAttachment' == rowData.formatS"
466
+ ></el-input>
467
+ </el-form-item>
468
+ <el-form-item :label="i18nt('designer.setting.columnWidth')">
469
+ <el-input v-model="rowData.width"></el-input>
470
+ </el-form-item>
471
+ <el-form-item :label="i18nt('必填')">
472
+ <el-switch
473
+ v-model="rowData.required"
474
+ @change="changeRowRequired(rowData)"
475
+ ></el-switch>
476
+ </el-form-item>
477
+ <el-form-item :label="i18nt('designer.setting.fixedColumn')">
478
+ <el-select v-model="rowData.fixed" clearable>
479
+ <el-option value="left">left</el-option>
480
+ <el-option value="right">right</el-option>
481
+ </el-select>
482
+ </el-form-item>
483
+ <el-form-item :label="i18nt('designer.setting.formatOfColumn')">
484
+ <el-select
485
+ v-model="rowData.formatS"
486
+ @change="changeFormatS(rowData, false)"
487
+ clearable
488
+ >
489
+ <el-option-group
490
+ :label="i18nt('designer.setting.customRenderGroup')"
491
+ >
492
+ <el-option value="render" label="render"></el-option>
493
+ </el-option-group>
494
+ <el-option-group v-for="t in op" :key="t.label" :label="t.label">
495
+ <el-option
496
+ v-for="e in t.options"
497
+ :key="e.value"
498
+ :value="e.value"
499
+ :label="e.label"
500
+ ></el-option>
501
+ </el-option-group>
502
+ </el-select>
503
+ </el-form-item>
504
+ <el-form-item label="格式化配置">
505
+ <el-button
506
+ size="mini"
507
+ plain=""
508
+ round=""
509
+ icon="el-icon-edit"
510
+ @click="openFormatConfigDialog(rowData, rowDataIndex)"
511
+ :disabled="
512
+ !columnFormatMap[rowData.formatS] &&
513
+ 'widgetRender' !== rowData.formatS &&
514
+ 'editTreeButtonGroup' !== rowData.formatS
515
+ "
516
+ ></el-button>
517
+ </el-form-item>
518
+ <el-form-item :label="i18nt('designer.setting.renderFunction')">
519
+ <el-button
520
+ :disabled="'render' !== rowData.formatS"
521
+ size="mini"
522
+ plain=""
523
+ round=""
524
+ icon="el-icon-edit"
525
+ @click="showRenderDialog(rowData)"
526
+ ></el-button>
527
+ </el-form-item>
528
+ <el-form-item
529
+ v-if="isUtcTransformColumn(rowData)"
530
+ label="UTC时差转换"
531
+ >
532
+ <el-switch v-model="rowData.utcTransformEnabled"></el-switch>
533
+ </el-form-item>
534
+ <el-form-item :label="i18nt('designer.setting.visibleColumn')">
535
+ <el-switch v-model="rowData.show"></el-switch>
536
+ </el-form-item>
537
+ <el-form-item label="动态显示脚本">
538
+ <a
539
+ href="javascript:void(0);"
540
+ class="a-link link-oneLind"
541
+ @click="openColumnShowDialog(rowData)"
542
+ >
543
+ <span>{{ rowData.columnShow }}</span>
544
+ <i class="el-icon-edit"></i>
545
+ </a>
546
+ </el-form-item>
547
+ <el-form-item :label="i18nt('designer.setting.sortableColumn')">
548
+ <el-switch v-model="rowData.sortable"></el-switch>
549
+ </el-form-item>
550
+ <el-form-item label="显示筛选">
551
+ <el-switch v-model="rowData.filterable"></el-switch>
552
+ </el-form-item>
553
+ <el-form-item :label="i18nt('明细行')">
554
+ <el-switch v-model="rowData.isItemLine"></el-switch>
555
+ </el-form-item>
556
+
557
+ <el-form-item :label="i18nt('下拉列')">
558
+ <el-switch v-model="rowData.treeNode"></el-switch>
559
+ </el-form-item>
560
+ <el-form-item :label="i18nt('自定义表格列配置')">
561
+ <a
562
+ href="javascript:void(0);"
563
+ class="a-link link-oneLind"
564
+ @click="openTableColumnConfigDialog(rowData, rowDataIndex)"
565
+ >
566
+ <span>{{ rowData.tableColumnConfig }}</span>
567
+ <i class="el-icon-edit"></i>
568
+ </a>
569
+ </el-form-item>
570
+ <el-form-item :label="i18nt('编辑插槽类型')">
571
+ <el-select
572
+ v-model="rowData.editFormatS"
573
+ @change="changeFormatS(rowData, true)"
574
+ clearable
575
+ >
576
+ <el-option
577
+ v-for="e in editOp"
578
+ :key="e.value"
579
+ :value="e.value"
580
+ :label="e.label"
581
+ ></el-option>
582
+ </el-select>
583
+ </el-form-item>
584
+ <el-form-item label="编辑插槽配置">
585
+ <el-button
586
+ size="mini"
587
+ plain=""
588
+ round=""
589
+ icon="el-icon-edit"
590
+ @click="openEditFormatConfigDialog(rowData, rowDataIndex)"
591
+ :disabled="!rowData.editFormatS"
592
+ ></el-button>
593
+ </el-form-item>
594
+ <el-form-item :label="i18nt('导出类型')">
595
+ <el-select v-model="rowData.exportType" clearable>
596
+ <el-option value="Image2" label="图片"></el-option>
597
+ <el-option value="Number" label="数值"></el-option>
598
+ </el-select>
599
+ </el-form-item>
600
+ <el-form-item :label="i18nt('表尾统计行类型')">
601
+ <el-select v-model="rowData.footerDataType" clearable>
602
+ <el-option value="1" label="合计"></el-option>
603
+ <el-option value="2" label="平均"></el-option>
604
+ <el-option value="3" label="自定义"></el-option>
605
+ </el-select>
606
+ </el-form-item>
607
+ <el-form-item label="表尾统计行配置">
608
+ <el-button
609
+ size="mini"
610
+ plain=""
611
+ round=""
612
+ icon="el-icon-edit"
613
+ @click="
614
+ editFormEventHandler(rowData, rowDataIndex, 'footerMethodConfg')
615
+ "
616
+ :disabled="rowData.footerDataType !== '3'"
617
+ ></el-button>
618
+ </el-form-item>
619
+ <el-form-item :label="i18nt('显示名称颜色')">
620
+ <el-select v-model="rowData.labelColor" clearable>
621
+ <el-option value="#e6a23c" label="橙"></el-option>
622
+ <el-option value="#2a6494" label="蓝"></el-option>
623
+ <el-option value="#30b08f" label="绿"></el-option>
624
+ <el-option value="#909399" label="灰"></el-option>
625
+ <el-option value="#ea5353" label="红"></el-option>
626
+ </el-select>
627
+ </el-form-item>
628
+ <el-form-item label-width="0" class="form-item-full">
629
+ <el-divider class="custom-divider">{{
630
+ i18nt("designer.setting.customLabelIcon")
631
+ }}</el-divider>
632
+ </el-form-item>
633
+ <el-form-item :label="i18nt('designer.setting.labelIconClass')">
634
+ <icon-picker v-model="rowData.labelIconClass"></icon-picker>
635
+ </el-form-item>
636
+ <el-form-item :label="i18nt('designer.setting.labelIconPosition')">
637
+ <el-select
638
+ v-model="rowData.labelIconPosition"
639
+ clearable
640
+ placeholder="默认后面"
641
+ >
642
+ <el-option label="前面" value="front"></el-option>
643
+ <el-option label="后面" value="rear"></el-option>
644
+ </el-select>
645
+ </el-form-item>
646
+ <el-form-item
647
+ :label="i18nt('designer.setting.labelTooltip')"
648
+ class="form-item-full"
649
+ >
650
+ <a
651
+ href="javascript:void(0);"
652
+ class="a-link link-oneLind"
653
+ @click="openLabelTooltipDialog"
654
+ >
655
+ <span>{{ rowData.labelTooltip }}</span>
656
+ <i class="el-icon-edit"></i>
657
+ </a>
658
+ </el-form-item>
659
+ </el-form>
660
+ </div>
661
+ <el-dialog
662
+ v-if="labelTooltipDialogVisible"
663
+ custom-class="dialog-style"
664
+ :title="i18nt('designer.setting.labelTooltip')"
665
+ :visible.sync="labelTooltipDialogVisible"
666
+ :show-close="true"
667
+ :append-to-body="true"
668
+ :modal="false"
669
+ :close-on-click-modal="false"
670
+ :close-on-press-escape="false"
671
+ :destroy-on-close="true"
672
+ width="520px"
673
+ v-dialog-drag
674
+ >
675
+ <el-input
676
+ type="textarea"
677
+ :rows="14"
678
+ class="label-tooltip-textarea"
679
+ v-model="labelTooltipValue"
680
+ clearable
681
+ ></el-input>
682
+ <div class="dialog-footer" slot="footer">
683
+ <el-button
684
+ @click="labelTooltipDialogVisible = false"
685
+ class="button-sty"
686
+ icon="el-icon-close"
687
+ >
688
+ {{ i18nt("designer.hint.cancel") }}
689
+ </el-button>
690
+ <el-button
691
+ type="primary"
692
+ @click="submitLabelTooltipDialog"
693
+ class="button-sty"
694
+ icon="el-icon-check"
695
+ >
696
+ {{ i18nt("designer.hint.confirm") }}
697
+ </el-button>
698
+ </div>
699
+ </el-dialog>
700
+ <div class="dialog-footer" slot="footer">
701
+ <el-button
702
+ @click="closeRowEditDialog"
703
+ class="button-sty"
704
+ icon="el-icon-close"
705
+ >
706
+ {{ i18nt("designer.hint.cancel") }}
707
+ </el-button>
708
+ <el-button
709
+ type="primary"
710
+ @click="submitRowEditDialog"
711
+ class="button-sty"
712
+ icon="el-icon-check"
713
+ >
714
+ {{ i18nt("designer.hint.confirm") }}
715
+ </el-button>
716
+ </div>
717
+ </el-dialog>
718
+ </el-dialog>
719
+ </template>
720
+ <script>
721
+ import i18n from "../../../../../../components/xform/utils/i18n";
722
+ import Sortable from "sortablejs";
723
+ import {
724
+ generateId,
725
+ loopHandleWidget,
726
+ deepClone,
727
+ columnFormatMap,
728
+ } from "../../../../../../components/xform/utils/util";
729
+ import columnRenderDialog from "./columnRenderDialog.vue";
730
+ import editTreeButtonGroupConfigDialog from "./edit-tree-button-group-config-dialog.vue";
731
+ import IconPicker from "@base/components/xform/icon-picker/index.vue";
732
+
733
+ let businessOptions = [
734
+ {
735
+ value: "_createBy",
736
+ label: "创建人",
737
+ },
738
+ {
739
+ value: "_modifyBy",
740
+ label: "更新人",
741
+ },
742
+ {
743
+ value: "create_date",
744
+ label: "创建时间",
745
+ },
746
+ {
747
+ value: "modify_date",
748
+ label: "更新时间",
749
+ },
750
+ ];
751
+ let userFields = ["_createBy", "_modifyBy", "create_date", "modify_date"];
752
+
753
+ export default {
754
+ mixins: [i18n],
755
+ props: {
756
+ designer: Object,
757
+ selectedWidget: Object,
758
+ optionModel: Object,
759
+ visiable: {
760
+ type: Boolean,
761
+ default: false,
762
+ },
763
+ },
764
+ components: {
765
+ columnRenderDialog,
766
+ editTreeButtonGroupConfigDialog,
767
+ IconPicker,
768
+ },
769
+ inject: ["openWidgetPropertyDialog"],
770
+ data() {
771
+ return {
772
+ tableReady: false,
773
+ tableColumnConfigTitle: null,
774
+ showTableColumnConfigDialog: false,
775
+ tableColumnConfigHeader: null,
776
+ tableColumnConfigCode: null,
777
+ showEditTreeButtonGroupConfigDialog: false,
778
+ currentEditTreeButtonGroupRow: null,
779
+ editTreeButtonGroupRowData: null,
780
+ alignOptions: [
781
+ {
782
+ value: "left",
783
+ label: "left",
784
+ },
785
+ {
786
+ value: "center",
787
+ label: "center",
788
+ },
789
+ {
790
+ value: "right",
791
+ label: "right",
792
+ },
793
+ ],
794
+ businessOptions,
795
+ userFields,
796
+ op: [
797
+ {
798
+ label: "edit Format",
799
+ options: [
800
+ {
801
+ value: "editInput",
802
+ label: "文本输入框",
803
+ },
804
+ {
805
+ value: "editNumber",
806
+ label: "数字输入框",
807
+ },
808
+ {
809
+ value: "editDate",
810
+ label: "日期输入框",
811
+ },
812
+ {
813
+ value: "textarea",
814
+ label: "多行文本输入框",
815
+ },
816
+ {
817
+ value: "editScriptInput",
818
+ label: "脚本输入框",
819
+ },
820
+ {
821
+ value: "editSelect",
822
+ label: "下拉框",
823
+ },
824
+ {
825
+ value: "checkbox",
826
+ label: "复选框",
827
+ },
828
+ {
829
+ value: "radio",
830
+ label: "单选框",
831
+ },
832
+ {
833
+ value: "editAttachment",
834
+ label: "附件",
835
+ },
836
+ {
837
+ value: "editSearch",
838
+ label: "搜索框",
839
+ },
840
+ {
841
+ value: "editStatus",
842
+ label: "状态",
843
+ },
844
+ {
845
+ value: "text",
846
+ label: "文本",
847
+ },
848
+ {
849
+ value: "aText",
850
+ label: "超链接文本",
851
+ },
852
+ {
853
+ value: "widgetRender",
854
+ label: "自定义组件",
855
+ },
856
+ ],
857
+ },
858
+ {
859
+ label: "按钮控件",
860
+ options: [
861
+ {
862
+ value: "dropdown",
863
+ label: "下拉按钮",
864
+ },
865
+ {
866
+ value: "editDelete",
867
+ label: "删除按钮",
868
+ },
869
+ {
870
+ value: "editButton",
871
+ label: "查看按钮",
872
+ },
873
+ {
874
+ value: "aLink",
875
+ label: "超链接按钮",
876
+ },
877
+ {
878
+ value: "button",
879
+ label: "按钮",
880
+ },
881
+ {
882
+ value: "editTreeButtonGroup",
883
+ label: "编辑行按钮组",
884
+ },
885
+ ],
886
+ },
887
+ {
888
+ label: "树控件",
889
+ options: [
890
+ {
891
+ value: "addSiblingEditRow",
892
+ label: "新增兄弟节点",
893
+ },
894
+ {
895
+ value: "addChildTreeRow",
896
+ label: "新增子节点",
897
+ },
898
+ {
899
+ value: "moveUpRow",
900
+ label: "上移",
901
+ },
902
+ {
903
+ value: "moveDownRow",
904
+ label: "下移",
905
+ },
906
+ {
907
+ value: "removeTreeRow",
908
+ label: "删除树节点",
909
+ },
910
+ ],
911
+ },
912
+
913
+ {
914
+ label: "业务模块",
915
+ options: businessOptions,
916
+ },
917
+ {
918
+ label: "日期格式化",
919
+ options: [
920
+ {
921
+ value: "d1",
922
+ label: "yyyy-MM-dd",
923
+ },
924
+ {
925
+ value: "d2",
926
+ label: "yyyy/MM/dd",
927
+ },
928
+ {
929
+ value: "d3",
930
+ label: "yyyy年MM月dd日",
931
+ },
932
+ {
933
+ value: "d4",
934
+ label: "yyyy-MM-dd HH:mm:ss",
935
+ },
936
+ {
937
+ value: "d5",
938
+ label: "yyyy-MM-dd hh:mm:ss",
939
+ },
940
+ ],
941
+ },
942
+ {
943
+ label: "数字格式化",
944
+ options: [
945
+ {
946
+ value: "n1",
947
+ label: "###,###,###,##0.######",
948
+ },
949
+ {
950
+ value: "n2",
951
+ label: "###,###,###,##0.00####",
952
+ },
953
+ {
954
+ value: "n3",
955
+ label: "###,###,###,##0.000000",
956
+ },
957
+ {
958
+ value: "n4",
959
+ label: "###,###,###,##0.000",
960
+ },
961
+ {
962
+ value: "n5",
963
+ label: "###,###,###,##0.00",
964
+ },
965
+ {
966
+ value: "n6",
967
+ label: "###,###,###,##0",
968
+ },
969
+ {
970
+ value: "n7",
971
+ label: "###,##0.00##%",
972
+ },
973
+ ],
974
+ },
975
+ ],
976
+ editOp: [
977
+ {
978
+ value: "editInput",
979
+ label: "文本输入框",
980
+ },
981
+ {
982
+ value: "textarea",
983
+ label: "多行文本输入框",
984
+ },
985
+ {
986
+ value: "editNumber",
987
+ label: "数字输入框",
988
+ },
989
+ {
990
+ value: "editDate",
991
+ label: "日期输入框",
992
+ },
993
+ {
994
+ value: "editSelect",
995
+ label: "下拉框",
996
+ },
997
+ {
998
+ value: "editAttachment",
999
+ label: "附件",
1000
+ },
1001
+ {
1002
+ value: "editSearch",
1003
+ label: "搜索框",
1004
+ },
1005
+ ],
1006
+ showRenderDialogFlag: !1,
1007
+ renderJson: "",
1008
+ currentTableColumn: null,
1009
+ sourceData: null,
1010
+
1011
+ hideAfter: 1500,
1012
+ openDelay: 500,
1013
+ tableData: [], //树形结构数据转的数组
1014
+ tableDataArray: [],
1015
+ dragSort: null,
1016
+ columnFormatMap,
1017
+
1018
+ showFormEventDialogFlag: false,
1019
+ formEventHandlerCode: "",
1020
+ curEventName: "",
1021
+ curEventRow: null,
1022
+
1023
+ eventParamsMap: {
1024
+ footerMethodConfg: "footerMethodConfg(dataId,formCode,param) {",
1025
+ columnShow: "columnShow(dataId,formCode,columnConfig) {",
1026
+ },
1027
+
1028
+ showColumnRenderDialog: false,
1029
+
1030
+ editRowData: null,
1031
+ rowData: null,
1032
+ rowDataIndex: 0,
1033
+ showRowEditDialog: false,
1034
+ labelTooltipDialogVisible: false,
1035
+ labelTooltipValue: "",
1036
+ sourceTableColumnsSnapshot: null,
1037
+ };
1038
+ },
1039
+ beforeDestroy() {
1040
+ if (this.dragSort) this.dragSort.destroy();
1041
+ },
1042
+ computed: {
1043
+ showDialog: {
1044
+ get() {
1045
+ return this.visiable;
1046
+ },
1047
+ set(val) {
1048
+ this.$emit("update:visiable", val);
1049
+ },
1050
+ },
1051
+ shouldExpandAllTable() {
1052
+ return this.countTreeRows(this.tableData) <= 30;
1053
+ },
1054
+ },
1055
+ watch: {
1056
+ visiable(val) {
1057
+ if (val) {
1058
+ this.onDialogOpen();
1059
+ } else {
1060
+ this.onDialogClose();
1061
+ }
1062
+ },
1063
+ },
1064
+ created() {},
1065
+ mounted() {
1066
+ if (this.visiable) {
1067
+ this.onDialogOpen();
1068
+ }
1069
+ },
1070
+ methods: {
1071
+ countTreeRows(rows) {
1072
+ if (!Array.isArray(rows) || !rows.length) {
1073
+ return 0;
1074
+ }
1075
+ let count = 0;
1076
+ const walk = (list) => {
1077
+ list.forEach((item) => {
1078
+ count += 1;
1079
+ if (item.children && item.children.length) {
1080
+ walk(item.children);
1081
+ }
1082
+ });
1083
+ };
1084
+ walk(rows);
1085
+ return count;
1086
+ },
1087
+ cloneTableColumnsForEdit(columns) {
1088
+ if (!Array.isArray(columns)) {
1089
+ return [];
1090
+ }
1091
+ const refKeys = ["widget", "editWidget", "widgetList"];
1092
+ const cloneRow = (row) => {
1093
+ if (!row || typeof row !== "object") {
1094
+ return row;
1095
+ }
1096
+ const cloned = {};
1097
+ Object.keys(row).forEach((key) => {
1098
+ const val = row[key];
1099
+ if (key === "children" && Array.isArray(val) && val.length) {
1100
+ cloned.children = val.map(cloneRow);
1101
+ return;
1102
+ }
1103
+ if (refKeys.includes(key)) {
1104
+ cloned[key] = val;
1105
+ return;
1106
+ }
1107
+ if (key === "columnOption") {
1108
+ if (!row.widget) {
1109
+ cloned.columnOption =
1110
+ val !== null && typeof val === "object" ? deepClone(val) : val;
1111
+ }
1112
+ return;
1113
+ }
1114
+ if (key === "editColumnOption") {
1115
+ if (!row.editWidget) {
1116
+ cloned.editColumnOption =
1117
+ val !== null && typeof val === "object" ? deepClone(val) : val;
1118
+ }
1119
+ return;
1120
+ }
1121
+ if (val !== null && typeof val === "object") {
1122
+ try {
1123
+ cloned[key] = deepClone(val);
1124
+ } catch (e) {
1125
+ cloned[key] = val;
1126
+ }
1127
+ return;
1128
+ }
1129
+ cloned[key] = val;
1130
+ });
1131
+ if (row.widget && !cloned.widget) {
1132
+ cloned.widget = row.widget;
1133
+ }
1134
+ if (row.editWidget && !cloned.editWidget) {
1135
+ cloned.editWidget = row.editWidget;
1136
+ }
1137
+ return cloned;
1138
+ };
1139
+ return columns.map(cloneRow);
1140
+ },
1141
+ buildColumnWidgetMap(columns, map = {}) {
1142
+ if (!Array.isArray(columns)) {
1143
+ return map;
1144
+ }
1145
+ columns.forEach((col) => {
1146
+ if (col && col.columnId) {
1147
+ map[col.columnId] = col;
1148
+ }
1149
+ if (col.children && col.children.length) {
1150
+ this.buildColumnWidgetMap(col.children, map);
1151
+ }
1152
+ });
1153
+ return map;
1154
+ },
1155
+ restoreColumnWidgetRefs(columns, widgetMap) {
1156
+ if (!Array.isArray(columns)) {
1157
+ return [];
1158
+ }
1159
+ return columns.map((row) => {
1160
+ const next = Object.assign({}, row);
1161
+ const orig = widgetMap[next.columnId];
1162
+ if (orig) {
1163
+ // 仅 formatS 未变更时补回 widget,避免清空 formatS 后又被快照还原
1164
+ const formatUnchanged = next.formatS === orig.formatS;
1165
+ const editFormatUnchanged = next.editFormatS === orig.editFormatS;
1166
+ if (formatUnchanged && !next.widget && orig.widget) {
1167
+ next.widget = orig.widget;
1168
+ }
1169
+ if (editFormatUnchanged && !next.editWidget && orig.editWidget) {
1170
+ next.editWidget = orig.editWidget;
1171
+ }
1172
+ if (
1173
+ formatUnchanged &&
1174
+ next.formatS === "widgetRender" &&
1175
+ (!next.widgetList || !next.widgetList.length) &&
1176
+ orig.widgetList &&
1177
+ orig.widgetList.length
1178
+ ) {
1179
+ next.widgetList = orig.widgetList;
1180
+ }
1181
+ }
1182
+ if (next.children && next.children.length) {
1183
+ next.children = this.restoreColumnWidgetRefs(
1184
+ next.children,
1185
+ widgetMap
1186
+ );
1187
+ }
1188
+ return next;
1189
+ });
1190
+ },
1191
+ editFormEventHandler(row, index, eventName) {
1192
+ this.curEventRow = row;
1193
+ this.curEventName = eventName;
1194
+ this.curEventIndex = index;
1195
+ this.formEventHandlerCode = row[eventName];
1196
+ this.showFormEventDialogFlag = true;
1197
+ },
1198
+
1199
+ saveFormEventHandler() {
1200
+ const codeHints = this.$refs.ecEditor.getEditorAnnotations();
1201
+ let syntaxErrorFlag = false;
1202
+ if (!!codeHints && codeHints.length > 0) {
1203
+ codeHints.forEach((chItem) => {
1204
+ if (chItem.type === "error") {
1205
+ syntaxErrorFlag = true;
1206
+ }
1207
+ });
1208
+
1209
+ if (syntaxErrorFlag) {
1210
+ this.$message.error(
1211
+ this.i18nt("designer.setting.syntaxCheckWarning")
1212
+ );
1213
+ return;
1214
+ }
1215
+ }
1216
+ this.curEventRow[this.curEventName] = this.formEventHandlerCode;
1217
+ this.showFormEventDialogFlag = false;
1218
+ },
1219
+ onDialogClose() {
1220
+ this.tableReady = false;
1221
+ this.sourceTableColumnsSnapshot = null;
1222
+ if (this.dragSort) {
1223
+ this.dragSort.destroy();
1224
+ this.dragSort = null;
1225
+ }
1226
+ },
1227
+ onDialogOpen() {
1228
+ this.tableReady = false;
1229
+ if (this.dragSort) {
1230
+ this.dragSort.destroy();
1231
+ this.dragSort = null;
1232
+ }
1233
+ this.$nextTick(() => {
1234
+ const load = () => {
1235
+ this.loadTableData();
1236
+ this.tableReady = true;
1237
+ this.$nextTick(() => {
1238
+ requestAnimationFrame(() => {
1239
+ this.rowDrop();
1240
+ });
1241
+ });
1242
+ };
1243
+ if (typeof requestIdleCallback === "function") {
1244
+ requestIdleCallback(load, { timeout: 80 });
1245
+ } else {
1246
+ setTimeout(load, 0);
1247
+ }
1248
+ });
1249
+ },
1250
+ loadTableData() {
1251
+ const source = this.optionModel.tableColumns || [];
1252
+ this.sourceTableColumnsSnapshot = source;
1253
+ this.tableData = this.cloneTableColumnsForEdit(source);
1254
+ },
1255
+ colSubmit() {
1256
+ this.dialogVisible = !1;
1257
+ const widgetMap = this.buildColumnWidgetMap(
1258
+ this.sourceTableColumnsSnapshot || []
1259
+ );
1260
+ this.optionModel.tableColumns = this.restoreColumnWidgetRefs(
1261
+ this.tableData,
1262
+ widgetMap
1263
+ );
1264
+ this.sourceTableColumnsSnapshot = null;
1265
+ this.closeHandle();
1266
+ },
1267
+ openWidgetRenderDialog(row, sourceData) {
1268
+ this.currentTableColumn = row;
1269
+ this.sourceData = sourceData;
1270
+
1271
+ // this.widgetList =
1272
+
1273
+ // this.designer.widgetList
1274
+
1275
+ this.showColumnRenderDialog = true;
1276
+ },
1277
+ confirmWidgetRenderDialog(widgetList) {
1278
+ this.currentTableColumn.widgetList = widgetList;
1279
+ this.showColumnRenderDialog = false;
1280
+ },
1281
+ showRenderDialog: function (e) {
1282
+ /*if(e.formatS == 'widgetRender'){
1283
+ this.openWidgetRenderDialog(e);
1284
+ return
1285
+ }*/
1286
+
1287
+ (this.currentTableColumn = e),
1288
+ (this.renderJson = e.render || ""),
1289
+ (this.showRenderDialogFlag = !0);
1290
+ },
1291
+ saveColumnRender: function () {
1292
+ this.$set(this.currentTableColumn, "render", this.renderJson),
1293
+ (this.showRenderDialogFlag = !1);
1294
+ },
1295
+ closeHandle() {
1296
+ this.$emit("update:visiable", false);
1297
+ this.$emit("close");
1298
+ },
1299
+ // 添加同级节点
1300
+ onAddSibling(row, index) {
1301
+ console.log("onAddSibling", row, index);
1302
+ const parentId = row.parentId || null;
1303
+ // 先判断是不是根节点
1304
+ if (!parentId) {
1305
+ // 当前节点直接添加
1306
+ // this.tableData.push(this.generateRow(parentId))
1307
+ let addIndex =
1308
+ this.tableData
1309
+ .filter((item) => !item.parentId)
1310
+ .findIndex((item) => item.columnId == row.columnId) + 1;
1311
+ this.tableData.splice(addIndex, 0, this.generateRow(parentId));
1312
+ } else {
1313
+ this.handleAddOneRow(row, index, "SIBLING");
1314
+ }
1315
+ },
1316
+ // 添加子节点 todo
1317
+ onAddChild(row, index) {
1318
+ this.handleAddOneRow(row, index, "CHILD");
1319
+ },
1320
+ /**
1321
+ * 处理添加一行数据
1322
+ * @param {object} row 当前节点
1323
+ * @param {number} index
1324
+ * @param {string} type 操作类型 SIBLING 同级 / CHILD 子级
1325
+ */
1326
+ handleAddOneRow(row, index, type) {
1327
+ const { parentId, columnId } = row;
1328
+ const curId = type === "SIBLING" ? parentId : columnId;
1329
+ let curRow = {};
1330
+ // 在 tableData 中,找到当前节点
1331
+ const findRow = (data) => {
1332
+ data.forEach((item) => {
1333
+ if (item.columnId === curId) {
1334
+ curRow = item;
1335
+ }
1336
+ if (item.children && item.children.length) {
1337
+ findRow(item.children);
1338
+ }
1339
+ });
1340
+ };
1341
+
1342
+ findRow(this.tableData);
1343
+
1344
+ const { columnId: generateParentId, children } = curRow;
1345
+
1346
+ let newRow = this.generateRow(generateParentId);
1347
+ if (children) {
1348
+ if (type === "SIBLING") {
1349
+ let addIndex =
1350
+ children.findIndex((item) => item.columnId == row.columnId) + 1;
1351
+ children.splice(addIndex, 0, newRow);
1352
+ } else {
1353
+ children.push(newRow);
1354
+ }
1355
+ } else {
1356
+ this.$set(curRow, "children", [newRow]);
1357
+ }
1358
+ },
1359
+ getUuid() {
1360
+ return new Date().getTime();
1361
+ },
1362
+ createRowAuthName(type) {
1363
+ return `row${type}` + generateId();
1364
+ },
1365
+ /**
1366
+ * 生成一行数据
1367
+ */
1368
+ generateRow(parentId) {
1369
+ let tmpId = "column" + generateId();
1370
+ let uuid = this.getUuid();
1371
+ var row = {
1372
+ columnId: uuid,
1373
+ kid: uuid,
1374
+ parentId: parentId || null,
1375
+ required: false,
1376
+ width: 150,
1377
+ prop: tmpId,
1378
+ label: tmpId,
1379
+ align: "left",
1380
+ show: true,
1381
+ sortable: true,
1382
+ filterable: true,
1383
+ exportType: null,
1384
+ footerDataType: null,
1385
+ footerMethodConfg: null,
1386
+ widgetList: [],
1387
+ labelColor: null,
1388
+ rowAddAuthName: this.createRowAuthName("Add"),
1389
+ rowEditAuthName: this.createRowAuthName("Edit"),
1390
+ rowAddShow: null,
1391
+ rowEditShow: null,
1392
+ columnShow: null,
1393
+ utcTransformEnabled: false,
1394
+ labelIconClass: null,
1395
+ labelIconPosition: "rear",
1396
+ labelTooltip: null,
1397
+ // treeNode: false,
1398
+ };
1399
+ return row;
1400
+ },
1401
+ isUtcTransformColumn(row) {
1402
+ const formatS = row.formatS;
1403
+ if (!formatS) {
1404
+ return true;
1405
+ }
1406
+ return [
1407
+ "d1",
1408
+ "d2",
1409
+ "d3",
1410
+ "d4",
1411
+ "d5",
1412
+ "render",
1413
+ "create_date",
1414
+ "modify_date",
1415
+ ].includes(formatS);
1416
+ },
1417
+ // 添加根节点
1418
+ onAddRoot() {
1419
+ this.tableData.push(this.generateRow());
1420
+ },
1421
+ // 删除当前节点及对应子节点数据
1422
+ onDelete(row) {
1423
+ const { parentId, columnId } = row;
1424
+ // 根节点直接删除
1425
+ if (!parentId) {
1426
+ const delIndex = this.tableData.findIndex(
1427
+ (item) => item.columnId === columnId
1428
+ );
1429
+ this.tableData.splice(delIndex, 1);
1430
+ } else {
1431
+ // 找到父节点,通过父节点删除
1432
+ let parentRow = {};
1433
+ const findRow = (data) => {
1434
+ data.forEach((item) => {
1435
+ if (item.columnId === parentId) {
1436
+ parentRow = { ...item };
1437
+ }
1438
+ if (item.children && item.children.length) {
1439
+ findRow(item.children);
1440
+ }
1441
+ });
1442
+ };
1443
+ findRow(this.tableData);
1444
+
1445
+ const { children } = parentRow;
1446
+
1447
+ const delIndex = children.findIndex(
1448
+ (item) => item.columnId === columnId
1449
+ );
1450
+
1451
+ children.splice(delIndex, 1);
1452
+ }
1453
+ },
1454
+ // 数据准备 生成 id 和 parentId
1455
+ handleTableDataFormat(data) {
1456
+ const tableFormat = (tableData, parentId) => {
1457
+ tableData.forEach((item) => {
1458
+ // item.parentId = parentId || null
1459
+ if (!item.kid) item.kid = item.columnId;
1460
+ if (item.children && item.children.length > 0) {
1461
+ tableFormat(item.children, item.columnId);
1462
+ }
1463
+ });
1464
+ };
1465
+
1466
+ tableFormat(data);
1467
+ return data;
1468
+ },
1469
+ //drag begin
1470
+ //行拖拽
1471
+ rowDrop() {
1472
+ if (this.dragSort) this.dragSort.destroy(); // 防止在Dom上重复绑定事件
1473
+ // const tbody = document.querySelector('.drag .el-table__body-wrapper tbody');
1474
+ var tbody = this.$refs.singleTable.$el.querySelectorAll(
1475
+ ".el-table__fixed-body-wrapper > table > tbody"
1476
+ )[0];
1477
+ const _this = this;
1478
+ this.dragSort = Sortable.create(tbody, {
1479
+ ghostClass: "sortable-ghost",
1480
+ // draggable: ".drag-option", // 修改可拖拽元素
1481
+ handle: ".drag-option", // 指定拖动按钮
1482
+ setData: function (e) {
1483
+ e.setData("Text", "");
1484
+ },
1485
+ onEnd({ newIndex, oldIndex }) {
1486
+ _this.rowDropEnd(newIndex, oldIndex);
1487
+ },
1488
+ });
1489
+ },
1490
+
1491
+ //树转数组
1492
+ toArray(data) {
1493
+ const result = [];
1494
+ data.forEach((item) => {
1495
+ const loop = (data) => {
1496
+ result.push({
1497
+ ...data,
1498
+ });
1499
+ let child = data.children;
1500
+ if (child) {
1501
+ for (let i = 0; i < child.length; i++) {
1502
+ loop(child[i]);
1503
+ }
1504
+ }
1505
+ };
1506
+ loop(item);
1507
+ });
1508
+ return result;
1509
+ },
1510
+ //数组转树
1511
+ arrToTree(arr, parentId) {
1512
+ return arr
1513
+ .filter((item) =>
1514
+ !parentId ? !item.parentId : item.parentId === parentId
1515
+ )
1516
+ .map((item) => {
1517
+ item.children = this.arrToTree(arr, item.columnId);
1518
+ return item;
1519
+ });
1520
+ },
1521
+ //查看树中v2 是否 为 v1的底级
1522
+ isTreeBottom(tree, v1, v2) {
1523
+ let result = false;
1524
+
1525
+ function recursion(tree, v1, v2, flag) {
1526
+ for (let i = 0; i < tree.length; i++) {
1527
+ const item = tree[i];
1528
+ if (item.columnId === v2) {
1529
+ result = flag;
1530
+ return;
1531
+ } else if (item.columnId === v1) {
1532
+ item.children ? recursion(item.children, v1, v2, true) : "";
1533
+ } else {
1534
+ item.children ? recursion(item.children, v1, v2, flag) : "";
1535
+ }
1536
+ }
1537
+ }
1538
+
1539
+ recursion(tree, v1, v2, false);
1540
+ return result;
1541
+ },
1542
+ //行结束拖拽事件
1543
+ rowDropEnd(newIndex, oldIndex) {
1544
+ //判断是否没有更换位置,如果没更换,则不做任何操作
1545
+ if (newIndex === oldIndex) return;
1546
+ //树形结构转数组
1547
+ this.tableDataArray = this.toArray(this.tableData);
1548
+
1549
+ let oldRow = this.tableDataArray[oldIndex];
1550
+ let newRow = this.tableDataArray[newIndex];
1551
+
1552
+ //判断是否把该行 拖拽到 自己的底级中
1553
+ if (this.isTreeBottom(this.tableData, oldRow.columnId, newRow.columnId)) {
1554
+ this.$message({
1555
+ type: "error",
1556
+ message: "不能放到子节点",
1557
+ });
1558
+ let tableData = this.tableData;
1559
+ this.tableData = [];
1560
+ this.$nextTick(() => {
1561
+ this.tableData = tableData;
1562
+ });
1563
+ return;
1564
+ }
1565
+
1566
+ if (oldRow.parentId != newRow.parentId) {
1567
+ this.$message({
1568
+ type: "error",
1569
+ message: "不能放到父节点",
1570
+ });
1571
+ let tableData = this.tableData;
1572
+ this.tableData = [];
1573
+ this.$nextTick(() => {
1574
+ this.tableData = tableData;
1575
+ });
1576
+ return;
1577
+ }
1578
+
1579
+ let pid = this.tableDataArray[newIndex].parentId || null;
1580
+ //拿到当前行数据,并从数组中删除该数据
1581
+ const currRow = this.tableDataArray.splice(oldIndex, 1)[0];
1582
+ //把当前行数据的 父id 给 赋值为结束位置的父id,因为当前行与结束行平级.父id相同.
1583
+ currRow.parentId = pid;
1584
+ //把更改了父id的当前行数据给插入到数组中
1585
+ this.tableDataArray.splice(newIndex, 0, currRow);
1586
+ //表格显示的数据清空
1587
+ this.tableData = [];
1588
+ this.$nextTick(() => {
1589
+ //表格显示的数据 为 修改了位置的数组转换成的属性结构
1590
+ this.tableData = this.arrToTree(this.tableDataArray);
1591
+ //新的数组为 表格显示的数据转换
1592
+ this.tableDataArray = this.toArray(this.tableData);
1593
+ });
1594
+ },
1595
+ getIsButtontCell(formatS) {
1596
+ let isButtontCell = false;
1597
+ let widgetType = this.columnFormatMap[formatS];
1598
+ if (widgetType) {
1599
+ isButtontCell =
1600
+ widgetType === "a-link" ||
1601
+ widgetType === "button" ||
1602
+ widgetType === "dropdown";
1603
+ }
1604
+ return isButtontCell;
1605
+ },
1606
+ //drag end
1607
+ changeFormatS(row, isEdit) {
1608
+ let formatS = isEdit ? row.editFormatS : row.formatS;
1609
+ let isButtontCell = this.getIsButtontCell(formatS);
1610
+ let attachmentPrefix = this.designer.getAttachmentPrefix();
1611
+ let columnSelectedWidget = this.designer.createColumnWidget(row, isEdit);
1612
+ if (!isEdit) {
1613
+ if (columnSelectedWidget) {
1614
+ row.widget = columnSelectedWidget;
1615
+ } else {
1616
+ row.widget = null;
1617
+ }
1618
+ row.utcTransformEnabled = false;
1619
+ } else {
1620
+ if (row.prop && row.prop.startsWith(attachmentPrefix)) {
1621
+ let suffix = row.prop.replace(attachmentPrefix, "");
1622
+ columnSelectedWidget.options.keyName = row.prop;
1623
+ columnSelectedWidget.options.keyNameSuffix = suffix;
1624
+ }
1625
+ if (columnSelectedWidget) {
1626
+ row.editWidget = columnSelectedWidget;
1627
+ } else {
1628
+ row.editWidget = null;
1629
+ }
1630
+ }
1631
+
1632
+ if (!isEdit) {
1633
+ if (row.formatS == "editTreeButtonGroup") {
1634
+ row.prop = null;
1635
+ row.label = null;
1636
+ row.sortable = false;
1637
+ row.width = 150;
1638
+ row.widget = null;
1639
+ } else if (isButtontCell) {
1640
+ if (row.formatS == "dropdown") {
1641
+ row.width = 100;
1642
+ } else if (row.formatS == "aLink" || row.formatS == "button") {
1643
+ if (!row.width || row.width == 47) row.width = 150;
1644
+ } else {
1645
+ row.width = 47;
1646
+ }
1647
+ row.prop = null;
1648
+ row.label = null;
1649
+ row.sortable = false;
1650
+ row.filterable = false;
1651
+ } else {
1652
+ let tmpId = "column" + generateId();
1653
+ if (!row.width || row.width == 47) row.width = 150;
1654
+ if (!row.prop) row.prop = tmpId;
1655
+ if (!row.label) row.label = tmpId;
1656
+
1657
+ if (this.userFields.includes(row.formatS)) {
1658
+ let item = this.businessOptions.find(
1659
+ (item) => item.value == row.formatS
1660
+ );
1661
+ if (item) {
1662
+ row.prop = item.value;
1663
+ row.label = item.label;
1664
+ }
1665
+ }
1666
+
1667
+ row.sortable = true;
1668
+
1669
+ if (!isEdit) {
1670
+ if (formatS == "editAttachment") {
1671
+ row.prop = columnSelectedWidget.options.keyName;
1672
+ } else {
1673
+ row.prop = row.prop.replaceAll(attachmentPrefix, "");
1674
+ }
1675
+ }
1676
+ }
1677
+ }
1678
+ },
1679
+ getColumnWidgetConfig(row, isChange, isEdit) {
1680
+ let formatS = isEdit ? row.editFormatS : row.formatS;
1681
+ let columnSelectedWidget = null;
1682
+ let columnEditFields = null;
1683
+
1684
+ let type = this.columnFormatMap[formatS];
1685
+
1686
+ if (type) {
1687
+ const applyNewWidgetDefaults = (widget) => {
1688
+ widget.options.required = row.required || false;
1689
+ if ("editDelete" == formatS) {
1690
+ widget.options.prefixIcon = "el-icon-delete";
1691
+ widget.options.label = "删除";
1692
+ widget.options.labelHidden = true;
1693
+ widget.options.hiddenByWf = true;
1694
+ widget.options.onClick =
1695
+ "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
1696
+ } else if ("editButton" == formatS) {
1697
+ widget.options.prefixIcon = "el-icon-edit";
1698
+ widget.options.label = "查看";
1699
+ widget.options.labelHidden = true;
1700
+ widget.options.onClick =
1701
+ "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
1702
+ } else if ("addSiblingEditRow" == formatS) {
1703
+ widget.options.prefixIcon = "el-icon-plus";
1704
+ widget.options.label = "新增兄弟节点";
1705
+ widget.options.labelHidden = false;
1706
+ widget.options.onClick =
1707
+ "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
1708
+ } else if ("addChildTreeRow" == formatS) {
1709
+ widget.options.prefixIcon = "el-icon-plus";
1710
+ widget.options.label = "新增子节点";
1711
+ widget.options.labelHidden = false;
1712
+ widget.options.onClick =
1713
+ "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
1714
+ } else if ("moveUpRow" == formatS) {
1715
+ widget.options.label = "↑上移";
1716
+ widget.options.labelHidden = false;
1717
+ widget.options.onClick =
1718
+ "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
1719
+ } else if ("moveDownRow" == formatS) {
1720
+ widget.options.label = "↓下移";
1721
+ widget.options.labelHidden = false;
1722
+ widget.options.onClick =
1723
+ "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
1724
+ } else if ("removeTreeRow" == formatS) {
1725
+ widget.options.prefixIcon = "el-icon-delete";
1726
+ widget.options.label = "删除";
1727
+ widget.options.labelHidden = true;
1728
+ widget.options.onClick =
1729
+ "let tableParam = this.tableParam;\nthis.getParentTarget().removeTreeRow(tableParam);";
1730
+ }
1731
+ };
1732
+
1733
+ if (!isChange) {
1734
+ const sourceWidget = this.designer.getColumnWidget(row, isEdit);
1735
+ if (sourceWidget) {
1736
+ columnSelectedWidget = this.$baseLodash.cloneDeep(sourceWidget);
1737
+ columnSelectedWidget.options.required = row.required || false;
1738
+ if ("editDelete" == formatS) {
1739
+ columnSelectedWidget.options.hiddenByWf =
1740
+ columnSelectedWidget.options.hiddenByWf ?? true;
1741
+ columnSelectedWidget.options.prefixIcon =
1742
+ columnSelectedWidget.options.prefixIcon || "el-icon-delete";
1743
+ } else if ("editButton" == formatS) {
1744
+ columnSelectedWidget.options.prefixIcon =
1745
+ columnSelectedWidget.options.prefixIcon || "el-icon-edit";
1746
+ }
1747
+ } else {
1748
+ columnSelectedWidget = this.designer.copyNewFieldWidget(
1749
+ this.designer.getFieldWidgetByType(type)
1750
+ );
1751
+ applyNewWidgetDefaults(columnSelectedWidget);
1752
+ }
1753
+ } else {
1754
+ columnSelectedWidget = this.designer.copyNewFieldWidget(
1755
+ this.designer.getFieldWidgetByType(type)
1756
+ );
1757
+ applyNewWidgetDefaults(columnSelectedWidget);
1758
+ }
1759
+
1760
+ if (columnSelectedWidget.options.hasOwnProperty("keyName")) {
1761
+ columnSelectedWidget.options.keyName = row.prop;
1762
+ columnSelectedWidget.options.keyNameEnabled = true;
1763
+ } else {
1764
+ columnSelectedWidget.options.name = row.prop;
1765
+ }
1766
+
1767
+ if (type != "button" && type != "a-link") {
1768
+ columnSelectedWidget.options.label = row.label;
1769
+ columnSelectedWidget.options.labelHidden = true;
1770
+ }
1771
+ }
1772
+ return { columnSelectedWidget, columnEditFields };
1773
+ },
1774
+ findColumnByColumnId(columnList, columnId) {
1775
+ let result = null;
1776
+ if (columnList) {
1777
+ let column = columnList.find((item) => item.columnId == columnId);
1778
+ for (let column of columnList) {
1779
+ if (column.columnId == columnId) {
1780
+ result = column;
1781
+ break;
1782
+ } else if (column.children && column.children.length) {
1783
+ let subColumn = this.findColumnByColumnId(
1784
+ column.children,
1785
+ children
1786
+ );
1787
+ if (subColumn) {
1788
+ result = subColumn;
1789
+ break;
1790
+ }
1791
+ }
1792
+ }
1793
+ }
1794
+ return result;
1795
+ },
1796
+
1797
+ getRowWidget(row) {
1798
+ let widget = row.widget;
1799
+ if (!widget) {
1800
+ widget.options.a = a;
1801
+ widget.options.a = a;
1802
+ }
1803
+ return widget;
1804
+ },
1805
+ confirmEditTreeButtonGroupConfig(rowConfig) {
1806
+ if (this.currentEditTreeButtonGroupRow) {
1807
+ Object.assign(this.currentEditTreeButtonGroupRow, rowConfig);
1808
+ }
1809
+ this.currentEditTreeButtonGroupRow = null;
1810
+ this.editTreeButtonGroupRowData = null;
1811
+ },
1812
+ openFormatConfigDialog(row, index) {
1813
+ if (row.formatS === "editTreeButtonGroup") {
1814
+ this.currentEditTreeButtonGroupRow = row;
1815
+ this.editTreeButtonGroupRowData = this.$baseLodash.cloneDeep(row);
1816
+ this.showEditTreeButtonGroupConfigDialog = true;
1817
+ return;
1818
+ }
1819
+ if (row.formatS == "widgetRender") {
1820
+ let formWidgetList = deepClone(this.designer.widgetList);
1821
+ const widgetMap = this.buildColumnWidgetMap(
1822
+ this.sourceTableColumnsSnapshot || this.optionModel.tableColumns || []
1823
+ );
1824
+ let tableData = this.restoreColumnWidgetRefs(
1825
+ this.cloneTableColumnsForEdit(this.tableData),
1826
+ widgetMap
1827
+ );
1828
+ let columnId = row.columnId;
1829
+
1830
+ let dataTableName = this.optionModel.name;
1831
+
1832
+ let targetColumn = null;
1833
+ loopHandleWidget(formWidgetList, (item) => {
1834
+ if (item.options.name == dataTableName) {
1835
+ item.options.tableColumns = tableData;
1836
+ targetColumn = this.findColumnByColumnId(
1837
+ item.options.tableColumns,
1838
+ columnId
1839
+ );
1840
+ }
1841
+ });
1842
+ let getWidgetList = (subWidgetList = []) => {
1843
+ targetColumn.widgetList = this.$baseLodash.cloneDeep(subWidgetList);
1844
+ return formWidgetList;
1845
+ };
1846
+ let sourceData = {
1847
+ formWidgetList,
1848
+ dataTableName,
1849
+ columnId,
1850
+ getWidgetList,
1851
+ };
1852
+
1853
+ this.openWidgetRenderDialog(row, sourceData);
1854
+ return;
1855
+ }
1856
+
1857
+ const { columnSelectedWidget, columnEditFields } =
1858
+ this.getColumnWidgetConfig(row);
1859
+ if (!columnSelectedWidget) {
1860
+ this.$message.warning(this.$t1("请先选择列格式化类型"));
1861
+ return;
1862
+ }
1863
+ columnSelectedWidget.options = this.$baseLodash.cloneDeep(
1864
+ columnSelectedWidget.options
1865
+ );
1866
+ this.operateIndex = index;
1867
+ this.openWidgetPropertyDialog({
1868
+ row: row,
1869
+ columnSelectedWidget,
1870
+ tableColumns: this.tableData,
1871
+ index: index,
1872
+ columnEditFields,
1873
+ callback: (confirmedWidget) => {
1874
+ this.confirmFormatConfigDialog(confirmedWidget, row);
1875
+ },
1876
+ });
1877
+ },
1878
+ getFieldKeyNameByOptions(options) {
1879
+ let o = options.name;
1880
+ return (options.keyNameEnabled && options.keyName) || o;
1881
+ },
1882
+ confirmFormatConfigDialog(columnSelectedWidget, row) {
1883
+ row.widget = columnSelectedWidget;
1884
+ const options = columnSelectedWidget.options;
1885
+
1886
+ let isButtontCell = this.getIsButtontCell(row.formatS);
1887
+ if (!isButtontCell) {
1888
+ row.prop = this.getFieldKeyNameByOptions(options);
1889
+ row.label = options.label;
1890
+ row.required = options.required;
1891
+ }
1892
+ },
1893
+ openEditFormatConfigDialog(row, index) {
1894
+ const { columnSelectedWidget, columnEditFields } =
1895
+ this.getColumnWidgetConfig(row, false, true);
1896
+ if (!columnSelectedWidget) {
1897
+ this.$message.warning(this.$t1("请先选择编辑列格式化类型"));
1898
+ return;
1899
+ }
1900
+ columnSelectedWidget.options = this.$baseLodash.cloneDeep(
1901
+ columnSelectedWidget.options
1902
+ );
1903
+ this.operateIndex = index;
1904
+ this.openWidgetPropertyDialog({
1905
+ row: row,
1906
+ tableColumns: this.tableData,
1907
+ columnSelectedWidget,
1908
+ index: index,
1909
+ columnEditFields,
1910
+ callback: (confirmedWidget) => {
1911
+ this.confirmEditFormatConfigDialog(confirmedWidget, row);
1912
+ },
1913
+ });
1914
+ },
1915
+ confirmEditFormatConfigDialog(columnSelectedWidget, row) {
1916
+ row.editWidget = columnSelectedWidget;
1917
+ },
1918
+ openColumnShowDialog(row) {
1919
+ this.editFormEventHandler(row, this.rowDataIndex, "columnShow");
1920
+ },
1921
+ openTableColumnConfigDialog(row, index) {
1922
+ this.operateIndex = index;
1923
+ this.currentTableColumn = row;
1924
+ let eventName = "tableColumnConfig";
1925
+ let eventParams = ["dataId", "formCode"];
1926
+ this.tableColumnConfigHeader = `${
1927
+ this.optionModel.name
1928
+ }.${eventName}(${eventParams.join(", ")}) {`;
1929
+ this.tableColumnConfigCode = this.$baseLodash.cloneDeep(
1930
+ row.tableColumnConfig || ""
1931
+ );
1932
+
1933
+ this.tableColumnConfigTitle = `自定义表格列属性配置(${row.label})`;
1934
+ this.showTableColumnConfigDialog = true;
1935
+ },
1936
+ saveTableColumnConfigDialog() {
1937
+ let row = this.currentTableColumn;
1938
+ const codeHints = this.$refs.ecEditor.getEditorAnnotations();
1939
+ let syntaxErrorFlag = false;
1940
+ if (!!codeHints && codeHints.length > 0) {
1941
+ codeHints.forEach((chItem) => {
1942
+ if (chItem.type === "error") {
1943
+ syntaxErrorFlag = true;
1944
+ }
1945
+ });
1946
+
1947
+ if (syntaxErrorFlag) {
1948
+ this.$message.error(
1949
+ this.i18nt("designer.setting.syntaxCheckWarning")
1950
+ );
1951
+ return;
1952
+ }
1953
+ }
1954
+ this.$set(
1955
+ row,
1956
+ "tableColumnConfig",
1957
+ this.$baseLodash.cloneDeep(this.tableColumnConfigCode)
1958
+ );
1959
+ this.showTableColumnConfigDialog = false;
1960
+ },
1961
+ changeRowLabel(row) {
1962
+ this.setRowWidgetAttars(row, "label", row.label);
1963
+ },
1964
+ changeRowProp(row) {
1965
+ this.setRowWidgetAttars(row, "keyName", row.prop);
1966
+ },
1967
+ changeRowRequired(row) {
1968
+ this.setRowWidgetAttars(row, "required", row.required);
1969
+ },
1970
+ setRowWidgetAttars(row, key, value) {
1971
+ let type1 = this.columnFormatMap[row.formatS];
1972
+ let type2 = this.columnFormatMap[row.editFormatS];
1973
+ let newWidget = type1
1974
+ ? this.designer.copyNewFieldWidget(
1975
+ this.designer.getFieldWidgetByType(type1)
1976
+ )
1977
+ : null;
1978
+
1979
+ let newEditWidget = type2
1980
+ ? this.designer.copyNewFieldWidget(
1981
+ this.designer.getFieldWidgetByType(type2)
1982
+ )
1983
+ : null;
1984
+
1985
+ if (newWidget && newWidget.formItemFlag && row.widget) {
1986
+ if (row.widget.options[key] !== undefined) {
1987
+ row.widget.options[key] = value;
1988
+ }
1989
+ }
1990
+
1991
+ if (newEditWidget && newEditWidget.formItemFlag && row.editWidget) {
1992
+ if (row.editWidget.options[key] !== undefined) {
1993
+ row.editWidget.options[key] = value;
1994
+ }
1995
+ }
1996
+ },
1997
+ openRowEditDialog(row, index) {
1998
+ this.editRowData = row;
1999
+ this.rowData = this.cloneTableColumnsForEdit([row])[0];
2000
+ this.rowDataIndex = index;
2001
+ this.showRowEditDialog = true;
2002
+ },
2003
+ submitRowEditDialog() {
2004
+ Object.assign(this.editRowData, this.rowData);
2005
+ if (this.rowData.widget) {
2006
+ this.editRowData.widget = this.rowData.widget;
2007
+ }
2008
+ if (this.rowData.editWidget) {
2009
+ this.editRowData.editWidget = this.rowData.editWidget;
2010
+ }
2011
+ if (this.rowData.widgetList && this.rowData.widgetList.length) {
2012
+ this.editRowData.widgetList = this.rowData.widgetList;
2013
+ }
2014
+ this.showRowEditDialog = false;
2015
+ this.labelTooltipDialogVisible = false;
2016
+ },
2017
+ closeRowEditDialog() {
2018
+ this.showRowEditDialog = false;
2019
+ this.labelTooltipDialogVisible = false;
2020
+ },
2021
+ openLabelTooltipDialog() {
2022
+ this.labelTooltipValue = this.rowData.labelTooltip || "";
2023
+ this.labelTooltipDialogVisible = true;
2024
+ },
2025
+ submitLabelTooltipDialog() {
2026
+ const value = (this.labelTooltipValue || "").trim();
2027
+ this.rowData.labelTooltip = value || null;
2028
+ this.labelTooltipDialogVisible = false;
2029
+ },
2030
+ },
2031
+ };
2032
+ </script>
2033
+ <style scoped lang="scss">
2034
+ .icon-drag:before {
2035
+ content: "\e61d";
2036
+ }
2037
+
2038
+ /* 固定弹框内容区高度,避免加载前后抖动 */
2039
+ ::v-deep .table-column-config-dialog.el-dialog {
2040
+ .el-dialog__body {
2041
+ height: 532px;
2042
+ max-height: 532px;
2043
+ overflow: hidden;
2044
+ box-sizing: border-box;
2045
+ }
2046
+ }
2047
+
2048
+ .table-column-dialog-cont {
2049
+ height: 516px;
2050
+ min-height: 516px;
2051
+ max-height: 516px;
2052
+ overflow: hidden;
2053
+ box-sizing: border-box;
2054
+ }
2055
+
2056
+ /* 完整列配置弹框:挂到 body,内容区可滚动 */
2057
+ ::v-deep .table-column-row-edit-dialog.el-dialog {
2058
+ .el-dialog__body {
2059
+ max-height: calc(90vh - 130px);
2060
+ overflow-y: auto;
2061
+ overflow-x: hidden;
2062
+ box-sizing: border-box;
2063
+
2064
+ .cont.table-column-row-edit-cont {
2065
+ overflow: visible;
2066
+ max-height: none;
2067
+ padding-bottom: 12px;
2068
+ }
2069
+
2070
+ .form-m2 {
2071
+ height: auto !important;
2072
+ overflow: visible !important;
2073
+
2074
+ .el-form-item.form-item-full:last-child {
2075
+ margin-bottom: 8px;
2076
+ }
2077
+ }
2078
+ }
2079
+ }
2080
+
2081
+ .table-column-row-edit-cont {
2082
+ box-sizing: border-box;
2083
+
2084
+ ::v-deep .form-m2 {
2085
+ .form-item-full {
2086
+ width: calc(100% - 20px) !important;
2087
+ display: block;
2088
+ }
2089
+
2090
+ .form-item-full .el-input {
2091
+ width: 100% !important;
2092
+ }
2093
+ }
2094
+
2095
+ ::v-deep .custom-divider.el-divider--horizontal {
2096
+ margin: 10px 0;
2097
+ }
2098
+ }
2099
+
2100
+ ::v-deep .label-tooltip-textarea textarea {
2101
+ min-height: 320px;
2102
+ }
2103
+ </style>