| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <div class="app-container">
- <el-form :model="queryForm" inline size="small">
- <el-form-item label="关键词">
- <el-input v-model="queryForm.name" placeholder="关键词" />
- </el-form-item>
- </el-form>
- <el-row class="action-bar-container" type="flex" justify="end">
- <el-button type="primary" size="small" @click.native="fetchData">查询</el-button>
- <el-button-group>
- <el-button v-permission="['place.base.info.add']" size="small" @click.native="$refs.dialogForm.open({})">
- 新建
- </el-button>
- <el-button v-permission="['place.base.info.delete']" size="small" @click.native="deleteByIds(multipleSelection)">
- 删除
- </el-button>
- </el-button-group>
- </el-row>
- <el-table
- v-loading="isLoading"
- :data="pageData.records"
- border
- fit
- highlight-current-row
- @selection-change="selectionChange"
- >
- <el-table-column type="selection" width="55" fixed="left" />
- <el-table-column label="ID" prop="id" width="150" />
- <el-table-column label="名称" prop="name" min-width="200" />
- <el-table-column label="缩略图" width="80">
- <template slot-scope="scope">
- {{ scope.row.litpics.length }}张
- </template>
- </el-table-column>
- <el-table-column label="地址" prop="address" min-width="350" />
- <el-table-column label="分类" prop="category.name" width="100" />
- <el-table-column label="联系人" prop="contacts" width="100" />
- <el-table-column label="联系电话" prop="contactNumber" width="150" />
- <el-table-column label="位置信息" width="200">
- <template slot-scope="scope">
- [ {{ scope.row.lng }}, {{ scope.row.lat }} ]
- </template>
- </el-table-column>
- <el-table-column label="操作" width="70" fixed="right">
- <template slot-scope="scope">
- <el-button v-permission="['place.base.info.edit']" type="text" @click.native="$refs.dialogForm.open(scope.row)">编辑</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- class="pagination-container"
- background
- layout="prev, pager, next"
- :total="pageData.total"
- :page-size="pageData.pageSize"
- @current-change="paginationChange"
- />
- <dialog-form ref="dialogForm" @ok="fetchData" />
- </div>
- </template>
- <script>
- import { deleteByIds, findPage } from '@/api/place/base_info'
- import { dateTimeFormatter } from '@/utils/formater'
- import DialogForm from './DialogForm'
- export default {
- components: { DialogForm },
- data() {
- return {
- queryForm: {},
- isLoading: true,
- pageData: {},
- currentPage: 1,
- multipleSelection: []
- }
- },
- created() {
- this.fetchData()
- },
- methods: {
- dateTimeFormatter,
- selectionChange(val) {
- const temp = []
- val.forEach(o => {
- temp.push(o.id)
- })
- this.multipleSelection = temp
- },
- deleteByIds(ids) {
- this.$confirm('确认要删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteByIds(ids).then(() => {
- this.fetchData()
- })
- })
- },
- paginationChange(val) {
- this.currentPage = val
- this.fetchData()
- },
- fetchData() {
- this.isLoading = true
- findPage({ ...this.queryForm, current: this.currentPage })
- .then((response) => {
- this.pageData = response
- })
- .finally(() => (this.isLoading = false))
- }
- }
- }
- </script>
|