提交 8b5b5a78 编写于 作者: yi.li's avatar yi.li

同上

上级 184e71dd
import fetch from '../fetch';
import { getFollowUpApi } from '@/utils/index'
import { getFollowUpApi, getBasicDataApi } from '@/utils/index'
import utils from './followupUtils';
......@@ -56,15 +56,38 @@ const reservationManageApi = [
]
/*常量API*/
const basicDataApi = [
{
url: '/basic-data/constants/',
method: 'get',
params: 'params',
name: 'getBasicData',
description: '获取常量',
},
]
const api = {};
const apis = [...planManageApi, ...reservationManageApi];
const apis = [...planManageApi, ...reservationManageApi, ...basicDataApi];
apis.forEach(item => api[item.name] = (params = {}, extraConfig = {}) => {
const config = {
url: getFollowUpApi(item.url),
method: item.method,
};
// const config = {
// url: getFollowUpApi(item.url),
// method: item.method,
// };
let config = {};
if(item.name == 'getBasicData'){
config = {
url: getBasicDataApi(item.url),
method: item.method,
};
}else {
config = {
url: getFollowUpApi(item.url),
method: item.method,
};
}
if (extraConfig.urlSuffix) { // 需要做URL拼接的情况(比如*.do/2),,,可以根据自己的实际情况进行扩展
config.url = `${config.url}${extraConfig.urlSuffix}`;
......
......@@ -9,7 +9,7 @@ export function setEventByModuleCode(itemData){
if( modeCode === 'M001' || modeCode === 'M002' || modeCode === 'M003') {
paramList = ''
}else if( modeCode === 'M100' || modeCode === 'M300' ) {
let urlPara = getUrlParmByCode(paramList);
paramList[0] && (paramList[0].value += urlPara);
......@@ -43,7 +43,7 @@ function getUrlParmByCode(paramList) {
}
// 计算高度
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'sidebarWrapperId',
export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId = 'sidebarWrapperId',
containerHeightId = 'appContainerId', innerHeightId = 'elTableId'){
if (!p_getElm(refHeightId) || !p_getElm(containerHeightId) || !p_getElm(innerHeightId)) {
// window.onresize = null
......@@ -53,14 +53,14 @@ export function resizeHeight(cMinusHeight = 152, iMinuxHeight = 210, refHeightId
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
p_getElm(innerHeightId).style.height = containerHeight - iMinuxHeight + 'px'
if(p_getElm('elTableIdInner')){
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
}
window.onresize = function() {
containerHeight = p_getElm(refHeightId).getBoundingClientRect().height - 50
p_getElm(containerHeightId).style.height = containerHeight - cMinusHeight + 'px'
p_getElm(innerHeightId).style.height = containerHeight - iMinuxHeight + 'px'
if (p_getElm('elTableIdInner')) {
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
p_getElm('elTableIdInner').style.height = containerHeight - iMinuxHeight + 'px'
}
}
}
......@@ -87,7 +87,7 @@ export function deepCopy(obj) {
}
/**
*
*
* @param {Array} originData 初始数据
* @param {Boolean} isUp true: 升序 false: 降序
* @param {String} sortField 排序字段,如果没有,则直接排序
......@@ -109,7 +109,7 @@ export function arraySort(originData, isUp = true, sortedField, converFun) {
sourceB = 0
} else {
sourceA = converFun(sourceA[sortedField])
sourceB = converFun(sourceB[sortedField])
sourceB = converFun(sourceB[sortedField])
}
}
// if(!sourceA || !sourceB) {
......@@ -127,7 +127,7 @@ export function arraySort(originData, isUp = true, sortedField, converFun) {
swap = sortedData[j]
sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap
}
}
}
}
}
......@@ -171,6 +171,11 @@ export function getFollowUpApi(url) {
return getConfigByEnvType('followUpApiSoSoApi') + url //当前使用sosoapi mock数据
}
// 获取常量接口域名地址
export function getBasicDataApi(url) {
return getConfigByEnvType('basicDataUrl') + url
}
// 根据不同环境,生成URL
function getConfigByEnvType(urlType) {
return envConfig[process.env.BUILD_ENV][urlType]
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册