Commit 105d2bdf authored by Sixiang_Zzb's avatar Sixiang_Zzb

用户管理和服务商管理 缓存优化处理

parent 4db99419
...@@ -14,30 +14,25 @@ import { gray } from 'chalk'; ...@@ -14,30 +14,25 @@ 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) const {
dispatch,
const { dispatch, CommunityList } = props; CommunityList,
single,
checklist,
status,
communitySelect,
defaultValue,
time,
username,
} = props;
const key = props.listkey; const key = props.listkey;
console.log(props);
const name = props.list; const name = props.list;
// const single = props.single
// const checklist = props.checklist;
// const status = props.status;
// const communitySelect = props.communitySelect
// const defaultValue = props.defaultValue;
// const time = props.time;
// username 为 小区列表管理者名字筛选
const { single, checklist, status, communitySelect, defaultValue, time, username } = props;
const community = props.community; const community = props.community;
const [selectOptions, setSelectOptions] = useState(true); const [selectOptions, setSelectOptions] = useState(true);
const [communitys, setCommunitys] = useState(CommunityList); const [communitys, setCommunitys] = useState(CommunityList);
const [communitySingle, setCommunitySingle] = useState(null); const [datePicker, setDate] = useState(null as any);
const [datePicker, setDate] = useState(null);
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -197,23 +192,9 @@ const TitleSearch = (props: any) => { ...@@ -197,23 +192,9 @@ const TitleSearch = (props: any) => {
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
// console.log("state参数",state)
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
CommunityList, CommunityList,
}; };
} }
export default connect(mapStateToProps)(TitleSearch); export default connect(mapStateToProps)(TitleSearch);
// time={["key","预订时间筛选"]}
// status = [{name:"status",data:["处理", "未处理"]}]
// listkey={['A', 'C']} list={['订单状态', '预订时间筛选']}
// <TitleSearch
// status={[{
// name: ["status", "订单状态"],
// data: [[0, "全部"], [1, "已申请"], [2, "已预订"], [3, "已使用"], [4, "已取消"]]
// }]}
// time={["key", "预订时间筛选"]}
// community={"communityName"}
// // single={true}
// onSubmit={CallBackTitleSearch} />
...@@ -8,68 +8,72 @@ import SelectOptions from '../../../components/SelectOptions/index'; ...@@ -8,68 +8,72 @@ 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';
let options: Array<{}> = [];
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 [load, setload] = useState(false) const [load, setload] = useState(false);
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, {}, module, dispatch);
}, []); }, []);
useEffect(() => { useEffect(() => {
if (DataServices != null) { if (DataServices != null) {
var tmp = DataServices.data.serviceScopeList;
console.log(DataServices) options = tmp.map((v: string, i: number) => {
var tmp = DataServices.data.serviceScopeList return {
label: v,
console.log(tmp) value: i.toString(),
};
});
if (SaveChooseData != null) { if (SaveChooseData != null) {
formRef.current.setFieldsValue(SaveChooseData) formRef.current.setFieldsValue(SaveChooseData);
} }
} }
}, [DataServices]) }, [DataServices]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
var val = values var val = values;
val.serviceCommunityList = CList val.serviceCommunityList = CList;
// val.serviceScopeList = SList // val.serviceScopeList = SList
val.creator = "admin"; val.creator = 'admin';
val.updater = "admin"; val.updater = 'admin';
setload(true) setload(true);
TosTosServiceProviderSave(val) TosTosServiceProviderSave(val);
};
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" onFinish={onFinish} onFinishFailed={onFinishFailed}> <Form ref={formRef} name="basic" onFinish={onFinish}>
<Spin spinning={load} tip="In the submission,Please Wait..."> <Spin spinning={load} tip="In the submission,Please Wait...">
<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}> <div className={styles.box1item2}>
<Form.Item name="providerName" <Form.Item
rules={[{ name="providerName"
required: true, rules={[
message: "Please enter the company name!" {
}]} required: true,
message: 'Please enter the company name!',
},
]}
> >
<Input style={{ width: 260 }} placeholder="Please enter company name" /> <Input style={{ width: 260 }} placeholder="Please enter company name" />
</Form.Item> </Form.Item>
...@@ -78,10 +82,12 @@ const Edit = (props: any) => { ...@@ -78,10 +82,12 @@ const Edit = (props: any) => {
<div className={styles.box1item4}> <div className={styles.box1item4}>
<Form.Item <Form.Item
name="providerAddress" name="providerAddress"
rules={[{ rules={[
required: true, {
message: "Please enter your office address!" required: true,
}]} message: 'Please enter your office address!',
},
]}
> >
<Input style={{ width: 200 }} placeholder="Single Line Input" /> <Input style={{ width: 200 }} placeholder="Single Line Input" />
</Form.Item> </Form.Item>
...@@ -90,19 +96,25 @@ const Edit = (props: any) => { ...@@ -90,19 +96,25 @@ const Edit = (props: any) => {
<div className={styles.line}></div> <div className={styles.line}></div>
<SelectOptions list={CommunityList.sort()} checklist={SaveChooseData != null ? SaveChooseData.serviceCommunityList : null} onSubmit={printContent} /> <SelectOptions
list={CommunityList ? CommunityList.sort() : []}
checklist={SaveChooseData != null ? SaveChooseData.serviceCommunityList : null}
onSubmit={printContent}
/>
<div className={styles.box2}> <div className={styles.box2}>
<div className={styles.box2item1}>Services Available</div> <div className={styles.box2item1}>Services Available</div>
<div className={styles.box2item2}> <div className={styles.box2item2}>
<Form.Item <Form.Item
name="serviceScopeList" name="serviceScopeList"
rules={[{ rules={[
required: true, {
message: "Please select at least one service available!" required: true,
}]} message: 'Please select at least one service available!',
},
]}
> >
<Checkbox.Group options={DataServices != null ? DataServices.data.serviceScopeList : null} /> <Checkbox.Group options={options} />
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
...@@ -112,59 +124,63 @@ const Edit = (props: any) => { ...@@ -112,59 +124,63 @@ const Edit = (props: any) => {
<div className={styles.box3item2}> <div className={styles.box3item2}>
<Form.Item <Form.Item
name="contactName" name="contactName"
rules={[{ rules={[
required: true, {
message: "Please enter the name of the person in charge!" required: true,
}]} message: 'Please enter the name of the person in charge!',
},
]}
> >
<Input style={{ width: 200 }} <Input style={{ width: 200 }} placeholder="Please enter a name" />
placeholder="Please enter a name"
/>
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
<div className={styles.box4}> <div className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div> <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.box4item2}>
<Form.Item name="contactPhone">
<Input style={{ width: 200 }} placeholder="Telephone" />
</Form.Item>
</div>
<div className={styles.box4item3}> <div className={styles.box4item3}>
<Form.Item <Form.Item
name="contactEmail" name="contactEmail"
rules={[{ rules={[
required: true, {
type: "email", required: true,
message: "Please enter the correct email address!" type: 'email',
}]} message: 'Please enter the correct email address!',
},
]}
> >
<Input style={{ width: 200 }} placeholder="E-mail" /></Form.Item></div> <Input style={{ width: 200 }} placeholder="E-mail" />
</Form.Item>
</div>
</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>
</Spin> </Spin>
</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;
return { return {
CurData, CurData,
SaveChooseData, SaveChooseData,
CommunityList, CommunityList,
DataServices DataServices,
}; };
} }
export default connect(mapStateToProps)(Edit); export default connect(mapStateToProps)(Edit);
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