Blame view

src/components/community/moreCommunity.vue 3.1 KB
0e3df9ef   wuxw   优化物业账号下切换小区功能
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  <template>
    <div>
      <el-dialog title="切换小区" :visible.sync="dialogVisible" width="70%" :close-on-click-modal="false">
        <div class="filter-container text-right">
          <el-input :placeholder="$t('communityManage.table.name')" v-model="navCommunityInfo.searchCommunityName"
            style="width: 300px;" class="filter-item"></el-input>
          <el-button class="filter-item" type="primary" icon="el-icon-search" @click="_queryEnterCommunity">
            {{ $t('common.search') }}
          </el-button>
        </div>
  
        <el-table :data="communitys" border fit highlight-current-row style="width: 100%; margin-top: 20px;">
          <el-table-column :label="$t('communityManage.table.communityId')" prop="communityId"
            align="center"></el-table-column>
          <el-table-column :label="$t('communityManage.table.name')" prop="name" align="center"></el-table-column>
          <el-table-column :label="$t('common.operation')" align="center">
            <template slot-scope="scope">
              <el-button size="mini" @click="_chooseCurrentCommunity(scope.row)">
                {{ $t('common.select') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
  
        <div class="pagination-container">
          <el-pagination @current-change="handleCurrentChange" :current-page="currentPage" :page-size="pageSize"
            layout="total, prev, pager, next" :total="total"></el-pagination>
        </div>
      </el-dialog>
    </div>
  </template>
    
  <script>
  import { getMyEnteredCommunitys } from '@/api/community/communityApi'
  import { setCurrentCommunity } from "@/utils/vc"
  
  const DEFAULT_PAGE = 1;
  const DEFAULT_ROW = 10;
  
  
  export default {
    name: 'ChooseEnterCommunity',
    data() {
      return {
        dialogVisible: false,
        currentPage: DEFAULT_PAGE,
        pageSize: DEFAULT_ROW,
        total: 0,
        communitys: [],
        navCommunityInfo: {
          _currentCommunity: {},
          communityInfos: [],
          communityInfo: [],
          errorInfo: '',
          searchCommunityName: ''
        }
      }
    },
    created() {
    },
    methods: {
      open() {
        this.dialogVisible = true;
        this.navCommunityInfo.searchCommunityName = '';
        this.listEnterCommunity(DEFAULT_PAGE, DEFAULT_ROW);
      },
      handleCurrentChange(val) {
        this.currentPage = val;
        this.listEnterCommunity(val, DEFAULT_ROW);
      },
      async listEnterCommunity(_page, _row) {
  
7fc2b308   wuxw   优化代码
73
        const { communitys, total } = await getMyEnteredCommunitys({
0e3df9ef   wuxw   优化物业账号下切换小区功能
74
75
76
77
78
79
          _uid: '123mlkdinkldldijdhuudjdjkkd',
          page: _page,
          row: _row,
          communityName: this.navCommunityInfo.searchCommunityName
        })
        this.communitys = communitys
7fc2b308   wuxw   优化代码
80
        this.total = total;
0e3df9ef   wuxw   优化物业账号下切换小区功能
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
        this.currentPage = _page;
  
      },
      _chooseCurrentCommunity(_currentCommunity) {
        setCurrentCommunity(_currentCommunity)
        
        this.dialogVisible = false;
        window.location.href="/"
      },
      _queryEnterCommunity() {
        this.listEnterCommunity(DEFAULT_PAGE, DEFAULT_ROW);
      }
    }
  }
  </script>
    
  <style scoped>
  .filter-container {
    margin-bottom: 20px;
  }
  
  .pagination-container {
    margin-top: 20px;
    text-align: center;
  }
  </style>