提交 1f177946 authored 作者: 钟是志's avatar 钟是志

优化一站式应用获取应用id 的方法

上级 bb5e6adc
...@@ -7,7 +7,11 @@ ...@@ -7,7 +7,11 @@
import { uaaRequest } from './one_stop_public/utils/request'; import { uaaRequest } from './one_stop_public/utils/request';
import config from '@/config/config'; import config from '@/config/config';
import { setOneStopActiveMenusConfig, setOneStopConfig } from '@/webPublic/zyd_public/utils/utils'; import {
getOneStopConfig,
setOneStopActiveMenusConfig,
setOneStopConfig,
} from '@/webPublic/zyd_public/utils/utils';
import { getOneStopConfigList } from '@/webPublic/one_stop_public/publicServices'; import { getOneStopConfigList } from '@/webPublic/one_stop_public/publicServices';
import prepareShow from '@/webPublic/one_stop_public/Table/prepareShow'; import prepareShow from '@/webPublic/one_stop_public/Table/prepareShow';
import { queryApiVersion } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiVersion } from '@/webPublic/one_stop_public/utils/queryConfig';
...@@ -25,16 +29,14 @@ import { getOneStopMyInfo } from '@/webPublic/one_stop_public/utils/utils'; ...@@ -25,16 +29,14 @@ import { getOneStopMyInfo } from '@/webPublic/one_stop_public/utils/utils';
* @param {String} code 模板的code * @param {String} code 模板的code
*/ */
export const fetchTemplateByCode = (code) => export const fetchTemplateByCode = (code) =>
uaaRequest('/UnifiedServicePatternApi/getDetail', { code }); uaaRequest('/UnifiedServicePatternApi/getDetail', { code });
export const fetchTemplateById = (id) => export const fetchTemplateById = (id) =>
uaaRequest('/UnifiedAppApi/getDetail', { id }) uaaRequest('/UnifiedAppApi/getDetail', { id }).then((res) => {
.then((res) => { return prepareShow(res).then((x) => {
return prepareShow(res) return res;
.then((x) => { });
return res; });
});
});
/** /**
* 查询表格中某条数据 * 查询表格中某条数据
...@@ -43,18 +45,13 @@ export const fetchTemplateById = (id) => ...@@ -43,18 +45,13 @@ export const fetchTemplateById = (id) =>
* @param{String} value 元数据表格中键对应的值 * @param{String} value 元数据表格中键对应的值
* @param{Bool} isBase key是否base加密过,默认传true * @param{Bool} isBase key是否base加密过,默认传true
*/ */
export const fetchTableItem = ({ export const fetchTableItem = ({ dataObjId, key, value, isBase = true }) => {
dataObjId, return uaaRequest('/DataObjApi/getFormData', {
key, dataObjId,
value, key,
isBase = true, value,
}) => { isBase,
return uaaRequest('/DataObjApi/getFormData', { });
dataObjId,
key,
value,
isBase,
});
}; };
/** /**
...@@ -64,20 +61,14 @@ export const fetchTableItem = ({ ...@@ -64,20 +61,14 @@ export const fetchTableItem = ({
* @param {Number} pageSize * @param {Number} pageSize
* @param {Number} pageNo * @param {Number} pageNo
*/ */
export const fetchTableData = ({ export const fetchTableData = ({ dataObjId, query, pageSize, pageNo, ...other }) => {
dataObjId, return uaaRequest('/DataObjApi/getFormDataPage', {
query, dataObjId,
pageSize, query: JSON.stringify(query),
pageNo, pageNo,
...other pageSize,
}) => { ...other,
return uaaRequest('/DataObjApi/getFormDataPage', { });
dataObjId,
query: JSON.stringify(query),
pageNo,
pageSize,
...other,
});
}; };
/** /**
...@@ -85,7 +76,7 @@ export const fetchTableData = ({ ...@@ -85,7 +76,7 @@ export const fetchTableData = ({
* @param {String} objId 元数据id * @param {String} objId 元数据id
*/ */
export const fetchTableHeader = (objId) => export const fetchTableHeader = (objId) =>
uaaRequest('/DataColumnApi/getHeaderList', { dataObjId: objId }); uaaRequest('/DataColumnApi/getHeaderList', { dataObjId: objId });
/** /**
* 删除元数据中的数据 * 删除元数据中的数据
...@@ -94,11 +85,11 @@ export const fetchTableHeader = (objId) => ...@@ -94,11 +85,11 @@ export const fetchTableHeader = (objId) =>
* @param {String} value 主键对应的值,删除多条数据时传数组 * @param {String} value 主键对应的值,删除多条数据时传数组
*/ */
export const deleteTableItem = (objId, primaryKey, value) => { export const deleteTableItem = (objId, primaryKey, value) => {
const copyValue = Array.isArray(value) ? value.join(',') : value; const copyValue = Array.isArray(value) ? value.join(',') : value;
return uaaRequest('/DataObjApi/deleteFormData', { return uaaRequest('/DataObjApi/deleteFormData', {
objId, objId,
keys: JSON.stringify({ [primaryKey]: copyValue }), keys: JSON.stringify({ [primaryKey]: copyValue }),
}); });
}; };
/** /**
...@@ -108,18 +99,13 @@ export const deleteTableItem = (objId, primaryKey, value) => { ...@@ -108,18 +99,13 @@ export const deleteTableItem = (objId, primaryKey, value) => {
* @param {Bool} isAdd true是新增,false是编辑 * @param {Bool} isAdd true是新增,false是编辑
* @param {Bool} isBase 数据是否编码过,从模板中出来的数据是编码过,默认true * @param {Bool} isBase 数据是否编码过,从模板中出来的数据是编码过,默认true
*/ */
export const addOrEditTableItem = ({ export const addOrEditTableItem = ({ objId, data, isAdd, isBase = true }) => {
objId, return uaaRequest('/DataObjApi/addFormData', {
data, data: JSON.stringify(data),
isAdd, isAdd,
isBase = true, objId,
}) => { isBase,
return uaaRequest('/DataObjApi/addFormData', { });
data: JSON.stringify(data),
isAdd,
objId,
isBase,
});
}; };
/** /**
...@@ -128,45 +114,43 @@ export const addOrEditTableItem = ({ ...@@ -128,45 +114,43 @@ export const addOrEditTableItem = ({
* @param {String} code 申报数据的code * @param {String} code 申报数据的code
*/ */
export const getHistoryFormDetail = (params = {}) => { export const getHistoryFormDetail = (params = {}) => {
return uaaRequest('/UnifiedAppFormApi/getFormDetail', params) return uaaRequest('/UnifiedAppFormApi/getFormDetail', params)
.then((res) => { .then((res) => {
if (res) { if (res) {
// console.log(queryApiVersion()); // console.log(queryApiVersion());
if (queryApiVersion() === '2.0') { // 2.0的接口 流程日志单独获取 if (queryApiVersion() === '2.0') {
return api2_0_getTaskInfo(params) // 2.0的接口 流程日志单独获取
.then((res2) => { return api2_0_getTaskInfo(params).then((res2) => {
return { return {
...res, ...res,
...res2, ...res2,
}; };
}); });
} else { } else {
return res; return res;
} }
} else { } else {
return null; return null;
} }
}) })
.then((g) => { .then((g) => {
// console.log(g); // console.log(g);
return g; return g;
}); });
}; };
export const api2_0_getTaskInfo = (params = {}) => { export const api2_0_getTaskInfo = (params = {}) => {
return uaaRequest('/UnifiedAppFormApi/getFormNextUser', params) return uaaRequest('/UnifiedAppFormApi/getFormNextUser', params).then((res) => {
.then((res) => { if (res) {
if (res) { return res;
return res; } else {
} else { return {};
return {}; }
} });
});
}; };
export const getTaskDefinition = (data) => { export const getTaskDefinition = (data) => {
return uaaRequest('/UnifiedAppFormApi/getTaskDefinition', data); return uaaRequest('/UnifiedAppFormApi/getTaskDefinition', data);
}; };
/** /**
...@@ -174,7 +158,7 @@ export const getTaskDefinition = (data) => { ...@@ -174,7 +158,7 @@ export const getTaskDefinition = (data) => {
* 用于授权 * 用于授权
*/ */
export const getAppList = (params = {}) => { export const getAppList = (params = {}) => {
return uaaRequest('/UnifiedAppApi/getListByTree', params); return uaaRequest('/UnifiedAppApi/getListByTree', params);
}; };
/** /**
...@@ -182,7 +166,7 @@ export const getAppList = (params = {}) => { ...@@ -182,7 +166,7 @@ export const getAppList = (params = {}) => {
* 用于一站式 应用分类列表 tree * 用于一站式 应用分类列表 tree
*/ */
export const getAppTypeList = () => { export const getAppTypeList = () => {
return uaaRequest('/UnifiedAppGroupApi/getList', {}); return uaaRequest('/UnifiedAppGroupApi/getList', {});
}; };
/** /**
...@@ -190,42 +174,46 @@ export const getAppTypeList = () => { ...@@ -190,42 +174,46 @@ export const getAppTypeList = () => {
* 用于一站式 应用树形列表 tree * 用于一站式 应用树形列表 tree
*/ */
export const getListByTreeList = (params = {}) => { export const getListByTreeList = (params = {}) => {
return uaaRequest('/UnifiedAppApi/getListByTree', params); return uaaRequest('/UnifiedAppApi/getListByTree', params);
}; };
export { getOneStopMyInfo }; export { getOneStopMyInfo };
export function getOneStopActiveMenus(key) { export function getOneStopActiveMenus(key) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setOneStopActiveMenusConfig(''); setOneStopActiveMenusConfig('');
resolve(true); resolve(true);
}); });
} }
export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value_list') { export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value_list') {
getOneStopActiveMenus() getOneStopActiveMenus().then((res) => {});
.then((res) => { if (config.getOnestopAppIdByMyPath) {
}); getOneStopConfigList();
return fetchTableData({ if (key) {
dataObjId: config.onestopConfigDataObjId || '1248169933162938368', getOneStopConfig(key);
pageNo: 1, }
pageSize: 5000, } else {
}) return fetchTableData({
.then((x) => { dataObjId: config.onestopConfigDataObjId || '1248169933162938368',
if (x && x.rows && x.rows.length) { pageNo: 1,
const onestopConfigList = {}; pageSize: 5000,
for (const item of x.rows) { }).then((x) => {
onestopConfigList[item[formKey]] = item[formValue]; if (x && x.rows && x.rows.length) {
} const onestopConfigList = {};
setOneStopConfig(onestopConfigList); for (const item of x.rows) {
onestopConfigList[item[formKey]] = item[formValue];
getOneStopConfigList(); }
setOneStopConfig(onestopConfigList);
if (key) {
return onestopConfigList[key]; getOneStopConfigList();
}
} else { if (key) {
console.error('没有配置一站式相关服务,无法使用部分功能'); return onestopConfigList[key];
return false; }
} } else {
}); console.error('没有配置一站式相关服务,无法使用部分功能');
return false;
}
});
}
} }
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论