Blame view

src/views/staff/staffList.vue 10.2 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
  <!-- views/staff/staffList.vue -->
  <template>
      <div class="staff-container">
          <!-- Search Conditions -->
          <div class="search-wrapper">
              <el-card>
                  <div slot="header" class="clearfix">
                      <span>{{ $t('staff.searchConditions') }}</span>
                  </div>
                  <el-row :gutter="20">
                      <el-col :span="6">
                          <el-input v-model="staffInfo.conditions.name" :placeholder="$t('staff.staffName')" clearable />
                      </el-col>
                      <el-col :span="6">
                          <el-input v-model="staffInfo.conditions.tel" :placeholder="$t('staff.phoneNumber')" clearable />
                      </el-col>
                      <el-col :span="6">
                          <el-input v-model="staffInfo.conditions.staffId" :placeholder="$t('staff.staffId')" clearable />
                      </el-col>
                      <el-col :span="6">
                          <el-button type="primary" @click="_queryStaffMethod">
                              <i class="el-icon-search"></i>
56732765   wuxw   修改员工界面部分bug
23
                              {{ $t('common.search') }}
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
24
25
26
                          </el-button>
                          <el-button @click="_resetStaffMethod">
                              <i class="el-icon-refresh"></i>
56732765   wuxw   修改员工界面部分bug
27
                              {{ $t('common.reset') }}
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
                          </el-button>
                      </el-col>
                  </el-row>
              </el-card>
          </div>
  
          <!-- Staff List -->
          <div class="list-wrapper">
              <el-card>
                  <div slot="header" class="clearfix">
                      <span>{{ $t('staff.staffManagement') }}</span>
                      <el-button type="primary" size="small" style="float: right;" @click="_openAddStaffStepPage">
                          <i class="el-icon-plus"></i>
                          {{ $t('staff.add') }}
                      </el-button>
                  </div>
  
                  <el-table v-loading="loading" :data="staffData" border style="width: 100%">
                      <el-table-column prop="userId" :label="$t('staff.staffNumber')" align="center" />
                      <el-table-column prop="name" :label="$t('staff.name')" align="center" />
                      <el-table-column prop="tel" :label="$t('staff.phone')" align="center" />
                      <el-table-column prop="orgName" :label="$t('staff.relatedOrg')" align="center" />
                      <el-table-column prop="email" :label="$t('staff.email')" align="center" />
                      <el-table-column prop="address" :label="$t('staff.address')" align="center" />
702baeae   wuxw   v1.9 优化员工没有岗位问题
52
                      <el-table-column prop="relCdName" :label="$t('staff.relCd')" align="center" />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
53
54
                      <el-table-column prop="sex" :label="$t('staff.gender')" align="center">
                          <template slot-scope="scope">
fe63215b   wuxw   v1.9 版本 员工重置密码
55
                              {{ scope.row.sex == 0 ? $t('staff.male') : $t('staff.female') }}
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
83
84
85
86
87
                          </template>
                      </el-table-column>
                      <el-table-column :label="$t('staff.operations')" align="center" width="300">
                          <template slot-scope="scope">
                              <el-button size="mini" @click="openEditStaff(scope.row)">
                                  {{ $t('staff.edit') }}
                              </el-button>
                              <el-button size="mini" @click="_resetStaffPwd(scope.row)">
                                  {{ $t('staff.resetPassword') }}
                              </el-button>
                              <el-button size="mini" type="danger" @click="openDeleteStaff(scope.row)">
                                  {{ $t('staff.delete') }}
                              </el-button>
                              <el-button size="mini" @click="openStaffDetail(scope.row)">
                                  {{ $t('staff.details') }}
                              </el-button>
                          </template>
                      </el-table-column>
                  </el-table>
  
                  <div class="tips margin-top-xs">
                      {{ $t('staff.tips') }}
                  </div>
  
                  <el-pagination :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size"
                      :total="page.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
                      @current-change="handleCurrentChange" />
              </el-card>
          </div>
  
          <reset-staff-pwd :visible.sync="resetPwdVisible" :staff-info="currentStaff" @success="handleSuccess" />
  
702baeae   wuxw   v1.9 优化员工没有岗位问题
88
          <edit-staff ref="editStaff" :staff-info="currentStaff" @success="handleSuccess" />
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
89
90
91
92
  
          <delete-staff :visible.sync="deleteStaffVisible" :staff-info="currentStaff" @success="handleSuccess" />
      </div>
  </template>
56732765   wuxw   修改员工界面部分bug
93
  
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
  <script>
  import { queryStaffInfos, listOrgs } from '@/api/staff/staffApi'
  import ResetStaffPwd from '@/components/staff/resetStaffPwd'
  import EditStaff from '@/components/staff/editStaff'
  import DeleteStaff from '@/components/staff/deleteStaff'
  
  export default {
      name: 'StaffList',
      components: {
          ResetStaffPwd,
          EditStaff,
          DeleteStaff
      },
      data() {
          return {
              loading: false,
              staffInfo: {
                  moreCondition: false,
                  branchOrgs: [],
                  departmentOrgs: [],
                  relCds: [],
                  conditions: {
                      branchOrgId: '',
                      departmentOrgId: '',
                      orgId: '',
                      orgName: '',
                      orgLevel: '2',
                      parentOrgId: '',
                      name: '',
                      tel: '',
                      staffId: '',
                      parentOrgName: '',
                      parentTwoOrgId: ''
                  }
              },
              staffData: [],
              page: {
                  current: 1,
                  size: 10,
                  total: 0
              },
              resetPwdVisible: false,
              editStaffVisible: false,
              deleteStaffVisible: false,
              currentStaff: {}
          }
      },
      watch: {
          'staffInfo.conditions.branchOrgId': {
              handler(val) {
                  this._getOrgsByOrgLevelStaff(1, 10, 3, val)
                  this.staffInfo.conditions.parentOrgId = val
                  this.staffInfo.conditions.departmentOrgId = ''
                  this.loadData(1, 10)
              },
              deep: true
          },
          'staffInfo.conditions.departmentOrgId': {
              handler(val) {
                  this.staffInfo.conditions.orgId = val
                  this.loadData(1, 10)
              },
              deep: true
          }
      },
      created() {
          this.loadData(1, 10)
56732765   wuxw   修改员工界面部分bug
161
          //this._getOrgsByOrgLevelStaff(1, 10, 2, '')
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
162
163
164
165
166
167
168
169
170
171
172
      },
      methods: {
          async loadData(page, size) {
              try {
                  this.loading = true
                  const params = {
                      page: page || this.page.current,
                      row: size || this.page.size,
                      ...this.staffInfo.conditions
                  }
  
56732765   wuxw   修改员工界面部分bug
173
174
                  const { staffs, records } = await queryStaffInfos(params)
                  this.staffData = staffs
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
175
176
177
178
179
180
181
182
183
184
                  this.page.total = records
              } catch (error) {
                  this.$message.error(error.message)
              } finally {
                  this.loading = false
              }
          },
          openEditStaff(staff) {
              this.currentStaff = { ...staff }
              this.editStaffVisible = true
702baeae   wuxw   v1.9 优化员工没有岗位问题
185
              this.$refs.editStaff.open(staff)
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
          },
          openDeleteStaff(staff) {
              this.currentStaff = { ...staff }
              this.deleteStaffVisible = true
          },
          _moreCondition() {
              this.staffInfo.moreCondition = !this.staffInfo.moreCondition
          },
          async _getOrgsByOrgLevelStaff(page, size, orgLevel, parentOrgId) {
              try {
                  const params = {
                      page,
                      row: size,
                      orgLevel,
                      parentOrgId
                  }
  
                  const { orgs } = await listOrgs(params)
                  if (orgLevel === 2) {
                      this.staffInfo.branchOrgs = orgs
                  } else {
                      this.staffInfo.departmentOrgs = orgs
                  }
              } catch (error) {
                  this.$message.error(error.message)
              }
          },
          _openAddStaffStepPage() {
              this.$router.push('/views/staff/addStaff')
          },
          _queryStaffMethod() {
              this.loadData(1, this.page.size)
          },
          _resetStaffMethod() {
              this.staffInfo.conditions = {
                  branchOrgId: '',
                  orgId: '',
                  departmentOrgId: '',
                  name: '',
                  tel: '',
                  staffId: ''
              }
              this.loadData(1, this.page.size)
          },
          _resetStaffPwd(staff) {
              this.currentStaff = { ...staff }
              this.resetPwdVisible = true
          },
          openStaffDetail(staff) {
caba9d96   wuxw   oa 中除了 工作办理没有测试其他...
235
              this.$router.push(`/views/staff/staffDetail?staffId=${staff.userId}`)
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
          },
          handleSuccess() {
              this.loadData(this.page.current, this.page.size)
          },
          handleSizeChange(val) {
              this.page.size = val
              this.loadData(1, val)
          },
          handleCurrentChange(val) {
              this.page.current = val
              this.loadData(val, this.page.size)
          }
      }
  }
  </script>
56732765   wuxw   修改员工界面部分bug
251
  
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
  <style lang="scss" scoped>
  .staff-container {
      padding: 20px;
  
      .search-wrapper {
          margin-bottom: 20px;
          text-align: left;
  
          .el-card__header {
              padding: 10px 20px;
              font-weight: bold;
  
          }
      }
  
      .list-wrapper {
          text-align: left;
  
          .el-card__header {
              padding: 10px 20px;
              font-weight: bold;
          }
  
          .tips {
              margin-top: 20px;
              padding: 10px;
              background-color: #f8f8f8;
              border-radius: 4px;
              color: #666;
              font-size: 14px;
          }
  
          .el-pagination {
              margin-top: 20px;
              text-align: right;
          }
      }
  
      .margin-top-xs {
          margin-top: 10px;
      }
  }
  </style>