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 { Button, Modal } from 'antd';
import BackButton from '../BackButton/BackButton';
import TitleGet from '../TitleGet/TitleGet';
const TitleBack = (props: any) => {
// <TitleBack sublist={['Handle Status : '+CurDataDetail.status,'Create Time : '+CurDataDetail.time]} title={headTitle} />
const [isModalVisible, setIsModalVisible] = useState(false);
const backData = (values: any) => {
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 (
<>
<div className={styles.item0}>
......@@ -26,9 +56,24 @@ const TitleBack = (props: any) => {
<></>
)}
<div className={styles.item2}>
{props.del ? (
<Button danger style={{ marginRight: 15 }} onClick={showModal}>
{props.del}
</Button>
) : null}
<BackButton backFunction={backData} url={props.url} />
</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
* @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
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\CommunityManagement\Bug.ts
......@@ -17,6 +17,7 @@ export default {
state: {
Data: null,
DataSave: null,
Result: null,
},
reducers: {
......@@ -30,6 +31,9 @@ export default {
let DataSave = { ...state.DataSave, ...Community };
return { ...state, DataSave };
},
returnResult(state, { Result }) {
return { ...state, Result };
},
},
effects: {
......@@ -40,6 +44,12 @@ export default {
if (resp.error_code != '0000') {
printf(playload, resp);
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 {
console.log(playload);
switch (playload.index) {
......@@ -70,15 +80,32 @@ export default {
history.push('/AccountManagement/service');
}
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 }) {
yield put({ type: 'returnDataSave', DataSave });
*SA({ playload }, { call, put }) {
let Data = null;
yield put({ type: 'returnPage', Data });
},
*ResultDataSave({ playload }, { call, put }) {
let DataSave = null;
yield put({ type: 'returnDataSave', DataSave });
},
*Result({ playload }, { call, put }) {
let Result = null;
yield put({ type: 'returnResult', Result });
},
},
};
......@@ -22,3 +22,7 @@ hr {
background: #eee;
margin-bottom: 24px;
}
.diys {
display: inline-block;
margin-left: 10%;
}
......@@ -59,7 +59,7 @@ const service = (props: any) => {
emptys(record, '/AccountManagement/service/detail');
}}
>
Delete
Detail
</a>
</Space>
),
......@@ -86,7 +86,7 @@ const service = (props: any) => {
// 清除操作之前的数据
const emptys = (data: any, url: any) => {
// dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
// dispatch({ type: module + '/delRemove' }); // 清掉之前的详情
dispatch({ type: module + '/Result' }); // 清掉之前的删除结果
dispatch({ type: module + '/ResultDataSave' }); // 清空详情缓存
// SA(data, module, dispatch);
history.push(url + '/' + data.id);
......
/*
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\pages\AccountManagement\Service\serviceEdit.tsx
*/
import React, { useState, useEffect } from 'react';
import { Button, Spin, Form, Input } from 'antd';
import { connect } from 'umi';
import { connect, history } from 'umi';
const { TextArea } = Input;
import { RA, SA } from '@/utils/method';
......@@ -19,7 +19,7 @@ import TitleBack from '@/components/TitleBack/TitleBack';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
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 [ImageSrc, setImageSrc] = useState([] as any); // 图片地址
......@@ -54,6 +54,15 @@ const service = (props: any) => {
}
}, [DataSave]);
// 删除结果
useEffect(() => {
if (Result) {
setTimeout(() => {
dispatch({ type: module + '/SA' }); // 清空详情缓存
history.push('/AccountManagement/service');
}, 300);
}
}, [Result]);
//onFinish 提交
const onFinish = (values: any) => {
values.reportId = match.params.id;
......@@ -63,11 +72,23 @@ const service = (props: any) => {
RA(71, values, module, dispatch);
};
// 确认删除
const handleOk = () => {
console.log('触发');
RA(73, { ids: match.params.id }, module, dispatch);
};
return (
<Spin spinning={loading}>
<div className="edit">
{/* 标题 */}
<TitleBack title={'Report details'} />
<TitleBack
title={'Report details'}
del={'Report delete'}
handleOk={handleOk}
loading={loading}
Result={Result}
/>
{/* 信息 */}
<div className="form_s">
<Form
......@@ -131,7 +152,10 @@ const service = (props: any) => {
<div key={idx}>
{/* 回复人 */}
<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 label="Overview">
......@@ -192,10 +216,10 @@ const service = (props: any) => {
};
function map(state: any) {
console.log(state);
// console.log(state);
const loading = state.loading.models.ServicePro;
const { Init, user } = state;
const { DataSave, curString, village } = state[module];
return { DataSave, loading, curString, village, Init, user };
const { DataSave, Result } = state[module];
return { DataSave, loading, Result, Init, user };
}
export default connect(map)(service);
......@@ -209,6 +209,9 @@ const Account = (props: any) => {
permissionArray: newData,
};
// 是否是报告员
value.isReporter = newData.find((i) => i == 71) ? 1 : 0;
// console.log(value);
// console.log(obj);
RA(38, value, module, dispatch); // 信息上传
......
......@@ -231,14 +231,10 @@ 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);
// },
// );
// 是否是报告员
value.isReporter = newData.find((i) => i == 71) ? 1 : 0;
RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传
setLoading(true);
......
/*
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts
......@@ -105,4 +105,5 @@ export const requestList = [
['/tos/report/edit', '70 web端报告编辑', {}],
['/tos/report/reply', '71 web端报告员回复', {}],
['/tos/community/get/address', '72 根据小区名搜索小区地址', {}],
['/tos/report/delete', '73 删除报告', {}],
];
......@@ -332,10 +332,10 @@ export const enUsFaci = [
children: [{ title: 'View Visitor Record', key: '61', disableCheckbox: true }],
},
{
title: 'Building Condit',
title: 'Building Condition Report',
key: '71',
disabled: true,
children: [{ title: 'Building Condit', key: '72', disableCheckbox: true }],
children: [{ title: 'Building Condition Report', key: '72', disableCheckbox: true }],
},
{
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