Commit 32dd96d7 authored by cellee's avatar cellee

编辑详情加ID

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