动态改为先审后发

This commit is contained in:
yezian 2024-03-29 23:24:03 +08:00
parent 27ed0f1d24
commit 251a7350dd
1 changed files with 21 additions and 47 deletions

View File

@ -247,12 +247,10 @@ const PostMachineReviewContent = (props) => {
<div>
<Space>
<Space.Compact direction="vertical">
{(current === "rollbackbymachine" ||
current === "machinereviewfail") && (
<Button type="primary" onClick={() => onClickSubmit(record)}>
通过
</Button>
)}
<Button type="primary" onClick={() => onClickPass(record)}>
通过
</Button>
<Button onClick={() => onClickReject(record)}>拒绝</Button>
</Space.Compact>
</Space>
</div>
@ -261,10 +259,16 @@ const PostMachineReviewContent = (props) => {
];
//ref
const formRef = useRef(null);
//
const onClickSubmit = (record) => {
//
const onClickPass = (record) => {
formRef.current.record = record;
formRef.current.btn = "submit";
formRef.current.type = 0;
formRef.current.submit();
};
//
const onClickReject = (record) => {
formRef.current.record = record;
formRef.current.type = 1;
formRef.current.submit();
};
//
@ -272,45 +276,26 @@ const PostMachineReviewContent = (props) => {
try {
//
const base = baseRequest();
if (formRef.current.record.others.media.id !== undefined) {
const response = await fetch("/op/image_audit_task/pass_batch", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
tasks: [formRef.current.record.others.media],
...base,
}),
});
const approveData = await response.json();
console.log(approveData);
if (approveData.ret === -1) {
alert(approveData.msg);
return;
}
}
//
const response2 = await fetch("/op/text_audit_task/pass_batch", {
const response = await fetch("/op/moment/review", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
tasks: [formRef.current.record.others.text],
moment_ids: [parseInt(formRef.current.record.momentId, 10)],
op_type: formRef.current.type,
...base,
}),
});
const approveData2 = await response2.json();
console.log(approveData2);
if (approveData2.ret === -1) {
alert(approveData2.msg);
const _data = await response.json();
if (_data.ret === -1) {
alert(_data.msg);
return;
}
//
setShowData(
showData.filter(
(item) => item.id.media !== formRef.current.record.others.media.id
(item) => item.momentId !== formRef.current.record.momentId
)
);
} catch (error) {
@ -334,9 +319,6 @@ const PostMachineReviewContent = (props) => {
case "passbymachine":
querryStatus = 2;
break;
case "passbyoperator":
querryStatus = 5;
break;
default:
break;
}
@ -364,6 +346,7 @@ const PostMachineReviewContent = (props) => {
const structedData = temData.data.list.map((item, index) => {
return {
key: index,
momentId: item.moment_audit_task.associative_table_id,
id: {
media: item.image_audit_task_vo.id,
text: item.text_audit_task_vo.id,
@ -444,7 +427,6 @@ const PostMachineReviewContent = (props) => {
<p>
{current === "rollbackbymachine" && `机审核违规${showData.length}`}
{current === "passbymachine" && `机审核通过${showData.length}`}
{current === "passbyoperator" && `运营通过${showData.length}`}
</p>
<Form
ref={formRef}
@ -483,10 +465,6 @@ export default function PostMachineReview() {
label: "机审通过",
key: "passbymachine",
},
{
label: "运营通过",
key: "passbyoperator",
},
];
const onClick = (e) => {
setCurrent(e.key);
@ -519,10 +497,6 @@ export default function PostMachineReview() {
path="/passbymachine"
element={<PostMachineReviewContent current="passbymachine" />}
/>
<Route
path="/passbyoperator"
element={<PostMachineReviewContent current="passbyoperator" />}
/>
</Routes>
</div>
);