Commit facdac8c authored by cellee's avatar cellee

报告删除,以及其样式修改

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 2453bef3
import React from 'react'; /*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2021-03-04 10:22:29
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\TitleBack\TitleBack.tsx
*/
import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Button, Modal } from 'antd';
import BackButton from '../BackButton/BackButton'; import BackButton from '../BackButton/BackButton';
import TitleGet from '../TitleGet/TitleGet'; import TitleGet from '../TitleGet/TitleGet';
const TitleBack = (props: any) => { const TitleBack = (props: any) => {
// <TitleBack sublist={['Handle Status : '+CurDataDetail.status,'Create Time : '+CurDataDetail.time]} title={headTitle} /> // <TitleBack sublist={['Handle Status : '+CurDataDetail.status,'Create Time : '+CurDataDetail.time]} title={headTitle} />
const [isModalVisible, setIsModalVisible] = useState(false);
const backData = (values: any) => { const backData = (values: any) => {
props.titleBack(values); props.titleBack(values);
}; };
useEffect(() => {
if (props.Result) {
setIsModalVisible(false);
}
}, [props.Result]);
const showModal = () => {
setIsModalVisible(true);
};
const handleOk = () => {
// setIsModalVisible(false);
props.handleOk();
};
const handleCancel = () => {
setIsModalVisible(false);
};
return ( return (
<> <>
<div className={styles.item0}> <div className={styles.item0}>
...@@ -26,9 +56,24 @@ const TitleBack = (props: any) => { ...@@ -26,9 +56,24 @@ const TitleBack = (props: any) => {
<></> <></>
)} )}
<div className={styles.item2}> <div className={styles.item2}>
{props.del ? (
<Button danger style={{ marginRight: 15 }} onClick={showModal}>
{props.del}
</Button>
) : null}
<BackButton backFunction={backData} url={props.url} /> <BackButton backFunction={backData} url={props.url} />
</div> </div>
<div className={styles.clear0}></div> <div className={styles.clear0}></div>
<Modal
title="Tips"
visible={isModalVisible}
onOk={handleOk}
confirmLoading={props.loading}
onCancel={handleCancel}
>
<p>Are you sure you want to delete this entry?</p>
</Modal>
</> </>
); );
}; };
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-01-14 09:23:51 * @Date: 2021-01-14 09:23:51
* @LastEditTime: 2021-03-03 15:44:51 * @LastEditTime: 2021-03-04 10:27:51
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\CommunityManagement\Bug.ts * @FilePath: \tostumi\src\models\CommunityManagement\Bug.ts
...@@ -17,6 +17,7 @@ export default { ...@@ -17,6 +17,7 @@ export default {
state: { state: {
Data: null, Data: null,
DataSave: null, DataSave: null,
Result: null,
}, },
reducers: { reducers: {
...@@ -30,6 +31,9 @@ export default { ...@@ -30,6 +31,9 @@ export default {
let DataSave = { ...state.DataSave, ...Community }; let DataSave = { ...state.DataSave, ...Community };
return { ...state, DataSave }; return { ...state, DataSave };
}, },
returnResult(state, { Result }) {
return { ...state, Result };
},
}, },
effects: { effects: {
...@@ -40,6 +44,12 @@ export default { ...@@ -40,6 +44,12 @@ export default {
if (resp.error_code != '0000') { if (resp.error_code != '0000') {
printf(playload, resp); printf(playload, resp);
message.error(`${resp.error_code}:${resp.error_msg}`); message.error(`${resp.error_code}:${resp.error_msg}`);
} else if (resp.error_code == '0002') {
// 不存在
let Data = null;
yield put({ type: 'returnPage', Data });
message.error(`The information does not exist!`);
history.push('/AccountManagement/service');
} else { } else {
console.log(playload); console.log(playload);
switch (playload.index) { switch (playload.index) {
...@@ -70,15 +80,32 @@ export default { ...@@ -70,15 +80,32 @@ export default {
history.push('/AccountManagement/service'); history.push('/AccountManagement/service');
} }
break; break;
case 73: // 删除报告
{
let Result = {
msg: 'Successfully deleted',
state: '0000',
};
yield put({ type: 'returnResult', Result });
// let Community = resp.data;
// Community.communityName = playload.body.communityName;
// yield put({ type: 'returnDataSaveCommunity', Community });
}
break;
} }
} }
}, },
*SA({ DataSave }, { call, put }) { *SA({ playload }, { call, put }) {
yield put({ type: 'returnDataSave', DataSave }); let Data = null;
yield put({ type: 'returnPage', Data });
}, },
*ResultDataSave({ playload }, { call, put }) { *ResultDataSave({ playload }, { call, put }) {
let DataSave = null; let DataSave = null;
yield put({ type: 'returnDataSave', DataSave }); yield put({ type: 'returnDataSave', DataSave });
}, },
*Result({ playload }, { call, put }) {
let Result = null;
yield put({ type: 'returnResult', Result });
},
}, },
}; };
...@@ -22,3 +22,7 @@ hr { ...@@ -22,3 +22,7 @@ hr {
background: #eee; background: #eee;
margin-bottom: 24px; margin-bottom: 24px;
} }
.diys {
display: inline-block;
margin-left: 10%;
}
...@@ -59,7 +59,7 @@ const service = (props: any) => { ...@@ -59,7 +59,7 @@ const service = (props: any) => {
emptys(record, '/AccountManagement/service/detail'); emptys(record, '/AccountManagement/service/detail');
}} }}
> >
Delete Detail
</a> </a>
</Space> </Space>
), ),
...@@ -86,7 +86,7 @@ const service = (props: any) => { ...@@ -86,7 +86,7 @@ const service = (props: any) => {
// 清除操作之前的数据 // 清除操作之前的数据
const emptys = (data: any, url: any) => { const emptys = (data: any, url: any) => {
// dispatch({ type: module + '/urlRemove' }); // 清掉图片信息 // dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
// dispatch({ type: module + '/delRemove' }); // 清掉之前的详情 dispatch({ type: module + '/Result' }); // 清掉之前的删除结果
dispatch({ type: module + '/ResultDataSave' }); // 清空详情缓存 dispatch({ type: module + '/ResultDataSave' }); // 清空详情缓存
// SA(data, module, dispatch); // SA(data, module, dispatch);
history.push(url + '/' + data.id); history.push(url + '/' + data.id);
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-03-02 14:39:40 * @Date: 2021-03-02 14:39:40
* @LastEditTime: 2021-03-03 16:23:36 * @LastEditTime: 2021-03-04 10:48:08
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\pages\AccountManagement\Service\serviceEdit.tsx * @FilePath: \tostumi\src\pages\AccountManagement\Service\serviceEdit.tsx
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Button, Spin, Form, Input } from 'antd'; import { Button, Spin, Form, Input } from 'antd';
import { connect } from 'umi'; import { connect, history } from 'umi';
const { TextArea } = Input; const { TextArea } = Input;
import { RA, SA } from '@/utils/method'; import { RA, SA } from '@/utils/method';
...@@ -19,7 +19,7 @@ import TitleBack from '@/components/TitleBack/TitleBack'; ...@@ -19,7 +19,7 @@ import TitleBack from '@/components/TitleBack/TitleBack';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow'; import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
const service = (props: any) => { const service = (props: any) => {
const { DataSave, dispatch, loading, match, user } = props; const { DataSave, dispatch, loading, match, user, Result } = props;
const [term, setTerm] = useState(null as any); // 默认小区 const [term, setTerm] = useState(null as any); // 默认小区
const [ImageSrc, setImageSrc] = useState([] as any); // 图片地址 const [ImageSrc, setImageSrc] = useState([] as any); // 图片地址
...@@ -54,6 +54,15 @@ const service = (props: any) => { ...@@ -54,6 +54,15 @@ const service = (props: any) => {
} }
}, [DataSave]); }, [DataSave]);
// 删除结果
useEffect(() => {
if (Result) {
setTimeout(() => {
dispatch({ type: module + '/SA' }); // 清空详情缓存
history.push('/AccountManagement/service');
}, 300);
}
}, [Result]);
//onFinish 提交 //onFinish 提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
values.reportId = match.params.id; values.reportId = match.params.id;
...@@ -63,11 +72,23 @@ const service = (props: any) => { ...@@ -63,11 +72,23 @@ const service = (props: any) => {
RA(71, values, module, dispatch); RA(71, values, module, dispatch);
}; };
// 确认删除
const handleOk = () => {
console.log('触发');
RA(73, { ids: match.params.id }, module, dispatch);
};
return ( return (
<Spin spinning={loading}> <Spin spinning={loading}>
<div className="edit"> <div className="edit">
{/* 标题 */} {/* 标题 */}
<TitleBack title={'Report details'} /> <TitleBack
title={'Report details'}
del={'Report delete'}
handleOk={handleOk}
loading={loading}
Result={Result}
/>
{/* 信息 */} {/* 信息 */}
<div className="form_s"> <div className="form_s">
<Form <Form
...@@ -131,7 +152,10 @@ const service = (props: any) => { ...@@ -131,7 +152,10 @@ const service = (props: any) => {
<div key={idx}> <div key={idx}>
{/* 回复人 */} {/* 回复人 */}
<Form.Item label="Contact Details"> <Form.Item label="Contact Details">
<span>{`${v.replyName} - ${v.replyPhone}`}</span> <div>
<span>{v.replyName}</span> <span className="diys">Telephone : </span>{' '}
<span>{v.replyPhone}</span>
</div>
</Form.Item> </Form.Item>
{/* 回复内容 */} {/* 回复内容 */}
<Form.Item label="Overview"> <Form.Item label="Overview">
...@@ -192,10 +216,10 @@ const service = (props: any) => { ...@@ -192,10 +216,10 @@ const service = (props: any) => {
}; };
function map(state: any) { function map(state: any) {
console.log(state); // console.log(state);
const loading = state.loading.models.ServicePro; const loading = state.loading.models.ServicePro;
const { Init, user } = state; const { Init, user } = state;
const { DataSave, curString, village } = state[module]; const { DataSave, Result } = state[module];
return { DataSave, loading, curString, village, Init, user }; return { DataSave, loading, Result, Init, user };
} }
export default connect(map)(service); export default connect(map)(service);
...@@ -209,6 +209,9 @@ const Account = (props: any) => { ...@@ -209,6 +209,9 @@ const Account = (props: any) => {
permissionArray: newData, permissionArray: newData,
}; };
// 是否是报告员
value.isReporter = newData.find((i) => i == 71) ? 1 : 0;
// console.log(value); // console.log(value);
// console.log(obj); // console.log(obj);
RA(38, value, module, dispatch); // 信息上传 RA(38, value, module, dispatch); // 信息上传
......
...@@ -231,14 +231,10 @@ const Account = (props: any) => { ...@@ -231,14 +231,10 @@ const Account = (props: any) => {
permissionArray: newData, permissionArray: newData,
subPermissionArray, subPermissionArray,
}; };
// Promise.all([RA(38, value, module, dispatch), RA(42, obj, module, dispatch)]).then(
// (v: any) => { // 是否是报告员
// console.log(v); value.isReporter = newData.find((i) => i == 71) ? 1 : 0;
// },
// (e: any) => {
// console.log(e);
// },
// );
RA(38, value, module, dispatch); // 信息上传 RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传 RA(42, obj, module, dispatch); // 权限上传
setLoading(true); setLoading(true);
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 20:34:18 * @Date: 2020-11-19 20:34:18
* @LastEditTime: 2021-03-03 15:51:17 * @LastEditTime: 2021-03-03 18:02:42
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts * @FilePath: \tostumi\src\utils\params.ts
...@@ -105,4 +105,5 @@ export const requestList = [ ...@@ -105,4 +105,5 @@ export const requestList = [
['/tos/report/edit', '70 web端报告编辑', {}], ['/tos/report/edit', '70 web端报告编辑', {}],
['/tos/report/reply', '71 web端报告员回复', {}], ['/tos/report/reply', '71 web端报告员回复', {}],
['/tos/community/get/address', '72 根据小区名搜索小区地址', {}], ['/tos/community/get/address', '72 根据小区名搜索小区地址', {}],
['/tos/report/delete', '73 删除报告', {}],
]; ];
...@@ -332,10 +332,10 @@ export const enUsFaci = [ ...@@ -332,10 +332,10 @@ export const enUsFaci = [
children: [{ title: 'View Visitor Record', key: '61', disableCheckbox: true }], children: [{ title: 'View Visitor Record', key: '61', disableCheckbox: true }],
}, },
{ {
title: 'Building Condit', title: 'Building Condition Report',
key: '71', key: '71',
disabled: true, disabled: true,
children: [{ title: 'Building Condit', key: '72', disableCheckbox: true }], children: [{ title: 'Building Condition Report', key: '72', disableCheckbox: true }],
}, },
{ {
title: 'Account Management', title: 'Account Management',
......
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