fix(lauange)
This commit is contained in:
parent
9e51070215
commit
e1ec20882e
|
@ -139,7 +139,6 @@ const BTable = (props: any) => {
|
|||
formRef={formRef}
|
||||
colProps={25}
|
||||
onFinish={() => {
|
||||
console.log(record)
|
||||
if (!record) {
|
||||
store.add(formRef.current?.getFieldsValue()).then((res) => {
|
||||
if (res) {
|
||||
|
|
|
@ -15,7 +15,8 @@ export enum FormType {
|
|||
password = "password",
|
||||
treeVideo = "treeVideo",
|
||||
fetchList = "fetchList",
|
||||
treeSelect = "treeSelect"
|
||||
treeSelect = "treeSelect",
|
||||
formList = "formList"
|
||||
}
|
||||
|
||||
export interface FormDatas {
|
||||
|
|
|
@ -21,7 +21,7 @@ export const FormSelect = (v: FormDatas) => {
|
|||
name={v.name}
|
||||
rules={v.rules}
|
||||
>
|
||||
<Select placeholder="">
|
||||
<Select placeholder="" mode="multiple">
|
||||
{list?.map((item: any, index) => {
|
||||
return <Option key={index} value={item.identity}>
|
||||
{item[v.keys ?? "name"]}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Checkbox, DatePicker, Form, Input, InputNumber, Radio } from "antd";
|
||||
import { Button, Checkbox, DatePicker, Form, Input, InputNumber, Radio, Space } from "antd";
|
||||
import { useEffect } from "react";
|
||||
import { FormType, SimpleFormData } from "./interface";
|
||||
import { FormSelect } from "./select";
|
||||
|
@ -7,6 +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 VideoSelect from "../video_select";
|
||||
const { TextArea } = Input;
|
||||
const SimpleForm = (props: SimpleFormData) => {
|
||||
|
@ -88,7 +90,6 @@ const SimpleForm = (props: SimpleFormData) => {
|
|||
/>
|
||||
</Form.Item>
|
||||
);
|
||||
|
||||
case FormType.select:
|
||||
return <FormSelect {...v} />
|
||||
case FormType.upload:
|
||||
|
@ -190,6 +191,37 @@ 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">
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, 'first']}
|
||||
rules={[{ required: true, message: 'Missing first name' }]}
|
||||
>
|
||||
<Input placeholder="First Name" />
|
||||
</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
|
||||
|
|
|
@ -73,6 +73,13 @@ export const defaultConfig = [
|
|||
value: "",
|
||||
rules: [{ required: true, message: "请输入负责人身份证!" }],
|
||||
},
|
||||
// {
|
||||
// type: FormType.select,
|
||||
// label: "参与人员选择",
|
||||
// name: "users",
|
||||
// value: "",
|
||||
// rules: [{ required: false, message: "请选择参与人员!" }],
|
||||
// },
|
||||
{
|
||||
type: FormType.select,
|
||||
label: "事件等级",
|
||||
|
@ -92,7 +99,6 @@ export const defaultConfig = [
|
|||
],
|
||||
rules: [{ required: true, message: "请输入事件等级!" }],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.upload,
|
||||
label: "现场拍摄",
|
||||
|
|
|
@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
|||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Drawer,
|
||||
Form,
|
||||
Input,
|
||||
message,
|
||||
|
@ -22,15 +23,14 @@ const Source = (props: Store) => {
|
|||
const [form] = Form.useForm();
|
||||
const [coloums, setColumns] = useState<any>([]);
|
||||
const [content, setContent] = useState([]);
|
||||
const [selectKey, setSelectKey] = useState<Array<string>>([
|
||||
"01JXVJXFDM39TN9FYCM33TQ0X0", "01JXVJXFDM39TN9FYCM3A0NFVP", "01JXVJXFDM39TN9FYCM4QK3RK5", "01JXVJXFDM39TN9FYCM8J27EYY", "01JXVJXFDM39TN9FYCMAHHNPQ7"
|
||||
]);
|
||||
const [selectKey, setSelectKey] = useState<Array<string>>([]);
|
||||
const [page, setPage] = useState<number>(1);
|
||||
const [editingKey, setEditingKey] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||
const [rowKeys, setRowKeys] = useState<any[]>([]);
|
||||
const isEditing = (record) => record.key === editingKey;
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const edit = (record: any) => {
|
||||
form.setFieldsValue({ ...record });
|
||||
setEditingKey(record.key);
|
||||
|
@ -71,7 +71,6 @@ const Source = (props: Store) => {
|
|||
};
|
||||
const getContent = (list, index) => {
|
||||
setLoading(true);
|
||||
console.log(index)
|
||||
sourceStore.geContent(list, index, 20).then((res) => {
|
||||
res.forEach((element) => {
|
||||
element.key = element.identity;
|
||||
|
@ -139,6 +138,9 @@ const Source = (props: Store) => {
|
|||
>
|
||||
编辑
|
||||
</Typography.Link>
|
||||
<Typography.Link onClick={() => setOpen(true)}>
|
||||
查看事件
|
||||
</Typography.Link>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
|
@ -233,6 +235,19 @@ const Source = (props: Store) => {
|
|||
/>
|
||||
</Form>
|
||||
</Space>
|
||||
|
||||
<Drawer
|
||||
closable
|
||||
title="事件详情"
|
||||
placement="right"
|
||||
open={open}
|
||||
loading={loading}
|
||||
onClose={() => setOpen(false)}
|
||||
>
|
||||
<p>Some contents...</p>
|
||||
<p>Some contents...</p>
|
||||
<p>Some contents...</p>
|
||||
</Drawer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue