<template>
|
<TableLayout :permissions="['business:member:query']">
|
<!-- 搜索表单 -->
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="停车库名称" prop="name">
|
<el-input v-model="searchForm.name" placeholder="请输入停车库名称" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<el-form-item label="所属停车库" prop="parentHkId">
|
<el-select v-model="searchForm.parentHkId" placeholder="请选择">
|
<el-option
|
v-for="item in list"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<!-- 表格和分页 -->
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li><el-button type="primary" v-permissions="['business:hksync:park']" @click="syncParks()">同步</el-button></li>
|
</ul>
|
<el-table
|
v-loading="isWorking.search"
|
:data="tableData.list"
|
stripe
|
>
|
<el-table-column prop="name" label="停车库名称" min-width="100px"></el-table-column>
|
<el-table-column prop="parentName" label="所属停车库" min-width="100px"></el-table-column>
|
<el-table-column prop="createDate" label="创建时间" min-width="100px"></el-table-column>
|
<el-table-column prop="editDate" label="更新时间" min-width="100px"></el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
>
|
</pagination>
|
</template>
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import Pagination from '@/components/common/Pagination'
|
import {findList, syncParks} from '@/api/business/parks'
|
export default {
|
name: 'Parks',
|
extends: BaseTable,
|
components: { TableLayout, Pagination },
|
data () {
|
return {
|
// 搜索
|
searchForm: {
|
name: '',
|
parentHkId: ''
|
},
|
list: []
|
}
|
},
|
created () {
|
this.config({
|
module: '停车库信息表',
|
api: '/business/parks',
|
'field.id': 'id',
|
'field.main': 'id'
|
})
|
this.search()
|
this.getfindList()
|
},
|
methods: {
|
syncParks(){
|
this.$dialog.actionConfirm("操作确认提醒","您确认同步全部信息吗?")
|
.then(() => {
|
this.isWorking.delete = true
|
this.api.syncParks({})
|
.then(res => {
|
this.$tip.apiSuccess(res || '同步成功')
|
this.__afterDelete()
|
})
|
.catch(e => {
|
this.$tip.apiFailed(e)
|
})
|
.finally(() => {
|
this.isWorking.delete = false
|
})
|
})
|
.catch(() => {})
|
},
|
getfindList () {
|
findList({})
|
.then(res => {
|
this.list = res
|
console.log(res)
|
})
|
}
|
}
|
}
|
</script>
|