暂存评价任务新增
This commit is contained in:
@ -10,7 +10,6 @@ import {
|
||||
Form,
|
||||
Tooltip,
|
||||
Tag,
|
||||
TreeSelect,
|
||||
} from 'antd';
|
||||
import type { TablePaginationConfig } from 'antd';
|
||||
import {
|
||||
@ -25,22 +24,11 @@ import {
|
||||
} from '@/dicts/supplierTemplateDict';
|
||||
import {
|
||||
getTemplateList,
|
||||
getCategoryTree,
|
||||
} from '@/servers/api/supplierEvaluate';
|
||||
import CategorySelector from '@/components/CategorySelector/CategorySelector';
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
// 处理品类树数据
|
||||
const processCategoryTree = (data: any[]): any[] => {
|
||||
return data.map(item => ({
|
||||
title: item.categoryName,
|
||||
value: item.id,
|
||||
key: item.id,
|
||||
selectable: item.type === '1', // 只有类型为品类的节点可选
|
||||
children: item.children ? processCategoryTree(item.children) : undefined
|
||||
}));
|
||||
};
|
||||
|
||||
const SupplierTemplateManage: React.FC = () => {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [form] = Form.useForm();
|
||||
@ -56,8 +44,7 @@ const SupplierTemplateManage: React.FC = () => {
|
||||
});
|
||||
const [searchParams, setSearchParams] = useState<SupplierEvaluate.TemplateSearchParams>({});
|
||||
|
||||
// 品类和部门下拉选项
|
||||
const [categoryTreeData, setCategoryTreeData] = useState<any[]>([]);
|
||||
// 部门下拉选项
|
||||
const [companyOptions, setCompanyOptions] = useState<{ label: string, value: string }[]>([
|
||||
{ label: '中山市合创展包装材料有限公司', value: '中山市合创展包装材料有限公司' },
|
||||
{ label: '广州市科技发展有限公司', value: '广州市科技发展有限公司' },
|
||||
@ -65,21 +52,6 @@ const SupplierTemplateManage: React.FC = () => {
|
||||
{ label: '东莞市制造业有限公司', value: '东莞市制造业有限公司' },
|
||||
]);
|
||||
|
||||
// 获取品类树
|
||||
const fetchCategoryTree = async () => {
|
||||
try {
|
||||
const res = await getCategoryTree();
|
||||
if (res.success && res.data) {
|
||||
// 使用组件外的函数处理数据
|
||||
const treeData = processCategoryTree(res.data);
|
||||
setCategoryTreeData(treeData);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取品类树失败:', error);
|
||||
message.error('获取品类树失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 获取模板列表
|
||||
const fetchTemplateList = async (
|
||||
current = 1,
|
||||
@ -128,7 +100,6 @@ const SupplierTemplateManage: React.FC = () => {
|
||||
// 首次加载获取数据
|
||||
useEffect(() => {
|
||||
fetchTemplateList(pagination.current, pagination.pageSize, {});
|
||||
fetchCategoryTree();
|
||||
}, []);
|
||||
|
||||
// 处理查看
|
||||
@ -284,16 +255,7 @@ const SupplierTemplateManage: React.FC = () => {
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="categoryId" label="品类">
|
||||
<TreeSelect
|
||||
placeholder="请选择品类"
|
||||
allowClear
|
||||
showSearch
|
||||
treeNodeFilterProp="title"
|
||||
style={{ width: 200 }}
|
||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||
treeData={categoryTreeData}
|
||||
treeDefaultExpandAll
|
||||
/>
|
||||
<CategorySelector multiple={false} style={{ width: 200 }} />
|
||||
</Form.Item>
|
||||
<Form.Item className="filter-btns">
|
||||
<Button type="primary" htmlType="submit" icon={<SearchOutlined />}>
|
||||
|
Reference in New Issue
Block a user