@jiangood/open-admin 1.1.1 → 1.2.0

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.
@@ -1,67 +0,0 @@
1
- import React from 'react'
2
- import {HttpUtils, ProTable} from "../../../framework";
3
-
4
-
5
- export default class extends React.Component {
6
-
7
- state = {
8
- formValues: {},
9
- formOpen: false,
10
- selectedRowKeys: []
11
- }
12
-
13
- formRef = React.createRef()
14
- tableRef = React.createRef()
15
-
16
- columns = [
17
-
18
-
19
- {
20
- title: '编码',
21
- dataIndex: 'code',
22
-
23
-
24
- },
25
- {
26
- title: '文本',
27
- dataIndex: 'text',
28
- },
29
-
30
-
31
- ]
32
-
33
-
34
- render() {
35
- return <>
36
- <ProTable
37
- actionRef={this.tableRef}
38
-
39
- request={(params) => HttpUtils.get('admin/sysDict/page', params)}
40
- columns={this.columns}
41
- rowKey='id'
42
-
43
- rowSelection={{
44
- type: 'radio',
45
- selectedRowKeys: this.state.selectedRowKeys,
46
- onChange: (selectedRowKeys, selectedRows) => {
47
- this.setState({selectedRowKeys: selectedRowKeys})
48
- this.props.onChange(selectedRowKeys[0])
49
- }
50
- }}
51
- onRow={(record) => ({
52
- onClick: () => {
53
- this.setState({selectedRowKeys: [record.id]})
54
- this.props.onChange(record.id)
55
- }
56
- })}
57
- />
58
-
59
-
60
- </>
61
-
62
-
63
- }
64
- }
65
-
66
-
67
-
@@ -1,175 +0,0 @@
1
- import {PlusOutlined} from '@ant-design/icons'
2
- import {Button, Col, Form, Input, InputNumber, Modal, Popconfirm, Row, Tag} from 'antd'
3
- import React from 'react'
4
-
5
- import {ButtonList, FieldBoolean, HttpUtils, ProTable} from '../../../framework'
6
-
7
-
8
- export default class extends React.Component {
9
-
10
- state = {
11
- formValues: {},
12
- formOpen: false
13
- }
14
-
15
- formRef = React.createRef()
16
- tableRef = React.createRef()
17
-
18
- componentDidUpdate(prevProps, prevState, snapshot) {
19
- if (prevProps.sysDictId !== this.props.sysDictId) {
20
- this.tableRef.current.reload()
21
- }
22
- }
23
-
24
- handleAdd = () => {
25
- this.setState({formOpen: true, formValues: {}})
26
- }
27
-
28
- handleEdit = record => {
29
- this.setState({formOpen: true, formValues: record})
30
- }
31
-
32
- onFinish = values => {
33
- values.sysDict = {id: this.props.sysDictId}
34
- HttpUtils.post('admin/sysDictItem/save', values).then(rs => {
35
- this.setState({formOpen: false})
36
- this.tableRef.current.reload()
37
- })
38
- }
39
-
40
- handleDelete = row => {
41
- HttpUtils.get('admin/sysDictItem/delete', row).then(rs => {
42
- this.tableRef.current.reload()
43
- })
44
- }
45
-
46
- columns = [
47
- {
48
- title: '文本',
49
- dataIndex: 'text',
50
- },
51
- {
52
- title: '编码',
53
- dataIndex: 'code',
54
- },
55
-
56
- {
57
- title: '启用',
58
- dataIndex: 'enabled',
59
- render(v) {
60
- return v ? '是' : '否'
61
- }
62
-
63
- },
64
- {
65
- title: '显示颜色',
66
- dataIndex: 'color',
67
- render(v) {
68
- return <Tag color={v}>COLOR</Tag>
69
- }
70
- },
71
- {
72
- title: '系统内置',
73
- dataIndex: 'builtin',
74
- render(v) {
75
- return v ? '是' : '否'
76
- }
77
-
78
- },
79
- {
80
- title: '序号',
81
- dataIndex: 'seq',
82
- },
83
- {
84
- title: '操作',
85
- dataIndex: 'option',
86
- render: (_, record) => {
87
-
88
- return (
89
- <ButtonList>
90
- <Button size='small' perm='sysDict:save'
91
- onClick={() => this.handleEdit(record)}> 编辑 </Button>
92
- <Popconfirm perm='sysDict:delete' title='是否确定删除字典项'
93
- onConfirm={() => this.handleDelete(record)}>
94
- <Button size='small'>删除</Button>
95
- </Popconfirm>
96
- </ButtonList>
97
- );
98
- },
99
- },
100
- ]
101
-
102
- render() {
103
- return <>
104
- <ProTable
105
- headerTitle='字典项列表'
106
- actionRef={this.tableRef}
107
- toolBarRender={() => {
108
- return <ButtonList>
109
- <Button perm='sysDictItem:save' type='primary' onClick={this.handleAdd}>
110
- <PlusOutlined/> 新增
111
- </Button>
112
- </ButtonList>
113
- }}
114
- request={(params) => {
115
- params.sysDictId = this.props.sysDictId
116
- return HttpUtils.get('admin/sysDictItem/page', params);
117
- }}
118
- columns={this.columns}
119
- rowKey='id'
120
- search={false}
121
- />
122
-
123
- <Modal
124
- title='编辑数据字典项'
125
- open={this.state.formOpen}
126
- onOk={() => this.formRef.current.submit()}
127
- onCancel={() => this.setState({formOpen: false})}
128
- destroyOnHidden
129
- >
130
-
131
- <Form ref={this.formRef} labelCol={{flex: '100px'}}
132
- initialValues={this.state.formValues}
133
- onFinish={this.onFinish}>
134
- <Form.Item name='id' noStyle></Form.Item>
135
-
136
- <Row>
137
- <Col span={12}>
138
- <Form.Item label='编码' name='code' rules={[{required: true}]}>
139
- <Input/>
140
- </Form.Item>
141
- </Col>
142
- <Col span={12}>
143
- <Form.Item label='文本' name='text' rules={[{required: true}]}>
144
- <Input/>
145
- </Form.Item>
146
- </Col>
147
- </Row>
148
-
149
- <Row>
150
- <Col span={12}>
151
- <Form.Item label='颜色' name='color' rules={[{required: true}]}>
152
- <Input/>
153
- </Form.Item>
154
- </Col>
155
- <Col span={12}>
156
- <Form.Item label='序号' name='seq' rules={[{required: true}]}>
157
- <InputNumber/>
158
- </Form.Item>
159
- </Col>
160
- </Row>
161
-
162
- <Form.Item label='启用' name='enabled' rules={[{required: true}]}>
163
- <FieldBoolean/>
164
- </Form.Item>
165
-
166
- </Form>
167
- </Modal>
168
- </>
169
-
170
-
171
- }
172
- }
173
-
174
-
175
-
@@ -1,16 +0,0 @@
1
- import React from 'react'
2
- import {Button} from "antd";
3
-
4
- export default class extends React.Component {
5
-
6
- render() {
7
- return <div style={{display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
8
- <Button type='primary' href='/ureport/designer'>打开设计器</Button>
9
- </div>
10
- }
11
-
12
-
13
- }
14
-
15
-
16
-