fix(en)
This commit is contained in:
parent
dba87a4e99
commit
9f39ef3e21
|
@ -23,6 +23,7 @@ const BTable = (props: any) => {
|
|||
onPageChange,
|
||||
config,
|
||||
btnText,
|
||||
children
|
||||
} = props;
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
|
@ -157,7 +158,9 @@ const BTable = (props: any) => {
|
|||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formDatas={config}
|
||||
></SimpleForm>
|
||||
>
|
||||
{children ?? null}
|
||||
</SimpleForm>
|
||||
</Modal>
|
||||
</Space>
|
||||
);
|
||||
|
|
|
@ -1,34 +1,27 @@
|
|||
import { useState } from "react";
|
||||
import DebounceSelect from "./featch_select";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/es/form/interface";
|
||||
import { base } from "@/service/base";
|
||||
import SourceConfig from "@/service/source_config";
|
||||
interface UserValue {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
const Dumbselect = (props: Store) => {
|
||||
const { usrStore } = props;
|
||||
const [value, setValue] = useState<UserValue[]>([]);
|
||||
const Dumbselect = (props) => {
|
||||
async function fetchUserList(username: string): Promise<UserValue[]> {
|
||||
return usrStore.serchUser(username).then((res) => {
|
||||
return base.get(SourceConfig.Searchs + "/?name=" + username, {}).then((res) => {
|
||||
return res.data.record.map((item) => ({
|
||||
label: item.user_name,
|
||||
value: item.identity,
|
||||
label: item.content,
|
||||
value: item.id_card,
|
||||
}));
|
||||
});
|
||||
}
|
||||
return (
|
||||
<DebounceSelect
|
||||
{...props}
|
||||
mode="multiple"
|
||||
value={value}
|
||||
placeholder="Select users"
|
||||
fetchOptions={fetchUserList}
|
||||
onChange={(newValue) => {
|
||||
setValue(newValue as UserValue[]);
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("usrStore")(observer(Dumbselect));
|
||||
export default Dumbselect;
|
||||
|
|
|
@ -46,12 +46,10 @@ const DebounceSelect = <
|
|||
|
||||
return (
|
||||
<Select
|
||||
labelInValue
|
||||
filterOption={false}
|
||||
onSearch={debounceFetcher}
|
||||
notFoundContent={fetching ? <Spin size="small" /> : null}
|
||||
{...props}
|
||||
|
||||
options={options}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Button, Checkbox, DatePicker, Form, Input, InputNumber, Radio, Space } from "antd";
|
||||
import { Checkbox, DatePicker, Form, Input, InputNumber, Radio } from "antd";
|
||||
import { useEffect } from "react";
|
||||
import { FormType, SimpleFormData } from "./interface";
|
||||
import { FormSelect } from "./select";
|
||||
|
@ -7,7 +7,8 @@ import MyEditor from "../edittor";
|
|||
import MapFrom from "../map/MapFrom";
|
||||
import { FormTreeSelect } from "./tree_select";
|
||||
import { FormCheckBox } from "./checkbox";
|
||||
import { MinusCircleOutlined } from '@ant-design/icons';
|
||||
import DumpSeleft from "./dump_seleft";
|
||||
|
||||
|
||||
// import VideoSelect from "../video_select";
|
||||
const { TextArea } = Input;
|
||||
|
@ -34,7 +35,6 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
initialValues={{ menubar: true }}
|
||||
onFinish={onFinish}
|
||||
>
|
||||
{props.childrenPosi ? null : props.children ?? props.children}
|
||||
{props.formDatas.map((v) => {
|
||||
switch (v.type) {
|
||||
case FormType.input:
|
||||
|
@ -192,36 +192,18 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
</Form.Item>
|
||||
);
|
||||
case FormType.formList:
|
||||
return <Form.List name="users">
|
||||
{(fields, { add, remove }) => (
|
||||
<>
|
||||
{fields.map(({ key, name, ...restField }) => (
|
||||
<Space key={key} style={{ display: 'flex', marginBottom: 8 }} align="baseline">
|
||||
return props.children
|
||||
case FormType.fetchList:
|
||||
return (
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, 'first']}
|
||||
rules={[{ required: true, message: 'Missing first name' }]}
|
||||
key={v.label}
|
||||
label={v.label}
|
||||
name={v.name}
|
||||
rules={v.rules}
|
||||
>
|
||||
<Input placeholder="First Name" />
|
||||
<DumpSeleft {...v} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, 'last']}
|
||||
rules={[{ required: true, message: 'Missing last name' }]}
|
||||
>
|
||||
<Input placeholder="Last Name" />
|
||||
</Form.Item>
|
||||
<MinusCircleOutlined onClick={() => remove(name)} />
|
||||
</Space>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button type="dashed" onClick={() => add()} block >
|
||||
Add field
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
</Form.List>
|
||||
)
|
||||
default:
|
||||
return (
|
||||
<Form.Item
|
||||
|
@ -235,7 +217,7 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
);
|
||||
}
|
||||
})}
|
||||
{props.childrenPosi ? props.children ?? props.children : null}
|
||||
{/* {props.childrenPosi ? props.children ?? props.children : null} */}
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { FormType } from "@/components/form/interface";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import SourceConfig from "@/service/source_config";
|
||||
import { ColumnsType } from "antd/es/table";
|
||||
|
||||
export const defaultConfig = [
|
||||
|
@ -73,13 +74,14 @@ export const defaultConfig = [
|
|||
value: "",
|
||||
rules: [{ required: true, message: "请输入负责人身份证!" }],
|
||||
},
|
||||
// {
|
||||
// type: FormType.select,
|
||||
// label: "参与人员选择",
|
||||
// name: "users",
|
||||
// value: "",
|
||||
// rules: [{ required: false, message: "请选择参与人员!" }],
|
||||
// },
|
||||
{
|
||||
type: FormType.fetchList,
|
||||
label: "参与人员选择",
|
||||
name: "part_idCard",
|
||||
value: [],
|
||||
selectUrl: SourceConfig.Searchs,
|
||||
rules: [{ required: false, message: "请选择参与人员!" }],
|
||||
},
|
||||
{
|
||||
type: FormType.select,
|
||||
label: "事件等级",
|
||||
|
@ -115,7 +117,6 @@ export const columns: ColumnsType<UserDataType> = [
|
|||
dataIndex: "name",
|
||||
fixed: "left",
|
||||
},
|
||||
|
||||
{
|
||||
title: "事件描述",
|
||||
dataIndex: "desc",
|
||||
|
|
|
@ -18,7 +18,8 @@ const Event = (props: Store) => {
|
|||
columns={columns}
|
||||
dataSource={thingStore.list ?? []}
|
||||
config={defaultConfig}
|
||||
/>
|
||||
>
|
||||
</BTable>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ class SourceConfig {
|
|||
static DELETE: string = "/desc";
|
||||
static Headers: string = "/desc/header";
|
||||
static Content: string = "/desc/content";
|
||||
static Searchs: string = "/desc/content/idcard";
|
||||
}
|
||||
|
||||
export default SourceConfig;
|
|
@ -44,6 +44,7 @@ class EventConfig {
|
|||
static EDIT: string = "/thing";
|
||||
static LIST: string = "/thing/list";
|
||||
static DELETE: string = "/thing";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue