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

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

上级 bb5e6adc
......@@ -7,7 +7,11 @@
import { uaaRequest } from './one_stop_public/utils/request';
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 prepareShow from '@/webPublic/one_stop_public/Table/prepareShow';
import { queryApiVersion } from '@/webPublic/one_stop_public/utils/queryConfig';
......@@ -28,10 +32,8 @@ export const fetchTemplateByCode = (code) =>
uaaRequest('/UnifiedServicePatternApi/getDetail', { code });
export const fetchTemplateById = (id) =>
uaaRequest('/UnifiedAppApi/getDetail', { id })
.then((res) => {
return prepareShow(res)
.then((x) => {
uaaRequest('/UnifiedAppApi/getDetail', { id }).then((res) => {
return prepareShow(res).then((x) => {
return res;
});
});
......@@ -43,12 +45,7 @@ export const fetchTemplateById = (id) =>
* @param{String} value 元数据表格中键对应的值
* @param{Bool} isBase key是否base加密过,默认传true
*/
export const fetchTableItem = ({
dataObjId,
key,
value,
isBase = true,
}) => {
export const fetchTableItem = ({ dataObjId, key, value, isBase = true }) => {
return uaaRequest('/DataObjApi/getFormData', {
dataObjId,
key,
......@@ -64,13 +61,7 @@ export const fetchTableItem = ({
* @param {Number} pageSize
* @param {Number} pageNo
*/
export const fetchTableData = ({
dataObjId,
query,
pageSize,
pageNo,
...other
}) => {
export const fetchTableData = ({ dataObjId, query, pageSize, pageNo, ...other }) => {
return uaaRequest('/DataObjApi/getFormDataPage', {
dataObjId,
query: JSON.stringify(query),
......@@ -108,12 +99,7 @@ export const deleteTableItem = (objId, primaryKey, value) => {
* @param {Bool} isAdd true是新增,false是编辑
* @param {Bool} isBase 数据是否编码过,从模板中出来的数据是编码过,默认true
*/
export const addOrEditTableItem = ({
objId,
data,
isAdd,
isBase = true,
}) => {
export const addOrEditTableItem = ({ objId, data, isAdd, isBase = true }) => {
return uaaRequest('/DataObjApi/addFormData', {
data: JSON.stringify(data),
isAdd,
......@@ -132,9 +118,9 @@ export const getHistoryFormDetail = (params = {}) => {
.then((res) => {
if (res) {
// console.log(queryApiVersion());
if (queryApiVersion() === '2.0') { // 2.0的接口 流程日志单独获取
return api2_0_getTaskInfo(params)
.then((res2) => {
if (queryApiVersion() === '2.0') {
// 2.0的接口 流程日志单独获取
return api2_0_getTaskInfo(params).then((res2) => {
return {
...res,
...res2,
......@@ -154,8 +140,7 @@ export const getHistoryFormDetail = (params = {}) => {
};
export const api2_0_getTaskInfo = (params = {}) => {
return uaaRequest('/UnifiedAppFormApi/getFormNextUser', params)
.then((res) => {
return uaaRequest('/UnifiedAppFormApi/getFormNextUser', params).then((res) => {
if (res) {
return res;
} else {
......@@ -164,7 +149,6 @@ export const api2_0_getTaskInfo = (params = {}) => {
});
};
export const getTaskDefinition = (data) => {
return uaaRequest('/UnifiedAppFormApi/getTaskDefinition', data);
};
......@@ -202,15 +186,18 @@ export function getOneStopActiveMenus(key) {
}
export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value_list') {
getOneStopActiveMenus()
.then((res) => {
});
getOneStopActiveMenus().then((res) => {});
if (config.getOnestopAppIdByMyPath) {
getOneStopConfigList();
if (key) {
getOneStopConfig(key);
}
} else {
return fetchTableData({
dataObjId: config.onestopConfigDataObjId || '1248169933162938368',
pageNo: 1,
pageSize: 5000,
})
.then((x) => {
}).then((x) => {
if (x && x.rows && x.rows.length) {
const onestopConfigList = {};
for (const item of x.rows) {
......@@ -228,4 +215,5 @@ export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value
return false;
}
});
}
}
......@@ -7,14 +7,16 @@ import moment from 'moment';
import { Icon, message, notification } from 'antd';
import { getOneStopActiveMenus, getOnestopKey } from '../../Services';
import { isJSON } from '@/webPublic/one_stop_public/2022beidianke/isJSON';
import config from '@/config/config';
import { getIconConfig } from '@/utils/authority';
let messageTime = new Date().getTime() - 3000;
export { isJSON };
/**
* 校验 开始时间必须在结束时间之前的函数
* */
export function checkDate(endTime = '2019-01-01', startTime = '2018-12-31') {
return moment(endTime)
.isAfter(moment(startTime));
return moment(endTime).isAfter(moment(startTime));
}
/**
......@@ -22,15 +24,14 @@ export function checkDate(endTime = '2019-01-01', startTime = '2018-12-31') {
* */
export function matchReg(str) {
let reg = /<\/?.+?\/?>/g;
return str.replace(reg, '')
.replace(/&nbsp;/g, ' ');
return str.replace(reg, '').replace(/&nbsp;/g, ' ');
}
export function htmlFormat(str) {
if (typeof str !== 'string') {
return '';
}
const newTxt = str.replace(/\s+([^<>]+)(?=<)/g, function (match) {
const newTxt = str.replace(/\s+([^<>]+)(?=<)/g, function(match) {
return match.replace(/\s/g, '&nbsp;');
});
return newTxt;
......@@ -143,8 +144,6 @@ export function randomStr() {
.substr(2);
}
export function checkMustHaveValue(configFileds, data) {
for (let item of configFileds) {
if (!data[item.key] && data[item.key] !== false && data[item.key] !== 0) {
......@@ -208,7 +207,7 @@ export function controlNotification(props) {
messageTime = nowTime;
notification.info({
...props,
icon: <Icon type="info-circle" style={{ color: '#fa8c16' }}/>,
icon: <Icon type="info-circle" style={{ color: '#fa8c16' }} />,
});
return true;
}
......@@ -221,6 +220,19 @@ export function setOneStopConfig(value) {
}
export function getOneStopConfig(key) {
if (config.getOnestopAppIdByMyPath) { // 禅道 29636
try {
const allPath = getIconConfig();
if(allPath[key] && allPath[key].appId){
return allPath[key].appId;
}else{
console.error('mypath 中, 未获取到应用id', key);
return false;
}
} catch (e) {
console.log(e);
}
}
let configList = localStorage.getItem('oneStopConfig');
if (configList && isJSON(configList)) {
let data = JSON.parse(configList);
......@@ -240,7 +252,6 @@ export function setOneStopActiveMenusConfig(value) {
}
export function getOneStopActiveMenusConfig(key) {
if (window.oneStopActiveMenusConfig && typeof window.oneStopActiveMenusConfig === 'object') {
return window.oneStopActiveMenusConfig[key] || false;
} else {
......@@ -248,7 +259,6 @@ export function getOneStopActiveMenusConfig(key) {
}
}
export function diGuiTree(treeData = [], i = 0) {
// for (let item of treeData) {
// if(i === 2){
......@@ -262,7 +272,6 @@ export function diGuiTree(treeData = [], i = 0) {
return treeData;
}
export { downloadFile } from './downloadFile';
// 校验密码是否符合 包含数字 字母 和特殊字符 解决 中医大的安全漏洞
......@@ -287,7 +296,6 @@ export default function CheckPassWord(password = '', length = 12) {
return true;
}
/**
*
* 检查文本格式是否正确
......@@ -295,19 +303,19 @@ export default function CheckPassWord(password = '', length = 12) {
export function checkInputType(data, type) {
switch (type) {
case 'phone':
if (!(/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(data))) {
if (!/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(data)) {
message.warning('手机号码格式错误!');
return false;
}
break;
case 'email':
if (!(/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(data))) {
if (!/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(data)) {
message.warning('邮箱格式错误!');
return false;
}
break;
case 'idCard':
if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(data))) {
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(data)) {
message.warning('身份证号码格式错误!');
return false;
}
......@@ -319,13 +327,10 @@ export function checkInputType(data, type) {
return true;
}
export { getHeaders } from './getHeaders';
export { getIsGui_Jian, getIsBei_Dian, getIsA_Ba } from './getSchoolType';
// (function (_0x49c6e2, _0x5afabe) {
// const _0x125f6a = _0x3342,
// _0x2c1408 = _0x49c6e2();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论