cloud-web-corejs 1.0.54-dev.646 → 1.0.54-dev.648

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.
@@ -0,0 +1,281 @@
1
+ <template>
2
+ <el-dialog
3
+ title="编辑行按钮组配置"
4
+ :visible.sync="dialogVisible"
5
+ custom-class="dialog-style list-dialog"
6
+ :show-close="true"
7
+ append-to-body
8
+ :close-on-click-modal="false"
9
+ :close-on-press-escape="false"
10
+ :destroy-on-close="true"
11
+ width="520px"
12
+ v-dialog-drag
13
+ @close="handleClose"
14
+ >
15
+ <div class="cont">
16
+ <el-form label-width="150px" class="edit-tree-button-group-form">
17
+ <el-form-item label="行新增权限名称">
18
+ <el-input
19
+ v-model="row.rowAddAuthName"
20
+ class="all-width"
21
+ placeholder="留空则不校验权限"
22
+ clearable
23
+ >
24
+ <el-tooltip
25
+ slot="suffix"
26
+ :enterable="false"
27
+ effect="dark"
28
+ content="随机生成"
29
+ placement="top"
30
+ >
31
+ <i
32
+ class="el-input__icon el-icon-refresh-right"
33
+ @click="createRandomRowAddAuthName"
34
+ ></i>
35
+ </el-tooltip>
36
+ </el-input>
37
+ </el-form-item>
38
+ <el-form-item label="行新增权限编码" v-if="rowAddAuthCode">
39
+ <div class="auth-code-text">
40
+ <el-tooltip effect="light" content="复制">
41
+ <a
42
+ class="a-link"
43
+ style="color: unset"
44
+ @click="copyAuthCode(rowAddAuthCode, $event)"
45
+ >
46
+ <span
47
+ ><i
48
+ class="el-icon-copy-document"
49
+ style="margin-right: 2px"
50
+ ></i
51
+ >{{ rowAddAuthCode }}</span
52
+ >
53
+ </a>
54
+ </el-tooltip>
55
+ </div>
56
+ </el-form-item>
57
+ <el-form-item label="行编辑权限名称">
58
+ <el-input
59
+ v-model="row.rowEditAuthName"
60
+ class="all-width"
61
+ placeholder="留空则不校验权限"
62
+ clearable
63
+ >
64
+ <el-tooltip
65
+ slot="suffix"
66
+ :enterable="false"
67
+ effect="dark"
68
+ content="随机生成"
69
+ placement="top"
70
+ >
71
+ <i
72
+ class="el-input__icon el-icon-refresh-right"
73
+ @click="createRandomRowEditAuthName"
74
+ ></i>
75
+ </el-tooltip>
76
+ </el-input>
77
+ </el-form-item>
78
+ <el-form-item label="行编辑权限编码" v-if="rowEditAuthCode">
79
+ <div class="auth-code-text">
80
+ <el-tooltip effect="light" content="复制">
81
+ <a
82
+ class="a-link"
83
+ style="color: unset"
84
+ @click="copyAuthCode(rowEditAuthCode, $event)"
85
+ >
86
+ <span
87
+ ><i
88
+ class="el-icon-copy-document"
89
+ style="margin-right: 2px"
90
+ ></i
91
+ >{{ rowEditAuthCode }}</span
92
+ >
93
+ </a>
94
+ </el-tooltip>
95
+ </div>
96
+ </el-form-item>
97
+ <el-form-item label="行新增显示条件">
98
+ <a
99
+ href="javascript:void(0);"
100
+ class="a-link link-oneLind"
101
+ @click="editRowShowScript('rowAddShow')"
102
+ >
103
+ <span>{{ row.rowAddShow }}</span>
104
+ <i class="el-icon-edit"></i>
105
+ </a>
106
+ </el-form-item>
107
+ <el-form-item label="行编辑显示条件">
108
+ <a
109
+ href="javascript:void(0);"
110
+ class="a-link link-oneLind"
111
+ @click="editRowShowScript('rowEditShow')"
112
+ >
113
+ <span>{{ row.rowEditShow }}</span>
114
+ <i class="el-icon-edit"></i>
115
+ </a>
116
+ </el-form-item>
117
+ </el-form>
118
+ </div>
119
+ <div slot="footer" class="dialog-footer">
120
+ <el-button class="button-sty" icon="el-icon-close" @click="handleClose">
121
+ {{ i18nt("designer.hint.cancel") }}
122
+ </el-button>
123
+ <el-button
124
+ type="primary"
125
+ class="button-sty"
126
+ icon="el-icon-check"
127
+ @click="handleConfirm"
128
+ >
129
+ {{ i18nt("designer.hint.confirm") }}
130
+ </el-button>
131
+ </div>
132
+ </el-dialog>
133
+ </template>
134
+
135
+ <script>
136
+ import i18n from "../../../../../../components/xform/utils/i18n";
137
+ import eventMixin from "../../../../../../components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin";
138
+ import { generateId } from "../../../../../../components/xform/utils/util";
139
+ import Clipboard from "clipboard";
140
+
141
+ export default {
142
+ name: "edit-tree-button-group-config-dialog",
143
+ mixins: [i18n, eventMixin],
144
+ props: {
145
+ visible: {
146
+ type: Boolean,
147
+ default: false,
148
+ },
149
+ row: {
150
+ type: Object,
151
+ required: true,
152
+ },
153
+ },
154
+ inject: ["getReportTemplate"],
155
+ data() {
156
+ return {
157
+ rowShowParams: ["dataId", "formCode", "tableParam"],
158
+ };
159
+ },
160
+ computed: {
161
+ dialogVisible: {
162
+ get() {
163
+ return this.visible;
164
+ },
165
+ set(val) {
166
+ this.$emit("update:visible", val);
167
+ },
168
+ },
169
+ reportTemplate() {
170
+ return this.getReportTemplate();
171
+ },
172
+ rowAddAuthName() {
173
+ return this.getRowAddAuthName();
174
+ },
175
+ rowEditAuthName() {
176
+ return this.getRowEditAuthName();
177
+ },
178
+ rowAddAuthCode() {
179
+ return this.getRowAuthCode(this.rowAddAuthName);
180
+ },
181
+ rowEditAuthCode() {
182
+ return this.getRowAuthCode(this.rowEditAuthName);
183
+ },
184
+ },
185
+ watch: {
186
+ visible(val) {
187
+ if (val) {
188
+ this.ensureRowAuthNames();
189
+ }
190
+ },
191
+ },
192
+ methods: {
193
+ getRowAddAuthName() {
194
+ return this.row.rowAddAuthName ?? this.row.treeRowAddName;
195
+ },
196
+ getRowEditAuthName() {
197
+ return this.row.rowEditAuthName ?? this.row.treeRowEditName;
198
+ },
199
+ getRowAuthCode(authName) {
200
+ if (!authName || !this.reportTemplate?.formCode) {
201
+ return "";
202
+ }
203
+ return this.reportTemplate.formCode + ":" + authName;
204
+ },
205
+ createRowAuthName(type) {
206
+ return `row${type}` + generateId();
207
+ },
208
+ ensureRowAuthNames() {
209
+ if (!this.getRowAddAuthName()) {
210
+ this.$set(this.row, "rowAddAuthName", this.createRowAuthName("Add"));
211
+ }
212
+ if (!this.getRowEditAuthName()) {
213
+ this.$set(this.row, "rowEditAuthName", this.createRowAuthName("Edit"));
214
+ }
215
+ },
216
+ createRandomRowAddAuthName() {
217
+ this.$set(this.row, "rowAddAuthName", this.createRowAuthName("Add"));
218
+ this.$message.success("生成成功");
219
+ },
220
+ createRandomRowEditAuthName() {
221
+ this.$set(this.row, "rowEditAuthName", this.createRowAuthName("Edit"));
222
+ this.$message.success("生成成功");
223
+ },
224
+ editRowShowScript(eventName) {
225
+ this.editEventHandler(eventName, this.rowShowParams, {
226
+ customCode: () => this.row[eventName] || "",
227
+ callback: (code) => {
228
+ this.$set(this.row, eventName, code);
229
+ },
230
+ });
231
+ },
232
+ copyAuthCode(content, clickEvent) {
233
+ const clipboard = new Clipboard(clickEvent.target, {
234
+ text: () => content,
235
+ });
236
+ clipboard.on("success", () => {
237
+ this.$message.success("复制成功");
238
+ clipboard.destroy();
239
+ });
240
+ clipboard.on("error", () => {
241
+ this.$message.error("复制失败");
242
+ clipboard.destroy();
243
+ });
244
+ clipboard.onClick(clickEvent);
245
+ },
246
+ handleClose() {
247
+ this.dialogVisible = false;
248
+ },
249
+ handleConfirm() {
250
+ this.$emit("confirm", this.getRowConfigSnapshot());
251
+ this.dialogVisible = false;
252
+ },
253
+ getRowConfigSnapshot() {
254
+ return {
255
+ rowAddAuthName: this.row.rowAddAuthName,
256
+ rowEditAuthName: this.row.rowEditAuthName,
257
+ rowAddShow: this.row.rowAddShow,
258
+ rowEditShow: this.row.rowEditShow,
259
+ };
260
+ },
261
+ },
262
+ };
263
+ </script>
264
+
265
+ <style scoped lang="scss">
266
+ .edit-tree-button-group-form {
267
+ ::v-deep .el-form-item {
268
+ margin-bottom: 12px;
269
+ }
270
+ ::v-deep .el-form-item__label {
271
+ line-height: 28px;
272
+ }
273
+ ::v-deep .el-form-item__content {
274
+ line-height: 28px;
275
+ }
276
+ .auth-code-text {
277
+ word-break: break-all;
278
+ line-height: 1.5;
279
+ }
280
+ }
281
+ </style>
@@ -130,7 +130,8 @@
130
130
  @click="openFormatConfigDialog(scope.row, scope.$index)"
131
131
  :disabled="
132
132
  !columnFormatMap[scope.row.formatS] &&
133
- 'widgetRender' !== scope.row.formatS
133
+ 'widgetRender' !== scope.row.formatS &&
134
+ 'editTreeButtonGroup' !== scope.row.formatS
134
135
  "
135
136
  ></el-button>
136
137
  </template>
@@ -265,6 +266,12 @@
265
266
  :visiable.sync="showColumnRenderDialog"
266
267
  @confirm="confirmWidgetRenderDialog"
267
268
  ></columnRenderDialog>
269
+ <editTreeButtonGroupConfigDialog
270
+ v-if="showEditTreeButtonGroupConfigDialog && editTreeButtonGroupRowData"
271
+ :visible.sync="showEditTreeButtonGroupConfigDialog"
272
+ :row="editTreeButtonGroupRowData"
273
+ @confirm="confirmEditTreeButtonGroupConfig"
274
+ />
268
275
  </div>
269
276
  <div class="dialog-footer" slot="footer">
270
277
  <el-button @click="closeHandle" class="button-sty" icon="el-icon-close">
@@ -490,7 +497,8 @@
490
497
  @click="openFormatConfigDialog(rowData, rowDataIndex)"
491
498
  :disabled="
492
499
  !columnFormatMap[rowData.formatS] &&
493
- 'widgetRender' !== rowData.formatS
500
+ 'widgetRender' !== rowData.formatS &&
501
+ 'editTreeButtonGroup' !== rowData.formatS
494
502
  "
495
503
  ></el-button>
496
504
  </el-form-item>
@@ -620,6 +628,7 @@ import {
620
628
  columnFormatMap,
621
629
  } from "../../../../../../components/xform/utils/util";
622
630
  import columnRenderDialog from "./columnRenderDialog.vue";
631
+ import editTreeButtonGroupConfigDialog from "./edit-tree-button-group-config-dialog.vue";
623
632
 
624
633
  let businessOptions = [
625
634
  {
@@ -648,7 +657,7 @@ export default {
648
657
  selectedWidget: Object,
649
658
  optionModel: Object,
650
659
  },
651
- components: { columnRenderDialog },
660
+ components: { columnRenderDialog, editTreeButtonGroupConfigDialog },
652
661
  inject: ["openWidgetPropertyDialog"],
653
662
  data() {
654
663
  return {
@@ -659,6 +668,9 @@ export default {
659
668
  tableColumnConfigCode: null,
660
669
  showDialog: true,
661
670
  dialogVisible: true,
671
+ showEditTreeButtonGroupConfigDialog: false,
672
+ currentEditTreeButtonGroupRow: null,
673
+ editTreeButtonGroupRowData: null,
662
674
  alignOptions: [
663
675
  {
664
676
  value: "left",
@@ -1059,6 +1071,9 @@ export default {
1059
1071
  getUuid() {
1060
1072
  return new Date().getTime();
1061
1073
  },
1074
+ createRowAuthName(type) {
1075
+ return `row${type}` + generateId();
1076
+ },
1062
1077
  /**
1063
1078
  * 生成一行数据
1064
1079
  */
@@ -1082,6 +1097,10 @@ export default {
1082
1097
  footerMethodConfg: null,
1083
1098
  widgetList: [],
1084
1099
  labelColor: null,
1100
+ rowAddAuthName: this.createRowAuthName("Add"),
1101
+ rowEditAuthName: this.createRowAuthName("Edit"),
1102
+ rowAddShow: null,
1103
+ rowEditShow: null,
1085
1104
  // treeNode: false,
1086
1105
  };
1087
1106
  return row;
@@ -1314,6 +1333,8 @@ export default {
1314
1333
  row.label = null;
1315
1334
  row.sortable = false;
1316
1335
  row.width = 150;
1336
+ row.columnOption = {};
1337
+ row.widget = null;
1317
1338
  } else if (isButtontCell) {
1318
1339
  if (row.formatS == "dropdown") {
1319
1340
  row.width = 100;
@@ -1494,7 +1515,20 @@ export default {
1494
1515
  }
1495
1516
  return widget;
1496
1517
  },
1518
+ confirmEditTreeButtonGroupConfig(rowConfig) {
1519
+ if (this.currentEditTreeButtonGroupRow) {
1520
+ Object.assign(this.currentEditTreeButtonGroupRow, rowConfig);
1521
+ }
1522
+ this.currentEditTreeButtonGroupRow = null;
1523
+ this.editTreeButtonGroupRowData = null;
1524
+ },
1497
1525
  openFormatConfigDialog(row, index) {
1526
+ if (row.formatS === "editTreeButtonGroup") {
1527
+ this.currentEditTreeButtonGroupRow = row;
1528
+ this.editTreeButtonGroupRowData = this.$baseLodash.cloneDeep(row);
1529
+ this.showEditTreeButtonGroupConfigDialog = true;
1530
+ return;
1531
+ }
1498
1532
  if (row.formatS == "widgetRender") {
1499
1533
  let formWidgetList = deepClone(this.designer.widgetList);
1500
1534
  let tableData = deepClone(this.tableData);
@@ -1527,20 +1561,6 @@ export default {
1527
1561
  return;
1528
1562
  }
1529
1563
 
1530
- /*let option = row.columnOption;
1531
- let selectedWidget;
1532
- let columnWidgetConfig = this.getColumnWidgetConfig(row);
1533
- let {columnSelectedWidget, columnEditFields} = columnWidgetConfig;
1534
- if (columnSelectedWidget) {
1535
- option = columnSelectedWidget.options;
1536
- selectedWidget = columnSelectedWidget;
1537
- } else {
1538
- option = {};
1539
- selectedWidget = {};
1540
- }
1541
-
1542
- let columnOption = this.$baseLodash.cloneDeep(option);
1543
- row.columnOption = columnOption;*/
1544
1564
  let selectedWidget = row.widget;
1545
1565
  this.operateIndex = index;
1546
1566
 
@@ -0,0 +1,173 @@
1
+ import { propertyRegistered } from './propertyRegister';
2
+
3
+ let propertyDialogSeed = 0;
4
+
5
+ function nextPropertyDialogId() {
6
+ propertyDialogSeed += 1;
7
+ return `widget-property-dialog-${Date.now()}-${propertyDialogSeed}`;
8
+ }
9
+
10
+ export default {
11
+ data() {
12
+ return {
13
+ widgetPropertyDialogs: [],
14
+ activePropertyDialogId: null,
15
+ };
16
+ },
17
+ methods: {
18
+ getActivePropertyDialog() {
19
+ if (!this.widgetPropertyDialogs.length) {
20
+ return null;
21
+ }
22
+ if (this.activePropertyDialogId) {
23
+ const active = this.widgetPropertyDialogs.find(
24
+ (dlg) => dlg.id === this.activePropertyDialogId
25
+ );
26
+ if (active) {
27
+ return active;
28
+ }
29
+ }
30
+ return this.widgetPropertyDialogs[this.widgetPropertyDialogs.length - 1];
31
+ },
32
+ setActivePropertyDialog(id) {
33
+ this.activePropertyDialogId = id;
34
+ this.syncLegacyPropertyDialogState();
35
+ },
36
+ syncLegacyPropertyDialogState() {
37
+ const active = this.getActivePropertyDialog();
38
+ this.showDateConfigDialog = !!active;
39
+ this.columnSelectedWidget = active ? active.columnSelectedWidget : {};
40
+ this.columnEditFields = active ? active.columnEditFields : [];
41
+ this.formatConfig = active ? active.formatConfig : {};
42
+ this.tableColumns = active ? active.tableColumns : null;
43
+ },
44
+ openWidgetPropertyDialog(config) {
45
+ const id = nextPropertyDialogId();
46
+ const dialog = {
47
+ id,
48
+ visible: true,
49
+ title: config.title,
50
+ columnSelectedWidget: config.columnSelectedWidget || {},
51
+ columnEditFields: config.columnEditFields || null,
52
+ tableColumns: config.tableColumns,
53
+ formatConfig: config,
54
+ widgetActiveCollapseName1s: ['1', '3'],
55
+ };
56
+ this.widgetPropertyDialogs.push(dialog);
57
+ this.setActivePropertyDialog(id);
58
+ },
59
+ closeWidgetPropertyDialog(id, invokeCallback = false) {
60
+ const index = this.widgetPropertyDialogs.findIndex((dlg) => dlg.id === id);
61
+ if (index === -1) {
62
+ return;
63
+ }
64
+ const dialog = this.widgetPropertyDialogs[index];
65
+ if (invokeCallback && dialog.formatConfig && dialog.formatConfig.callback) {
66
+ const columnOption = this.$baseLodash.cloneDeep(
67
+ dialog.columnSelectedWidget.options
68
+ );
69
+ dialog.formatConfig.callback(columnOption);
70
+ }
71
+ this.widgetPropertyDialogs.splice(index, 1);
72
+ if (this.activePropertyDialogId === id) {
73
+ const last = this.widgetPropertyDialogs[this.widgetPropertyDialogs.length - 1];
74
+ this.activePropertyDialogId = last ? last.id : null;
75
+ }
76
+ this.syncLegacyPropertyDialogState();
77
+ },
78
+ handleWidgetPropertyDialogBeforeClose(dialog, done) {
79
+ this.closeWidgetPropertyDialog(dialog.id);
80
+ done();
81
+ },
82
+ confirmWidgetPropertyDialog(dialog) {
83
+ this.closeWidgetPropertyDialog(dialog.id, true);
84
+ },
85
+ hasPropEditorForDialog(dialog, propName, editorName) {
86
+ if (!editorName) {
87
+ return false;
88
+ }
89
+ if (dialog.columnEditFields && !dialog.columnEditFields.includes(propName)) {
90
+ return false;
91
+ }
92
+ const widget = dialog.columnSelectedWidget;
93
+ if (propName.indexOf('-') <= -1) {
94
+ const originalPropName = `${widget.type}-${propName}`;
95
+ if (propertyRegistered(originalPropName)) {
96
+ return false;
97
+ }
98
+ }
99
+ const propKey = propName.replace(`${widget.type}-`, '');
100
+ return this.designer.hasConfig(widget, propKey);
101
+ },
102
+ getPropEditorForDialog(dialog, propName, editorName) {
103
+ const widget = dialog.columnSelectedWidget;
104
+ const propKey = propName.replace(`${widget.type}-`, '');
105
+ const uniquePropName = `${widget.type}-${propKey}-editor`;
106
+ if (this.$options.components[uniquePropName]) {
107
+ return uniquePropName;
108
+ }
109
+ if (this.$root.$options.components[uniquePropName]) {
110
+ return uniquePropName;
111
+ }
112
+ return editorName;
113
+ },
114
+ showCollapseForDialog(dialog, props) {
115
+ for (const propName in props) {
116
+ if (!props.hasOwnProperty(propName)) {
117
+ continue;
118
+ }
119
+ if (this.hasPropEditorForDialog(dialog, propName, props[propName])) {
120
+ return true;
121
+ }
122
+ }
123
+ return false;
124
+ },
125
+ editEventHandler(eventName, eventParams, eventOptions) {
126
+ eventOptions = eventOptions || {};
127
+ const activeDialog = this.getActivePropertyDialog();
128
+ const eventWidget = activeDialog
129
+ ? activeDialog.columnSelectedWidget
130
+ : this.selectedWidget;
131
+ this.curEventName = eventName;
132
+ this.eventHeader = `${this.optionModel.name}.${eventName}(${eventParams.join(', ')}) {`;
133
+ if (eventOptions.customCode) {
134
+ this.eventHandlerCode = eventOptions.customCode() || '';
135
+ } else {
136
+ this.eventHandlerCode = (eventWidget && eventWidget.options[eventName]) || '';
137
+ }
138
+ this.eventOption = eventOptions;
139
+ if (eventName === 'onCreated' && !this.optionModel.onCreated) {
140
+ this.eventHandlerCode = ' //组件创建生命周期\n console.log(\'test onCreated()\')\n';
141
+ }
142
+ this.showWidgetEventDialogFlag = true;
143
+ },
144
+ saveEventHandler() {
145
+ const editorAnnotations = this.$refs.ecEditor.getEditorAnnotations();
146
+ let hasError = false;
147
+ if (editorAnnotations && editorAnnotations.length > 0) {
148
+ editorAnnotations.forEach((item) => {
149
+ if (item.type === 'error') {
150
+ hasError = true;
151
+ }
152
+ });
153
+ if (hasError) {
154
+ this.$message.error(this.i18nt('designer.hint.syntaxCheckWarning'));
155
+ return;
156
+ }
157
+ }
158
+ const eventOptions = this.eventOption || {};
159
+ if (!eventOptions.callback) {
160
+ const activeDialog = this.getActivePropertyDialog();
161
+ const eventWidget = activeDialog
162
+ ? activeDialog.columnSelectedWidget
163
+ : this.selectedWidget;
164
+ if (eventWidget) {
165
+ eventWidget.options[this.curEventName] = this.eventHandlerCode;
166
+ }
167
+ } else {
168
+ eventOptions.callback(this.eventHandlerCode);
169
+ }
170
+ this.showWidgetEventDialogFlag = false;
171
+ },
172
+ },
173
+ };
@@ -259,10 +259,6 @@ export const containers = [
259
259
  tableConfig: null,
260
260
  isEditTable: false,
261
261
  isTreeTable: false,
262
- rowAddAuthName: null,
263
- rowEditAuthName: null,
264
- rowAddShow: null,
265
- rowEditShow: null,
266
262
  wbsEnabled: false,
267
263
  sortScriptCode: null,
268
264
  importTemplateFile: null,