Show region name in the DE terminals table
This commit is contained in:
parent
1dad28d2ae
commit
a464270171
|
@ -1,9 +1,10 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import store from '../store/modules/settings.js'
|
||||||
|
|
||||||
const RegionEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io'
|
const RegionEndpointUrl = 'https://metadata.service.development.therig.onlinefuelslabs.io'
|
||||||
|
|
||||||
export function fetchList(query) {
|
export function fetchList() {
|
||||||
return axios.get(`${RegionEndpointUrl}/regions`, { params: query })
|
return axios.get(`${RegionEndpointUrl}/regions?platform=${store.state.platform}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchRegion(id) {
|
export function fetchRegion(id) {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="$store.state.settings.platform === 'OLFDE'" align="center" label="Region Id" width="200">
|
<el-table-column v-if="$store.state.settings.platform === 'OLFDE'" align="center" label="Region Id" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.region_id }}</span>
|
<span>{{ scope.row.regionName }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="$store.state.settings.platform === 'OLFDE'" align="center" label="Phone" width="200">
|
<el-table-column v-if="$store.state.settings.platform === 'OLFDE'" align="center" label="Phone" width="200">
|
||||||
|
@ -34,11 +34,11 @@
|
||||||
<span>{{ scope.row.contactNumber }}</span>
|
<span>{{ scope.row.contactNumber }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="$store.state.settings.platform === 'OLFDE'" align="center" label="Meta" width="200">
|
<!-- <el-table-column v-if="$store.state.settings.platform === 'OLFDE'" align="center" label="Meta" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.meta }}</span>
|
<span>{{ scope.row.meta }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
|
|
||||||
<el-table-column align="center" label="Actions" width="120">
|
<el-table-column align="center" label="Actions" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
@ -60,7 +60,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { fetchList } from '@/api/terminal'
|
const fetchTerminalList = require('@/api/terminal').fetchList
|
||||||
|
const fetchRegionList = require('@/api/region').fetchList
|
||||||
// import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
// import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||||
import DeletePopUp from '@/components/PopUps/Delete'
|
import DeletePopUp from '@/components/PopUps/Delete'
|
||||||
|
|
||||||
|
@ -93,12 +94,20 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true
|
this.listLoading = true
|
||||||
fetchList().then(response => {
|
fetchTerminalList().then(response => {
|
||||||
this.originaList = response.data.terminals
|
this.originaList = response.data.terminals
|
||||||
this.filteredList = this.originaList
|
this.filteredList = this.originaList
|
||||||
console.log(this.originaList)
|
|
||||||
this.total = response.data.terminals.length
|
this.total = response.data.terminals.length
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
|
}).then(() => {
|
||||||
|
fetchRegionList().then(regions => {
|
||||||
|
this.filteredList.forEach(terminal => {
|
||||||
|
const region = regions.data.regions.find(function(region) {
|
||||||
|
if (region._id === terminal.region_id) { return region }
|
||||||
|
})
|
||||||
|
if (region) { terminal.regionName = region.name }
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
|
|
Loading…
Reference in New Issue