Commit 9e0fbec0 authored by MrShi's avatar MrShi

[fix]服务商模块

parent 41c626d6
...@@ -86,15 +86,15 @@ export default { ...@@ -86,15 +86,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/': { '/tos/': {
target: 'http://localhost:8651', target: 'http://localhost:8651',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
},*/ },
}, },
}; };
...@@ -33,7 +33,7 @@ const Users = (props:any) => { ...@@ -33,7 +33,7 @@ const Users = (props:any) => {
const search = formatMessage({ id: 'R.charge.search' }) const search = formatMessage({ id: 'R.charge.search' })
const addaccount = formatMessage({ id: 'R.charge.addaccount' }) const addaccount = formatMessage({ id: 'R.charge.addaccount' })
const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' }) const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' })
// const string2mean = [[0, "未注册"], [1, "注册"], [2, "注销"]] // const string2mean = [[0, "未注册"], [1, "注册"], [2, "注销"]]
const string2mean=[[0, "Unregistered"],[1,"Registered"], [2,"Deregistered"]] const string2mean=[[0, "Unregistered"],[1,"Registered"], [2,"Deregistered"]]
...@@ -50,33 +50,33 @@ const Users = (props:any) => { ...@@ -50,33 +50,33 @@ const Users = (props:any) => {
const columns = [ const columns = [
{ title: username, dataIndex: 'owerName', }, { title: username, dataIndex: 'owerName', },
{ title: project, dataIndex: 'communityName', }, { title: project, dataIndex: 'communityName', },
// { title: project, dataIndex: 'unit', }, // { title: project, dataIndex: 'unit', },
// { title: unit, dataIndex: 'living', }, // { title: unit, dataIndex: 'living', },
{title: unit,render:(text: any, record: any) => (<div>{record.buildingNumber+"#"+record.floorNumber+"—"+record.roomNumber}</div>)}, {title: unit,render:(text: any, record: any) => (<div>{record.buildingNumber+"#"+record.floorNumber+"—"+record.roomNumber}</div>)},
{ title: status, dataIndex: 'enable', render: (text: any, record: any) => (<div>{string2mean[text][1]}</div>)}, { title: status, dataIndex: 'enable', render: (text: any, record: any) => (<div>{string2mean[text][1]}</div>)},
{title: submissionTime,render:(text: any, record: any) => (<div>{timestampToTime(record.createTime.time)}</div>)}, {title: submissionTime,render:(text: any, record: any) => (<div>{timestampToTime(record.createTime.time)}</div>)},
{title: actions, {title: actions,
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
<a onClick={goToEdit.bind(this, record)} disabled={record.enable==2?true:false}>Edit</a> <a onClick={goToEdit.bind(this, record)} disabled={record.enable==2?true:false}>Edit</a>
<a onClick={goToDetail.bind(this,record)}>Detail</a> <a onClick={goToDetail.bind(this,record)}>Detail</a>
</Space> </Space>
), ),
}, },
]; ];
// 上传的模块 // 上传的模块
const propsUpload = { const propsUpload = {
name: 'file', name: 'file',
action: ()=>{return "http://47.74.233.180:8651/tos/excel/upload?userId=" + getCookie("id")}, action: ()=>{return "http://47.74.233.180:8651/tos/excel/upload?userId=" + getCookie("id")},
onChange(info) { onChange(info) {
if (info.file.status == 'uploading') { if (info.file.status == 'uploading') {
setFileUploading(true) setFileUploading(true)
} }
if (info.file.status === 'done') { if (info.file.status === 'done') {
if (info.file.response.data.error_code == "0000") { if (info.file.response.data.error_code == "0000") {
history.push(location.pathname+"/Result") history.push(location.pathname+"/Result")
} else { } else {
...@@ -97,13 +97,13 @@ const Users = (props:any) => { ...@@ -97,13 +97,13 @@ const Users = (props:any) => {
setLoading(false) setLoading(false)
console.log("核查的地方") console.log("核查的地方")
console.log(Data) console.log(Data)
} }
}, [Data]) }, [Data])
// if (pageStart == false) { // if (pageStart == false) {
// console.log(location.pathname) // console.log(location.pathname)
// if(history_url!=null){ console.log(history_url.pathname)} // if(history_url!=null){ console.log(history_url.pathname)}
// if (history_url != null && location.pathname != history_url.pathname) { // if (history_url != null && location.pathname != history_url.pathname) {
// console.log("来自上层数据") // console.log("来自上层数据")
// if (history_url.status == 0) { // if (history_url.status == 0) {
...@@ -111,10 +111,10 @@ const Users = (props:any) => { ...@@ -111,10 +111,10 @@ const Users = (props:any) => {
// var tmp = Data // var tmp = Data
// tmp.defaultCurrent = pageData.defaultCurrent // tmp.defaultCurrent = pageData.defaultCurrent
// var tmp2 = curString; tmp2.defaultCurrent = pageData.defaultCurrent; setCurString(tmp2) // var tmp2 = curString; tmp2.defaultCurrent = pageData.defaultCurrent; setCurString(tmp2)
// setTestData(tmp) // setTestData(tmp)
// } else { // } else {
// console.log("异变数据源") // console.log("异变数据源")
// console.log(history_url) // console.log(history_url)
// RA(12, { // RA(12, {
// ownerName:null, // ownerName:null,
// communityArray: CommunityList // communityArray: CommunityList
...@@ -125,18 +125,18 @@ const Users = (props:any) => { ...@@ -125,18 +125,18 @@ const Users = (props:any) => {
// }else { // }else {
// var tmp={rows:[], total:0,defaultCurrent:1} // var tmp={rows:[], total:0,defaultCurrent:1}
// setTestData(tmp) // setTestData(tmp)
// } // }
// } // }
// if (pageStart == true) { // if (pageStart == true) {
// if (Data != null) { // if (Data != null) {
// console.log("可以接受值2") // console.log("可以接受值2")
// console.log(Data) // console.log(Data)
// changeValue("loading",false) // changeValue("loading",false)
// setTestData(Data) // setTestData(Data)
// } // }
// } // }
useEffect(() => { useEffect(() => {
//分页设置 //分页设置
...@@ -147,17 +147,17 @@ const Users = (props:any) => { ...@@ -147,17 +147,17 @@ const Users = (props:any) => {
} }
//前置数据 //前置数据
console.log("前置数据"); console.log("前置数据");
var tmp = filterObjbyTg(location.query, ["ownerName"]) var tmp = filterObjbyTg(location.query, ["ownerName"])
setReadyData(tmp) setReadyData(tmp)
//获取数据 //获取数据
setLoading(true) setLoading(true)
RA(12, { RA(12, {
ownerName:location.query.ownerName != undefined ? (location.query.ownerName) : null, ownerName:location.query.ownerName != undefined ? (location.query.ownerName) : null,
communityArray: CommunityList communityArray: CommunityList
}, module, dispatch); }, module, dispatch);
},[location]) },[location])
const goToDetail = (values:any,e:any) => { const goToDetail = (values:any,e:any) => {
...@@ -176,7 +176,7 @@ const Users = (props:any) => { ...@@ -176,7 +176,7 @@ const Users = (props:any) => {
URL({ pathname: location.pathname+'/Add', status: 1 }, module2, dispatch) URL({ pathname: location.pathname+'/Add', status: 1 }, module2, dispatch)
history.push(location.pathname+'/Add') history.push(location.pathname+'/Add')
} }
const CallBackTitleSearch = (comment: any)=>{ const CallBackTitleSearch = (comment: any)=>{
console.log(comment) console.log(comment)
//页面搜索 //页面搜索
...@@ -184,33 +184,34 @@ const Users = (props:any) => { ...@@ -184,33 +184,34 @@ const Users = (props:any) => {
history.push(location.pathname+urlEncode(filterObj({ ownerName: comment.OwnerName}))) history.push(location.pathname+urlEncode(filterObj({ ownerName: comment.OwnerName})))
} }
const pageChange = (values: any) => { const pageChange = (values: any) => {
// var tmp = curString; tmp.defaultCurrent = values.current; setCurString(tmp) // var tmp = curString; tmp.defaultCurrent = values.current; setCurString(tmp)
/*页面跳转*/ /*页面跳转*/
var tmp = filterObjbyTg(location.query, []) var tmp = filterObjbyTg(location.query, [])
tmp["current"]=values.current tmp["current"]=values.current
history.push(location.pathname + urlEncode(tmp)) history.push(location.pathname + urlEncode(tmp))
} }
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件 */} {/* 头部组件 */}
<TitleSearch listkey={["OwnerName"]} list={["Owner Name"]} community={"serviceCommunityList"} onSubmit={CallBackTitleSearch} /> <TitleSearch listkey={["OwnerName"]} list={["Owner Name"]}
community={"serviceCommunityList"} onSubmit={CallBackTitleSearch} />
{/* 内容组件 */} {/* 内容组件 */}
<div className={styles.box2}> <div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToAdd}>Create New Owner</button> <button className={styles.buttonAdd2} onClick={goToAdd}>Create New Owner</button>
<div className={styles.buttonAdd} > <div className={styles.buttonAdd} >
<Upload {...propsUpload}> <Upload {...propsUpload}>
<Button icon={compent.fileUploading?null:<UploadOutlined />}>{compent.fileUploading?<><Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} /> Uploading</>:"Batch Upload"}</Button> <Button icon={compent.fileUploading?null:<UploadOutlined />}>{compent.fileUploading?<><Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} /> Uploading</>:"Batch Upload"}</Button>
</Upload> </Upload>
</div> </div>
</div> </div>
{/* 列表组件 */} {/* 列表组件 */}
<Table <Table
rowKey={"id"} rowKey={"id"}
...@@ -226,10 +227,10 @@ const Users = (props:any) => { ...@@ -226,10 +227,10 @@ const Users = (props:any) => {
}; };
function mapStateToProps(state:any) { function mapStateToProps(state:any) {
const { sourceData, DataSave, Data, } = state.User; const { sourceData, DataSave, Data, } = state.User;
const { history_url } = state.History; const { history_url } = state.History;
const { pageData} = state.PageData; const { pageData} = state.PageData;
const { token } = state.login; const { token } = state.login;
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
Data, Data,
......
...@@ -7,16 +7,17 @@ import { LoadingOutlined } from '@ant-design/icons'; ...@@ -7,16 +7,17 @@ import { LoadingOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch,history } from 'umi'; import { Link, useIntl, connect, Dispatch,history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../../components/TitleSearch/TitleSearch';
import {filterObj, urlEncode} from "@/utils/method";
const ServiceProviderManagement = (props: any) => { const ServiceProviderManagement = (props: any) => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const { dispatch, location, Data, CommunityList } = props; const { dispatch, location, Data, CommunityList } = props;
const RA = (index:any,values: any) => { dispatch({ type: 'ServiceProvider/RA', playload: {index:index, body:values } }) }; const RA = (index:any,values: any) => { dispatch({ type: 'ServiceProvider/RA', playload: {index:index, body:values } }) };
const TosTosServiceProviderGet = (values: any) => { dispatch({ type: 'ServiceProvider/TosTosServiceProviderGet', playload: values }) }; const TosTosServiceProviderGet = (values: any) => { dispatch({ type: 'ServiceProvider/TosTosServiceProviderGet', playload: values }) };
const SaveChooseData = (values: any) => { dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values }) };
const SaveChooseData = (values: any) => { dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values }) };
const GetList = () => { const GetList = () => {
if (CommunityList != null) { if (CommunityList != null) {
TosTosServiceProviderGet({ TosTosServiceProviderGet({
...@@ -27,26 +28,26 @@ const ServiceProviderManagement = (props: any) => { ...@@ -27,26 +28,26 @@ const ServiceProviderManagement = (props: any) => {
} }
useEffect(() => { useEffect(() => {
GetList() GetList()
}, []); }, []);
useEffect(() => { useEffect(() => {
GetList() GetList()
}, [CommunityList]); }, [CommunityList]);
const goToDetail = (values: any, e: any) => { const goToDetail = (values: any, e: any) => {
SaveChooseData(values) SaveChooseData(values)
history.push(location.pathname +'/Detail') history.push(location.pathname +'/Detail')
} }
const goToCreate = () => { const goToCreate = () => {
SaveChooseData(null) SaveChooseData(null)
history.push(location.pathname + '/Edit') history.push(location.pathname + '/Edit')
} }
const goToEdit = (values: any, e: any) => { const goToEdit = (values: any, e: any) => {
SaveChooseData(values) SaveChooseData(values)
history.push(location.pathname + '/Edit') history.push(location.pathname + '/Edit')
} }
const goToServices = () => {history.push(location.pathname +'/Services')} const goToServices = () => {history.push(location.pathname +'/Services')}
const pagination={defaultCurrent:1,total: Data!=null?Data.length:0} const pagination={defaultCurrent:1,total: Data!=null?Data.length:0}
const columns = [ const columns = [
...@@ -57,7 +58,7 @@ const ServiceProviderManagement = (props: any) => { ...@@ -57,7 +58,7 @@ const ServiceProviderManagement = (props: any) => {
{ title: "Account Status",dataIndex: 'enable',}, { title: "Account Status",dataIndex: 'enable',},
{ title: "Actions", { title: "Actions",
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"><a onClick={goToDetail.bind(this,record)}>Detail</a><a onClick={goToEdit.bind(this,record)}>edit</a></Space> <Space size="middle"><a onClick={goToDetail.bind(this,record)}>Detail</a><a onClick={goToEdit.bind(this,record)}>edit</a></Space>
), ),
}, },
]; ];
...@@ -67,45 +68,53 @@ const ServiceProviderManagement = (props: any) => { ...@@ -67,45 +68,53 @@ const ServiceProviderManagement = (props: any) => {
switch (tmp[items].enable) { switch (tmp[items].enable) {
case 0: tmp[items].enable = "unregistered";break; case 0: tmp[items].enable = "unregistered";break;
case 1: tmp[items].enable = "registered";break; case 1: tmp[items].enable = "registered";break;
case 2:break; case 2:break;
} }
} }
return tmp; return tmp;
} }
const CallBackTitleSearch = (comment: any)=>{ const CallBackTitleSearch = (comment: any)=>{
console.log(comment) console.log(comment)
console.log(location.pathname)
//页面搜索
TosTosServiceProviderGet({
providerName: comment.providerName,
serviceCommunityList: CommunityList
})
// history.push(location.pathname+urlEncode(filterObj({ providerName: comment.providerName})))
} }
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件 */}
<TitleSearch <TitleSearch
listkey={["providerName"]} listkey={["providerName"]}
list={["Service Provider"]} list={["Service Provider"]}
community={"serviceCommunityList"} community={"serviceCommunityList"}
onSubmit={CallBackTitleSearch} /> onSubmit={CallBackTitleSearch} />
{/* 内容组件 */} {/* 内容组件 */}
<div className={styles.box2}> <div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToServices}>Avail Services</button> <button className={styles.buttonAdd2} onClick={goToServices}>Avail Services</button>
<button className={styles.buttonAdd} onClick={goToCreate}>Create New</button> <button className={styles.buttonAdd} onClick={goToCreate}>Create New</button>
</div> </div>
{/* 列表组件 */} {/* 列表组件 */}
<Spin spinning={Data!=null?false:true}> <Spin spinning={Data!=null?false:true}>
<Table size="small" rowKey={"id"} style={{ marginTop: 16 }} columns={columns} dataSource={Data!=null?dataSource(Data):null} pagination={pagination} /> <Table size="small" rowKey={"id"} style={{ marginTop: 16 }} columns={columns} dataSource={Data!=null?dataSource(Data):null} pagination={pagination} />
</Spin> </Spin>
</div> </div>
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state:any) {
const { Data } = state.ServiceProvider; const { Data } = state.ServiceProvider;
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
Data, Data,
......
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