供应商评价模板,禁用逻辑
This commit is contained in:
@ -79,7 +79,7 @@ const SupplierAnnualTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, disp
|
||||
const fetchTemplateList = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const res = await getAllAnnualTemplates();
|
||||
const res = await getAllAnnualTemplates({ status: '1' });
|
||||
if (res.success && res.data) {
|
||||
// 如果是修改,需要过滤掉自己
|
||||
if (location.state?.editData) {
|
||||
|
@ -44,7 +44,6 @@ interface PageProps extends ConnectProps {
|
||||
const SupplierTaskManageAdd: React.FC<PageProps> = ({
|
||||
supplierTaskManage,
|
||||
dispatch,
|
||||
breadcrumb,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
// 获取dva model中的状态
|
||||
|
@ -92,7 +92,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
// 获取所有模板列表
|
||||
const fetchTemplateList = async () => {
|
||||
try {
|
||||
const res = await getAllTemplates();
|
||||
const res = await getAllTemplates({ status: '1' });
|
||||
if (res.success && res.data) {
|
||||
// 如果是修改,需要过滤掉自己
|
||||
if (location.state?.editData) {
|
||||
@ -234,6 +234,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
if (isEdit && templateDetail) {
|
||||
dataToSubmit.id = templateDetail.id;
|
||||
}
|
||||
debugger
|
||||
setLoading(true);
|
||||
try {
|
||||
// 调用API接口
|
||||
@ -337,6 +338,11 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
|
||||
// setTemplateData(copiedIndicatorStList);
|
||||
setTemplateData(res.data.indicatorStList);
|
||||
// 赋值表单,因为需要传递到组件中判断状态
|
||||
form.setFieldsValue({
|
||||
indicatorStMore: res.data.indicatorStMore,
|
||||
indicatorTypeMore: res.data.indicatorTypeMore,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
message.error(
|
||||
@ -502,6 +508,10 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
id: 'supplierTemplateManage.form.selectTemplate',
|
||||
})}
|
||||
loading={templateList.length === 0}
|
||||
showSearch={true}
|
||||
filterOption={(input, option) => {
|
||||
return (option?.children ?? '').toLowerCase().includes(input.toLowerCase())
|
||||
}}
|
||||
onSelect={handleTemplateSelect}
|
||||
>
|
||||
{templateList.map((template) =>
|
||||
@ -534,11 +544,16 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
{getUserRole() === 'admin' && (
|
||||
<Row gutter={24}>
|
||||
<Col span={8}>
|
||||
<Form.Item label="是否可追加一级指标" name="indicatorStMore">
|
||||
<Radio.Group>
|
||||
<Form.Item label="是否可追加一级指标" name="indicatorStMore" hidden={getUserRole() !== 'admin'}>
|
||||
<Radio.Group onChange={(e) => {
|
||||
if (e.target.value === IndicatorAddOption.CAN_ADD) {
|
||||
form.setFieldsValue({
|
||||
indicatorTypeMore: '',
|
||||
});
|
||||
}
|
||||
}}>
|
||||
<Radio value={IndicatorAddOption.CAN_ADD}>
|
||||
{IndicatorAddOptionText[IndicatorAddOption.CAN_ADD]}
|
||||
</Radio>
|
||||
@ -555,7 +570,7 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('indicatorStMore') === IndicatorAddOption.CANNOT_ADD ? (
|
||||
<Col span={8}>
|
||||
<Form.Item label="禁用指标类型" name="indicatorTypeMore">
|
||||
<Form.Item label="禁用指标类型" name="indicatorTypeMore" hidden={getUserRole() !== 'admin'}>
|
||||
<Select
|
||||
placeholder="请选择禁用指标类型"
|
||||
options={indicatorTypes}
|
||||
@ -580,7 +595,6 @@ const SupplierTemplateManageAdd: React.FC<PageProps> = ({ breadcrumb, dispatch }
|
||||
</Form.Item>
|
||||
</Col> */}
|
||||
</Row>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
<Divider />
|
||||
|
Reference in New Issue
Block a user