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

export default {
    calculate: function (data) {
        return request({
            url: "/qdport-zcgx/strive/calculate",
            method: "post",
            data
        })
    },

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

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

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

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

    updateById: function (data) { // 月度情况说明/打分/奖励分配
        return request({
            url: "/qdport-zcgx/strive/updateById",
            method: "post",
            data: {
                ...data,
                updateId: userInfo.id
            }
        })
    },

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

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

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

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

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

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