import request from '@/Utils/requestUtils.js';
import $api from '@/Apis/api';

export const pageService = {
    queryWebPageOutput: function(parentId = 0) {
        return request.get($api.page.queryWebPageOutput, { params: { parentId: parentId } });
    },
    deleteWebpage: function(webId) {
        return request.get($api.page.deleteWebpage, { params: { webId: webId } });
    },
    addWebpage: function(data) {
        return request.post($api.page.addWebpage, data);
    },
    updateWebpage: function(data) {
        return request.post($api.page.updateWebpage, data);
    },
    addButton: function(data) {
        return request.post($api.page.addButton, data);
    },
    queryButtonByWeb: function(webId) {
        return request.get($api.page.queryButtonByWeb, { params: { webId: webId } });
    },
    deleteButton: function(buttonId) {
        return request.get($api.page.deleteButton, { params: { buttonId: buttonId } });
    },
    updateButton: function(data) {
        return request.post($api.page.updateButton, data);
    },
    addPageField: function(data) {
        return request.post($api.page.addPageField, data);
    },
    queryFieldByWeb: function(webId) {
        return request.get($api.page.queryFieldByWeb, { params: { webId: webId } });
    },
    deleteField: function(fieldId) {
        return request.get($api.page.deleteField, { params: { fieldId: fieldId } });
    },
    updatePageField: function(data) {
        return request.post($api.page.updatePageField, data);
    },
    addSingleField: function(data) {
        return request.post($api.page.addSingleField, data);
    },
    addButtonField: function(data) {
        return request.post($api.page.addButtonField, data);
    }, //自动添加子页面列
    addSingleButtonField: function(data) {
        return request.post($api.page.addSingleButtonField, data);
    }, //人工单独添加子页面列
    queryButtonFieldByButton: function(data) {
        return request.get($api.page.queryButtonFieldByButton, { params: data });
    }, //查询子页面字段
    deleteButtonField: function(fieldId) {
        return request.get($api.page.deleteButtonField, { params: { fieldId: fieldId } });
    }, //删除子页面字段
    updateButtonField: function(data) {
        return request.post($api.page.updateButtonField, data);
    } //修改子页面字段关联
};
