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

同上

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