SystemPermissionInfo.js
12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/* eslint-disable array-callback-return,no-undef */
import React, { Component } from 'react';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Layout, Tabs, Spin, Row, Col, Input } from 'antd-v4';
import styles from '../../index.less';
import selfstyles from './SystemPermissionInfo.less';
import Toolbar from '../Common/ToolBar/ToolBarNew';
import * as commonFunc from '../Common/commonFunc';
import CommonBase from '../Common/CommonBase';
import CommonJurisdictionEvent from '../Common/CommonJurisdictionNewEvent';
import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
import StaticEditTree from '../Common/Tree/StaticTree';
import AntdDraggableModal from '../Common/AntdDraggableModal';
import * as commonUtils from '../../utils/utils';
import ShowType from '../Common/CommonComponent';
const { Header, Content } = Layout;
const { TabPane } = Tabs;
const { Search } = Input;
const FormItem = Form.Item;
class SystemPermissionComponentInfo extends Component {
constructor(props) {
super(props);
this.state = {
};
this.form = {}; /* 表单对象 */
}
onTabChange = (key) => {
this.props.onSaveState({ activeKey: key });
};
render() {
const { pageLoading } = this.props;
return (
<div>
<Spin spinning={pageLoading}>
<div>
<SystemPermissionComponent
{...this.props}
{...this.state}
onTabChange={this.onTabChange}
/>
</div>
</Spin>
</div>
);
}
}
const SystemPermissionComponent = Form.create({
mapPropsToFields(props) {
const { masterData } = props;
const obj = commonFunc.mapPropsToFields(masterData, Form);
return obj;
},
})((props) => {
const {
form, onReturnForm, activeKey, enabled, groupModalVisible, sToGroupConfig, userModalVisible, sToUserConfig, app, masterData,
} = props;
// const tableHeight = (window.innerHeight - 300) / 2;
const groupProps = {
...commonBusiness.getTableTypes('group', props),
tableProps: { rowSelection: null, AutoTableHeight: 330 },
// rowSelectionType: 'radio',
enabled: false,
};
const userGroupProps = {
...commonBusiness.getTableTypes('userGroup', props),
tableProps: { rowSelection: null, AutoTableHeight: 150 },
enabled: false,
};
// const groupUserProps = {
// ...commonBusiness.getTableTypes('groupUser', props),
// tableProps: { rowSelection: null, rowKey: 'sGroupsId', AutoTableHeight: tableHeight },
// enabled: false,
// };
/* 查看用户权限 */
const userProps = {
...commonBusiness.getTableTypes('userView', props),
tableProps: { rowSelection: null, AutoTableHeight: window.innerHeight - 250 },
enabled: false,
};
/* 切换到查看用户权限页签时 Tree不能编辑 */
let treeDisabled = !enabled;
if (props && activeKey) {
if (props.activeKey === '3') {
treeDisabled = true;
} else {
treeDisabled = !enabled;
}
}
const name = 'search';
const treeProps = {
...commonBusiness.getTreeTypes('tree', props),
isSearch: true,
[`${name}Column`]: props[`${name}Column`],
[`${name}Config`]: props[`${name}Config`],
[`${name}Data`]: props[`${name}Data`],
getFloatNum: props.getFloatNum,
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getDateFormat: props.getDateFormat,
onDoubleClick: props.onDoubleClick,
disabled: treeDisabled,
sKeyName: 'key',
};
console.log('treeProps', treeProps);
const sCopyGroup = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'sCopyGroup')) ? commonFunc.showMessage(app.commonConst, 'sCopyGroup') : '复制组权限';/* 复制组权限 */
const sCopyUser = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'sCopyUser')) ? commonFunc.showMessage(app.commonConst, 'sCopyUser') : '复制人员权限';/* 复制组权限 */
/* 回带表单 */
onReturnForm(form);
return (
<Form>
<Layout>
<Header className={styles.header}>
<Toolbar {...props} />
</Header>
<Layout className={selfstyles.clayout} >
<Content className={styles.content}>
<Layout className={styles.clayoutJur} id="SysPermissionList">
<div style={{
width: '100%', height: '2px', borderBottom: '1px solid #d9d9d9', position: 'relative', zIndex: 2, top: '38px',
}}
/>
<Row type="flex" justify="space-between">
<Col span={9} style={{ }}>
<div id="slaveTabs">
<Tabs onChange={props.onTabChange} className={styles.slaveTabs} size="large" tabBarStyle={{ margin: '10 0px' }}>
<TabPane tab="组权限" key={2} >
<Row>
<Search placeholder="查询组权限" allowClear onSearch={props.onSearchGroup} style={{ width: '64%', margin: '10px 1px' }} />
</Row>
<Row>
<Col span={24} key="1" >
<div className="xly-bill-list">
<StaticEditTable {...groupProps} noVlist footer="hidden" />
</div>
</Col>
</Row>
<Row style={{ marginTop: '8px' }}>
<Col span={24} key="2" >
<div className="xly-bill-list">
<StaticEditTable {...userGroupProps} footer="hidden" />
</div>
</Col>
</Row>
</TabPane>
<TabPane tab="查看用户权限" key={3} >
<Row>
<Search placeholder="查询用户权限" allowClear onSearch={props.onSearchUser} style={{ width: '64%', margin: '10px 1px' }} />
</Row>
<Row>
<Col span={24} key="3" >
<div className="xly-bill-list">
<StaticEditTable {...userProps} footer="hidden" />
</div>
</Col>
</Row>
{/* <Row style={{ marginTop: '20px' }}> */}
{/* <Col span={24} key="{userProps.name}Col" > */}
{/* <StaticEditTable {...groupUserProps} footer="hidden" /> */}
{/* </Col> */}
{/* </Row> */}
</TabPane>
</Tabs>
</div>
</Col>
<Col span={15} style={{ marginTop: 40, paddingLeft: '17px' }}>
<Row>
<Col span={24} className="xly-jurisdiction" >
<StaticEditTree {...treeProps} />
</Col>
</Row>
</Col>
</Row>
</Layout>
</Content>
<div>
{
(groupModalVisible) ?
<AntdDraggableModal
title={sCopyGroup}
visible={groupModalVisible}
onOk={props.onCopyGroupModalOk}
onCancel={props.onModalCance.bind(this, 'groupModalVisible')}
width={800}
bodyStyle={{ height: 350, zIndex: 2000 }}
okButtonProps={{ style: { marginRight: '5px' } }}
>
<div className="contextMenuStyle" >
<FormItem className="searchMainForm">
<Row type="flex" style={{ height: 'auto', overflow: 'hidden' }}>
{ commonUtils.isNotEmptyArr(sToGroupConfig) ?
sToGroupConfig.map((child) => {
const sMemo = child.sName.toLowerCase().endsWith('memo');
let enabledNew = !child.bReadonly;
if (child.iTag === 1) {
enabledNew = false;
} else if (child.iTag === 3) {
enabledNew = true;
}
const showTypeProps = {
name: 'slave',
form,
record: {},
sId: commonUtils.createSid(),
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
onChange: props.onChange,
getDateFormat: props.getDateFormat,
showConfig: child,
textArea: sMemo,
enabled: enabledNew,
dataValue: commonUtils.isNotEmptyObject(masterData) ? masterData[child.sName] : '',
bTable: true,
formRoute: props.formRoute,
formItemLayout: {},
};
return (
<Col key={child.sId} span={24} order={child.iOrder} className="ContextMenuCol" style={{ border: '1px solid #d3d3d3' }}>
<ShowType {...showTypeProps} />
</Col>
);
}) : ''
}
</Row>
</FormItem>
</div>
</AntdDraggableModal>
: ''
}
{
(userModalVisible) ?
<AntdDraggableModal
title={sCopyUser}
visible={userModalVisible}
onOk={props.onCopyUserModalOk}
onCancel={props.onModalCance.bind(this, 'userModalVisible')}
width={800}
bodyStyle={{ height: 350, zIndex: 2000 }}
okButtonProps={{ style: { marginRight: '5px' } }}
>
<div className="contextMenuStyle" >
<FormItem className="searchMainForm">
<Row type="flex" style={{ height: 'auto', overflow: 'hidden' }}>
{ commonUtils.isNotEmptyArr(sToUserConfig) ?
sToUserConfig.map((child) => {
const sMemo = child.sName.toLowerCase().endsWith('memo');
let enabledNew = !child.bReadonly;
if (child.iTag === 1) {
enabledNew = false;
} else if (child.iTag === 3) {
enabledNew = true;
}
const showTypeProps = {
name: 'slave',
form,
record: {},
sId: commonUtils.createSid(),
getSqlDropDownData: props.getSqlDropDownData,
getSqlCondition: props.getSqlCondition,
handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
getFloatNum: props.getFloatNum,
onChange: props.onChange,
getDateFormat: props.getDateFormat,
showConfig: child,
textArea: sMemo,
enabled: enabledNew,
dataValue: commonUtils.isNotEmptyObject(masterData) ? masterData[child.sName] : '',
bTable: true,
formRoute: props.formRoute,
formItemLayout: {},
};
return (
<Col key={child.sId} span={24} order={child.iOrder} className="ContextMenuCol" style={{ border: '1px solid #d3d3d3' }}>
<ShowType {...showTypeProps} />
</Col>
);
}) : ''
}
</Row>
</FormItem>
</div>
</AntdDraggableModal>
: ''
}
</div>
</Layout>
</Layout>
</Form>
);
});
export default CommonBase(CommonJurisdictionEvent(SystemPermissionComponentInfo));