|
@@ -0,0 +1,260 @@
|
|
|
+import React, { Component } from 'react';
|
|
|
+import { connect } from 'dva';
|
|
|
+import { Card, Modal, Form, Tag } from 'antd';
|
|
|
+import { StandardTableList } from '../../../components/AXList';
|
|
|
+import { addRowKey } from '../../../utils/utils';
|
|
|
+import styles from './AccountsDidLabelList.less';
|
|
|
+import AXRemoteSelect from '../../../components/AXRemoteSelect';
|
|
|
+
|
|
|
+const formItemLayout = {
|
|
|
+ labelCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 7 },
|
|
|
+ },
|
|
|
+ wrapperCol: {
|
|
|
+ xs: { span: 24 },
|
|
|
+ sm: { span: 15 },
|
|
|
+ md: { span: 13 },
|
|
|
+ },
|
|
|
+};
|
|
|
+function arrayDataFormatter(data) {
|
|
|
+ return data.map((item) => {
|
|
|
+ return {
|
|
|
+ text: item.name,
|
|
|
+ value: `${item.name}||${item.id}`,
|
|
|
+ };
|
|
|
+ });
|
|
|
+}
|
|
|
+@Form.create()
|
|
|
+@connect(({ loading, accounts, campus }) => ({
|
|
|
+ accounts,
|
|
|
+ campus,
|
|
|
+ loading: loading.models.accounts,
|
|
|
+ fetching: loading.models.campus,
|
|
|
+}))
|
|
|
+
|
|
|
+export default class NewListAccountsPage extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ const { state } = props.location;
|
|
|
+ this.state = {
|
|
|
+ UIParams: (state || {}).UIParams,
|
|
|
+ Queryers: (state || {}).Queryers,
|
|
|
+ campuses: (state || {}).campuses || [],
|
|
|
+ filterModalDestroy: true,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ componentWillMount() {
|
|
|
+ const { campuses } = this.state;
|
|
|
+ let campusId;
|
|
|
+ if (campuses && campuses.length) {
|
|
|
+ campusId = campuses[0].split('||')[1];
|
|
|
+ }
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchCampusAmount',
|
|
|
+ payload: {},
|
|
|
+ });
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchTerminalsAmount',
|
|
|
+ payload: {},
|
|
|
+ });
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchDidLabelList',
|
|
|
+ payload: {
|
|
|
+ campusId,
|
|
|
+ ...this.state.Queryers,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchDidLabelList',
|
|
|
+ payload: { ...this.state.Queryers },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ handleFilterOperation = (params, states) => {
|
|
|
+ this.setState({
|
|
|
+ UIParams: states,
|
|
|
+ Queryers: params,
|
|
|
+ });
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchDidLabelList',
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ payload: { ...this.state.Queryers },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ handleFilterModalShow = () => {
|
|
|
+ this.setState({ filterModalDestroy: false });
|
|
|
+ };
|
|
|
+ handleFilterModalDestroy = () => {
|
|
|
+ this.setState({ filterModalDestroy: true });
|
|
|
+ };
|
|
|
+ handleModalFilterOperation = () => {
|
|
|
+ const { getFieldsValue } = this.props.form;
|
|
|
+ const { campuses } = getFieldsValue();
|
|
|
+ let campusId;
|
|
|
+ if (campuses && campuses.length) {
|
|
|
+ campusId = campuses[0].split('||')[1];
|
|
|
+ }
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchDidLabelList',
|
|
|
+ payload: {
|
|
|
+ campusId,
|
|
|
+ ...this.state.Queryers,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.handleFilterModalDestroy();
|
|
|
+ this.setState({ campuses });
|
|
|
+ };
|
|
|
+
|
|
|
+ handleDownloadOperation = () => {
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'accounts/fetchDidLabelExcel',
|
|
|
+ });
|
|
|
+ };
|
|
|
+ handleTerminalsRemoteSelectSearch = (value) => {
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'campus/fetchCampusList',
|
|
|
+ payload: {
|
|
|
+ pageSize: 50,
|
|
|
+ name: value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+ render() {
|
|
|
+ const { campuses } = this.state;
|
|
|
+ const { loading, accounts, fetching, campus, form } = this.props;
|
|
|
+
|
|
|
+ const { list, totalSize, pageSize, pageNo } = accounts;
|
|
|
+ const { getFieldDecorator } = form;
|
|
|
+ const basicSearch = {
|
|
|
+ keys: [
|
|
|
+ {
|
|
|
+ name: '终端编号',
|
|
|
+ field: 'code',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ const pagination = {
|
|
|
+ pageNo,
|
|
|
+ pageSize,
|
|
|
+ totalSize,
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const columns = [{
|
|
|
+ title: '校区名称',
|
|
|
+ key: 1,
|
|
|
+ dataIndex: 'cname',
|
|
|
+ width: '20%',
|
|
|
+ }, {
|
|
|
+ title: '终端编号',
|
|
|
+ key: 2,
|
|
|
+ dataIndex: 'ucode',
|
|
|
+ width: '20%',
|
|
|
+ }, {
|
|
|
+ title: '终端名称',
|
|
|
+ key: 3,
|
|
|
+ dataIndex: 'uname',
|
|
|
+ width: '20%',
|
|
|
+ }, {
|
|
|
+ title: '标签',
|
|
|
+ key: 4,
|
|
|
+ dataIndex: 'userTags',
|
|
|
+ render: (userTags = []) => (
|
|
|
+ <span>
|
|
|
+ {[...new Set(userTags)].map(tag => <Tag key={tag} className={styles.label}>{tag}</Tag>)}
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ width: '40%',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ return (
|
|
|
+ <Card>
|
|
|
+ <StandardTableList
|
|
|
+ columns={columns}
|
|
|
+ loading={loading}
|
|
|
+ dataSource={addRowKey(list)}
|
|
|
+ header={{
|
|
|
+ basicSearch,
|
|
|
+ onAdvanceFilterClick: this.handleFilterModalShow,
|
|
|
+ onFilterClick: this.handleFilterOperation,
|
|
|
+ onDownload: this.handleDownloadOperation,
|
|
|
+ }}
|
|
|
+ footer={{
|
|
|
+ pagination,
|
|
|
+ }}
|
|
|
+ keepUIState={{ ...this.state.UIParams }}
|
|
|
+ showStatusSelect={false}
|
|
|
+ />
|
|
|
+ {!this.state.filterModalDestroy && (
|
|
|
+ <Modal
|
|
|
+ width={600}
|
|
|
+ visible
|
|
|
+ title="高级筛选"
|
|
|
+ okText="筛选"
|
|
|
+ cancelText="取消"
|
|
|
+ maskClosable={false}
|
|
|
+ onCancel={this.handleFilterModalDestroy}
|
|
|
+ onOk={this.handleModalFilterOperation}
|
|
|
+ >
|
|
|
+ <Form>
|
|
|
+ <Form.Item label="所属校区" {...formItemLayout}>
|
|
|
+ {getFieldDecorator('campuses', {
|
|
|
+ initialValue: campuses,
|
|
|
+ })(
|
|
|
+ <AXRemoteSelect
|
|
|
+ fetching={fetching}
|
|
|
+ dataSource={arrayDataFormatter(campus.list)}
|
|
|
+ onSearch={this.handleTerminalsRemoteSelectSearch}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
+ )}
|
|
|
+ </Card>
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|