NailApproval.js
14.7 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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Table, Button, Modal, Row, Col, Switch, Popconfirm, Icon } from 'antd'
import { required, maxLength, allNumber } from '../../components/widget/reduxForm/validate'
import { Field, reduxForm, change, reset, formValueSelector, getFormValues, initialize, submit, FieldArray } from 'redux-form'
import BreadcrumbWarp from '../../components/commondComponents/newBreadcrumbWarp'
import InputField from '../../components/widget/reduxForm/InputField'
import NoDataNew from '../../components/widget/prompt/NoDataNew'
import { sortData } from '../../utils/commonUtils'
import cx from 'classnames'
import s from '../employee/employee.les'
import SearchForm from '../../components/widget/reduxForm/SearchForm'
import SearchInputGroupWrap from '../../components/widget/reduxForm/SearchInputGroupWrap'
import SearchFormInputField from '../../components/widget/reduxForm/SearchFormInputField'
import PaginationWrap from '../../components/widget/reduxForm/PaginationWrap'
import NoData from '../../components/widget/prompt/NoData'
import {
loadNailApprovalListAction, loadNailApprovalDetailAction
} from '../../redux/actions/recruit'
import {
selectCompanyList
} from '../../redux/actions/amoeba'
import x from '../salary/financial.les';
import moment from 'moment';
const crumbsData = [
{ name: '钉钉审批流程', link: 'javascript:;', isLink: false },
{ name: '审批列表', link: '#/container/customer', isLink: true }
]
const fieldTypeOptions = [
{ 'id': 'text', "name": '文本' },
{ 'id': 'number', "name": '数值' },
{ 'id': 'date', "name": '日期' },
{ 'id': 'range', "name": '时间段' },
{ 'id': 'select', "name": '下拉列表' }
]
const statusOption = [
{ 'id': 'RUNNING', 'name': '审核中' },
{ 'id': 'COMPLETED', 'name': '已同意' },
{ 'id': 'TERMINATED', 'name': '已拒绝' },
]
const categoryOptions = [
{ 'id': '客户', 'name': '客户' },
{ 'id': '客户-共享', 'name': '客户-共享' },
{ 'id': '客户-公共池申领', 'name': '客户-公共池申领' },
{ 'id': '服务合同', 'name': '服务合同' },
{ 'id': '服务合同-合同新增', 'name': '服务合同-合同新增' },
{ 'id': '服务合同-合同续签', 'name': '服务合同-合同续签' },
{ 'id': '服务合同-合同规则', 'name': '服务合同-合同规则' },
{ 'id': '服务合同-协议审批', 'name': '服务合同-协议审批' },
{ 'id': '服务合同-终止合同', 'name': '服务合同-终止合同' },
{ 'id': '返利', 'name': '返利' },
{ 'id': '返利-规则添加', 'name': '返利-规则添加' },
{ 'id': '返利-返利单提交', 'name': '返利-返利单提交' },
{ 'id': '开票-垫款', 'name': '开票-垫款' }
]
class NailApproval extends Component {
constructor(props) {
super(props)
this.searchGrid = this.searchGrid.bind(this)
this.renderDetailModal = this.renderDetailModal.bind(this)
this.linkBackDetail = this.linkBackDetail.bind(this)
this.state = {
showDetail: false
}
}
componentDidMount() {
const { dispatch } = this.props
dispatch(loadNailApprovalListAction(`?offset=0&limit=10`))
dispatch(selectCompanyList())
}
searchGrid(values) {
const { dispatch } = this.props;
let params = [];
if (values.offset) {
params.push(`?offset=${values.offset}`)
} else {
params.push(`?offset=0`)
}
if (values.limit) {
params.push(`&limit=${values.limit}`)
}
if (values.category) {
params.push(`&category=${values.category}`)
}
if (values.status) {
params.push(`&status=${values.status}`)
}
if (values.belong_org_id) {
params.push(`&belong_org_id=${values.belong_org_id}`)
}
if (values.apply_at) {
params.push(`&apply_at=${values.apply_at}`)
}
dispatch(loadNailApprovalListAction(params.join('')))
}
columnWidth(arr) {
let num = 0;
arr.map(cl => {
num += cl.width
})
return num
}
lookDetail(r) {
const { dispatch, change } = this.props;
this.setState({
showDetail: true,
nail_record: r
})
dispatch(loadNailApprovalDetailAction(r.process_instance_id))
}
getColumns() {
return [
{
title: '项目类型',
dataIndex: 'category',
key: 'category',
width: 160,
}, {
title: '明细',
dataIndex: 'Name',
key: 'Name',
width: 160,
}, {
title: '审批状态',
dataIndex: 'status',
key: 'status',
width: 120,
render: (t, r) => {
return (
<span>
{
t == 'AUDITING' ? '待审核' :
t == 'RUNNING' ? '审核中' :
t == 'COMPLETED' ? '已同意' :
t == 'TERMINATED' ? '已拒绝' :
null
}
</span>
)
}
}, {
title: '阿米巴',
dataIndex: 'belong_org',
key: 'belong_org',
width: 140,
}, {
title: '审批人',
dataIndex: 'approvers',
key: 'approvers',
width: 120,
}, {
title: '备注',
dataIndex: 'comment',
key: 'comment',
width: 200,
}, {
title: '申请人',
dataIndex: 'apply_by',
key: 'apply_by',
width: 120,
}, {
title: '申请时间',
dataIndex: 'apply_at',
key: 'apply_at',
width: 160,
render: (t, r) => {
return (
<span>{moment(t * 1000).format('YYYY-MM-DD HH:mm')}</span>
)
}
}, {
title: '申请理由',
dataIndex: 'apply_for',
key: 'apply_for',
width: 180,
}, {
title: '操作',
dataIndex: 'opt',
key: 'opt',
width: 120,
render: (t, r) => {
return (
<a onClick={this.lookDetail.bind(this, r)}>审批记录</a>
)
}
},
]
}
linkBackDetail() {
this.setState({
showDetail: false
})
}
renderDetailModal() {
const { nail_approval_detail = {} } = this.props;
const { nail_record } = this.state
return (
<div className={cx(x.detail_warp_f)}>
<b className={cx(x.detail_warp_opacity)}></b>
<div className={cx(x.detail_modal_select)}>
<div className={cx(x.detail_warp)}>
<div className={cx(x.text_title)} style={{ width: '60px' }} onClick={this.linkBackDetail}><Icon type="left-circle" style={{ fontSize: '17px', marginRight: '8px' }} />返回</div>
<div className={cx(x.detail_text_warp)}>
<Row className={cx(x.detail_text)}>
<Col span={13} >
<span className={cx(s.title)}>申请人:</span>
<span className={cx(s.data)}>{nail_approval_detail && nail_approval_detail.user_name}</span>
</Col>
<Col span={13} >
<span className={cx(s.title)}>状态:</span>
<span className={cx(s.data)}>{nail_approval_detail && nail_approval_detail.status == 'COMPLETED' ? '已同意' : nail_approval_detail.status == 'RUNNING' ? '审核中' : nail_approval_detail.status == 'TERMINATED' ? '已拒绝' : null}</span>
</Col>
<Col span={13} >
<span className={cx(s.title)}>申请时间:</span>
<span className={cx(s.data)}>{nail_approval_detail && nail_approval_detail.create_time}</span>
</Col>
<Col span={13} >
<span className={cx(s.title)}>审批类型:</span>
<span className={cx(s.data)}>{nail_record && nail_record.category}</span>
</Col>
<Col span={13} >
<span className={cx(s.title)}>审批内容:</span>
<span className={cx(s.data)}>{nail_approval_detail && nail_approval_detail.title}</span>
</Col>
{
nail_approval_detail && nail_approval_detail.operation_records && nail_approval_detail.operation_records.length > 0 && nail_approval_detail.operation_records.map(cl => {
return (
<Col span={24} >
<Row>
<Col span={12}>
<span className={cx(x.title)}>{cl.user}({cl.operation_result == 'AGREE' ? '已同意' : cl.operation_result == 'REFUSE' ? '已拒绝' : null})</span>
{/* <span className={cx(s.data)}>{nail_approval_detail&&nail_approval_detail.title}</span> */}
</Col>
<Col span={12}>
<span className={cx(x.title)}>{cl.date}</span>
</Col>
</Row>
<div className={s.divider_line}></div>
</Col>
)
})
}
</Row>
</div>
</div>
</div>
</div>
)
}
render() {
const { nail_approval_list = [], departmentName, admin_orgs, nail_approval_detail = {} } = this.props;
const { showDetail } = this.state;
return (
<div>
<div style={{ marginBottom: '20px' }}>
<BreadcrumbWarp crumbsData={crumbsData} />
</div>
<div style={{ padding: '0 20px' }}>
<SearchForm
formName='nail_approval_search_form'
enableKeys={[]}
ref="role_search_form"
search={this.searchGrid}
>
<SearchInputGroupWrap>
<div>
<SearchFormInputField
label='审批类型'
name='category'
type="select"
placeholder={`请选择审批类型`}
inputStyle={{ width: '100%' }}
options={categoryOptions}
/>
</div>
<div>
<SearchFormInputField
label='状态'
name='status'
type="select"
placeholder={`请选择状态`}
inputStyle={{ width: '100%' }}
options={statusOption}
/>
</div>
<div>
<SearchFormInputField
label={departmentName}
name='belong_org_id'
type="select"
placeholder={`请选择${departmentName}`}
inputStyle={{ width: '100%' }}
options={admin_orgs}
/>
</div>
<div>
<SearchFormInputField
label='申请时间'
name='apply_at'
type="date"
unix
inputStyle={{ width: '100%' }}
/>
</div>
</SearchInputGroupWrap>
{
nail_approval_list && nail_approval_list.length > 0 ? <div className='resetTableStyleWrap'>
<Table pagination={false} dataSource={nail_approval_list} scroll={{ x: this.columnWidth(this.getColumns()) }} columns={this.getColumns()} />
<PaginationWrap style={{ marginTop: '20px' }} formName='nail_approval_search_form' onChange={this.searchGrid} />
</div> : <NoData />
}
</SearchForm>
</div>
{
showDetail && this.renderDetailModal()
}
</div>
)
}
}
const submitForm = (values, dispatch, props) => {
}
const selector = formValueSelector('nail_approval_form')
NailApproval = reduxForm({
form: 'nail_approval_form',
onSubmit: submitForm,
})(NailApproval)
const mapState = (state) => {
const {
recruit: { nail_approval_list, nail_approval_detail },
custome: { departmentName },
amoeba: { admin_orgs }
} = state
return {
nail_approval_list,
departmentName,
admin_orgs,
nail_approval_detail
}
}
export default connect(mapState)(NailApproval)