From 9d749ee09e96b3325992a7df538cb9402471146f Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Tue, 21 Mar 2023 14:04:15 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E9=87=87=E9=9B=86=E4=BB=BB=E5=8A=A1action?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metadataAcquisition/actions/dataSource.js | 6 +- .../metadataAcquisition/actions/index.js | 5 +- .../metadataAcquisition/actions/task.js | 56 +++++++++++++++++++ web/client/src/utils/webapi.js | 6 +- 4 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 web/client/src/sections/metadataAcquisition/actions/task.js diff --git a/web/client/src/sections/metadataAcquisition/actions/dataSource.js b/web/client/src/sections/metadataAcquisition/actions/dataSource.js index a9c0746..6467ef4 100644 --- a/web/client/src/sections/metadataAcquisition/actions/dataSource.js +++ b/web/client/src/sections/metadataAcquisition/actions/dataSource.js @@ -23,7 +23,7 @@ export function getDataSources(query) { query: query || {}, actionType: 'GET_ACQ_DATASOURCES', url: `${ApiTable.getDataSources}`, - msg: { error: '获取适配器列表失败' }, + msg: { error: '获取数据源列表失败' }, reducer: { name: 'datasources' } }); } @@ -35,7 +35,7 @@ export function deleteDataSource(id) { actionType: 'DELETE_ACQ_DATASOURCE', url: ApiTable.modifyDataSource.replace('{id}', id), msg: { - option: '模型删除', + option: '数据源删除', }, }); } @@ -48,7 +48,7 @@ export function modifyDataSource(id, params, msg) { actionType: 'MODIFY_ACQ_DATASOURCE', url: ApiTable.modifyDataSource.replace('{id}', id), msg: { - option: msg || '模型编辑', + option: msg || '数据源编辑', }, }); } diff --git a/web/client/src/sections/metadataAcquisition/actions/index.js b/web/client/src/sections/metadataAcquisition/actions/index.js index e6377ed..115de9b 100644 --- a/web/client/src/sections/metadataAcquisition/actions/index.js +++ b/web/client/src/sections/metadataAcquisition/actions/index.js @@ -3,9 +3,10 @@ import * as example from './example' import * as adapter from './adapter' import * as dataSource from './dataSource' - +import * as task from './task'; export default { ...example, ...adapter, - ...dataSource + ...dataSource, + ...task } \ No newline at end of file diff --git a/web/client/src/sections/metadataAcquisition/actions/task.js b/web/client/src/sections/metadataAcquisition/actions/task.js new file mode 100644 index 0000000..d940619 --- /dev/null +++ b/web/client/src/sections/metadataAcquisition/actions/task.js @@ -0,0 +1,56 @@ +'use strict'; + +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function addTask(params, msg) { + return (dispatch) => basicAction({ + type: 'post', + data: params, + dispatch, + actionType: 'ADD_DATSOURCE', + url: ApiTable.addTask, + msg: { + option: msg || '新增采集任务', + }, + }); +} + +export function getTasks(query) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + query: query || {}, + actionType: 'GET_ACQ_TASKS', + url: `${ApiTable.getTasks}`, + msg: { error: '获取采集任务列表失败' }, + reducer: { name: 'tasks' } + }); +} + +export function deleteTask(id) { + return (dispatch) => basicAction({ + type: 'del', + dispatch, + actionType: 'DELETE_ACQ_TASK', + url: ApiTable.modifyTask.replace('{id}', id), + msg: { + option: '采集任务删除', + }, + }); +} + +export function modifyTask(id, params, msg) { + return (dispatch) => basicAction({ + type: 'put', + data: params, + dispatch, + actionType: 'MODIFY_ACQ_TASK', + url: ApiTable.modifyTask.replace('{id}', id), + msg: { + option: msg || '采集任务编辑', + }, + }); +} + + diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index cc0bc84..1c17926 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -31,9 +31,9 @@ export const ApiTable = { modifyDataSource: 'acq/dataSource/{id}', //元数据采集-采集任务管理 - addDataSource: 'meta/acq/task', - getDataSources: 'meta/acq/tasks', - modifyDataSource: 'acq/task/{id}', + addTask: 'meta/acq/task', + getTasks: 'meta/acq/tasks', + modifyTask: 'acq/task/{id}', };