Commit eb5c602e authored by cellee's avatar cellee

设施大改

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 61c5de68
/*
* @Author: your name
* @Date: 2020-12-01 18:40:06
* @LastEditTime: 2021-01-13 10:34:13
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\config\config.ts
*/
// https://umijs.org/config/
import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
......@@ -314,7 +322,7 @@ export default defineConfig({
},
{
path: './FacilityEdit',
component: './CommunityManagement/FacilityBookings/Facility',
component: './CommunityManagement/FacilityBookings/FacilityTow',
},
{
path: './FacilityDetail',
......@@ -364,6 +372,17 @@ export default defineConfig({
],
},
{
path: './SystemFeedback',
name: 'systemfeedback',
routes: [
{ path: './', component: './AccountManagement/SystemFeedback/SystemFeedback' },
{
path: './BugDetail',
component: './AccountManagement/SystemFeedback/BugDetail',
},
],
},
{
path: './CompanyInformation',
name: 'companyinformation',
......
......@@ -86,15 +86,15 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://47.74.233.180:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/tos/': {
target: 'http://192.168.1.28:8651',
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://192.168.1.28:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
},
};
/*
* @Author: your name
* @Date: 2020-12-14 18:52:22
* @LastEditTime: 2021-01-12 14:43:56
* @LastEditors: your name
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\locales\en-US\menu.ts
*/
export default {
'menu.welcome': 'Welcome',
'menu.more-blocks': 'More Blocks',
......@@ -72,6 +80,7 @@ export default {
'menu.communitymanagement.visitorrecord': 'Visitor Record',
'menu.accountmanagement': 'Account Management',
'menu.accountmanagement.accountmanagement1': 'Account Management',
'menu.accountmanagement.systemfeedback': 'System Feedback',
'menu.accountmanagement.companyinformation': 'Company Information',
'menu.accountmanagement.languagesettings': 'Language Settings',
};
......@@ -72,6 +72,7 @@ export default {
'menu.communitymanagement.visitorrecord': '访客记录',
'menu.accountmanagement': '后台管理',
'menu.accountmanagement.accountmanagement1': '账号管理',
'menu.accountmanagement.systemfeedback': 'BUG反馈',
'menu.accountmanagement.companyinformation': '公司信息',
'menu.accountmanagement.languagesettings': '语言设置',
};
/*
* @Author: your name
* @Date: 2021-01-14 09:23:51
* @LastEditTime: 2021-01-14 10:51:37
* @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 { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router';
import { printf } from '@/utils/log';
export default {
namespace: 'Bug',
state: {
Data: null,
DataSave: null,
},
reducers: {
returnPage(state, { Data }) {
return { ...state, Data };
},
returnDataSave(state, { DataSave }) {
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 {
switch (playload.index) {
case 59: // 获取后台所有账号
{
let Data = resp.data;
yield put({ type: 'returnPage', Data });
}
break;
}
}
},
*SA({ DataSave }, { call, put }) {
yield put({ type: 'returnDataSave', DataSave });
},
},
};
......@@ -127,8 +127,8 @@ export default {
yield put({ type: 'returnPage3', Data3});
}break;
case 2: {
case 2:
case 60:{
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
......
import React, { useEffect } from 'react';
import { Button, Descriptions, Image } from 'antd';
import { EditOutlined, LeftOutlined } from '@ant-design/icons';
import './index.less';
import { connect, history } from 'umi';
import moment from 'moment';
const BugDetail = (props: any) => {
const { DataSave } = props;
useEffect(() => {
if (!DataSave) {
history.push('/AccountManagement/SystemFeedback');
}
}, [DataSave]);
const goToReturn = () => {
history.go(-1);
};
return (
<>
<div className="contop bug">
<h3 className="capi">
<EditOutlined />
&nbsp;System Feedback Details
<div className="back" onClick={goToReturn}>
<Button>
<LeftOutlined />
Back
</Button>
</div>
</h3>
<hr></hr>
<Descriptions column={{ xxl: 1, xl: 1, lg: 1, md: 1, sm: 1, xs: 1 }}>
<Descriptions.Item label="Mobile phone brands">
{DataSave ? DataSave.phoneBrand : '-'}
</Descriptions.Item>
<Descriptions.Item label="Phone model">
{DataSave ? DataSave.deviceModel : '-'}
</Descriptions.Item>
<Descriptions.Item label="System version">
{DataSave ? DataSave.osVersion : '-'}
</Descriptions.Item>
<Descriptions.Item label="Software version">
{DataSave ? DataSave.appVersion : '-'}
</Descriptions.Item>
<Descriptions.Item label="Feedback content">
{DataSave ? DataSave.description : '-'}
</Descriptions.Item>
<Descriptions.Item className="diys" label="&nbsp;">
{DataSave
? DataSave.imageUrls.map((item: any) => {
return <Image width={120} src={item} />;
})
: '-'}
</Descriptions.Item>
<Descriptions.Item label="Actions">
{DataSave ? moment(DataSave.updateTime.time).calendar() : '-'}
</Descriptions.Item>
</Descriptions>
</div>
</>
);
};
function BugDetailProps(state: any) {
const { DataSave } = state.Bug;
const loading = state.loading.models.Bug || false;
return {
DataSave,
loading,
};
}
export default connect(BugDetailProps)(BugDetail);
import React, { useState, useEffect, useRef } from 'react';
import { Pagination } from 'antd';
import {} from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import { RA } from '@/utils/method';
import { connect, history } from 'umi';
import moment from 'moment';
import './index.less';
const SystemFeedback = (props: any) => {
const { dispatch, Data, loading } = props;
const module = 'Bug';
const [term, setTerm] = useState({ pageNum: 1 } as any); //页码
useEffect(() => {
if (!Data) {
Refresh();
}
}, [Data]);
const columns = [
{ title: 'Brand', dataIndex: 'phoneBrand' },
{ title: 'Phone model', dataIndex: 'deviceModel' },
{ title: 'System version', dataIndex: 'osVersion' },
{ title: 'Software version', dataIndex: 'appVersion' },
{ title: 'Problem Description', dataIndex: 'description', ellipsis: true },
{
title: 'Submission time',
dataIndex: 'createTime',
render: (text: any) => {
// let data =
// moment(text.time).format('YYYY-MM-DD hh') +
// ':00' +
// (parseInt(moment(text.time).format('HH')) > 11 ? 'PM' : 'AM');
let data = moment(text.time).calendar();
return data;
},
},
{
title: 'Actions',
valueType: 'option',
render: (text: any) => {
return (
<a
key="link"
onClick={() => {
Details(text);
}}
>
Details
</a>
);
},
},
];
// 跳到内页
const Details = (item: any) => {
let DataSave = item;
dispatch({ type: 'Bug/SA', DataSave });
history.push('/AccountManagement/SystemFeedback/BugDetail');
};
// 页码切换
const sopens = (page: any) => {
let p = {
pageNum: page,
};
setTerm({ ...p });
RA(59, p, module, dispatch);
};
// 刷新
const Refresh = () => {
RA(59, term, module, dispatch);
};
return (
<>
<ProTable
dataSource={Data ? Data.list : null}
rowKey={'id'}
columns={columns as any}
pagination={false}
options={{
density: false,
fullScreen: false,
reload: () => {
Refresh();
},
setting: false,
}}
loading={loading}
search={false}
headerTitle="System Feedback"
/>
<div className="pages">
<Pagination
// onShowSizeChange={pageSizeHandler}
current={Data ? Data.page.currentPage : 0}
onChange={sopens}
total={Data ? Data.page.totalRow : 0}
pageSize={Data ? Data.page.curPageSize : 0}
showSizeChanger={false}
/>
</div>
</>
);
};
function mapStateToProps(state: any) {
const { Data } = state.Bug;
const loading = state.loading.models.Bug || false;
return {
Data,
loading,
};
}
export default connect(mapStateToProps)(SystemFeedback);
.contop {
background: #fff;
padding: 20px;
border-right: 4px;
margin-bottom: 0;
h3 {
margin-bottom: 15px;
position: relative;
.back {
position: absolute;
right: 0;
top: 0;
top: -2px;
background: #fff;
}
}
}
hr {
border: 0;
height: 1px;
background: #eee;
margin-bottom: 24px;
}
.bug {
.ant-descriptions-item-label {
display: inline-block;
min-width: 160px;
}
.diys {
.ant-descriptions-item-label {
color: #fff;
}
}
.ant-image {
margin-right: 15px;
}
}
.pages {
text-align: right;
padding: 10px;
}
......@@ -69,15 +69,15 @@ const Account = (props: any) => {
key: 'userAccount',
},
{
title: 'Grade',
title: 'Authority Level',
dataIndex: 'tosUserLevel',
key: 'userLevel',
render: (text: any) => (
<span>
{text == 0 ? 'Administrator' : ''}
{text == 1 ? 'First Level' : ''}
{text == 2 ? 'Two Level' : ''}
{text == 3 ? 'Three Level' : ''}
{text == 2 ? 'Second Level' : ''}
{text == 3 ? 'Third Level' : ''}
</span>
),
},
......
import React, { useState, useEffect } from 'react';
import { Input, Tabs, Pagination, Space, Button } from 'antd';
import { Input, Tabs, Pagination, Space, Button, message } from 'antd';
const { TabPane } = Tabs;
import { Link, useIntl, connect, Dispatch, history } from 'umi';
......@@ -42,8 +42,6 @@ const FacilityBookings = (props: any) => {
CommunityList,
} = props;
// console.log(Data2);
const RA = (index: any, values: any) => {
dispatch({
type: 'FacilityBookings/RA',
......@@ -63,9 +61,38 @@ const FacilityBookings = (props: any) => {
dispatch({ type: 'FacilityBookings/CA', playload: null });
};
// 表头格式
const [columns, setColumns] = useState([]);
const [columns2, setColumns2] = useState([]);
// 设施列表数据
const [Facility, setFacility] = useState([] as any);
useEffect(() => {
if (Data2 != null) {
// 提取出列表的值
let Array = [];
for (let i in Data2.data) {
let a = {
community: '',
facilities: [] as any,
};
a.community = Object.keys(Data2.data[i])[0];
let arr = Data2.data[i][Object.keys(Data2.data[i])[0]];
arr.map((item: any) => {
let id = Object.keys(item)[0];
let obj = {
id: id,
name: item[id],
};
a.facilities.push(obj);
});
Array.push(a);
}
setFacility(Array);
}
}, [Data2]);
const goToFunction = () => {
if (curString.tab == 2) {
CA();
......@@ -89,6 +116,10 @@ const FacilityBookings = (props: any) => {
// 列表2 点击跳转
const makeOperator = (values: any, index: any) => {
const path = ['/FacilityDetail', '/FacilityEdit', '/FacilityApply'];
if (index != 1) {
message.error('In function development!');
return false;
}
SA(values);
// 清空设施列表图
let list: any = [];
......@@ -127,9 +158,18 @@ const FacilityBookings = (props: any) => {
],
];
const key2 = [
['Community', 'communityName'],
['Facilities', 'facilityName'],
['Opening Hours', 'categoriesOpenTime'],
['Community', 'community'],
[
'Facilities',
'facilities',
(text: any, record: any) => {
let a = '';
text.map((item: any) => {
a += item.name + '、';
});
return a;
},
],
[
'Action',
null,
......@@ -356,8 +396,8 @@ const FacilityBookings = (props: any) => {
<TabPane tab="Facility Management" key="2">
<ProTable
loading={loading}
rowKey="id"
dataSource={Data2.data}
rowKey={'community'}
dataSource={Facility}
columns={columns2}
// pagination={{
// current: curString.curPage2,
......
import React, { useState, useEffect, useRef } from 'react';
import { Tabs, Spin, Input, InputNumber, Button, Form, Select, message, TimePicker } from 'antd';
import { connect, history } from 'umi';
const { Option } = Select;
const { RangePicker } = TimePicker;
const { TabPane } = Tabs;
import './css/indexTow.less';
import './css/index.less';
import TitleBack from '@/components/TitleBack/TitleBack';
import Facilitys from '@/components/Facilitys/Facilitys';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
import OnTime from '@/components/OnTime/OnTime';
import moment from 'moment';
import { getUrlLast } from '@/utils/string';
import { validateMessages } from '@/utils/params';
import { NewFaci } from '@/utils/tip';
const FacilityTow = (props: any) => {
const {
dispatch,
location,
DataSaveDetail,
sourceData,
DataSave,
Result,
load,
FacilitysList,
} = props;
const [PATHNAME, setPATHNAME] = useState('');
const [facilityDetail, setFacilityDetail] = useState(false); // 全部禁止
const [imgOpen, setImgOpen] = useState(false); // 是否能点击上传
const [ctyName, setCtyName] = useState(null); // 小区名称
const [fileList, setFileList] = useState([] as any); // 设施总图片列表组
const [Cycle, setCycle] = useState(null as any); // 周期下拉
const [soltTime, setSoltTime] = useState(['', '']); // 已选时间
const formRef = useRef(null as any);
const [form] = Form.useForm(); // 表单标识
const module = 'FacilityBookings';
const RA = (index: any, values: any) => {
dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } });
};
useEffect(() => {
if (location.pathname.indexOf('FacilityDetail') > -1) {
setPATHNAME('Facility Detail');
} else {
setPATHNAME('Edit Facility');
}
}, []);
// 传递来的小区和设施
useEffect(() => {
if (DataSave) {
setCtyName(DataSave.community);
beg(DataSave.facilities[0].id);
} else {
//返回列表
}
}, [DataSave]);
// 点击设施获取到的设施列表
useEffect(() => {
if (DataSaveDetail) {
console.log();
let { categories, facilities } = DataSaveDetail;
// 设施A、设施B小图
let list: any = categories.map((item: any, index: any) => {
let sam = {
id: index,
name: item.categoriesName,
fileList: [
{
uid: item.id,
name: item.categoriesName,
status: 'done',
url: item.categoriesImageUrl,
},
],
};
// 设施图片列表默认值
form.setFieldsValue({
['shebei_' + index]: item.categoriesName,
});
return sam;
});
dispatch({ type: module + '/genxin', list });
// 设施总图片
let fileListImg: any = [];
facilities.facilitiesImageList.map((item: any, index: any) => {
let sam = {
uid: index,
name: item.facilitiesImageName,
status: 'done',
url: item.facilitiesImageUrl,
};
fileListImg.push(sam);
});
setFileList([...fileListImg]);
// 设置表单默认值
formRef.current.setFieldsValue(facilities);
// 周期
setCycle(facilities.periodType + '');
// 时间
let time = facilities.reservationQuantumTime.split(',');
formRef.current.setFieldsValue({
Time: [moment(time[0], 'HH:mm'), moment(time[1], 'HH:mm')],
});
setSoltTime([...time]);
}
}, [DataSaveDetail]);
// tab 切换
const onTabClicks = (id: String) => {
beg(id);
};
// 提交
const onFinish = (values: any) => {
console.log(values);
message.error('In function development!');
};
const onFinishFailed = (errorInfo: any) => {
// console.log('Failed:', errorInfo);
};
// 发起请求
const beg = (id: String) => {
RA(60, { facilitiesId: id });
};
// 删除子组件清除表单的 输入框值
const dumps = (key: any) => {
form.setFieldsValue({
['shebei_' + key]: '',
});
};
// 监听输入框值全填了就搜索
const keyup = (keyname: any, e: any) => {
e.target.value = e.target.value.replace(/[^\d^\.]+/g, '');
var tmp = {};
tmp[keyname] = e.target.value;
formRef.current.setFieldsValue(tmp);
};
//选择周期
function handleChange(value: any) {
setCycle(value);
}
//时间
const onChanges = (value: any, b: any) => {
console.log(value);
};
return (
<div style={{ padding: 16 }}>
{/* 头部组件v1.2 */}
<TitleBack title={PATHNAME} url={getUrlLast(location.pathname) + '?Facility=true'} />
{/* 设施切换 */}
<div className={'FacilityName'}>
<label>Community :</label> {DataSave ? DataSave.community : ''}
</div>
<Tabs defaultActiveKey="0" tabPosition="top" onTabClick={(key) => onTabClicks(key)}>
{DataSave
? DataSave.facilities.map((i: any) => <TabPane tab={`${i.name}`} key={i.id}></TabPane>)
: ''}
</Tabs>
{/* 设施内容 */}
<Spin spinning={load}>
<div className={'base basediy'}>
<Form
ref={formRef}
form={form}
name="basic"
onFinish={onFinish}
onFinishFailed={onFinishFailed}
validateMessages={validateMessages}
labelAlign="right"
>
{/* 设施名称 以及费用 */}
<Input.Group>
<Form.Item label="Facility Classification" name="facilityName" rules={NewFaci[1]}>
<Input
placeholder="Facility Classification"
disabled={facilityDetail}
maxLength={30}
/>
</Form.Item>
<span className="divIconMoney">Fee($):</span>
<Form.Item label="" name="communityManagerFee">
<InputNumber
prefix="$"
placeholder="00.00"
disabled={facilityDetail}
min={0}
max={999}
step={0.01}
style={{ width: '120px' }}
/>
</Form.Item>
<span className="divIconMoney">Deposit:</span>
<Form.Item label="" name="communityMargin">
<InputNumber
prefix="$"
placeholder="00.00"
disabled={facilityDetail}
min={0}
max={999}
step={0.01}
style={{ width: '120px' }}
/>
</Form.Item>
</Input.Group>
<hr></hr>
{/* 设施品类上传 */}
<Form.Item label="Facilities" className="flex required" style={{ marginBottom: 0 }}>
<Facilitys
disabled={imgOpen}
updata={{
// userToken: token,
imageType: 'categoriesImageName',
extends: ctyName,
}}
dumps={dumps}
></Facilitys>
</Form.Item>
{/* 设施详情上传 */}
<Form.Item
name="categoriesDetailsImageName"
label="Facility Pictures"
rules={NewFaci[4]}
>
<PictureOptionsRow
over={imgOpen}
data={{
// userToken: token,
imageType: 'categoriesDetailsImageName',
extends: ctyName,
}}
limitNums={99}
imgs={fileList}
/>
</Form.Item>
{/* 时间 */}
<Form.Item label="Opening Hours" className="required">
<Form.Item name="Time" noStyle>
<RangePicker
minuteStep={60}
format="HH:mm"
onChange={(time: any, timeString: any) => {
onChanges(time, timeString);
}}
disabled
/>
</Form.Item>
</Form.Item>
<hr></hr>
{/* ------------- */}
<p className="diyp">Booking Rules : </p>
{/* 预约设置 */}
<Input.Group>
<Form.Item name="cancelReservationDay" label="Early Cancellation" rules={NewFaci[5]}>
<Input
onKeyUp={keyup.bind(this, 'cancelReservationDay')}
disabled={facilityDetail}
// prefix="Advance"
suffix="Day(s) In Advance"
style={{ width: 160, textAlign: 'center' }}
placeholder="0"
maxLength={2}
/>
</Form.Item>
<Form.Item
label="No Deposit To Cancel Reservation"
name="nomarginCancelReservationDay"
rules={NewFaci[6]}
>
<Input
onKeyUp={keyup.bind(this, 'nomarginCancelReservationDay')}
disabled={facilityDetail}
// prefix="Advance"
suffix="Day(s) In Advance"
style={{ width: 160, textAlign: 'center' }}
placeholder="0"
maxLength={2}
/>
</Form.Item>
<Form.Item label="Booking" name="canReservationDay" rules={NewFaci[7]}>
<Input
onKeyUp={keyup.bind(this, 'canReservationDay')}
placeholder="0"
style={{ width: 160, textAlign: 'center' }}
disabled={facilityDetail}
// prefix="Advance"
suffix="Day(s) In Advance"
maxLength={2}
/>
</Form.Item>
</Input.Group>
{/* 设置次数 */}
<Input.Group>
<Form.Item label="Booking Quotas" rules={NewFaci[8]}>
<Select
placeholder="Cycle"
allowClear
style={{ width: 120 }}
disabled={facilityDetail}
value={Cycle}
onChange={handleChange}
>
<Option value="1">Week</Option>
<Option value="2">Month</Option>
<Option value="3">Year</Option>
</Select>
</Form.Item>
<Form.Item name="canReservationNum" rules={NewFaci[9]}>
<Input
onKeyUp={keyup.bind(this, 'canReservationNum')}
placeholder="Second"
style={{ width: 120 }}
disabled={facilityDetail}
defaultValue={0}
suffix="Time(s)"
/>
</Form.Item>
</Input.Group>
<hr></hr>
<>
<Button type="primary" htmlType="submit" loading={load}>
Submit
</Button>
</>
</Form>
</div>
</Spin>
</div>
);
};
function mapStateToProps(state: any) {
const { sourceData, DataSave, DataSaveDetail, Result, FacilitysList } = state.FacilityBookings;
const { token } = state.login;
const load =
typeof state.loading.models.FacilityBookings == 'undefined'
? false
: state.loading.models.FacilityBookings;
return {
DataSave,
DataSaveDetail,
sourceData,
token,
Result,
load,
FacilitysList,
};
}
export default connect(mapStateToProps)(FacilityTow);
......@@ -331,12 +331,10 @@ hr {
}
.divIconMoney {
position: absolute;
z-index: 99;
top: 50%;
transform: translateY(-50%);
left: 8px;
color: #999;
display: inline-block;
margin-right: 10px;
color: rgba(0, 0, 0, 0.85);
line-height: 32px;
}
.required {
......
hr {
border: 0;
height: 1px;
background: #eee;
margin-bottom: 24px;
}
.FacilityName {
margin-bottom: 15px;
label {
display: inline-block;
min-width: 100px;
}
}
/*
* @Author: your name
* @Date: 2020-11-19 20:34:18
* @LastEditTime: 2021-01-07 15:08:08
* @LastEditTime: 2021-01-14 15:31:59
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts
......@@ -91,4 +91,6 @@ export const requestList = [
['/tos/user/twoLevel/get', '56 获取二级账号', {}],
['/tos/user/twoLevel/get/CommunityAuth', '57 根据用户id获取用户管辖小区名和权限', {}],
['/tos/community/categories/subscribe/reservationNum', '58 获取小区设施可预约次数', {}],
['/tos/bug/feedback/list', '59 获取用户反馈列表', {}],
['/tos/community/facilities/get/detail', '60 获取小区设施详情', {}],
];
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