Blame view

src/views/community/communityManageList.vue 8.03 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
73
74
75
76
77
78
79
80
81
82
  <template>
    <div class="community-manage-container">
      <!-- 查询条件 -->
      <el-card>
        <div slot="header" class="clearfix flex justify-between">
          <span>{{ $t('communityManage.search.title') }}</span>
          <div style="float: right;">
          </div>
        </div>
        <el-row :gutter="20">
          <el-col :span="4">
            <el-input v-model="communityManageInfo.conditions.communityId"
              :placeholder="$t('communityManage.search.communityId')" clearable />
          </el-col>
          <el-col :span="4">
            <el-input v-model="communityManageInfo.conditions.name" :placeholder="$t('communityManage.search.name')"
              clearable />
          </el-col>
          <el-col :span="12">
            <area-select @selectArea="selectArea" />
          </el-col>
          <el-col :span="4">
            <el-button type="primary" @click="_queryCommunityMethod">
              {{ $t('common.search') }}
            </el-button>
          </el-col>
        </el-row>
      </el-card>
  
      <!-- 小区信息 -->
  
      <el-card>
        <div slot="header" class="clearfix flex justify-between">
          <span>{{ $t('communityManage.list.title') }}</span>
          <div style="float: right;">
            <el-button type="primary" size="small" @click="toDoc('/pages/hc/addCommunity_cn.html')">
              {{ $t('common.document') }}
            </el-button>
            <el-button type="primary" size="small" @click="_openAddCommunityModal">
              {{ $t('communityManage.list.addCommunity') }}
            </el-button>
          </div>
        </div>
        <el-table :data="communityManageInfo.communitys" border style="width: 100%">
          <el-table-column prop="communityId" :label="$t('communityManage.table.communityId')" align="center" />
          <el-table-column prop="name" :label="$t('communityManage.table.name')" align="center" />
          <el-table-column prop="storeName" :label="$t('communityManage.table.storeName')" align="center">
            <template #default="{ row }">
              {{ row.storeName || '-' }}
            </template>
          </el-table-column>
          <el-table-column prop="nearbyLandmarks" :label="$t('communityManage.table.nearbyLandmarks')" align="center" />
          <el-table-column prop="cityName" :label="$t('communityManage.table.cityCode')" align="center" />
          <el-table-column prop="createTime" :label="$t('communityManage.table.createTime')" align="center" />
          <el-table-column v-for="(item, index) in communityManageInfo.listColumns" :key="index" :label="item.specName"
            align="center">
            <template #default="{ row }">
              {{ row.listValues[index] }}
            </template>
          </el-table-column>
          <el-table-column prop="stateName" :label="$t('communityManage.table.state')" align="center" />
          <el-table-column :label="$t('common.operation')" align="center" width="220">
            <template #default="{ row }">
              <el-button-group>
                <el-button size="mini" @click="_openDeleteCommunityModel(row)">
                  {{ $t('common.delete') }}
                </el-button>
                <el-button size="mini" @click="_openEditCommunityModel(row)">
                  {{ $t('common.edit') }}
                </el-button>
                <el-button size="mini" @click="_sendCommunityIot(row)">
                  {{ $t('communityManage.table.syncIot') }}
                </el-button>
              </el-button-group>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination :current-page.sync="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size"
          :total="pagination.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
          @current-change="handleCurrentChange" />
      </el-card>
      <!-- 组件 -->
6db3ce8f   wuxw   优化 post 显示动画
83
84
85
      <add-community ref="addCommunity" @listData="_queryCommunityMethod" />
      <edit-community ref="editCommunity" @listData="_queryCommunityMethod" />
      <delete-community ref="deleteCommunity" @listData="_queryCommunityMethod" />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
      <community-data-to-iot ref="communityDataToIot" />
    </div>
  </template>
  
  <script>
  import { listCommunitys } from '@/api/community/communityManageApi'
  import AreaSelect from '@/components/community/areaSelect'
  import AddCommunity from '@/components/community/addCommunity'
  import EditCommunity from '@/components/community/editCommunity'
  import DeleteCommunity from '@/components/community/deleteCommunity'
  import CommunityDataToIot from '@/components/community/communityDataToIot'
  import { getAttrSpecList } from '@/api/dev/attrSpecApi'
  
  export default {
    name: 'CommunityManageList',
    components: {
      AreaSelect,
      AddCommunity,
      EditCommunity,
      DeleteCommunity,
      CommunityDataToIot,
    },
    data() {
      return {
        communityManageInfo: {
          communitys: [],
          storeTypeCd: '',
          conditions: {
            name: '',
            cityCode: '',
            communityId: ''
          },
          listColumns: []
        },
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this._initMethod()
    },
    methods: {
      async _initMethod() {
        await this._getColumns()
        this._listCommunitys(this.pagination.current, this.pagination.size)
      },
      _listCommunitys(page, size) {
        const params = {
          ...this.communityManageInfo.conditions,
          page,
          row: size
        }
        listCommunitys(params).then(res => {
          this.communityManageInfo.total = res.total
          this.communityManageInfo.records = res.records
          this.communityManageInfo.communitys = res.communitys
          this.dealCommunityAttr(res.communitys)
cfccdf5c   wuxw   v1.9 修复业务受理页面部分bug
146
          this.pagination.total = res.total
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
        }).catch(error => {
          console.error('请求失败处理', error)
        })
      },
      selectArea(area) {
        this.communityManageInfo.conditions.cityCode = area.selectArea
      },
      _openAddCommunityModal() {
        this.$refs.addCommunity.openModal()
      },
      _openEditCommunityModel(community) {
        this.$refs.editCommunity.openModal(community)
      },
      _openDeleteCommunityModel(community) {
        this.$refs.deleteCommunity.openModal(community)
      },
      _queryCommunityMethod() {
        this.pagination.current = 1
        this._listCommunitys(this.pagination.current, this.pagination.size)
      },
      _resetCommunityMethod() {
        this.communityManageInfo.conditions = {
          name: '',
          cityCode: '',
          communityId: ''
        }
        this._listCommunitys(this.pagination.current, this.pagination.size)
      },
      _sendCommunityIot(community) {
        this.$refs.communityDataToIot.openModal(community)
      },
      dealCommunityAttr(communitys) {
        communitys.forEach(item => {
          this._getColumnsValue(item)
        })
      },
      _getColumnsValue(community) {
        community.listValues = []
        if (!community.communityAttrDtos || community.communityAttrDtos.length < 1) {
          this.communityManageInfo.listColumns.forEach(() => {
            community.listValues.push('')
          })
          return
        }
        this.communityManageInfo.listColumns.forEach(column => {
          let tmpValue = ''
          community.communityAttrDtos.forEach(attrItem => {
            if (column.specCd === attrItem.specCd) {
              tmpValue = attrItem.value
            }
          })
          community.listValues.push(tmpValue)
        })
      },
      async _getColumns() {
        const { data } = await getAttrSpecList({
          page: 1,
          row: 100,
6db3ce8f   wuxw   优化 post 显示动画
205
          tableName: 'building_community_attr'
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
        })
        this.communityManageInfo.listColumns = []
        data.forEach(item => {
          if (item.listShow === 'Y') {
            this.communityManageInfo.listColumns.push({
              specCd: item.specCd,
              specName: item.specName
            })
          }
        })
      },
      handleSizeChange(val) {
        this.pagination.size = val
        this._listCommunitys(this.pagination.current, val)
      },
      handleCurrentChange(val) {
        this.pagination.current = val
        this._listCommunitys(val, this.pagination.size)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .community-manage-container {
    padding: 20px;
  
    .el-card {
      margin-bottom: 20px;
    }
  }
  </style>