cloud-web-corejs 1.0.54-dev.665 → 1.0.54-dev.667

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.665",
4
+ "version": "1.0.54-dev.667",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -0,0 +1,253 @@
1
+ <template>
2
+ <static-content-wrapper
3
+ :designer="designer"
4
+ :field="field"
5
+ :design-state="designState"
6
+ :parent-widget="parentWidget"
7
+ :parent-list="parentList"
8
+ :index-of-parent-list="indexOfParentList"
9
+ :sub-form-row-index="subFormRowIndex"
10
+ :sub-form-col-index="subFormColIndex"
11
+ :sub-form-row-id="subFormRowId"
12
+ >
13
+ <div
14
+ v-if="designState"
15
+ class="designer-vue-page-container"
16
+ :style="containerStyle"
17
+ >
18
+ <div class="designer-vue-page-title">Vue页面</div>
19
+ <div class="designer-vue-page-path">
20
+ {{ componentPath || "请配置 Vue 页面路径" }}
21
+ </div>
22
+ </div>
23
+ <div v-else class="vue-page-container" :style="containerStyle">
24
+ <div v-if="!componentPath" class="vue-page-placeholder">{{ $t1("请配置 Vue 页面路径") }}</div>
25
+ <div v-else-if="loadError" class="vue-page-error">{{ loadError }}</div>
26
+ <div v-else-if="loading" class="vue-page-loading">{{ $t1("页面加载中...") }}</div>
27
+ <component
28
+ v-if="showComponent && dynamicComponent"
29
+ :is="dynamicComponent"
30
+ :key="componentRenderKey"
31
+ v-bind="componentProps"
32
+ visible-key="showComponent"
33
+ :parent-target="_self"
34
+ @reload="$reloadHandle"
35
+ />
36
+ </div>
37
+ </static-content-wrapper>
38
+ </template>
39
+
40
+ <script>
41
+ import StaticContentWrapper from "./static-content-wrapper";
42
+ import emitter from "../../../utils/emitter";
43
+ import i18n from "../../../utils/i18n";
44
+ import fieldMixin from "./fieldMixin";
45
+ import { loadView } from "@base/store/modules/permission";
46
+
47
+ export default {
48
+ name: "vue-page-widget",
49
+ componentName: "FieldWidget",
50
+ mixins: [emitter, fieldMixin, i18n],
51
+ props: {
52
+ field: Object,
53
+ parentWidget: Object,
54
+ parentList: Array,
55
+ indexOfParentList: Number,
56
+ designer: Object,
57
+ designState: {
58
+ type: Boolean,
59
+ default: false,
60
+ },
61
+ subFormRowIndex: {
62
+ type: Number,
63
+ default: -1,
64
+ },
65
+ subFormColIndex: {
66
+ type: Number,
67
+ default: -1,
68
+ },
69
+ subFormRowId: {
70
+ type: String,
71
+ default: "",
72
+ },
73
+ },
74
+ components: {
75
+ StaticContentWrapper,
76
+ },
77
+ data() {
78
+ return {
79
+ showComponent: false,
80
+ dynamicComponent: null,
81
+ componentProps: {},
82
+ componentRenderKey: 0,
83
+ componentLoaded: false,
84
+ loading: false,
85
+ loadError: null,
86
+ };
87
+ },
88
+ computed: {
89
+ componentPath() {
90
+ return (this.field.options.componentPath || "").trim();
91
+ },
92
+ containerStyle() {
93
+ const height = (this.field.options.componentHeight || "").trim();
94
+ if (!height) {
95
+ return {};
96
+ }
97
+ return {
98
+ height,
99
+ minHeight: height,
100
+ overflow: "auto",
101
+ };
102
+ },
103
+ },
104
+ watch: {
105
+ componentPath() {
106
+ this.reloadDynamicComponent();
107
+ },
108
+ "field.options.componentConfig"() {
109
+ this.updateComponentProps();
110
+ },
111
+ formModel: {
112
+ deep: true,
113
+ handler() {
114
+ this.updateComponentProps();
115
+ },
116
+ },
117
+ },
118
+ created() {
119
+ this.registerToRefList();
120
+ this.initEventHandler();
121
+ this.handleOnCreated();
122
+ this.loadPage();
123
+ },
124
+ mounted() {
125
+ this.handleOnMounted();
126
+ },
127
+ beforeDestroy() {
128
+ this.unregisterFromRefList();
129
+ },
130
+ methods: {
131
+ normalizeComponentPath(path) {
132
+ return path.replace(/\.vue$/i, "");
133
+ },
134
+ resetComponentState() {
135
+ this.showComponent = false;
136
+ this.dynamicComponent = null;
137
+ this.componentProps = {};
138
+ this.componentLoaded = false;
139
+ this.loading = false;
140
+ this.loadError = null;
141
+ },
142
+ reloadDynamicComponent() {
143
+ this.resetComponentState();
144
+ this.loadPage();
145
+ },
146
+ loadPage() {
147
+ if (this.designState) {
148
+ return;
149
+ }
150
+
151
+ if (this.dynamicComponent) {
152
+ this.showComponent = true;
153
+ this.updateComponentProps();
154
+ return;
155
+ }
156
+
157
+ const path = this.normalizeComponentPath(this.componentPath);
158
+ this.showComponent = false;
159
+ this.loadError = null;
160
+
161
+ if (!path) {
162
+ this.loading = false;
163
+ this.componentLoaded = false;
164
+ return;
165
+ }
166
+
167
+ this.loading = true;
168
+ try {
169
+ const loader = loadView(path);
170
+ loader((component) => {
171
+ this.loading = false;
172
+ if (!component) {
173
+ this.loadError = this.$t1("页面组件未找到");
174
+ this.componentLoaded = false;
175
+ return;
176
+ }
177
+ this.dynamicComponent = component.default || component;
178
+ this.componentRenderKey += 1;
179
+ this.componentLoaded = true;
180
+ this.showComponent = true;
181
+ this.updateComponentProps();
182
+ });
183
+ } catch (error) {
184
+ this.loading = false;
185
+ this.componentLoaded = false;
186
+ this.loadError = error.message || this.$t1("页面加载失败");
187
+ }
188
+ },
189
+ reloadPage() {
190
+ if (!this.dynamicComponent) {
191
+ this.loadPage();
192
+ return;
193
+ }
194
+ this.$openEditView("showComponent");
195
+ },
196
+ updateComponentProps() {
197
+ if (this.designState || !this.dynamicComponent) {
198
+ return;
199
+ }
200
+
201
+ let props = this.handleCustomEvent(
202
+ this.field.options.componentConfig,
203
+ ["formModel"],
204
+ [this.formModel]
205
+ );
206
+ this.componentProps = props && typeof props === "object" ? props : {};
207
+ },
208
+ },
209
+ };
210
+ </script>
211
+
212
+ <style lang="scss" scoped>
213
+ @import "~@/styles/global.scss";
214
+
215
+ .designer-vue-page-container {
216
+ outline: 1px dashed #336699;
217
+ padding: 12px;
218
+ margin: 5px;
219
+ min-height: 120px;
220
+ background: #f8fbff;
221
+ }
222
+
223
+ .designer-vue-page-title {
224
+ font-size: 14px;
225
+ font-weight: 600;
226
+ color: #336699;
227
+ margin-bottom: 8px;
228
+ }
229
+
230
+ .designer-vue-page-path {
231
+ font-size: 12px;
232
+ color: #666;
233
+ word-break: break-all;
234
+ }
235
+
236
+ .vue-page-container {
237
+ width: 100%;
238
+ min-height: 120px;
239
+ }
240
+
241
+ .vue-page-placeholder,
242
+ .vue-page-loading,
243
+ .vue-page-error {
244
+ padding: 16px;
245
+ font-size: 13px;
246
+ color: #909399;
247
+ text-align: center;
248
+ }
249
+
250
+ .vue-page-error {
251
+ color: #f56c6c;
252
+ }
253
+ </style>
@@ -1976,17 +1976,28 @@ export default {
1976
1976
  overflow-y: auto;
1977
1977
  overflow-x: hidden;
1978
1978
  box-sizing: border-box;
1979
+
1980
+ .cont.table-column-row-edit-cont {
1981
+ overflow: visible;
1982
+ max-height: none;
1983
+ padding-bottom: 12px;
1984
+ }
1985
+
1986
+ .form-m2 {
1987
+ height: auto !important;
1988
+ overflow: visible !important;
1989
+
1990
+ .el-form-item.form-item-full:last-child {
1991
+ margin-bottom: 8px;
1992
+ }
1993
+ }
1979
1994
  }
1980
1995
  }
1981
1996
 
1982
1997
  .table-column-row-edit-cont {
1983
- padding-bottom: 8px;
1984
1998
  box-sizing: border-box;
1985
1999
 
1986
2000
  ::v-deep .form-m2 {
1987
- height: auto;
1988
- overflow: visible;
1989
-
1990
2001
  .form-item-full {
1991
2002
  width: calc(100% - 20px) !important;
1992
2003
  display: block;
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <div>
3
+ <el-form-item label="Vue页面路径">
4
+ <el-input
5
+ v-model="optionModel.componentPath"
6
+ placeholder="如 @base/views/user/form/view/list 或 /user/form/view/list"
7
+ ></el-input>
8
+ </el-form-item>
9
+ <el-form-item label="页面高度">
10
+ <el-input
11
+ v-model="optionModel.componentHeight"
12
+ placeholder="如 500px,留空则自适应"
13
+ ></el-input>
14
+ </el-form-item>
15
+ <el-form-item label="页面传参" label-width="150px">
16
+ <a
17
+ href="javascript:void(0);"
18
+ class="a-link link-oneLind"
19
+ @click="editEventHandler('componentConfig', params)"
20
+ >
21
+ <span>{{ optionModel.componentConfig }}</span>
22
+ <i class="el-icon-edit"></i>
23
+ </a>
24
+ </el-form-item>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import i18n from "../../../../utils/i18n";
30
+ import eventMixin from "../event-handler/eventMixin";
31
+
32
+ export default {
33
+ name: "vue-page-editor",
34
+ mixins: [i18n, eventMixin],
35
+ props: {
36
+ designer: Object,
37
+ selectedWidget: Object,
38
+ optionModel: Object,
39
+ },
40
+ data() {
41
+ return {
42
+ params: ["dataId", "formCode", "formModel"],
43
+ };
44
+ },
45
+ };
46
+ </script>
47
+
48
+ <style scoped></style>
@@ -122,6 +122,7 @@ const COMMON_PROPERTIES = {
122
122
  // 'dropdownItemFlag': 'dropdown-item-editor',
123
123
 
124
124
  oplogFlag: "oplogFlag-editor",
125
+ vuePageFlag: "vue-page-editor",
125
126
  ganttConfig: "gantt-editor",
126
127
 
127
128
  //弹框
@@ -1,4 +1,4 @@
1
- import { propertyRegistered } from './propertyRegister';
1
+ import { propertyRegistered } from "./propertyRegister";
2
2
 
3
3
  let propertyDialogSeed = 0;
4
4
 
@@ -51,18 +51,24 @@ export default {
51
51
  columnEditFields: config.columnEditFields || null,
52
52
  tableColumns: config.tableColumns,
53
53
  formatConfig: config,
54
- widgetActiveCollapseName1s: ['1', '3'],
54
+ widgetActiveCollapseName1s: ["1", "3"],
55
55
  };
56
56
  this.widgetPropertyDialogs.push(dialog);
57
57
  this.setActivePropertyDialog(id);
58
58
  },
59
59
  closeWidgetPropertyDialog(id, invokeCallback = false) {
60
- const index = this.widgetPropertyDialogs.findIndex((dlg) => dlg.id === id);
60
+ const index = this.widgetPropertyDialogs.findIndex(
61
+ (dlg) => dlg.id === id
62
+ );
61
63
  if (index === -1) {
62
64
  return;
63
65
  }
64
66
  const dialog = this.widgetPropertyDialogs[index];
65
- if (invokeCallback && dialog.formatConfig && dialog.formatConfig.callback) {
67
+ if (
68
+ invokeCallback &&
69
+ dialog.formatConfig &&
70
+ dialog.formatConfig.callback
71
+ ) {
66
72
  const columnSelectedWidget = this.$baseLodash.cloneDeep(
67
73
  dialog.columnSelectedWidget
68
74
  );
@@ -70,7 +76,8 @@ export default {
70
76
  }
71
77
  this.widgetPropertyDialogs.splice(index, 1);
72
78
  if (this.activePropertyDialogId === id) {
73
- const last = this.widgetPropertyDialogs[this.widgetPropertyDialogs.length - 1];
79
+ const last =
80
+ this.widgetPropertyDialogs[this.widgetPropertyDialogs.length - 1];
74
81
  this.activePropertyDialogId = last ? last.id : null;
75
82
  }
76
83
  this.syncLegacyPropertyDialogState();
@@ -86,22 +93,25 @@ export default {
86
93
  if (!editorName) {
87
94
  return false;
88
95
  }
89
- if (dialog.columnEditFields && !dialog.columnEditFields.includes(propName)) {
96
+ if (
97
+ dialog.columnEditFields &&
98
+ !dialog.columnEditFields.includes(propName)
99
+ ) {
90
100
  return false;
91
101
  }
92
102
  const widget = dialog.columnSelectedWidget;
93
- if (propName.indexOf('-') <= -1) {
103
+ if (propName.indexOf("-") <= -1) {
94
104
  const originalPropName = `${widget.type}-${propName}`;
95
105
  if (propertyRegistered(originalPropName)) {
96
106
  return false;
97
107
  }
98
108
  }
99
- const propKey = propName.replace(`${widget.type}-`, '');
109
+ const propKey = propName.replace(`${widget.type}-`, "");
100
110
  return this.designer.hasConfig(widget, propKey);
101
111
  },
102
112
  getPropEditorForDialog(dialog, propName, editorName) {
103
113
  const widget = dialog.columnSelectedWidget;
104
- const propKey = propName.replace(`${widget.type}-`, '');
114
+ const propKey = propName.replace(`${widget.type}-`, "");
105
115
  const uniquePropName = `${widget.type}-${propKey}-editor`;
106
116
  if (this.$options.components[uniquePropName]) {
107
117
  return uniquePropName;
@@ -129,16 +139,19 @@ export default {
129
139
  ? activeDialog.columnSelectedWidget
130
140
  : this.selectedWidget;
131
141
  this.curEventName = eventName;
132
- this.eventHeader = `${this.optionModel.name}.${eventName}(${eventParams.join(', ')}) {`;
142
+ this.eventHeader = `${
143
+ this.optionModel.name
144
+ }.${eventName}(${eventParams.join(", ")}) {`;
133
145
  if (eventOptions.customCode) {
134
- this.eventHandlerCode = eventOptions.customCode() || '';
146
+ this.eventHandlerCode = eventOptions.customCode() || "";
135
147
  } else {
136
- this.eventHandlerCode = (eventWidget && eventWidget.options[eventName]) || '';
148
+ this.eventHandlerCode =
149
+ (eventWidget && eventWidget.options[eventName]) || "";
137
150
  }
138
151
  this.eventOption = eventOptions;
139
- if (eventName === 'onCreated' && !this.optionModel.onCreated) {
140
- this.eventHandlerCode = ' //组件创建生命周期\n console.log(\'test onCreated()\')\n';
141
- }
152
+ /* if (eventName === 'onCreated' && !this.optionModel.onCreated) {
153
+ this.eventHandlerCode = ' //组件创建生命周期\n onsole.logc(\'test onCreated()\')\n';
154
+ } */
142
155
  this.showWidgetEventDialogFlag = true;
143
156
  },
144
157
  saveEventHandler() {
@@ -146,12 +159,12 @@ export default {
146
159
  let hasError = false;
147
160
  if (editorAnnotations && editorAnnotations.length > 0) {
148
161
  editorAnnotations.forEach((item) => {
149
- if (item.type === 'error') {
162
+ if (item.type === "error") {
150
163
  hasError = true;
151
164
  }
152
165
  });
153
166
  if (hasError) {
154
- this.$message.error(this.i18nt('designer.hint.syntaxCheckWarning'));
167
+ this.$message.error(this.i18nt("designer.hint.syntaxCheckWarning"));
155
168
  return;
156
169
  }
157
170
  }
@@ -3511,7 +3511,7 @@ export const advancedFields = [
3511
3511
  },
3512
3512
  },
3513
3513
 
3514
- /* {
3514
+ {
3515
3515
  type: "vue-page",
3516
3516
  icon: "html-text",
3517
3517
  commonFlag: !0,
@@ -3521,15 +3521,18 @@ export const advancedFields = [
3521
3521
  name: "",
3522
3522
  hidden: !1,
3523
3523
  customClass: "",
3524
- onCreated: "",
3524
+ onCreated: "this.loadPage();",
3525
3525
  onMounted: "",
3526
+ vuePageFlag: 1,
3526
3527
  componentPath: "",
3528
+ componentHeight: "",
3527
3529
  componentConfig: "",
3528
- label: "",
3529
- labelHidden: !1,
3530
-
3530
+ accessType: "1",
3531
+ showRuleFlag: 1,
3532
+ showRuleEnabled: 1,
3533
+ showRules: [],
3531
3534
  },
3532
- }, */
3535
+ },
3533
3536
  ];
3534
3537
 
3535
3538
  export const businessFields = [
@@ -48,6 +48,7 @@ export default {
48
48
  slider: "Slider",
49
49
  "static-text": "Text",
50
50
  "html-text": "HTML",
51
+ "vue-page": "Vue Page",
51
52
  button: "Button",
52
53
  divider: "Divider",
53
54
  "picture-upload": "Picture",
@@ -54,6 +54,7 @@ export default {
54
54
  "static-text": "静态文字",
55
55
  "tips-text": "提示文字",
56
56
  "html-text": "HTML",
57
+ "vue-page": "Vue页面",
57
58
  button: "按钮",
58
59
  divider: "分隔线",
59
60
  census: '统计',