Commit 67c11eeb authored by cellee's avatar cellee

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

parent 64e50d1e
......@@ -86,15 +86,15 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://192.168.1.28:8651',
// target: 'http://47.74.233.180:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/tos/': {
target: 'http://192.168.1.28:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
};
......@@ -14,18 +14,23 @@ export default {
Data3: null,
DataSave: null,
DataSaveDetail: null,
sourceData: null,
curString: {
subscribeDate: null,
status: 0,
communityNameList: null,
communityNameList2: null,
tab: 1,
curPage: 1,
curPage2: 1,
globalMark: 'yes',
//表格1搜索条件
search: {
communityNameList: null, // 小区
status: 0, //状态
subscribeDate: null, // 时间
pageNum: 1, // 页码
globalMark: 'yes', // 状态
},
//表格2搜索条件
search2: {
communityNameList: null, //选择小区
facilityName: null, // 设施名
pageNum: '1', // 页码
},
tab: 1, // 是哪一张表格
Result: null,
......@@ -73,8 +78,19 @@ export default {
returnSource(state, { sourceData }) {
return { ...state, sourceData };
},
returnCurString(state, { curString }) {
return { ...state, curString };
// 表格
returnTab(state, { tabs }) {
let tab = tabs;
console.log({ ...state, tab });
return { ...state, tab };
},
// 表格1 搜索条件
returnCurString(state, { search }) {
return { ...state, search };
},
// 表格2 搜索条件
returnCurString2(state, { search2 }) {
return { ...state, search2 };
},
returnResult(state, { Result }) {
return { ...state, Result };
......@@ -238,9 +254,22 @@ export default {
yield put({ type: 'returnSource', sourceData });
},
// 当前表格
*TB({ playload }, { call, put }) {
console.log(playload);
var tabs = playload;
yield put({ type: 'returnTab', tabs });
},
// 搜索条件
*QA({ playload }, { call, put }) {
var curString = playload;
yield put({ type: 'returnCurString', curString });
var search = playload;
yield put({ type: 'returnCurString', search });
},
// 拉取条件
*QA2({ playload }, { call, put }) {
var search2 = playload;
yield put({ type: 'returnCurString2', search2 });
},
*ResultClear({}, { put }) {
......
......@@ -13,7 +13,7 @@ import { RA } from '@/utils/method';
const Account = (props: any) => {
const module = 'Account';
const { dispatch, SubResult, loading, user, Info } = props;
const { dispatch, SubResult, load, user, Info } = props;
// 权限列表
const treeData = localStorage.getItem('umi_locale') == 'zh-CN' ? zhCnFaci : enUsFaci;
......@@ -28,6 +28,9 @@ const Account = (props: any) => {
const [towAccountId, settowAccountId] = useState(null); // 二级账户id
const [treeDataList, settreeDataList] = useState(treeData); // 权限列表
// 加载情况
const [loading, setLoading] = useState(true);
// 表单标识
const [form] = Form.useForm();
const formRef = useRef(null);
......@@ -82,6 +85,7 @@ const Account = (props: any) => {
// 赋值改变
treeDatas[0].children = _p;
settreeDataList(treeDatas as any); // 可勾选列表
setLoading(false);
}
}, [user, values]);
......@@ -93,6 +97,7 @@ const Account = (props: any) => {
message.success('Submitted Successfully !');
dispatch({ type: module + '/ReData' });
dispatch({ type: module + '/AccountClear' });
setLoading(false);
history.go(-1);
}
}
......@@ -208,6 +213,7 @@ const Account = (props: any) => {
// console.log(obj);
RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传
setLoading(true);
return true;
}
};
......@@ -272,7 +278,7 @@ const Account = (props: any) => {
};
return (
<Spin spinning={loading}>
<Spin spinning={load || loading}>
<div className="contop" style={{ padding: '12px 20px' }}>
<h3 className="capi">
<EditOutlined />
......@@ -376,7 +382,7 @@ const Account = (props: any) => {
<div className="diy">
<div className="label"></div>
<div className="label">
<Button type="primary" htmlType="submit" loading={loading}>
<Button type="primary" htmlType="submit" loading={load || loading}>
Submit
</Button>
</div>
......@@ -389,14 +395,14 @@ const Account = (props: any) => {
const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, SubResult, Info } = state.Account;
const loading = state.loading.global;
const load = state.loading.global;
const { user } = state;
return {
Data,
DataSave,
DataSaveDetail,
Result,
loading,
load,
user, // 获取当前账户信息
SubResult,
Info,
......
import React, { useState, useEffect, useRef } from 'react';
import { Form, Input, Button, message, Descriptions, Spin, Tree, Radio, Select, Modal } from 'antd';
import { connect, history } from 'umi';
import { connect, history, Prompt } from 'umi';
import { EditOutlined, LeftOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import './Account.less';
......@@ -13,7 +13,7 @@ import { RA } from '@/utils/method';
const Account = (props: any) => {
const module = 'Account';
const { Option } = Select;
const { dispatch, SubResult, loading, user, DataSave, Permission, Info } = props;
const { dispatch, SubResult, user, DataSave, Permission, Info, load } = props;
// 权限列表
const treeData = localStorage.getItem('umi_locale') == 'zh-CN' ? zhCnFaci : enUsFaci;
......@@ -32,6 +32,9 @@ const Account = (props: any) => {
// const [frequency, setfrequency] = useState(0); // 权限列表
const [TreeDisabled, setTreeDisabled] = useState(true); // 权限是否可编辑
// 加载情况
const [loading, setLoading] = useState(true);
// 表单标识
const [form] = Form.useForm();
const formRef = useRef(null);
......@@ -75,7 +78,7 @@ const Account = (props: any) => {
}
}, [DataSave, user]);
// 提交信息结果
//提交信息结果
useEffect(() => {
if (SubResult != null) {
if (SubResult.statr == 0 && SubResult.desc == 0) {
......@@ -83,12 +86,13 @@ const Account = (props: any) => {
message.success('Submitted Successfully !');
dispatch({ type: module + '/ReData' });
dispatch({ type: module + '/AccountClear' });
setLoading(true);
history.go(-1);
}
}
}, [SubResult]);
// 已选权限
// 获取已选权限
useEffect(() => {
if (Permission != null) {
let data = Permission.curUserPermission ? Permission.curUserPermission.split(',') : [];
......@@ -150,6 +154,7 @@ const Account = (props: any) => {
}
setCheckedKeys(data);
setLoading(false);
}
}, [Permission, DataSave]);
......@@ -226,8 +231,17 @@ const Account = (props: any) => {
permissionArray: newData,
subPermissionArray,
};
// Promise.all([RA(38, value, module, dispatch), RA(42, obj, module, dispatch)]).then(
// (v: any) => {
// console.log(v);
// },
// (e: any) => {
// console.log(e);
// },
// );
RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传
setLoading(true);
return true;
}
};
......@@ -540,7 +554,7 @@ const Account = (props: any) => {
/* --------------------------- 更新 End---------------------------------- */
return (
<Spin spinning={loading}>
<Spin spinning={loading || load}>
<div className="contop" style={{ padding: '12px 20px' }}>
<h3 className="capi">
<EditOutlined />
......@@ -661,7 +675,7 @@ const Account = (props: any) => {
<div className="diy">
<div className="label"></div>
<div className="label">
<Button type="primary" htmlType="submit" loading={loading}>
<Button type="primary" htmlType="submit" loading={loading || load}>
Submit
</Button>
</div>
......@@ -673,20 +687,19 @@ const Account = (props: any) => {
};
const AccountProps = (state: any) => {
// console.log(state.loading);
const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account;
const loading = state.loading.global;
const { user } = state;
const load = state.loading.global;
return {
Data,
DataSave,
DataSaveDetail,
Result,
loading,
Permission,
user, // 获取当前账户信息
SubResult,
Info,
load,
};
};
......
......@@ -33,29 +33,39 @@ const FacilityBookings = (props: any) => {
Data2,
token,
DataSave,
curString,
Result,
search,
tab,
search2,
loading,
CommunityList,
} = props;
const Model = 'FacilityBookings';
const RA = (index: any, values: any) => {
dispatch({
type: 'FacilityBookings/RA',
type: Model + '/RA',
playload: { index: index, body: values },
});
};
const SA = (values: any) => {
dispatch({ type: 'FacilityBookings/SA', playload: values });
dispatch({ type: Model + '/SA', playload: values });
};
const QA = (values: any) => {
dispatch({ type: 'FacilityBookings/QA', playload: values });
dispatch({ type: Model + '/QA', playload: values });
};
const QA2 = (values: any) => {
dispatch({ type: Model + '/QA2', playload: values });
};
const TB = (values: any) => {
dispatch({ type: Model + '/TB', playload: values });
};
const IA = () => {
dispatch({ type: 'FacilityBookings/IA' });
dispatch({ type: Model + '/IA' });
};
const CA = () => {
dispatch({ type: 'FacilityBookings/CA', playload: null });
dispatch({ type: Model + '/CA', playload: null });
};
// 表头格式
......@@ -91,15 +101,15 @@ const FacilityBookings = (props: any) => {
}, [Data2]);
const goToFunction = () => {
if (curString.tab == 2) {
if (tab == 2) {
CA();
// 先清空上传图片列表
let list: any = [];
dispatch({ type: 'FacilityBookings/genxin' }, list);
dispatch({ type: Model + '/genxin' }, list);
}
// 清空之前的数据
SA(null);
history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding'));
history.push(location.pathname + (tab == 1 ? '/Booking' : '/Adding'));
};
// 预约详情跳转
......@@ -122,7 +132,7 @@ const FacilityBookings = (props: any) => {
// 清空设施列表图;
let list: any = [];
dispatch({ type: 'FacilityBookings/genxin', list });
dispatch({ type: Model + '/genxin', list });
history.push(location.pathname + path[index]);
};
......@@ -197,149 +207,145 @@ const FacilityBookings = (props: any) => {
//发起请求--有小区再发起,没有就没必要了
if (CommunityList) {
if (curString.tab == 1) {
let tmp = curString;
tmp.communityNameList = CommunityList;
tmp.communityNameList2 = CommunityList;
QA(tmp);
RA(9, {
communityNameList: CommunityList,
userToken: token,
pageNum: curString.curPage,
subscribeDate: curString.subscribeDate,
status: curString.status,
globalMark: curString.globalMark,
});
if (tab == 1 && CommunityList !== null) {
// let tmp = JSON.parse(JSON.stringify(search));
let obj = {
communityNameList: search.communityNameList ? search.communityNameList : CommunityList,
subscribeDate: search.subscribeDate ? search.subscribeDate : null, // 时间
status: search.status ? search.status : null, // 状态
pageNum: search.pageNum ? search.pageNum : 1, // 实际搜索页码
globalMark: search.globalMark ? search.globalMark : 'no', // 搜索全部内容
};
requse(obj, tab);
} else {
RA(8, {
userToken: token,
pageNum: curString.curPage2,
communityNameList: CommunityList,
});
let obj = {
communityNameList: search2.communityNameList ? search2.communityNameList : CommunityList,
facilityName: search2.facilityName ? search2.facilityName : null,
};
requse(obj, tab);
}
}
}, [CommunityList]);
// 发起搜索
const CallBackTitleSearch = (comment: any) => {
if (curString.tab == 1) {
// 没有选小区就不让他提交
if (comment.communityName && comment.communityName.length == 0) {
message.info('Please Select A Community !');
return;
if (tab == 1) {
if (
comment.communityName &&
comment.communityName.length == 0 &&
comment.status == null &&
comment.key == null
) {
message.warning('Please fill in at least one condition');
return false;
}
if (comment.communityName != null || comment.key != null || comment.status != null) {
var tmp = curString;
tmp.subscribeDate = comment.key;
if (comment.status == null || comment.status == undefined) {
tmp.status = null;
} else {
tmp.status = comment.status;
}
tmp.communityNameList = comment.communityName;
tmp.curPage = 1;
tmp.globalMark = 'no';
QA(tmp);
//中断
RA(9, {
userToken: token,
pageNum: '1',
subscribeDate: tmp.subscribeDate,
status: tmp.status,
communityNameList: comment.communityName,
globalMark: 'no',
});
let obj = {
communityNameList: comment.communityName ? comment.communityName : null, // 所选小区
subscribeDate: comment.key ? comment.key : null, // 时间
status: comment.status ? comment.status : null, // 状态
pageNum: 1, // 实际搜索页码
globalMark: 'no', // 搜索全部内容
};
requse(obj, tab);
}
} else {
// 没有选小区就不让他提交
if (comment.communityName2 && comment.communityName2.length == 0) {
message.info('Please Select A Community !');
return;
if (
comment.communityName2 &&
comment.communityName2.length == 0 &&
comment.facilityName == ''
) {
message.warning('Please fill in at least one condition');
return false;
}
if (comment.communityName2 != null || comment.facilityName != null) {
var tmp = curString;
tmp.communityNameList2 = comment.communityName2;
tmp.facilityName = comment.facilityName;
tmp.curPage = 1;
QA(tmp);
RA(8, {
communityNameList: comment.communityName2,
facilityName: comment.facilityName,
let obj = {
communityNameList: comment.communityName2 ? comment.communityName2 : null,
facilityName: comment.facilityName ? comment.facilityName : null,
pageNum: '1',
});
};
requse(obj, tab);
}
}
};
// 切换tab
function TabCallback(tab: any) {
var tmp = curString;
tmp.tab = tab;
QA(tmp);
TB(tab);
if (tab == 1) {
RA(9, {
communityNameList: curString.communityNameList,
// 搜索t
let obj = {
communityNameList: search.communityNameList,
userToken: token,
status: curString.status,
subscribeDate: curString.subscribeDate,
pageNum: curString.curPage,
globalMark: curString.globalMark,
});
status: search.status,
subscribeDate: search.subscribeDate,
pageNum: search.pageNum,
globalMark: search.globalMark,
};
requse(obj, tab);
} else {
RA(8, {
// 储存的值
let obj = {
communityNameList: search2.communityNameList ? search2.communityNameList : CommunityList,
pageNum: search2.pageNum,
userToken: token,
pageNum: curString.curPage2,
communityNameList: curString.communityNameList2,
});
};
requse(obj, tab);
}
}
// 点击分页
function Pagechange(current: any, pageSize: any) {
if (curString.tab == 1) {
var tmp = curString;
tmp.curPage = current;
QA(tmp);
RA(9, {
if (tab == 1) {
let obj = {
communityNameList: search.communityNameList,
userToken: token,
status: search.status,
subscribeDate: search.subscribeDate,
pageNum: current,
subscribeDate: curString.subscribeDate,
status: curString.status,
communityNameList: curString.communityNameList,
globalMark: curString.globalMark,
});
globalMark: search.globalMark,
};
requse(obj, tab);
} else {
var tmp = curString;
tmp.curPage2 = current;
QA(tmp);
if (curString.communityNameList != null) {
RA(8, {
userToken: token,
pageNum: current,
communityNameList: curString.communityNameList2
? curString.communityNameList2
: JSON.parse(localStorage.getItem('CommunityList') as any),
});
} else {
RA(8, { userToken: token, pageNum: current });
}
let obj = {
communityNameList: search2.communityNameList ? search2.communityNameList : CommunityList,
pageNum: current,
userToken: token,
};
requse(obj, tab);
}
}
// 预约刷新
// const onReset = () => {
// RA(9, {
// userToken: token,
// pageNum: curString.curPage,
// subscribeDate: curString.subscribeDate,
// status: curString.status,
// communityNameList: CommunityList,
// globalMark: curString.globalMark,
// });
// };
// 储存并发起请求
const requse = (v: any, tab: any) => {
if (tab == 1) {
let obj = {
communityNameList: v.communityNameList ? v.communityNameList : null,
userToken: token,
pageNum: v.pageNum ? v.pageNum : '1',
subscribeDate: v.subscribeDate ? v.subscribeDate : null,
status: v.status ? v.status : null,
globalMark: v.globalMark ? v.globalMark : 'yes',
};
QA({ ...obj });
RA(9, { ...obj });
} else {
// 储存的
// 搜索的
let obj = {
communityNameList: v.communityNameList ? v.communityNameList : null,
facilityName: v.facilityName ? v.facilityName : null,
pageNum: v.curPage ? v.curPage : '1',
};
QA2({ ...obj });
RA(8, { ...obj });
}
};
const operations = (
<Button key="3" type="primary" onClick={goToFunction}>
<PlusOutlined />
{curString.tab == 1 ? 'Add Appointment' : 'Add Facilities'}
{tab == 1 ? 'Add Appointment' : 'Add Facilities'}
</Button>
);
......@@ -347,7 +353,7 @@ const FacilityBookings = (props: any) => {
<>
<div className="base">
{/* 头部组件 */}
{curString.tab == 1 ? (
{tab == 1 ? (
<>
<TitleSearch
status={[
......@@ -360,12 +366,12 @@ const FacilityBookings = (props: any) => {
[3, 'Used'],
[4, 'Cancelled'],
],
default: curString.status,
default: search.status,
},
]}
time={['key', 'Booking time ']}
community={'communityName'}
checklist={curString.communityNameList ? curString.communityNameList : []}
checklist={search.communityNameList ? search.communityNameList : []}
onSubmit={CallBackTitleSearch}
/>
</>
......@@ -375,7 +381,7 @@ const FacilityBookings = (props: any) => {
listkey={['facilityName']}
list={['Facility name']}
community={'communityName2'}
checklist={curString.communityNameList2 ? curString.communityNameList2 : []}
checklist={search2.communityNameList ? search2.communityNameList : []}
onSubmit={CallBackTitleSearch}
/>
</>
......@@ -386,12 +392,12 @@ const FacilityBookings = (props: any) => {
<div className={'base'}>
{/* <div style={{ position: 'relative', height: 40 }}>
<Button type="primary" style={{ position: 'absolute', right: 0 }} onClick={goToFunction}>
{curString.tab == 1 ? 'Booking' : 'Add Facility'}
{search.tab == 1 ? 'Booking' : 'Add Facility'}
</Button>
</div> */}
<Tabs
defaultActiveKey={curString.tab.toString()}
defaultActiveKey={tab.toString()}
onChange={TabCallback}
className="diytabs"
tabBarExtraContent={operations}
......@@ -402,34 +408,15 @@ const FacilityBookings = (props: any) => {
rowKey="id"
dataSource={Data ? Data.list : null}
columns={columns}
// pagination={{
// current: curString.curPage,
// total: Data.total.totalRow,
// showSizeChanger: false,
// onChange: Pagechange,
// }}
pagination={false}
search={false}
toolBarRender={false}
// toolBarRender={() => [
// <Button key="3" type="primary" onClick={goToFunction}>
// <PlusOutlined />
// Add Appointment
// </Button>,
// ]}
options={{
density: false,
fullScreen: false,
reload: false,
setting: false,
}}
// headerTitle="预约列表"
/>
{Data ? (
<div className="pages">
<Pagination
current={curString.curPage ? curString.curPage : 0}
current={search.pageNum ? search.pageNum : 0}
total={Data.page.totalRow ? Data.page.totalRow : 0}
// pageSizeOptions={[]}
showSizeChanger={false}
......@@ -449,30 +436,11 @@ const FacilityBookings = (props: any) => {
dataSource={Facility}
columns={columns2}
toolBarRender={false}
// pagination={{
// current: curString.curPage2,
// total: Data2.total.totalRow,
// showSizeChanger: false,
// onChange: Pagechange,
// }}
pagination={false} // 隐藏默认分页
search={false}
// toolBarRender={() => [
// <Button key="3" type="primary" onClick={goToFunction}>
// <PlusOutlined />
// Add Facilities
// </Button>,
// ]}
options={{
density: false,
fullScreen: false,
reload: false,
setting: false,
}}
// headerTitle="Facilities List"
/>
{curString ? (
{search ? (
<div className="pages">
<Pagination
current={Data2.total.currentPage}
......@@ -494,7 +462,7 @@ const FacilityBookings = (props: any) => {
};
function mapStateToProps(state: any) {
const { Data, Data2, DataSave, curString, Result } = state.FacilityBookings;
const { Data, Data2, DataSave, search, search2, Result, tab } = state.FacilityBookings;
const { token } = state.login;
const loading = state.loading.models.FacilityBookings
? state.loading.models.FacilityBookings
......@@ -502,10 +470,12 @@ function mapStateToProps(state: any) {
const { CommunityList } = state.Init; // 小区列表
return {
tab,
Data,
Data2,
DataSave,
curString,
search,
search2,
Result,
token,
loading,
......
......@@ -46,7 +46,8 @@ const VisitorRecord = (props: any) => {
// 点击搜索
const onSubmitForm = (value: any) => {
let obj = {
communityNames: value.community.value,
communityNames:
value.community.value && value.community.value.length > 0 ? value.community.value : null,
inviterName: value.inviterName ? value.inviterName : null,
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : null,
pageNum: 1,
......
......@@ -46,7 +46,8 @@ const VisitorRecord = (props: any) => {
// 点击搜索
const onSubmitForm = (value: any) => {
let obj = {
communityNames: value.community.value,
communityNames:
value.community.value && value.community.value.length > 0 ? value.community.value : null,
inviterName: value.inviterName ? value.inviterName : null,
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : null,
pageNum: 1,
......
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