README.md 2.1 KB
Newer Older
zcdtk's avatar
zcdtk committed
1

KK's avatar
KK committed
2 3 4 5

# 文件上传编辑器(多选)参数说明

文件上传编辑器支持编辑器参数,其编辑器参数分为两类,分别是上传参数和下载参数。上传参数和其他参数不同,上传参数只为自己的上传地址做服务,因此不需要分成 context、param两个对象。
zcdtk's avatar
zcdtk committed
6 7 8 9

编辑器配置如下:

```typescript
KK's avatar
KK committed
10 11
uploadParam={"orderid":"%orderid%","aaaa":"111111","uuu":"hhhhh","bbb":"%testid%"}
exportParam={"orderid":"%orderid%","aaaa":"111111","uuu":"hhhhh","bbb":"%testid%"}
zcdtk's avatar
zcdtk committed
12 13
```

KK's avatar
KK committed
14
其中,上传参数和下载参数都包括两个部分,示例代码如下。
zcdtk's avatar
zcdtk committed
15 16 17 18

## 上传参数:

```typescript
KK's avatar
KK committed
19
uploadParam={"orderid":"%orderid%","aaaa":"111111","uuu":"hhhhh","bbb":"%testid%"}
zcdtk's avatar
zcdtk committed
20 21
```

KK's avatar
KK committed
22
## 下载参数
zcdtk's avatar
zcdtk committed
23

KK's avatar
KK committed
24 25 26
```typescript
exportParam={"orderid":"%orderid%","aaaa":"111111","uuu":"hhhhh","bbb":"%testid%"}
```
zcdtk's avatar
zcdtk committed
27

KK's avatar
KK committed
28
## 动态解构
zcdtk's avatar
zcdtk committed
29

KK's avatar
KK committed
30
上传参数和下载参数中的  `"orderid":"%orderid%"```"bbb":"%testid%"`` 需要动态解构赋值。
zcdtk's avatar
zcdtk committed
31 32 33

其取值赋值顺序为:

KK's avatar
KK committed
34 35 36
- 首先从视图传递给编辑器的**视图上下文**中获取匹配值,如存在,则赋值给相应的属性。
- 其次从视图传递给编辑器的**视图参数**中获取匹配值,如存在,则赋值给相应的属性。
- 最后从表单数据中获取匹配值,如存在,则赋值给相应的属性。
zcdtk's avatar
zcdtk committed
37 38 39

> 如果表单中能获取匹配值,会覆盖视图上下文中获取的配置值,请配置参数时,合理配置。

KK's avatar
KK committed
40
动态结构后台的参数对象分别为:
zcdtk's avatar
zcdtk committed
41 42

```typescript
KK's avatar
KK committed
43
uploadParam={"orderid":"05676b25da4b479c2100c010a87e6dd5","aaaa":"111111","uuu":"hhhhh","bbb":"yyyy"}
zcdtk's avatar
zcdtk committed
44 45 46
```

```typescript
KK's avatar
KK committed
47
exportParam={"orderid":"05676b25da4b479c2100c010a87e6dd5","aaaa":"111111","uuu":"hhhhh","bbb":"yyyy"}
zcdtk's avatar
zcdtk committed
48 49
```

KK's avatar
KK committed
50
## 数据处理
zcdtk's avatar
zcdtk committed
51

KK's avatar
KK committed
52
通过qs对象将对象序列化成URL的形式,以&进行拼接.最终的参数传递如下
zcdtk's avatar
zcdtk committed
53

KK's avatar
KK committed
54 55
```http
http://localhost:8111/ibizutil/upload?orderid=05676b25da4b479c2100c010a87e6dd5&aaaa=111111&uuu=hhhhh&bbb=yyyy
zcdtk's avatar
zcdtk committed
56 57 58 59 60 61 62 63 64 65 66
```


```http
http://localhost:8111/ibizutil/download/fileid?orderid=05676b25da4b479c2100c010a87e6dd5&aaaa=111111&uuu=hhhhh&bbb=yyyy
```