import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PrintTemplateVO, PrintTemplateForm, PrintTemplateQuery } from '@/api/oa/base/printTemplate/types';

/**
 * 查询打印模板信息列表
 * @param query
 * @returns {*}
 */

export const listPrintTemplate = (query?: PrintTemplateQuery): AxiosPromise<PrintTemplateVO[]> => {
  return request({
    url: '/oa/base/printTemplate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询打印模板信息详细
 * @param templateId
 */
export const getPrintTemplate = (templateId: string | number): AxiosPromise<PrintTemplateVO> => {
  return request({
    url: '/oa/base/printTemplate/' + templateId,
    method: 'get'
  });
};

/**
 * 新增打印模板信息
 * @param data
 */
export const addPrintTemplate = (data: PrintTemplateForm) => {
  return request({
    url: '/oa/base/printTemplate',
    method: 'post',
    data: data
  });
};

/**
 * 修改打印模板信息
 * @param data
 */
export const updatePrintTemplate = (data: PrintTemplateForm) => {
  return request({
    url: '/oa/base/printTemplate',
    method: 'put',
    data: data
  });
};

/**
 * 删除打印模板信息
 * @param templateId
 */
export const delPrintTemplate = (templateId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/base/printTemplate/' + templateId,
    method: 'delete'
  });
};

/**
 * 下拉框查询打印模板信息列表
 * @param query
 * @returns {*}
 */
export function getBasePrintTemplateList (query) {
    return request({
        url: '/oa/base/printTemplate/getBasePrintTemplateList',
        method: 'get',
        params: query
    });
};
