diff --git a/config/index.js b/config/index.js index ee6f874..a995b14 100644 --- a/config/index.js +++ b/config/index.js @@ -19,7 +19,7 @@ var proxyUrl = (module.exports = { proxyTable: { '/screen': { // target: 'http://112.29.103.165:21626',//重庆 - target: 'http://localhost:39080', //测试 + target: 'http://192.168.2.216:39080', //测试 // target: 'http://10.40.92.74:8080', changeOrigin: true, // secure: true, //如果是https接口,需要配置这个参数 diff --git a/src/api/index.js b/src/api/index.js index 5d5b8c7..4c5532e 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -7,8 +7,8 @@ axios.defaults.timeout = 30000 // 默认配置 // axios.defaults.baseURL = process.env.API_ROOT; // axios.defaults.baseURL = 'http://192.168.0.56:21627/bigScreen' -// axios.defaults.baseURL = 'screen' -axios.defaults.baseURL = 'http://localhost:8080/screen' +axios.defaults.baseURL = 'screen' +// axios.defaults.baseURL = 'http://localhost:8080/screen' axios.interceptors.request.use( (config) => { diff --git a/src/api/screen.js b/src/api/screen.js index d0fe496..0ce6ce0 100644 --- a/src/api/screen.js +++ b/src/api/screen.js @@ -34,6 +34,12 @@ export const getMaintenanceByMonthApi = (params) => //设备分布图 export const getEquipmentDisByMapApi = (params) => POST(`/material/base/largeScreen/home/getEquipmentDisByMap`) +//获取工程的位置信息 +export const getProjectByMapApi = (params) => + GET(`/material/base/largeScreen/home/getEquipmentDis`, params) +//获取设备的位置信息 +export const getDeviceByMapApi = (params) => + GET(`/material/base/largeScreen/home/getIotMaCodeMachine`, params) //施工机具/ export const getTotalOwnershipApi = (params) => POST(`/material/base/largeScreen/home/getTotalOwnership`) diff --git a/src/components/home/countryMap.vue b/src/components/home/countryMap.vue index c763917..60efda0 100644 --- a/src/components/home/countryMap.vue +++ b/src/components/home/countryMap.vue @@ -29,6 +29,7 @@ export default { isCity: 0, cityCount: [], gozoom: 1, + mapList: [], // 查询后的地图数据 } }, created() { @@ -37,13 +38,20 @@ export default { // this.getCityCount() }, mounted() { - this.getEquipmentDisByMapApiPage() - this.getInitData() + getEquipmentDisByMapApi().then((res) => { + console.log('res=====地图数据---', res) + + this.mapList = res.data + this.getInitData() + }) }, methods: { - getEquipmentDisByMapApiPage() { + async getEquipmentDisByMapApiPage() { getEquipmentDisByMapApi().then((res) => { - console.log('res=====', res) + console.log('res=====地图数据---', res) + + this.mapList = res.data + console.log('mapList=====地图数据---', this.mapList) }) }, getCompanyList() { @@ -115,7 +123,7 @@ export default { } }) - let mapData = [ + // let mapData = [ // { // name: '青海省', // value: ['101.778', '36.623'], @@ -136,19 +144,20 @@ export default { // value: ['112.982', '28.194'], // a: '100', // }, - { - name: '重庆市', + // { + // name: '重庆市', + // value: [], + // a: 100, + // }, + // ] + console.log('this.mapList',this.mapList) + let mapData = this.mapList.map((e) => { + return { + name: e.province, + a: e.num, value: [], - a: 100, - }, - ] - // let mapData = this.mapList.map((e) => { - // return { - // name: e.province, - // a: e.num, - // value: [], - // } - // }) + } + }) for (let i = 0; i < mapData.length; i++) { let geoCoord = geoCoordMap[mapData[i].name] diff --git a/src/components/home/new-map.vue b/src/components/home/new-map.vue index e8c0a98..6b1ce74 100644 --- a/src/components/home/new-map.vue +++ b/src/components/home/new-map.vue @@ -3,7 +3,7 @@