fix(api):update store
This commit is contained in:
parent
53bb00191f
commit
602e2e4ab9
|
@ -44,7 +44,11 @@ const AliUpload = (props: UploadFileProps) => {
|
||||||
}, [props.imgList]);
|
}, [props.imgList]);
|
||||||
|
|
||||||
const handleChange: UploadProps["onChange"] = ({ fileList: newFileList }) => {
|
const handleChange: UploadProps["onChange"] = ({ fileList: newFileList }) => {
|
||||||
console.log(newFileList);
|
newFileList.forEach((i)=>{
|
||||||
|
i.url = "http://127.0.0.1:12214/uploads/"+i.name
|
||||||
|
})
|
||||||
|
setFileList(newFileList);
|
||||||
|
props.onChnage(newFileList)
|
||||||
};
|
};
|
||||||
const uploadButton = (
|
const uploadButton = (
|
||||||
<div>
|
<div>
|
||||||
|
@ -60,6 +64,7 @@ const AliUpload = (props: UploadFileProps) => {
|
||||||
fileList={files}
|
fileList={files}
|
||||||
action={"http://127.0.0.1:12214/v1/public/fts/upload"}
|
action={"http://127.0.0.1:12214/v1/public/fts/upload"}
|
||||||
onPreview={handlePreview}
|
onPreview={handlePreview}
|
||||||
|
maxCount={1}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
>
|
>
|
||||||
{files.length >= 4 ? null : uploadButton}
|
{files.length >= 4 ? null : uploadButton}
|
||||||
|
|
|
@ -63,11 +63,12 @@ const Dep = (props: Store) => {
|
||||||
setId(record.id);
|
setId(record.id);
|
||||||
};
|
};
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
console.log(values);
|
let data = values
|
||||||
|
data.head_img = values.head_img[0].url
|
||||||
if (!tagId) {
|
if (!tagId) {
|
||||||
depStore.add(values);
|
depStore.add(data);
|
||||||
} else {
|
} else {
|
||||||
depStore.putItem(tagId, values);
|
depStore.putItem(tagId, data);
|
||||||
}
|
}
|
||||||
setIsModalOpen(false);
|
setIsModalOpen(false);
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { useNavigate } from "react-router";
|
||||||
const User = (props: Store) => {
|
const User = (props: Store) => {
|
||||||
const { usrStore } = props;
|
const { usrStore } = props;
|
||||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||||
const nav = useNavigate()
|
const nav = useNavigate();
|
||||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
const formRef = React.useRef<FormInstance>(null);
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
const [record, setRecord] = useState<any>(null);
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
@ -94,14 +94,10 @@ const User = (props: Store) => {
|
||||||
setId(record.id);
|
setId(record.id);
|
||||||
};
|
};
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
// let images = values.imageUrl.map((item) => {
|
let data = {
|
||||||
// return item.response.data.url;
|
|
||||||
// });
|
|
||||||
|
|
||||||
values = {
|
|
||||||
...values,
|
...values,
|
||||||
headImg: "cascas", //images.join(","),
|
|
||||||
};
|
};
|
||||||
|
data.head_img = values.head_img[0].url;
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
usrStore.add(values);
|
usrStore.add(values);
|
||||||
} else {
|
} else {
|
||||||
|
@ -145,7 +141,7 @@ const User = (props: Store) => {
|
||||||
label: "头像",
|
label: "头像",
|
||||||
name: "headImg",
|
name: "headImg",
|
||||||
value: [],
|
value: [],
|
||||||
// rules: [{ required: true, message: "请上传头像" }],
|
rules: [{ required: true, message: "请上传头像" }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "input",
|
type: "input",
|
||||||
|
@ -170,24 +166,74 @@ const User = (props: Store) => {
|
||||||
添加用户
|
添加用户
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button type="default" onClick={() => {nav("/tag")}}>
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/tag");
|
||||||
|
}}
|
||||||
|
>
|
||||||
标签管理
|
标签管理
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="default" onClick={() => { nav("/dep")}}>
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/dep");
|
||||||
|
}}
|
||||||
|
>
|
||||||
部门管理
|
部门管理
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="default" onClick={() => {}}>
|
<Button type="default" onClick={() => {}}>
|
||||||
部门管理
|
部门管理
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="default" onClick={() => {}}>
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/dep");
|
||||||
|
}}
|
||||||
|
>
|
||||||
档案管理
|
档案管理
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="default" onClick={() => {
|
<Button
|
||||||
nav("/warehouse")
|
type="default"
|
||||||
}}>
|
onClick={() => {
|
||||||
仓库管理
|
nav("/dep");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
仓库管理
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/dep");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
请假审批
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/dep");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
政治学习
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/dep");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
政治法规管理
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="default"
|
||||||
|
onClick={() => {
|
||||||
|
nav("/dep");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
物资管理
|
||||||
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
|
||||||
<BTable store={usrStore} columns={columns} dataSource={usrStore.list} />
|
<BTable store={usrStore} columns={columns} dataSource={usrStore.list} />
|
||||||
|
|
Loading…
Reference in New Issue