cloud-web-corejs 1.1.0-dev.76 → 1.1.0-dev.78
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/docs//345/270/270/347/224/250/350/204/232/346/234/254/350/260/203/347/224/250.md +18 -0
- package/src/components/xform/docs//347/272/247/350/201/224/351/200/211/346/213/251/346/207/222/345/212/240/350/275/275/344/275/277/347/224/250/350/257/264/346/230/216.md +147 -85
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +149 -31
- package/src/views/user/wf/wf_manage/list.vue +7 -1
- package/src/views/user/wf/wf_manage/list2.vue +7 -1
- package/src/views/user/wf/wf_manage/wfContentDialog.vue +7 -1
package/package.json
CHANGED
|
@@ -183,6 +183,24 @@ let allRows = grid.getTableData().fullData;
|
|
|
183
183
|
|
|
184
184
|
`getCheckboxRecords(true)` 取出跨页勾选的行。`addTableData` 的第二个参数是去重字段,例如 `table.addTableData(rows, "id")`。
|
|
185
185
|
|
|
186
|
+
`addTableData` 只用于普通表。树表(`isTreeTable: true`)新增走 `addTreeRows`,它会补临时节点身份,并把父字段写成根值。
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
let table = this.getFormRef().getWidgetRef("表格字段名");
|
|
190
|
+
|
|
191
|
+
table.addTreeRows([{
|
|
192
|
+
f_attr_sid: this.$generateUUID()
|
|
193
|
+
}]);
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
要插到第一行时用 `table.addTopTreeRow({ f_attr_sid: this.$generateUUID() })`。
|
|
197
|
+
|
|
198
|
+
节点身份是 `treeConfig.rowField`(例如 `f_file_obj_id`)。新增时还没有正式编号,脚本里不要传这个字段,更不要写成 `0`。`0`、`"0"`、`null`、`""` 是根哨兵,只能出现在父字段(`parentField`,例如 `f_parent_file_obj_id`)上,表示没有父节点。写进节点身份会在入表时报「树节点 xxx 不能为空或根哨兵」。
|
|
199
|
+
|
|
200
|
+
`addTreeRows` 发现身份为空或是哨兵时,会生成 `row_时间戳_…` 临时键,并记到 `_X_TREE_TEMP_KEY`。父字段由方法写成 `rootParentValue`(默认 `0`)。表上开了 `serverGeneratesRowField` 时,提交会把临时键清成 `null`,正式编号由服务端回填。
|
|
201
|
+
|
|
202
|
+
手里已经有真实、唯一、且不是哨兵的节点身份时,可以传给 `addTreeRows`,方法会按正式身份保留。
|
|
203
|
+
|
|
186
204
|
## 显隐和禁用
|
|
187
205
|
|
|
188
206
|
参数可以是字段名,也可以是字段名数组。
|
|
@@ -1,68 +1,114 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 级联选择懒加载使用说明
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
级联选择开启懒加载后,展开每一级才请求下一级数据,走字段上的「请求访问」,脚本只支持 **list**(`objx` 为数组),不走分页,也不走 `condition`。
|
|
4
4
|
|
|
5
5
|
未开启懒加载时,仍使用选项里配好的整棵树。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 一、业务示例:地区全称 + 省市区镇分字段
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
常见做法是:**地区全称**只做选择入口,不入库;**省、市、区、镇**的名称和 ID 单独存文本字段。详情页接口只返回分字段,全称每次打开保持空白,不回显。
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
| 含义 | 组件类型 | 唯一名称 | 是否入库 |
|
|
14
|
+
|----------|------------|----------|----------|
|
|
15
|
+
| 地区全称 | 级联选择 | a1 | 否(不要开「数据属性名称」) |
|
|
16
|
+
| 省 | 文本 | a2 | 是 |
|
|
17
|
+
| 省 ID | 文本 | a3 | 是 |
|
|
18
|
+
| 市 | 文本 | a4 | 是 |
|
|
19
|
+
| 市 ID | 文本 | a5 | 是 |
|
|
20
|
+
| 区 | 文本 | a6 | 是 |
|
|
21
|
+
| 区 ID | 文本 | a7 | 是 |
|
|
22
|
+
| 镇 | 文本 | a8 | 是 |
|
|
23
|
+
| 镇 ID | 文本 | a9 | 是 |
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
- 不打开时,`taBm` 就是组件名。
|
|
25
|
+
列表接口每一行建议返回(供选中回写):
|
|
17
26
|
|
|
18
|
-
|
|
27
|
+
- `tree_path`:各级 ID,英文逗号分隔,如 `44,4401,440106,440106001`
|
|
28
|
+
- `tree_path_name`:各级名称,英文逗号分隔,如 `广东省,广州市,天河区,石牌街道`
|
|
19
29
|
|
|
20
|
-
|
|
30
|
+
---
|
|
21
31
|
|
|
22
|
-
|
|
23
|
-
传到后台的参数名,和数据集里的父级字段一致。可以留空,留空时请求使用 `f_parent`。输入框里不会自动填上 `f_parent`。父级值取的是当前节点的「关联字段」,可以是 ID,也可以是编码。
|
|
24
|
-
2. **有子节点标识**
|
|
25
|
-
返回行里表示是否还有下级的字段。可以留空,留空时按 `f_has_child` 判断。`true`、`1` 可以继续展开,`false`、`0` 是末级。
|
|
26
|
-
3. **传参脚本**
|
|
27
|
-
需要把选中行上的其他字段一并传给后台时再写。点编辑图标,脚本签名是 `lazyParamScript(dataId, formCode, row)`。`row` 是当前选中行,第一次展开根节点时是 `null`。返回对象会并入 `data`。不写就只传父级字段。
|
|
32
|
+
## 二、表单设计器配置步骤
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
在表单设计器拖入「级联选择」作为 `a1`,再拖入 8 个文本字段 `a2`~`a9`。选中 `a1`,在右侧属性面板按顺序配置。
|
|
30
35
|
|
|
31
|
-
###
|
|
36
|
+
### 步骤 1:字段键名(taBm)
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
请求体里的 `taBm` 用的是**这个级联字段本身**:
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
3. 「请求去掉 data 层」默认不勾。勾上之后,父级参数会平铺到外层,不再包在 `data` 里。
|
|
38
|
-
4. 返回结果需要过滤时,再写「查询回调」。返回数组就用这份数组作为本级节点。
|
|
40
|
+
- 打开「数据属性名称」并填写 `keyName` 时,`taBm` = 该 `keyName`。
|
|
41
|
+
- 不打开时,`taBm` = 组件唯一名称(如 `a1`)。
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
**地区全称 a1 不要开「数据属性名称」**,避免把级联值写入表单数据。
|
|
41
44
|
|
|
42
|
-
###
|
|
45
|
+
### 步骤 2:打开懒加载
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
在常用设置里打开「**懒加载**」。打开后出现:
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
| 配置项 | 说明 |
|
|
50
|
+
|--------------|------|
|
|
51
|
+
| **父级字段** | 传到后台的参数名,与数据集父级字段一致。可留空,留空时请求使用 `f_parent`(不会自动写回输入框)。值取当前节点「关联字段」,可以是 ID 或编码。 |
|
|
52
|
+
| **有子节点标识** | 返回行里表示是否还有下级。可留空,留空时按 `f_has_child` 判断。`true`/`1` 可展开,`false`/`0` 为末级。 |
|
|
53
|
+
| **传参脚本** | 可选。签名 `lazyParamScript(dataId, formCode, row)`。`row` 为当前选中行,根节点为 `null`。返回对象并入 `data`。**不使用**「请求访问」里的查询参数。 |
|
|
48
54
|
|
|
49
|
-
###
|
|
55
|
+
### 步骤 3:请求访问
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
在「请求访问设置」中:
|
|
52
58
|
|
|
53
|
-
|
|
59
|
+
1. 打开「**启用请求后台脚本**」。不打开则不会按本文 list 方式请求(可走 `onLazyLoad` 自定义,见文末)。
|
|
60
|
+
2. 填写「**表单脚本编码**」,留空默认 `getList`。
|
|
61
|
+
3. 「请求去掉 data 层」按需勾选;默认不勾,父级参数在 `data` 内。
|
|
62
|
+
4. 需要过滤本级节点时,再写「**查询回调**」`formScriptSuccess`,返回数组替换本级列表。
|
|
54
63
|
|
|
55
|
-
|
|
64
|
+
**不要改「查询参数」**;懒加载不会读取 `formScriptParam`。
|
|
56
65
|
|
|
57
|
-
|
|
66
|
+
### 步骤 4:显示字段 / 关联字段
|
|
58
67
|
|
|
59
|
-
|
|
68
|
+
启用请求后台脚本后,在选项设置里可改:
|
|
69
|
+
|
|
70
|
+
- **显示字段**:下拉展示列,默认 `label`,可改为 `f_name` 等。
|
|
71
|
+
- **关联字段**:选中值及下一级 `f_parent` 取值列,默认 `value`,可改为 `id`、`f_code` 等。
|
|
72
|
+
|
|
73
|
+
### 步骤 5:事件脚本(a1)
|
|
74
|
+
|
|
75
|
+
在「事件设置」中为 `a1` 配置:
|
|
76
|
+
|
|
77
|
+
| 事件 | 何时触发 |
|
|
78
|
+
|------------|----------|
|
|
79
|
+
| **onChange** | 值变化时(含选中、清空),**先于** onSelect / onClear 执行。 |
|
|
80
|
+
| **onSelect** | 仅用户**选中**某一级时。 |
|
|
81
|
+
| **onClear** | 仅用户点**清空**时,**不走** onSelect。 |
|
|
82
|
+
|
|
83
|
+
赋值给其他字段请用:`this.getWidgetRef("字段唯一名称").setValue(值)`。
|
|
84
|
+
|
|
85
|
+
### 步骤 6:保存并验证
|
|
86
|
+
|
|
87
|
+
保存表单后预览:
|
|
88
|
+
|
|
89
|
+
- 第一次展开级联,请求里 `f_parent` 为 `null`。
|
|
90
|
+
- 展开某一行后,`f_parent` 为该行的关联字段值。
|
|
91
|
+
- 选中后 `a2`~`a9` 按脚本写入;清空后 `onClear` 清空这 8 个字段。
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 三、脚本示例(a1)
|
|
96
|
+
|
|
97
|
+
### 3.1 onSelect:按级别回写省市区镇
|
|
98
|
+
|
|
99
|
+
`onSelect(dataId, formCode, value, oldValue, item, rowData, rowIndex)`
|
|
100
|
+
|
|
101
|
+
- `item.level`:**固定**,当前选到的级别 `0` 省、`1` 市、`2` 区、`3` 镇。
|
|
102
|
+
- `item.data`:**固定**,当前选中行的原始数据;`tree_path`、`tree_path_name` 需列表接口返回。
|
|
103
|
+
|
|
104
|
+
只选到某一级时,更高级别写入,更低级别清空。
|
|
60
105
|
|
|
61
106
|
```js
|
|
62
|
-
let level = item
|
|
63
|
-
let data = item
|
|
107
|
+
let level = item.level;
|
|
108
|
+
let data = item.data || {};
|
|
64
109
|
let ids = data.tree_path ? String(data.tree_path).split(",") : [];
|
|
65
110
|
let names = data.tree_path_name ? String(data.tree_path_name).split(",") : [];
|
|
111
|
+
|
|
66
112
|
this.getWidgetRef("a2").setValue(level >= 0 ? names[0] || null : null);
|
|
67
113
|
this.getWidgetRef("a3").setValue(level >= 0 ? ids[0] || null : null);
|
|
68
114
|
this.getWidgetRef("a4").setValue(level >= 1 ? names[1] || null : null);
|
|
@@ -73,9 +119,9 @@ this.getWidgetRef("a8").setValue(level >= 3 ? names[3] || null : null);
|
|
|
73
119
|
this.getWidgetRef("a9").setValue(level >= 3 ? ids[3] || null : null);
|
|
74
120
|
```
|
|
75
121
|
|
|
76
|
-
|
|
122
|
+
### 3.2 onClear:清空分字段
|
|
77
123
|
|
|
78
|
-
|
|
124
|
+
`onClear(dataId, formCode, rowData, rowIndex)`
|
|
79
125
|
|
|
80
126
|
```js
|
|
81
127
|
this.getWidgetRef("a2").setValue(null);
|
|
@@ -88,46 +134,68 @@ this.getWidgetRef("a8").setValue(null);
|
|
|
88
134
|
this.getWidgetRef("a9").setValue(null);
|
|
89
135
|
```
|
|
90
136
|
|
|
91
|
-
|
|
137
|
+
### 3.3 传参脚本 lazyParamScript(可选)
|
|
138
|
+
|
|
139
|
+
展开非根节点时,把选中行其他字段带入 `data`:
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
// lazyParamScript(dataId, formCode, row)
|
|
143
|
+
if (!row) return {};
|
|
144
|
+
return {
|
|
145
|
+
f_code: row.f_code
|
|
146
|
+
};
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 3.4 查询回调 formScriptSuccess(可选)
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
// formScriptSuccess(dataId, formCode, res, rows)
|
|
153
|
+
return rows.filter(function (item) {
|
|
154
|
+
return item.enabled !== false;
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 3.5 上级条件变化后重载懒加载树
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
this.getFormRef().getWidgetRef("a1").reloadLazyNodes();
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 四、后台请求与返回
|
|
167
|
+
|
|
168
|
+
### 4.1 请求
|
|
92
169
|
|
|
93
|
-
|
|
170
|
+
脚本编码在 URL:`/{服务名}/bd_api/{formCode}/{scriptCode}`,**不在 body**。
|
|
171
|
+
|
|
172
|
+
展开节点时 body 示例:
|
|
94
173
|
|
|
95
174
|
```js
|
|
96
175
|
{
|
|
97
176
|
fixeData: {},
|
|
98
177
|
formCode: "kehu3_detail",
|
|
99
178
|
formVersion: 39,
|
|
100
|
-
taBm: "
|
|
179
|
+
taBm: "a1",
|
|
101
180
|
data: {
|
|
102
181
|
f_parent: 64
|
|
103
182
|
}
|
|
104
183
|
}
|
|
105
184
|
```
|
|
106
185
|
|
|
107
|
-
`fixeData
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
传参脚本可以带上选中行的其他字段。父级字段仍以「父级字段」的配置为准。
|
|
112
|
-
|
|
113
|
-
```js
|
|
114
|
-
// lazyParamScript(dataId, formCode, row)
|
|
115
|
-
// row 为当前选中行,根节点为 null
|
|
116
|
-
if (!row) return {};
|
|
117
|
-
return {
|
|
118
|
-
f_code: row.f_code,
|
|
119
|
-
f_name: row.f_name
|
|
120
|
-
};
|
|
121
|
-
```
|
|
186
|
+
- `fixeData`:由 `formHttp` 补全,来自报表全局参数,无则为 `{}`。
|
|
187
|
+
- `data` 中无 `current`、`size`、`condition`。
|
|
188
|
+
- 根节点:`f_parent` 为 `null`。
|
|
189
|
+
- 传参脚本与父级字段同时存在时,**父级字段名以配置为准**,传参脚本字段并入 `data`(同名时父级字段覆盖传参脚本)。
|
|
122
190
|
|
|
123
|
-
|
|
191
|
+
带传参脚本示例:
|
|
124
192
|
|
|
125
193
|
```js
|
|
126
194
|
{
|
|
127
195
|
fixeData: {},
|
|
128
196
|
formCode: "kehu3_detail",
|
|
129
197
|
formVersion: 39,
|
|
130
|
-
taBm: "
|
|
198
|
+
taBm: "a1",
|
|
131
199
|
data: {
|
|
132
200
|
f_parent: 64,
|
|
133
201
|
f_code: "A01",
|
|
@@ -136,42 +204,36 @@ return {
|
|
|
136
204
|
}
|
|
137
205
|
```
|
|
138
206
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
## 返回
|
|
207
|
+
### 4.2 返回
|
|
142
208
|
|
|
143
|
-
`objx`
|
|
209
|
+
`objx` **必须是数组**(不是 `objx.records`)。每行至少包含显示字段、关联字段,以及有子节点标识(或 `leaf`):
|
|
144
210
|
|
|
145
211
|
```js
|
|
146
212
|
[
|
|
147
|
-
{
|
|
148
|
-
{
|
|
213
|
+
{ f_name: "华东", id: 64, f_has_child: true, tree_path: "64", tree_path_name: "华东" },
|
|
214
|
+
{ f_name: "上海", id: 65, f_has_child: false, tree_path: "64,65", tree_path_name: "华东,上海" }
|
|
149
215
|
]
|
|
150
216
|
```
|
|
151
217
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
查询回调可以改本级数据,返回数组即可:
|
|
155
|
-
|
|
156
|
-
```js
|
|
157
|
-
// formScriptSuccess(dataId, formCode, res, rows)
|
|
158
|
-
return rows.filter(item => item.enabled !== false);
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## 保存与回显
|
|
162
|
-
|
|
163
|
-
选中值按各级关联字段组成数组保存,例如 `["EAST", "SH"]`。多选时是多条路径。
|
|
218
|
+
---
|
|
164
219
|
|
|
165
|
-
|
|
220
|
+
## 五、说明与限制
|
|
166
221
|
|
|
167
|
-
|
|
222
|
+
| 项 | 说明 |
|
|
223
|
+
|----|------|
|
|
224
|
+
| 事件顺序 | 同一次操作:**onChange → onSelect**(选中)或 **onChange → onClear**(清空)。 |
|
|
225
|
+
| 详情回显 | 全称 a1 不入库时,**不必**在 `onMounted` 里回显 a1;分字段由详情接口赋值即可。 |
|
|
226
|
+
| 只读展示 | 懒加载只读展示依赖已加载节点;未展开过的路径可能只显示原始值。 |
|
|
227
|
+
| 自定义懒加载 | 未启用「请求后台脚本」时使用 `onLazyLoad(node, resolve)`,须调用 `resolve(节点数组)`;启用后**不执行** onLazyLoad。 |
|
|
228
|
+
| initLazyChecked | 若需仅用脚本展示全称且不写 formModel,可调用组件方法 `initLazyChecked([{ value, label }, ...])`;与「每次打开全称空白」场景二选一。 |
|
|
168
229
|
|
|
169
|
-
|
|
230
|
+
---
|
|
170
231
|
|
|
171
|
-
|
|
232
|
+
## 六、配置检查清单
|
|
172
233
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
234
|
+
- [ ] a1 已开懒加载 + 请求访问 + 脚本编码(默认 getList)
|
|
235
|
+
- [ ] 显示字段 / 关联字段与数据集列一致
|
|
236
|
+
- [ ] 列表行含 `tree_path`、`tree_path_name`(英文逗号分隔)
|
|
237
|
+
- [ ] a1 未开「数据属性名称」
|
|
238
|
+
- [ ] a1 已配 onSelect、onClear;分字段用 `getWidgetRef("xx").setValue`
|
|
239
|
+
- [ ] 未依赖查询参数做懒加载;传参用传参脚本
|
|
@@ -131,6 +131,8 @@ import fieldMixin from "../../../../../components/xform/form-designer/form-widge
|
|
|
131
131
|
import settingConfig from "@/settings.js";
|
|
132
132
|
|
|
133
133
|
const BATCH_UPLOAD_API = "/api/v1.0/FileOperation/BatchUploadFilesFromPortal";
|
|
134
|
+
/** 全部处理完显示 100 后,再停一会儿关闭加载。 */
|
|
135
|
+
const HX_UPLOAD_DONE_DELAY = 200;
|
|
134
136
|
|
|
135
137
|
function parseJsonValue(value) {
|
|
136
138
|
if (value == null || value === "") return null;
|
|
@@ -342,6 +344,7 @@ export default {
|
|
|
342
344
|
|
|
343
345
|
beforeDestroy() {
|
|
344
346
|
this.componentDestroyed = true;
|
|
347
|
+
this.closeHxUploadLoading();
|
|
345
348
|
this.revokeOwnedBlobUrls();
|
|
346
349
|
this.unregisterFromRefList();
|
|
347
350
|
},
|
|
@@ -644,14 +647,22 @@ export default {
|
|
|
644
647
|
}
|
|
645
648
|
target.clearFiles();
|
|
646
649
|
if (uploadUrl) {
|
|
650
|
+
let fileOrder = 0;
|
|
647
651
|
if (!isCustom) {
|
|
652
|
+
if (this.uploadingCount === 0) {
|
|
653
|
+
this.hxUploadTotal = 0;
|
|
654
|
+
this.openHxUploadLoading();
|
|
655
|
+
}
|
|
648
656
|
this.uploadingCount++;
|
|
657
|
+
this.hxUploadTotal++;
|
|
658
|
+
fileOrder = this.hxUploadTotal;
|
|
649
659
|
}
|
|
650
660
|
var abort;
|
|
651
661
|
|
|
652
662
|
let config = {
|
|
653
663
|
useToken: false,
|
|
654
|
-
isLoading
|
|
664
|
+
// 串行时每个请求单独 isLoading,上一个的延迟关闭会把后一个的遮罩关掉,中间空一截
|
|
665
|
+
isLoading: false,
|
|
655
666
|
headers: {
|
|
656
667
|
"Content-Type": "multipart/form-data",
|
|
657
668
|
Authorization: `Bearer ${this.token}`,
|
|
@@ -663,12 +674,14 @@ export default {
|
|
|
663
674
|
}
|
|
664
675
|
}), */
|
|
665
676
|
onUploadProgress: (progressEvent) => {
|
|
677
|
+
const percent = progressEvent.total
|
|
678
|
+
? Math.floor((progressEvent.loaded * 100) / progressEvent.total)
|
|
679
|
+
: 0;
|
|
666
680
|
if (isCustom || file) {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
);
|
|
681
|
+
progressEvent.percent = percent;
|
|
682
|
+
}
|
|
683
|
+
if (!isCustom) {
|
|
684
|
+
this.setHxUploadProgress(fileOrder, percent);
|
|
672
685
|
}
|
|
673
686
|
},
|
|
674
687
|
failMsg: false,
|
|
@@ -678,36 +691,111 @@ export default {
|
|
|
678
691
|
config = extendDeeply(config, config.httpConfig);
|
|
679
692
|
}
|
|
680
693
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
694
|
+
this.enqueueHxUpload(() => {
|
|
695
|
+
if (this.componentDestroyed || !this.getFormRef()) {
|
|
696
|
+
this.finishHxUpload(!isCustom);
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (!isCustom) {
|
|
700
|
+
this.setHxUploadProgress(fileOrder, 0);
|
|
701
|
+
}
|
|
702
|
+
let batchDone = false;
|
|
703
|
+
return this.getFormRef()
|
|
704
|
+
.$http.post(uploadUrl, form, config)
|
|
705
|
+
.then((res1) => {
|
|
706
|
+
if (this.componentDestroyed) return;
|
|
707
|
+
const isLast = !isCustom && this.uploadingCount <= 1;
|
|
708
|
+
if (isLast) {
|
|
709
|
+
this.setHxUploadPercentText(99);
|
|
710
|
+
}
|
|
711
|
+
uploadConfig && uploadConfig.callback && uploadConfig.callback(res1, fileObj);
|
|
685
712
|
|
|
686
|
-
|
|
713
|
+
const adaptedResponse = this.responseAdapter(res1);
|
|
687
714
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
715
|
+
if (!isCustom) {
|
|
716
|
+
if (adaptedResponse.success) {
|
|
717
|
+
// this.initShowImageUrl(adaptedResponse.data)
|
|
718
|
+
if (adaptedResponse.data) {
|
|
719
|
+
let fileInfo = {
|
|
720
|
+
...adaptedResponse.data,
|
|
721
|
+
showUrl: null,
|
|
722
|
+
};
|
|
723
|
+
this.appendUploadedFile(fileInfo);
|
|
724
|
+
// this.initShowUrl();
|
|
725
|
+
}
|
|
726
|
+
batchDone = isLast;
|
|
727
|
+
} else {
|
|
728
|
+
if (isLast) {
|
|
729
|
+
this.closeHxUploadLoading();
|
|
730
|
+
}
|
|
731
|
+
// param.onError(new Error(res1.content || '上传异常'));
|
|
732
|
+
this.$baseAlert(adaptedResponse.message);
|
|
698
733
|
}
|
|
699
|
-
} else {
|
|
700
|
-
// param.onError(new Error(res1.content || '上传异常'));
|
|
701
|
-
this.$baseAlert(adaptedResponse.message);
|
|
702
734
|
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
735
|
+
})
|
|
736
|
+
.finally(() => {
|
|
737
|
+
return this.finishHxUpload(!isCustom, batchDone);
|
|
738
|
+
});
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
/**
|
|
743
|
+
* 同一控件内串行上传。上一次请求结束后立刻发下一次,
|
|
744
|
+
* 避免海信回写工单字段时后一次覆盖前一次。
|
|
745
|
+
*/
|
|
746
|
+
enqueueHxUpload(task) {
|
|
747
|
+
if (!this.hxUploadChain) {
|
|
748
|
+
this.hxUploadChain = Promise.resolve();
|
|
710
749
|
}
|
|
750
|
+
const scheduled = this.hxUploadChain.then(() => task());
|
|
751
|
+
this.hxUploadChain = scheduled.catch(() => {});
|
|
752
|
+
return scheduled;
|
|
753
|
+
},
|
|
754
|
+
openHxUploadLoading() {
|
|
755
|
+
if (this.hxUploadLoading) return;
|
|
756
|
+
this.hxUploadLoading = this.$baseLoading({
|
|
757
|
+
target: document.body,
|
|
758
|
+
background: "unset",
|
|
759
|
+
customClass: "hx-upload-loading",
|
|
760
|
+
text: "",
|
|
761
|
+
});
|
|
762
|
+
},
|
|
763
|
+
setHxUploadProgress(index, percent) {
|
|
764
|
+
if (!this.hxUploadLoading || typeof this.hxUploadLoading.setText !== "function") {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
const total = this.hxUploadTotal || 1;
|
|
768
|
+
const safePercent = Number.isFinite(percent) ? Math.min(percent, 98) : 0;
|
|
769
|
+
const text = total > 1 ? `${index}/${total}` : `${safePercent}%`;
|
|
770
|
+
this.hxUploadLoading.setText(text);
|
|
771
|
+
},
|
|
772
|
+
setHxUploadPercentText(percent) {
|
|
773
|
+
if (!this.hxUploadLoading || typeof this.hxUploadLoading.setText !== "function") {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
this.hxUploadLoading.setText(`${percent}%`);
|
|
777
|
+
},
|
|
778
|
+
closeHxUploadLoading() {
|
|
779
|
+
const loading = this.hxUploadLoading;
|
|
780
|
+
if (!loading) return;
|
|
781
|
+
this.hxUploadLoading = null;
|
|
782
|
+
loading.close();
|
|
783
|
+
},
|
|
784
|
+
finishHxUpload(counted, showDone) {
|
|
785
|
+
if (!counted) return;
|
|
786
|
+
this.uploadingCount = Math.max(0, this.uploadingCount - 1);
|
|
787
|
+
if (this.uploadingCount !== 0) return;
|
|
788
|
+
if (!showDone) {
|
|
789
|
+
this.closeHxUploadLoading();
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
this.setHxUploadPercentText(100);
|
|
793
|
+
return new Promise((resolve) => {
|
|
794
|
+
setTimeout(() => {
|
|
795
|
+
this.closeHxUploadLoading();
|
|
796
|
+
resolve();
|
|
797
|
+
}, HX_UPLOAD_DONE_DELAY);
|
|
798
|
+
});
|
|
711
799
|
},
|
|
712
800
|
handleUploadExceed(files) {
|
|
713
801
|
let limit = this.pickLimit || this.uploadLimit;
|
|
@@ -923,3 +1011,33 @@ export default {
|
|
|
923
1011
|
}
|
|
924
1012
|
}
|
|
925
1013
|
</style>
|
|
1014
|
+
|
|
1015
|
+
<style lang="scss">
|
|
1016
|
+
/* 进度写在转圈中间。全局 spinner 被 zoom:2 放大,这里单独收回来,避免文字掉到圈外。 */
|
|
1017
|
+
body .el-loading-mask.hx-upload-loading .el-loading-spinner {
|
|
1018
|
+
zoom: 1;
|
|
1019
|
+
margin-top: -42px;
|
|
1020
|
+
|
|
1021
|
+
.circular {
|
|
1022
|
+
width: 84px;
|
|
1023
|
+
height: 84px;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
.el-loading-text {
|
|
1027
|
+
zoom: 1;
|
|
1028
|
+
position: absolute;
|
|
1029
|
+
left: 50%;
|
|
1030
|
+
top: 42px;
|
|
1031
|
+
width: 52px;
|
|
1032
|
+
margin: 0;
|
|
1033
|
+
padding: 0;
|
|
1034
|
+
transform: translate(-50%, -50%);
|
|
1035
|
+
font-size: 14px;
|
|
1036
|
+
line-height: 1;
|
|
1037
|
+
text-align: center;
|
|
1038
|
+
white-space: nowrap;
|
|
1039
|
+
overflow: hidden;
|
|
1040
|
+
color: #409eff;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
</style>
|
|
@@ -654,7 +654,13 @@ export default {
|
|
|
654
654
|
// ($openEditView 是 200ms 定时放行,冷启动拉 chunk 常超过它)
|
|
655
655
|
async openEditDialog(row) {
|
|
656
656
|
let id = row.objId;
|
|
657
|
-
|
|
657
|
+
// 数字(含数字字符串)保持原有 Number 转换;非数字字符串原样传给表单
|
|
658
|
+
let wfDataId = id;
|
|
659
|
+
if (!id || typeof id == "object") {
|
|
660
|
+
wfDataId = 0;
|
|
661
|
+
} else if (!isNaN(id)) {
|
|
662
|
+
wfDataId = Number(id);
|
|
663
|
+
}
|
|
658
664
|
|
|
659
665
|
if (row.url == "form") {
|
|
660
666
|
let formCode = null;
|
|
@@ -528,7 +528,13 @@ export default {
|
|
|
528
528
|
// ($openEditView 是 200ms 定时放行,冷启动拉 chunk 常超过它)
|
|
529
529
|
async openEditDialog(row) {
|
|
530
530
|
let id = row.objId;
|
|
531
|
-
|
|
531
|
+
// 数字(含数字字符串)保持原有 Number 转换;非数字字符串原样传给表单
|
|
532
|
+
let wfDataId = id;
|
|
533
|
+
if (!id || typeof id == "object") {
|
|
534
|
+
wfDataId = 0;
|
|
535
|
+
} else if (!isNaN(id)) {
|
|
536
|
+
wfDataId = Number(id);
|
|
537
|
+
}
|
|
532
538
|
|
|
533
539
|
if (row.url == "form") {
|
|
534
540
|
let formCode = null;
|
|
@@ -104,7 +104,13 @@ export default {
|
|
|
104
104
|
});
|
|
105
105
|
try {
|
|
106
106
|
let id = this.option.objId;
|
|
107
|
-
|
|
107
|
+
// 数字(含数字字符串)保持原有 Number 转换;非数字字符串原样传给表单
|
|
108
|
+
let wfDataId = id;
|
|
109
|
+
if (!id || typeof id == "object") {
|
|
110
|
+
wfDataId = 0;
|
|
111
|
+
} else if (!isNaN(id)) {
|
|
112
|
+
wfDataId = Number(id);
|
|
113
|
+
}
|
|
108
114
|
let param = this.option.param || {};
|
|
109
115
|
if (this.option.url == "form") {
|
|
110
116
|
let formCode = null;
|