diff --git a/pc4mobx/organization/apis/company.js b/pc4mobx/organization/apis/company.js index ccc6838..74e71e4 100644 --- a/pc4mobx/organization/apis/company.js +++ b/pc4mobx/organization/apis/company.js @@ -1,40 +1,20 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request' export const getSearchList = (params) => { - return fetch('/api/bs/hrmorganization/comp/listComp', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/comp/listComp', params); } export const getDeptListByPid = (params) => { - return fetch('/api/bs/hrmorganization/dept/getDeptListByPid', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/dept/getDeptListByPid', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/comp/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/comp/deleteByIds',params); } export const getAdvanceSearchCondition = (params) => { @@ -59,25 +39,11 @@ export const editResource = (params) => { } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/comp/updateForbiddenTagById',params); } export const move = (params) => { - return fetch('/api/bs/hrmorganization/comp/moveCompany', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/comp/moveCompany',params); } export const getCompanyForm = (params) => { diff --git a/pc4mobx/organization/apis/department.js b/pc4mobx/organization/apis/department.js index 3a0f813..c896338 100644 --- a/pc4mobx/organization/apis/department.js +++ b/pc4mobx/organization/apis/department.js @@ -1,28 +1,14 @@ - import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request' export const getSearchList = (params) => { - return fetch('/api/bs/hrmorganization/dept/listPage', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/dept/listPage', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/dept/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/dept/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -58,36 +44,15 @@ export const add = (params) => { } export const copy = (params) => { - return fetch('/api/bs/hrmorganization/dept/copyDepartment', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/dept/copyDepartment',params); } export const merge = (params) => { - return fetch('/api/bs/hrmorganization/dept/mergeDepartment', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/dept/mergeDepartment', params); } export const transfer = (params) => { - return fetch('/api/bs/hrmorganization/dept/moveDepartment', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/dept/moveDepartment', params); } export const editResource = (params) => { @@ -95,14 +60,7 @@ export const editResource = (params) => { } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/dept/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/dept/updateForbiddenTagById', params); } export const getDeptForm = (params) => { diff --git a/pc4mobx/organization/apis/fieldDefined.js b/pc4mobx/organization/apis/fieldDefined.js index 122308d..55f2647 100644 --- a/pc4mobx/organization/apis/fieldDefined.js +++ b/pc4mobx/organization/apis/fieldDefined.js @@ -1,124 +1,62 @@ import { WeaTools } from 'ecCom'; +import {postFetch} from '../util/request' /** * 获取tab数据 * @param {Object} params [description] * @return {[type]} [description] */ - export const getHasRight = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getHasRight`, 'GET', params) + export const getHasRight = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getHasRight`, 'GET', params); -export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTabInfo`, 'GET', params) +export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTabInfo`, 'GET', params); -export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params) +export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params); export const saveFieldDefinedInfo = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`,params); } export const removeFieldDefinedInfo = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/del`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/del`, params); } export const saveGroupInfo = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, params); } export const saveGroupSettingInfo = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveGroup`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveGroup`, params); } export const changeTypeInfo = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, params); } export const removeGroupInfo = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTitle`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTitle`, params); } -export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params) +export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params); export const saveTree = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTree`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTree`, params); } export const deleteTree = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTree`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTree`, params); } export const changeGroup = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeGroup`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeGroup`, params); } -export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params) +export const getEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/getEncryptFieldSettingForm`, 'GET', params); -export const saveEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/saveEncryptFieldSettingForm`, 'POST', params) +export const saveEncryptFieldSettingForm = (params = {}) => WeaTools.callApi(`/api/encrypt/fieldsetting/saveEncryptFieldSettingForm`, 'POST', params); //获取字段可查看范围列表 export const getEncryptFieldScopeList = (params = {}) => WeaTools.callApi('/api/encrypt/fieldsetting/getEncryptFieldScopeList', 'POST', params); diff --git a/pc4mobx/organization/apis/group.js b/pc4mobx/organization/apis/group.js index f5fe312..8ffb8cf 100644 --- a/pc4mobx/organization/apis/group.js +++ b/pc4mobx/organization/apis/group.js @@ -1,18 +1,11 @@ - import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request' export const edit = (params) => { - return fetch('/api/bs/hrmorganization/group/updateGroup', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/group/updateGroup',params); } export const getTabInfo = (params) => { diff --git a/pc4mobx/organization/apis/job.js b/pc4mobx/organization/apis/job.js index 0230814..1ee7d43 100644 --- a/pc4mobx/organization/apis/job.js +++ b/pc4mobx/organization/apis/job.js @@ -1,28 +1,15 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { - return fetch('/api/bs/hrmorganization/job/listPage', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/job/listPage', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/job/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/job/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -42,25 +29,11 @@ export const refresh = (params) => { } export const add = (params) => { - return fetch('/api/bs/hrmorganization/job/saveBaseForm', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/job/saveBaseForm', params); } export const copy = (params) => { - return fetch('/api/bs/hrmorganization/job/copyJobItem', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/job/copyJobItem', params); } export const editResource = (params) => { @@ -68,14 +41,7 @@ export const editResource = (params) => { } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/job/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/job/updateForbiddenTagById', params); } export const getJobForm = (params) => { @@ -103,12 +69,5 @@ export const getMergeForm = (params = {}) => { } export const merge = (params) => { - return fetch('/api/bs/hrmorganization/job/mergeJob', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/job/mergeJob', params); } \ No newline at end of file diff --git a/pc4mobx/organization/apis/jobgrade.js b/pc4mobx/organization/apis/jobgrade.js index 8109602..36ace96 100644 --- a/pc4mobx/organization/apis/jobgrade.js +++ b/pc4mobx/organization/apis/jobgrade.js @@ -1,20 +1,14 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request' export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/grade/getGradeTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/grade/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/grade/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -22,36 +16,15 @@ export const getAdvanceSearchCondition = (params) => { } export const add = (params) => { - return fetch('/api/bs/hrmorganization/grade/saveGrade', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/grade/saveGrade', params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/grade/updateGrade', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/grade/updateGrade', params); } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/grade/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/grade/updateForbiddenTagById', params); } export const getGradeForm = (params) => { @@ -62,7 +35,6 @@ export const getTabInfo = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/grade/getTabInfo', 'GET', params); } - export const getHasRight = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/grade/getHasRight', 'GET', params); } diff --git a/pc4mobx/organization/apis/joblevel.js b/pc4mobx/organization/apis/joblevel.js index 8fb9365..c9db26a 100644 --- a/pc4mobx/organization/apis/joblevel.js +++ b/pc4mobx/organization/apis/joblevel.js @@ -1,21 +1,15 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/level/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/level/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -23,36 +17,15 @@ export const getAdvanceSearchCondition = (params) => { } export const add = (params) => { - return fetch('/api/bs/hrmorganization/level/saveLevel', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/level/saveLevel',params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/level/updateLevel', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/level/updateLevel', params); } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/level/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/level/updateForbiddenTagById', params); } export const getLevelForm = (params) => { diff --git a/pc4mobx/organization/apis/managerDetach.js b/pc4mobx/organization/apis/managerDetach.js index 79b9766..4726d55 100644 --- a/pc4mobx/organization/apis/managerDetach.js +++ b/pc4mobx/organization/apis/managerDetach.js @@ -1,7 +1,8 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/detach/getTable', 'GET', params); @@ -24,37 +25,16 @@ export const doDetachSwitch = (params) => { } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/detach/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/detach/deleteByIds', params); } export const add = (params) => { - return fetch('/api/bs/hrmorganization/detach/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/detach/save', params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/detach/update', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/detach/update',params); } diff --git a/pc4mobx/organization/apis/rankscheme.js b/pc4mobx/organization/apis/rankscheme.js index f196220..a8e3df3 100644 --- a/pc4mobx/organization/apis/rankscheme.js +++ b/pc4mobx/organization/apis/rankscheme.js @@ -1,22 +1,15 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/scheme/getTable', 'GET', params); } export const deleteTableData = (params) => { - //return WeaTools.callApi('/api/bs/hrmorganization/scheme/deleteByIds', 'POST', params); - return fetch('/api/bs/hrmorganization/scheme/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/scheme/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -24,37 +17,15 @@ export const getAdvanceSearchCondition = (params) => { } export const add = (params) => { - //return WeaTools.callApi('/api/bs/hrmorganization/scheme/save', 'POST', params); - return fetch('/api/bs/hrmorganization/scheme/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/scheme/save', params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/scheme/updateScheme', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/scheme/updateScheme',params); } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/scheme/updateForbiddenTagById',params); } export const getSchemeForm = (params) => { diff --git a/pc4mobx/organization/apis/resource.js b/pc4mobx/organization/apis/resource.js index d8a8aeb..18143aa 100644 --- a/pc4mobx/organization/apis/resource.js +++ b/pc4mobx/organization/apis/resource.js @@ -1,7 +1,8 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/listPage', 'GET', params); @@ -12,14 +13,7 @@ export const getAdvanceSearchCondition = (params) => { } export const add = (params) => { - return fetch('/api/bs/hrmorganization/hrmresource/saveBaseForm', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/hrmresource/saveBaseForm', params); } @@ -62,37 +56,16 @@ export const exportResource = (ids) => { export const saveSearchTemplate = (params) => { - return fetch('/api/bs/hrmorganization/hrmresource/saveSearchTemplate', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/hrmresource/saveSearchTemplate', params); } export const saveCustomTemplate = (params) => { - return fetch('/api/bs/hrmorganization/hrmresource/saveCustomTemplate', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/hrmresource/saveCustomTemplate', params); } export const deleteSearchTemplate = (params) => { - return fetch('/api/bs/hrmorganization/hrmresource/deleteSearchTemplate', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/hrmresource/deleteSearchTemplate', params); } export const getSearchTemplate = (params) => { diff --git a/pc4mobx/organization/apis/resourceBasicInfo.js b/pc4mobx/organization/apis/resourceBasicInfo.js index fd06371..fe7a460 100644 --- a/pc4mobx/organization/apis/resourceBasicInfo.js +++ b/pc4mobx/organization/apis/resourceBasicInfo.js @@ -1,32 +1,19 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/resourceBasicInfo/delete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/resourceBasicInfo/delete', params); } export const recoverData = (params) => { - return fetch('/api/bs/hrmorganization/resourceBasicInfo/recover', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/resourceBasicInfo/recover', params); } export const getAdvanceSearchCondition = (params) => { @@ -34,36 +21,15 @@ export const getAdvanceSearchCondition = (params) => { } export const addType = (params) => { - return fetch('/api/bs/hrmorganization/resourceBasicInfo/saveResourceItemClass', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/resourceBasicInfo/saveResourceItemClass', params); } export const editType = (params) => { - return fetch('/api/bs/hrmorganization/resourceBasicInfo/updateResourceItemClass', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/resourceBasicInfo/updateResourceItemClass', params); } export const deleteType = (params) => { - return fetch('/api/bs/hrmorganization/resourceBasicInfo/deleteResourceItemClass', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/resourceBasicInfo/deleteResourceItemClass', params); } export const getTypeForm = (params) => { @@ -72,25 +38,11 @@ export const getTypeForm = (params) => { export const add = (params) => { - return fetch('/api/bs/hrmorganization/resourceBasicInfo/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/resourceBasicInfo/save', params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/resourceBasicInfo/update', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/resourceBasicInfo/update', params); } export const getForm = (params) => { diff --git a/pc4mobx/organization/apis/sequence.js b/pc4mobx/organization/apis/sequence.js index 97d0cd3..4a072ea 100644 --- a/pc4mobx/organization/apis/sequence.js +++ b/pc4mobx/organization/apis/sequence.js @@ -1,21 +1,15 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/sequence/getSequenceTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/sequence/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/sequence/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -23,36 +17,15 @@ export const getAdvanceSearchCondition = (params) => { } export const add = (params) => { - return fetch('/api/bs/hrmorganization/sequence/saveSequence', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/sequence/saveSequence', params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/sequence/updateSequence', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/sequence/updateSequence', params); } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/sequence/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/sequence/updateForbiddenTagById', params); } export const getSequenceForm = (params) => { diff --git a/pc4mobx/organization/apis/staff.js b/pc4mobx/organization/apis/staff.js index adc688e..b12b33b 100644 --- a/pc4mobx/organization/apis/staff.js +++ b/pc4mobx/organization/apis/staff.js @@ -1,21 +1,15 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/staff/getTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/staff/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/staff/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -23,25 +17,11 @@ export const getAdvanceSearchCondition = (params) => { } export const add = (params) => { - return fetch('/api/bs/hrmorganization/staff/saveStaff', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/staff/saveStaff', params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/staff/updateStaff', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/staff/updateStaff', params); } export const getForm = (params) => { diff --git a/pc4mobx/organization/apis/staffscheme.js b/pc4mobx/organization/apis/staffscheme.js index 4b866ba..0bd5ab9 100644 --- a/pc4mobx/organization/apis/staffscheme.js +++ b/pc4mobx/organization/apis/staffscheme.js @@ -1,21 +1,15 @@ import { WeaTools -} from 'ecCom' +} from 'ecCom'; +import {postFetch} from '../util/request'; export const getSearchList = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/staffplan/getTable', 'GET', params); } export const deleteTableData = (params) => { - return fetch('/api/bs/hrmorganization/staffplan/deleteByIds', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/staffplan/deleteByIds', params); } export const getAdvanceSearchCondition = (params) => { @@ -23,36 +17,15 @@ export const getAdvanceSearchCondition = (params) => { } export const add = (params) => { - return fetch('/api/bs/hrmorganization/staffplan/saveStaffPlan', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/staffplan/saveStaffPlan', params); } export const edit = (params) => { - return fetch('/api/bs/hrmorganization/staffplan/updateStaffPlan', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/staffplan/updateStaffPlan', params); } export const updateForbiddenTag = (params) => { - return fetch('/api/bs/hrmorganization/staffplan/updateForbiddenTagById', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) + return postFetch('/api/bs/hrmorganization/staffplan/updateForbiddenTagById', params); } export const getSchemeForm = (params) => { diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index 9796de3..1f2d824 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -83,9 +83,7 @@ export class CompanyStore { ...this.form.getFormParams(), }; } - Api.getSearchList(params).then(response => { - return response.json() - }).then(res => { + Api.getSearchList(params).then(res => { if (res.code === 200) { this.setHasRight(res.data.hasRight); res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); @@ -105,9 +103,7 @@ export class CompanyStore { let params = { parentComp: id } - Api.getDeptListByPid(params).then(response => { - return response.json() - }).then(res => { + Api.getDeptListByPid(params).then(res => { if (res.code === 200) { res.data.list && this.setDeptDataSource(res.data.list); res.data.columns && this.setDeptColumns(res.data.columns); @@ -125,9 +121,7 @@ export class CompanyStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.setSelectedRowKeys([]); @@ -145,9 +139,7 @@ export class CompanyStore { canceled: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -213,9 +205,7 @@ export class CompanyStore { id: id, ...this.form2.getFormParams(), }; - Api.move(params).then(response => { - return response.json() - }).then(data => { + Api.move(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); diff --git a/pc4mobx/organization/stores/department.js b/pc4mobx/organization/stores/department.js index 0c0b368..645ab1d 100644 --- a/pc4mobx/organization/stores/department.js +++ b/pc4mobx/organization/stores/department.js @@ -92,9 +92,7 @@ export class DepartmentStore { ...this.form.getFormParams(), }; } - Api.getSearchList(params).then(response => { - return response.json() - }).then(res => { + Api.getSearchList(params).then(res => { if (res.code === 200) { this.setHasRight(res.data.hasRight); res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); @@ -139,9 +137,7 @@ export class DepartmentStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.setSelectedRowKeys([]); @@ -159,9 +155,7 @@ export class DepartmentStore { canceled: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg, 1); this.getTableInfo(); @@ -292,9 +286,7 @@ export class DepartmentStore { }; this.form1.validateForm().then(f => { if (f.isValid) { - Api.merge(params).then(response => { - return response.json() - }).then(data => { + Api.merge(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -319,9 +311,7 @@ export class DepartmentStore { }; this.form1.validateForm().then(f => { if (f.isValid) { - Api.transfer(params).then(response => { - return response.json() - }).then(data => { + Api.transfer(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -344,9 +334,7 @@ export class DepartmentStore { ids: this.ids, ...this.form2.getFormParams() }; - Api.copy(params).then(response => { - return response.json() - }).then(data => { + Api.copy(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js index ebe72a2..a5fcbf2 100644 --- a/pc4mobx/organization/stores/fieldDefined.js +++ b/pc4mobx/organization/stores/fieldDefined.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-06-09 10:16:00 - * @LastEditTime: 2022-11-08 16:43:10 + * @LastEditTime: 2023-11-14 15:20:03 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js */ @@ -732,9 +732,7 @@ this.spinning = false; if (this.selectedTreeNodeInfo != null) params.groupType = this.selectedTreeNodeInfo.key - api.removeGroupInfo(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.removeGroupInfo(this.moduleName, params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.tabConfig.activeTabKey = '1'; @@ -878,9 +876,7 @@ this.spinning = false; ...this.formTarget.typeInfoFrom.getFormParams(), id: this.selectedTreeNodeInfo.domid } - api.changeTypeInfo(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.changeTypeInfo(this.moduleName, params).then(data => { if (data.code === 200) { this.setDialogVisible('editTypeInfo', false, ''); this.getTree() @@ -921,9 +917,7 @@ this.spinning = false; if (this.selectedTreeNodeInfo != null) params.groupType = this.selectedTreeNodeInfo.key - api.saveGroupInfo(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.saveGroupInfo(this.moduleName, params).then(data => { if (data.code === 200) { this.setDialogVisible('editGroupInfo', false, ''); if (this.moveToGroup) { @@ -1019,9 +1013,7 @@ this.spinning = false; return; } - api.saveFieldDefinedInfo(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.saveFieldDefinedInfo(this.moduleName, params).then(data => { if (data.code === 200) { message.success(i18n.message.saveSuccess()); this.getTabInfoByTreeNode(); @@ -1272,9 +1264,7 @@ this.spinning = false; } params.data = dataObj; - api.saveGroupSettingInfo(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.saveGroupSettingInfo(this.moduleName, params).then(data => { if (data.code === 200) { this.setDialogVisible('groupInfoSetting', false, ''); this.getTabInfoByTreeNode(false, true); @@ -1762,9 +1752,7 @@ this.spinning = false; id: this.selectedTreeNodeInfo.domid } - api.deleteTree(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.deleteTree(this.moduleName, params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTree(() => { @@ -1831,9 +1819,7 @@ this.spinning = false; parentId } - api.saveTree(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.saveTree(this.moduleName, params).then(data => { if (data.code === 200) { this.setDialogVisible('childInfoSetting', false, ''); this.getTree(); @@ -1900,9 +1886,7 @@ this.spinning = false; } @action doChangeGroup = (params) => { - api.changeGroup(this.moduleName, params).then(response => { - return response.json() - }).then(data => { + api.changeGroup(this.moduleName, params).then(data => { if (data.code === 200) { message.success(i18n.message.moveSuccess()); this.getTabInfoByTreeNode(); diff --git a/pc4mobx/organization/stores/group.js b/pc4mobx/organization/stores/group.js index 8cbaed4..860e8e5 100644 --- a/pc4mobx/organization/stores/group.js +++ b/pc4mobx/organization/stores/group.js @@ -90,9 +90,7 @@ export class GroupStore { let params = { ...this.form.getFormParams(), id: 1 }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { this.getGroupForm(); message.success(data.msg); diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js index 5555b1c..7025e12 100644 --- a/pc4mobx/organization/stores/job.js +++ b/pc4mobx/organization/stores/job.js @@ -96,9 +96,7 @@ export class JobStore { ...this.form.getFormParams(), }; } - Api.getSearchList(params).then(response => { - return response.json() - }).then(res => { + Api.getSearchList(params).then(res => { if (res.code === 200) { this.setHasRight(res.data.hasRight); res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns); @@ -142,9 +140,7 @@ export class JobStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.setSelectedRowKeys([]); @@ -175,9 +171,7 @@ export class JobStore { forbiddenTag: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg, 1); this.getTableInfo(); @@ -268,9 +262,7 @@ export class JobStore { }; this.form1.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -294,9 +286,7 @@ export class JobStore { ids: this.ids, ...this.form2.getFormParams() }; - Api.copy(params).then(response => { - return response.json() - }).then(data => { + Api.copy(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -314,9 +304,7 @@ export class JobStore { id: id, ...this.form2.getFormParams() }; - Api.merge(params).then(response => { - return response.json() - }).then(data => { + Api.merge(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); diff --git a/pc4mobx/organization/stores/jobgrade.js b/pc4mobx/organization/stores/jobgrade.js index c4e27c0..654db2b 100644 --- a/pc4mobx/organization/stores/jobgrade.js +++ b/pc4mobx/organization/stores/jobgrade.js @@ -137,9 +137,7 @@ export class JobGradeStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTableInfo(); @@ -157,9 +155,7 @@ export class JobGradeStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -181,9 +177,7 @@ export class JobGradeStore { let params = { ...this.form.getFormParams(), id: this.gradeId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); @@ -206,9 +200,7 @@ export class JobGradeStore { forbiddenTag: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); diff --git a/pc4mobx/organization/stores/joblevel.js b/pc4mobx/organization/stores/joblevel.js index f164ef1..700d03d 100644 --- a/pc4mobx/organization/stores/joblevel.js +++ b/pc4mobx/organization/stores/joblevel.js @@ -124,9 +124,7 @@ export class JobLevelStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTableInfo(); @@ -144,9 +142,7 @@ export class JobLevelStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -168,9 +164,7 @@ export class JobLevelStore { let params = { ...this.form.getFormParams(), id: this.levelId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); @@ -198,9 +192,7 @@ export class JobLevelStore { forbiddenTag: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); diff --git a/pc4mobx/organization/stores/managerDetach.js b/pc4mobx/organization/stores/managerDetach.js index 3af8f26..c9a12eb 100644 --- a/pc4mobx/organization/stores/managerDetach.js +++ b/pc4mobx/organization/stores/managerDetach.js @@ -78,9 +78,7 @@ export class ManagerDetachStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { this.getTableInfo(); message.success(i18n.message.deleteSuccess()); @@ -99,9 +97,7 @@ export class ManagerDetachStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -123,9 +119,7 @@ export class ManagerDetachStore { let params = { ...this.form.getFormParams(), id: this.detachId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js index ecd5cc0..3722583 100644 --- a/pc4mobx/organization/stores/rankscheme.js +++ b/pc4mobx/organization/stores/rankscheme.js @@ -84,9 +84,7 @@ export class RankSchemeStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { this.getTableInfo(); message.success(i18n.message.deleteSuccess()); @@ -105,9 +103,7 @@ export class RankSchemeStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -129,9 +125,7 @@ export class RankSchemeStore { let params = { ...this.form.getFormParams(), id: this.schemeId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); @@ -154,9 +148,7 @@ export class RankSchemeStore { forbiddenTag: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); diff --git a/pc4mobx/organization/stores/reserouseBasicInfo.js b/pc4mobx/organization/stores/reserouseBasicInfo.js index f409350..b9fc984 100644 --- a/pc4mobx/organization/stores/reserouseBasicInfo.js +++ b/pc4mobx/organization/stores/reserouseBasicInfo.js @@ -122,9 +122,7 @@ export class ResourceBasicInfoStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTableInfo(); @@ -138,9 +136,7 @@ export class ResourceBasicInfoStore { //删除类型 deleteType() { - Api.deleteType(this.selectedTreeNodeInfo.domid).then(response => { - return response.json() - }).then(data => { + Api.deleteType(this.selectedTreeNodeInfo.domid).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTree(); @@ -158,9 +154,7 @@ export class ResourceBasicInfoStore { let params = { ids: id }; - Api.recoverData(params).then(response => { - return response.json() - }).then(data => { + Api.recoverData(params).then(data => { if (data.code === 200) { message.success(i18n.message.opSuccess()); this.getTableInfo(); @@ -178,9 +172,7 @@ export class ResourceBasicInfoStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -205,9 +197,7 @@ export class ResourceBasicInfoStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.addType(params).then(response => { - return response.json() - }).then(data => { + Api.addType(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTree(); @@ -230,9 +220,7 @@ export class ResourceBasicInfoStore { let params = { ...this.form.getFormParams(), fid: this.fId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -254,9 +242,7 @@ export class ResourceBasicInfoStore { let params = { ...this.form.getFormParams(), fid: this.selectedTreeNodeInfo.domid }; this.form.validateForm().then(f => { if (f.isValid) { - Api.editType(params).then(response => { - return response.json() - }).then(data => { + Api.editType(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTree(); diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js index 27da720..3190ed1 100644 --- a/pc4mobx/organization/stores/resource.js +++ b/pc4mobx/organization/stores/resource.js @@ -157,9 +157,7 @@ export class ResourceStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg,1); this.getTableInfo(); @@ -423,9 +421,7 @@ export class ResourceStore { fields: fields.toString() } - Api.saveSearchTemplate(params).then(response => { - return response.json() - }).then(data => { + Api.saveSearchTemplate(params).then(data => { if (data.code === 200) { this.searchTemplateId = data.data; this.setPanelStatus(true); @@ -447,9 +443,7 @@ export class ResourceStore { showname: this.customTemplateName, fields: this.transfer.transferKeys.toString() } - Api.saveCustomTemplate(params).then(response => { - return response.json() - }).then(data => { + Api.saveCustomTemplate(params).then(data => { if (data.code === 200) { this.customTemplateId = data.data; this.getSearchTemplate(false); @@ -470,9 +464,7 @@ export class ResourceStore { if (this.searchTemplateId == -1) { return message.error("默认模板不可删除"); } - Api.deleteSearchTemplate({ id: this.searchTemplateId }).then(response => { - return response.json() - }).then(data => { + Api.deleteSearchTemplate({ id: this.searchTemplateId }).then(data => { if (data.code === 200) { message.success(data.msg); this.searchTemplateId = '-1'; diff --git a/pc4mobx/organization/stores/sequence.js b/pc4mobx/organization/stores/sequence.js index fb7481d..e069211 100644 --- a/pc4mobx/organization/stores/sequence.js +++ b/pc4mobx/organization/stores/sequence.js @@ -88,9 +88,7 @@ export class SequenceStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTableInfo(); @@ -108,9 +106,7 @@ export class SequenceStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -132,9 +128,7 @@ export class SequenceStore { let params = { ...this.form.getFormParams(), id: this.sequenceId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); @@ -162,9 +156,7 @@ export class SequenceStore { forbiddenTag: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); diff --git a/pc4mobx/organization/stores/staff.js b/pc4mobx/organization/stores/staff.js index 3bfa854..da43c05 100644 --- a/pc4mobx/organization/stores/staff.js +++ b/pc4mobx/organization/stores/staff.js @@ -92,9 +92,7 @@ export class StaffStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTableInfo(); @@ -113,9 +111,7 @@ export class StaffStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -137,9 +133,7 @@ export class StaffStore { let params = { ...this.form.getFormParams(), id: this.staffId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); diff --git a/pc4mobx/organization/stores/staffscheme.js b/pc4mobx/organization/stores/staffscheme.js index 3b6d1eb..83bfc66 100644 --- a/pc4mobx/organization/stores/staffscheme.js +++ b/pc4mobx/organization/stores/staffscheme.js @@ -86,9 +86,7 @@ export class StaffSchemeStore { let params = { ids: this.ids }; - Api.deleteTableData(params).then(response => { - return response.json() - }).then(data => { + Api.deleteTableData(params).then(data => { if (data.code === 200) { message.success(i18n.message.deleteSuccess()); this.getTableInfo(); @@ -107,9 +105,7 @@ export class StaffSchemeStore { }; this.form.validateForm().then(f => { if (f.isValid) { - Api.add(params).then(response => { - return response.json() - }).then(data => { + Api.add(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(); @@ -131,9 +127,7 @@ export class StaffSchemeStore { let params = { ...this.form.getFormParams(), id: this.schemeId }; this.form.validateForm().then(f => { if (f.isValid) { - Api.edit(params).then(response => { - return response.json() - }).then(data => { + Api.edit(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); @@ -156,9 +150,7 @@ export class StaffSchemeStore { forbiddenTag: checked, id: id } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { + Api.updateForbiddenTag(params).then(data => { if (data.code === 200) { message.success(data.msg); this.getTableInfo(true); diff --git a/pc4mobx/organization/util/request.js b/pc4mobx/organization/util/request.js new file mode 100644 index 0000000..9e18a7b --- /dev/null +++ b/pc4mobx/organization/util/request.js @@ -0,0 +1,42 @@ +const server = window.server || ''; +export const postFetch = (url, params) => { + if (typeof localStorage.access_token === "string" && localStorage.access_token !== "") { + params.access_token = localStorage.access_token; + } + url = server + url + "?__random__=" + (new Date()).valueOf(); + return fetch(url, getFetchParams("POST", params)).then(res => res.json()); + }; + + export const getFd = (values) => { + let fd = {}; + for (let p in values) { + values[p] = _.isNil(values[p]) ? "" : values[p]; + let item = values[p]; + if (window.E9Encrypt && __AESEcrypt__) item = __AESEcrypt__.aes_data_encrypt(item); + fd = { ...fd, [p]: item }; + } + if (window.E9Encrypt && __AESEcrypt__) { + fd = { ...fd, rsaAes01: __AESEcrypt__.get_rsa_aes_01(), rsaAes02: __AESEcrypt__.get_rsa_aes_02() }; + } + return fd; + }; + + const getFetchParams = (method, params, header = {}) => { + let obj = { + method, mode: "cors", + headers: { + "Content-Type": "application/json", + "X-Requested-With": "XMLHttpRequest", + ...header + } + }; + if (server === "") { + obj.credentials = "include"; + } + if (!_.isEmpty(params) && Object.prototype.toString.call(params) === "[object Object]") { + obj.body = JSON.stringify(getFd(params)); + } else { + obj.body = JSON.stringify(params); + } + return obj; + }; \ No newline at end of file