Commit 32dd96d7 authored by cellee's avatar cellee

编辑详情加ID

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent fa28ac36
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-12-01 18:40:06 * @Date: 2020-12-01 18:40:06
* @LastEditTime: 2021-02-23 09:51:06 * @LastEditTime: 2021-02-25 11:57:26
* @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
...@@ -278,8 +278,8 @@ export default defineConfig({ ...@@ -278,8 +278,8 @@ export default defineConfig({
routes: [ routes: [
{ path: './', component: './CommunityManagement/CellList/CellList' }, { path: './', component: './CommunityManagement/CellList/CellList' },
{ path: './Add', component: './CommunityManagement/CellList/Adds' }, { path: './Add', component: './CommunityManagement/CellList/Adds' },
{ path: './Edit', component: './CommunityManagement/CellList/Adds' }, { path: './Edit/:id', component: './CommunityManagement/CellList/Adds' },
{ path: './Detail', component: './CommunityManagement/CellList/Details' }, { path: './Detail/:id', component: './CommunityManagement/CellList/Details' },
{ path: '*', component: '@/pages/404' }, { path: '*', component: '@/pages/404' },
], ],
}, },
......
...@@ -186,7 +186,6 @@ const Facilitys = (props: any) => { ...@@ -186,7 +186,6 @@ const Facilitys = (props: any) => {
> >
<Input <Input
placeholder="Facility Name" placeholder="Facility Name"
disabled={disabled}
id={index} id={index}
onChange={(e: any) => monitor(e, index)} onChange={(e: any) => monitor(e, index)}
value={FacilitysList[index].name} value={FacilitysList[index].name}
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-02-01 14:54:48 * @Date: 2021-02-01 14:54:48
* @LastEditTime: 2021-02-24 16:25:27 * @LastEditTime: 2021-02-25 14:28:02
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx * @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
...@@ -312,7 +312,7 @@ const PdfUpload: React.FC<PriceInputProps> = ({ ...@@ -312,7 +312,7 @@ const PdfUpload: React.FC<PriceInputProps> = ({
placeholder="Basic usage" placeholder="Basic usage"
className="pdf-input" className="pdf-input"
onChange={inpChange} onChange={inpChange}
id={index} // id={Math.floor(Math.random() * 100) as any}
value={item.name} value={item.name}
disabled={disabled} disabled={disabled}
maxLength={30} maxLength={30}
...@@ -337,7 +337,6 @@ const PdfUpload: React.FC<PriceInputProps> = ({ ...@@ -337,7 +337,6 @@ const PdfUpload: React.FC<PriceInputProps> = ({
beforeUpload={beforeUpload} //上传前检测 beforeUpload={beforeUpload} //上传前检测
onRemove={onRemove} onRemove={onRemove}
// id={index} // id={index}
iconRender={icons} // 上传成功后的图标 iconRender={icons} // 上传成功后的图标
disabled={disabled} disabled={disabled}
> >
......
...@@ -10,6 +10,8 @@ import { SA } from '@/utils/method'; ...@@ -10,6 +10,8 @@ import { SA } from '@/utils/method';
const { Option } = Select; const { Option } = Select;
import moment from 'moment';
const TitleSearch = (props: any) => { const TitleSearch = (props: any) => {
const { const {
dispatch, dispatch,
...@@ -67,6 +69,25 @@ const TitleSearch = (props: any) => { ...@@ -67,6 +69,25 @@ const TitleSearch = (props: any) => {
} }
}, [CommunityList]); }, [CommunityList]);
// 监听 status
useEffect(() => {
if (status) {
form.setFieldsValue({
status: status[0].default,
});
}
}, [status]);
// 监听 time
useEffect(() => {
if (time) {
// console.log(time);
form.setFieldsValue({
subscribeDate: time[2],
});
}
}, [time]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
// console.log(values); // console.log(values);
if (datePicker) { if (datePicker) {
...@@ -80,7 +101,9 @@ const TitleSearch = (props: any) => { ...@@ -80,7 +101,9 @@ const TitleSearch = (props: any) => {
const onFinishFailed = () => {}; const onFinishFailed = () => {};
// 选择时间
const onChange = (date: any, dateString: string) => { const onChange = (date: any, dateString: string) => {
console.log(dateString);
setDate(dateString); setDate(dateString);
}; };
...@@ -106,9 +129,10 @@ const TitleSearch = (props: any) => { ...@@ -106,9 +129,10 @@ const TitleSearch = (props: any) => {
// 清除操作之前的数据 // 清除操作之前的数据
const emptys = (data: any, url: any) => { const emptys = (data: any, url: any) => {
dispatch({ type: 'CellList/urlRemove' }); // 清掉图片信息 let module = 'CellList';
SA(data, 'CellList', dispatch); dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
dispatch({ type: 'CellList/ResultClear' }); // 清空之前保存成功的结果 dispatch({ type: module + '/delRemove' }); // 清掉之前的详情
dispatch({ type: module + '/ResultClear' }); // 清空之前保存成功的结果
history.push(url); history.push(url);
}; };
...@@ -148,6 +172,7 @@ const TitleSearch = (props: any) => { ...@@ -148,6 +172,7 @@ const TitleSearch = (props: any) => {
</Col> </Col>
) : null} ) : null}
{/* 设施预约状态 */}
{status != null {status != null
? status.map((item: { name: string; data: Array<''>; default: any }, index: number) => { ? status.map((item: { name: string; data: Array<''>; default: any }, index: number) => {
return ( return (
...@@ -172,12 +197,20 @@ const TitleSearch = (props: any) => { ...@@ -172,12 +197,20 @@ const TitleSearch = (props: any) => {
); );
}) })
: null} : null}
{/* 时间 */}
{time != null ? ( {time != null ? (
<Col key="datePicker_"> <Col key="datePicker_">
{' '} {' '}
<DatePicker placeholder={time[1]} onChange={onChange} /> <DatePicker
placeholder={time[1]}
defaultValue={time[2] ? moment(time[2], 'YYYY/MM/DD') : null}
onChange={onChange}
/>
</Col> </Col>
) : null} ) : null}
{/* 搜索btn */}
{community == null ? ( {community == null ? (
<Col> <Col>
<Form.Item> <Form.Item>
......
...@@ -147,6 +147,7 @@ export default { ...@@ -147,6 +147,7 @@ export default {
}, },
*delRemove({ playload }, { call, put }) { *delRemove({ playload }, { call, put }) {
console.log('触发');
var detailData = null; var detailData = null;
yield put({ type: 'returnDataSaveDetail', detailData }); yield put({ type: 'returnDataSaveDetail', detailData });
}, },
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
//表格1搜索条件 //表格1搜索条件
search: { search: {
communityNameList: null, // 小区 communityNameList: null, // 小区
status: 0, //状态 status: null, //状态
subscribeDate: null, // 时间 subscribeDate: null, // 时间
pageNum: 1, // 页码 pageNum: 1, // 页码
globalMark: 'yes', // 状态 globalMark: 'yes', // 状态
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
// 表格 // 表格
returnTab(state, { tabs }) { returnTab(state, { tabs }) {
let tab = tabs; let tab = tabs;
console.log({ ...state, tab }); // console.log({ ...state, tab });
return { ...state, tab }; return { ...state, tab };
}, },
// 表格1 搜索条件 // 表格1 搜索条件
...@@ -256,7 +256,7 @@ export default { ...@@ -256,7 +256,7 @@ export default {
// 当前表格 // 当前表格
*TB({ playload }, { call, put }) { *TB({ playload }, { call, put }) {
console.log(playload); // console.log(playload);
var tabs = playload; var tabs = playload;
yield put({ type: 'returnTab', tabs }); yield put({ type: 'returnTab', tabs });
}, },
......
...@@ -153,17 +153,11 @@ const Account = (props: any) => { ...@@ -153,17 +153,11 @@ const Account = (props: any) => {
// 表头单搜索 // 表头单搜索
const onFinishContract = (value: any) => { const onFinishContract = (value: any) => {
if (value.tosAccountName || value.creatorName) { value.creatorId = user.id;
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '[]');
value.creatorId = userInfo.userModel.id;
let t = { ...term, ...value }; let t = { ...term, ...value };
delete t.pageNum; // 搜索的时候 删除页码 delete t.pageNum; // 搜索的时候 删除页码
setTerm(t); setTerm(t);
RA(51, t); RA(51, t);
} else {
message.error('Enter At Least One Entry!');
}
}; };
// 页码切换 // 页码切换
......
...@@ -20,7 +20,7 @@ const { RangePicker } = TimePicker; ...@@ -20,7 +20,7 @@ const { RangePicker } = TimePicker;
const Adds = (props: any) => { const Adds = (props: any) => {
const module = 'CellList'; const module = 'CellList';
const { Data, detailData, dispatch, loading, imgUrl, Result } = props; const { detailData, dispatch, loading, imgUrl, Result, match } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -33,27 +33,22 @@ const Adds = (props: any) => { ...@@ -33,27 +33,22 @@ const Adds = (props: any) => {
const [codeStrat, setcodeStrat] = useState(true); // 是否开放上传 默认没填写不允许 const [codeStrat, setcodeStrat] = useState(true); // 是否开放上传 默认没填写不允许
const [info, setInfo] = useState(false); // 是否允许更改小区邮编地址名称 默认可以 const [info, setInfo] = useState(false); // 是否允许更改小区邮编地址名称 默认可以
const [banners, setBanners] = useState(null as any); // bannner // match 是路由属性
// 赋值
useEffect(() => { useEffect(() => {
// 如果是添加传来没有值的时候 就清空 否则 赋值给表单 if (match.params.id) {
if (Data) { RA(64, { id: match.params.id }, module, dispatch);
//发起请求
RA(64, { id: Data.id }, module, dispatch);
} else {
console.log('新建');
} }
}, [Data]); }, [match]);
// 详情 // 详情
useEffect(() => { useEffect(() => {
if (Data && detailData) { if (detailData && detailData != {}) {
let { communityData } = detailData; let { communityData } = detailData;
// 赋值 // 要判断是不是拿取到了
if (communityData) {
form.setFieldsValue({ form.setFieldsValue({
// communityData, communityData,
des: { des: {
residentialZipCode: communityData.residentialZipCode.substring( residentialZipCode: communityData.residentialZipCode.substring(
communityData.residentialZipCode.length - 6, communityData.residentialZipCode.length - 6,
...@@ -88,20 +83,21 @@ const Adds = (props: any) => { ...@@ -88,20 +83,21 @@ const Adds = (props: any) => {
setForms(true); setForms(true);
} }
} }
}
}, [detailData]); }, [detailData]);
// 提交成功与否 // 提交成功与否
useEffect(() => { useEffect(() => {
if (Result != null) { if (Result != null) {
// 如果不是编辑的话就更新本地小区 // 如果不是编辑的话就更新本地小区
if (!Data) { if (!match.params.id) {
dispatch({ type: 'Init/addCommunityget', playload: { Result: new Array(Result.data) } }); dispatch({ type: 'Init/addCommunityget', playload: { Result: new Array(Result.data) } });
} }
// 提示跳转 // 提示跳转
// message.success(`Information saved successfully!`); // message.success(`Information saved successfully!`);
history.push('/CommunityManagement/CellList'); history.push('/CommunityManagement/CellList');
} }
}, [Result, Data]); }, [Result, match]);
// 监听表单的值 // 监听表单的值
...@@ -222,11 +218,10 @@ const Adds = (props: any) => { ...@@ -222,11 +218,10 @@ const Adds = (props: any) => {
delete values.help; delete values.help;
delete values.workingHours; delete values.workingHours;
if (Data) { if (match.params.id) {
values.id = Data.id; values.id = match.params.id;
} }
console.log(values);
// 上传 // 上传
RA(63, values, module, dispatch); RA(63, values, module, dispatch);
} }
...@@ -316,7 +311,7 @@ const Adds = (props: any) => { ...@@ -316,7 +311,7 @@ const Adds = (props: any) => {
<div className="form"> <div className="form">
<h3 className="capi"> <h3 className="capi">
<EditOutlined /> <EditOutlined />
&nbsp; {Data ? 'edit' : 'Create New'} community &nbsp; {match && match.params ? 'edit' : 'Create New'} community
<div className="back"> <div className="back">
<Button onClick={goToReturn}> <Button onClick={goToReturn}>
<LeftOutlined /> <LeftOutlined />
...@@ -348,9 +343,7 @@ const Adds = (props: any) => { ...@@ -348,9 +343,7 @@ const Adds = (props: any) => {
LoseFocus(v); LoseFocus(v);
}} }}
defaultvalue={ defaultvalue={
Data && detailData && Data && detailData.communityData detailData && detailData.communityData ? detailData.communityData : null
? detailData.communityData
: null
} }
/> />
</Form.Item> </Form.Item>
...@@ -414,7 +407,7 @@ const Adds = (props: any) => { ...@@ -414,7 +407,7 @@ const Adds = (props: any) => {
}} }}
limitNums={1} limitNums={1}
over={codeStrat} over={codeStrat}
CommunityValue={Data && detailData && detailData.banner ? detailData.banner : null} CommunityValue={detailData && detailData.banner ? detailData.banner : null}
// imgs={ImageSrc} // imgs={ImageSrc}
// disabled={codeStrat} // disabled={codeStrat}
/> />
...@@ -437,7 +430,7 @@ const Adds = (props: any) => { ...@@ -437,7 +430,7 @@ const Adds = (props: any) => {
}} }}
disabled={codeStrat} disabled={codeStrat}
detailvalue={ detailvalue={
Data && detailData && detailData.communityMainPdfList detailData && detailData.communityMainPdfList
? detailData.communityMainPdfList ? detailData.communityMainPdfList
: null : null
} }
...@@ -468,7 +461,7 @@ const Adds = (props: any) => { ...@@ -468,7 +461,7 @@ const Adds = (props: any) => {
}} }}
disabled={codeStrat} disabled={codeStrat}
detailvalue={ detailvalue={
Data && detailData && detailData.communityEssentialPdfList detailData && detailData.communityEssentialPdfList
? detailData.communityEssentialPdfList ? detailData.communityEssentialPdfList
: null : null
} }
...@@ -501,7 +494,7 @@ const Adds = (props: any) => { ...@@ -501,7 +494,7 @@ const Adds = (props: any) => {
}} }}
disabled={codeStrat} disabled={codeStrat}
detailvalue={ detailvalue={
Data && detailData && detailData.communityFormsPdfList detailData && detailData.communityFormsPdfList
? detailData.communityFormsPdfList ? detailData.communityFormsPdfList
: null : null
} }
...@@ -551,9 +544,8 @@ const Adds = (props: any) => { ...@@ -551,9 +544,8 @@ const Adds = (props: any) => {
// export default Adds; // export default Adds;
function map(state: any) { function map(state: any) {
// console.log(state); // console.log(state);
const Data = state.CellList.DataSave;
const { imgUrl, Result, detailData } = state.CellList; const { imgUrl, Result, detailData } = state.CellList;
const loading = state.loading.models.CellList ? state.loading.models.CellList : false; const loading = state.loading.models.CellList ? state.loading.models.CellList : false;
return { Data, loading, Result, imgUrl, detailData }; return { loading, Result, imgUrl, detailData };
} }
export default connect(map)(Adds); export default connect(map)(Adds);
...@@ -90,7 +90,7 @@ const CellLists = (props: any) => { ...@@ -90,7 +90,7 @@ const CellLists = (props: any) => {
dispatch({ type: module + '/delRemove' }); // 清掉之前的详情 dispatch({ type: module + '/delRemove' }); // 清掉之前的详情
dispatch({ type: module + '/ResultClear' }); // 清空之前保存成功的结果 dispatch({ type: module + '/ResultClear' }); // 清空之前保存成功的结果
SA(data, module, dispatch); SA(data, module, dispatch);
history.push(url); history.push(url + '/' + data.id);
}; };
// 点击搜索 // 点击搜索
...@@ -119,11 +119,6 @@ const CellLists = (props: any) => { ...@@ -119,11 +119,6 @@ const CellLists = (props: any) => {
RA(48, t, module, dispatch); RA(48, t, module, dispatch);
}; };
// 刷新
const resetHandler = () => {
RA(48, term, module, dispatch);
};
return ( return (
<div> <div>
{village != null ? ( {village != null ? (
......
...@@ -21,7 +21,9 @@ import fileDownload from 'js-file-download'; ...@@ -21,7 +21,9 @@ import fileDownload from 'js-file-download';
const Detail = (props: any) => { const Detail = (props: any) => {
const module = 'CellList'; const module = 'CellList';
const { detailData, DataSave, dispatch, loading, overCom, user, CommunityList } = props; const { detailData, DataSave, dispatch, loading, overCom, user, CommunityList, match } = props;
// console.log(match);
// 关闭提示框 // 关闭提示框
const [ModelFee, setModelFee] = useState(false); const [ModelFee, setModelFee] = useState(false);
...@@ -29,20 +31,16 @@ const Detail = (props: any) => { ...@@ -29,20 +31,16 @@ const Detail = (props: any) => {
const [ModelExcel, setModelExcel] = useState(false); const [ModelExcel, setModelExcel] = useState(false);
const [ModelResult, setModelResult] = useState(null as any); const [ModelResult, setModelResult] = useState(null as any);
// match 是路由属性
useEffect(() => { useEffect(() => {
console.log(DataSave); if (match) {
if (DataSave) { RA(64, { id: match.params.id }, module, dispatch);
// 32 老的接口 64 新的接口
RA(64, { id: DataSave.id }, module, dispatch);
} else {
// 返回列表
history.push('/CommunityManagement/CellList');
} }
}, [1]); }, [match]);
useEffect(() => { useEffect(() => {
if (detailData) { if (detailData) {
console.log(detailData); // console.log(detailData);
} }
}, [detailData]); }, [detailData]);
......
...@@ -211,8 +211,8 @@ const FacilityBookings = (props: any) => { ...@@ -211,8 +211,8 @@ const FacilityBookings = (props: any) => {
// let tmp = JSON.parse(JSON.stringify(search)); // let tmp = JSON.parse(JSON.stringify(search));
let obj = { let obj = {
communityNameList: search.communityNameList ? search.communityNameList : CommunityList, communityNameList: search.communityNameList ? search.communityNameList : CommunityList,
subscribeDate: search.subscribeDate ? search.subscribeDate : null, // 时间 subscribeDate: search.subscribeDate !== null ? search.subscribeDate : null, // 时间
status: search.status ? search.status : null, // 状态 status: search.status !== null ? search.status : null, // 状态
pageNum: search.pageNum ? search.pageNum : 1, // 实际搜索页码 pageNum: search.pageNum ? search.pageNum : 1, // 实际搜索页码
globalMark: search.globalMark ? search.globalMark : 'no', // 搜索全部内容 globalMark: search.globalMark ? search.globalMark : 'no', // 搜索全部内容
}; };
...@@ -243,7 +243,7 @@ const FacilityBookings = (props: any) => { ...@@ -243,7 +243,7 @@ const FacilityBookings = (props: any) => {
let obj = { let obj = {
communityNameList: comment.communityName ? comment.communityName : null, // 所选小区 communityNameList: comment.communityName ? comment.communityName : null, // 所选小区
subscribeDate: comment.key ? comment.key : null, // 时间 subscribeDate: comment.key ? comment.key : null, // 时间
status: comment.status ? comment.status : null, // 状态 status: comment.status !== null ? comment.status : null, // 状态
pageNum: 1, // 实际搜索页码 pageNum: 1, // 实际搜索页码
globalMark: 'no', // 搜索全部内容 globalMark: 'no', // 搜索全部内容
}; };
...@@ -323,8 +323,8 @@ const FacilityBookings = (props: any) => { ...@@ -323,8 +323,8 @@ const FacilityBookings = (props: any) => {
communityNameList: v.communityNameList ? v.communityNameList : null, communityNameList: v.communityNameList ? v.communityNameList : null,
userToken: token, userToken: token,
pageNum: v.pageNum ? v.pageNum : '1', pageNum: v.pageNum ? v.pageNum : '1',
subscribeDate: v.subscribeDate ? v.subscribeDate : null, subscribeDate: v.subscribeDate !== null ? v.subscribeDate : null,
status: v.status ? v.status : null, status: v.status !== null ? v.status : null,
globalMark: v.globalMark ? v.globalMark : 'yes', globalMark: v.globalMark ? v.globalMark : 'yes',
}; };
QA({ ...obj }); QA({ ...obj });
...@@ -369,7 +369,7 @@ const FacilityBookings = (props: any) => { ...@@ -369,7 +369,7 @@ const FacilityBookings = (props: any) => {
default: search.status, default: search.status,
}, },
]} ]}
time={['key', 'Booking time ']} time={['key', 'Booking time ', search.subscribeDate]}
community={'communityName'} community={'communityName'}
checklist={search.communityNameList ? search.communityNameList : []} checklist={search.communityNameList ? search.communityNameList : []}
onSubmit={CallBackTitleSearch} onSubmit={CallBackTitleSearch}
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 16:54:53 * @Date: 2020-11-19 16:54:53
* @LastEditTime: 2021-02-06 13:53:48 * @LastEditTime: 2021-02-25 09:46:30
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\tip.ts * @FilePath: \tostumi\src\utils\tip.ts
...@@ -115,5 +115,10 @@ export const BookingsTip = [ ...@@ -115,5 +115,10 @@ export const BookingsTip = [
export const AccountTip = [ export const AccountTip = [
[{ ...reqMes('Please enter email address !'), type: 'email' }], [{ ...reqMes('Please enter email address !'), type: 'email' }],
[reqMes('Please enter the name !')], [reqMes('Please enter the name !')],
[reqMes('Please enter the correct telephone !')], [
{
...reqMes('PPlease input (8 or 11 digits) !'),
validator: inputNumberTel,
},
],
]; ];
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