| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- import { defHttp } from '/@/utils/http/axios';
- import { Modal } from 'ant-design-vue';
- enum Api {
- list = '/ventanaly/quartzJob/list',
- save = '/ventanaly/quartzJob/add',
- edit = '/ventanaly/quartzJob/edit',
- get = '/ventanaly/quartzJob/queryById',
- pause = '/ventanaly/quartzJob/pause',
- resume = '/ventanaly/quartzJob/resume',
- delete = '/ventanaly/quartzJob/delete',
- dataCenterDelete = '/ventanaly-collect/collect/quartzJob/delete',
- exportXlsUrl = '/ventanaly/quartzJob/exportXls',
- importExcelUrl = '/ventanaly/quartzJob/importExcel',
- execute = '/ventanaly/quartzJob/execute',
- deleteBatch = '/ventanaly-collect/collect/quartzJob/deleteBatch',
- //数据中心
- dataCenterList = '/dataCenter/ventanaly-collect/collect/quartzJob/list',
- // dataCentersave = '/dataCenter/ventanaly/quartzJob/add',
- // dataCenteredit = '/dataCenter/ventanaly/quartzJob/edit',
- }
- /**
- * 导出api
- */
- export const getExportUrl = Api.exportXlsUrl;
- /**
- * 导入api
- */
- export const getImportUrl = Api.importExcelUrl;
- /**
- * 查询任务列表
- * @param params
- */
- export const getQuartzList = (params) => {
- return defHttp.get({ url: Api.list, params });
- };
- /**
- * 保存或者更新任务
- * @param params
- */
- export const saveOrUpdateQuartz = (params, isUpdate) => {
- let url = isUpdate ? Api.edit : Api.save;
- return defHttp.post({ url: url, params });
- };
- /**
- * 查询任务详情
- * @param params
- */
- export const getQuartzById = (params) => {
- return defHttp.get({ url: Api.get, params });
- };
- /**
- * 删除任务
- * @param params
- */
- export const deleteQuartz = (params, handleSuccess) => {
- return defHttp.delete({ url: Api.delete, data: params }, { joinParamsToUrl: true }).then(() => {
- handleSuccess();
- });
- };
- /**
- * 启动
- * @param params
- */
- export const resumeJob = (params, handleSuccess) => {
- return defHttp.get({ url: Api.resume, params }).then(() => {
- handleSuccess();
- });
- };
- /**
- * 暂停
- * @param params
- */
- export const pauseJob = (params, handleSuccess) => {
- return defHttp.get({ url: Api.pause, params }).then(() => {
- handleSuccess();
- });
- };
- /**
- * 立即执行
- * @param params
- */
- export const executeImmediately = (params, handleSuccess) => {
- return defHttp.get({ url: Api.execute, params }).then(() => {
- handleSuccess();
- });
- };
- /**
- * 批量删除任务
- * @param params
- */
- export const batchDeleteQuartz = (params, handleSuccess) => {
- Modal.confirm({
- title: '确认删除',
- content: '是否删除选中数据',
- okText: '确认',
- cancelText: '取消',
- onOk: () => {
- return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
- handleSuccess();
- });
- },
- });
- };
- /**
- * 数据中心---获取定时任务列表
- * @param params
- */
- export const getDataCenterList = (params) =>
- defHttp.get({
- url: Api.dataCenterList,
- params,
- });
- /**
- * 查询任务详情
- * @param params
- */
- export const getDataCenterQuartzById = (params) => {
- return defHttp.get({
- url: Api.get,
- params,
- });
- };
- /**
- * 删除任务
- * @param params
- */
- export const deleteDataCenterQuartz = (params, handleSuccess) => {
- return defHttp
- .delete(
- {
- url: Api.dataCenterDelete,
- data: params,
- },
- { joinParamsToUrl: true }
- )
- .then(() => {
- handleSuccess();
- });
- };
- /**
- * 批量删除任务
- * @param params
- */
- export const batchDataCenterDeleteQuartz = (params, handleSuccess) => {
- Modal.confirm({
- title: '确认删除',
- content: '是否删除选中数据',
- okText: '确认',
- cancelText: '取消',
- onOk: () => {
- return defHttp
- .delete(
- {
- url: Api.deleteBatch,
- data: params,
- },
- { joinParamsToUrl: true }
- )
- .then(() => {
- handleSuccess();
- });
- },
- });
- };
- // // 定义可配置的控制接口
- function generateApiPath(moduleType, operation) {
- return `/dataCenter/${moduleType}/quartzJob/${operation}`;
- }
- // 启动作业接口
- export const resumeDataCenterJob = (params: any, sysType: string, operation: string, handleSuccess: () => void) => {
- const currentModule = sysType;
- const apiPath = generateApiPath(currentModule, operation);
- return defHttp
- .get({
- url: apiPath,
- params,
- })
- .then(() => {
- handleSuccess();
- });
- };
- // 停止作业接口
- export const pauseDataCenterJob = (params: any, sysType: String, operation: String, handleSuccess: () => void) => {
- const currentModule = sysType;
- const apiPath = generateApiPath(currentModule, operation);
- return defHttp
- .get({
- url: apiPath,
- params,
- })
- .then(() => {
- handleSuccess();
- });
- };
- // 立即执行作业接口
- export const excuteDataCenterJob = (params: any, sysType: String, operation: String, handleSuccess: () => void) => {
- const currentModule = sysType;
- const apiPath = generateApiPath(currentModule, operation);
- return defHttp
- .get({
- url: apiPath,
- params,
- })
- .then(() => {
- handleSuccess();
- });
- };
- /**
- * 保存或者更新任务
- * @param params
- */
- export const dataCenterUpdateQuartz = (params, sysType: String, operation: String) => {
- const currentModule = sysType;
- const apiPath = generateApiPath(currentModule, operation);
- return defHttp.post({
- url: apiPath,
- params,
- });
- };
- export const dataCenterSaveQuartz = (params, sysType: String, operation: String) => {
- const currentModule = sysType;
- const apiPath = generateApiPath(currentModule, operation);
- return defHttp.post({
- url: apiPath,
- params,
- });
- };
|