travel/admin/src/views/onlines/online.vue

112 lines
3.8 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="ID" width="60" prop="id" />
<el-table-column align="center" label="姓名" width="80" prop="name" />
<el-table-column align="center" label="状态" width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.isOnline === 0" type="border-card">下线</el-tag>
<el-tag v-if="scope.row.isOnline === 1" type="success">在线</el-tag>
<el-tag v-if="scope.row.isOnline === 2" type="info">没上线</el-tag>
</template>
</el-table-column>
<!-- <el-table-column align="center" label="是否分单" width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.isEndWork === 0" type="border-card">否</el-tag>
<el-tag v-if="scope.row.isEndWork === 1" type="success">是</el-tag>
</template>
</el-table-column>-->
<el-table-column align="center" label="是否分单" width="100">
<template #default="scope">
<el-switch v-model="scope.row.isEndWork" :active-value="1" :inactive-value="0" @change="updateStatus(scope.row)" />
</template>
</el-table-column>
<el-table-column align="center" label="剩余限制订单数量" width="190">
<template #default="scope">
<el-input-number v-model="scope.row.order_num" :max="9999999" :min="0" class="small-input-number" style="width: 160px; height: 36px;" @change="updateStatus(scope.row)" />
</template>
</el-table-column>
<el-table-column align="center" label="在线时长" width="80">
<template slot-scope="scope">
{{ Math.floor((scope.row.data ? scope.row.data.onlineTime : scope.row.onlineTime) / 3600) || '--' }} 分钟
</template>
</el-table-column>
<el-table-column width="138px" align="center" label="上班时间">
<template slot-scope="scope">
<span>{{ scope.row.start_work_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column width="138px" align="center" label="下班时间">
<template slot-scope="scope">
<span>{{ scope.row.end_work_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
name: 'GetOnlineList',
components: { },
data() {
return {
statusArr: { 0: '禁用', 1: '启用' },
list: [],
total: 0,
loading: false,
listLoading: true,
listQuery: {
page: 1,
limit: 10,
status: null,
content: ''
},
dialogCreate: false,
dialogEdit: false,
item: {},
anchors: {}
}
},
created() {
this.listQuery.status = this.$route.query.status || null
this.listQuery.content = this.$route.query.content || null
this.getOnlineList()
},
methods: {
getOnlineList() {
this.listLoading = true // /admin/admin/getOnlineList /admin/shortcutContent/list
this.$axios.get('/admin/admin/getOnlineList', { params: this.listQuery }).then(response => {
this.list = response.data
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
updateStatus(item) {
this.$axios.post('/admin/admin/editInfo', { id: item.id, order_num: item.order_num, is_order: item.isEndWork }).then(() => {
this.getOnlineList()
}).catch(() => {
})
}
}
}
</script>
<style scoped>
.app-container {
position: relative;
padding-bottom: 60px; /* 分页条的高度 */
}
.filter-container,
.el-table {
padding-bottom: 52px; /* 分页条的高度,以避免内容重叠 */
}
.search {
margin-left: 10px;
}
</style>