fe-drone-ci/src/views/liftingperiods/list.vue

79 lines
1.9 KiB
Vue

<template>
<div class="app-container">
<el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
<el-table-column align="center" label="Name" width="200">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="Name" width="200">
<template slot-scope="scope">
<span>{{ scope.row.days }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="Actions" width="120">
<template slot-scope="scope">
<router-link :to="'/lifting-periods/edit/' + scope.row._id">
<el-button type="primary" size="small" icon="el-icon-edit">
Edit
</el-button>
</router-link>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
</div>
</template>
<script>
import { fetchList } from '@/api/liftingPeriod'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
export default {
name: 'LiftingPeriodList',
components: { Pagination },
data() {
return {
list: null,
total: 0,
listLoading: true,
listQuery: {
page: 1,
limit: 20
}
}
},
created() {
// Set the type for the query
this.listQuery.platform = 'OLFDE'
this.getList()
},
methods: {
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.liftingPeriods
this.total = response.data.liftingPeriods.length
this.listLoading = false
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>