12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { Select } from "antd";
- import { connect } from "dva/index";
- import { Component } from "react";
- import { businessStateEnum } from "@/utils/utils";
- import styles from "./index.less";
- @connect(({ store }) => ({
- store,
- }))
- export default class BusinessStateSelector extends Component {
- constructor(props) {
- super(props);
- this.state = {
- stateList: Object.keys(businessStateEnum).map((key) => ({
- name: businessStateEnum[key],
- value: key,
- })),
- currentBusinessState: "",
- };
- }
- handleChange = (value) => {
- this.setState({ currentBusinessState: value });
- };
- componentDidMount() {
- // dispatch({
- // type: "store/get_business_state",
- // callback: (res) => {},
- // });
- }
- render() {
- const { stateList, currentBusinessState } = this.state;
- return stateList.length ? (
- <div className={`${styles.state_warp}`}>
- <span className={`${styles.label}`}>经营状态</span>
- <Select
- value={currentBusinessState}
- style={{ width: 150 }}
- onChange={this.handleChange}
- >
- {stateList.map((state) => (
- <Select.Option key={state.name} value={state.value}>
- {state.name}
- </Select.Option>
- ))}
- </Select>
- </div>
- ) : null;
- }
- }
|