提交 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';
...@@ -28,10 +32,8 @@ export const fetchTemplateByCode = (code) => ...@@ -28,10 +32,8 @@ 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)
.then((x) => {
return res; return res;
}); });
}); });
...@@ -43,12 +45,7 @@ export const fetchTemplateById = (id) => ...@@ -43,12 +45,7 @@ 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,
key,
value,
isBase = true,
}) => {
return uaaRequest('/DataObjApi/getFormData', { return uaaRequest('/DataObjApi/getFormData', {
dataObjId, dataObjId,
key, key,
...@@ -64,13 +61,7 @@ export const fetchTableItem = ({ ...@@ -64,13 +61,7 @@ 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,
query,
pageSize,
pageNo,
...other
}) => {
return uaaRequest('/DataObjApi/getFormDataPage', { return uaaRequest('/DataObjApi/getFormDataPage', {
dataObjId, dataObjId,
query: JSON.stringify(query), query: JSON.stringify(query),
...@@ -108,12 +99,7 @@ export const deleteTableItem = (objId, primaryKey, value) => { ...@@ -108,12 +99,7 @@ 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,
data,
isAdd,
isBase = true,
}) => {
return uaaRequest('/DataObjApi/addFormData', { return uaaRequest('/DataObjApi/addFormData', {
data: JSON.stringify(data), data: JSON.stringify(data),
isAdd, isAdd,
...@@ -132,9 +118,9 @@ export const getHistoryFormDetail = (params = {}) => { ...@@ -132,9 +118,9 @@ export const getHistoryFormDetail = (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,
...@@ -154,8 +140,7 @@ export const getHistoryFormDetail = (params = {}) => { ...@@ -154,8 +140,7 @@ export const getHistoryFormDetail = (params = {}) => {
}; };
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 {
...@@ -164,7 +149,6 @@ export const api2_0_getTaskInfo = (params = {}) => { ...@@ -164,7 +149,6 @@ export const api2_0_getTaskInfo = (params = {}) => {
}); });
}; };
export const getTaskDefinition = (data) => { export const getTaskDefinition = (data) => {
return uaaRequest('/UnifiedAppFormApi/getTaskDefinition', data); return uaaRequest('/UnifiedAppFormApi/getTaskDefinition', data);
}; };
...@@ -202,15 +186,18 @@ export function getOneStopActiveMenus(key) { ...@@ -202,15 +186,18 @@ export function getOneStopActiveMenus(key) {
} }
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();
if (key) {
getOneStopConfig(key);
}
} else {
return fetchTableData({ return fetchTableData({
dataObjId: config.onestopConfigDataObjId || '1248169933162938368', dataObjId: config.onestopConfigDataObjId || '1248169933162938368',
pageNo: 1, pageNo: 1,
pageSize: 5000, pageSize: 5000,
}) }).then((x) => {
.then((x) => {
if (x && x.rows && x.rows.length) { if (x && x.rows && x.rows.length) {
const onestopConfigList = {}; const onestopConfigList = {};
for (const item of x.rows) { for (const item of x.rows) {
...@@ -228,4 +215,5 @@ export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value ...@@ -228,4 +215,5 @@ export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value
return false; return false;
} }
}); });
}
} }
...@@ -7,14 +7,16 @@ import moment from 'moment'; ...@@ -7,14 +7,16 @@ import moment from 'moment';
import { Icon, message, notification } from 'antd'; import { Icon, message, notification } from 'antd';
import { getOneStopActiveMenus, getOnestopKey } from '../../Services'; import { getOneStopActiveMenus, getOnestopKey } from '../../Services';
import { isJSON } from '@/webPublic/one_stop_public/2022beidianke/isJSON'; 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; let messageTime = new Date().getTime() - 3000;
export { isJSON }; export { isJSON };
/** /**
* 校验 开始时间必须在结束时间之前的函数 * 校验 开始时间必须在结束时间之前的函数
* */ * */
export function checkDate(endTime = '2019-01-01', startTime = '2018-12-31') { export function checkDate(endTime = '2019-01-01', startTime = '2018-12-31') {
return moment(endTime) return moment(endTime).isAfter(moment(startTime));
.isAfter(moment(startTime));
} }
/** /**
...@@ -22,15 +24,14 @@ export function checkDate(endTime = '2019-01-01', startTime = '2018-12-31') { ...@@ -22,15 +24,14 @@ export function checkDate(endTime = '2019-01-01', startTime = '2018-12-31') {
* */ * */
export function matchReg(str) { export function matchReg(str) {
let reg = /<\/?.+?\/?>/g; let reg = /<\/?.+?\/?>/g;
return str.replace(reg, '') return str.replace(reg, '').replace(/&nbsp;/g, ' ');
.replace(/&nbsp;/g, ' ');
} }
export function htmlFormat(str) { export function htmlFormat(str) {
if (typeof str !== 'string') { if (typeof str !== 'string') {
return ''; return '';
} }
const newTxt = str.replace(/\s+([^<>]+)(?=<)/g, function (match) { const newTxt = str.replace(/\s+([^<>]+)(?=<)/g, function(match) {
return match.replace(/\s/g, '&nbsp;'); return match.replace(/\s/g, '&nbsp;');
}); });
return newTxt; return newTxt;
...@@ -143,8 +144,6 @@ export function randomStr() { ...@@ -143,8 +144,6 @@ export function randomStr() {
.substr(2); .substr(2);
} }
export function checkMustHaveValue(configFileds, data) { export function checkMustHaveValue(configFileds, data) {
for (let item of configFileds) { for (let item of configFileds) {
if (!data[item.key] && data[item.key] !== false && data[item.key] !== 0) { if (!data[item.key] && data[item.key] !== false && data[item.key] !== 0) {
...@@ -208,7 +207,7 @@ export function controlNotification(props) { ...@@ -208,7 +207,7 @@ export function controlNotification(props) {
messageTime = nowTime; messageTime = nowTime;
notification.info({ notification.info({
...props, ...props,
icon: <Icon type="info-circle" style={{ color: '#fa8c16' }}/>, icon: <Icon type="info-circle" style={{ color: '#fa8c16' }} />,
}); });
return true; return true;
} }
...@@ -221,6 +220,19 @@ export function setOneStopConfig(value) { ...@@ -221,6 +220,19 @@ export function setOneStopConfig(value) {
} }
export function getOneStopConfig(key) { 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'); let configList = localStorage.getItem('oneStopConfig');
if (configList && isJSON(configList)) { if (configList && isJSON(configList)) {
let data = JSON.parse(configList); let data = JSON.parse(configList);
...@@ -240,7 +252,6 @@ export function setOneStopActiveMenusConfig(value) { ...@@ -240,7 +252,6 @@ export function setOneStopActiveMenusConfig(value) {
} }
export function getOneStopActiveMenusConfig(key) { export function getOneStopActiveMenusConfig(key) {
if (window.oneStopActiveMenusConfig && typeof window.oneStopActiveMenusConfig === 'object') { if (window.oneStopActiveMenusConfig && typeof window.oneStopActiveMenusConfig === 'object') {
return window.oneStopActiveMenusConfig[key] || false; return window.oneStopActiveMenusConfig[key] || false;
} else { } else {
...@@ -248,7 +259,6 @@ export function getOneStopActiveMenusConfig(key) { ...@@ -248,7 +259,6 @@ export function getOneStopActiveMenusConfig(key) {
} }
} }
export function diGuiTree(treeData = [], i = 0) { export function diGuiTree(treeData = [], i = 0) {
// for (let item of treeData) { // for (let item of treeData) {
// if(i === 2){ // if(i === 2){
...@@ -262,7 +272,6 @@ export function diGuiTree(treeData = [], i = 0) { ...@@ -262,7 +272,6 @@ export function diGuiTree(treeData = [], i = 0) {
return treeData; return treeData;
} }
export { downloadFile } from './downloadFile'; export { downloadFile } from './downloadFile';
// 校验密码是否符合 包含数字 字母 和特殊字符 解决 中医大的安全漏洞 // 校验密码是否符合 包含数字 字母 和特殊字符 解决 中医大的安全漏洞
...@@ -287,7 +296,6 @@ export default function CheckPassWord(password = '', length = 12) { ...@@ -287,7 +296,6 @@ export default function CheckPassWord(password = '', length = 12) {
return true; return true;
} }
/** /**
* *
* 检查文本格式是否正确 * 检查文本格式是否正确
...@@ -295,19 +303,19 @@ export default function CheckPassWord(password = '', length = 12) { ...@@ -295,19 +303,19 @@ export default function CheckPassWord(password = '', length = 12) {
export function checkInputType(data, type) { export function checkInputType(data, type) {
switch (type) { switch (type) {
case 'phone': 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('手机号码格式错误!'); message.warning('手机号码格式错误!');
return false; return false;
} }
break; break;
case 'email': 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('邮箱格式错误!'); message.warning('邮箱格式错误!');
return false; return false;
} }
break; break;
case 'idCard': 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('身份证号码格式错误!'); message.warning('身份证号码格式错误!');
return false; return false;
} }
...@@ -319,13 +327,10 @@ export function checkInputType(data, type) { ...@@ -319,13 +327,10 @@ export function checkInputType(data, type) {
return true; return true;
} }
export { getHeaders } from './getHeaders'; export { getHeaders } from './getHeaders';
export { getIsGui_Jian, getIsBei_Dian, getIsA_Ba } from './getSchoolType'; export { getIsGui_Jian, getIsBei_Dian, getIsA_Ba } from './getSchoolType';
// (function (_0x49c6e2, _0x5afabe) { // (function (_0x49c6e2, _0x5afabe) {
// const _0x125f6a = _0x3342, // const _0x125f6a = _0x3342,
// _0x2c1408 = _0x49c6e2(); // _0x2c1408 = _0x49c6e2();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论