import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CompanyFieldApplyVO, CompanyFieldApplyForm, CompanyFieldApplyQuery, ApprovalForm } from '@/api/smarttrace/companyFieldApply/types';

/**
 * 查询企业字段修改申请列表
 * @param query
 * @returns {*}
 */

export const listCompanyFieldApply = (query?: CompanyFieldApplyQuery): AxiosPromise<CompanyFieldApplyVO[]> => {
    return request({
        url: '/smarttrace/companyFieldApply/list',
        method: 'get',
        params: query
    });
};

/**
 * 查询企业字段修改申请详细
 * @param id
 */
export const getCompanyFieldApply = (id: string | number): AxiosPromise<CompanyFieldApplyVO> => {
    return request({
        url: '/smarttrace/companyFieldApply/getInfo/' + id,
        method: 'get'
    });
};

/**
 * 新增企业字段修改申请
 * @param data
 */
export const addCompanyFieldApply = (data: CompanyFieldApplyForm) => {
    return request({
        url: '/smarttrace/companyFieldApply/add',
        method: 'post',
        data: data
    });
};

/**
 * 修改企业字段修改申请
 * @param data
 */
export const updateCompanyFieldApply = (data: CompanyFieldApplyForm) => {
    return request({
        url: '/smarttrace/companyFieldApply/edit',
        method: 'post',
        data: data
    });
};

/**
 * 删除企业字段修改申请
 * @param id
 */
export const delCompanyFieldApply = (id: string | number | Array<string | number>) => {
    return request({
        url: '/smarttrace/companyFieldApply/remove/' + id,
        method: 'get'
    });
};
/**
 * 查询申请
 * @param id
 */
export const listByPage = (query?: CompanyFieldApplyQuery) => {
    return request({
        url: '/smarttrace/companyFieldApply/listByPage',
        method: 'get',
        params:query
    });
};
/**
 * 删除企业字段修改申请
 * @param id
 */
export const approvalCpyField = (data?: ApprovalForm) => {
  return request({
      url: '/approval/approvalCpyField',
      method: 'post',
      data
  });
};
