import config from "@/config"
import http from "@/utils/request"

export default {
    contract: {
        url: `${config.API_URL}/zcxt/supplierContract`,
        name: "采购合同",

        all: async function (data = {}) {
            return await http.post(`${this.url}/getList`, data);
        },

        download: async function (params = {}) {
            return await http.get(`${this.url}/download`, params, { responseType: "blob" });
        }
    },

    plan: {
        url: `${config.API_URL}/zcxt/purchasePlan`,
        name: "招采计划",

        getTongji: async function (data = {}) {
            return await http.post(`${this.url}/getTongji`, data);
        },

        getSelectPage: async function (data = {}) {
            return await http.post(`${this.url}/getSelectPage`, data);
        },

        get: async function (data = {}) {
            return await http.post(`${this.url}/getPage`, data);
        },

        add: async function (data = {}) {
            return await http.post(`${this.url}/save`, data);
        },

        edit: async function (data = {}) {
            return await http.post(`${this.url}/update`, data);
        },

        del: async function (data = {}) {
            return await http.post(`${this.url}/remove`, data);
        },

        detail: async function (data = {}) {
            return await http.post(`${this.url}/getById`, data);
        },

        saveApprove: async function (data = {}) { // 审核
            return await http.post(`${this.url}/saveApprove`, data);
        },

        resubmit: async function (data = {}) { // 重新发起
            return await http.post(`${this.url}/resubmit`, data);
        }
    },

    apply: {
        url: `${config.API_URL}/zcxt/purchaseApply`,
        name: "采购申请",

        add: async function (data = {}) {
            return await http.post(`${this.url}/save`, data);
        },

        edit: async function (data = {}) {
            return await http.post(`${this.url}/update`, data);
        },

        updatePurchase: async function (data = {}) { // 是否公用
            return await http.post(`${this.url}/updatePurchase`, data);
        },

        del: async function (data = {}) {
            return await http.post(`${this.url}/remove`, data);
        },

        detail: async function (data = {}) {
            return await http.post(`${this.url}/getById`, data);
        },

        saveApprove: async function (data = {}) { // 审核
            return await http.post(`${this.url}/saveApprove`, data);
        },

        resubmit: async function (data = {}) { // 重新发起
            return await http.post(`${this.url}/resubmit`, data);
        }
    },

    matter: {
        url: `${config.API_URL}/zcxt/purchaseMatter`,
        name: "采购申请-事项审批",

        add: async function (data = {}) {
            return await http.post(`${this.url}/save`, data);
        },

        detail: async function (data = {}) {
            return await http.post(`${this.url}/getById`, data);
        },

        saveApprove: async function (data = {}) { // 审核
            return await http.post(`${this.url}/saveApprove`, data);
        },

        resubmit: async function (data = {}) { // 重新发起
            return await http.post(`${this.url}/resubmit`, data);
        }
    },

    bidSign: {
        url: `${config.API_URL}/zcxt/purchaseBidSign`,
        name: "采购申请-招标文件会签",

        add: async function (data = {}) {
            return await http.post(`${this.url}/save`, data);
        },

        updateFile: async function (data = {}) { // 审批过程中修改文件
            return await http.post(`${this.url}/updateFile`, data);
        },

        detail: async function (data = {}) {
            return await http.post(`${this.url}/getById`, data);
        },

        saveApprove: async function (data = {}) { // 审核
            return await http.post(`${this.url}/saveApprove`, data);
        },

        resubmit: async function (data = {}) { // 重新发起
            return await http.post(`${this.url}/resubmit`, data);
        }
    },

    answerSign: {
        url: `${config.API_URL}/zcxt/purchaseAnswerSign`,
        name: "采购申请-招标答疑会签",

        add: async function (data = {}) {
            return await http.post(`${this.url}/save`, data);
        },

        updateFile: async function (data = {}) { // 审批过程中修改文件
            return await http.post(`${this.url}/updateFile`, data);
        },

        detail: async function (data = {}) {
            return await http.post(`${this.url}/getById`, data);
        },

        saveApprove: async function (data = {}) { // 审核
            return await http.post(`${this.url}/saveApprove`, data);
        },

        resubmit: async function (data = {}) { // 重新发起
            return await http.post(`${this.url}/resubmit`, data);
        }
    },

    bidNotice: {
        url: `${config.API_URL}/zcxt/purchaseBidNotice`,
        name: "采购申请-招标情况通知",

        add: async function (data = {}) {
            return await http.post(`${this.url}/save`, data);
        },

        detail: async function (data = {}) {
            return await http.post(`${this.url}/getById`, data);
        },

        saveApprove: async function (data = {}) { // 审核
            return await http.post(`${this.url}/saveApprove`, data);
        },

        resubmit: async function (data = {}) { // 重新发起
            return await http.post(`${this.url}/resubmit`, data);
        }
    },

    ledger: {
        url: `${config.API_URL}/zcxt/purchase`,
        name: "招采台账",

        getTongji: async function (data = {}) {
            return await http.post(`${this.url}/getTongji`, data);
        },

        get: async function (data = {}) {
            return await http.post(`${this.url}/getPage`, data);
        },

        edit: async function (data = {}) {
            return await http.post(`${this.url}/update`, data);
        },

        getBusinessId: async function (data = {}) {
            return await http.post(`${this.url}/getBusinessId`, data);
        }
    }
}