Commit 61244f26 authored by 张苗苗's avatar 张苗苗

feat: 新增sensorType和isMock

parent 3659dbc0
Pipeline #29835 passed with stages
in 22 minutes 36 seconds
...@@ -4,7 +4,7 @@ import * as constants from '../../constants'; ...@@ -4,7 +4,7 @@ import * as constants from '../../constants';
export const API = { export const API = {
AUTHORIZATION_TOKEN: '/Publish/Identity/AuthorizationToken', AUTHORIZATION_TOKEN: '/Publish/Identity/AuthorizationToken',
GET_GATEWAY_CONFIG: '/Publish/OMS/GateWayConfig', GET_GATEWAY_CONFIG: '/PandaCore/OMS/GateWayConfig',
GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig', GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig',
GENERATE_TOKEN: '/cityinterface/rest/services.svc/generatetoken', GENERATE_TOKEN: '/cityinterface/rest/services.svc/generatetoken',
GENERATE_IOT_TOKEN: 'cityinterface/rest/services.svc/generateGCKToken', GENERATE_IOT_TOKEN: 'cityinterface/rest/services.svc/generateGCKToken',
...@@ -33,6 +33,8 @@ export const API = { ...@@ -33,6 +33,8 @@ export const API = {
UPLOAD_FILE_URL: UPLOAD_FILE_URL:
'/cityinterface/rest/services/filedownload.svc/uploadfile/个人信息/{path}/{filename}', '/cityinterface/rest/services/filedownload.svc/uploadfile/个人信息/{path}/{filename}',
AVATAR_FILE_URL: '/cityinterface/rest/services/filedownload.svc/download', AVATAR_FILE_URL: '/cityinterface/rest/services/filedownload.svc/download',
GET_SENSOR_TYPE: '/PandaCore/GCK/Sensor/GetSensorType', // 获取传感器类型
GET_SYSTEM_CONFIGURATION: '/PandaCore/OMS/SysConfiguration', // 获取系统配置
}; };
const services = { const services = {
...@@ -145,6 +147,17 @@ const services = { ...@@ -145,6 +147,17 @@ const services = {
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
// Sensor 指标管理
getSensorType: {
url: API.GET_SENSOR_TYPE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
sysConfiguration: {
url: API.GET_SYSTEM_CONFIGURATION,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
}; };
export const searchAutoCity = keywords => { export const searchAutoCity = keywords => {
......
...@@ -80,6 +80,7 @@ const loader = (appContent, loading) => render({ appContent, loading }); ...@@ -80,6 +80,7 @@ const loader = (appContent, loading) => render({ appContent, loading });
const initLocale = () => { const initLocale = () => {
localStorage.setItem('umi_locale', 'zh-CN'); localStorage.setItem('umi_locale', 'zh-CN');
}; };
const PRODUCT_NAME = ['civ_water', 'civ_monitor'];
const initGlobalConfig = () => { const initGlobalConfig = () => {
// eslint-disable-next-line no-debugger // eslint-disable-next-line no-debugger
...@@ -130,6 +131,7 @@ const initGlobalConfig = () => { ...@@ -130,6 +131,7 @@ const initGlobalConfig = () => {
appService appService
.queryConfig({ client: params.getParams('client') || 'city' }) .queryConfig({ client: params.getParams('client') || 'city' })
.then(res => { .then(res => {
debugger;
if (res) { if (res) {
const data = res; const data = res;
if (!data.client) { if (!data.client) {
...@@ -175,6 +177,8 @@ const initGlobalConfig = () => { ...@@ -175,6 +177,8 @@ const initGlobalConfig = () => {
}) })
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
.then(res => { .then(res => {
initSensorType();
initIsMock();
render({ appContent: '', loading: true }); render({ appContent: '', loading: true });
}) })
.catch(error => { .catch(error => {
...@@ -183,6 +187,41 @@ const initGlobalConfig = () => { ...@@ -183,6 +187,41 @@ const initGlobalConfig = () => {
} }
}; };
const initSensorType = () => {
let filterProduct =
(window.globalConfig && window.globalConfig.products) || [];
filterProduct = filterProduct.filter(item =>
PRODUCT_NAME.includes(item.PackageName),
);
if (filterProduct.length > 0) {
appService.getSensorType().then(res => {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, {
sensorType: res.data,
}),
),
);
});
}
};
const initIsMock = () => {
appService
.sysConfiguration({
moduleName: '是否mock数据',
})
.then(res => {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, {
isMock: res.data === '是',
}),
),
);
});
};
initGlobalConfig(); initGlobalConfig();
initLocale(); initLocale();
window.share && window.share &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment