|
@@ -1,4 +1,4 @@
|
|
|
-import { getOpusListApi } from '@/services/task-api/opus';
|
|
|
+import { getOpusListApi, getUserNameListApi } from '@/services/task-api/opus';
|
|
|
import { MaterialTypeEnum } from '@/utils/constEnum';
|
|
|
import { SearchOutlined } from '@ant-design/icons';
|
|
|
import { PageContainer } from '@ant-design/pro-components';
|
|
@@ -16,7 +16,9 @@ const Opus: React.FC = () => {
|
|
|
const [form] = Form.useForm<TASKAPI.OpusList>();
|
|
|
const [queryForm, setQueryForm] = useState<TASKAPI.OpusList>({ pageNum: 1, pageSize: 10 });
|
|
|
const getOpusList = useRequest(getOpusListApi, { manual: true });
|
|
|
+ const getUserNameList = useRequest(getUserNameListApi, { manual: true, debounceWait: 300 });
|
|
|
const [data, setData] = useState<any[]>([]);
|
|
|
+ const [userList, setUserList] = useState<{ label: string; value: any }[]>([]);
|
|
|
/**************************************/
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -57,6 +59,23 @@ const Opus: React.FC = () => {
|
|
|
setQueryForm({ ...queryForm, pageNum: queryForm.pageNum + 1 });
|
|
|
};
|
|
|
|
|
|
+ const handleSearch = (newValue: string) => {
|
|
|
+ getUserNameList.runAsync({ userName: newValue }).then((res) => {
|
|
|
+ console.log('getUserNameList-->', res?.data);
|
|
|
+ if (res?.data && Object.keys(res?.data)?.length > 0) {
|
|
|
+ setUserList(
|
|
|
+ Object.keys(res?.data as any).map((key) => ({
|
|
|
+ label: res?.data[key],
|
|
|
+ value: key,
|
|
|
+ })),
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ setUserList([]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ console.log('--->', userList);
|
|
|
+
|
|
|
return (
|
|
|
<PageContainer>
|
|
|
<Card style={{ borderRadius: 8 }} bodyStyle={{ padding: 0 }}>
|
|
@@ -78,6 +97,24 @@ const Opus: React.FC = () => {
|
|
|
onFinish={onFinish}
|
|
|
>
|
|
|
<Row gutter={[0, 6]}>
|
|
|
+ <Col>
|
|
|
+ <Form.Item name="userId">
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ allowClear
|
|
|
+ style={{ width: 150 }}
|
|
|
+ loading={getUserNameList.loading}
|
|
|
+ onSearch={handleSearch}
|
|
|
+ placeholder="请输入名称查找"
|
|
|
+ defaultActiveFirstOption={false}
|
|
|
+ suffixIcon={null}
|
|
|
+ filterOption={false}
|
|
|
+ notFoundContent={null}
|
|
|
+ options={userList}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+
|
|
|
<Col>
|
|
|
<Form.Item name="materialType">
|
|
|
<Select
|