提交 662db3e2 authored 作者: pengxiaohui's avatar pengxiaohui

删除员工增加提示

上级 b76d967b
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
</template> </template>
<script> <script>
import TableList from '@/components/TableList' import TableList from '@/components/TableList'
import { getStaffList, getProjectList, getRoleList, createStaff, updateStaff, batchDeleteStaff, clearUserCached } from '@/api/settings' import { getStaffList, getProjectList, getRoleList, createStaff, updateStaff, batchDeleteStaff } from '@/api/settings'
import { sendCode, updatePassword, updateUserInfo } from '@/api/account' import { sendCode, updatePassword, updateUserInfo } from '@/api/account'
import { searchUserList } from '@/api/system' import { searchUserList } from '@/api/system'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
...@@ -286,19 +286,24 @@ export default { ...@@ -286,19 +286,24 @@ export default {
}, },
// 删除 // 删除
handleRemove() { handleRemove() {
const ids = this.multipleSelection.map(item => item.sso_id) const selection = this.multipleSelection
if (ids.includes(this.user.id)) { const ids = selection.map(item => item.sso_id)
this.$message.error('您所删除的员工包含你的账户,删除后将导致您没法使用此系统') let isWarn = false
return for (const i in selection) {
} if (selection[i].status === 0) {
batchDeleteStaff({ sso_ids: ids }).then(res => { isWarn = true
if (res.code === 0) {
this.$message.success('删除成功')
this.$refs.tabList.refetch(true)
} else {
this.$message.error(res.message)
} }
}) }
if (isWarn) {
this.$confirm('选中的项中有已启用的账户, 是否继续执行删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.fetchDeleteStaff(ids)
}).catch(() => {});
} else {
this.fetchDeleteStaff(ids)
}
}, },
handleCreate() { handleCreate() {
this.drawerVisible = true this.drawerVisible = true
...@@ -520,11 +525,16 @@ export default { ...@@ -520,11 +525,16 @@ export default {
} }
}) })
}, },
fetchClearUserCached() { fetchDeleteStaff(ids) {
const id = this.operateItem.sso_id || '' if (ids.includes(this.user.id)) {
clearUserCached(id).then(res => { this.$message.error('您所删除的账户包含你的账户,删除后将导致您没法使用此系统')
if (res.code === 0 && res.data && res.data.status) { }
this.$refs.tabList.refetch() batchDeleteStaff({ sso_ids: ids }).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.$refs.tabList.refetch(true)
} else {
this.$message.error(res.message)
} }
}) })
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论