|
@@ -1,54 +1,53 @@
|
|
-import { List, Modal, Select, Table } from "antd";
|
|
|
|
-import TreeSelect from "rc-tree-select";
|
|
|
|
-import React, { useEffect, useMemo } from "react";
|
|
|
|
|
|
+import { Button, List, Modal, Select, Table } from 'antd';
|
|
|
|
+import TreeSelect from 'rc-tree-select';
|
|
|
|
+import React, { useEffect, useMemo } from 'react';
|
|
|
|
|
|
-const ClassifyModal = ({ data, visible,userList, onClose, handleChange }) => {
|
|
|
|
- const {classify =[], project_id} = data
|
|
|
|
|
|
+const ClassifyModal = ({ data, visible, userList, onClose, handleChange }) => {
|
|
|
|
+ const { classify = [], project_id } = data;
|
|
const list = useMemo(() => {
|
|
const list = useMemo(() => {
|
|
return userList.map(item => {
|
|
return userList.map(item => {
|
|
- return {label:item.CName, value:item.ID}
|
|
|
|
- })
|
|
|
|
- }, [userList])
|
|
|
|
|
|
+ return { label: item.CName, value: item.ID };
|
|
|
|
+ });
|
|
|
|
+ }, [userList]);
|
|
|
|
|
|
const onChange = (e, item) => {
|
|
const onChange = (e, item) => {
|
|
- console.log(e, item)
|
|
|
|
|
|
+ console.log(e, item);
|
|
const idx = classify.findIndex(cur => cur.classify_id == item.classify_id);
|
|
const idx = classify.findIndex(cur => cur.classify_id == item.classify_id);
|
|
if (idx > -1) {
|
|
if (idx > -1) {
|
|
const curClassifyItem = { ...classify[idx], uid: e.join(',') };
|
|
const curClassifyItem = { ...classify[idx], uid: e.join(',') };
|
|
classify[idx] = curClassifyItem;
|
|
classify[idx] = curClassifyItem;
|
|
- handleChange({project_id, classify})
|
|
|
|
|
|
+ handleChange({ project_id, classify });
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
const columns = [
|
|
const columns = [
|
|
{
|
|
{
|
|
title: '分类名称',
|
|
title: '分类名称',
|
|
width: '50%',
|
|
width: '50%',
|
|
- render: item => item.name,
|
|
|
|
|
|
+ render: item => item.name,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '选择操作人',
|
|
title: '选择操作人',
|
|
width: '50%',
|
|
width: '50%',
|
|
render: item => {
|
|
render: item => {
|
|
- return (
|
|
|
|
|
|
+ return (
|
|
<Select
|
|
<Select
|
|
mode="multiple"
|
|
mode="multiple"
|
|
allowClear
|
|
allowClear
|
|
style={{ width: '100%' }}
|
|
style={{ width: '100%' }}
|
|
placeholder="选择操作人"
|
|
placeholder="选择操作人"
|
|
- defaultValue={item.uid ? item.uid.split(",").map(item=>Number(item)) : []}
|
|
|
|
- onChange={(e) => onChange(e,item) }
|
|
|
|
|
|
+ defaultValue={item.uid ? item.uid.split(',').map(item => Number(item)) : []}
|
|
|
|
+ onChange={e => onChange(e, item)}
|
|
options={list}
|
|
options={list}
|
|
/>
|
|
/>
|
|
- )
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
-
|
|
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
|
|
- return (
|
|
|
|
|
|
+ return (
|
|
<Modal
|
|
<Modal
|
|
- width='60%'
|
|
|
|
|
|
+ width="60%"
|
|
// confirmLoading={loading}
|
|
// confirmLoading={loading}
|
|
maskClosable={false}
|
|
maskClosable={false}
|
|
destroyOnClose
|
|
destroyOnClose
|
|
@@ -56,6 +55,11 @@ const ClassifyModal = ({ data, visible,userList, onClose, handleChange }) => {
|
|
visible={visible}
|
|
visible={visible}
|
|
onCancel={onClose}
|
|
onCancel={onClose}
|
|
onOk={onClose}
|
|
onOk={onClose}
|
|
|
|
+ footer={[
|
|
|
|
+ <Button key="submit" type="primary" onClick={onClose}>
|
|
|
|
+ 确定
|
|
|
|
+ </Button>,
|
|
|
|
+ ]}
|
|
>
|
|
>
|
|
<Table
|
|
<Table
|
|
columns={columns}
|
|
columns={columns}
|
|
@@ -64,7 +68,6 @@ const ClassifyModal = ({ data, visible,userList, onClose, handleChange }) => {
|
|
scroll={{ y: 500 }}
|
|
scroll={{ y: 500 }}
|
|
/>
|
|
/>
|
|
</Modal>
|
|
</Modal>
|
|
- )
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-export default ClassifyModal;
|
|
|
|
|
|
+ );
|
|
|
|
+};
|
|
|
|
+export default ClassifyModal;
|