Commit 059303cf authored by cellee's avatar cellee

Signed-off-by: cellee <893264950@qq.com>

parent e349b94b
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-12-01 18:40:06 * @Date: 2020-12-01 18:40:06
* @LastEditTime: 2021-01-30 15:56:31 * @LastEditTime: 2021-02-03 15:41:15
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\config\config.ts * @FilePath: \tostumi\config\config.ts
...@@ -201,7 +201,7 @@ export default defineConfig({ ...@@ -201,7 +201,7 @@ export default defineConfig({
{ path: './', component: './CommercialService/PropertyServices' }, { path: './', component: './CommercialService/PropertyServices' },
{ path: './Detail', component: './CommercialService/Detail' }, { path: './Detail', component: './CommercialService/Detail' },
{ path: './Edit', component: './CommercialService/Detail' }, { path: './Edit', component: './CommercialService/Detail' },
] ],
}, },
{ {
path: './RenovationApplication', path: './RenovationApplication',
...@@ -226,10 +226,10 @@ export default defineConfig({ ...@@ -226,10 +226,10 @@ export default defineConfig({
path: './ReportOnline', path: './ReportOnline',
name: 'reportonline', name: 'reportonline',
routes: [ routes: [
{ path: "./", component: './CommercialService/PropertyServices' }, { path: './', component: './CommercialService/PropertyServices' },
{ path: './Detail', component: './CommercialService/Detail' }, { path: './Detail', component: './CommercialService/Detail' },
{ path: './Edit', component: './CommercialService/Detail' }, { path: './Edit', component: './CommercialService/Detail' },
] ],
}, },
{ {
path: './ShelfLifeService', path: './ShelfLifeService',
...@@ -244,12 +244,12 @@ export default defineConfig({ ...@@ -244,12 +244,12 @@ export default defineConfig({
{ path: './OwnerComplaints/Edit', component: './CommercialService/Detail' }, { path: './OwnerComplaints/Edit', component: './CommercialService/Detail' },
], ],
}, },
{ // {
path: '/OrderManagement', // path: '/OrderManagement',
name: 'ordermanagement', // name: 'ordermanagement',
icon: 'ContainerOutlined', // icon: 'ContainerOutlined',
routes: [{ path: './', component: './OrderManagement/Order' }], // routes: [{ path: './', component: './OrderManagement/Order' }],
}, // },
{ {
path: '/ContractManagement', path: '/ContractManagement',
name: 'contractmanagement', name: 'contractmanagement',
......
...@@ -74,6 +74,7 @@ class SelectOptions extends React.PureComponent { ...@@ -74,6 +74,7 @@ class SelectOptions extends React.PureComponent {
flag: false, flag: false,
lastValue: null, lastValue: null,
}; };
console.log(this.state);
} else { } else {
this.state = { this.state = {
menuList: ArrayToPingYin.get(list), menuList: ArrayToPingYin.get(list),
...@@ -102,13 +103,13 @@ class SelectOptions extends React.PureComponent { ...@@ -102,13 +103,13 @@ class SelectOptions extends React.PureComponent {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (this.props.show != null) { if (this.props.show != null) {
if (this.props.show == this.state.flag) { if (this.props.show == this.state.flag) {
console.log(this.props.show); // console.log(this.props.show);
if (this.props.show == false) { if (this.props.show == false) {
this.setState({ componetVisible: this.state.selectoptionsOpen, flag: true }); this.setState({ componetVisible: this.state.selectoptionsOpen, flag: true });
} else { } else {
this.setState({ componetVisible: this.state.selectoptionsPutItAway, flag: false }); this.setState({ componetVisible: this.state.selectoptionsPutItAway, flag: false });
} }
console.log(this.state.componetVisible); // console.log(this.state.componetVisible);
} }
// if (this.props.list.length > this.state.checkedList.length) { // if (this.props.list.length > this.state.checkedList.length) {
// } // }
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 16:54:53 * @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-12-04 17:24:27 * @LastEditTime: 2021-02-03 17:43:00
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\CommunityManagement\VisitorRecord.ts * @FilePath: \tostumi\src\models\CommunityManagement\VisitorRecord.ts
...@@ -54,9 +54,8 @@ export default { ...@@ -54,9 +54,8 @@ export default {
{ {
// 总数据 // 总数据
let Data = resp.data.rows; let Data = resp.data.rows;
let DataSave = resp.data.rows; console.log('??');
yield put({ type: 'returnPage', Data }); yield put({ type: 'returnPage', Data });
yield put({ type: 'returnDataSave', DataSave });
} }
break; break;
} }
......
...@@ -389,7 +389,7 @@ const Account = (props: any) => { ...@@ -389,7 +389,7 @@ const Account = (props: any) => {
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, SubResult, Info } = state.Account; const { Data, DataSave, DataSaveDetail, Result, SubResult, Info } = state.Account;
const loading = state.loading.models.Account || false; const loading = state.loading.global;
const { user } = state; const { user } = state;
return { return {
Data, Data,
......
...@@ -673,8 +673,9 @@ const Account = (props: any) => { ...@@ -673,8 +673,9 @@ const Account = (props: any) => {
}; };
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
console.log(state.loading);
const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account; const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account;
const loading = state.loading.models.Account || false; const loading = state.loading.global;
const { user } = state; const { user } = state;
return { return {
Data, Data,
......
...@@ -17,9 +17,9 @@ const VisitorRecord = (props: any) => { ...@@ -17,9 +17,9 @@ const VisitorRecord = (props: any) => {
// 新增搜索的时间 原来时间是时间戳格式 // 新增搜索的时间 原来时间是时间戳格式
useEffect(() => { useEffect(() => {
if (Data != null && CommunityList != null) { if (Data != null && CommunityList != null) {
Data.forEach((item: any) => { // Data.forEach((item: any) => {
item.showTime = moment(item.updateTime).format('YYYY-MM-DD'); // item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
}); // });
} else { } else {
RA(26, { communityNames: CommunityList }, module, dispatch); RA(26, { communityNames: CommunityList }, module, dispatch);
} }
...@@ -50,7 +50,7 @@ const VisitorRecord = (props: any) => { ...@@ -50,7 +50,7 @@ const VisitorRecord = (props: any) => {
// 分页 // 分页
const pagination: any = { const pagination: any = {
defaultCurrent: 1, defaultCurrent: 1,
total: Data != null ? Data.length : 0, // total: Data != null ? Data.length : 0,
defaultPageSize: 15, defaultPageSize: 15,
showSizeChanger: false, showSizeChanger: false,
showTitle: false, showTitle: false,
...@@ -73,116 +73,16 @@ const VisitorRecord = (props: any) => { ...@@ -73,116 +73,16 @@ const VisitorRecord = (props: any) => {
// 点击搜索 // 点击搜索
const onSubmitForm = (value: any) => { const onSubmitForm = (value: any) => {
// 小区更换为数组 console.log(value);
// value.visitorCommunity = value.community.value; let obj = {
let visitorCommunity = value.community.value; communityNames: value.community.value,
delete value.community; inviterName: value.inviterName ? value.inviterName : '',
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : '',
if (value.showTime) { };
value.showTime = moment(value.showTime).format('YYYY-MM-DD'); SA(obj, module, dispatch);
} RA(26, obj, module, dispatch);
// 有的话需要先转换 否则会被清除
// 清除 undefind
let info = JSON.parse(stringifyNoEmptyField(value));
if (info.showTime) {
info.showTime = moment(info.showTime).format('YYYY-MM-DD');
}
// 所有字符串条件检索出来的结果
let Datas = filter(info, DataSave);
let newArr = [];
// 开始数组处理
if (visitorCommunity.length > 0) {
for (let i in Datas) {
if (visitorCommunity.indexOf(Datas[i].visitorCommunity) != -1) {
newArr.push(Datas[i]);
}
}
} else {
// 没有选小区
newArr = Datas;
}
SA(newArr, module, dispatch);
}; };
// 点击重置
const onResetFrom = () => {
form.resetFields();
onReset();
};
// 刷新
const onReset = () => {
SA(DataSave, module, dispatch);
RA(
26,
{ communityNames: JSON.parse(localStorage.getItem('CommunityList') as any) },
module,
dispatch,
);
};
// 去掉null undefined 无效字段
function removeEmptyField(obj: any) {
var newObj = {};
if (typeof obj == 'string') {
obj = JSON.parse(obj);
}
if (obj instanceof Array) {
newObj = [];
}
if (obj instanceof Object) {
for (var attr in obj) {
if (
obj.hasOwnProperty(attr) &&
obj[attr] !== '' &&
obj[attr] !== null &&
obj[attr] !== undefined
) {
if (obj[attr] instanceof Object) {
newObj[attr] = removeEmptyField(obj[attr]);
} else if (
typeof obj[attr] == 'string' &&
((obj[attr].indexOf('{') > -1 && obj[attr].indexOf('}') > -1) ||
(obj[attr].indexOf('[') > -1 && obj[attr].indexOf(']') > -1))
) {
try {
var attrObj = JSON.parse(obj[attr]);
if (attrObj instanceof Object) {
newObj[attr] = removeEmptyField(attrObj);
}
} catch (e) {
newObj[attr] = obj[attr];
}
} else {
newObj[attr] = obj[attr];
}
}
}
}
return newObj;
}
function stringifyNoEmptyField(obj: any) {
var newObj = removeEmptyField(obj);
for (var attr in newObj) {
if (newObj.hasOwnProperty(attr) && newObj[attr] instanceof Array) {
newObj[attr] = JSON.stringify(newObj[attr]);
}
}
return JSON.stringify(newObj);
}
// 选择小区名字并赋值
// const opname = (value: any) => {
// form.setFieldsValue({
// visitorCommunity: value,
// });
// };
return ( return (
<> <>
<div className="VisitorRecord"> <div className="VisitorRecord">
...@@ -210,16 +110,6 @@ const VisitorRecord = (props: any) => { ...@@ -210,16 +110,6 @@ const VisitorRecord = (props: any) => {
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}> <Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '} Search{' '}
</Button> </Button>
{/* <Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
icon={<ClearOutlined />}
loading={loading}
>
{' '}
Reset
</Button> */}
</Form.Item> </Form.Item>
<div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}> <div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}>
<Form.Item name="community" label=""> <Form.Item name="community" label="">
...@@ -232,20 +122,14 @@ const VisitorRecord = (props: any) => { ...@@ -232,20 +122,14 @@ const VisitorRecord = (props: any) => {
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id" rowKey="id"
dataSource={Data != null ? Data : ''} dataSource={Data != null ? Data.rows : ''}
columns={columns} columns={columns}
pagination={pagination} pagination={pagination}
// pagination={{ current: 1, total: Data.total}} // pagination={{ current: 1, total: Data.total}}
search={false} search={false}
toolBarRender={false} toolBarRender={false}
options={{
density: false,
fullScreen: false,
reload: false,
setting: false,
}}
headerTitle="Visitor List" headerTitle="Visitor List"
onReset={onResetFrom} // onReset={onResetFrom}
onSubmit={onSubmitForm} onSubmit={onSubmitForm}
/> />
</div> </div>
......
...@@ -17,9 +17,9 @@ const VisitorRecord = (props: any) => { ...@@ -17,9 +17,9 @@ const VisitorRecord = (props: any) => {
// 新增搜索的时间 原来时间是时间戳格式 // 新增搜索的时间 原来时间是时间戳格式
useEffect(() => { useEffect(() => {
if (Data != null && CommunityList != null) { if (Data != null && CommunityList != null) {
Data.forEach((item: any) => { // Data.forEach((item: any) => {
item.showTime = moment(item.updateTime).format('YYYY-MM-DD'); // item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
}); // });
} else { } else {
RA(26, { communityNames: CommunityList }, module, dispatch); RA(26, { communityNames: CommunityList }, module, dispatch);
} }
...@@ -50,7 +50,7 @@ const VisitorRecord = (props: any) => { ...@@ -50,7 +50,7 @@ const VisitorRecord = (props: any) => {
// 分页 // 分页
const pagination: any = { const pagination: any = {
defaultCurrent: 1, defaultCurrent: 1,
total: Data != null ? Data.length : 0, // total: Data != null ? Data.length : 0,
defaultPageSize: 15, defaultPageSize: 15,
showSizeChanger: false, showSizeChanger: false,
showTitle: false, showTitle: false,
...@@ -73,116 +73,16 @@ const VisitorRecord = (props: any) => { ...@@ -73,116 +73,16 @@ const VisitorRecord = (props: any) => {
// 点击搜索 // 点击搜索
const onSubmitForm = (value: any) => { const onSubmitForm = (value: any) => {
// 小区更换为数组 console.log(value);
// value.visitorCommunity = value.community.value; let obj = {
let visitorCommunity = value.community.value; communityNames: value.community.value,
delete value.community; inviterName: value.inviterName ? value.inviterName : '',
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : '',
if (value.showTime) { };
value.showTime = moment(value.showTime).format('YYYY-MM-DD'); SA(obj, module, dispatch);
} RA(26, obj, module, dispatch);
// 有的话需要先转换 否则会被清除
// 清除 undefind
let info = JSON.parse(stringifyNoEmptyField(value));
if (info.showTime) {
info.showTime = moment(info.showTime).format('YYYY-MM-DD');
}
// 所有字符串条件检索出来的结果
let Datas = filter(info, DataSave);
let newArr = [];
// 开始数组处理
if (visitorCommunity.length > 0) {
for (let i in Datas) {
if (visitorCommunity.indexOf(Datas[i].visitorCommunity) != -1) {
newArr.push(Datas[i]);
}
}
} else {
// 没有选小区
newArr = Datas;
}
SA(newArr, module, dispatch);
}; };
// 点击重置
const onResetFrom = () => {
form.resetFields();
onReset();
};
// 刷新
const onReset = () => {
SA(DataSave, module, dispatch);
RA(
26,
{ communityNames: JSON.parse(localStorage.getItem('CommunityList') as any) },
module,
dispatch,
);
};
// 去掉null undefined 无效字段
function removeEmptyField(obj: any) {
var newObj = {};
if (typeof obj == 'string') {
obj = JSON.parse(obj);
}
if (obj instanceof Array) {
newObj = [];
}
if (obj instanceof Object) {
for (var attr in obj) {
if (
obj.hasOwnProperty(attr) &&
obj[attr] !== '' &&
obj[attr] !== null &&
obj[attr] !== undefined
) {
if (obj[attr] instanceof Object) {
newObj[attr] = removeEmptyField(obj[attr]);
} else if (
typeof obj[attr] == 'string' &&
((obj[attr].indexOf('{') > -1 && obj[attr].indexOf('}') > -1) ||
(obj[attr].indexOf('[') > -1 && obj[attr].indexOf(']') > -1))
) {
try {
var attrObj = JSON.parse(obj[attr]);
if (attrObj instanceof Object) {
newObj[attr] = removeEmptyField(attrObj);
}
} catch (e) {
newObj[attr] = obj[attr];
}
} else {
newObj[attr] = obj[attr];
}
}
}
}
return newObj;
}
function stringifyNoEmptyField(obj: any) {
var newObj = removeEmptyField(obj);
for (var attr in newObj) {
if (newObj.hasOwnProperty(attr) && newObj[attr] instanceof Array) {
newObj[attr] = JSON.stringify(newObj[attr]);
}
}
return JSON.stringify(newObj);
}
// 选择小区名字并赋值
// const opname = (value: any) => {
// form.setFieldsValue({
// visitorCommunity: value,
// });
// };
return ( return (
<> <>
<div className="VisitorRecord"> <div className="VisitorRecord">
...@@ -210,16 +110,6 @@ const VisitorRecord = (props: any) => { ...@@ -210,16 +110,6 @@ const VisitorRecord = (props: any) => {
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}> <Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '} Search{' '}
</Button> </Button>
{/* <Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
icon={<ClearOutlined />}
loading={loading}
>
{' '}
Reset
</Button> */}
</Form.Item> </Form.Item>
<div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}> <div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}>
<Form.Item name="community" label=""> <Form.Item name="community" label="">
...@@ -232,20 +122,14 @@ const VisitorRecord = (props: any) => { ...@@ -232,20 +122,14 @@ const VisitorRecord = (props: any) => {
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id" rowKey="id"
dataSource={Data != null ? Data : ''} dataSource={Data != null ? Data.rows : ''}
columns={columns} columns={columns}
pagination={pagination} pagination={pagination}
// pagination={{ current: 1, total: Data.total}} // pagination={{ current: 1, total: Data.total}}
search={false} search={false}
toolBarRender={false} toolBarRender={false}
options={{
density: false,
fullScreen: false,
reload: false,
setting: false,
}}
headerTitle="Visitor List" headerTitle="Visitor List"
onReset={onResetFrom} // onReset={onResetFrom}
onSubmit={onSubmitForm} onSubmit={onSubmitForm}
/> />
</div> </div>
......
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