@jiangood/open-admin 3.0.13 → 3.0.14

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
@@ -49,5 +49,5 @@
49
49
  "test:e2e": "playwright test",
50
50
  "test:e2e:ui": "playwright test --ui"
51
51
  },
52
- "version": "3.0.13"
52
+ "version": "3.0.14"
53
53
  }
@@ -108,6 +108,10 @@ export class FieldDateRange extends React.Component<FieldDateRangeProps> {
108
108
  }
109
109
 
110
110
  dateToStr(dateArr: [dayjs.Dayjs | null, dayjs.Dayjs | null] | null, fmt: string): string {
111
+ if (dateArr == null) {
112
+ return "";
113
+ }
114
+
111
115
  const arr = dateArr as [dayjs.Dayjs | null, dayjs.Dayjs | null];
112
116
  const d1 = arr[0];
113
117
  const d2 = arr[1];
@@ -56,6 +56,7 @@ export class FieldEditor extends React.Component<FieldEditorProps, {loading: boo
56
56
  language: 'zh_CN',
57
57
  height: height,
58
58
  images_upload_url: uploadUrl,
59
+ convert_urls: false,
59
60
  promotion: false,
60
61
  cache_suffix: '?v=v7.7',
61
62
  plugins: [
@@ -365,7 +365,7 @@ export class FieldUploadImage extends React.Component<FieldUploadImageProps, Fie
365
365
  fd.append('file', this.state.preview.cFile);
366
366
  fd.append('thumb', tFile);
367
367
  fd.append('isPublic', String(this.state.isPublic));
368
- const rs = await HttpUtils.post('admin/sysFile/uploadImage', fd, null, {headers: {'Content-Type': 'multipart/form-data'}});
368
+ const rs = await HttpUtils.post('admin/sysFile/uploadImage', fd);
369
369
  const newNames = [...this.state.objectNames, rs.objectName];
370
370
  this.setState({objectNames: newNames});
371
371
  this.props.onChange?.(newNames.join(','));
@@ -21,6 +21,12 @@ export class HttpUtils {
21
21
  const url = config.url as string;
22
22
  config.url = url.startsWith('admin') ? '/' + url : url;
23
23
 
24
+ // FormData 请求交由浏览器自动生成带 boundary 的 multipart Content-Type,
25
+ // 否则手动指定 Content-Type 会缺失 boundary 导致后端解析失败
26
+ if (typeof FormData !== 'undefined' && config.data instanceof FormData) {
27
+ config.headers = {...config.headers, 'Content-Type': undefined};
28
+ }
29
+
24
30
  return new Promise<T>((resolve, reject) => {
25
31
  axiosInstance(config).then((response) => {
26
32
  const body = response.data;
@@ -1,5 +1,5 @@
1
1
  import {DeleteOutlined, EditOutlined, PlusOutlined} from '@ant-design/icons';
2
- import {AutoComplete, Button, Card, Descriptions, Empty, Form, Input, InputNumber, Popconfirm, Splitter, Tree, Tag, TreeSelect, Typography} from 'antd';
2
+ import {AutoComplete, Button, Card, Descriptions, Empty, Form, Input, InputNumber, Splitter, Tree, Tag, TreeSelect, Typography} from 'antd';
3
3
  import React from 'react';
4
4
  import {
5
5
  PermActions,
@@ -168,7 +168,9 @@ export default class extends React.Component {
168
168
  size='small'
169
169
  title={<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}>
170
170
  <Typography.Text strong>字典类型</Typography.Text>
171
- <Button size='small' perm='sys-dict:create' icon={<PlusOutlined/>} onClick={this.handleTypeAdd}>新增类型</Button>
171
+ <PermActions size='small' actions={[
172
+ {label: '新增类型', perm: 'sys-dict:create', icon: <PlusOutlined/>, onClick: this.handleTypeAdd},
173
+ ]}/>
172
174
  </div>}
173
175
  >
174
176
  <Tree
@@ -188,14 +190,16 @@ export default class extends React.Component {
188
190
  <div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8}}>
189
191
  <Typography.Text strong>类型信息</Typography.Text>
190
192
  {hasTypeSelected && (
191
- <span>
192
- <Button size='small' icon={<EditOutlined/>} perm='sys-dict:update'
193
- onClick={this.handleTypeEdit} style={{marginRight: 4}}>编辑</Button>
194
- <Popconfirm perm='sys-dict:delete' title='是否确定删除此类型及其所有子类型和字典项?'
195
- onConfirm={this.handleTypeDelete}>
196
- <Button size='small' icon={<DeleteOutlined/>}>删除</Button>
197
- </Popconfirm>
198
- </span>
193
+ <PermActions size='small' actions={[
194
+ {label: '编辑', perm: 'sys-dict:update', icon: <EditOutlined/>, onClick: this.handleTypeEdit},
195
+ {
196
+ label: '删除',
197
+ perm: 'sys-dict:delete',
198
+ icon: <DeleteOutlined/>,
199
+ confirm: '是否确定删除此类型及其所有子类型和字典项?',
200
+ onClick: this.handleTypeDelete,
201
+ },
202
+ ]}/>
199
203
  )}
200
204
  </div>
201
205
  {hasTypeSelected && <Descriptions size='small' column={3}>
@@ -1,5 +1,5 @@
1
1
  import {DeleteOutlined, EditOutlined, PlusOutlined, SettingOutlined, SyncOutlined} from '@ant-design/icons';
2
- import {Button, Card, Checkbox, Descriptions, Form, Input, InputNumber, Popconfirm, Popover, Space, Spin, Splitter, Switch, Tree, Typography} from 'antd';
2
+ import {Button, Card, Checkbox, Descriptions, Form, Input, InputNumber, Popover, Space, Spin, Splitter, Switch, Tree, Typography} from 'antd';
3
3
  import React from 'react';
4
4
  import {
5
5
  FieldBoolean,
@@ -10,6 +10,7 @@ import {
10
10
  HttpUtils,
11
11
  NamedIcon,
12
12
  Page,
13
+ PermActions,
13
14
  ViewSwitch,
14
15
  } from "../../../framework";
15
16
 
@@ -145,14 +146,16 @@ export default class extends React.Component {
145
146
  <div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8}}>
146
147
  <Typography.Text strong>机构信息</Typography.Text>
147
148
  {selectedOrg && (
148
- <span>
149
- <Button size='small' icon={<EditOutlined/>} perm='sys-org:update'
150
- onClick={this.handleEdit} style={{marginRight: 4}}>编辑</Button>
151
- <Popconfirm perm='sys-org:delete' title='是否确定删除组织机构'
152
- onConfirm={this.handleDelete}>
153
- <Button size='small' icon={<DeleteOutlined/>}>删除</Button>
154
- </Popconfirm>
155
- </span>
149
+ <PermActions size='small' actions={[
150
+ {label: '编辑', perm: 'sys-org:update', icon: <EditOutlined/>, onClick: this.handleEdit},
151
+ {
152
+ label: '删除',
153
+ perm: 'sys-org:delete',
154
+ icon: <DeleteOutlined/>,
155
+ confirm: '是否确定删除组织机构',
156
+ onClick: this.handleDelete,
157
+ },
158
+ ]}/>
156
159
  )}
157
160
  </div>
158
161
  {selectedOrg && (