Blame view

src/views/store/propertyCompanyManageList.vue 8.12 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
1
2
3
4
5
6
7
8
9
  <template>
    <div class="property-company-container">
      <!-- 查询条件 -->
      <el-card>
        <div slot="header" class="clearfix flex justify-between">
          <span>{{ $t('propertyCompanyManage.queryCondition') }}</span>
        </div>
        <el-row :gutter="20">
          <el-col :span="6">
84ba0155   wuxw   家庭成员测试
10
            <el-input v-model="searchForm.storeId" :placeholder="$t('propertyCompanyManage.enterStoreId')" clearable />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
11
12
          </el-col>
          <el-col :span="6">
84ba0155   wuxw   家庭成员测试
13
            <el-input v-model="searchForm.name" :placeholder="$t('propertyCompanyManage.enterName')" clearable />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
14
15
          </el-col>
          <el-col :span="6">
84ba0155   wuxw   家庭成员测试
16
            <el-input v-model="searchForm.tel" :placeholder="$t('propertyCompanyManage.enterTel')" clearable />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
          </el-col>
          <el-col :span="6">
            <el-button type="primary" @click="handleSearch">
              {{ $t('propertyCompanyManage.search') }}
            </el-button>
            <el-button @click="handleReset">
              {{ $t('propertyCompanyManage.reset') }}
            </el-button>
          </el-col>
        </el-row>
      </el-card>
  
      <!-- 物业公司列表 -->
      <el-card>
        <div slot="header" class="clearfix flex justify-between">
          <span>{{ $t('propertyCompanyManage.propertyCompany') }}</span>
          <div>
            <el-button type="primary" size="small" @click="handleAdd">
              {{ $t('propertyCompanyManage.add') }}
            </el-button>
          </div>
        </div>
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column prop="storeId" :label="$t('propertyCompanyManage.storeId')" align="center" />
          <el-table-column prop="name" :label="$t('propertyCompanyManage.name')" align="center" />
          <el-table-column prop="address" :label="$t('propertyCompanyManage.address')" align="center" />
          <el-table-column prop="tel" :label="$t('propertyCompanyManage.tel')" align="center" />
          <el-table-column prop="corporation" :label="$t('propertyCompanyManage.corporation')" align="center" />
          <el-table-column prop="foundingTime" :label="$t('propertyCompanyManage.foundingTime')" align="center" />
          <el-table-column prop="nearbyLandmarks" :label="$t('propertyCompanyManage.landmark')" align="center" />
          <el-table-column prop="createTime" :label="$t('propertyCompanyManage.createTime')" align="center" />
          <el-table-column :label="$t('propertyCompanyManage.operation')" align="center" width="300">
            <template #default="scope">
              <el-button-group>
                <el-button size="mini" @click="handleEdit(scope.row)">
                  {{ $t('propertyCompanyManage.edit') }}
                </el-button>
84ba0155   wuxw   家庭成员测试
54
                <el-button size="mini" @click="handleDelete(scope.row)">
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
55
56
57
58
59
60
61
62
63
64
                  {{ $t('propertyCompanyManage.delete') }}
                </el-button>
                <el-button size="mini" @click="handleManageCommunity(scope.row)">
                  {{ $t('propertyCompanyManage.manageCommunity') }}
                </el-button>
              </el-button-group>
              <el-button-group style="margin-top: 5px">
                <el-button size="mini" @click="handleAdminLogin(scope.row)">
                  {{ $t('propertyCompanyManage.login') }}
                </el-button>
84ba0155   wuxw   家庭成员测试
65
                <el-button size="mini" v-if="scope.row.state !== '48002'" @click="handleUpdateState(scope.row, '48002')">
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
66
67
                  {{ $t('propertyCompanyManage.restrictLogin') }}
                </el-button>
84ba0155   wuxw   家庭成员测试
68
                <el-button size="mini" v-else @click="handleUpdateState(scope.row, '48001')">
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
                  {{ $t('propertyCompanyManage.restoreLogin') }}
                </el-button>
                <el-button size="mini" @click="handleResetPwd(scope.row)">
                  {{ $t('propertyCompanyManage.resetPwd') }}
                </el-button>
              </el-button-group>
            </template>
          </el-table-column>
        </el-table>
  
        <el-row>
          <el-col :span="12">
            <div class="tip">{{ $t('propertyCompanyManage.tip') }}</div>
          </el-col>
          <el-col :span="12">
84ba0155   wuxw   家庭成员测试
84
85
86
            <el-pagination :current-page="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="handlePageChange" />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
146
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
205
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
238
239
240
241
242
243
244
245
          </el-col>
        </el-row>
      </el-card>
  
      <!-- 组件 -->
      <add-property-company ref="addPropertyCompany" @success="handleSuccess" />
      <edit-property-company ref="editPropertyCompany" @success="handleSuccess" />
      <delete-property-company ref="deletePropertyCompany" @success="handleSuccess" />
      <admin-login-property ref="adminLoginProperty" @success="handleLoginSuccess" />
      <update-store-state ref="updateStoreState" @success="handleSuccess" />
      <reset-staff-pwd ref="resetStaffPwd" @success="handleSuccess" />
    </div>
  </template>
  
  <script>
  import { getPropertyList, getPropertyStaffs } from '@/api/store/propertyCompanyManageApi'
  
  export default {
    name: 'PropertyCompanyManageList',
    components: {
      AddPropertyCompany: () => import('@/components/store/AddPropertyCompany'),
      EditPropertyCompany: () => import('@/components/store/EditPropertyCompany'),
      DeletePropertyCompany: () => import('@/components/store/DeletePropertyCompany'),
      AdminLoginProperty: () => import('@/components/store/AdminLoginProperty'),
      UpdateStoreState: () => import('@/components/store/UpdateStoreState'),
      ResetStaffPwd: () => import('@/components/store/ResetStaffPwd')
    },
    data() {
      return {
        searchForm: {
          storeId: '',
          name: '',
          tel: ''
        },
        tableData: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.getList()
    },
    methods: {
      async getList() {
        try {
          const params = {
            page: this.pagination.current,
            row: this.pagination.size,
            ...this.searchForm
          }
          const { data, total } = await getPropertyList(params)
          this.tableData = data
          this.pagination.total = total
        } catch (error) {
          this.$message.error(this.$t('propertyCompanyManage.fetchError'))
        }
      },
      handleSearch() {
        this.pagination.current = 1
        this.getList()
      },
      handleReset() {
        this.searchForm = {
          storeId: '',
          name: '',
          tel: ''
        }
        this.handleSearch()
      },
      handleAdd() {
        this.$refs.addPropertyCompany.open()
      },
      handleEdit(row) {
        this.$refs.editPropertyCompany.open(row)
      },
      handleDelete(row) {
        this.$refs.deletePropertyCompany.open(row)
      },
      handleManageCommunity(row) {
        this.$router.push(`/views/community/propertyCommunity?storeId=${row.storeId}`)
      },
      async handleAdminLogin(row) {
        try {
          const { data } = await getPropertyStaffs({
            page: 1,
            row: 1,
            relCd: '600311000001',
            storeId: row.storeId
          })
          this.$refs.adminLoginProperty.open({
            ...row,
            staffInfo: data[0]
          })
        } catch (error) {
          this.$message.error(this.$t('propertyCompanyManage.fetchStaffError'))
        }
      },
      handleUpdateState(row, state) {
        this.$refs.updateStoreState.open({
          storeInfo: row,
          state
        })
      },
      async handleResetPwd(row) {
        try {
          const { data } = await getPropertyStaffs({
            page: 1,
            row: 1,
            relCd: '600311000001',
            storeId: row.storeId
          })
          this.$refs.resetStaffPwd.open({
            ...row,
            staffInfo: data[0]
          })
        } catch (error) {
          this.$message.error(this.$t('propertyCompanyManage.fetchStaffError'))
        }
      },
      handleSuccess() {
        this.getList()
      },
      handleLoginSuccess() {
        this.$router.push('/')
      },
      handleSizeChange(size) {
        this.pagination.size = size
        this.getList()
      },
      handlePageChange(page) {
        this.pagination.current = page
        this.getList()
      }
    }
  }
  </script>
  
  <style scoped>
  .property-company-container {
    padding: 20px;
  }
  
  .el-card {
    margin-bottom: 20px;
  }
  
  .tip {
    padding: 10px;
    color: #999;
    font-size: 12px;
  }
  
  .el-button-group {
    margin-bottom: 5px;
  }
  </style>