Commit a6cadda8 authored by MrShi's avatar MrShi

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

parent f659fc86
...@@ -7,16 +7,16 @@ ...@@ -7,16 +7,16 @@
*/ */
export default { export default {
dev: { dev: {
/* '/api/': { '/api/': {
target: 'https://preview.pro.ant.design', target: 'https://preview.pro.ant.design',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
},*/ },
'/api/': { /*'/api/': {
target: 'http://localhost:8080', target: 'http://localhost:8080',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },*/
'/res/': { '/res/': {
target: 'http://mapleonlyone.top', target: 'http://mapleonlyone.top',
changeOrigin: true, changeOrigin: true,
...@@ -27,10 +27,15 @@ export default { ...@@ -27,10 +27,15 @@ export default {
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
'/tos/': { /* '/tos/': {
target: 'http://47.74.233.180:8651', target: 'http://47.74.233.180:8651',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
},*/
'/tos/': {
target: 'http://localhost:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
}, },
}, },
test: { test: {
...@@ -54,10 +59,15 @@ export default { ...@@ -54,10 +59,15 @@ export default {
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
'/tos/': { /* '/tos/': {
target: 'http://47.74.233.180:8651', target: 'http://47.74.233.180:8651',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
},*/
'/tos/': {
target: 'http://localhost:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
}, },
}, },
pre: { pre: {
...@@ -80,11 +90,11 @@ export default { ...@@ -80,11 +90,11 @@ export default {
target: 'http://47.74.233.180:8651', target: 'http://47.74.233.180:8651',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
// '/tos/': { /* '/tos/': {
// target: 'http://localhost:8651', target: 'http://localhost:8651',
// changeOrigin: true, changeOrigin: true,
// pathRewrite: { '^': '' }, 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{ export default{
namespace: 'tUModel', namespace: 'tUModel',
...@@ -17,19 +17,31 @@ export default{ ...@@ -17,19 +17,31 @@ export default{
*getOwner({callback,payload},{ call, put }) { *getOwner({callback,payload},{ call, put }) {
const response = yield call(getOwner,payload); const response = yield call(getOwner,payload);
yield put({ yield put({
type: "getOwner", type: "get",
}); });
if(callback) callback(response); if(callback) callback(response);
}, },
*getOwnerDetail({callback,payload},{ call, put }) { *getOwnerDetail({callback,payload},{ call, put }) {
const response = yield call(getOwnerDetail,payload); const response = yield call(getOwnerDetail,payload);
yield put({ 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); if(callback) callback(response);
}, },
*delAdvertisement({callback,payload},{ call, put }) { *delAdvertisement({callback,payload},{ call, put }) {
const response = yield call(delAdvertisement,payload); const response = yield call(delAdvertisement,payload);
yield put({ yield put({
...@@ -74,7 +86,7 @@ export default{ ...@@ -74,7 +86,7 @@ export default{
}; };
}, },
getOwner(state, action) { /* getOwner(state, action) {
return { return {
...state, ...state,
data:action.payload || {}, data:action.payload || {},
...@@ -86,7 +98,7 @@ export default{ ...@@ -86,7 +98,7 @@ export default{
...state, ...state,
data:action.payload || {}, data:action.payload || {},
}; };
}, },*/
del(state, action) { del(state, action) {
return { return {
...state, ...state,
......
...@@ -5,9 +5,7 @@ from "antd"; ...@@ -5,9 +5,7 @@ from "antd";
import styles from './style.less'; import styles from './style.less';
import {ConnectState} from "@/models/connect"; import {ConnectState} from "@/models/connect";
import XLSX from "@/pages/account/xlsx.core.min"; import XLSX from "@/pages/account/xlsx.core.min";
import {router} from "umi";
import 'moment/locale/zh-cn'; import 'moment/locale/zh-cn';
// @ts-ignore
import SelectOptions from '../../../components/SelectOptions/index'; import SelectOptions from '../../../components/SelectOptions/index';
class TosUser extends React.Component { class TosUser extends React.Component {
...@@ -34,7 +32,6 @@ class TosUser extends React.Component { ...@@ -34,7 +32,6 @@ class TosUser extends React.Component {
visible: false, visible: false,
deviceStatus: '', deviceStatus: '',
selectedRowKeys: [], selectedRowKeys: [],
used: null, used: null,
newAdd: null, newAdd: null,
strList: [], strList: [],
...@@ -206,17 +203,15 @@ class TosUser extends React.Component { ...@@ -206,17 +203,15 @@ class TosUser extends React.Component {
visible: false, visible: false,
}); });
}; };
//获取所有设备
//获取所有设备
getDevice = () => { getDevice = () => {
const params = { const params = {
// address: (this.state.province == undefined ? '' : this.state.province.label) + /*name: this.state.name,
// (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, model: this.state.model,
status: this.state.status, status: this.state.status,
id: this.props.currentUser.userid, id: this.props.currentUser.userid,*/
// userPhone:"18813787835", // userPhone:"18813787835",
// id:"240ebdfbac82417082ff789750760b83", // id:"240ebdfbac82417082ff789750760b83",
// ownerName: "哈喽kk", // ownerName: "哈喽kk",
...@@ -227,17 +222,12 @@ class TosUser extends React.Component { ...@@ -227,17 +222,12 @@ class TosUser extends React.Component {
payload: params, payload: params,
callback: (res) => { callback: (res) => {
if (res) { if (res) {
/*this.setState({
data: res.rows,
total: res.total,
})*/
if(res.error_code == "0000"){ if(res.error_code == "0000"){
this.setState({ this.setState({
data: res.data.rows, data: res.data.rows,
total: res.data.total, total: res.data.total,
}) })
} } else if(res.error_code == "0001"){
else if(res.error_code == "0001"){
alert(res.error_msg); alert(res.error_msg);
}else if(res.error_code == "0002"){ }else if(res.error_code == "0002"){
alert(res.error_msg); alert(res.error_msg);
...@@ -255,8 +245,6 @@ class TosUser extends React.Component { ...@@ -255,8 +245,6 @@ class TosUser extends React.Component {
}; };
//跳转到编辑页面 //跳转到编辑页面
edit = (params) => { edit = (params) => {
let flag = 0; let flag = 0;
...@@ -304,7 +292,6 @@ class TosUser extends React.Component { ...@@ -304,7 +292,6 @@ class TosUser extends React.Component {
edit2 = (params) => { edit2 = (params) => {
let flag = 0; let flag = 0;
const nowUser = this.props.currentUser; const nowUser = this.props.currentUser;
this.props.dispatch(routerRedux.push({ this.props.dispatch(routerRedux.push({
pathname: '/UserManagement/tosUser/edit', pathname: '/UserManagement/tosUser/edit',
query: params, query: params,
...@@ -362,17 +349,17 @@ class TosUser extends React.Component { ...@@ -362,17 +349,17 @@ class TosUser extends React.Component {
}; };
//加载省 //加载省
provinceload = (code) => { provinceload = (code) => {
this.props.dispatch({ // this.props.dispatch({
type: 'deviceModel/getRegion', // type: 'deviceModel/getRegion',
payload: {code: code,}, // payload: {code: code,},
callback: (res) => { // callback: (res) => {
if (res) { // if (res) {
this.setState({ // this.setState({
provinceList: res.data, // provinceList: res.data,
}); // });
} // }
} // }
}); // });
}; };
//省变更 //省变更
provinceChange = (e) => { provinceChange = (e) => {
...@@ -416,7 +403,7 @@ class TosUser extends React.Component { ...@@ -416,7 +403,7 @@ class TosUser extends React.Component {
}) })
} else { } else {
this.setState({city: {label: e.label,}}); this.setState({city: {label: e.label,}});
this.props.dispatch({ /* this.props.dispatch({
type: 'deviceModel/getRegion', type: 'deviceModel/getRegion',
payload: {code: e.key,}, payload: {code: e.key,},
callback: (res) => { callback: (res) => {
...@@ -428,7 +415,7 @@ class TosUser extends React.Component { ...@@ -428,7 +415,7 @@ class TosUser extends React.Component {
}); });
} }
} }
}); });*/
} }
}; };
//区变更 //区变更
...@@ -441,7 +428,7 @@ class TosUser extends React.Component { ...@@ -441,7 +428,7 @@ class TosUser extends React.Component {
}) })
} else { } else {
this.setState({district: {label: e.label,}}); this.setState({district: {label: e.label,}});
this.props.dispatch({ /*this.props.dispatch({
type: 'deviceModel/getRegion', type: 'deviceModel/getRegion',
payload: {code: e.key,}, payload: {code: e.key,},
callback: (res) => { callback: (res) => {
...@@ -452,12 +439,12 @@ class TosUser extends React.Component { ...@@ -452,12 +439,12 @@ class TosUser extends React.Component {
}); });
} }
} }
}); });*/
} }
}; };
//批量删除 //批量删除
del() { del() {
this.props.dispatch({ /* this.props.dispatch({
type: 'deviceModel/delDevice', type: 'deviceModel/delDevice',
payload: this.state.delData, payload: this.state.delData,
callback: (res) => { callback: (res) => {
...@@ -472,13 +459,13 @@ class TosUser extends React.Component { ...@@ -472,13 +459,13 @@ class TosUser extends React.Component {
} else if(res.error_code == "0008"){ } else if(res.error_code == "0008"){
alert(res.error_msg); alert(res.error_msg);
window.location.href = '/'; window.location.href = '/';
router.replace('/'); // router.replace('/');
} else { } else {
alert("删除失败!未知错误!"); alert("删除失败!未知错误!");
} }
} }
} }
}); });*/
}; };
//显示信息 //显示信息
info() { info() {
......
...@@ -161,13 +161,73 @@ class TosUserCreate extends React.Component { ...@@ -161,13 +161,73 @@ class TosUserCreate extends React.Component {
snChange = (e) => { snChange = (e) => {
this.setState({sn: e.target.value}); 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) => { keeperChange = (e) => {
this.setState({keeper: e.target.value}); this.setState({keeper: e.target.value});
}; };
//联系电话正则 //联系电话正则
phoneBlur = () => { 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({ this.setState({
phoneBlur: false, phoneBlur: false,
}) })
...@@ -217,7 +277,7 @@ class TosUserCreate extends React.Component { ...@@ -217,7 +277,7 @@ class TosUserCreate extends React.Component {
}); });
} }
}); });
} }*/
}; };
//联系电话变更 //联系电话变更
phoneChange = (e) => { phoneChange = (e) => {
...@@ -291,7 +351,7 @@ class TosUserCreate extends React.Component { ...@@ -291,7 +351,7 @@ class TosUserCreate extends React.Component {
//渲染 //渲染
render() { render() {
const { name, model, keeper, phone,phone1, province, city, district, street, 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) => ( /* const provinceSelect = provinceList.map((item) => (
<Select.Option value={item.code} label={item.name}>{item.name}</Select.Option> <Select.Option value={item.code} label={item.name}>{item.name}</Select.Option>
)); ));
...@@ -311,8 +371,9 @@ class TosUserCreate extends React.Component { ...@@ -311,8 +371,9 @@ class TosUserCreate extends React.Component {
<div className={styles.detailsBox}> <div className={styles.detailsBox}>
<div> <div>
<span className={styles.detailsContent}>Owner's Name</span> <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>
<div> <div>
<span className={styles.detailsContent}>Project / community</span> <span className={styles.detailsContent}>Project / community</span>
......
...@@ -20,7 +20,19 @@ export async function getOwnerDetail(params) { ...@@ -20,7 +20,19 @@ export async function getOwnerDetail(params) {
data: 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) { export async function delAdvertisement(params) {
return request('/api/ad/del', { return request('/api/ad/del', {
method: 'POST', method: 'POST',
......
...@@ -14,14 +14,16 @@ export function getAuthority(str?: string): string | string[] { ...@@ -14,14 +14,16 @@ export function getAuthority(str?: string): string | string[] {
authority = authorityString; authority = authorityString;
} }
if (typeof authority === 'string') { 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 only do not use in your production.
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
return ['admin']; return ['admin'];
} }
return authority; // return authority;
return ['admin'];
} }
export function setAuthority(authority: string | string[]): void { 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