|
@@ -31,48 +31,49 @@ const toEditStaff = (userId) => () => {
|
31
|
31
|
*/
|
32
|
32
|
const CartBody = (props) => {
|
33
|
33
|
const { data } = props
|
|
34
|
+ // console.log("data11:", data)
|
34
|
35
|
|
35
|
36
|
const confirm = (data) => () => {
|
36
|
|
- console.log(data,"11111")
|
37
|
|
- if(data.status === 1){
|
|
37
|
+ // console.log(data, "11111")
|
|
38
|
+ if (data.status === 1) {
|
38
|
39
|
Modal.confirm({
|
39
|
40
|
title: '确认停用该角色?',
|
40
|
41
|
okText: '确认',
|
41
|
42
|
cancelText: '取消',
|
42
|
|
- onOk() {
|
43
|
|
- request({ ...apis.staff.change, urlData: {id:data.userId,type:'off'}}).then((data) => {
|
|
43
|
+ onOk () {
|
|
44
|
+ request({ ...apis.staff.change, urlData: { id: data.userId, type: 'off' } }).then((data) => {
|
44
|
45
|
message.info("操作成功")
|
45
|
46
|
props.onFresh()
|
46
|
47
|
})
|
47
|
48
|
}
|
48
|
49
|
});
|
49
|
|
- }else{
|
|
50
|
+ } else {
|
50
|
51
|
Modal.confirm({
|
51
|
52
|
title: '确认启用该角色?',
|
52
|
53
|
okText: '确认',
|
53
|
54
|
cancelText: '取消',
|
54
|
|
- onOk() {
|
55
|
|
- request({ ...apis.staff.change, urlData: {id:data.userId,type:'on'}}).then((data) => {
|
|
55
|
+ onOk () {
|
|
56
|
+ request({ ...apis.staff.change, urlData: { id: data.userId, type: 'on' } }).then((data) => {
|
56
|
57
|
message.info("操作成功")
|
57
|
58
|
props.onFresh()
|
58
|
59
|
})
|
59
|
60
|
}
|
60
|
61
|
});
|
61
|
62
|
}
|
62
|
|
-
|
|
63
|
+
|
63
|
64
|
}
|
64
|
65
|
return (
|
65
|
66
|
|
66
|
67
|
<Card className={Styles.card}>
|
67
|
68
|
<div>
|
68
|
69
|
<Avatar src={data.photo} style={{ width: '0.48rem', height: '0.48rem' }} />
|
69
|
|
- <Button type="link" style={{color: '#FF925C', fontSize: '0.106rem',position: 'absolute', top: '40px', left: '0.56rem' }} onClick={toEditStaff(data.userId)}>
|
|
70
|
+ <Button type="link" style={{ color: '#FF925C', fontSize: '0.106rem', position: 'absolute', top: '40px', left: '0.56rem' }} onClick={toEditStaff(data.userId)}>
|
70
|
71
|
编辑
|
71
|
72
|
<Icon type="form" style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
|
72
|
73
|
</Button>
|
73
|
74
|
<Button type="link" style={{ fontSize: ' 0.106rem', color: '#cacaca', position: 'absolute', top: '40px', right: '0' }} onClick={confirm(data)}>
|
74
|
75
|
{data.status === 1 ? '停用' : '启用'}
|
75
|
|
- <Icon type={data.status===1?'close-circle':'form'} style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
|
|
76
|
+ <Icon type={data.status === 1 ? 'close-circle' : 'form'} style={{ color: '#C0C4CC', marginLeft: '0.04rem' }} />
|
76
|
77
|
</Button>
|
77
|
78
|
{/* <Button type="link" style={{ fontSize: ' 0.106rem', color: '#FF925C', position: 'absolute', top: '50px', right: '0' }} onClick={confirm}>
|
78
|
79
|
启用
|
|
@@ -105,13 +106,15 @@ const CartBody = (props) => {
|
105
|
106
|
const header = (props) => {
|
106
|
107
|
const [tempData, setTempData] = useState([])
|
107
|
108
|
const [pageTotal, setPageTotal] = useState('')
|
|
109
|
+ const [data,setData] = useState({})
|
108
|
110
|
useEffect(() => {
|
109
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
|
111
|
+ getList({ pageNum: 1, pageSize: 8 });
|
110
|
112
|
}, [])
|
111
|
113
|
|
112
|
114
|
const getList = (params) => {
|
113
|
115
|
request({ ...apis.staff.taUser, params: { ...params } }).then((data) => {
|
114
|
116
|
console.log(data, "listData")
|
|
117
|
+ setData(data)
|
115
|
118
|
setTempData(data.records)
|
116
|
119
|
setPageTotal(data.total)
|
117
|
120
|
})
|
|
@@ -119,7 +122,7 @@ const header = (props) => {
|
119
|
122
|
|
120
|
123
|
// 分页
|
121
|
124
|
const onChange = (pageNumber) => {
|
122
|
|
- getList({ pageNum: pageNumber, pageSize: 10 });
|
|
125
|
+ getList({ pageNum: pageNumber, pageSize: 8 });
|
123
|
126
|
}
|
124
|
127
|
|
125
|
128
|
// 提交事件
|
|
@@ -128,13 +131,13 @@ const header = (props) => {
|
128
|
131
|
props.form.validateFields((err, values) => {
|
129
|
132
|
if (!err) {
|
130
|
133
|
console.log('提交数据: ', values)
|
131
|
|
- getList({ pageNum: 1, pageSize: 10, ...values })
|
|
134
|
+ getList({ pageNum: 1, pageSize: 8, ...values })
|
132
|
135
|
}
|
133
|
136
|
});
|
134
|
137
|
}
|
135
|
138
|
|
136
|
|
- //重置搜索
|
137
|
|
- function handleReset() {
|
|
139
|
+ //重置搜索
|
|
140
|
+ function handleReset () {
|
138
|
141
|
props.form.resetFields();
|
139
|
142
|
}
|
140
|
143
|
|
|
@@ -184,9 +187,9 @@ const header = (props) => {
|
184
|
187
|
<Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
185
|
188
|
搜索
|
186
|
189
|
</Button>
|
187
|
|
-
|
188
|
|
- <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
189
|
|
- 重置
|
|
190
|
+
|
|
191
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
192
|
+ 重置
|
190
|
193
|
</Button>
|
191
|
194
|
</Form.Item>
|
192
|
195
|
</Form>
|
|
@@ -195,7 +198,7 @@ const header = (props) => {
|
195
|
198
|
{
|
196
|
199
|
tempData.map((item, index) => (
|
197
|
200
|
<Col span={6}>
|
198
|
|
- <CartBody data={item} onFresh={()=> getList({ pageNum: 1, pageSize: 10 })}/>
|
|
201
|
+ <CartBody data={item} onFresh={() => getList({ pageNum: 1, pageSize: 8 })} />
|
199
|
202
|
</Col>
|
200
|
203
|
))
|
201
|
204
|
}
|
|
@@ -203,7 +206,7 @@ const header = (props) => {
|
203
|
206
|
|
204
|
207
|
{/* 分页 */}
|
205
|
208
|
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
206
|
|
- <Pagination showQuickJumper defaultCurrent={1} total={pageTotal} onChange={onChange} current={data.current}/>
|
|
209
|
+ <Pagination showQuickJumper defaultCurrent={1} pageSize={8} total={pageTotal} onChange={onChange} current={data.current}/>
|
207
|
210
|
</div>
|
208
|
211
|
</>
|
209
|
212
|
)
|