import request from "@/utils/request";
import { useUserStore } from "@/store/user";
const { userInfo } = useUserStore(); // store 用户

export default {
    get: function (params) {
        return request({
            url: "/qdport-zcgx/case/page",
            method: "get",
            params
        })
    },

    detail: function (id) {
        return request({
            url: `/qdport-zcgx/case/${id}`,
            method: "get"
        })
    },

    add: function (data) {
        return request({
            url: "/qdport-zcgx/case/save",
            method: "post",
            data
        })
    },

    edit: function (data) {
        return request({
            url: "/qdport-zcgx/case/update",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    },

    del: function (data) {
        return request({
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            url: "/qdport-zcgx/case/remove",
            method: "post",
            data
        })
    },

    saveApprove: function (data) { // 直接上报/提交
        return request({
            url: "/qdport-zcgx/case/saveApprove",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    },

    withdraw: function (data) { // 撤回
        return request({
            url: "/qdport-zcgx/case/withdraw",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    },

    agree: function (data) { // 审核通过
        return request({
            url: "/qdport-zcgx/case/approve",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    },

    refuse: function (data) { // 退回
        return request({
            url: "/qdport-zcgx/case/refuse",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    },

    resubmit: function (data) { // 退回
        return request({
            url: "/qdport-zcgx/case/resubmit",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    }
}