<template>
|
<GlobalWindow title="楼层管理" :showConfirm="false" :visible.sync="visible" width="800px">
|
<div class="head">
|
<div class="title">楼层列表</div>
|
<el-button type="primary" @click="editClick()">新建楼层</el-button>
|
</div>
|
<el-table :data="list" stripe>
|
<el-table-column prop="id" label="楼层编码" min-width="100px"></el-table-column>
|
<el-table-column prop="name" label="楼层名称" min-width="100px"></el-table-column>
|
<el-table-column label="操作" min-width="100px">
|
<template slot-scope="{row}">
|
<el-button type="text" @click="$refs.operaYwBuildingWindow.open('编辑楼宇', row)" icon="el-icon-edit"
|
v-permissions="['business:ywbuilding:update']">编辑</el-button>
|
<el-button type="text" @click="deleteById(row)" icon="el-icon-delete"
|
v-permissions="['business:ywbuilding:delete']">删除</el-button>
|
</template>
|
</el-table-column>
|
<el-table-column prop="projectName" label="所属项目" min-width="100px"></el-table-column>
|
</el-table>
|
<div class="mt20">
|
<Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
|
</div>
|
|
<!-- -->
|
<el-dialog :title="title" :visible.sync="showModal" :append-to-body="true" width="500px">
|
<el-form :model="param" ref="form" :rules="rules">
|
<el-form-item label="楼层编码" prop="code">
|
<el-input v-model="param.code" placeholder="请输入楼层编码" v-trim />
|
</el-form-item>
|
<el-form-item label="楼层名称" prop="name">
|
<el-input v-model="param.name" placeholder="请输入楼层名称" v-trim />
|
</el-form-item>
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="showModal = false">取 消</el-button>
|
<el-button type="primary" @click="showModal = false">确 定</el-button>
|
</span>
|
</el-dialog>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import BaseOpera from '@/components/base/BaseOpera'
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
import { fetchList, detailById, deleteById, create } from '@/api/project/yeFloor'
|
import Pagination from '@/components/common/Pagination'
|
export default {
|
extends: BaseOpera,
|
components: { GlobalWindow, Pagination },
|
data() {
|
return {
|
// 表单数据
|
info: {},
|
id: '',
|
visible: false,
|
showModal: false,
|
list: [],
|
pagination: {
|
pageSize: 10,
|
page: 1,
|
total: 0
|
},
|
|
title: '新建楼层',
|
param: {},
|
rules: {
|
name: [{ required: true, message: '请输入楼层名称' }],
|
area: [{ required: true, message: '请输入楼层编码' }],
|
},
|
}
|
},
|
created() {
|
},
|
methods: {
|
getList(buildingId) {
|
const { pagination } = this
|
let capacity = pagination.pageSize
|
let page = pagination.page
|
fetchList({ capacity, page, model: { buildingId } }).then(res => {
|
this.list = res
|
})
|
},
|
editClick(row) {
|
if(row && row.id){
|
this.title = '编辑楼层'
|
}else{
|
this.title = '新建楼层'
|
}
|
this.showModal = true
|
|
},
|
handleSizeChange(capacity) {
|
this.pagination.pageSize = capacity
|
}
|
}
|
}
|
</script>
|
<style lang="scss" scoped>
|
.head {
|
width: 100%;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
margin-bottom: 12px;
|
|
.title {
|
font-size: 16px;
|
font-weight: 500;
|
}
|
}
|
</style>
|