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