cloud-web-corejs 1.0.287 → 1.0.289

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.287",
4
+ "version": "1.0.289",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -12,6 +12,7 @@
12
12
  :sub-form-row-id="subFormRowId"
13
13
  >
14
14
  <el-dropdown
15
+ v-if="hasDropdownPermission(field) && hasVisibleDropdownItem"
15
16
  :trigger="field.options.dropdownTrigger"
16
17
  :disabled="field.options.disabled"
17
18
  >
@@ -39,7 +40,7 @@
39
40
  <el-dropdown-menu slot="dropdown">
40
41
  <template v-for="(subWidget, index) in field.widgetList">
41
42
  <el-dropdown-item
42
- v-show="!subWidget.options.hidden"
43
+ v-show="isDropdownItemVisible(subWidget)"
43
44
  :key="index"
44
45
  :icon="subWidget.options.icon"
45
46
  @click.native="(e) => handleSubButtonWidgetClick(e, index)"
@@ -105,7 +106,14 @@ export default {
105
106
  StaticContentWrapper,
106
107
  dropdownItemWidget,
107
108
  },
108
- computed: {},
109
+ computed: {
110
+ hasVisibleDropdownItem() {
111
+ if (this.designState) return true;
112
+ return this.field.widgetList.some((item) =>
113
+ this.isDropdownItemVisible(item)
114
+ );
115
+ },
116
+ },
109
117
  beforeCreate() {
110
118
  /* 这里不能访问方法和属性!! */
111
119
  },
@@ -146,7 +154,30 @@ export default {
146
154
  }
147
155
  },
148
156
  handleSubButtonWidgetClick(e, index) {
149
- this.$refs["item" + index][0].handleButtonWidgetClick(e);
157
+ let subWidget = this.field.widgetList[index];
158
+ if (!this.isDropdownItemVisible(subWidget)) return;
159
+ let itemRef = this.$refs["item" + index];
160
+ if (itemRef && itemRef[0]) {
161
+ itemRef[0].handleButtonWidgetClick(e);
162
+ }
163
+ },
164
+ getDropdownAuthCode(widget) {
165
+ let formRef = this.getFormRef();
166
+ let formCode = formRef?.reportTemplate?.formCode;
167
+ let authName = widget?.options?.name;
168
+ return formCode && authName ? formCode + ":" + authName : null;
169
+ },
170
+ hasDropdownPermission(widget) {
171
+ if (this.designState) return true;
172
+ let authCode = this.getDropdownAuthCode(widget);
173
+ if (!authCode) return true;
174
+ let dispermissions = this.$store.getters.dispermissions || [];
175
+ return !dispermissions.includes(authCode);
176
+ },
177
+ isDropdownItemVisible(widget) {
178
+ return (
179
+ !!widget && !widget.options.hidden && this.hasDropdownPermission(widget)
180
+ );
150
181
  },
151
182
  handleHidden() {
152
183
  let isShow = this.field.widgetList.some((item) => !item.options.hidden);
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Webpack async chunk load error helpers.
3
+ */
4
+ export function isChunkLoadError(error) {
5
+ const name = (error && error.name) || "";
6
+ const message = (error && error.message) || String(error || "");
7
+ return (
8
+ name === "ChunkLoadError"
9
+ || /Loading (CSS )?chunk .* failed/i.test(message)
10
+ || /ChunkLoadError/i.test(message)
11
+ || /Failed to fetch dynamically imported module/i.test(message)
12
+ || /页面资源加载失败/i.test(message)
13
+ );
14
+ }
15
+
16
+ export function getChunkLoadErrorMessage(error, resourceName = "页面资源") {
17
+ if (isChunkLoadError(error)) {
18
+ return `${resourceName}加载失败,可能系统已发布新版本,请刷新页面后重试`;
19
+ }
20
+ return `${resourceName}加载失败,请稍后重试`;
21
+ }
@@ -164,6 +164,9 @@ import scriptDescriptionDialog from '@base/components/scriptDescription/dialog'
164
164
  // import designer from '../../../../views/user/form/vform/designer.vue';
165
165
  import itemList from "./itemList";
166
166
  import formTypeEditDialog from "../../../../views/user/form/form_type/editDialog";
167
+ import { getChunkLoadErrorMessage } from "@base/utils/chunkLoadError";
168
+
169
+ const loadDesigner = () => import('../../../../views/user/form/vform/designer.vue');
167
170
 
168
171
  export default {
169
172
  name: 'form_template:list',
@@ -174,7 +177,7 @@ export default {
174
177
  scriptDescriptionDialog,
175
178
  itemList,
176
179
  formTypeEditDialog,
177
- designer: () => import('../../../../views/user/form/vform/designer.vue')
180
+ designer: loadDesigner
178
181
  },
179
182
  data() {
180
183
  return {
@@ -184,6 +187,7 @@ export default {
184
187
  vxeOption: {},
185
188
  formData: {},
186
189
  showDesingerDialog: false,
190
+ designerLoading: false,
187
191
  formCode: null,
188
192
  templateId: null,
189
193
 
@@ -250,9 +254,25 @@ export default {
250
254
  this.showItemEdit = false;
251
255
  this.$openEditView('showEdit');
252
256
  },
253
- openDesingerDialog(row) {
254
- this.formCode = row.formCode;
255
- this.showDesingerDialog = true;
257
+ async openDesingerDialog(row) {
258
+ if (this.designerLoading) return;
259
+ this.designerLoading = true;
260
+ const loading = this.$loading({
261
+ lock: true,
262
+ text: this.$t1("表单设计器加载中..."),
263
+ background: "rgba(255, 255, 255, 0.65)"
264
+ });
265
+ try {
266
+ await loadDesigner();
267
+ this.formCode = row.formCode;
268
+ this.showDesingerDialog = true;
269
+ } catch (error) {
270
+ console.error("[form-template] 表单设计器加载失败:", error);
271
+ this.$message.error(getChunkLoadErrorMessage(error, "表单设计器"));
272
+ } finally {
273
+ loading.close();
274
+ this.designerLoading = false;
275
+ }
256
276
  },
257
277
  closeFormDesignwinEvent(done) {
258
278
  this.$baseConfirm('请确认"已保存"报表模板,是否继续关闭?').then(() => {
@@ -42,6 +42,7 @@
42
42
 
43
43
  <script>
44
44
  import { loadViewComponent } from "@base/utils/resolveViewComponent";
45
+ import { getChunkLoadErrorMessage } from "@base/utils/chunkLoadError";
45
46
  export default {
46
47
  name: "wfContentDialog",
47
48
  props: {
@@ -89,40 +90,50 @@ export default {
89
90
  this.$emit("close");
90
91
  },
91
92
  openWfDialog() {
92
- let id = this.option.objId;
93
- let wfDataId = !id || typeof id == "object" ? 0 : Number(id);
94
- let param = this.option.param || {};
95
- if (this.option.url == "form") {
96
- let formCode = null;
97
- if (this.option.formCode) {
98
- formCode = this.option.formCode;
93
+ try {
94
+ let id = this.option.objId;
95
+ let wfDataId = !id || typeof id == "object" ? 0 : Number(id);
96
+ let param = this.option.param || {};
97
+ if (this.option.url == "form") {
98
+ let formCode = null;
99
+ if (this.option.formCode) {
100
+ formCode = this.option.formCode;
101
+ } else {
102
+ formCode = this.option.objTypeCode.substr(9);
103
+ }
104
+ this.param = Object.assign(param, {
105
+ formCode: formCode,
106
+ dataId: wfDataId,
107
+ });
108
+ let url = "/user/form/vform/render.vue";
109
+ this.wfContent = require("@base/views" + url).default;
99
110
  } else {
100
- formCode = this.option.objTypeCode.substr(9);
111
+ this.param = Object.assign(param, {
112
+ _dataId: wfDataId,
113
+ });
114
+ let url = this.option.url + ".vue";
115
+ let res = loadViewComponent(url);
116
+ if (res.error) throw res.error;
117
+ this.remoteView =
118
+ res.kind === "remote"
119
+ ? {
120
+ owner: res.owner,
121
+ targetPath: res.targetPath,
122
+ bizParams: this.param,
123
+ viewMeta: { visibleKey: "showWfContent", defaultShowWfContent: true, viewType: 1 },
124
+ }
125
+ : null;
126
+ this.wfContent = res.component;
127
+ if (!this.wfContent && !this.remoteView) {
128
+ throw new Error("待办详情组件不存在或未正确配置");
129
+ }
101
130
  }
102
- this.param = Object.assign(param, {
103
- formCode: formCode,
104
- dataId: wfDataId,
105
- });
106
- let url = "/user/form/vform/render.vue";
107
- this.wfContent = require("@base/views" + url).default;
108
- } else {
109
- this.param = Object.assign(param, {
110
- _dataId: wfDataId,
111
- });
112
- let url = this.option.url + ".vue";
113
- let res = loadViewComponent(url);
114
- this.remoteView =
115
- res.kind === "remote"
116
- ? {
117
- owner: res.owner,
118
- targetPath: res.targetPath,
119
- bizParams: this.param,
120
- viewMeta: { visibleKey: "showWfContent", defaultShowWfContent: true, viewType: 1 },
121
- }
122
- : null;
123
- this.wfContent = res.component;
131
+ this.showWfContent = true;
132
+ } catch (error) {
133
+ console.error("[wf-content-dialog] 待办详情加载失败:", error);
134
+ this.$message.error(getChunkLoadErrorMessage(error, "待办详情"));
135
+ this.wfClose();
124
136
  }
125
- this.showWfContent = true;
126
137
  },
127
138
  },
128
139
  };