master
zhengpengju 3 years ago
parent 0446ac3d75
commit c7e6e0a0f7

@ -9,11 +9,12 @@ import ProTable from '@ant-design/pro-table';
import { BetaSchemaForm, ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import ProDescriptions from '@ant-design/pro-descriptions';
import type { FormValueType } from './components/UpdateForm';
import UpdateForm from './components/UpdateForm';
import type { FormValueType } from './_components/UpdateForm';
import UpdateForm from './_components/UpdateForm';
import { querySubjectList, queryRulesList, removeRules } from '../service';
import type { TableListItem, TableListPagination } from './data';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import { updateRules } from './service';
/**
*
@ -38,6 +39,29 @@ const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
}
};
/**
*
*
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
console.log('fields',fields)
try {
await updateRules({
...currentRow,
...fields,
});
hide();
message.success('配置成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
return false;
}
};
const ExaminationRules: React.FC = () => {
//const [registrationModalVisible, handleRegistrationModalVisible] = useState<boolean>(false);
const actionRef = useRef<ActionType>();
@ -173,10 +197,13 @@ const ExaminationRules: React.FC = () => {
</a>,
<a
key="registration"
onClick={() => {
history.push(`/examination/option/registration/${record.examination_id}`);
key="b_use"
onClick={async () => {
//history.push(`/examination/option/registration/${record.examination_id}`);
//setCurrentRow(record);
console.log('record', {...record, b_use: !record.b_use})
await handleUpdate({b_use: record?.b_use === 0 ? 1 : 0}, record);
actionRef.current?.reloadAndRest?.();
}}
>
{record.b_use == 0 ? "未发布" : "已发布"}

Loading…
Cancel
Save