Commit 2e104c6c authored by cellee's avatar cellee

Merge branch 'final' of http://120.77.240.215:9701/Maple/tostumi.git into final

parents 4db7a0b1 182173d4
import React, { useState, useEffect, useRef } from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import React, { useState, useEffect } from 'react';
import { connect } from 'umi';
import { SearchOutlined } from '@ant-design/icons';
......@@ -7,7 +7,6 @@ import { Input, Row, Col, Form, Select, Button, DatePicker } from 'antd';
const { Option } = Select;
import SelectOptions from '../../components/SelectOptions/index';
import { gray } from 'chalk';
import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity';
const TitleSearch = (props: any) => {
......@@ -28,10 +27,12 @@ const TitleSearch = (props: any) => {
const name = props.list;
const community = props.community;
const [selectOptions, setSelectOptions] = useState(true);
// const [selectOptions, setSelectOptions] = useState(true);
const [communitys, setCommunitys] = useState(CommunityList);
const [datePicker, setDate] = useState(null as any);
const [defalueName, setDefalueName] = useState(undefined);
const [form] = Form.useForm();
const tosCommunityget = (values: any) => {
......@@ -51,6 +52,7 @@ const TitleSearch = (props: any) => {
useEffect(() => {
if (defaultValue != null) {
form.setFieldsValue(defaultValue);
setDefalueName(defaultValue.communityName);
}
}, [defaultValue]);
......@@ -93,14 +95,14 @@ const TitleSearch = (props: any) => {
});
};
// 小区默认值
const communityDef = () => {
if (defaultValue != null && defaultValue.communityName) {
return defaultValue.communityName;
} else {
return undefined;
}
};
// // 小区默认值
// const communityDef = () => {
// if (defaultValue != null && defaultValue.communityName) {
// return defaultValue.communityName;
// } else {
// return undefined;
// }
// };
return (
<>
......@@ -110,7 +112,7 @@ const TitleSearch = (props: any) => {
<Col key={'communitySelect_'}>
<Form.Item name={'communityName'}>
<SearchOptionsCommnity
defaultName={communityDef}
defaultName={defalueName}
titleSearch={true}
opname={opname}
/>
......@@ -118,7 +120,7 @@ const TitleSearch = (props: any) => {
</Col>
) : null}
{key != null
? key.map((item, index) => {
? key.map((item: string, index: number) => {
return (
<Col key={'KeyCol_' + index}>
<Form.Item name={item}>
......@@ -139,7 +141,7 @@ const TitleSearch = (props: any) => {
) : null}
{status != null
? status.map((item, index) => {
? status.map((item: { name: string; data: Array<''> }, index: number) => {
return (
<Col key={'StatusCol_' + index}>
<Form.Item name={item.name[0]}>
......@@ -180,7 +182,7 @@ const TitleSearch = (props: any) => {
checklist={checklist}
single={single}
list={CommunityList.sort()}
show={selectOptions}
show={true}
onSubmit={printContent}
/>
) : null}
......
......@@ -55,12 +55,16 @@ const Model: LoginModelType = {
effects: {
*login({ payload }, { call, put }) {
const response = yield call(AccountLogin, payload);
yield put({
type: 'changeLoginStatus',
payload: response,
});
// Login successfully response.status === 'ok'
if (response.token != null) {
if (response.status === 'resetPwd') {
// if () {
// }
} else if (response.status === 'ok' && response.token != null) {
yield put({
type: 'changeLoginStatus',
payload: response,
});
// Login successfully response.status === 'ok'
console.log('用户名密码登录成功');
console.log(response);
const userMessage = yield call(AccountCheckLogin, payload); //请求时间网络
......@@ -95,7 +99,6 @@ const Model: LoginModelType = {
}
history.replace(redirect || '/');
} else {
console.error(response);
message.error('Login Error! Username or Password is wrong!', 3);
}
},
......
......@@ -152,8 +152,8 @@ const Card = (props: any) => {
dataSource={Data7 !== null ? Data7.data.list : []}
columns={columns}
pagination={{
defaultCurrent: readyData.pageNum,
defaultPageSize: 15,
current: readyData.pageNum,
pageSize: Data7 !== null ? Data7.data.page.curPageSize : 15,
total: Data7 !== null ? Data7.data.page.totalRow : null,
showSizeChanger: false,
}}
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Spin, Result, message, Upload, Button, Table, Space } from 'antd';
import { Spin, message, Upload, Button, Table, Space } from 'antd';
import { UploadOutlined, LoadingOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { useIntl, connect, history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch';
import { timestampToTime } from '../../../utils/time';
import {
PAGE,
RA,
URLCLEAR,
getCookie,
DataClear,
URL,
filterObjbyTg,
urlEncode,
filterObj,
} from '@/utils/method';
import PageData from '@/models/Common/PageData';
import { RA, getCookie, URL, filterObjbyTg, urlEncode, filterObj } from '@/utils/method';
console.log('检查是否有权限');
const module = 'User';
const module2 = 'History';
const module3 = 'PageData';
// const string2mean = [[0, "未注册"], [1, "注册"], [2, "注销"]]
const string2mean = [
......@@ -48,7 +35,7 @@ let flag: boolean = false;
const Users = (props: any) => {
const permissionArr = JSON.parse(localStorage.getItem('permission') || '');
const { formatMessage } = useIntl();
const { dispatch, location, Data, CommunityList, pageData, history_url } = props;
const { dispatch, location, Data, CommunityList } = props;
const SA = (values: any) => {
dispatch({ type: 'User/SA', playload: values });
};
......@@ -87,10 +74,17 @@ const Users = (props: any) => {
title: actions,
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={goToEdit.bind(this, record)} disabled={record.enable == 2 ? true : false}>
<Button
type="link"
size="small"
onClick={goToEdit.bind(this, record)}
disabled={record.enable == 2 ? true : false}
>
Edit
</a>
<a onClick={goToDetail.bind(this, record)}>Detail</a>
</Button>
<Button type="link" size="small" onClick={goToDetail.bind(this, record)}>
Detail
</Button>
</Space>
),
},
......
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Form, Input, Spin, Table, Space, Button, message } from 'antd';
import { LoadingOutlined } from '@ant-design/icons';
import { Table, Space, Button, message } from 'antd';
import { urlEncode, filterObj, filterObjbyTg, RA } from '@/utils/method';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { connect, history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch';
import { TosSecurityGuarderGet } from '@/services/tos';
const module = 'User';
// 服务范围数据
let options: Array<[number, string]> = [];
interface readyType {
pageNum: number;
serviceCommunityList: Array<string>;
serviceScope: string;
providerName: string;
}
interface valuesType {
serviceScope: string;
serviceScopeList: Array<''>;
}
interface propsType {
Data: { rows: Array<object>; page: { totalRow: number; curPageSize: number } };
CommunityList: Array<''>;
DataServices: { data: { rows: Array<{}> } };
dispatch: any;
location: any;
}
// 筛选参数
let readyData: any = {
let readyData: readyType = {
pageNum: 1,
serviceCommunityList: [],
serviceScope: '',
......@@ -25,45 +43,40 @@ let readyData: any = {
// 节流阀
let flag: boolean = false;
const ServiceProviderManagement = (props: any) => {
const ServiceProviderManagement = (props: propsType) => {
const permissionArr = JSON.parse(localStorage.getItem('permission') || '');
const [loading, setLoading] = useState(false);
const { dispatch, location, Data, CommunityList, DataServices } = props;
const SaveChooseData = (values: any) => {
const SaveChooseData = (values: object | null) => {
dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values });
};
const goToDetail = (values: any, e: any) => {
const goToDetail = (values: valuesType, e: any) => {
if (permissionArr.indexOf('6') < 0) {
message.error('No Permissions!!!', 3);
return;
}
values.serviceScope = options[values.serviceScopeList[0]][1];
SaveChooseData(values);
if (values.serviceScopeList[0] === '0') {
if (values.serviceScopeList[0].toString() === '0') {
history.push(location.pathname + '/Detail');
} else if (values.serviceScopeList[0] === '1') {
} else if (values.serviceScopeList[0].toString() === '1') {
history.push(location.pathname + '/AccoutingDetail');
} else {
history.push('/404');
}
};
const goToEdit = (values: any, e: any) => {
const goToEdit = (values: object, e: any) => {
if (permissionArr.indexOf('7') < 0) {
message.error('No Permissions!!!', 3);
return;
}
SaveChooseData(values);
history.push(location.pathname + '/Edit');
// if (values.serviceScopeList[0] === '0') {
// } else if (values.serviceScopeList[0] === '1') {
// history.push(location.pathname + '/AccoutingEdit');
// } else {
// history.push('/404');
// }
};
const goToCreate = () => {
if (permissionArr.indexOf('8') < 0) {
......@@ -88,24 +101,28 @@ const ServiceProviderManagement = (props: any) => {
{
title: 'Services Available',
dataIndex: 'serviceScopeList',
render: (text: any, record: any) => {
if (options.length > 0) {
return options[text[0]][1];
}
render: (text: Array<''>, record: object) => {
let type: string = '';
if (options.length > 0) type = options[text[0]][1];
return type;
},
},
{ title: 'Account Status', dataIndex: 'enable' },
{
title: 'Actions',
render: (text: any, record: any) => (
render: (text: string, record: any) => (
<Space size="middle">
<a onClick={goToDetail.bind(this, record)}>Detail</a>
<a
<Button
type="link"
size="small"
disabled={record.enable == 'Deregistered' ? true : false}
onClick={goToEdit.bind(this, record)}
>
Edit
</a>
</Button>
<Button type="link" size="small" onClick={goToDetail.bind(this, record)}>
Detail
</Button>
</Space>
),
},
......@@ -145,7 +162,7 @@ const ServiceProviderManagement = (props: any) => {
...location.query,
};
}
console.log(CommunityList, flag);
if (CommunityList && flag === false) {
flag = true;
setLoading(true);
......@@ -177,9 +194,6 @@ const ServiceProviderManagement = (props: any) => {
comment.status = '';
}
console.log(comment);
// if (comment.status) {
// }
history.push(
location.pathname +
......@@ -256,24 +270,26 @@ const ServiceProviderManagement = (props: any) => {
</div>
{/* 列表组件 */}
<Table
rowKey={'id'}
style={{ marginTop: 16 }}
loading={loading}
columns={columns}
dataSource={Data != null ? dataSource(Data.rows) : []}
pagination={
Data != null
? {
current: parseInt(readyData.pageNum),
total: Data.page.totalRow,
showSizeChanger: false,
pageSize: Data.page.curPageSize,
}
: {}
}
onChange={pageChange}
/>
{
<Table
rowKey={'id'}
style={{ marginTop: 16 }}
loading={loading}
columns={columns}
dataSource={Data !== null ? dataSource(Data.rows) : []}
pagination={
Data !== null
? {
current: +readyData.pageNum,
total: Data.page.totalRow,
showSizeChanger: false,
pageSize: Data.page.curPageSize,
}
: {}
}
onChange={pageChange}
/>
}
</div>
);
};
......@@ -282,6 +298,7 @@ function mapStateToProps(state: any) {
const { Data } = state.ServiceProvider;
const { DataProvider, DataServices } = state.User;
const { CommunityList } = state.Init;
return {
Data,
DataProvider,
......
......@@ -6,7 +6,7 @@ interface Password {
password: string;
}
const Login2 = (props: any) => {
const Login2 = (props: { history: { push: (location: string) => void } }) => {
const { history } = props;
// 修改密码
const onFinish = (values: Password) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment