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