Blame view

src/views/staff/aStaffList.vue 6.37 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
cf9ca7dc   wuxw   优化前段代码bug
2
    <div class="padding">
ebc1053d   wuxw   加入运营员工详情功能
3
4
5
6
7
8
      <el-card class="box-card margin-bottom">
        <div slot="header" class="clearfix flex justify-between">
          <span>{{ $t('staff.searchConditions') }}</span>
        </div>
        <el-row :gutter="20">
          <el-col :span="6">
cf9ca7dc   wuxw   优化前段代码bug
9
            <el-input :placeholder="$t('staff.staffId')" v-model="searchConditions.staffId" clearable />
ebc1053d   wuxw   加入运营员工详情功能
10
11
          </el-col>
          <el-col :span="6">
cf9ca7dc   wuxw   优化前段代码bug
12
            <el-input :placeholder="$t('staff.staffName')" v-model="searchConditions.name" clearable />
ebc1053d   wuxw   加入运营员工详情功能
13
14
          </el-col>
          <el-col :span="6">
cf9ca7dc   wuxw   优化前段代码bug
15
            <el-input :placeholder="$t('staff.phoneNumber')" v-model="searchConditions.tel" clearable />
ebc1053d   wuxw   加入运营员工详情功能
16
17
          </el-col>
          <el-col :span="6">
c54a6f92   wuxw   v1.9 优化员工页面分页问题
18
            <el-button type="primary" @click="searchStaff">
ebc1053d   wuxw   加入运营员工详情功能
19
20
21
22
23
24
25
26
              {{ $t('staff.search') }}
            </el-button>
          </el-col>
        </el-row>
      </el-card>
  
      <el-card class="box-card">
        <div slot="header" class="clearfix  flex justify-between">
cf9ca7dc   wuxw   优化前段代码bug
27
          <span>{{ $t('staff.staffManagement') }}</span>
ebc1053d   wuxw   加入运营员工详情功能
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
          <el-button v-if="hasPrivilege(['502022082992310001', '502022101889270183'])" type="primary" size="small"
            class="float-right" @click="openAddStaffPage">
            {{ $t('staff.add') }}
          </el-button>
        </div>
  
        <el-table :data="staffList" border style="width: 100%">
          <el-table-column prop="userId" :label="$t('staff.staffId')" 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="relCdName" :label="$t('staff.position')" align="center" />
          <el-table-column prop="idCard" :label="$t('staff.idCard')" align="center" />
          <el-table-column prop="address" :label="$t('staff.address')" align="center" />
          <el-table-column :label="$t('staff.gender')" align="center">
            <template slot-scope="scope">
a1cba8c1   wuxw   v1.9 修复admin 员工无法...
44
              {{ scope.row.sex == 0 ? $t('staff.male') : $t('staff.female') }}
ebc1053d   wuxw   加入运营员工详情功能
45
46
47
48
49
50
51
52
53
            </template>
          </el-table-column>
          <el-table-column :label="$t('staff.operations')" align="center" width="300">
            <template slot-scope="scope">
              <el-button v-if="hasPrivilege(['502022082992300002', '502022101832220184'])" size="mini"
                @click="openEditStaff(scope.row)">
                {{ $t('staff.edit') }}
              </el-button>
              <el-button size="mini" @click="openResetPwd(scope.row)">
cf9ca7dc   wuxw   优化前段代码bug
54
                {{ $t('staff.resetPassword') }}
ebc1053d   wuxw   加入运营员工详情功能
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
              </el-button>
              <el-button
                v-if="scope.row.relCd !== '600311000001' && hasPrivilege(['502022082920350003', '502022101887680185'])"
                size="mini" type="danger" @click="openDeleteStaff(scope.row)">
                {{ $t('staff.delete') }}
              </el-button>
              <el-button size="mini" type="info" @click="openStaffDetail(scope.row)">
                {{ $t('staff.details') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
  
        <el-row class="margin-top">
          <el-col :span="16">
c54a6f92   wuxw   v1.9 优化员工页面分页问题
70
            <div class="tip-text"></div>
ebc1053d   wuxw   加入运营员工详情功能
71
72
73
74
75
76
77
78
79
80
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
          </el-col>
          <el-col :span="8" class="text-right">
            <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" />
          </el-col>
        </el-row>
      </el-card>
  
      <reset-staff-pwd ref="resetPwdDialog" @success="queryStaff" />
      <edit-staff ref="editStaffDialog" @success="queryStaff" />
      <delete-staff ref="deleteStaffDialog" @success="queryStaff" />
    </div>
  </template>
  
  <script>
  import { queryStaffInfos } from '@/api/staff/aStaffApi'
  import ResetStaffPwd from '@/components/staff/resetStaffPwd'
  import EditStaff from '@/components/staff/editStaff'
  import DeleteStaff from '@/components/staff/deleteStaff'
  import { getDict } from '@/api/community/communityApi'
  
  export default {
    name: 'AStaffList',
    components: {
      ResetStaffPwd,
      EditStaff,
      DeleteStaff
    },
    data() {
      return {
        searchConditions: {
          staffId: '',
          name: '',
          tel: ''
        },
        staffList: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        },
        relCds: []
      }
    },
    created() {
      this.getDictData()
      this.queryStaff()
    },
    methods: {
      async getDictData() {
        try {
          const res = await getDict('u_org_staff_rel', 'rel_cd')
          if (res.code === 0) {
            this.relCds = res.data
          }
        } catch (error) {
          console.error('获取字典数据失败:', error)
        }
      },
c54a6f92   wuxw   v1.9 优化员工页面分页问题
131
132
133
134
      searchStaff() {
        this.pagination.current = 1
        this.queryStaff()
      },
ebc1053d   wuxw   加入运营员工详情功能
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
      async queryStaff() {
        try {
          const params = {
            ...this.searchConditions,
            page: this.pagination.current,
            row: this.pagination.size
          }
  
          const res = await queryStaffInfos(params)
          console.log(res)
  
          this.staffList = res.staffs.map(staff => {
            const relCdItem = this.relCds.find(item => item.statusCd === staff.relCd)
            return {
              ...staff,
              relCdName: relCdItem ? relCdItem.name : ''
            }
          })
c54a6f92   wuxw   v1.9 优化员工页面分页问题
153
          this.pagination.total = res.total
ebc1053d   wuxw   加入运营员工详情功能
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
  
        } catch (error) {
          console.error('查询员工信息失败:', error)
        }
      },
      openResetPwd(staff) {
        this.$refs.resetPwdDialog.open(staff)
      },
      openEditStaff(staff) {
        this.$refs.editStaffDialog.open(staff)
      },
      openDeleteStaff(staff) {
        this.$refs.deleteStaffDialog.open(staff)
      },
      openStaffDetail(staff) {
        this.$router.push(`/views/staff/aStaffDetail?staffId=${staff.userId}`)
      },
      openAddStaffPage() {
        this.$router.push('/views/staff/addStaff')
      },
      handleSizeChange(size) {
        this.pagination.size = size
        this.queryStaff()
      },
      handlePageChange(page) {
        this.pagination.current = page
        this.queryStaff()
      },
  
    }
  }
  </script>
  
  <style scoped>
  .box-card {
    margin-bottom: 20px;
  }
  
  .float-right {
    float: right;
  }
  
  .margin-top {
    margin-top: 20px;
  }
  
  .margin-bottom {
    margin-bottom: 20px;
  }
  
  .text-right {
    text-align: right;
  }
  
  .tip-text {
    color: #999;
    font-size: 12px;
    padding: 10px 0;
  }
  </style>