cloud-web-corejs 1.0.233 → 1.0.235

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.233",
4
+ "version": "1.0.235",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -0,0 +1,231 @@
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">
25
+ {{ $t1("请配置 Vue 页面路径") }}
26
+ </div>
27
+ <div v-else-if="loadError" class="vue-page-error">{{ loadError }}</div>
28
+ <div v-else-if="loading" class="vue-page-loading">
29
+ {{ $t1("页面加载中...") }}
30
+ </div>
31
+ <component
32
+ v-if="showComponent && dynamicComponent"
33
+ :is="dynamicComponent"
34
+ :key="componentRenderKey"
35
+ v-bind="componentProps"
36
+ visible-key="showComponent"
37
+ :parent-target="_self"
38
+ @reload="$reloadHandle"
39
+ />
40
+ </div>
41
+ </static-content-wrapper>
42
+ </template>
43
+
44
+ <script>
45
+ import StaticContentWrapper from "./static-content-wrapper";
46
+ import emitter from "../../../utils/emitter";
47
+ import i18n from "../../../utils/i18n";
48
+ import fieldMixin from "./fieldMixin";
49
+ import { loadView } from "@base/store/modules/permission";
50
+
51
+ export default {
52
+ name: "vue-page-widget",
53
+ componentName: "FieldWidget",
54
+ mixins: [emitter, fieldMixin, i18n],
55
+ props: {
56
+ field: Object,
57
+ parentWidget: Object,
58
+ parentList: Array,
59
+ indexOfParentList: Number,
60
+ designer: Object,
61
+ designState: {
62
+ type: Boolean,
63
+ default: false,
64
+ },
65
+ subFormRowIndex: {
66
+ type: Number,
67
+ default: -1,
68
+ },
69
+ subFormColIndex: {
70
+ type: Number,
71
+ default: -1,
72
+ },
73
+ subFormRowId: {
74
+ type: String,
75
+ default: "",
76
+ },
77
+ },
78
+ components: {
79
+ StaticContentWrapper,
80
+ },
81
+ data() {
82
+ return {
83
+ showComponent: false,
84
+ dynamicComponent: null,
85
+ componentProps: {},
86
+ componentRenderKey: 0,
87
+ loading: false,
88
+ loadError: null,
89
+ };
90
+ },
91
+ computed: {
92
+ componentPath() {
93
+ return (this.field.options.componentPath || "").trim();
94
+ },
95
+ containerStyle() {
96
+ const height = (this.field.options.componentHeight || "").trim();
97
+ if (!height) {
98
+ return {};
99
+ }
100
+ return {
101
+ height,
102
+ minHeight: height,
103
+ overflow: "auto",
104
+ };
105
+ },
106
+ },
107
+ created() {
108
+ this.registerToRefList();
109
+ this.initEventHandler();
110
+ this.handleOnCreated();
111
+ },
112
+ mounted() {
113
+ this.handleOnMounted();
114
+ },
115
+ beforeDestroy() {
116
+ this.unregisterFromRefList();
117
+ },
118
+ methods: {
119
+ normalizeComponentPath(path) {
120
+ return path.replace(/\.vue$/i, "");
121
+ },
122
+ resetComponentState() {
123
+ this.showComponent = false;
124
+ this.dynamicComponent = null;
125
+ this.componentProps = {};
126
+ this.loading = false;
127
+ this.loadError = null;
128
+ },
129
+ loadPage() {
130
+ if (this.designState) {
131
+ return;
132
+ }
133
+
134
+ const path = this.normalizeComponentPath(this.componentPath);
135
+ if (!path) {
136
+ this.resetComponentState();
137
+ return;
138
+ }
139
+
140
+ if (this.dynamicComponent) {
141
+ this.updateComponentProps();
142
+ this.showComponent = true;
143
+ return;
144
+ }
145
+
146
+ this.showComponent = false;
147
+ this.loadError = null;
148
+ this.loading = true;
149
+
150
+ try {
151
+ const loader = loadView(path);
152
+ loader((component) => {
153
+ if (path !== this.normalizeComponentPath(this.componentPath)) {
154
+ return;
155
+ }
156
+ this.loading = false;
157
+ if (!component) {
158
+ this.loadError = this.$t1("页面组件未找到");
159
+ return;
160
+ }
161
+ this.dynamicComponent = component.default || component;
162
+ this.componentRenderKey += 1;
163
+ this.updateComponentProps();
164
+ this.showComponent = true;
165
+ });
166
+ } catch (error) {
167
+ this.loading = false;
168
+ this.loadError = error.message || this.$t1("页面加载失败");
169
+ }
170
+ },
171
+ reloadPage() {
172
+ if (!this.dynamicComponent) {
173
+ this.loadPage();
174
+ return;
175
+ }
176
+ this.$openEditView("showComponent");
177
+ },
178
+ updateComponentProps() {
179
+ if (this.designState || !this.dynamicComponent) {
180
+ return;
181
+ }
182
+
183
+ let props = this.handleCustomEvent(this.field.options.componentConfig);
184
+ this.componentProps = props && typeof props === "object" ? props : {};
185
+ },
186
+ },
187
+ };
188
+ </script>
189
+
190
+ <style lang="scss" scoped>
191
+ @import "~@/styles/global.scss";
192
+
193
+ .designer-vue-page-container {
194
+ outline: 1px dashed #336699;
195
+ padding: 12px;
196
+ margin: 5px;
197
+ min-height: 120px;
198
+ background: #f8fbff;
199
+ }
200
+
201
+ .designer-vue-page-title {
202
+ font-size: 14px;
203
+ font-weight: 600;
204
+ color: #336699;
205
+ margin-bottom: 8px;
206
+ }
207
+
208
+ .designer-vue-page-path {
209
+ font-size: 12px;
210
+ color: #666;
211
+ word-break: break-all;
212
+ }
213
+
214
+ .vue-page-container {
215
+ width: 100%;
216
+ min-height: 120px;
217
+ }
218
+
219
+ .vue-page-placeholder,
220
+ .vue-page-loading,
221
+ .vue-page-error {
222
+ padding: 16px;
223
+ font-size: 13px;
224
+ color: #909399;
225
+ text-align: center;
226
+ }
227
+
228
+ .vue-page-error {
229
+ color: #f56c6c;
230
+ }
231
+ </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"],
43
+ };
44
+ },
45
+ };
46
+ </script>
47
+
48
+ <style scoped></style>
@@ -119,6 +119,7 @@ const COMMON_PROPERTIES = {
119
119
  // 'dropdownItemFlag': 'dropdown-item-editor',
120
120
 
121
121
  'oplogFlag': 'oplogFlag-editor',
122
+ vuePageFlag: "vue-page-editor",
122
123
  'ganttConfig': 'gantt-editor',
123
124
 
124
125
  //弹框