Commit 508ba46c authored by cellee's avatar cellee

报告员

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 2eb42250
/*
* @Author: your name
* @Date: 2020-12-01 18:40:06
* @LastEditTime: 2021-02-25 11:57:26
* @LastEditTime: 2021-03-03 15:04:15
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\config\config.ts
......@@ -376,7 +376,19 @@ export default defineConfig({
{ path: '*', component: '@/pages/404' },
],
},
{
path: './service',
name: 'service',
routes: [
{ path: './', component: './AccountManagement/Service/service' },
{ path: './edit/:id', component: './AccountManagement/Service/serviceEdit' },
{
path: './detail/:id',
component: './AccountManagement/Service/serviceDetail',
},
{ path: '*', component: '@/pages/404' },
],
},
{
path: './SystemFeedback',
name: 'systemfeedback',
......
/*
* @Author: your name
* @Date: 2021-02-01 14:54:48
* @LastEditTime: 2021-02-25 14:28:02
* @LastEditTime: 2021-03-03 10:08:06
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
......@@ -214,7 +214,7 @@ const PdfUpload: React.FC<PriceInputProps> = ({
onChange && onChange(list);
}
// console.log(list);
setImgList([...list]);
};
......@@ -289,6 +289,8 @@ const PdfUpload: React.FC<PriceInputProps> = ({
const inpChange = (e: any) => {
let { id, value } = e.target;
let list = JSON.parse(JSON.stringify(imgList));
// console.log(imgList);
// console.log(id);
list[id].name = value;
// 在判断上传文件了没 ,上传了的话去掉提示
......@@ -312,7 +314,7 @@ const PdfUpload: React.FC<PriceInputProps> = ({
placeholder="Basic usage"
className="pdf-input"
onChange={inpChange}
// id={Math.floor(Math.random() * 100) as any}
id={index}
value={item.name}
disabled={disabled}
maxLength={30}
......
......@@ -30,7 +30,7 @@
}
.pdf-input {
width: 104px;
width: 208px;
margin-right: 10px;
}
.pdf-div {
......
......@@ -169,7 +169,7 @@ const PictureOptionsRow = (props: any) => {
onChange={handleChange} // 点击上传
disabled={props.over}
>
{fileList.length >= limitNum ? null : props.disabled ? null : uploadButton}
{fileList.length >= limitNum || props.over ? null : props.disabled ? null : uploadButton}
</Upload>
<Modal
title="Preview"
......
......@@ -81,6 +81,8 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
{ path: '/AccountManagement/account/Detail', title: '查看账号', key: '63' },
{ path: '/AccountManagement/account/edit', title: '编辑账号', key: '64' },
{ path: '/AccountManagement/account/Add', title: '添加账号', key: '65' },
//报告员
{ path: '/AccountManagement/service', title: '报告员', key: '71' },
];
// 用户重新打开需要重新登录
......
/*
* @Author: your name
* @Date: 2020-12-14 18:52:22
* @LastEditTime: 2021-01-12 14:43:56
* @LastEditors: your name
* @LastEditTime: 2021-03-03 16:23:17
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\locales\en-US\menu.ts
*/
......@@ -83,4 +83,5 @@ export default {
'menu.accountmanagement.systemfeedback': 'System Feedback',
'menu.accountmanagement.companyinformation': 'Company Information',
'menu.accountmanagement.languagesettings': 'Language Settings',
'menu.accountmanagement.service': 'Service Provider Management',
};
/*
* @Author: your name
* @Date: 2020-12-14 18:52:22
* @LastEditTime: 2021-03-01 10:05:23
* @LastEditors: your name
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\locales\zh-CN\menu.ts
*/
export default {
'menu.welcome': '欢迎',
'menu.more-blocks': '更多区块',
......@@ -75,4 +83,5 @@ export default {
'menu.accountmanagement.systemfeedback': 'BUG反馈',
'menu.accountmanagement.companyinformation': '公司信息',
'menu.accountmanagement.languagesettings': '语言设置',
'menu.accountmanagement.service': '报告员',
};
/*
* @Author: your name
* @Date: 2021-01-14 09:23:51
* @LastEditTime: 2021-03-03 15:44:51
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\CommunityManagement\Bug.ts
*/
import * as service from '../../services/tos';
import { message } from 'antd';
import { history } from 'umi';
import { printf } from '@/utils/log';
export default {
namespace: 'ServicePro',
state: {
Data: null,
DataSave: null,
},
reducers: {
returnPage(state, { Data }) {
return { ...state, Data };
},
returnDataSave(state, { DataSave }) {
return { ...state, DataSave };
},
returnDataSaveCommunity(state, { Community }) {
let DataSave = { ...state.DataSave, ...Community };
return { ...state, DataSave };
},
},
effects: {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
if (resp.error_code != '0000') {
printf(playload, resp);
message.error(`${resp.error_code}:${resp.error_msg}`);
} else {
console.log(playload);
switch (playload.index) {
case 68: // 获取列表
{
let Data = resp.data;
yield put({ type: 'returnPage', Data });
}
break;
case 69: // 获取详情
{
let DataSave = resp.data;
yield put({ type: 'returnDataSave', DataSave });
}
break;
case 72: // 小区改变
{
let Community = resp.data;
Community.communityName = playload.body.communityName;
yield put({ type: 'returnDataSaveCommunity', Community });
}
break;
case 70: // 小区编辑保存
case 71: // 小区回复保存
{
let Data = null;
yield put({ type: 'returnPage', Data });
history.push('/AccountManagement/service');
}
break;
}
}
},
*SA({ DataSave }, { call, put }) {
yield put({ type: 'returnDataSave', DataSave });
},
*ResultDataSave({ playload }, { call, put }) {
let DataSave = null;
yield put({ type: 'returnDataSave', DataSave });
},
},
};
.contop {
padding: 20px;
}
.pages {
padding: 20px;
text-align: right;
}
.edit {
padding: 20px;
.form_s {
margin-top: 20px;
}
}
.ant-form-item {
margin-bottom: 18px;
}
hr {
border: 0;
height: 1px;
background: #eee;
margin-bottom: 24px;
}
import React, { useState, useEffect } from 'react';
import { Space, message, Pagination, Spin } from 'antd';
import { connect, history } from 'umi';
import ProTable from '@ant-design/pro-table';
import TitleSearch from '@/components/TitleSearch/TitleSearch';
import { RA, SA } from '@/utils/method';
const module = 'ServicePro';
import './service.less';
import moment from 'moment';
const service = (props: any) => {
const columns = [
{
title: 'Community',
dataIndex: 'communityName',
key: 'communityName',
width: 240,
},
{
title: 'Rapporteur',
dataIndex: 'reporterName',
key: 'reporterName',
width: 160,
},
{
title: 'Upload description',
dataIndex: 'reportContent',
key: 'reportContent',
width: 400,
ellipsis: true,
},
{
title: 'Submission Time',
dataIndex: 'createTime',
key: 'createTime',
width: 160,
render: (text: any) => <span>{moment(text.time).format('YYYY-MM-DD')}</span>,
},
{
title: 'Action',
key: 'action',
width: 120,
render: (text: any, record: any) => (
<Space size="middle">
<a
onClick={() => {
emptys(record, `/AccountManagement/service/edit`);
}}
>
Edit
</a>
<a
onClick={() => {
emptys(record, '/AccountManagement/service/detail');
}}
>
Delete
</a>
</Space>
),
},
];
const { Data, dispatch, loading, Init } = props;
const [term, setTerm] = useState(null as any); // 拉取数据的条件存储
// 监听是否有数据
useEffect(() => {
if (Init.CommunityList !== null && Data == null) {
let obj = {
communityNameList: Init.CommunityList,
reporterName: null,
pageNum: 1,
};
setTerm({ ...obj });
RA(68, obj, module, dispatch);
}
}, [Init, Data]);
// 清除操作之前的数据
const emptys = (data: any, url: any) => {
// dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
// dispatch({ type: module + '/delRemove' }); // 清掉之前的详情
dispatch({ type: module + '/ResultDataSave' }); // 清空详情缓存
// SA(data, module, dispatch);
history.push(url + '/' + data.id);
};
// 点击搜索
const CallBackTitleSearch = (comment: any) => {
if (comment.communityName.length > 0 || typeof comment.label !== 'undefined') {
let obj = {
reporterName: comment.label,
communityNameList: comment.communityName.length > 0 ? comment.communityName : null,
pageNum: 1,
};
setTerm({ ...obj }); // 存进搜索条件
RA(68, obj, module, dispatch);
} else {
message.error('Please Enter And Select A Content To Search!');
}
};
// 点击页面属性传参数
const paginationHandler = (page: number, pageSize?: number) => {
let p = {
pageNum: page,
};
let t = { ...term, ...p };
setTerm(t);
RA(68, t, module, dispatch);
};
return (
<div>
<>
{/* <TitleSearch listkey={['communityName']} list={['Community Name']} onSubmit={CallBackTitleSearch}/> */}
<div className="contop">
<TitleSearch
username={['label', "Rapporteur's name"]}
community={'communityName'}
checklist={Init ? Init.CommunityList : []}
onSubmit={CallBackTitleSearch}
/>
</div>
<ProTable
pagination={false} // 隐藏默认分页
rowKey={'id'}
dataSource={Data ? Data.list : null}
columns={columns}
search={false}
loading={loading}
toolBarRender={false}
scroll={{ x: 980 }}
options={false}
headerTitle="Community List"
/>
{Data ? (
<div className="pages">
<Pagination
current={Data.page.currentPage}
total={Data.page.totalRow}
pageSize={Data.page.curPageSize}
onChange={paginationHandler}
showSizeChanger={false}
/>
</div>
) : (
''
)}
</>
</div>
);
};
function map(state: any) {
console.log(state);
const loading = state.loading.models.ServicePro;
const Init = state.Init;
const { Data, curString, village } = state[module];
return { Data, loading, curString, village, Init };
}
export default connect(map)(service);
/*
* @Author: your name
* @Date: 2021-03-02 14:39:40
* @LastEditTime: 2021-03-03 16:23:36
* @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';
const { TextArea } = Input;
import { RA, SA } from '@/utils/method';
const module = 'ServicePro';
import './service.less';
import TitleBack from '@/components/TitleBack/TitleBack';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
const service = (props: any) => {
const { DataSave, dispatch, loading, match, user } = props;
const [term, setTerm] = useState(null as any); // 默认小区
const [ImageSrc, setImageSrc] = useState([] as any); // 图片地址
const [form] = Form.useForm();
// 监听是否有数据
useEffect(() => {
if (match.params.id) {
RA(69, { id: match.params.id }, module, dispatch);
}
}, [match]);
useEffect(() => {
if (DataSave != null) {
setTerm({ ...DataSave });
if (DataSave.reportPictures.length > 0) {
// 图片名any
let a = DataSave.reportPictures.map((item: any, i: any) => {
let img = DataSave.reportImages.split(',');
let key = img[i];
return {
uid: i,
name: key,
status: 'done',
url: item,
};
});
// 图片列表
setImageSrc(a);
}
}
}, [DataSave]);
//onFinish 提交
const onFinish = (values: any) => {
values.reportId = match.params.id;
values.replyId = user.currentUser.userModel.id;
values.replyImages = values.replyImages.join(',');
// console.log(values);
RA(71, values, module, dispatch);
};
return (
<Spin spinning={loading}>
<div className="edit">
{/* 标题 */}
<TitleBack title={'Report details'} />
{/* 信息 */}
<div className="form_s">
<Form
name="basic"
form={form}
initialValues={{ remember: true }}
labelCol={{ xs: 12, sm: 6, md: 6, lg: 4, xl: 4, xxl: 2 }}
wrapperCol={{ xs: 12, sm: 18, md: 18, lg: 20, xl: 20, xxl: 22 }}
onFinish={onFinish}
>
{/* 小区名 */}
<Form.Item label="Community">{term ? term.communityName : null}</Form.Item>
{/* 小区地址 */}
<Form.Item label="Address">
<span>{term ? `${term.communityAddress} , ${term.postCode}` : null}</span>
</Form.Item>
{/* 报告人 */}
<Form.Item label="Rapporteur">
<span>{term ? term.reporterName : null}</span>
</Form.Item>
{/* 报告人联系方式 */}
<Form.Item label="Contact Details">
<span>{term ? term.reporterPhone : null}</span>
</Form.Item>
{/* 报告描述 */}
<Form.Item label="Description">
<TextArea
rows={4}
style={{ maxWidth: 600, width: '100%' }}
value={term ? term.reportContent : null}
disabled
/>
</Form.Item>
{/* 报告图片 */}
<Form.Item label="Picture">
<PictureOptionsRow
action="/tos/image/upload"
data={{
imageType: 'tosReportImage',
identification: '',
}}
limitNums={10}
imgs={ImageSrc}
over={true}
/>
</Form.Item>
<hr></hr>
{/* --------------------------------------------------------------------------------------------- */}
{term && term.replyData.length > 0
? term.replyData.map((v: any, idx: any) => {
let imgs = v.replyPictures.map((item: any, i: any) => {
return {
uid: i,
name: 'Imags',
status: 'done',
url: item,
};
});
return (
<div key={idx}>
{/* 回复人 */}
<Form.Item label="Contact Details">
<span>{`${v.replyName} - ${v.replyPhone}`}</span>
</Form.Item>
{/* 回复内容 */}
<Form.Item label="Overview">
<TextArea
rows={4}
style={{ maxWidth: 600, width: '100%' }}
value={v.replyContent}
disabled
/>
</Form.Item>
{/* 回复图片 */}
<Form.Item label="Picture">
<PictureOptionsRow
action="/tos/image/upload"
data={{
imageType: 'tosReportImage',
identification: '',
}}
limitNums={10}
imgs={imgs}
over={true}
/>
</Form.Item>
<hr></hr>
</div>
);
})
: null}
{/* --------------------------------------------------------------------------------------------- */}
{/* 回复描述 */}
<Form.Item label="Overview" name="replyContent" rules={[{ required: true }]}>
<TextArea rows={4} style={{ maxWidth: 600, width: '100%' }} />
</Form.Item>
{/* 回复图片 */}
<Form.Item label="Picture" name="replyImages" rules={[{ required: true }]}>
<PictureOptionsRow
action="/tos/image/upload"
data={{
imageType: 'tosReportImage',
identification: '',
}}
limitNums={10}
over={loading}
/>
</Form.Item>
{/* --------------------------------------------------------------------------------------------- */}
{/* 提交 */}
<Form.Item label=" " colon={false}>
<Button type="primary" loading={loading} htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
</div>
</div>
</Spin>
);
};
function map(state: any) {
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 };
}
export default connect(map)(service);
/*
* @Author: your name
* @Date: 2021-03-02 14:39:40
* @LastEditTime: 2021-03-03 14:56:54
* @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';
const { TextArea } = Input;
import { RA, SA } from '@/utils/method';
const module = 'ServicePro';
import './service.less';
import TitleBack from '@/components/TitleBack/TitleBack';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
import moment from 'moment';
const service = (props: any) => {
const { DataSave, dispatch, loading, match } = props;
const [term, setTerm] = useState(null as any); // 默认小区
const [ImageSrc, setImageSrc] = useState([] as any); // 图片地址
const [form] = Form.useForm();
// 监听是否有数据
useEffect(() => {
if (match.params.id) {
RA(69, { id: match.params.id }, module, dispatch);
}
}, [match]);
useEffect(() => {
if (DataSave != null) {
setTerm({ ...DataSave });
form.setFieldsValue({
communityName: DataSave.communityName,
reportContent: DataSave.reportContent,
reportImages: DataSave.reportImages ? DataSave.reportImages.split(',') : null,
});
if (DataSave.reportPictures.length > 0) {
// 图片名any
let a = DataSave.reportPictures.map((item: any, i: any) => {
let img = DataSave.reportImages.split(',');
let key = img[i];
return {
uid: i,
name: key,
status: 'done',
url: item,
};
});
// 图片列表
setImageSrc(a);
}
}
}, [DataSave]);
//onFinish 提交
const onFinish = (values: any) => {
values.id = match.params.id;
values.reportImages = values.reportImages.join(',');
RA(70, values, module, dispatch);
};
// 选择小区名字并赋值
const opname = (value: any) => {
// console.log(value);
if (value) {
RA(72, { communityName: value }, module, dispatch);
}
form.setFieldsValue({
communityName: value,
});
};
return (
<Spin spinning={loading}>
<div className="edit">
{/* 标题 */}
<TitleBack title={'Edit report'} />
{/* 信息 */}
<div className="form_s">
<Form
name="basic"
form={form}
initialValues={{ remember: true }}
labelCol={{ xs: 12, sm: 6, md: 6, lg: 4, xl: 4, xxl: 2 }}
wrapperCol={{ xs: 12, sm: 18, md: 18, lg: 20, xl: 20, xxl: 22 }}
onFinish={onFinish}
>
{/* 小区名 */}
<Form.Item label="Community" name="communityName" rules={[{ required: true }]}>
<SearchOptionsCommnity
// ubmit={extendName}
opname={opname}
defaultName={term ? term.communityName : null}
// type={1} // 单选还是多选 单选就直接去掉
/>
</Form.Item>
{/* 小区地址 */}
<Form.Item label="Address">
<span>{term ? `${term.communityAddress} , ${term.postCode}` : null}</span>
</Form.Item>
{/* 报告人 */}
<Form.Item label="Rapporteur">
<span>{term ? term.reporterName : null}</span>
</Form.Item>
{/* 报告人联系方式 */}
<Form.Item label="Contact Details">
<span>{term ? term.reporterPhone : null}</span>
</Form.Item>
{/* 报告描述 */}
<Form.Item label="Description" name="reportContent" rules={[{ required: true }]}>
<TextArea rows={4} style={{ maxWidth: 600, width: '100%' }} />
</Form.Item>
{/* 报告图片 */}
<Form.Item label="Picture" name="reportImages" rules={[{ required: true }]}>
<PictureOptionsRow
action="/tos/image/upload"
data={{
imageType: 'tosReportImage',
identification: '',
}}
limitNums={10}
imgs={ImageSrc}
over={loading}
/>
</Form.Item>
{/* --------------------------------------------------------------------------------------------- */}
{/* 提交 */}
<Form.Item label=" " colon={false}>
<Button type="primary" loading={loading} htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
</div>
</div>
</Spin>
);
};
function map(state: any) {
const loading = state.loading.models.ServicePro;
const Init = state.Init;
const { DataSave, curString, village } = state[module];
return { DataSave, loading, curString, village, Init };
}
export default connect(map)(service);
......@@ -478,7 +478,7 @@ const Adds = (props: any) => {
<div className="formBox">
{forms ? (
<div className="pdfform">
<p style={{ marginBottom: 6 }}>Form</p>
<p style={{ marginBottom: 6 }}>Forms</p>
<Form.Item
name={'formsPdfList'}
label=""
......@@ -503,7 +503,7 @@ const Adds = (props: any) => {
</div>
) : (
<div className="acitves">
<Button onClick={switchs}>Form</Button>
<Button onClick={switchs}>Click to upload forms</Button>
</div>
)}
</div>
......
/*
* @Author: your name
* @Date: 2020-11-19 20:34:18
* @LastEditTime: 2021-02-23 17:12:49
* @LastEditTime: 2021-03-03 15:51:17
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts
......@@ -100,4 +100,9 @@ export const requestList = [
['/tos/tosCompany/edit', '65 修改公司信息', {}],
['/tos/tosCompany/get', '66 获取公司信息', {}],
['/tos/users/edit', '67 修改admin信息', {}],
['/tos/report/get/list', '68 web端报告列表', {}],
['/tos/report/get/detail', '69 web端报告详情', {}],
['/tos/report/edit', '70 web端报告编辑', {}],
['/tos/report/reply', '71 web端报告员回复', {}],
['/tos/community/get/address', '72 根据小区名搜索小区地址', {}],
];
......@@ -154,6 +154,12 @@ export const zhCnFaci = [
disabled: true,
children: [{ title: '查看访客记录', key: '61', disableCheckbox: true }],
},
{
title: '报告员权限',
key: '71',
disabled: true,
children: [{ title: '报告员', key: '72', disableCheckbox: true }],
},
{
title: '账号管理',
key: '62',
......@@ -325,6 +331,12 @@ export const enUsFaci = [
disabled: true,
children: [{ title: 'View Visitor Record', key: '61', disableCheckbox: true }],
},
{
title: 'Building Condit',
key: '71',
disabled: true,
children: [{ title: 'Building Condit', key: '72', disableCheckbox: true }],
},
{
title: 'Account Management',
key: '62',
......
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