import React, { Component } from 'react';
import st from 'styled-components';
import { connect } from 'dva';
import { withRouter } from 'dva/router';
import {
Input,
Button,
Table,
Select,
Alert,
DatePicker,
notification,
Modal,
Popover
} from 'antd';
import store from 'store';
import tablePage from '../../../../utils/hoc/tablePage';
import columnFun from './columns';
import SubDrawer from './SubDrawer';
import { getConfigBayzgzSb } from '../../../../services/api';
import '../../declaration.less';
import moment from 'moment';
const { RangePicker } = DatePicker;
const { Option } = Select;
const dateFormat = 'YYYY-MM-DD';
@connect(state => ({
global: state.global,
companyInfo: state.global.companyInfo
}))
@tablePage({ type: 'bkt' })
@withRouter
export default class Submitted extends Component {
constructor(props, context) {
super(props, context);
this.state = {
//抽屉
drawerVisble: false,
personApplyId: '', //当前选中的id
dataListAreaCode: '',//表格数据属于哪个区域
isNanNiCode:false,//是否是南宁地区码
};
}
/**
* 6106是陕西的
* 后面又增加南宁的特殊字段需求,往下传isNanNiCode值,在非陕西的页面中做判断
*/
checkAreaCode() {
return this.state.dataListAreaCode && this.state.dataListAreaCode.indexOf('6106') == 0
}
// 判断是否是北京地区(北京地区隐藏劳动合同、户籍类型、户籍所在地三个字段)
checkBeijinCode() {
let regProvince = String(this.props.companyInfo.regProvince);
return regProvince && regProvince.indexOf('110') == 0
}
// 判断是否为商洛地区
checkSRAreaCode = () => {
let regCity = String(this.props.companyInfo.regCity);
return regCity && regCity.indexOf('611000') == 0
}
componentDidMount() {
this.__getConfigBayzgzSb();
}
//获取保安员指南
__getConfigBayzgzSb() {
getConfigBayzgzSb().then(
res => {
if (res.retType === '0') {
this.setState({
declareNotice: res.data.declareNotice
})
}
}
)
}
// 表格渲染
_renderList = () => {
const columns = columnFun.call(this);
if (this.checkAreaCode()) {
columns.splice(
7, 0,
{
title: '指纹状态',
dataIndex: 'fingerprintStatus',
key: 'fingerprintStatus',
render: value => {
let text = '查询中';
let color = '';
switch (true) {
case value == '0':
text = '查询中';
color = '#F59A23';
break;
case value == '1':
text = '已录入';
color = '#4B7902';
break;
case value == '2':
text = '未录入';
color = '#D9001B';
break;
}
return (
{text}
);
}
},
)
columns.splice(
9, 0,
{
title: '缴费金额(元)',
dataIndex: 'payAmount',
key: 'payAmount',
render: value => value || '-'
},
)
}
const { PageTable, isInit } = this.props;
if (!isInit) return;
return (
{
this.setState({
dataListAreaCode: data.userData? data.userData.areaCode:'',
isNanNiCode: data.userData? data.userData.areaCode.indexOf('4501') == 0 : false,
})
}}
/>
);
};
render() {
const { SearchForm, Form } = this.props;
const { getFieldDecorator } = this.props.form;
return (
}
type="warning"
showIcon
style={{ marginBottom: '15px' }}
/>
{/* */}
{
// values
const { date, examDate,confirmDate } = values;
// 报名时间
console.log(date, 'date');
if (date.length == 2) {
values.applyStartDate = moment(date[0]).format(dateFormat);
values.applyEndDate = moment(date[1]).format(dateFormat);
} else {
values.applyStartDate = '';
values.applyEndDate = '';
}
if (examDate.length == 2) {
values.examStartDate = moment(examDate[0]).format(dateFormat);
values.examEndDate = moment(examDate[1]).format(dateFormat);
} else {
values.examStartDate = '';
values.examEndDate = '';
}
// 确认成绩时间
if (confirmDate.length == 2) {
values.confirmStartDate = moment(confirmDate[0]).format(dateFormat);
values.confirmEndDate = moment(confirmDate[1]).format(dateFormat);
} else {
values.confirmStartDate = '';
values.confirmEndDate = '';
}
Reflect.deleteProperty(values, 'date');
Reflect.deleteProperty(values, 'examDate');
Reflect.deleteProperty(values, 'confirmDate');
return values;
}}
>
<>
{getFieldDecorator('keyword', {
initialValue: ''
})(
)}
{getFieldDecorator('applyStatus', {
initialValue: ''
})(
)}
{getFieldDecorator('backgroundStatus', {
initialValue: ''
})(
)}
{getFieldDecorator('organName', {
initialValue: ''
})(
)}
{getFieldDecorator('orderStatus', {
initialValue: ''
})(
)}
{getFieldDecorator('materialApproveStatus', {
initialValue: ''
})(
)}
{getFieldDecorator('date', {
initialValue: []
})(
)}
{getFieldDecorator('trackLearnStatus', {
initialValue: ''
})(
)}
{getFieldDecorator('departName', {
initialValue: ''
})(
)}
{getFieldDecorator('testState', {
initialValue: ''
})(
)}
{getFieldDecorator('examDate', {
initialValue: []
})(
)}
{getFieldDecorator('trackName', {
initialValue: ''
})(
)}
{getFieldDecorator('confirmDate', {
initialValue: []
})(
)}
{
this.checkAreaCode()&&<>
{getFieldDecorator('fingerprintStatus', {
initialValue: ''
})(
)}
{getFieldDecorator('payAmount', {
initialValue: ''
})(
)}
>
}
>
{this.checkBeijinCode()?'':
}
{/* */}
{/* 表格 */}
{this._renderList()}
{/* 修改弹窗 */}
{
this.setState({
personApplyId: ''
});
}}
/>
);
}
}
const Btns = st.div`
margin-top: 15px;
button {
margin-right: 15px;
}
`;