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

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

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

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

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

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

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

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

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

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

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

    resubmit: function (data) { // 重新发起
        return request({
            url: "/qdport-zcgx/share/resubmit",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    }
}