Commit a6cadda8 authored by MrShi's avatar MrShi

新开dev_ssz分支,业主模块修改

parent f659fc86
......@@ -7,16 +7,16 @@
*/
export default {
dev: {
/* '/api/': {
'/api/': {
target: 'https://preview.pro.ant.design',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
'/api/': {
},
/*'/api/': {
target: 'http://localhost:8080',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},*/
'/res/': {
target: 'http://mapleonlyone.top',
changeOrigin: true,
......@@ -27,8 +27,13 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
/* '/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
'/tos/': {
target: 'http://47.74.233.180:8651',
target: 'http://localhost:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
......@@ -54,8 +59,13 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
/* '/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
'/tos/': {
target: 'http://47.74.233.180:8651',
target: 'http://localhost:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
......@@ -76,15 +86,15 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/tos/': {
target: 'http://47.74.233.180:8651',
'/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
/* '/tos/': {
target: 'http://localhost:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://localhost:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
},*/
},
};
import {getOwnerDetail,getOwner, getTosUser,delAdvertisement,saveAdvertisement,quitAndUserAd,uploadApk,checkVideo } from '@/services/tosUser';
import {updateOwner,saveOwner,getOwnerDetail,getOwner, getTosUser,delAdvertisement,saveAdvertisement,quitAndUserAd,uploadApk,checkVideo } from '@/services/tosUser';
export default{
namespace: 'tUModel',
......@@ -17,19 +17,31 @@ export default{
*getOwner({callback,payload},{ call, put }) {
const response = yield call(getOwner,payload);
yield put({
type: "getOwner",
type: "get",
});
if(callback) callback(response);
},
*getOwnerDetail({callback,payload},{ call, put }) {
const response = yield call(getOwnerDetail,payload);
yield put({
type: "getOwnerDetail",
type: "get",
});
if(callback) callback(response);
},
*saveOwner({callback,payload},{ call, put }) {
const response = yield call(saveOwner,payload);
yield put({
type: "save",
});
if(callback) callback(response);
},
*updateOwner({callback,payload},{ call, put }) {
const response = yield call(updateOwner,payload);
yield put({
type: "save",
});
if(callback) callback(response);
},
*delAdvertisement({callback,payload},{ call, put }) {
const response = yield call(delAdvertisement,payload);
yield put({
......@@ -74,7 +86,7 @@ export default{
};
},
getOwner(state, action) {
/* getOwner(state, action) {
return {
...state,
data:action.payload || {},
......@@ -86,7 +98,7 @@ export default{
...state,
data:action.payload || {},
};
},
},*/
del(state, action) {
return {
...state,
......
......@@ -5,9 +5,7 @@ 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 'moment/locale/zh-cn';
// @ts-ignore
import SelectOptions from '../../../components/SelectOptions/index';
class TosUser extends React.Component {
......@@ -34,7 +32,6 @@ class TosUser extends React.Component {
visible: false,
deviceStatus: '',
selectedRowKeys: [],
used: null,
newAdd: null,
strList: [],
......@@ -206,17 +203,15 @@ class TosUser extends React.Component {
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,
/*name: this.state.name,
model: this.state.model,
status: this.state.status,
id: this.props.currentUser.userid,
id: this.props.currentUser.userid,*/
// userPhone:"18813787835",
// id:"240ebdfbac82417082ff789750760b83",
// ownerName: "哈喽kk",
......@@ -227,17 +222,12 @@ class TosUser extends React.Component {
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,
})
}
else if(res.error_code == "0001"){
} else if(res.error_code == "0001"){
alert(res.error_msg);
}else if(res.error_code == "0002"){
alert(res.error_msg);
......@@ -246,7 +236,7 @@ class TosUser extends React.Component {
// window.location.href = '/';
// router.replace('/');
}
else{
else{
alert("Tos查询出错!未知错误!");
}
}
......@@ -255,8 +245,6 @@ class TosUser extends React.Component {
};
//跳转到编辑页面
edit = (params) => {
let flag = 0;
......@@ -304,7 +292,6 @@ class TosUser extends React.Component {
edit2 = (params) => {
let flag = 0;
const nowUser = this.props.currentUser;
this.props.dispatch(routerRedux.push({
pathname: '/UserManagement/tosUser/edit',
query: params,
......@@ -332,7 +319,7 @@ class TosUser extends React.Component {
}
}
}else{
//alert("找不到用户权限记录!");
//alert("找不到用户权限记录!");
//return;;
}
/* if(flag == 0){
......@@ -362,17 +349,17 @@ class TosUser extends React.Component {
};
//加载省
provinceload = (code) => {
this.props.dispatch({
type: 'deviceModel/getRegion',
payload: {code: code,},
callback: (res) => {
if (res) {
this.setState({
provinceList: res.data,
});
}
}
});
// this.props.dispatch({
// type: 'deviceModel/getRegion',
// payload: {code: code,},
// callback: (res) => {
// if (res) {
// this.setState({
// provinceList: res.data,
// });
// }
// }
// });
};
//省变更
provinceChange = (e) => {
......@@ -416,7 +403,7 @@ class TosUser extends React.Component {
})
} else {
this.setState({city: {label: e.label,}});
this.props.dispatch({
/* this.props.dispatch({
type: 'deviceModel/getRegion',
payload: {code: e.key,},
callback: (res) => {
......@@ -428,7 +415,7 @@ class TosUser extends React.Component {
});
}
}
});
});*/
}
};
//区变更
......@@ -441,7 +428,7 @@ class TosUser extends React.Component {
})
} else {
this.setState({district: {label: e.label,}});
this.props.dispatch({
/*this.props.dispatch({
type: 'deviceModel/getRegion',
payload: {code: e.key,},
callback: (res) => {
......@@ -452,12 +439,12 @@ class TosUser extends React.Component {
});
}
}
});
});*/
}
};
//批量删除
del() {
this.props.dispatch({
/* this.props.dispatch({
type: 'deviceModel/delDevice',
payload: this.state.delData,
callback: (res) => {
......@@ -472,13 +459,13 @@ class TosUser extends React.Component {
} else if(res.error_code == "0008"){
alert(res.error_msg);
window.location.href = '/';
router.replace('/');
// router.replace('/');
} else {
alert("删除失败!未知错误!");
}
}
}
});
});*/
};
//显示信息
info() {
......
......@@ -161,13 +161,73 @@ class TosUserCreate extends React.Component {
snChange = (e) => {
this.setState({sn: e.target.value});
};
//设备sn变更
snChange1 = (e) => {
this.setState({sn1: e.target.value});
};
//设备sn变更
snChange2 = (e) => {
this.setState({sn2: e.target.value});
};
//管理员变更
keeperChange = (e) => {
this.setState({keeper: e.target.value});
};
//联系电话正则
phoneBlur = () => {
if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(this.state.phone))){
const params = {
/* deviceAddress: (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),
deviceName: this.state.name,
deviceModel: this.state.model,
deviceKeeper: this.state.keeper,
deviceID: this.state.id,
deviceSerialNumber: this.state.sn,
devicePhone: this.state.phone,
deviceWorking: this.state.status == '' ? 2 : this.state.status,
deviceStatus: this.state.deviceStatus ? this.state.deviceStatus : 0,
deviceCreate: this.props.currentUser.userid,*/
owerName: this.state.sn,
owerPhone:this.state.sn1,
owerEmail:this.state.sn2,
communityName:this.state.model,
buildingNumber:this.state.name,
floorNumber:this.state.keeper,
roomNumber:this.state.phone1,
addressAndpostalCode:this.state.phone
};
console.log("params",params);
this.props.dispatch({
type: 'tUModel/saveOwner',
payload: params,
callback: (res) => {
if (res.error_code == "0000") {
alert(res.error_msg);
this.back();
} else if (res.error_code == "0002") {
alert(res.error_msg);
this.back();
} else if (res.error_code == "0001"){
alert(res.error_msg);
} else if (res.error_code == "0003"){
alert(res.error_msg)
} else if(res.error_code == "0008"){
alert(res.error_msg);
window.location.href = '/';
router.replace('/');
}else {
alert("提交错误!未知原因!");
}
}
});
/*if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(this.state.phone))){
this.setState({
phoneBlur: false,
})
......@@ -217,7 +277,7 @@ class TosUserCreate extends React.Component {
});
}
});
}
}*/
};
//联系电话变更
phoneChange = (e) => {
......@@ -291,7 +351,7 @@ class TosUserCreate extends React.Component {
//渲染
render() {
const { name, model, keeper, phone,phone1, province, city, district, street,
provinceList, cityList, districtList, streetList, phoneBlur, sn } = this.state;
provinceList, cityList, districtList, streetList, phoneBlur, sn,sn1,sn2 } = this.state;
/* const provinceSelect = provinceList.map((item) => (
<Select.Option value={item.code} label={item.name}>{item.name}</Select.Option>
));
......@@ -311,8 +371,9 @@ class TosUserCreate extends React.Component {
<div className={styles.detailsBox}>
<div>
<span className={styles.detailsContent}>Owner's Name</span>
<Input className={styles.input} value={sn} placeholder="Single Line Input" onChange={(e) => this.snChange(e)}/>
<Input className={styles.input} value={sn} placeholder="OwnerName" onChange={(e) => this.snChange(e)}/>
<Input className={styles.input} value={sn1} placeholder="Phone" onChange={(e) => this.snChange1(e)}/>
<Input className={styles.input} value={sn2} placeholder="E-mail" onChange={(e) => this.snChange2(e)}/>
</div>
<div>
<span className={styles.detailsContent}>Project / community</span>
......
......@@ -20,7 +20,19 @@ export async function getOwnerDetail(params) {
data: params,
});
}
export async function saveOwner(params) {
return request('/tos/tosOwner/save', {
method: 'POST',
data: params,
});
}
export async function updateOwner(params) {
return request('/tos/tosOwner/info/update', {
method: 'POST',
data: params,
});
}
export async function delAdvertisement(params) {
return request('/api/ad/del', {
method: 'POST',
......
......@@ -14,14 +14,16 @@ export function getAuthority(str?: string): string | string[] {
authority = authorityString;
}
if (typeof authority === 'string') {
return [authority];
// return [authority];
return ['admin'];
}
// preview.pro.ant.design only do not use in your production.
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
return ['admin'];
}
return authority;
// return authority;
return ['admin'];
}
export function setAuthority(authority: string | string[]): void {
......
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