diff --git a/src/api/user.ts b/src/api/user.ts index edc326a..ce5e406 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -8,7 +8,7 @@ const editPasswordUrl = '/admin/user/password' const userPageUrl = '/admin/user/page' -const addUserUrl = '/admin/user' +const userUrl = '/admin/user' const modifyPwUrl = "/admin/user/modifyPw" @@ -65,7 +65,7 @@ export function userPage(data: any) { export function addUser(data: any) { return new Promise((resolve, reject) => { - postData(addUserUrl, data).then((res: any) => { + postData(userUrl, data).then((res: any) => { resolve(res.data) }).catch(error => { reject(error) @@ -93,7 +93,7 @@ export function modifyPw(data: any) { export function updateUI(data: any) { return new Promise((resolve, reject) => { request({ - url: addUserUrl, + url: userUrl, method: "put", data }).then((res: any) => { @@ -103,3 +103,17 @@ export function updateUI(data: any) { }) }) } + +export function deleteU(ids: any[]) { + return new Promise((resolve, reject) => { + request({ + url: userUrl, + method: "delete", + data: ids + }).then((res: any) => { + resolve(true) + }).catch(error => { + reject(error) + }) + }) +} diff --git a/src/views/permissions-manage/doctor-manage.vue b/src/views/permissions-manage/doctor-manage.vue index 45ff461..a768801 100644 --- a/src/views/permissions-manage/doctor-manage.vue +++ b/src/views/permissions-manage/doctor-manage.vue @@ -48,8 +48,8 @@ :disabled="scope.row.lockFlag == 1">密码 修改 - 删除 + 删除 @@ -74,7 +74,7 @@ import {exportData, tableRemoveRow} from '@/utils/table-util' import CommonPagination from '@/components/common-pagination.vue' import DoctorForm from './form/doctor-form.vue' import ImportDialog from '@/components/import-dialog.vue' -import {modifyPw, updateUserInfo, userPage} from "@/api/user"; +import {deleteU, modifyPw, updateUserInfo, userPage} from "@/api/user"; const tableRef = ref() const doctorFormRef = ref() @@ -138,11 +138,20 @@ const importData = () => { } const removeData = (e?: any) => { const selectRow = e || tableRef.value.getSelectionRows() + tableRemoveRow({data: selectRow}, (res: boolean) => { if (res) { const index = tableData.value.findIndex((item: any) => item === selectRow) tableData.value.splice(index, 1) - // console.log('调用删除', selectRow, index) + const ids: any = []; + selectRow.forEach((row: any) => { + ids.push(row.userId) + }) + deleteU(ids).then(res => { + ElMessage.success("删除成功") + }).catch(() => { + ElMessage.error("删除失败") + }) } }) } diff --git a/src/views/remote-manage/remote-manage.vue b/src/views/remote-manage/remote-manage.vue index bd4d839..b32a201 100644 --- a/src/views/remote-manage/remote-manage.vue +++ b/src/views/remote-manage/remote-manage.vue @@ -1,7 +1,11 @@