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

export default {
    menu: {
        url: `${config.API_URL}/zcxt/menus`,
        name: "获取我的菜单",
        build: async function (params) {
            return await http.get(`${this.url}/build`, params);
        },

        get: async function (params) {
            return await http.get(this.url, params);
        },

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

        edit: async function (data = {}) {
            return await http.put(this.url, data);
        },

        del: async function (data = {}) {
            return await http.delete(this.url, data);
        }
    },

    role: {
        url: `${config.API_URL}/zcxt/roles`,
        name: "角色列表",
        all: async function () {
            return await http.get(`${this.url}/all`);
        },

        get: async function (params) {
            return await http.get(this.url, params);
        },

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

        edit: async function (data = {}) {
            return await http.put(this.url, data);
        },

        del: async function (data = {}) {
            return await http.delete(this.url, data);
        },

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

    job: {
        url: `${config.API_URL}/zcxt/job`,
        name: "岗位列表",
        all: async function (data = {}) {
            return await http.post(`${this.url}/getList`, 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);
        }
    },

    dept: {
        url: `${config.API_URL}/zcxt/dept`,
        name: "组织列表",
        get: async function (data = {}) {
            return await http.post(`${this.url}/getList`, 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);
        }
    },

    user: {
        url: `${config.API_URL}/zcxt/users`,
        name: "用户列表",
        get: async function (params) {
            return await http.get(this.url, params);
        },

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

        edit: async function (data = {}) {
            return await http.put(this.url, data);
        },

        del: async function (data = {}) {
            return await http.delete(this.url, data);
        }
    },

    dict: {
        url: `${config.API_URL}/zcxt/dict`,
        name: "字典列表",
        all: async function () {
            return await http.get(`${this.url}/all`);
        },

        get: async function (params) {
            return await http.get(this.url, params);
        },

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

        edit: async function (data = {}) {
            return await http.put(this.url, data);
        },

        del: async function (data = {}) {
            return await http.delete(this.url, data);
        }
    },

    dictDetail: {
        url: `${config.API_URL}/zcxt/dictDetail`,
        name: "字典列表",
        get: async function (params) {
            return await http.get(this.url, params);
        },

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

        edit: async function (data = {}) {
            return await http.put(this.url, data);
        },

        del: async function (id) {
            return await http.delete(this.url + "/" + id);
        },

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

    approveInfo: {
        url: `${config.API_URL}/zcxt/approveInfo`,
        name: "审批流程code",

        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);
        }
    },

    bank: {
        url: `${config.API_URL}/zcxt/finance`,
        name: "银行列表",
        get: async function (data = {}) {
            return await http.post(`${this.url}/getPage`, data);
        }
    },

    project: {
        url: `${config.API_URL}/zcxt/projectInfo`,
        name: "项目列表",

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

        all: async function (data = {}) {
            return await http.post(`${this.url}/getList`, 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);
        }
    },

    userProject: {
        url: `${config.API_URL}/zcxt/userProjectRef`,
        name: "项目列表",

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

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