Commit e8a38aa7 authored by Sixiang_Zzb's avatar Sixiang_Zzb

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

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