import request from '@/config/axios';
import type { TableData } from './types';

/** 获取表格数据 */
export const getCsckBusinessSystemListApi = (data: any) => {
  return request.postJson({ url: '/csck/spi/csck/CsckWorkFlow/CsckWorkFlowQuery', data});
};

/** 获取子表格数据 */
export const getCsckWorkFlowSubTable = (data: any) => {
  return request.postJson({ url: '/csck/spi/csck/CsckWorkFlow/CsckWorkFlowSubTable', data});
};

/** 提交/驳回 */
export const saveCsckBusinessSystemApi = (data: Partial<TableData>): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckWorkFlow/CsckWorkFlowDeal', data });
};

/** 查询单条数据 */
export const queryCsckBusinessSystemApi = (systemCode: string | number, systemVersion: string): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckBusinessSystem/CsckBusinessSystemQueryOne', data: { systemCode, systemVersion } });
};

/** 获取提交时按钮状态 */
export const getWorkFlowVisiableButton = (systemGroup: string): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckWorkFlow/CsckWorkFlowVisiableButton', data: { systemGroup } });
};

export const queryCsckWorkFlowApi = (data: { systemGroup?: string; dataDate?: string; organCode?: string }): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckWorkFlow/CsckWorkFlowQueryOne', data });
};

export const queryCsckWorkFlowBatchApi = (data: { dbList: { orgCode?: string; dataDate?: string; pkid?: string;systemGroupName?:string}[] }): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckWorkFlow/CsckWorkFlowQueryBatchState', data });
};