cloud-web-corejs 1.0.54-dev.666 → 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 +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/vue-page-widget.vue +253 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vue-page/vue-page-editor.vue +48 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
- package/src/components/xform/form-designer/setting-panel/widgetPropertyDialogMixin.js +1 -1
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +9 -6
- package/src/components/xform/lang/en-US.js +1 -0
- package/src/components/xform/lang/zh-CN.js +1 -0
package/package.json
CHANGED
|
@@ -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>
|
|
@@ -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>
|
|
@@ -150,7 +150,7 @@ export default {
|
|
|
150
150
|
}
|
|
151
151
|
this.eventOption = eventOptions;
|
|
152
152
|
/* if (eventName === 'onCreated' && !this.optionModel.onCreated) {
|
|
153
|
-
this.eventHandlerCode = ' //组件创建生命周期\n
|
|
153
|
+
this.eventHandlerCode = ' //组件创建生命周期\n onsole.logc(\'test onCreated()\')\n';
|
|
154
154
|
} */
|
|
155
155
|
this.showWidgetEventDialogFlag = true;
|
|
156
156
|
},
|
|
@@ -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
|
-
|
|
3529
|
-
|
|
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 = [
|