Commit b570b13b authored by maple's avatar maple Committed by MrShi

[fix]小区管理

(cherry picked from commit 817395e6)
parent 9a6d7464
......@@ -224,8 +224,11 @@ export default defineConfig({
/* {
path: './CellList',
name: 'celllist',
component:'./runTest/Template'
},*/
routes:[
{path:'./',component:'./CommunityManagement/CellList/CellList'}
]
},
*/
{
path: './housingList',
name: 'celllist',
......@@ -241,6 +244,9 @@ export default defineConfig({
/* {
path: './CommunityAnnouncement',
name: 'communityannouncement',
routes: [
{path:"./",component:'./CommunityManagement/CommunityAnnouncement/CommunityAnnouncement'}
]
component:'./runTest/Template'
},*/
{
......@@ -271,6 +277,9 @@ export default defineConfig({
/*{
path: './VisitorRecord',
name: 'visitorrecord',
routes: [
{path:"./",component:'./CommunityManagement/VisitorRecord/VisitorRecord'}
]
component:'./runTest/Template'
},*/
{
......
......@@ -16,7 +16,7 @@ const proSettings: DefaultSettings = {
menu: {
locale: true,
},
title: 'TOS_v1.0.5',
title: 'TOS_v1.0.6',
pwa: false,
iconfontUrl: '',
};
......
......@@ -20,8 +20,10 @@ const SearchOptionsCommnity = (props: any) => {
props.onSubmit(values);
}
return (
<>
<>{CommunityList!=null?
<SearchOptions disabled={disabled} placeholder={placeholder} defaultValue={defaultValue} list={CommunityList} onSubmit={extendName} />
:null
}
</>
);
};
......@@ -32,3 +34,4 @@ function mapStateToProps(state:any) {
};
}
export default connect(mapStateToProps)(SearchOptionsCommnity);
// <SearchOptionsCommnity onSubmit={extendName} />
......@@ -5,6 +5,7 @@ import { stringify } from 'querystring';
import { ConnectState } from '@/models/connect';
import { CurrentUser } from '@/models/user';
import login from '@/pages/user/login';
import { getCookie } from '@/utils/method';
interface SecurityLayoutProps extends ConnectProps {
loading?: boolean;
......@@ -13,12 +14,14 @@ interface SecurityLayoutProps extends ConnectProps {
}
interface SecurityLayoutState {
token:String,
isReady: boolean;
}
class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayoutState> {
state: SecurityLayoutState = {
isReady: false,
token:"abc123",
};
componentDidMount() {
......@@ -26,7 +29,8 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
isReady: true,
});
const { dispatch ,login} = this.props;
console.log("登录中")
// console.log("安全登录中")
// console.log(login)
if (dispatch) {
dispatch({
type: 'user/fetchCurrent',
......@@ -39,21 +43,19 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
}
render() {
const { isReady } = this.state;
const { isReady,token } = this.state;
const { children, loading, currentUser,login } = this.props;
// You can replace it to your authentication rule (such as check token exists)
// 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
console.log("是否已登录"+login?.token)
// console.log("是否已登录" + getCookie("token"))
// const isLogin = currentUser && currentUser.name;//isLogin为关键点
var isLogin = false
if (currentUser.name != null) {
if (getCookie("token").length!=0) {
isLogin=true
}
isLogin = true
if ((login?.token).length==0) {
// isLogin=false
}
const queryString = stringify({
redirect: window.location.href,
});
......
......@@ -69,7 +69,7 @@ export default {
'menu.communitymanagement.celllist': 'Cell List',
'menu.communitymanagement.communityannouncement': 'Community Announcement',
'menu.communitymanagement.facilitybookings': 'Facility Bookings',
'menu.communitymanagement.visitorrecord': 'visitorrecord',
'menu.communitymanagement.visitorrecord': 'Visitor Record',
'menu.accountmanagement': 'Account Management',
'menu.accountmanagement.accountmanagement1': 'Account Management',
'menu.accountmanagement.companyinformation': 'Company Information',
......
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: 'CellList',
state: {
Data: null,
curString:{},
Result: null,
DataSave: null,
DataSaveDetail:null,
},
reducers: {
returnPage(state, { Data}) {
return { ...state, Data };
},
returnResult(state, { Result}) {
return { ...state, Result};
},
returnDataSave(state, { DataSave }) {
return {...state,DataSave}
},
returnDataSaveDetail(state, { DataSaveDetail }) {
return {...state,DataSaveDetail}
},
},
effects: {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
}
if (resp.error_code != "0000") {
printf(playload, resp)
}
else {
switch (playload.index) {
case 24: {
let Data = resp.data;
yield put({ type: 'returnPage', Data });
} break;
}
}
},
*ResultClear({ }, { put }) {
var tmp=null
yield put({type: 'returnResult', tmp} )
},
*SA({ playload }, { call, put }) {
var DataSave = playload
yield put({type: 'returnDataSave', DataSave} )
},
},
};
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: 'CommunityAnnouncement',
state: {
Data: null,
Result: null,
DataSave: null,
DataSaveDetail:null,
},
reducers: {
returnPage(state, { Data}) {
return { ...state, Data };
},
returnResult(state, { Result}) {
return { ...state, Result};
},
returnDataSave(state, { DataSave }) {
return {...state,DataSave}
},
returnDataSaveDetail(state, { DataSaveDetail }) {
return {...state,DataSaveDetail}
},
},
effects: {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
}
if (resp.error_code != "0000") {
printf(playload, resp)
}
else {
switch (playload.index) {
case 25: {
let Data = resp.data;
yield put({ type: 'returnPage', Data });
} break;
}
}
},
*ResultClear({ }, { put }) {
var tmp=null
yield put({type: 'returnResult', tmp} )
},
*SA({ playload }, { call, put }) {
var DataSave = playload
yield put({type: 'returnDataSave', DataSave} )
},
},
};
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: 'VisitorRecord',
state: {
Data: null,
Result: null,
DataSave: null,
DataSaveDetail:null,
},
reducers: {
returnPage(state, { Data}) {
return { ...state, Data };
},
returnResult(state, { Result}) {
return { ...state, Result};
},
returnDataSave(state, { DataSave }) {
return {...state,DataSave}
},
returnDataSaveDetail(state, { DataSaveDetail }) {
return {...state,DataSaveDetail}
},
},
effects: {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
}
if (resp.error_code != "0000") {
printf(playload, resp)
}
else {
switch (playload.index) {
case 26: {
let Data = resp.data;
yield put({ type: 'returnPage', Data });
} break;
}
}
},
*ResultClear({ }, { put }) {
var tmp=null
yield put({type: 'returnResult', tmp} )
},
*SA({ playload }, { call, put }) {
var DataSave = playload
yield put({type: 'returnDataSave', DataSave} )
},
},
};
......@@ -5,6 +5,7 @@ import { AccountLogin,AccountCheckLogin,AccountOut } from '@/services/login';
import { setAuthority } from '@/utils/authority';
import { getPageQuery } from '@/utils/utils';
import { setCookie, getCookie } from '@/utils/method';
export interface StateType {
status?: 'ok' | 'error';
type?: string;
......@@ -60,11 +61,13 @@ const Model: LoginModelType = {
});
// Login successfully
if (response.status === 'ok') {
console.log("登录成功")
console.log("用户名密码登录成功")
console.log(response)
const userMessage = yield call(AccountCheckLogin, payload);//请求时间网络
console.log(userMessage)
console.log(userMessage.token)
setCookie("token",userMessage.token)
console.log("获取到Token:" + getCookie("token"))
yield put({type: 'saveToken',token: userMessage.token,userName:payload.userName,password:payload.password});
const urlParams = new URL(window.location.href);
const params = getPageQuery();
......
......@@ -47,7 +47,7 @@ const UserModel: UserModelType = {
},
*fetchCurrent({playload}, { call, put }) {
const response = yield call(queryCurrent,playload);
console.log(response)
// console.log(response)
yield put({
type: 'saveCurrentUser',
payload: response,
......
import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs;
import {connect} from 'umi';
const columns = [
["Community", "residentialName"],
["Administrator", "residentialManagerUserName"],
["Operation Hours", null, (text: any, record: any) => (<div></div>)],
["Office Tel", "residentialPhone"],
["Address", "residentialAddress"],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
]
import TitleSearch from '@/components/TitleSearch/TitleSearch'
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity'
import { RA } from '@/utils/method';
import { objectColumns } from '@/utils/string';
import { timestampToTime } from '@/utils/time';
const module="CellList"
const CellList = (props:any) => {
const { dispatch, Data } = props;
const Pagechange = () => {
}
const [columnsVal,setColumnsVal]=useState([])
useEffect(() => {
var tmp = objectColumns(columns)
console.log(tmp)
setColumnsVal(tmp)
RA(24, {communityName: "" }, module, dispatch);
}, [])
useEffect(() => {
if (Data != null) {
//console.log(columnsVal)
}
}, [Data])
const CallbackSearch = (values:any) => {
RA(24, {communityName: values }, module, dispatch);
}
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
{
Data != null ? <>
{/* <TitleSearch listkey={['communityName']} list={['Community Name']} onSubmit={CallBackTitleSearch}/> */}
<SearchOptionsCommnity onSubmit={CallbackSearch} />
<Table loading={false} rowKey="id" style={{ marginTop: 16 }}
dataSource={Data.rows}
columns={columnsVal}
pagination={{ current: 1, total: Data.total}} />
</> : null
}
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(CellList);
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs;
import {connect} from 'umi';
import { objectColumns } from '@/utils/string';
import {timestampToTime3} from '@/utils/time'
// communityNum: "A7"
// count: 0
// createTime: "Jul 8, 2020 7:38:37 PM"
// deleted: 0
// extend: ""
// id: "2f9b5e98a2ea4b79b75242b1b34301bd"
// noticEndTime: "Aug 23, 2020 7:38:29 PM"
// noticImageName: "3.jpg"
// noticScope: 0
// noticStartTime: "Aug 20, 2020 7:38:26 PM"
// noticText: "噶防范发更好覅单号梵蒂冈很反感辅导班梵蒂冈房管局覅北京饭店个法币发动机盖我甲方的GV第八届发第十九GIF大锅饭"
// noticTitlel: "大家好,今年端午节不放假"
// updateTime: "Jun 28, 2020 7:38:39 PM"
const columns = objectColumns( [
["community", "communityNum"],
["Title", "noticTitlel"],
["Publish Time", null, (text: any, record: any) => (<Space size="middle">{record.noticStartTime.time}</Space>)],
["noticScope", "noticScope"],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
])
import { RA } from '@/utils/method';
const module="CommunityAnnouncement"
const CommunityAnnouncement = (props:any) => {
const { dispatch, Data } = props;
useEffect(() => {
RA(25,{communityNum: "", noticTitlel: "" },module,dispatch)
},[])
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
{Data!=null?
<Table
loading={false}
rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data.rows}
columns={columns}
pagination={{ current: 1, total: Data.total}} />:null}
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(CommunityAnnouncement);
//备注 发布人缺少 发布时间格式错误
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs;
import {connect} from 'umi';
import { objectColumns } from '@/utils/string';
// cdkCode: 998974
// cdkStatus: "0"
// count: 0
// createTime: "Sep 7, 2020 6:12:35 PM"
// deleted: 0
// enable: 0
// extend: ""
// id: "8f8b49308c0b4fb4a0e6b9d6af0aaa1e"
// inviterAddress: "TANGDE2#01#01#01"
// inviterId: "2597108b72f64a5da34892c14f0e6a57"
// inviterName: "啊啊啊"
// inviterPhone: "2536727886@qq.com"
// linkStatus: 1
// numberPlate: "粤A465123"
// securityGuardCommunity: "unkown"
// securityGuardName: "unkown"
// securityGuardPhone: "unkown"
// status: 1
// updateTime: "Sep 7, 2020 6:13:06 PM"
// visitorsName: "销赃"
// visitorsPhone: "18535669865"
const columns = objectColumns( [
["User Name", "inviterName"],
["Visitor", "visitorsName"],
["Security Guard", "securityGuardName"],
["Number Plate", "numberPlate"],
["Address", "inviterAddress"],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
])
import TitleSearch from '@/components/TitleSearch/TitleSearch'
import { RA } from '@/utils/method';
const module="VisitorRecord"
const VisitorRecord = (props:any) => {
const { dispatch, Data } = props;
useEffect(() => {
RA(26,{inviterAddress: "", visitorCommunity: ""},module,dispatch)
}, [])
const CallBackTitleSearch = (values:any) => {
console.log(values)
}
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
<TitleSearch listkey={['inviterAddress']} list={['Community Name']} onSubmit={CallBackTitleSearch}/>
{Data!=null?
<Table
loading={false}
rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data.rows}
columns={columns}
pagination={{ current: 1, total: Data.total}} />:null}
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(VisitorRecord);
// 备注
// 列表缺少访客时间
// 搜索缺少到达时间、访客姓名
import React from 'react';
import {connect, routerRedux} from 'dva';
import {Table, Button, Input, Select, Modal, Tooltip, Upload, Icon, Checkbox, Row, Radio, Tag} from "antd";
import styles from './style.less';
import {ConnectState} from "@/models/connect";
// import XLSX from "@/pages/account/xlsx.core.min";
import {router} from "umi";
import SelectOptions from '../../../components/SelectOptions/index';
import TitleSearch from "@/components/TitleSearch/TitleSearch";
class VisitorRecord extends React.Component {
//构造
constructor(props) {
super(props);
this.state = {
data: [],
province: undefined,
city: undefined,
district: undefined,
street: undefined,
total: 1,
name: '',
model: '',
status: undefined,
statusList: [{label:"在线",value:"1"}, {label:"故障",value:"3"},{label:"未激活",value:"4"}],
provinceList: [],
cityList: [{name: "未选择省"}],
districtList: [{name: "未选择市"}],
streetList: [{name: "未选择区"}],
delData: [],
visible: false,
deviceStatus: '',
selectedRowKeys: [],
used: null,
newAdd: null,
strList: [],
newList:[],
authorityList:[
{
"children": [
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 5,
"name": "组织架构",
"parentid": 1,
"sort": 10,
"state": "",
"is_checked": true
},
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 6,
"name": "员工管理",
"parentid": 1,
"sort": 20,
"state": "",
"is_checked": true
},
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 11,
"name": "角色管理",
"parentid": 1,
"sort": 30,
"state": "",
"is_checked": false
},
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 17,
"name": "企业设置",
"parentid": 1,
"sort": 2,
"state": "",
"is_checked": true
},
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 26,
"name": "员工管理",
"parentid": 1,
"sort": 1,
"state": "",
"is_checked": false
}
],
"hasChildren": true,
"is_admin": 1,
"menuid": 1,
"name": "企业",
"parentid": 0,
"sort": 20,
"state": "closed",
"is_checked": true
},
{
"children": [
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 12,
"name": "供应商订单",
"parentid": 4,
"sort": 10,
"state": "",
"is_checked": true
},
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 15,
"name": "供应商管理",
"parentid": 4,
"sort": 20,
"state": "",
"is_checked": false
},
{
"children": [],
"hasChildren": false,
"is_admin": 1,
"menuid": 16,
"name": "成为供应商",
"parentid": 4,
"sort": 30,
"state": "",
"is_checked": true
}
],
"hasChildren": true,
"is_admin": 1,
"menuid": 4,
"name": "供应商",
"parentid": 0,
"sort": 11,
"state": "closed",
"is_checked": true
}
],
}
}
/*----------------- 方法集 ------------------*/
//重置
reset = () => {
this.setState({
province: undefined,
city: undefined,
district: undefined,
street: undefined,
status: undefined,
name: '',
},() => {
this.getDevice();
});
};
//模态框相关
showModal = () => {
let flag = 0;
const nowUser = this.props.currentUser;
if(nowUser.permission!=null){
for(let i=0;i<nowUser.permission.length;i++){
if(nowUser.permission[i]=="4"){
if(this.state.delData==null||this.state.delData.length<=0){
alert("未选中删除项!");
return;
}
flag = 1;
this.setState({
visible: true,
});
}
}
}else{
// alert("找不到用户权限记录!");
// return;
}
if(flag == 0){
alert("缺少设备删除权限!");
}
};
handleOk = () => {
this.del();
this.setState({
visible: false,
});
};
handleCancel = () => {
this.setState({
visible: false,
});
};
//获取所有设备
getDevice = () => {
const params = {
// address: (this.state.province == undefined ? '' : this.state.province.label) +
// (this.state.city == undefined ? '' : '-' + this.state.city.label) +
// (this.state.district == undefined ? '' : '-' + this.state.district.label) +
// (this.state.street == undefined ? '' : '-' + this.state.street.label),
name: this.state.name,
model: this.state.model,
status: this.state.status,
id: this.props.currentUser.userid,
userPhone:"18813787835"
};
this.props.dispatch({
type: 'visitorRecordModel/getVisitorRecord',
payload: params,
callback: (res) => {
if (res) {
/* this.setState({
data: res.rows,
total: res.total,
})*/
if(res.error_code == "0000"){
this.setState({
data: res.data.rows,
total: res.data.total,
})
}
if(res.error_code == "0001"){
alert(res.error_msg);
}else if(res.error_code == "0002"){
alert(res.error_msg);
}else if(res.error_code == "0008"){
alert(res.error_msg);
window.location.href = '/';
router.replace('/');
}
// else{
// alert("Tos查询出错!未知错误!");
// }
}
}
});
};
//跳转到编辑页面
edit = (params) => {
let flag = 0;
const nowUser = this.props.currentUser;
if(nowUser.permission!=null){
if(params==null){
for(let i=0;i<nowUser.permission.length;i++){
if(nowUser.permission[i]=="3"){
flag = 1;
this.props.dispatch(routerRedux.push({
pathname: 'tosUser/create',
query: params,
}))
}
}
}else{
for(let i=0;i<nowUser.permission.length;i++){
if(nowUser.permission[i]=="2"){
flag = 1;
this.props.dispatch(routerRedux.push({
pathname: '/tosUser/edit',
query: params,
}))
}
}
}
}else{
// alert("找不到用户权限记录!");
// return;
}
if(flag == 0){
if(params==null){
alert("缺少设备添加权限!");
}else{
alert("缺少设备修改权限!");
}
}
};
//跳转到编辑页面
edit2 = (params) => {
let flag = 0;
const nowUser = this.props.currentUser;
if(nowUser.permission!=null){
if(params==null){
for(let i=0;i<nowUser.permission.length;i++){
if(nowUser.permission[i]=="3"){
flag = 1;
this.props.dispatch(routerRedux.push({
pathname: 'tosUser/edit',
query: params,
}))
}
}
}else{
for(let i=0;i<nowUser.permission.length;i++){
if(nowUser.permission[i]=="2"){
flag = 1;
this.props.dispatch(routerRedux.push({
pathname: '/tosUser/edit',
query: params,
}))
}
}
}
}else{
// alert("找不到用户权限记录!");
// return;
}
if(flag == 0){
if(params==null){
alert("缺少设备添加权限!");
}else{
alert("缺少设备修改权限!");
}
}
};
//跳转到详情页面
details = (params) => {
this.props.dispatch(routerRedux.push({
pathname: '/tosUser/details',
query: params,
}))
};
//设备状态变更
statusChange = (e) => {
this.setState({status: e == undefined ? undefined : e});
};
//设备名称和型号修改
nameAndModelChange = (e) => {
this.setState({name: e.target.value});
};
//加载省
provinceload = (code) => {
this.props.dispatch({
type: 'deviceModel/getRegion',
payload: {code: code,},
callback: (res) => {
if (res) {
this.setState({
provinceList: res.data,
});
}
import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs;
import {connect} from 'umi';
import { objectColumns } from '@/utils/string';
// cdkCode: 998974
// cdkStatus: "0"
// count: 0
// createTime: "Sep 7, 2020 6:12:35 PM"
// deleted: 0
// enable: 0
// extend: ""
// id: "8f8b49308c0b4fb4a0e6b9d6af0aaa1e"
// inviterAddress: "TANGDE2#01#01#01"
// inviterId: "2597108b72f64a5da34892c14f0e6a57"
// inviterName: "啊啊啊"
// inviterPhone: "2536727886@qq.com"
// linkStatus: 1
// numberPlate: "粤A465123"
// securityGuardCommunity: "unkown"
// securityGuardName: "unkown"
// securityGuardPhone: "unkown"
// status: 1
// updateTime: "Sep 7, 2020 6:13:06 PM"
// visitorsName: "销赃"
// visitorsPhone: "18535669865"
const columns = objectColumns( [
["User Name", "inviterName"],
["Visitor", "visitorsName"],
["Security Guard", "securityGuardName"],
["Number Plate", "numberPlate"],
["Address", "inviterAddress"],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
])
import TitleSearch from '@/components/TitleSearch/TitleSearch'
import { RA } from '@/utils/method';
const module="VisitorRecord"
const VisitorRecord = (props:any) => {
const { dispatch, Data } = props;
useEffect(() => {
RA(26,{inviterAddress: "", visitorCommunity: ""},module,dispatch)
}, [])
const CallBackTitleSearch = (values:any) => {
console.log(values)
}
});
};
//省变更
provinceChange = (e) => {
if (e == undefined) {
this.setState({
cityList: [{name: "未选择省"}],
districtList: [{name: "未选择市"}],
streetList: [{name: "未选择区"}],
province: undefined,
city: undefined,
district: undefined,
street: undefined,
})
} else {
this.setState({province: {label: e.label,}});
this.props.dispatch({
type: 'deviceModel/getRegion',
payload: {code: e.key,},
callback: (res) => {
if (res) {
this.setState({
cityList: res.data,
city: undefined,
district: undefined,
street: undefined,
});
}
}
});
}
};
//市变更
cityChange = (e) => {
if (e == undefined) {
this.setState({
districtList: [{name: "未选择市"}],
streetList: [{name: "未选择区"}],
city: undefined,
district: undefined,
street: undefined,
})
} else {
this.setState({city: {label: e.label,}});
this.props.dispatch({
type: 'deviceModel/getRegion',
payload: {code: e.key,},
callback: (res) => {
if (res) {
this.setState({
districtList: res.data,
district: undefined,
street: undefined,
});
}
}
});
}
};
//区变更
districtChange = (e) => {
if (e == undefined) {
this.setState({
streetList: [{name: "未选择区"}],
district: undefined,
street: undefined,
})
} else {
this.setState({district: {label: e.label,}});
this.props.dispatch({
type: 'deviceModel/getRegion',
payload: {code: e.key,},
callback: (res) => {
if (res) {
this.setState({
streetList: res.data,
street: undefined,
});
}
}
});
}
};
//批量删除
del() {
this.props.dispatch({
type: 'deviceModel/delDevice',
payload: this.state.delData,
callback: (res) => {
if (res) {
if (res.error_code == "0000") {
alert(res.error_msg);
this.getDevice();
} else if(res.error_code == "0001") {
alert(res.error_msg);
} else if(res.error_code == "0002"){
alert(res.error_msg);
} else if(res.error_code == "0008"){
alert(res.error_msg);
window.location.href = '/';
router.replace('/');
} else {
alert("删除失败!未知错误!");
}
}
}
});
};
//显示信息
info() {
const { used, newAdd, strList} = this.state;
const strSelect = strList.map((item) => (
<p>{item}</p>
));
Modal.info({
title: '批量导入结果',
content: (
<div>
<p>绑定<span style={{color:"lightgreen",fontSize:24}}>{newAdd}</span>台设备,
以下<span style={{color:"red",fontSize:24}}>{used}</span>台设备已被占用</p>
{strSelect}
</div>
),
onOk() {},
});
}
//初始化
componentDidMount() {
// this.provinceload(0);
this.getDevice();
}
/*--------------------------------------*/
//表格列名
columns = [
{
title: 'invitees',
dataIndex: 'inviterName',
key: 'inviterName',
},
{
title: 'Visitor',
dataIndex: 'visitorsName',
key: 'visitorsName',
},
{
title: 'Security Staff',
dataIndex: 'securityGuardName',
key: 'securityGuardName',
},
{
title: 'License Plate',
dataIndex: 'numberPlate',
key: 'numberPlate',
},
{
title: 'Time of Arrival',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: 'Project',
dataIndex: 'inviterAddress',
key: 'inviterAddress',
},
{
title: 'Address',
dataIndex: 'visitorCommunity',
key: 'visitorCommunity',
},
{
title: 'cdkCode',
dataIndex: 'cdkCode',
key: 'cdkCode',
},
/* {
title: 'Car Templete',
dataIndex: 'enable',
key: 'enable',
render: (text, record) => (
<span>{record.enable == '1' ? "注册" : "未注册"}</span>
),
},*/
/*{
title: '用户类型',
dataIndex: 'deviceRegisterTime',
key: 'deviceRegisterTime',
},
{
title: '状态',
dataIndex: 'deviceWorking',
key: 'deviceWorking',
render: (text, record) => (
<span>{record.deviceWorking == '1' ? "正常" :
(record.deviceWorking == '2' ? "离线" :
(record.deviceWorking == '3' ? "故障" : "未激活"))}</span>
)
},*/
/* {
title: 'Actions',
dataIndex: 'action',
key: 'action',
render: (text, record) => (
<span>
<Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
onClick={() => this.details(record)}>Details</Button>
<Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
onClick={() => this.edit(record)}>Edit</Button>
</span>
),
},*/
];
//行选择
rowSelection = {
onChange: (selectedRowKeys , selectedRows) => {
this.setState({
delData: selectedRows
});
},
};
//渲染
render() {
const printContent = (comment: any)=>{
console.log(comment)
}
const {
data, total, statusList, provinceList, cityList, districtList,
province, city, district, status, name,newList,authorityList
} = this.state;
const uploadprops = {
// 这里我们只接受excel2007以后版本的文件,accept就是指定文件选择框的文件类型
accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
name: 'file',
headers: {
authorization: 'authorization-text',
},
showUploadList: false,
// 把excel的处理放在beforeUpload事件,否则要把文件上传到通过action指定的地址去后台处理
// 这里我们没有指定action地址,因为没有传到后台
beforeUpload: (file, fileList) => {
const rABS = true;
const f = fileList[0];
const reader = new FileReader();
reader.onload = e => {
let dataResult = e.target.result;
if (!rABS) dataResult = new Uint8Array(dataResult);
const workbook = XLSX.read(dataResult, {
type: rABS ? 'binary' : 'array',
});
// 假设我们的数据在第一个标签
const firstWorksheet = workbook.Sheets[workbook.SheetNames[0]];
// XLSX自带了一个工具把导入的数据转成json
const jsonArr = XLSX.utils.sheet_to_json(firstWorksheet, {header: 1});
// 通过自定义的方法处理Json,得到Excel原始数据传给后端,后端统一处理
const oldDeviceList = [];
for (let i = 0; i < jsonArr.length; i++) {
//去重
if (!oldDeviceList.includes(jsonArr[i][0]) && jsonArr[i][0] != '' && jsonArr[i][0] != null && jsonArr[i][0] != undefined) {
oldDeviceList.push(jsonArr[i][0]);
}
}
this.props.dispatch({
type: 'deviceModel/importUserDeviceListExcel',
payload: {
jsonArr: oldDeviceList,
userID: this.props.currentUser.userid,
},
callback: (res) => {
if (res) {
this.setState({
used: res.data.used,
newAdd: res.data.integer,
strList: res.data.strList,
},() => {
this.getDevice();
this.info();
});
}
}
});
};
if (rABS) reader.readAsBinaryString(f);
else reader.readAsArrayBuffer(f);
return false;
},
};
/* const statusSelect = statusList.map((item) => (
<Select.Option value={item.value} label={item.label}>{item.label}</Select.Option>
));
const provinceSelect = provinceList.map((item) => (
<Select.Option value={item.code} label={item.name}>{item.name}</Select.Option>
));
const citySelect = cityList.map((item) => (
<Select.Option value={item.code} label={item.name}>{item.name}</Select.Option>
));
const districtSelect = districtList.map((item) => (
<Select.Option value={item.code} label={item.name}>{item.name}</Select.Option>
));*/
const CallBackTitleSearch = (comment: any)=>{
console.log(comment)
}
return (
<div className={styles.body}>
<div className={styles.inputBox}>
<Input className={styles.input}
placeholder="User Name"
value={name}
onChange={(e) => this.nameAndModelChange(e)}/>
{/*<Select className={styles.input}*/}
{/* placeholder="设备状态"*/}
{/* onChange={(e) => this.statusChange(e)}*/}
{/* allowClear={true}*/}
{/* value={status != undefined ? status: undefined}>{statusSelect}</Select>*/}
{/*<Select className={styles.downButton}*/}
{/* placeholder="省"*/}
{/* onChange={(e) => this.provinceChange(e)}*/}
{/* allowClear={true}*/}
{/* labelInValue={true}*/}
{/* value={province}>*/}
{/* {provinceSelect}*/}
{/*</Select>*/}
{/*<Select className={styles.downButton}*/}
{/* placeholder="市"*/}
{/* onChange={(e) => this.cityChange(e)}*/}
{/* allowClear={true}*/}
{/* labelInValue={true}*/}
{/* value={city}>*/}
{/* {citySelect}*/}
{/*</Select>*/}
{/*<Select className={styles.downButton}*/}
{/* placeholder="区"*/}
{/* onChange={(e) => this.districtChange(e)}*/}
{/* allowClear={true}*/}
{/* labelInValue={true}*/}
{/* value={district}>*/}
{/* {districtSelect}*/}
{/*</Select>*/}
</div>
{/* <div>
{
authorityList.map((item,key) => {
return (
<CheckGroup
key={key}
checkId={key}
checkAll={newList[1]['checkAll'+1]}
checkAllId={newList[1]['checkAllId'+1]}
allListId={newList[1]['allListId'+1]}
checkedList={newList[1]['checkedList'+1]}
checkAllValue={item.menuid}
checkAllLable={item.name}
hasChildren={item.hasChildren}
children={item.children}
onChangeGroup={this.selectCheckbox}/>
)
})
}
</div>*/}
<div>
<Button className={styles.button1} onClick={() => this.getDevice()}>Search</Button>
{/*<Button className={styles.button} onClick={() => this.reset()}>重置</Button>*/}
{/*<Button className={styles.button2} onClick={() => this.edit(null)}>Create New Owner</Button>*/}
<Upload {...uploadprops}>
<Tooltip title="">
<Button className={styles.button2}
style={{width: 150}}>
<Icon type="upload"/>Batch Upload
</Button>
</Tooltip>
</Upload>
</div>
{/* <div>
<h1>Hello World</h1>
<SelectOptions list={["A1 Project","B1 Project","C1 Project","D1 Project","E1 Project","F1 Project"
,"G1 Project","H1 Project","I1 Project","J1 Project","K1 Project","L1 Project","M1 Project","N1 Project"
,"O1 Project","P1 Project","Q1 Project","R1 Project","S1 Project","T1 Project","U1 Project","V1 Project"
,"W1 Project","X1 Project","Y1 Project","Z1 Project"]} onSubmit={printContent}/>
</div>*/}
<TitleSearch
listkey={["providerName"]}
list={["Service Provider"]}
community={"serviceCommunityList"}
onSubmit={CallBackTitleSearch} />
<div>
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
<TitleSearch listkey={['inviterAddress']} list={['Community Name']} onSubmit={CallBackTitleSearch}/>
{Data!=null?
<Table
rowKey={record => record.deviceID}
className={styles.table}
rowSelection={this.rowSelection}
columns={this.columns}
dataSource={data}
size="small"
pagination={{showQuickJumper: true, pageSize: 10, total: total}}
/>
<Button className={styles.button3} onClick={() => this.showModal()}>Delete</Button>
</div>
<Modal
title="确认删除?"
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}>
<div style={{textAlign: "center"}}><p style={{fontSize: 18}}>删除信息将不可恢复</p></div>
</Modal>
loading={false}
rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data.rows}
columns={columns}
pagination={{ current: 1, total: Data.total}} />:null}
</div>
);
}
}
};
export default connect(({user}: ConnectState) => ({
currentUser: user.currentUser,
}))(VisitorRecord);
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(VisitorRecord);
// 备注
// 列表缺少访客时间
// 搜索缺少到达时间、访客姓名
......@@ -9,13 +9,17 @@ import BackButton from '../../components/BackButton/BackButton';
import TitleGet from '../../components/TitleGet/TitleGet';
import TableShow from '../../components/TableShow/TableShow';
import { getCookie } from '@/utils/method';
const Guard = (props:any) => {
const { dispatch, CommunityList,token} = props;
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) };
const [page, setPage] = useState({ token: "" })
useEffect(() => {
tosCommunityget(null)
setPage({ token: getCookie("token") });
}, []);
const onFinish = (values:any) => {
......@@ -31,9 +35,9 @@ const Guard = (props:any) => {
<TitleGet title={"Version 1.0.5"} />
<TitleGet title={"Version 1.0.6"} />
<p>
token:{token}
token:{page.token}
</p>
{/* <TableShow /> */}
{/* <div>{token}</div>
......
......@@ -86,17 +86,27 @@ const requestList = [
["/tos/contract/detail/query", "20 获取合同列表详情"],
["/tos/community/service/get/detail", "21 小区服务获取详情"],
["/tos/communtiy/service/reply", "22 小区回复"],
["/tos/property/decorate/record/get","23 装修列表获取"],
["/tos/property/decorate/record/get", "23 装修列表获取"],
["/tos/tosCommunity/get", "24 获取小区列表"],
["/tos/tosCommunityNotic/get", "25 获取小区公告列表"],
["/tos/tosVisitorRecord/get","26 获取访客记录列表"],
]
const params = [
{ "communityName": "" },
{ "communityNum": "", "noticTitlel": "" },
{ "inviterAddress": "", "visitorCommunity": "" },
]
function requestAuto(url:string,values:any) {
return request(url, Body(values))
}
export function RA(playload: any) {
// console.log(playload)
// console.log(playload.index)
// console.log(requestList[playload.index])
var url =(requestList[playload.index])[0]
console.log(playload.index+"》【发送请求】"+url+(requestList[playload.index])[1])
console.log(playload.index + "》【发送请求】" + url + " " + (requestList[playload.index])[1])
console.log("参数如下:")
console.log(playload.body)
return requestAuto(url,playload.body)
}
// console.log(playload)
// console.log(playload.index)
// console.log(requestList[playload.index])
// import {message } from 'antd';
export const printf = (playload: any,resp:any) => {
console.log("请求错误码:"+"("+playload.index+")" + resp.error_code)
console.log(playload)
}
......@@ -33,3 +33,24 @@ export const picFromate = (values: any) => {
}
return result
}
export const getCookie=(key:string)=>{
const name = key + "=";
const ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
const c = ca[i].trim();
if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
export const setCookie=(key:string,value: string)=>{
document.cookie=key + "=" + value + "; ";
}
export const RA = (index:any,values:any,module:string,dispatch:any) => { dispatch({ type: module+'/RA', playload: {index:index, body:values } }) };
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs;
import {connect} from 'umi';
import { RA } from '@/utils/method';
const module="XXX"
const XXX = (props:any) => {
const { dispatch, Data } = props;
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(XXX);
\ No newline at end of file
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: 'XXX',
state: {
Data: null,
Result: null,
DataSave: null,
DataSaveDetail:null,
},
reducers: {
returnPage(state, { Data}) {
return { ...state, Data };
},
returnResult(state, { Result}) {
return { ...state, Result};
},
returnDataSave(state, { DataSave }) {
return {...state,DataSave}
},
returnDataSaveDetail(state, { DataSaveDetail }) {
return {...state,DataSaveDetail}
},
},
effects: {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
}
if (resp.error_code != "0000") {
printf(playload, resp)
}
else {
switch (playload.index) {
case 24: {
let Data = resp.data;
yield put({ type: 'returnPage', Data });
} break;
}
}
},
*ResultClear({ }, { put }) {
var tmp=null
yield put({type: 'returnResult', tmp} )
},
*SA({ playload }, { call, put }) {
var DataSave = playload
yield put({type: 'returnDataSave', DataSave} )
},
},
};
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