Просмотр исходного кода

♻️ refactor(areas): replace AreaTreeSelect with LazyAreaTreeSelect

- change component import from AreaTreeSelect to LazyAreaTreeSelect
- remove manual value setting logic as it's now handled internally by LazyAreaTreeSelect
yourname 8 месяцев назад
Родитель
Сommit
b0fdd89dd9
1 измененных файлов с 2 добавлено и 4 удалено
  1. 2 4
      src/client/admin/pages/Areas.tsx

+ 2 - 4
src/client/admin/pages/Areas.tsx

@@ -1,7 +1,7 @@
 import React, { useState, useEffect } from 'react';
 import { Table, Button, Space, Input, Modal, Form } from 'antd';
 import { App } from 'antd';
-import AreaTreeSelect from '@/client/admin/components/AreaTreeSelect';
+import LazyAreaTreeSelect from '@/client/admin/components/LazyAreaTreeSelect';
 import { PlusOutlined, EditOutlined, DeleteOutlined, SearchOutlined } from '@ant-design/icons';
 import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
 import { areaClient } from '@/client/api';
@@ -277,10 +277,8 @@ const Areas: React.FC = () => {
             label="父区域"
             tooltip="选择父区域,顶级区域无需选择"
           >
-            <AreaTreeSelect
+            <LazyAreaTreeSelect
               placeholder="请选择父区域(顶级区域无需选择)"
-              value={form.getFieldValue('parentId') || undefined}
-              onChange={(value) => form.setFieldValue('parentId', value)}
             />
           </Form.Item>
         </Form>