lbq
2026-01-05 72139f39a0845f8de31fd44bc5dd7077df17d48e
rsf-admin/src/page/locPreview/LocPreviewList.jsx
@@ -201,6 +201,8 @@
                    <TextField source="memo" label="common.field.memo" sortable={false} />
                    <WrapperField cellClassName="opt" label="common.field.opt">
                        <EditButton sx={{ padding: '1px', fontSize: '.75rem' }}  label="toolbar.detail" />
                        {/* <LocButton sx={{ padding: '1px', fontSize: '.75rem' }} ></LocButton>
                        <UnLockButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /><UnLockButton /> */}
                    </WrapperField>
                </StyledDatagrid>
            </List>
@@ -208,4 +210,63 @@
    )
}
export default LocPreviewList;
export default LocPreviewList;
/**
 * 操作
 * @returns
 */
const LocButton = (props) => {
    // const record = useRecordContext();
    const notify = useNotify();
    const refresh = useRefresh();
    const clickComplete = () => {
        completeTask(record)
    };
    //完成任务
    const completeTask = async (row) => {
        const { data: { code, data, msg } } = await request.post(`task/complete/` + row.id);
        if (code === 200) {
            notify(msg);
            refresh();
        } else {
            notify(msg);
        }
    }
    return (
        <ConfirmButton label={"冻结"} color="secondary" startIcon={<TaskAltIcon />} onConfirm={clickComplete} />
    )
}
/**
 * 取消按钮
 * @returns
 */
const UnLockButton = () => {
    const record = useRecordContext();
    const notify = useNotify();
    const refresh = useRefresh();
    const clickCancel = () => {
        cancleTask(record)
    };
    //取消任务
    const cancleTask = async (row) => {
        const { data: { code, data, msg } } = await request.post(`/task/remove/` + row.id);
        if (code === 200) {
            notify(msg);
            refresh();
        } else {
            notify(msg);
        }
    }
    return (
        (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 107 || record.taskType == 103 || record.taskType == 11) ?
            <ConfirmButton
                onConfirm={clickCancel}
                startIcon={<CancelIcon />}
                label={"toolbar.cancel"}>
            </ConfirmButton>
            :
            <></>
    )
}