删除员工

This commit is contained in:
jiutianzhiyu 2021-03-30 09:51:24 +08:00
parent 180027be76
commit 3a566de9d3
2 changed files with 24 additions and 3 deletions

View File

@ -15,3 +15,13 @@ export function getEmployeeList(params) {
params params
}) })
} }
/**
* 删除员工接口
* ****/
export function delEmployee(id) {
return request({
url: `/sys/user/${id}`,
method: 'delete'
})
}

View File

@ -29,13 +29,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" width="280"> <el-table-column label="操作" fixed="right" width="280">
<template> <template slot-scope="{row}">
<el-button type="text" size="small">查看</el-button> <el-button type="text" size="small">查看</el-button>
<el-button type="text" size="small">转正</el-button> <el-button type="text" size="small">转正</el-button>
<el-button type="text" size="small">调岗</el-button> <el-button type="text" size="small">调岗</el-button>
<el-button type="text" size="small">离职</el-button> <el-button type="text" size="small">离职</el-button>
<el-button type="text" size="small">角色</el-button> <el-button type="text" size="small">角色</el-button>
<el-button type="text" size="small">删除</el-button> <el-button type="text" size="small" @click="delEmployee(row.id)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -49,7 +49,7 @@
</template> </template>
<script> <script>
import { getEmployeeList } from '@/api/employees' import { getEmployeeList, delEmployee } from '@/api/employees'
import EmployeeEnum from '@/api/constant/employees' import EmployeeEnum from '@/api/constant/employees'
export default { export default {
data() { data() {
@ -86,6 +86,17 @@ export default {
const obj = EmployeeEnum.hireType.find(item => item.id === cellValue) const obj = EmployeeEnum.hireType.find(item => item.id === cellValue)
// return // return
return obj ? obj.value : '未知' return obj ? obj.value : '未知'
},
//
async delEmployee(id) {
try {
await this.$confirm('确定删除该员工吗?')
await delEmployee(id)
this.getEmployeeList()
this.$message.success('删除员工成功')
} catch (err) {
console.log(err)
}
} }
} }
} }