Commit 105d2bdf authored by Sixiang_Zzb's avatar Sixiang_Zzb

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

parent 4db99419
......@@ -14,30 +14,25 @@ import { gray } from 'chalk';
import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity';
const TitleSearch = (props: any) => {
// console.log("===================================", props)
const { dispatch, CommunityList } = props;
const {
dispatch,
CommunityList,
single,
checklist,
status,
communitySelect,
defaultValue,
time,
username,
} = props;
const key = props.listkey;
console.log(props);
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 [selectOptions, setSelectOptions] = useState(true);
const [communitys, setCommunitys] = useState(CommunityList);
const [communitySingle, setCommunitySingle] = useState(null);
const [datePicker, setDate] = useState(null);
const [datePicker, setDate] = useState(null as any);
const [form] = Form.useForm();
......@@ -197,23 +192,9 @@ const TitleSearch = (props: any) => {
);
};
function mapStateToProps(state: any) {
// console.log("state参数",state)
const { CommunityList } = state.Init;
return {
CommunityList,
};
}
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';
import TitleBack from '../../../components/TitleBack/TitleBack';
import { RA } from '@/utils/method';
const module = "User"
const module = 'User';
let options: Array<{}> = [];
const Edit = (props: any) => {
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 [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);
useEffect(() => {
console.log(SaveChooseData)
RA(43, { serviceName: "" }, module, dispatch)
console.log(SaveChooseData);
RA(43, {}, module, dispatch);
}, []);
useEffect(() => {
if (DataServices != null) {
console.log(DataServices)
var tmp = DataServices.data.serviceScopeList
console.log(tmp)
var tmp = DataServices.data.serviceScopeList;
options = tmp.map((v: string, i: number) => {
return {
label: v,
value: i.toString(),
};
});
if (SaveChooseData != null) {
formRef.current.setFieldsValue(SaveChooseData)
formRef.current.setFieldsValue(SaveChooseData);
}
}
}, [DataServices])
}, [DataServices]);
const onFinish = (values: any) => {
var val = values
val.serviceCommunityList = CList
var val = values;
val.serviceCommunityList = CList;
// val.serviceScopeList = SList
val.creator = "admin";
val.updater = "admin";
setload(true)
TosTosServiceProviderSave(val)
};
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo)
val.creator = 'admin';
val.updater = 'admin';
setload(true);
TosTosServiceProviderSave(val);
};
return (
<div className={styles.base}>
{/* 头部组件v1.2 */}
<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...">
<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!"
}]}
<Form.Item
name="providerName"
rules={[
{
required: true,
message: 'Please enter the company name!',
},
]}
>
<Input style={{ width: 260 }} placeholder="Please enter company name" />
</Form.Item>
......@@ -78,10 +82,12 @@ const Edit = (props: any) => {
<div className={styles.box1item4}>
<Form.Item
name="providerAddress"
rules={[{
required: true,
message: "Please enter your office address!"
}]}
rules={[
{
required: true,
message: 'Please enter your office address!',
},
]}
>
<Input style={{ width: 200 }} placeholder="Single Line Input" />
</Form.Item>
......@@ -90,19 +96,25 @@ const Edit = (props: any) => {
<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.box2item1}>Services Available</div>
<div className={styles.box2item2}>
<Form.Item
name="serviceScopeList"
rules={[{
required: true,
message: "Please select at least one service available!"
}]}
rules={[
{
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>
</div>
</div>
......@@ -112,59 +124,63 @@ const Edit = (props: any) => {
<div className={styles.box3item2}>
<Form.Item
name="contactName"
rules={[{
required: true,
message: "Please enter the name of the person in charge!"
}]}
rules={[
{
required: true,
message: 'Please enter the name of the person in charge!',
},
]}
>
<Input style={{ width: 200 }}
placeholder="Please enter a name"
/>
<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.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!"
}]}
rules={[
{
required: true,
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 className={styles.line}></div>
<Form.Item>
<Button type="primary" htmlType="submit">Submit</Button>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Spin>
</Form>
</div>
);
};
function mapStateToProps(state: any) {
const { CurData, SaveChooseData } = state.ServiceProvider;
const { DataServices, } = state.User;
const { DataServices } = state.User;
const { CommunityList } = state.Init;
return {
CurData,
SaveChooseData,
CommunityList,
DataServices
DataServices,
};
}
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