import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DesignDataFieldVO, DesignDataFieldForm, DesignDataFieldQuery } from '@/api/system/designDataField/types';

/**
 * 查询大屏设计数据字段列表
 * @param query
 * @returns {*}
 */

export const listDesignDataField = (query?: DesignDataFieldQuery): AxiosPromise<DesignDataFieldVO[]> => {
  return request({
    url: '/system/designDataField/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询大屏设计数据字段详细
 * @param dataFieldId
 */
export const getDesignDataField = (dataFieldId: string | number): AxiosPromise<DesignDataFieldVO> => {
  return request({
    url: '/system/designDataField/' + dataFieldId,
    method: 'get'
  });
};

/**
 * 新增大屏设计数据字段
 * @param data
 */
export const addDesignDataField = (data: DesignDataFieldForm) => {
  return request({
    url: '/system/designDataField',
    method: 'post',
    data: data
  });
};

/**
 * 修改大屏设计数据字段
 * @param data
 */
export const updateDesignDataField = (data: DesignDataFieldForm) => {
  return request({
    url: '/system/designDataField',
    method: 'put',
    data: data
  });
};

/**
 * 删除大屏设计数据字段
 * @param dataFieldId
 */
export const delDesignDataField = (dataFieldId: string | number | Array<string | number>) => {
  return request({
    url: '/system/designDataField/' + dataFieldId,
    method: 'delete'
  });
};


/**
 * 下拉框查询大屏设计数据字段列表
 * @param query
 * @returns {*}
 */
export function getSysDesignDataFieldList (query) {
    return request({
        url: '/system/designDataField/getSysDesignDataFieldList',
        method: 'get',
        params: query
    });
};
