feat: handle delete

pull/1/MERGE
xingyuv 2023-03-21 18:20:45 +08:00
parent 9c60aa3640
commit 1701c5dae1
7 changed files with 78 additions and 45 deletions

View File

@ -46,7 +46,7 @@ import { nextTick, ref } from 'vue'
import { getListSimpleUsersApi } from '@/api/system/user'
import { onMounted } from 'vue'
const { createMessage } = useMessage()
const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const [register, { expandAll, collapseAll, getForm, reload }] = useTable({
@ -113,12 +113,16 @@ function handleEdit(record: Recordable) {
}
async function handleDelete(record: Recordable) {
console.log(record)
const res = await deleteDeptApi(record.id)
if (res) {
createMessage.success('删除成功')
reload()
}
createConfirm({
title: '删除',
iconType: 'warning',
content: '是否要删除数据?',
async onOk() {
await deleteDeptApi(record.id)
createMessage.success('删除成功')
reload()
}
})
}
function onFetchSuccess() {

View File

@ -87,11 +87,15 @@ async function handleExport() {
}
async function handleDelete(record: Recordable) {
console.log(record)
const res = await deleteErrorCodeApi(record.id)
if (res) {
createMessage.success('删除成功')
reload()
}
createConfirm({
title: '删除',
iconType: 'warning',
content: '是否要删除数据?',
async onOk() {
await deleteErrorCodeApi(record.id)
createMessage.success('删除成功')
reload()
}
})
}
</script>

View File

@ -33,15 +33,14 @@
</template>
<script lang="ts" setup name="Menu">
import { BasicTable, useTable, TableAction } from '@/components/Table'
import { getMenuListApi } from '@/api/system/menu'
import { deleteMenuApi, getMenuListApi } from '@/api/system/menu'
import { columns, searchFormSchema } from './menu.data'
import { useModal } from '@/components/Modal'
import DeptModel from './MenuModel.vue'
import { useMessage } from '@/hooks/web/useMessage'
import { handleTree } from '@/utils/tree'
import { deleteDeptApi } from '@/api/system/dept'
const { createMessage } = useMessage()
const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const [register, { expandAll, collapseAll, getForm, reload }] = useTable({
@ -87,11 +86,15 @@ function handleEdit(record: Recordable) {
}
async function handleDelete(record: Recordable) {
console.log(record)
const res = await deleteDeptApi(record.id)
if (res) {
createMessage.success('删除成功')
reload()
}
createConfirm({
title: '删除',
iconType: 'warning',
content: '是否要删除数据?',
async onOk() {
await deleteMenuApi(record.id)
createMessage.success('删除成功')
reload()
}
})
}
</script>

View File

@ -37,7 +37,7 @@ import NoticeModal from './NoticeModel.vue'
import { columns, searchFormSchema } from './notice.data'
import { useMessage } from '@/hooks/web/useMessage'
const { createMessage } = useMessage()
const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload }] = useTable({
title: '公告列表',
@ -72,11 +72,15 @@ function handleEdit(record: Recordable) {
}
async function handleDelete(record: Recordable) {
console.log(record)
const res = await deleteNoticeApi(record.id)
if (res) {
createMessage.success('删除成功')
reload()
}
createConfirm({
title: '删除',
iconType: 'warning',
content: '是否要删除数据?',
async onOk() {
await deleteNoticeApi(record.id)
createMessage.success('删除成功')
reload()
}
})
}
</script>

View File

@ -87,11 +87,15 @@ async function handleExport() {
}
async function handleDelete(record: Recordable) {
console.log(record)
const res = await deletePostApi(record.id)
if (res) {
createMessage.success('删除成功')
reload()
}
createConfirm({
title: '删除',
iconType: 'warning',
content: '是否要删除数据?',
async onOk() {
await deletePostApi(record.id)
createMessage.success('删除成功')
reload()
}
})
}
</script>

View File

@ -92,11 +92,15 @@ async function handleExport() {
}
async function handleDelete(record: Recordable) {
console.log(record)
const res = await deleteSensitiveWordApi(record.id)
if (res) {
createMessage.success('删除成功')
reload()
}
createConfirm({
title: '删除',
iconType: 'warning',
content: '是否要删除数据?',
async onOk() {
await deleteSensitiveWordApi(record.id)
createMessage.success('删除成功')
reload()
}
})
}
</script>

View File

@ -39,8 +39,10 @@ import { useModal } from '@/components/Modal'
import UserModel from './UserModel.vue'
import DeptTree from './DeptTree.vue'
import { columns, searchFormSchema } from './user.data'
import { getUserPageApi } from '@/api/system/user'
import { deleteUserApi, getUserPageApi } from '@/api/system/user'
import { useMessage } from '@/hooks/web/useMessage'
const { createConfirm, createMessage } = useMessage()
const [registerModal, { openModal }] = useModal()
const searchInfo = reactive<Recordable>({})
@ -71,15 +73,23 @@ function handleCreate() {
}
function handleEdit(record: Recordable) {
console.log(record)
openModal(true, {
record,
isUpdate: true
})
}
function handleDelete(record: Recordable) {
console.log(record)
async function handleDelete(record: Recordable) {
createConfirm({
title: '删除',
iconType: 'warning',
content: '是否要删除数据?',
async onOk() {
await deleteUserApi(record.id)
createMessage.success('删除成功')
reload()
}
})
}
function handleSuccess({ isUpdate, values }) {