Commit 98ce63ab8455a512b91c6e1b1c49adf8084b2b75

Authored by 曾国涛
2 parents 631ce122 f794b05d
src/pages/Client/Client/Components/ClientDrawer.tsx
... ... @@ -345,31 +345,39 @@ export default ({ optType, record, onFinish }) => {
345 345 name="institutionContactName"
346 346 rules={[{ required: true, message: '请输入课题组名称!' }]}
347 347 request={async (value) => {
348   - const keywords = value.keyWords;
  348 + const keywords = value.keyWords || '';
349 349 const res = await postResearchGroupsNameSet({
350 350 data: {
351 351 status: 'ADD_AUDIT_PASS',
352 352 groupName: keywords,
353 353 },
354 354 });
355   - let options = res?.data?.map((c: any) => {
356   - return {
357   - label: c,
358   - value: c,
359   - key: c,
360   - };
361   - });
362   - return options;
  355 + return Object.entries(res?.data || {}).map(
  356 + ([researchGroupsId, researchGroupsName]) => ({
  357 + label: researchGroupsName,
  358 + value: researchGroupsName, // 使用 researchGroupsId 作为 value
  359 + key: researchGroupsId,
  360 + id: researchGroupsId,
  361 + }),
  362 + );
363 363 }}
364 364 fieldProps={{
365   - filterOption() {
366   - return true;
  365 + filterOption: () => true,
  366 + onChange: (_, option) => {
  367 + form.setFieldsValue({
  368 + researchGroupId: option?.id || '',
  369 + });
367 370 },
368 371 }}
369 372 debounceTime={1000}
370 373 label="课题组名称"
371 374 placeholder="请输入名称"
372 375 />
  376 + <ProFormText
  377 + hidden={true}
  378 + key="researchGroupId"
  379 + name="researchGroupId"
  380 + ></ProFormText>
373 381 <Form.Item label="关联销售" name="affiliateSales">
374 382 <ProFormSelect
375 383 name="affiliateSales"
... ...