<template>
|
<section class="content-box">
|
|
<div class="form-box">
|
<h1>停 车 场 车 位 管 理</h1>
|
<el-form :inline="true" :model="searchForm" size="medium" >
|
<el-form-item>
|
<el-select v-model="searchForm.parkId" clearable>
|
<el-option v-for="item in table1" :key="item.id" :label="item.name" :value="item.id" ></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" size="small" @click="onSearch" icon="el-icon-search">查询</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
|
<div class="table">
|
<el-table :data="table2" border height="300" style="font-size: 15px">
|
<el-table-column prop="name" label="停车场名称" align="center" ></el-table-column>
|
<el-table-column prop="num" label="计划车位数量" align="center" ></el-table-column>
|
<el-table-column prop="carNum" label="场内泊车数量" align="center" ></el-table-column>
|
<el-table-column prop="content" label="描述" align="center"></el-table-column>
|
<el-table-column label="操作" fixed="right" align="center">
|
<template slot-scope="scope">
|
<el-button size="mini" @click="onEdit(scope.$index, scope.row)">修改</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<el-dialog title="编辑" :visible.sync="flag" width="40%">
|
<el-form :model="formData" ref="formData" label-width="130px" >
|
<el-form-item label="停车场名称" prop="name" aria-readonly="true">
|
<el-input v-model="formData.name"></el-input>
|
</el-form-item>
|
<el-form-item label="计划车位数量" prop="num" :rules="[{ required: true, message: '请输入车位数量', trigger: 'blur'}]">
|
<el-input v-model="formData.num"></el-input>
|
</el-form-item>
|
<el-form-item label="场内泊车数量" prop="num" :rules="[{ required: true, message: '请输入车位数量', trigger: 'blur'}]">
|
<el-input v-model="formData.carNum"></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="flag = false">取 消</el-button>
|
<el-button type="primary" @click="onSave">确 定</el-button>
|
</div>
|
</el-dialog>
|
|
|
</section>
|
</template>
|
|
<script>
|
export default {
|
name: "EditCarNum",
|
data: function () {
|
return {
|
flag:false,
|
flag2:false,
|
pageData: null,
|
searchForm: {
|
parkId: '',
|
},
|
formData: {
|
id:null,
|
parkName:'',
|
num:'',
|
carNum:''
|
},
|
urlPath:this.$systemconfig.basePath + '/ffzf/park/',
|
table1:[],
|
table2:[],
|
}
|
},
|
mounted() {
|
this.$byutil.postData(this, this.urlPath+'findAll', this.formData, res => {
|
this.table1 = res.data;
|
})
|
},
|
methods: {
|
onSave(){
|
this.$refs['formData'].validate((valid) => {
|
if (valid) {
|
this.$byutil.postData(this, this.urlPath+'editParkCarNum', this.formData, res => {
|
this.$refs['formData'].resetFields();
|
this.flag=false;
|
this.$message({message: '保存成功', type: 'success'});
|
this.loadData();
|
})
|
} else {
|
return false;
|
}
|
});
|
},
|
loadData() {
|
this.$byutil.postData(this, this.urlPath+'getById', this.searchForm,res => {
|
this.table2 = []
|
this.table2.push(res.data);
|
});
|
},
|
onSearch() {
|
this.flag2 = true
|
this.loadData();
|
},
|
onEdit(index, row) {
|
this.flag=true;
|
this.formData = row;
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
.content-box{
|
width: 100vw;
|
height: 100vh;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
flex-direction: column;
|
position: relative;
|
left: 0;
|
top: 0;
|
}
|
|
h1{
|
font-size: 55px;
|
color: #409EFF;
|
margin-bottom: 50px;
|
}
|
|
.form-box{
|
width: 1000px;
|
/*height: 50px;*/
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
flex-direction: column;
|
}
|
|
/deep/ .el-input--medium .el-input__inner{
|
width: 700px;
|
border: 2px solid #BDE2B2FF;
|
border-radius: 30px;
|
}
|
|
.table{
|
width: 1000px;
|
height: 500px;
|
}
|
|
</style>
|