Browse Source

1、添加车库区域管理

wangfen 3 years ago
parent
commit
b67bf394ad

+ 43 - 2
operationSupport/src/views/buildingManagement/index.vue

@@ -11,7 +11,11 @@
     <div class="main">
         <div>
             <div class="search">
-                <el-input placeholder="请输入资料代码或名称" class="search-input" v-model.trim="mixins_query.keyWords"></el-input>
+                <el-input v-model="query.buildingName" placeholder="请输入楼栋名称" class="search-input" v-model.trim="mixins_query.keyWords"></el-input>
+                <el-select v-model="query.communityName" placeholder="请选择社区名称">
+                    <el-option label="清空" value=""></el-option>
+                    <el-option v-for="(item,index) in communityList" :label="item.label" :value="item.id"></el-option>
+                </el-select>
                 <el-button type="primary" @click="mixins_search" class="search-btn" icon="el-icon-search">查询
                     <!-- <i class="iconfont">&#xe6fc;</i> -->
                 </el-button>
@@ -82,6 +86,11 @@ export default {
     mixins: [list],
     data() {
         return {
+            communityList:[],//社区名称下拉列表
+            query:{
+                buildingName:'',//楼栋名称
+                communityName:'',//社区名称
+            },
             cols: [
                 {
                     label: '所属社区',
@@ -142,6 +151,20 @@ export default {
         // viewDetail
     },
     methods: {
+        //获取社区名称下拉列表
+        communityNameList(){
+            this.communityList=[];
+            let onOption='';
+            this.$http.get('/assets/community/list', {}).then((res) => {
+                res.data.map(res=>{
+                    onOption={
+                        label:res.communityName,
+                        id:res.id
+                    }
+                    this.communityList.push(onOption)
+                })
+            });
+        },
         addCommand(command) {
             if (command === "add") {
                 // this.showaddDialog=true
@@ -205,14 +228,32 @@ export default {
         },
         selectionChange(val) {
             this.selectRow = val;
+        },
+        mixins_search(){
+            this.communityList()
+        },
+        //获取列表数据
+        communityList(){
+            let submitData={
+                "pageNum": 1,
+                "pageSize": 10
+            }
+            this.$http.post('/sc-community-web/assets/building/page', submitData).then((data) => {
+                this.mixins_list=data.data.list;
+                this.mixins_onQuery=false;
+            }).catch(function () {
+
+            });
         }
     },
     created() {
+        this.communityNameList();
+        this.communityList();
         this.mixins_dataUrl = '/dict/selectPage';
         this.mixins_query = {
             keyWords: ''
         };
-        this.mixins_search();
+        // this.mixins_search();
     }
 };
 </script>

+ 101 - 20
operationSupport/src/views/parkingLotAdministration/garageList.vue

@@ -1,8 +1,8 @@
 <template>
     <div class="main">
         <div class="search">
-            <el-input placeholder="车位号" class="search-input"></el-input>
-            <el-select v-model="communityName" placeholder="请选择社区名称" @change="communityChoice">
+            <el-input v-model="query.garageName" placeholder="车位号" class="search-input"></el-input>
+            <el-select v-model="query.communityName" placeholder="请选择社区名称">
                 <el-option label="清空" value=""></el-option>
                 <el-option v-for="(item,index) in communityList" :label="item.label" :value="item.id"></el-option>
             </el-select>
@@ -11,7 +11,7 @@
             </el-button>
             <div class="search-icon">
                 <!-- 删除 新增 -->
-<!--                <i class="iconfont" @click="deleteRow" v-txt-tip data-txt="删除">&#xe63b;</i>-->
+                <i class="iconfont" @click="deleteRow" v-txt-tip data-txt="删除">&#xe63b;</i>
                 <i class="iconfont" @click="addOrEdit('add')" v-left-txt-tip data-txt="新增">&#xe641;</i>
             </div>
         </div>
@@ -28,7 +28,7 @@
                 <template slot-scope="scope" slot="opt">
                     <i @click="addOrEdit('edit', scope)" class="iconfont" style="color:#2787F1;margin-right:30px" v-txt-tip data-txt="编辑">&#xe645;</i>
                     <i @click="deleteOne(scope.row.id)"  class="iconfont" style="color:#FF7272;margin-right:30px;" v-txt-tip data-txt="删除">&#xe63a;</i>
-                    <i @click="partitionManagement" class="iconfont" style="color:#2787F1;" v-txt-tip data-txt="分区管理">&#xe645;</i>
+                    <i @click="partitionManagement(scope)" class="iconfont" style="color:#2787F1;" v-txt-tip data-txt="分区管理">&#xe645;</i>
                 </template>
             </zz-table>
         </div>
@@ -36,14 +36,19 @@
 </template>
 
 <script>
+    import list from '@utils/list.js';
     export default {
+        mixins: [list],
         data() {
             return {
                 parkingNumber:'',
                 communityList:[],//社区名称下拉列表
-                communityName:'',//社区名称
                 communityId:'',//社区id
                 selectName: 'parkingLot',
+                query:{
+                    communityName:'',//社区名称
+                    garageName:'',//车库名称
+                },
                 cols: [
                     {
                         label: '所属社区',
@@ -64,6 +69,7 @@
                     }
                 ],
                 // tableData: []
+                selectRow: [],
             };
         },
         props:{
@@ -71,6 +77,10 @@
                 type: Array,
                 default: "",
             },
+            tableTotal:{
+                type:Number,
+                default: "",
+            },
         },
         methods: {
             //获取社区名称下拉列表
@@ -87,6 +97,35 @@
                     })
                 });
             },
+
+            mixins_search(){
+                console.log(this.query.communityName)
+                this.communityId=this.query.communityName
+                this.garageLotList();
+            },
+
+            //获取列表数据
+            garageLotList(){
+                let submitData={
+                    "communityId":this.communityId,
+                    "garageName":this.query.garageName,
+                    "pageNum": 1,
+                    "pageSize": 10
+                }
+                this.$http.post('/sc-community/assets/garage/page', submitData).then(res=> {
+                    this.tableData=res.data.list;
+                    this.mixins_pageset = {
+                        total:parseInt(res.data.total),
+                        // pageNum: this.mixins_pageset.pageNum,
+                        // pageSize: this.mixins_pageset.pageSize
+                    };
+                    this.mixins_onQuery=false;
+                    // this.mixins_list=data.data.list;
+                    // this.mixins_onQuery=false;
+                }).catch(function () {
+
+                });
+            },
             addOrEdit(todo, scope) {
                 let self=this;
                 new Promise((resolve) => {
@@ -94,34 +133,39 @@
                         title = '编辑车库';
                     if ('add' == todo) {
                         title = '新增车库';
+                        this.addEditPopUps(title,row,todo)
                     } else {
                         this.$http.get('/sc-community-web/assets/garage/find/'+scope.row.id, {}).then((res) => {
                             // sessionStorage.setItem('communityInformation',JSON.stringify(data))
                             row=res.data;
+                            this.addEditPopUps(title,row,todo)
                         });
                     }
-                    setTimeout(function(){
-                        self.$store.dispatch('openModal', {
-                            url: '/parkingLotAdministration/pageJump/garageSaveEdits.vue',
-                            title: title,
-                            width: '850px',
-                            height: '600px',
-                            props: {
-                                data: row,
-                                todo: todo,
-                                callback: self.mixins_search
-                            }
-                        });
-                    },1000)
 
                 }).then(() => {
                     this.mixins_search();
                 });
             },
+            addEditPopUps(title,row,todo){
+                this.$store.dispatch('openModal', {
+                    url: '/parkingLotAdministration/pageJump/garageSaveEdits.vue',
+                    title: title,
+                    width: '850px',
+                    height: '600px',
+                    props: {
+                        data: row,
+                        todo: todo,
+                        callback: this.mixins_search
+                    }
+                });
+            },
 
             //分区管理
-            partitionManagement(){
-                this.$router.push('/parkingLotAdministration/pageJump/partitionManagement')
+            partitionManagement(scope){
+                sessionStorage.setItem('communityId',scope.row.communityId);
+                sessionStorage.setItem('garageId',scope.row.id);
+                this.$router.push({ name: '/parkingLotAdministration/pageJump/partitionManagement'})
+
             },
             //单个删除
             deleteOne(ids) {
@@ -146,9 +190,46 @@
                         });
                     });
             },
+            deleteRow() {
+                // 获取选中列表的ids
+                let ids = [];
+                if (!this.selectRow.length) {
+                    this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
+                    return;
+                }
+                this.selectRow.forEach((v) => {
+                    ids.push(v.id);
+                });
+                this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
+                    .then((_) => {
+                        this.$http.post('/sc-community-web/assets/garage/delete', ids).then(({ status, data, msg }) => {
+                            if (0 === status) {
+                                this.$message({
+                                    type: 'success',
+                                    message: '删除成功!'
+                                });
+                                this.mixins_search();
+                            }
+                        });
+                    })
+                    .catch(() => {});
+            },
+            selectionChange(val){
+                this.selectRow = val;
+            }
         },
         created() {
             this.communityNameList();
+            this.mixins_onQuery=false;
+        },
+        watch:{
+            tableTotal(item) {
+                this.mixins_pageset = {
+                    total:item,
+                    // pageNum: this.mixins_pageset.pageNum,
+                    // pageSize: this.mixins_pageset.pageSize
+                };
+            }
         }
     };
 </script>

+ 12 - 2
operationSupport/src/views/parkingLotAdministration/index.vue

@@ -2,10 +2,10 @@
     <div class="main">
         <el-tabs v-model="selectName" @tab-click="handleClick">
             <el-tab-pane label="车位管理" name="parkingLot">
-                 <parking-space-list :tableData="tableData"></parking-space-list>
+                 <parking-space-list :tableData="tableData" :tableTotal="tableTotal"></parking-space-list>
             </el-tab-pane>
             <el-tab-pane label="车库管理" name="garage">
-                <garage-list :tableData="tableData"></garage-list>
+                <garage-list :tableData="tableData" :tableTotal="tableTotal"></garage-list>
             </el-tab-pane>
         </el-tabs>
     </div>
@@ -20,6 +20,7 @@
             return {
                 selectName: 'parkingLot',
                 tableData:[],
+                tableTotal:'',//表格总条数
             };
         },
         components: {
@@ -45,6 +46,7 @@
                     this.tableData=res.data.list;
                     // this.mixins_list=data.data.list;
                     // this.mixins_onQuery=false;
+                    this.tableTotal=parseInt(res.data.total)
                 }).catch(function () {
 
                 });
@@ -56,6 +58,14 @@
                 }
                 this.$http.post('/sc-community/assets/garage/page', submitData).then(res => {
                     this.tableData=res.data.list;
+                    // this.mixins_pageset = {
+                    //     total:parseInt(res.data.total),
+                    //     // pageNum: this.mixins_pageset.pageNum,
+                    //     // pageSize: this.mixins_pageset.pageSize
+                    // };
+                    // this.mixins_onQuery=false;
+                    this.tableTotal=parseInt(res.data.total)
+
                     // this.mixins_list=data.data.list;
                     // this.mixins_onQuery=false;
                 }).catch(function () {

+ 9 - 34
operationSupport/src/views/parkingLotAdministration/pageJump/garageSaveEdits.vue

@@ -11,13 +11,10 @@
                             </el-select>
                         </el-form-item>
                         <el-form-item label="车库名称" prop="garageName">
-                            <el-select v-model="ruleForm.garageName" placeholder="请选择车库名称" @change="garageChoice">
-                                <el-option label="清空" value=""></el-option>
-                                <el-option v-for="(item,index) in garageList" :label="item.label" :value="item.id"></el-option>
-                            </el-select>
+                            <el-input v-model="ruleForm.garageName"></el-input>
                         </el-form-item>
                         <el-form-item label="车位数量">
-                            <el-input v-model="ruleForm.parkingLotQuantity"></el-input>
+                            <el-input v-model="ruleForm.parkingNumber"></el-input>
                         </el-form-item>
                         <el-form-item label="备注信息">
                             <el-input type="textarea" :rows="4" v-model="ruleForm.remarks" maxlength="300">
@@ -39,13 +36,11 @@
                 communityList:[],//社区名称下拉列表
                 // communityName:'',//社区名称
                 // communityId:'',//社区id
-                garageList:[],//车库名称下拉列表
-                // garageName:'',//车库名称
                 ruleForm: {
                     communityName: '',//社区名称
                     communityList:[],//社区名称下拉列表
                     garageName:'',//车库名称
-                    parkingLotQuantity:'',//车位数量
+                    parkingNumber:'',//车位数量
                     remarks:'',//备注
                 },
                 rules: {
@@ -80,21 +75,7 @@
             communityChoice(e){
                 console.log(e)
                 this.communityId=e;
-                this.garageNameList();
-            },
-            //获取车库名称下拉列表
-            garageNameList(){
-                this.garageList=[];
-                let onOption='';
-                this.$http.post('/assets/garage/list', {communityId:this.communityId}).then((res) => {
-                    res.data.map(res=>{
-                        onOption={
-                            label:res.garageName,
-                            id:res.id
-                        }
-                        this.garageList.push(onOption)
-                    })
-                });
+                // this.garageNameList();
             },
             submit() {
                 let formData='';
@@ -105,7 +86,7 @@
                                 "communityId": this.communityId,
                                 "garageName": this.ruleForm.garageName,
                                 "id": 0,
-                                "parkingNumber":this.ruleForm.parkingLotQuantity,
+                                "parkingNumber":this.ruleForm.parkingNumber,
                                 "remarks":this.ruleForm.remarks,
                             }
                             this.$http.post('/assets/garage/update', formData).then((res) => {
@@ -116,7 +97,7 @@
                                 "communityId": this.communityId,
                                 "garageName": this.ruleForm.garageName,
                                 "id": 0,
-                                "parkingNumber":this.ruleForm.parkingLotQuantity,
+                                "parkingNumber":this.ruleForm.parkingNumber,
                                 "remarks":this.ruleForm.remarks,
                             }
                             this.$http.post('/assets/garage/add', formData).then((res) => {
@@ -163,19 +144,13 @@
             addEditPresentation(){
                 if(this.params.todo=='edit'){
                     this.ruleForm.communityName=this.params.data.communityId;
-                    this.ruleForm.parkingBeginNumber=this.params.data.parkingBeginNumber;
-                    this.ruleForm.parkingEndNumber=this.params.data.parkingEndNumber;
-                    this.ruleForm.parkingType=String(this.params.data.parkingType);
-                    this.ruleForm.parkingArea=this.params.data.parkingArea;
+                    this.ruleForm.garageName=this.params.data.garageName;
                     this.ruleForm.parkingNumber=this.params.data.parkingNumber;
                     this.ruleForm.remarks=this.params.data.remarks;
                 }else{
-                    this.false=true;
                     this.ruleForm.communityName='';
-                    this.ruleForm.parkingBeginNumber='';
-                    this.ruleForm.parkingEndNumber=this.params.data.parkingEndNumber;
-                    this.ruleForm.parkingType='1';
-                    this.ruleForm.parkingArea='';
+                    this.ruleForm.garageName='';
+                    this.ruleForm.parkingNumber='';
                     this.ruleForm.remarks='';
                 }
             },

+ 91 - 23
operationSupport/src/views/parkingLotAdministration/pageJump/partitionManagement.vue

@@ -1,14 +1,14 @@
 <template>
     <div class="main">
         <div class="search">
-            <el-input placeholder="分区名称" class="search-input"></el-input>
+            <el-input v-model="areaName" placeholder="分区名称" class="search-input"></el-input>
             <el-button type="primary" @click="mixins_search" class="search-btn" icon="el-icon-search">查询
                 <!-- <i class="iconfont">&#xe6fc;</i> -->
             </el-button>
             <div class="search-icon">
                 <!-- 删除 新增 -->
                 <i class="iconfont" @click="addOrEdit('add')" v-left-txt-tip data-txt="新增">&#xe641;</i>
-<!--                <i class="iconfont" @click="deleteRow" v-txt-tip data-txt="删除">&#xe63b;</i>-->
+                <i class="iconfont" @click="deleteRow" v-txt-tip data-txt="删除">&#xe63b;</i>
             </div>
         </div>
         <div>
@@ -22,7 +22,7 @@
                     @selection-change="selectionChange"
             >
                 <template slot-scope="scope" slot="opt">
-                    <i @click="addOrEdit('edit', scope.index)" class="iconfont" style="color:#2787F1;margin-right:30px" v-txt-tip data-txt="编辑">&#xe645;</i>
+                    <i @click="addOrEdit('edit', scope)" class="iconfont" style="color:#2787F1;margin-right:30px" v-txt-tip data-txt="编辑">&#xe645;</i>
                     <i @click="deleteOne(scope.row.id)"  class="iconfont" style="color:#FF7272;margin-right:30px;" v-txt-tip data-txt="删除">&#xe63a;</i>
                 </template>
             </zz-table>
@@ -31,9 +31,14 @@
 </template>
 
 <script>
+    import list from '@utils/list.js';
     export default {
+        mixins: [list],
         data() {
             return {
+                areaName:'',
+                communityId:'',//社区id
+                garageId:'',//车库id
                 selectName: 'parkingLot',
                 cols: [
                    {
@@ -54,43 +59,70 @@
                         slot: 'opt'
                     }
                 ],
-                tableData: []
+                tableData: [],
+                selectRow: [],
             };
         },
         methods: {
             handleClick(tab, event) {
                 console.log(tab, event);
             },
-            addOrEdit(todo, index) {
+
+            //查询
+            mixins_search(){
+                let submitData={
+                    "areaName":this.areaName,
+                    "garageId":this.garageId,
+                    "pageNum": 1,
+                    "pageSize": 10
+                }
+                this.garageManagementList(submitData)
+            },
+            //新增与编辑弹出框
+            addOrEdit(todo, scope) {
                 new Promise((resolve) => {
                     let row,
                         title = '分区编辑';
                     if ('add' == todo) {
                         title = '分区添加';
+                        row={
+                            communityId:this.communityId,
+                            garageId:this.garageId
+                        }
+                        this.addEditPopUps(title,row,todo)
                     } else {
                         // row = this.mixins_list[index] || {};
                         // row = JSON.parse(JSON.stringify(row));
+                        this.$http.get('/sc-community-web/assets/garage/area/find/'+scope.row.id, {}).then(res=> {
+                            row=res.data;
+                            this.addEditPopUps(title,row,todo)
+                        }).catch(function () {
+
+                        });
                     }
-                    this.$store.dispatch('openModal', {
-                        url: '/parkingLotAdministration/pageJump/zoneAddEdit.vue',
-                        title: title,
-                        width: '850px',
-                        height: '600px',
-                        props: {
-                            data: row,
-                            todo: todo,
-                            callback: this.mixins_search
-                        }
-                    });
                 }).then(() => {
 
                 });
             },
+
+            addEditPopUps(title,row,todo){
+                this.$store.dispatch('openModal', {
+                    url: '/parkingLotAdministration/pageJump/zoneAddEdit.vue',
+                    title: title,
+                    width: '850px',
+                    height: '600px',
+                    props: {
+                        data: row,
+                        todo: todo,
+                        callback: this.mixins_search
+                    }
+                });
+            },
             //单个删除
             deleteOne(ids) {
                 this.$msgBox(`刪除字典`, '删除后将无法恢复,请问是否继续?')
                     .then(() => {
-                        this.$http.post('/dict/delete', [ids]).then(({ status, data, msg }) => {
+                        this.$http.post('/sc-community-web/assets/garage/area/delete', [ids]).then(({ status}) => {
                             if (0 === status) {
                                 this.$message({
                                     type: 'success',
@@ -109,22 +141,58 @@
                         });
                     });
             },
-            garageManagementList(){
-                let submitData={
-                    "pageNum": 1,
-                    "pageSize": 10
-                }
+            garageManagementList(submitData){
                 this.$http.post('/sc-community-web/assets/garage/area/page', submitData).then(res => {
                     if(res.status==0){
                         this.tableData=res.data.list;
+                        this.mixins_pageset = {
+                            total:parseInt(res.data.total),
+                            // pageNum: this.mixins_pageset.pageNum,
+                            // pageSize: this.mixins_pageset.pageSize
+                        };
+                        this.mixins_onQuery=false;
                     }
                 }).catch(function () {
 
                 });
+            },
+            deleteRow() {
+                // 获取选中列表的ids
+                let ids = [];
+                if (!this.selectRow.length) {
+                    this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
+                    return;
+                }
+                this.selectRow.forEach((v) => {
+                    ids.push(v.id);
+                });
+                this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
+                    .then((_) => {
+                        this.$http.post('/sc-community-web/assets/garage/area/delete', ids).then(({ status, data, msg }) => {
+                            if (0 === status) {
+                                this.$message({
+                                    type: 'success',
+                                    message: '删除成功!'
+                                });
+                                this.mixins_search();
+                            }
+                        });
+                    })
+                    .catch(() => {});
+            },
+            selectionChange(val){
+                this.selectRow = val;
             }
         },
         created() {
-            this.garageManagementList()
+            this.communityId=parseInt(sessionStorage.getItem('communityId'));
+                this.garageId=parseInt(sessionStorage.getItem('garageId'));
+            let submitData={
+                "garageId":this.garageId,
+                "pageNum": 1,
+                "pageSize": 10
+            }
+            this.garageManagementList(submitData)
         }
     };
 </script>

+ 62 - 18
operationSupport/src/views/parkingLotAdministration/pageJump/zoneAddEdit.vue

@@ -5,46 +5,43 @@
                 <el-row>
                     <el-col :span="24">
                         <el-form-item label="车库名称" prop="garageName">
-                            <el-select v-model="ruleForm.garageName" placeholder="请选择车库名称" @change="garageChoice">
+                            <el-select v-model="ruleForm.garageName" placeholder="请选择车库名称">
                                 <el-option label="清空" value=""></el-option>
                                 <el-option v-for="(item,index) in garageList" :label="item.label" :value="item.id"></el-option>
                             </el-select>
                         </el-form-item>
-                        <el-form-item label="分区名称" prop="partitionName">
-                            <el-input v-model="ruleForm.partitionName"></el-input>
+                        <el-form-item label="分区名称" prop="areaName">
+                            <el-input v-model="ruleForm.areaName"></el-input>
                         </el-form-item>
                         <el-form-item label="车位数量">
-                            <el-input v-model="ruleForm.parkingLotQuantity"></el-input>
+                            <el-input v-model="ruleForm.parkingNumber"></el-input>
                         </el-form-item>
                         <el-form-item label="备注信息">
-                            <el-input type="textarea" :rows="4" v-model="ruleForm.remark" maxlength="300">
+                            <el-input type="textarea" :rows="4" v-model="ruleForm.remarks" maxlength="300">
                             </el-input>
-                            <span style="position:absolute;bottom:0;right:10px">{{ruleForm.remark.length}}/300</span>
+                            <span style="position:absolute;bottom:0;right:10px">{{ruleForm.remarks.length}}/300</span>
                         </el-form-item>
                     </el-col>
                 </el-row>
             </el-form>
         </div>
-        <!--        <div style="text-align: right;">-->
-        <!--            <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>-->
-        <!--            <el-button>取消</el-button>-->
-        <!--        </div>-->
     </div>
 </template>
 <script>
     export default {
+        props: ["params"],
         data() {
             return {
                 garageList:[],//车库名称下拉列表
                 ruleForm: {
                     garageName:'',//车库名称
-                    partitionName:'',//分区名称
-                    parkingLotQuantity:'',//车位数量
-                    remark:'',//备注
+                    areaName:'',//分区名称
+                    parkingNumber:'',//车位数量
+                    remarks:'',//备注
                 },
                 rules: {
                     garageName:[{ required: true, message: '请输入车库名称', trigger: 'change' }],
-                    partitionName:[{ required: true, message: '请输入分区名称', trigger: 'change' }],
+                    areaName:[{ required: true, message: '请输入分区名称', trigger: 'change' }],
                 },
                 radio: '1',
             }
@@ -58,7 +55,7 @@
             garageNameList(){
                 this.garageList=[];
                 let onOption='';
-                this.$http.post('/assets/garage/list', {communityId:this.communityId}).then((res) => {
+                this.$http.post('/assets/garage/list', {communityId:''}).then((res) => {
                     res.data.map(res=>{
                         onOption={
                             label:res.garageName,
@@ -71,9 +68,41 @@
             submit() {
                 this.$refs['ruleForm'].validate((valid) => {
                     if (valid) {
-                        alert('submit!');
+                        if(this.params.todo=="edit"){
+                            let submitData={
+                                "areaName": this.ruleForm.areaName,
+                                "communityId": this.params.data.communityId,
+                                "garageId": this.ruleForm.garageName,
+                                "id": this.params.data.id,
+                                "parkingNumber": this.ruleForm.parkingNumber,
+                                "remarks": this.ruleForm.remarks,
+                            }
+                            this.$http.post('/sc-community-web/assets/garage/area/update', submitData).then(res => {
+                                if(res.status==0){
+                                    // this.tableData=res.data.list;
+                                }
+                            }).catch(function () {
+
+                            });
+                        }else{
+                            let submitData={
+                                "areaName": this.ruleForm.areaName,
+                                "communityId": this.params.data.communityId,
+                                "garageId": this.ruleForm.garageName,
+                                "id": 0,
+                                "parkingNumber": this.ruleForm.parkingNumber,
+                                "remarks": this.ruleForm.remarks,
+                            }
+                            this.$http.post('/sc-community-web/assets/garage/area/add', submitData).then(res => {
+                                if(res.status==0){
+                                    // this.tableData=res.data.list;
+                                }
+                            }).catch(function () {
+
+                            });
+                        }
                     } else {
-                        console.log('error submit!!');
+                        this.$message.error('验证失败');
                         return false;
                     }
                 });
@@ -106,12 +135,27 @@
             },
             addressQueryClick(){
                 this.mapPopUpStatus=true;
-            }
+            },
+            //展示添加和编辑
+            addEditPresentation(){
+                if(this.params.todo=='edit'){
+                    this.ruleForm.garageName=this.params.data.garageId;
+                    this.ruleForm.areaName=this.params.data.areaName;
+                    this.ruleForm.parkingNumber=this.params.data.parkingNumber;
+                    this.ruleForm.remarks=this.params.data.remarks;
+                }else{
+                    this.ruleForm.garageName=parseInt(this.params.data.garageId);
+                    this.ruleForm.areaName='';
+                    this.ruleForm.parkingNumber='';
+                    this.ruleForm.remarks='';
+                }
+            },
 
 
         },
         created() {
            this.garageNameList();
+            this.addEditPresentation();
         }
     };
 </script>

+ 64 - 14
operationSupport/src/views/parkingLotAdministration/parkingSpaceList.vue

@@ -15,7 +15,7 @@
             </el-button>
             <div class="search-icon">
                 <!-- 删除 新增 -->
-<!--                <i class="iconfont" @click="deleteRow" v-txt-tip data-txt="删除">&#xe63b;</i>-->
+                <i class="iconfont" @click="deleteRow" v-txt-tip data-txt="删除">&#xe63b;</i>
                 <i class="iconfont" @click="addOrEdit('add')" v-left-txt-tip data-txt="新增">&#xe641;</i>
             </div>
         </div>
@@ -84,6 +84,7 @@
                     }
                 ],
                 // tableData: []
+                selectRow: [],
             };
         },
         props:{
@@ -91,6 +92,10 @@
                 type: Array,
                 default: "",
             },
+            tableTotal:{
+                type:Number,
+                default: "",
+            },
         },
         methods: {
             //获取社区名称下拉列表
@@ -133,29 +138,31 @@
                         title = '编辑车位';
                     if ('add' == todo) {
                         title = '新增车位';
+                        this.addEditPopUps(title,row,todo)
                     } else {
                         this.$http.get('/assets/garage/parking/find/'+scope.row.id, {}).then((res) => {
                             // sessionStorage.setItem('communityInformation',JSON.stringify(data))
                             row=res.data;
+                            this.addEditPopUps(title,row,todo)
                         });
                     }
-                    setTimeout(function(){
-                        self.$store.dispatch('openModal', {
-                            url: '/parkingLotAdministration/pageJump/parkingLotSaveEdits.vue',
-                            title: title,
-                            width: '850px',
-                            height: '600px',
-                            props: {
-                                data: row,
-                                todo: todo,
-                                callback: self.mixins_search
-                            }
-                        });
-                    },1000)
                 }).then(() => {
                     this.mixins_search();
                 });
             },
+            addEditPopUps(title,row,todo){
+                this.$store.dispatch('openModal', {
+                    url: '/parkingLotAdministration/pageJump/parkingLotSaveEdits.vue',
+                    title: title,
+                    width: '850px',
+                    height: '600px',
+                    props: {
+                        data: row,
+                        todo: todo,
+                        callback: this.mixins_search
+                    }
+                });
+            },
 
             mixins_search(){
                 this.parkingLotList();
@@ -173,6 +180,12 @@
                 }
                 this.$http.post('/sc-community/assets/garage/parking/page', submitData).then(res=> {
                     this.tableData=res.data.list;
+                    this.mixins_pageset = {
+                        total:parseInt(res.data.total),
+                        // pageNum: this.mixins_pageset.pageNum,
+                        // pageSize: this.mixins_pageset.pageSize
+                    };
+                    this.mixins_onQuery=false;
                     // this.mixins_list=data.data.list;
                     // this.mixins_onQuery=false;
                 }).catch(function () {
@@ -202,12 +215,49 @@
                         });
                     });
             },
+            deleteRow() {
+                // 获取选中列表的ids
+                let ids = [];
+                if (!this.selectRow.length) {
+                    this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
+                    return;
+                }
+                this.selectRow.forEach((v) => {
+                    ids.push(v.id);
+                });
+                this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
+                    .then((_) => {
+                        this.$http.post('/sc-community-web/assets/garage/parking/delete', ids).then(({ status, data, msg }) => {
+                            if (0 === status) {
+                                this.$message({
+                                    type: 'success',
+                                    message: '删除成功!'
+                                });
+                                this.mixins_search();
+                            }
+                        });
+                    })
+                    .catch(() => {});
+            },
+            selectionChange(val){
+                this.selectRow = val;
+            }
         },
         mounted(){
 
         },
         created() {
            this.communityNameList();
+            this.mixins_onQuery=false;
+        },
+        watch:{
+            tableTotal(item) {
+                this.mixins_pageset = {
+                    total:item,
+                    // pageNum: this.mixins_pageset.pageNum,
+                    // pageSize: this.mixins_pageset.pageSize
+                };
+            }
         }
     };
 </script>