sadjv3_admin/src/views/travelAdjust/index.vue

129 lines
4.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="mod-dict">
<div style="margin:6px 0;">
<span style="color: red;font-size: 12px;">技师出行方式不可自行调整时按照如下规则自动调整时间点1之后使用方式1出行时间点2之后使用方式2出行</span>
</div>
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%;">
<el-table-column prop="updateTime" header-align="center" align="center" width="180" label="修改时间"/>
<el-table-column prop="pricingType" header-align="center" align="center" label="切换时间点1">
<template slot-scope="scope">
<span>{{ scope.row.pointTime1 }}</span>
</template>
</el-table-column>
<el-table-column prop="travelType" header-align="center" align="center" label="出行方式1">
<template slot-scope="scope">
<span v-if="scope.row.travelType1 == 1" class="people">公交</span>
<span v-if="scope.row.travelType1 == 2" class="people">出租</span>
<span v-if="scope.row.travelType1 == 3" class="people">免费</span>
</template>
</el-table-column>
<el-table-column prop="travelType" header-align="center" align="center" label="免费公里数1">
<template slot-scope="scope">
<span>{{ scope.row.travelNum1 }}</span>
</template>
</el-table-column>
<el-table-column prop="seasonsType" header-align="center" align="center" label="切换时间点2">
<template slot-scope="scope">
<span>{{ scope.row.pointTime2 }}</span>
</template>
</el-table-column>
<el-table-column prop="travelType" header-align="center" align="center" label="出行方式2">
<template slot-scope="scope">
<span v-if="scope.row.travelType2 == 1" class="people">公交</span>
<span v-if="scope.row.travelType2 == 2" class="people">出租</span>
<span v-if="scope.row.travelType2 == 3" class="people">免费</span>
</template>
</el-table-column>
<el-table-column prop="travelType" header-align="center" align="center" label="免费公里数2">
<template slot-scope="scope">
<span>{{ scope.row.travelNum2 }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="120" label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('travelConf:main:update')" type="text" size="small" @click="addOrUpdateHandle(1,scope.row.id)">修改</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"/>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"/>
</div>
</template>
<script>
import AddOrUpdate from './add-or-update'
export default {
data() {
return {
dataForm: {
name: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('travelAdjust/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
...this.dataForm,
})
}).then(({ data: rdata }) => {
console.log(rdata);
let { code, data } = rdata || {};
let { records, total } = data || {};
if(code === 0){
this.dataList = records;
this.totalPage = total;
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
// 新增 / 修改
addOrUpdateHandle(index,id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(index,id)
})
},
}
}
</script>