问题label
This commit is contained in:
@ -157,7 +157,7 @@ const SupplierRegister: React.FC<supplierWithInputProps> = (props) => {
|
|||||||
labelCol={{ span: 7 }}
|
labelCol={{ span: 7 }}
|
||||||
wrapperCol={{ span: 17 }}
|
wrapperCol={{ span: 17 }}
|
||||||
>
|
>
|
||||||
<Form.Item label="企业类型" labelCol={{ span: 2 }} wrapperCol={{ span: 19 }}>
|
<Form.Item label="境内/境外" labelCol={{ span: 2 }} wrapperCol={{ span: 19 }}>
|
||||||
<Radio.Group onChange={handleSupplierTypeChange} buttonStyle="solid" value={supplierType}>
|
<Radio.Group onChange={handleSupplierTypeChange} buttonStyle="solid" value={supplierType}>
|
||||||
<Radio.Button value="dvs">境内企业/机构</Radio.Button>
|
<Radio.Button value="dvs">境内企业/机构</Radio.Button>
|
||||||
<Radio.Button value="ovs">境外企业</Radio.Button>
|
<Radio.Button value="ovs">境外企业</Radio.Button>
|
||||||
|
@ -79,7 +79,7 @@ const SupplierSelector: React.FC<{
|
|||||||
<Form.Item name="name" label="供应商名称">
|
<Form.Item name="name" label="供应商名称">
|
||||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
|
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="supplierType" label="企业类型">
|
<Form.Item name="supplierType" label="境内/境外">
|
||||||
<RegionTypeSelect />
|
<RegionTypeSelect />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
|
@ -78,7 +78,7 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
|
|||||||
<Form.Item name="name" label="供应商名称">
|
<Form.Item name="name" label="供应商名称">
|
||||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={100} />
|
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={100} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="supplierType" label="企业类型">
|
<Form.Item name="supplierType" label="境内/境外">
|
||||||
<RegionTypeSelect />
|
<RegionTypeSelect />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
@ -27,10 +27,6 @@ interface Props {
|
|||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
onSuccess?: () => void;
|
onSuccess?: () => void;
|
||||||
}
|
}
|
||||||
interface DeptOption {
|
|
||||||
deptId: string;
|
|
||||||
deptName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const convertToTreeData = (data: any[] = []): TreeNodeType[] => {
|
const convertToTreeData = (data: any[] = []): TreeNodeType[] => {
|
||||||
return (data || []).map(item => ({
|
return (data || []).map(item => ({
|
||||||
@ -50,6 +46,21 @@ const updateLockType = (nodes: TreeNodeType[], key: string, val: number) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function hasFuelCategory(checkedKeys: string[], treeData: TreeNodeType[]): boolean {
|
||||||
|
let found = false;
|
||||||
|
function dfs(nodes: TreeNodeType[]) {
|
||||||
|
for (const node of nodes) {
|
||||||
|
if (checkedKeys.includes(node.key) && node.categoryName.includes('燃油')) {
|
||||||
|
found = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (node.children) dfs(node.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dfs(treeData);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) => {
|
const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
@ -61,8 +72,8 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
|
|||||||
const [expandedKeys, setExpandedKeys] = useState<string[]>([]);
|
const [expandedKeys, setExpandedKeys] = useState<string[]>([]);
|
||||||
//供应商符合性审查
|
//供应商符合性审查
|
||||||
const [fileList, setFileList] = useState<UploadFile<any>[]>([]);
|
const [fileList, setFileList] = useState<UploadFile<any>[]>([]);
|
||||||
|
//品类(燃油)必填区域
|
||||||
const [deptOptions, setDeptOptions] = useState<DeptOption[]>([]);
|
const [areaRequired, setAreaRequired] = useState(false);
|
||||||
// 自定义上传
|
// 自定义上传
|
||||||
const handleCustomRequest = async (options: any) => {
|
const handleCustomRequest = async (options: any) => {
|
||||||
const { file, onSuccess, onError } = options;
|
const { file, onSuccess, onError } = options;
|
||||||
@ -92,13 +103,7 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
|
|||||||
const init = async (visible: boolean) => {
|
const init = async (visible: boolean) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
await superiorLockList();
|
// await superiorLockList();
|
||||||
await getSupplierPage({ basePageRequest: { pageNo: 1, pageSize: 10 } }).then(res => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
setDeptOptions(res.data.records);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await categoryTree()
|
await categoryTree()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200 && Array.isArray(res.data)) {
|
if (res.code === 200 && Array.isArray(res.data)) {
|
||||||
@ -120,8 +125,7 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => setLoading(false));
|
.finally(() => setLoading(false));
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 清空选项
|
// 清空选项
|
||||||
@ -140,12 +144,14 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
|
|||||||
}, [visible, form]);
|
}, [visible, form]);
|
||||||
|
|
||||||
const handleTreeCheck = (checkedKeysValue: any) => {
|
const handleTreeCheck = (checkedKeysValue: any) => {
|
||||||
const onlyOneEachLevel = checkedKeysValue;
|
setCheckedKeys(checkedKeysValue);
|
||||||
|
form.setFieldsValue({ categoryKeys: checkedKeysValue });
|
||||||
console.log(onlyOneEachLevel, 'onlyOneEachLevel');
|
if (hasFuelCategory(checkedKeysValue, treeData)) {
|
||||||
|
setAreaRequired(true);
|
||||||
setCheckedKeys(onlyOneEachLevel);
|
form.validateFields(['area']);
|
||||||
form.setFieldsValue({ categoryKeys: onlyOneEachLevel });
|
} else {
|
||||||
|
setAreaRequired(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// 从树中获取所有选中节点及其父级节点
|
// 从树中获取所有选中节点及其父级节点
|
||||||
const collectCheckedWithParents = (nodes: TreeNodeType[], checked: string[]): string[] => {
|
const collectCheckedWithParents = (nodes: TreeNodeType[], checked: string[]): string[] => {
|
||||||
@ -265,13 +271,14 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label="区域选择(仅燃油品)"
|
label="区域选择(仅燃油品)"
|
||||||
name="area"
|
name="area"
|
||||||
|
required={areaRequired}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: areaRequired,
|
||||||
|
message: '请选择区域(燃油品必填)',
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
{/* <Select
|
|
||||||
placeholder="请选择区域"
|
|
||||||
style={{ width: 260 }}
|
|
||||||
options={areaOptions}
|
|
||||||
/> rules={[{ required: true, message: '请选择区域' }]}
|
|
||||||
required */}
|
|
||||||
<Select placeholder="请选择区域">
|
<Select placeholder="请选择区域">
|
||||||
{
|
{
|
||||||
regionOptions.map((item) => {
|
regionOptions.map((item) => {
|
||||||
|
@ -64,7 +64,7 @@ export const detail = (params: detailData) => request.get(`/cosco/library/detail
|
|||||||
export const superiorLockList = () => request.get(`/cosco/library/superiorLockList`);
|
export const superiorLockList = () => request.get(`/cosco/library/superiorLockList`);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询上级部门锁定品类
|
*
|
||||||
*/
|
*/
|
||||||
interface treeListData {
|
interface treeListData {
|
||||||
categoryLibraryId: string;
|
categoryLibraryId: string;
|
||||||
|
@ -86,7 +86,7 @@ const ViewModal: React.FC<{
|
|||||||
{
|
{
|
||||||
title: '境内/境外', dataIndex: 'supplierCategory', align: 'center',
|
title: '境内/境外', dataIndex: 'supplierCategory', align: 'center',
|
||||||
render: (record: any) => {
|
render: (record: any) => {
|
||||||
const supplierCategoryType = record.supplierCategory === 'dvs' ? '境内企业' : '境外企业'
|
const supplierCategoryType = record.supplierCategory === 'dvs' ? '境内企业' : record.supplierCategory === 'pe' ? '个人':'境外企业'
|
||||||
return (
|
return (
|
||||||
<span>{supplierCategoryType}</span>
|
<span>{supplierCategoryType}</span>
|
||||||
)
|
)
|
||||||
|
@ -197,7 +197,7 @@ const SupplierChangeReviewManage: React.FC<Props> = ({ dispatch }) => {
|
|||||||
<Form.Item name="supplierName" label="供应商名称">
|
<Form.Item name="supplierName" label="供应商名称">
|
||||||
<Input placeholder="请输入供应商名称关键字" allowClear />
|
<Input placeholder="请输入供应商名称关键字" allowClear />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="supplierType" label="企业类型">
|
<Form.Item name="supplierType" label="境内/境外">
|
||||||
<RegionTypeSelect />
|
<RegionTypeSelect />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
|
|||||||
<Form.Item name="name" label="供应商名称">
|
<Form.Item name="name" label="供应商名称">
|
||||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} maxLength={50} />
|
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} maxLength={50} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="supplierType" label="企业类型">
|
<Form.Item name="supplierType" label="境内/境外">
|
||||||
<RegionTypeSelect />
|
<RegionTypeSelect />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
|
@ -195,7 +195,7 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
|
|||||||
<Form.Item name="accessStatus" label="准入状态">
|
<Form.Item name="accessStatus" label="准入状态">
|
||||||
<AccessStatusSelect/>
|
<AccessStatusSelect/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="supplierType" label="企业类型">
|
<Form.Item name="supplierType" label="境内/境外">
|
||||||
<RegionTypeSelect />
|
<RegionTypeSelect />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
|
@ -189,7 +189,7 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
|
|||||||
<Form.Item name="name" label="供应商名称">
|
<Form.Item name="name" label="供应商名称">
|
||||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
|
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="supplierType" label="企业类型">
|
<Form.Item name="supplierType" label="境内/境外">
|
||||||
<RegionTypeSelect />
|
<RegionTypeSelect />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="accessStatus" label="准入状态">
|
<Form.Item name="accessStatus" label="准入状态">
|
||||||
|
Reference in New Issue
Block a user