123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <template>
- <div class="main">
- <div class="search">
- <el-input v-model="query.garageName" placeholder="车位号" class="search-input"></el-input>
- <el-select v-model="query.communityName" placeholder="请选择社区名称">
- <el-option v-for="(item, index) in communityList" :label="item.label" :value="item.id" :key="index"></el-option>
- </el-select>
- <el-button type="primary" @click="mixins_search" class="search-btn" icon="el-icon-search"
- >查询
- <!-- <i class="iconfont"></i> -->
- </el-button>
- <div class="search-icon">
- <!-- 删除 新增 -->
- <i class="iconfont" @click="deleteRow" v-txt-tip data-txt="删除"></i>
- <i class="iconfont" @click="addOrEdit('add')" v-left-txt-tip data-txt="新增"></i>
- </div>
- </div>
- <div>
- <zz-table
- :cols="cols"
- :settings="{ showCheckbox: true, showIndex: true, stripe: true }"
- :loading="mixins_onQuery"
- :data="tableData"
- :pageset="mixins_pageset"
- @page-change="pageChange"
- @selection-change="selectionChange"
- >
- <template slot-scope="scope" slot="opt">
- <i
- @click="addOrEdit('edit', scope)"
- class="iconfont"
- style="color: #2787f1; margin-right: 30px"
- v-txt-tip
- data-txt="编辑"
- ></i
- >
- <i
- @click="deleteOne(scope.row.id)"
- class="iconfont"
- style="color: #ff7272; margin-right: 30px"
- v-txt-tip
- data-txt="删除"
- ></i
- >
- </template>
- <template slot-scope="scope" slot="opt" class="opt">
- <div class="opt">
- <el-tooltip effect="light" placement="bottom" content="编辑">
- <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope)"></i>
- </el-tooltip>
- <el-tooltip effect="light" placement="bottom" content="删除">
- <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteOne(scope.row.id)"></i>
- </el-tooltip>
- <el-tooltip effect="light" placement="bottom" content="分区管理">
- <i class="zoniot_font zoniot-icon-bianji" @click="partitionManagement(scope)"></i>
- </el-tooltip>
- </div>
- </template>
- </zz-table>
- </div>
- </div>
- </template>
- <script>
- import list from '@utils/list.js';
- export default {
- mixins: [list],
- data() {
- return {
- parkingNumber: '',
- communityList: [], //社区名称下拉列表
- communityId: '', //社区id
- selectName: 'parkingLot',
- query: {
- communityName: '', //社区名称
- garageName: '' //车库名称
- },
- cols: [
- {
- label: '所属社区',
- prop: 'communityName'
- },
- {
- label: '车库名称',
- prop: 'garageName'
- },
- {
- label: '车位数量',
- prop: 'parkingNumber'
- },
- {
- label: '备注',
- prop: 'remarks'
- },
- {
- label: '操作',
- prop: 'opt',
- slot: 'opt'
- }
- ],
- // tableData: []
- selectRow: []
- };
- },
- props: {
- tableData: {
- type: Array,
- default: ''
- },
- tableTotal: {
- type: Number,
- default: ''
- }
- },
- 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);
- });
- });
- },
- 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) => {
- let row,
- 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);
- });
- }
- }).then(() => {
- this.mixins_search();
- });
- },
- addEditPopUps(title, row, todo) {
- this.$store.dispatch('openModal', {
- url: '/parkingLotAdministration/pageJump/garageSaveEdits.vue',
- title: title,
- width: '500px',
- height: '420px',
- props: {
- data: row,
- communityList:this.communityList,
- todo: todo,
- callback: this.mixins_search
- }
- });
- },
- //分区管理
- partitionManagement(scope) {
- sessionStorage.setItem('communityId', scope.row.communityId);
- sessionStorage.setItem('garageId', scope.row.id);
- this.$router.push({ name: '/parkingLotAdministration/pageJump/partitionManagement' });
- },
- //单个删除
- deleteOne(ids) {
- this.$msgBox(`刪除字典`, '删除后将无法恢复,请问是否继续?')
- .then(() => {
- this.$http.post('/dict/delete', [ids]).then(({ status, data, msg }) => {
- if (0 === status) {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- this.mixins_search();
- } else {
- this.$message.error('删除失败!');
- }
- });
- })
- .catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- 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>
|