Commit e8a38aa7 authored by Sixiang_Zzb's avatar Sixiang_Zzb

服务商管理模块 新增服务商bug处理

parent c1317903
......@@ -73,16 +73,16 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
</span>
</HeaderDropdown>
) : (
<span className={`${styles.action} ${styles.account}`}>
<Spin
size="small"
style={{
marginLeft: 8,
marginRight: 8,
}}
/>
</span>
);
<span className={`${styles.action} ${styles.account}`}>
<Spin
size="small"
style={{
marginLeft: 8,
marginRight: 8,
}}
/>
</span>
);
}
}
......
......@@ -81,7 +81,8 @@ class TagSelect extends React.Component {
const { value, inputVisible, inputValue, editInputIndex, editInputValue } = this.state;
return (
<>
{value.map((tag, index) => {
{
value.map((tag, index) => {
if (editInputIndex === index) {
return (
<Input
......@@ -127,7 +128,9 @@ class TagSelect extends React.Component {
) : (
tagElem
);
})}
})
}
{inputVisible && (
<Input
ref={this.saveInputRef}
......
import React, { useState,useEffect,useRef} from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import styles from './index.less';
......@@ -6,26 +6,26 @@ import styles from './index.less';
import BackButton from '../BackButton/BackButton';
import TitleGet from '../TitleGet/TitleGet';
import { Input, Row, Col, Form, Select, Button,DatePicker } from 'antd';
import { Input, Row, Col, Form, Select, Button, DatePicker } from 'antd';
const { Option } = Select;
import SelectOptions from '../../components/SelectOptions/index';
import { gray } from 'chalk';
import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity';
const TitleSearch= (props:any) => {
const TitleSearch = (props: any) => {
// console.log("===================================",props)
const {dispatch, CommunityList } = props;
const { dispatch, CommunityList } = props;
const key = props.listkey
const name = props.list;
const single = props.single
const checklist = props.checklist;
const status = props.status;
const communitySelect=props.communitySelect
const communitySelect = props.communitySelect
const defaultValue = props.defaultValue
const time = props.time;
const community = props.community;
const [selectOptions, setSelectOptions] = useState(true)
......@@ -34,27 +34,29 @@ const TitleSearch= (props:any) => {
const [datePicker, setDate] = useState(null)
const formRef = useRef(null)
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) };
useEffect(() => {
// console.log("标题搜寻组件初始化") OK
if (CommunityList == null) {
// console.log("小区数量初始化") OK
tosCommunityget(null)
tosCommunityget(null)
}
if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue)
}
}, []);
}, []);
useEffect(() => {
useEffect(()=>{
if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue)
}
},[defaultValue])
useEffect(()=>{
}, [defaultValue])
useEffect(() => {
console.log(CommunityList)
if (CommunityList != null) {
// console.log("小区数量初始化完毕") OK
var tmp = {}
......@@ -62,106 +64,109 @@ const TitleSearch= (props:any) => {
// props.onSubmit(tmp) 禁用 改用组件初始化
setCommunitys(CommunityList)
}
},[CommunityList])
}, [CommunityList])
const onFinish = (values:any) => {
const onFinish = (values: any) => {
if (datePicker) {
values[time[0]] = datePicker;
}
if (community) {
values[community]=communitys
if (community) {
values[community] = communitys
}
console.log('Success:', values);
props.onSubmit(values)
};
const onFinishFailed = (errorInfo:any) => {
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo);
};
const onChange = (date:any,dateString:string) => {
const onChange = (date: any, dateString: string) => {
setDate(dateString)
}
const printContent = (comment: any)=>{
const printContent = (comment: any) => {
setCommunitys(comment)
}
return (
<>
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}>
{
communitySelect != null ?
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} /></Form.Item></Col>
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}>
{
communitySelect != null ?
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} /></Form.Item></Col>
: null
}
}
{
key!=null?
key.map((item, index) => {
return (
<Col key={"KeyCol_"+ index}><Form.Item name={item}><Input placeholder={name[index]} allowClear /></Form.Item></Col>
)
})
:null
key != null ?
key.map((item, index) => {
return (
<Col key={"KeyCol_" + index}><Form.Item name={item}><Input placeholder={name[index]} allowClear /></Form.Item></Col>
)
})
: null
}
{
status != null ?
status.map((item, index) => {
return (
<Col key={"StatusCol_" + index}><Form.Item name={item.name[0]}>
<Select style={{width:160}} placeholder={item.name[1]} allowClear={true}>
{
item.data.map(word => {
return (
<Option key={word} value={word[0]}>{word[1]}</Option>
)
})
}
</Select></Form.Item></Col>
)
})
:null
status.map((item, index) => {
return (
<Col key={"StatusCol_" + index}>
<Form.Item name={item.name[0]}>
<Select style={{ width: 160 }} placeholder={item.name[1]} allowClear={true}>
{
item.data.map(word => {
return (
<Option key={word} value={word[0]}>{word[1]}</Option>
)
})
}
</Select>
</Form.Item>
</Col>
)
})
: null
}
{
time != null ?
<Col key={"datePicker_"} > <DatePicker placeholder={time[1]} onChange={onChange} /></Col>
time != null ?
<Col key={"datePicker_"} > <DatePicker placeholder={time[1]} onChange={onChange} /></Col>
: null
}
}
{
community == null ?
<Col><Form.Item><Button type="primary" htmlType="submit">Search</Button></Form.Item></Col>
<Col><Form.Item><Button type="primary" htmlType="submit">Search</Button></Form.Item></Col>
: null
}
}
</Row>
{
community != null ?
<>
{
CommunityList != null ?
<SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} />:
null
<SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} /> :
null
}
<Form.Item><Button type="primary" htmlType="submit" style={{ backgroundColor: "#e7f4ff",color:"rgba(24,144,255,1)"}}>Search</Button></Form.Item>
<Form.Item><Button type="primary" htmlType="submit" style={{ backgroundColor: "#e7f4ff", color: "rgba(24,144,255,1)" }}>Search</Button></Form.Item>
</> : null
}
</Form>
</>
);
};
function mapStateToProps(state:any) {
function mapStateToProps(state: any) {
// console.log("state参数",state)
const { CommunityList } = state.Init;
const { CommunityList } = state.Init;
return {
CommunityList,
};
......
import * as service from '../services/tos';
import { message } from 'antd';
import { routerRedux } from 'dva/router'
import { routerRedux } from 'dva/router';
export default {
namespace: 'ServiceProvider',
state: {
Data: null,
CurDataFollow: null,
SaveChooseData:null,
SaveChooseData: null,
},
reducers: {
......@@ -22,65 +22,61 @@ export default {
returnCurDataFollowDetail(state, { CurDataFollowDetail }) {
return { ...state, CurDataFollowDetail };
},
},
returnSaveChooseData(state, { SaveChooseData }) {
return { ...state, SaveChooseData };
},
},
effects: {
// 获取服务商
*TosTosServiceProviderGet({ playload }, { call, put }) {
const resp = yield call(service.TosTosServiceProviderGet, playload);
console.log(resp)
console.log(resp);
if (resp.code == 500) {
// window.location.href = '/500';
}
if (resp.error_code == "0000") {
let Data = resp.data.rows;
yield put({ type: 'returnPage', Data, });
}
if (resp.error_code == '0000') {
let Data = resp.data.rows;
yield put({ type: 'returnPage', Data });
} else {
console.log("请求错误码:"+resp.error_code)
console.log('请求错误码:' + resp.error_code);
let Data = null;
console.log(playload)
yield put({ type: 'returnPage', Data, });
console.log(playload);
yield put({ type: 'returnPage', Data });
}
},
// 新建服务商
*TosTosServiceProviderSave({ playload }, { call, put }) {
console.log(playload)
console.log(playload);
const resp = yield call(service.TosTosServiceProviderSave, playload);
console.log(resp)
console.log(resp);
if (resp.code == 500) {
window.location.href = '/500';
} else {
message.success("operator success!", 2);
message.success('operator success!', 2);
window.location.href = '/UserManagement/ServiceProviderManagement';
}
},
//获取服务商保安根据服务商名
*TosSecurityGuarderGet({ playload }, { call, put }) {
console.log(playload)
console.log(playload);
const resp = yield call(service.TosSecurityGuarderGet, playload);
console.log(resp)
console.log(resp);
let CurDataFollow = resp.data.rows;
yield put({ type: 'returnCurDataFollow', CurDataFollow, });
yield put({ type: 'returnCurDataFollow', CurDataFollow });
},
//获取服务商保安详情根据服务商名
*GuarderById({ playload }, { call, put }) {
let CurDataFollowDetail = playload;
yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail, });
yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail });
},
*SaveChooseData({ playload }, { call, put }) {
let SaveChooseData = playload;
yield put({ type: 'returnSaveChooseData', SaveChooseData, });
yield put({ type: 'returnSaveChooseData', SaveChooseData });
},
},
};
......@@ -21,6 +21,7 @@ const Users = (props: any) => {
const { formatMessage } = useIntl();
const { dispatch, location, Data, CommunityList, pageData, history_url } = props;
const SA = (values: any) => { dispatch({ type: 'User/SA', playload: values }) };
const nameofowner = formatMessage({ id: 'R.charge.input.nameofowner' })
......@@ -105,25 +106,23 @@ const Users = (props: any) => {
useEffect(() => {
//分页设置
if (location.query.current != null) {
setPageNum(parseInt(location.query.current))
if (location.query.pageNum != null) {
setPageNum(parseInt(location.query.pageNum))
} else {
setPageNum(1)
}
//前置数据
// console.log("前置数据");
// console.log(location)
// var tmp = filterObjbyTg(location.query, ["ownerName"])
// console.log(tmp)
// setReadyData(tmp)
// 前置数据
var tmp = filterObjbyTg(location.query, ["owerName", "pageNum"])
setReadyData(tmp)
// //获取数据
// setLoading(true)
// RA(12, {
// ownerName:location.query.ownerName != undefined ? (location.query.ownerName) : null,
// communityArray:CommunityList
// }, module, dispatch);
//获取数据
setLoading(true)
RA(12, {
owerName: location.query.owerName != undefined ? (location.query.owerName) : null,
communityArray: TestData != null ? TestData : CommunityList,
pageNum,
}, module, dispatch);
}, [location])
......@@ -149,53 +148,28 @@ const Users = (props: any) => {
// LIFE用户管理页面的搜索按钮
const CallBackTitleSearch = (comment: any) => {
console.log("触发了按钮", comment)
//页面搜索
comment.current = 1
setLoading(true)
RA(12, {
ownerName: comment.OwnerName != undefined ? (comment.OwnerName) : null,
communityArray: comment.serviceCommunityList,
pageNum: comment.current
}, module, dispatch)
setTestData(comment.serviceCommunityList)
// history.push(location.pathname + urlEncode(filterObj({ ownerName: comment.OwnerName})))
history.push(location.pathname)
history.push(location.pathname + urlEncode(filterObj({
owerName: comment.OwnerName,
pageNum: 1,
})))
}
const pageChange = (values: any) => {
// var tmp = curString; tmp.defaultCurrent = values.current; setCurString(tmp)
setPageNum(values.current)
/*页面跳转*/
var tmp = filterObjbyTg(location.query, [])
tmp["current"] = values.current
tmp["pageNum"] = values.current
history.push(location.pathname + urlEncode(tmp))
}
function sortByKey(array: []) {
let sortList = []
sortList = array.sort((a, b) => {
var x = a["enable"];//如果要从大到小,把x,y互换就好
var y = b["enable"];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
sortList = sortList.sort((a, b) => {
if (a["enable"] === b["enable"]) {
var x = a["createTime"]["time"];//如果要从大到小,把x,y互换就好
var y = b["createTime"]["time"];
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
}
});
return sortList
}
return (
<div className={styles.base}>
{/* 头部组件 */}
<TitleSearch listkey={["OwnerName"]} list={["Owner Name"]}
community={"serviceCommunityList"} onSubmit={CallBackTitleSearch} />
......@@ -214,9 +188,9 @@ const Users = (props: any) => {
rowKey={"id"}
loading={loading}
style={{ marginTop: 16 }}
dataSource={Data != null ? sortByKey(Data.data.list) : []}
dataSource={Data != null ? Data.data.list : []}
columns={columns}
pagination={Data != null ? { current: pageNum, total: Data.data.page.totalRow, showSizeChanger: false, defaultPageSize: Data.data.page.curPageSize } : {}}
pagination={Data != null ? { current: pageNum, total: Data.data.page.totalRow, showSizeChanger: false, pageSize: Data.data.page.curPageSize } : {}}
onChange={pageChange} />
</div>
......@@ -225,13 +199,12 @@ const Users = (props: any) => {
function mapStateToProps(state: any) {
const { sourceData, DataSave, Data, } = state.User;
const { history_url } = state.History;
const { pageData } = state.PageData;
const { token } = state.login;
const { CommunityList } = state.Init;
console.log("mapStateToProps 执行了")
return {
Data,
DataSave,
......
import React, { useState, useEffect,useRef } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import styles from './Edit.less';
import { Input ,Button,Form,Result,Pagination,Tooltip, Checkbox } from 'antd';
import { Input, Button, Form, Result, Pagination, Tooltip, Checkbox } from 'antd';
import { Link, useIntl, connect } from 'umi';
......@@ -8,32 +8,36 @@ import SelectOptions from '../../../components/SelectOptions/index';
import TitleBack from '../../../components/TitleBack/TitleBack';
import { RA } from '@/utils/method';
const module="User"
const Edit= (props:any) => {
const module = "User"
const Edit = (props: any) => {
const { dispatch,CurData,SaveChooseData,location,CommunityList,DataServices} = props;
const { dispatch, CurData, SaveChooseData, location, CommunityList, DataServices } = props;
const TosTosServiceProviderSave = (values: any) => { dispatch({ type: 'ServiceProvider/TosTosServiceProviderSave', playload: values }) };
const [CList, setCList] = useState(CommunityList);
const [SList,setSList]=useState(["1"])
const printContent = (List: any)=>{setCList(List)}
const [SList, setSList] = useState(["1"])
const printContent = (List: any) => { setCList(List) }
const formRef = useRef(null);
useEffect(() => {
console.log(SaveChooseData)
RA(43,{serviceName:""},module,dispatch)
RA(43, { serviceName: "" }, module, dispatch)
}, []);
useEffect(()=>{
}, []);
useEffect(() => {
if (DataServices != null) {
var tmp=DataServices.data.serviceScopeList
if (SaveChooseData != null) {
formRef.current.setFieldsValue(SaveChooseData)
}
var tmp = DataServices.data.serviceScopeList
if (SaveChooseData != null) {
formRef.current.setFieldsValue(SaveChooseData)
}
},[DataServices])
}
}, [DataServices])
const onFinish = (values: any) => {
console.log(values)
return;
var val = values
val.serviceCommunityList = CList
// val.serviceScopeList = SList
......@@ -42,54 +46,106 @@ const Edit= (props:any) => {
TosTosServiceProviderSave(val)
};
const onFinishFailed = (errorInfo:any) => {console.log('Failed:', errorInfo) };
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo)
};
return (
<div className={styles.base}>
{/* 头部组件v1.2 */}
{/* 头部组件v1.2 */}
<TitleBack title="Edit Service Provider" />
<Form ref={formRef} name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}><Form.Item name="providerName" ><Input style={{width:260}} placeholder="Please enter company name" /></Form.Item></div>
<div className={styles.box1item3}>Office Address</div>
<div className={styles.box1item4}><Form.Item name="providerAddress"><Input style={{width:200}} placeholder="Single Line Input"/></Form.Item></div>
</div>
<div className={styles.line}></div>
<SelectOptions list={CommunityList.sort()} checklist={SaveChooseData!=null?SaveChooseData.serviceCommunityList:null} onSubmit={printContent} />
<div className={styles.box2}>
<div className={styles.box2item1}>Services Available</div>
<div className={styles.box2item2}><Form.Item name="serviceScopeList"><Checkbox.Group options={ DataServices!=null?DataServices.data.serviceScopeList:null} /></Form.Item></div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}><Form.Item name="contactName"><Input style={{width:200}} placeholder="Please enter a name"/></Form.Item></div>
</div>
<div className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}><Form.Item name="contactPhone"><Input style={{width:200}} placeholder="Telephone"/></Form.Item></div>
<div className={styles.box4item3}><Form.Item name="contactEmail"><Input style={{width:200}} placeholder="E-mail"/></Form.Item></div>
</div>
<Form ref={formRef} name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}>
<Form.Item name="providerName"
rules={[{
required: true,
message: "Please enter the company name!"
}]}
>
<Input style={{ width: 260 }} placeholder="Please enter company name" />
</Form.Item>
</div>
<div className={styles.box1item3}>Office Address</div>
<div className={styles.box1item4}>
<Form.Item
name="providerAddress"
rules={[{
required: true,
message: "Please enter your office address!"
}]}
>
<Input style={{ width: 200 }} placeholder="Single Line Input" />
</Form.Item>
</div>
</div>
<div className={styles.line}></div>
<SelectOptions list={CommunityList.sort()} checklist={SaveChooseData != null ? SaveChooseData.serviceCommunityList : null} onSubmit={printContent} />
<div className={styles.box2}>
<div className={styles.box2item1}>Services Available</div>
<div className={styles.box2item2}>
<Form.Item
name="serviceScopeList"
rules={[{
required: true,
message: "Please select at least one service available!"
}]}
>
<Checkbox.Group options={DataServices != null ? DataServices.data.serviceScopeList : null} />
</Form.Item>
</div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}>
<Form.Item
name="contactName"
rules={[{
required: true,
message: "Please enter the name of the person in charge!"
}]}
>
<Input style={{ width: 200 }}
placeholder="Please enter a name"
/>
</Form.Item>
</div>
</div>
<div className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}><Form.Item name="contactPhone"><Input style={{ width: 200 }} placeholder="Telephone" /></Form.Item></div>
<div className={styles.box4item3}>
<Form.Item
name="contactEmail"
rules={[{
required: true,
type: "email",
message: "Please enter the correct email address!"
}]}
>
<Input style={{ width: 200 }} placeholder="E-mail" /></Form.Item></div>
</div>
<div className={styles.line}></div>
<Form.Item>
<Button type="primary" htmlType="submit">Submit</Button>
</Form.Item>
</Form>
</div>
);
};
function mapStateToProps(state:any) {
function mapStateToProps(state: any) {
const { CurData, SaveChooseData } = state.ServiceProvider;
const { DataServices, } = state.User;
const { CommunityList } = state.Init;
......@@ -106,4 +162,3 @@ function mapStateToProps(state:any) {
export default connect(mapStateToProps)(Edit);
\ No newline at end of file
import React, { useState, useEffect,useRef} from 'react';
import React, { useState, useEffect, useRef } from 'react';
import styles from './index.less';
import {Form, Input ,Spin,Table,Space, Button} from 'antd';
import { Form, Input, Spin, Table, Space, Button } from 'antd';
import { LoadingOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch,history } from 'umi';
import { urlEncode, filterObj, filterObjbyTg } from '@/utils/method';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch';
const ServiceProviderManagement = (props: any) => {
const { formatMessage } = useIntl();
const [pageNum, setPageNum] = useState(1)
const [loading, setLoading] = useState(false)
const [testData, setTestData] = useState(null);
const { dispatch, location, Data, CommunityList } = props;
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 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 SaveChooseData = (values: any) => { dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values }) };
const GetList = () => {
if (CommunityList != null) {
TosTosServiceProviderGet({
providerName: "",
serviceCommunityList: CommunityList
})
}
}
useEffect(() => {
GetList()
}, []);
useEffect(() => {
GetList()
}, [CommunityList]);
// const GetList = () => {
// if (CommunityList != null) {
// TosTosServiceProviderGet({
// providerName: "",
// serviceCommunityList: CommunityList
// })
// }
// }
// useEffect(() => {
// console.log(CommunityList)
// GetList()
// }, [CommunityList]);
const goToDetail = (values: any, e: any) => {
SaveChooseData(values)
history.push(location.pathname +'/Detail')
history.push(location.pathname + '/Detail')
}
const goToCreate = () => {
SaveChooseData(null)
......@@ -44,76 +55,112 @@ const ServiceProviderManagement = (props: any) => {
SaveChooseData(values)
history.push(location.pathname + '/Edit')
}
const goToServices = () => {history.push(location.pathname +'/Services')}
const pagination={defaultCurrent:1,total: Data!=null?Data.length:0}
const goToServices = () => { history.push(location.pathname + '/Services') }
const columns = [
{ title: "Service Provider",dataIndex: 'providerName',},
{ title: "contact Name",dataIndex: 'contactName',},
{ title: "Service Provider", dataIndex: 'providerName', },
{ title: "contact Name", dataIndex: 'contactName', },
{ title: "Contacts",dataIndex: 'contactPhone',},
{
title: "Contacts",
dataIndex: 'contactPhone',
},
/*{ title: "Contact Details",dataIndex: 'contactEmail',},*/
{ title: "Services Available",dataIndex: 'serviceScope',},
{ title: "Account Status",dataIndex: 'enable',},
{ title: "Actions",
{
title: "Services Available",
dataIndex: 'serviceScope',
},
{ title: "Account Status", dataIndex: 'enable', },
{
title: "Actions",
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>
),
},
];
const dataSource = (values:any) => {
const dataSource = (values: any) => {
let tmp = values;
for (let items in tmp) {
switch (tmp[items].enable) {
case 0: tmp[items].enable = "unregistered";break;
case 1: tmp[items].enable = "registered";break;
case 2:break;
case 0: tmp[items].enable = "unregistered"; break;
case 1: tmp[items].enable = "registered"; break;
case 2: break;
}
}
for (let items in tmp) {
switch (tmp[items].serviceScope) {
case 0: tmp[items].serviceScope = "清洁";break;
case 1: tmp[items].serviceScope = "维修";break;
case 2:tmp[items].serviceScope = "保安";break;
case 3:tmp[items].serviceScope = "会计";break;
case 0: tmp[items].serviceScope = "清洁"; break;
case 1: tmp[items].serviceScope = "维修"; break;
case 2: tmp[items].serviceScope = "保安"; break;
case 3: tmp[items].serviceScope = "会计"; break;
}
}
// for (let items in tmp) {
// for(let i=0; i<tmp[items].serviceScopeList.length;i++){
// if(tmp[items].serviceScopeList[i] == '0'){
// tmp[items].serviceScopeList[i] = '清洁'
// continue
// }else if(tmp[items].serviceScopeList[i] == '1'){
// tmp[items].serviceScopeList[i] = '维修'
// continue
// }else if(tmp[items].serviceScopeList[i] == '2'){
// tmp[items].serviceScopeList[i] = '保安'
// continue
// }else if(tmp[items].serviceScopeList[i] == '3'){
// tmp[items].serviceScopeList[i] = '会计'
// continue
// }
// }
// }
return tmp;
}
const CallBackTitleSearch = (comment: any)=>{
useEffect(() => {
if (Data != null) {
setLoading(false)
console.log("核查的地方")
console.log(Data)
}
}, [Data])
useEffect(() => {
//分页设置
if (location.query.pageNum != null) {
setPageNum(parseInt(location.query.pageNum))
TosTosServiceProviderGet({
...location.query,
serviceCommunityList: testData != null ? testData : CommunityList,
})
} else {
setPageNum(1)
//获取数据
setLoading(true)
TosTosServiceProviderGet({
...location.query,
serviceCommunityList: testData != null ? testData : CommunityList,
})
}
}, [location])
const CallBackTitleSearch = (comment: any) => {
console.log(comment)
console.log(location.pathname)
//页面搜索
TosTosServiceProviderGet({
// TosTosServiceProviderGet({
// providerName: comment.providerName,
// serviceScope: comment.status,
// serviceCommunityList: comment.serviceCommunityList
// })
setTestData(comment.serviceCommunityList)
history.push(location.pathname + urlEncode(filterObj({
providerName: comment.providerName,
serviceScope:comment.status,
serviceCommunityList: comment.serviceCommunityList
})
// history.push(location.pathname+urlEncode(filterObj({ providerName: comment.providerName})))
serviceScope: comment.status,
pageNum: 1
})))
}
const pageChange = (values: any) => {
// setPageNum(values.current)
console.log(values)
/*页面跳转*/
var tmp = filterObjbyTg(location.query, [])
tmp["pageNum"] = values.current
history.push(location.pathname + urlEncode(tmp))
}
const pagination = {
current: pageNum,
// total: Data.total,
showSizeChanger: false
}
return (
<div className={styles.base}>
......@@ -129,26 +176,30 @@ const ServiceProviderManagement = (props: any) => {
community={"serviceCommunityList"}
onSubmit={CallBackTitleSearch} />
{/* 内容组件 */}
{/* 内容组件 */}
<div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToServices}>Avail Services</button>
<button className={styles.buttonAdd} onClick={goToCreate}>Create New</button>
</div>
{/* 列表组件 */}
<Spin spinning={Data!=null?false:true}>
<Table size="small" rowKey={"id"}
style={{ marginTop: 16 }} columns={columns}
dataSource={Data!=null?dataSource(Data):null}
pagination={pagination} />
<Spin spinning={Data != null ? false : true}>
<Table size="small" rowKey={"id"}
style={{ marginTop: 16 }}
loading={loading}
columns={columns}
dataSource={Data != null ? dataSource(Data) : null}
pagination={Data != null ? pagination : {}}
onChange={pageChange}
/>
</Spin>
</div>
</div>
);
};
function mapStateToProps(state:any) {
function mapStateToProps(state: any) {
const { Data } = state.ServiceProvider;
const { DataProvider } = state.User;
const { CommunityList } = state.Init;
......
import React, { useState, useEffect, useRef } from 'react';
import styles from './Services.less';
import { Form ,Button,Modal,Space,Pagination,Tooltip, Checkbox } from 'antd';
import { Form, Button, Modal, Space, Pagination, Tooltip, Checkbox } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
import {PlusCircleOutlined} from '@ant-design/icons';
import { PlusCircleOutlined } from '@ant-design/icons';
import Line from '../../../components/Line/Line';
import BackButton from '../../../components/BackButton/BackButton';
......@@ -14,61 +14,62 @@ import TagSelect from '../../../components/TagSelect/index';
import { RA } from '@/utils/method';
import TitleBack from '@/components/TitleBack/TitleBack';
const module="User"
const Services = (props:any) => {
const module = "User"
const Services = (props: any) => {
const { dispatch,DataServices} = props
const { dispatch, DataServices } = props
const formRef = useRef(null)
useEffect(()=>{
RA(43,{serviceName:""},module,dispatch)
useEffect(() => {
RA(43, { serviceName: "" }, module, dispatch)
}, [location])
useEffect(()=>{
useEffect(() => {
if (DataServices != null) {
var tmp=DataServices.data.serviceScopeList
var tmp = DataServices.data.serviceScopeList
console.log(tmp)
formRef.current.setFieldsValue({services:tmp })
}
console.log(formRef)
formRef.current.setFieldsValue({ services: tmp })
}
}, [DataServices])
const onFinish = (values:any) => {
const onFinish = (values: any) => {
console.log(values)
RA(44, {
id:"5",
serviceName:"律政"
},module,dispatch)
id: "5",
serviceName: "律政"
}, module, dispatch)
}
const Add = (values:any) => {
const Add = (values: any) => {
console.log(values)
}
const Remove = (values: any) => {
}
return (
<div className={styles.base}>
<TitleBack title={"Services Available Management"}></TitleBack>
<TitleBack title={"Services Available Management"}></TitleBack>
<Form ref={formRef} name="basic" onFinish={onFinish}>
{DataServices != null?
<Form.Item label="Available Services" name="services"><TagSelect onAdd={Add} onRemove={Remove}/></Form.Item>
:null
{DataServices != null ?
<Form.Item label="Available Services" name="services"><TagSelect onAdd={Add} onRemove={Remove} /></Form.Item>
: null
}
<Line />
{/* <Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item> */}
</Form>
</div>
);
};
function mapStateToProps(state:any) {
const{DataServices} = state.User
function mapStateToProps(state: any) {
const { DataServices } = state.User
return {
DataServices
}
}
}
export default connect(mapStateToProps)(Services)
......
......@@ -48,6 +48,8 @@ export function TosAccountPermissionCheckPermission(values: any) {
// 服务商
export function TosTosServiceProviderGet(values: any) {
console.log(values);
// return
return request('/tos/tosServiceProvider/get', {
method: 'POST',
body: JSON.stringify(values),
......
......@@ -5,12 +5,14 @@ export async function query(): Promise<any> {
}
export async function queryCurrent(values: any): Promise<any> {
console.log(values)
return request('/tos/user/newCurrentUser',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}});
console.log('登录数据=================', values);
return request('/tos/user/newCurrentUser', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
}
export async function queryNotices(): Promise<any> {
return request('/api/notices');
}
......@@ -197,15 +197,3 @@ export const timeForm = (values: any, format: any) => {
});
return result[0] + '-' + result[1];
};
// 根据时间排序
// array 需要排序的数组
// key 字段名
export const timeSort = (array: [], key: string) => {
return array.sort((a, b) => {
let x = a['key'];
let y = b['key'];
return x < y ? -1 : x > y ? 1 : 0;
});
};
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