fix(amap):core
This commit is contained in:
parent
e96a1efe47
commit
08c8a91182
|
@ -1,13 +1,21 @@
|
|||
import { Button, Space, Modal, FormInstance, Form, Select } from "antd";
|
||||
import {
|
||||
Button,
|
||||
Space,
|
||||
Modal,
|
||||
FormInstance,
|
||||
Form,
|
||||
Select,
|
||||
GetProps,
|
||||
Tree,
|
||||
} from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import BTable from "@/components/b_table";
|
||||
import { useEffect, useState } from "react";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import React from "react";
|
||||
import { FormType } from "@/components/form/interface";
|
||||
import DirectoryTree from "antd/lib/tree/DirectoryTree";
|
||||
import { DataNode } from "antd/lib/tree";
|
||||
const { Option } = Select;
|
||||
const Dep = (props: Store) => {
|
||||
const { depStore } = props;
|
||||
|
@ -15,40 +23,9 @@ const Dep = (props: Store) => {
|
|||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const [org, setOrg] = useState<any>(null);
|
||||
const [tagId, setId] = useState<Number | null>(null);
|
||||
const columns: ColumnsType<UserDataType> = [
|
||||
{ title: "部门名称", dataIndex: "dep_name" },
|
||||
{ title: "部门描述", dataIndex: "remark" },
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "id",
|
||||
render: (any, record) => (
|
||||
<div>
|
||||
<Space wrap>
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
edit(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
depStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const edit = (record) => {
|
||||
let data = {
|
||||
...record,
|
||||
|
@ -66,11 +43,21 @@ const Dep = (props: Store) => {
|
|||
} else {
|
||||
depStore.putItem(tagId, values);
|
||||
}
|
||||
getOrg();
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
depStore.getlist();
|
||||
getOrg();
|
||||
}, [depStore]);
|
||||
|
||||
const getOrg = () => {
|
||||
depStore.getOrg().then((v) => {
|
||||
let morg = v.data.record;
|
||||
setOrg(morg);
|
||||
});
|
||||
};
|
||||
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
|
@ -105,6 +92,16 @@ const Dep = (props: Store) => {
|
|||
},
|
||||
];
|
||||
const onFinishFailed = () => {};
|
||||
type DirectoryTreeProps = GetProps<typeof Tree.DirectoryTree>;
|
||||
|
||||
const onSelect: DirectoryTreeProps["onSelect"] = (keys, info) => {
|
||||
console.log("Trigger Select", keys, info);
|
||||
};
|
||||
|
||||
const onExpand: DirectoryTreeProps["onExpand"] = (keys, info) => {
|
||||
console.log("Trigger Expand", keys, info);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||
|
@ -121,7 +118,17 @@ const Dep = (props: Store) => {
|
|||
</Button>
|
||||
</Space>
|
||||
|
||||
<BTable store={depStore} columns={columns} dataSource={depStore.list} />
|
||||
{/* <BTable store={depStore} columns={columns} dataSource={depStore.list} /> */}
|
||||
<DirectoryTree
|
||||
multiple
|
||||
defaultExpandAll
|
||||
onSelect={onSelect}
|
||||
onExpand={onExpand}
|
||||
treeData={org}
|
||||
titleRender={(nodeData: DataNode) => {
|
||||
return <>{nodeData.title}<span style={{marginLeft:"10px",color:"blue"}} onClick={edit}>编辑</span></>
|
||||
}}
|
||||
/>
|
||||
<Modal
|
||||
title={!tagId ? "添加部门" : "编辑部门"}
|
||||
width={800}
|
||||
|
|
|
@ -162,7 +162,6 @@ const User = (props: Store) => {
|
|||
key="dep_identity"
|
||||
label="部门选择"
|
||||
name="dep_identity"
|
||||
rules={[{ required: true, message: "请选择部门!" }]}
|
||||
>
|
||||
<Select placeholder="">
|
||||
{depList?.map((v: any) => {
|
||||
|
|
|
@ -29,6 +29,57 @@ export const defaultConfig =(team,per)=>
|
|||
value: 0,
|
||||
rules: [{ required: true, message: "请选择性别" }],
|
||||
},
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "是否网格员",
|
||||
name: "grid_user",
|
||||
radioData: [
|
||||
{
|
||||
key: "是",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "否",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "请选择是否网格员" }],
|
||||
},
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "是否为巡防大队",
|
||||
name: "patrol_user",
|
||||
radioData: [
|
||||
{
|
||||
key: "是",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "否",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "请选择是否为巡防大队" }],
|
||||
},
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "是否民兵",
|
||||
name: "militia",
|
||||
radioData: [
|
||||
{
|
||||
key: "是",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "否",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
value: 0,
|
||||
rules: [{ required: true, message: "请选择是否民兵" }],
|
||||
},
|
||||
{
|
||||
type: FormType.inputNumber,
|
||||
label: "年龄",
|
||||
|
@ -41,7 +92,6 @@ export const defaultConfig =(team,per)=>
|
|||
label: "身份证",
|
||||
name: "id_card",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入身份证" }],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
|
@ -56,7 +106,6 @@ export const defaultConfig =(team,per)=>
|
|||
label: "家庭住址",
|
||||
name: "home_addr",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入家庭住址" }],
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -64,38 +113,20 @@ export const defaultConfig =(team,per)=>
|
|||
label: "担任职务",
|
||||
name: "pos_held",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入担任职务" }],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "通讯地址",
|
||||
name: "mail_addr",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入通讯地址" }],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "贯籍",
|
||||
name: "porig",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入贯籍" }],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "联系电话",
|
||||
name: "tel",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入联系电话" }],
|
||||
},
|
||||
{
|
||||
type: FormType.input,
|
||||
label: "民族",
|
||||
name: "eth",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入民族" }],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.cehckboxGroup,
|
||||
label: "所属队伍",
|
||||
|
@ -129,41 +160,7 @@ export const defaultConfig =(team,per)=>
|
|||
],
|
||||
rules: [{ required: true, message: "是否党员不能为空" }],
|
||||
},
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "单位类型",
|
||||
name: "o_type",
|
||||
value: 0,
|
||||
radioData: [
|
||||
{
|
||||
key: "机关单位",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "企事业单位",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
rules: [{ required: true, message: "单位类型不能为空" }],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "民兵类型",
|
||||
name: "militia_type",
|
||||
value: 0,
|
||||
radioData: [
|
||||
{
|
||||
key: "基干民兵",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "普通民兵",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
rules: [{ required: true, message: "民兵类型不能为空" }],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "是否退役军人",
|
||||
|
@ -213,72 +210,6 @@ export const defaultConfig =(team,per)=>
|
|||
name: "email",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "积极力量",
|
||||
name: "a_member",
|
||||
value: 1,
|
||||
radioData: [
|
||||
{
|
||||
key: "是",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "否",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "专业队伍",
|
||||
name: "p_team",
|
||||
value: 1,
|
||||
radioData: [
|
||||
{
|
||||
key: "是",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "否",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "是否为社干力量",
|
||||
name: "c_member",
|
||||
value: 2,
|
||||
radioData: [
|
||||
{
|
||||
key: "是",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "否",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: FormType.radio,
|
||||
label: "三方力量",
|
||||
name: "o_member",
|
||||
value: 2,
|
||||
radioData: [
|
||||
{
|
||||
key: "是",
|
||||
val: 1,
|
||||
},
|
||||
{
|
||||
key: "否",
|
||||
val: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
type: FormType.textarea,
|
||||
label: "描述",
|
||||
|
|
Loading…
Reference in New Issue