1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-06 07:21:24 +08:00

add the function of deleteNoticeType and modify the router of notice.ts

This commit is contained in:
cccccyb
2023-05-25 01:27:57 +08:00
parent c060a762af
commit 16325f21de
10 changed files with 243 additions and 165 deletions

View File

@@ -40,7 +40,7 @@
</el-dialog>
</el-header>
<el-main>
<notice-type-table />
<notice-type-table @deleteTypeById="deleteTypeById" />
</el-main>
</el-container>
</template>
@@ -48,6 +48,8 @@
import { SIZE_ICON_MD } from '@/constants/Common.constants'
import { useNoticeTypeStore } from '@/store/notice'
import { mapState } from 'pinia'
import { ElMessage, ElMessageBox } from 'element-plus'
import request from '@/services'
const noticeTypeStore = useNoticeTypeStore()
@@ -99,6 +101,30 @@ export default {
},
resetForm() {
this.$refs.addForm.$refs.addTypeData.resetFields()
},
deleteTypeById(typeId) {
ElMessageBox.confirm('确定是否要删除?该操作将无法回退', '警告', {
confirmButtonText: '确定',
cancelButtonText: '我再想想',
type: 'warning'
})
.then(() => {
request.delete('/notice_type/' + typeId).then((response) => {
if (response.data.code === 20024) {
ElMessage({
message: '删除成功.',
type: 'success'
})
noticeTypeStore.selectNoticeType()
} else if (response.data.code === 20034) {
ElMessage({
message: response.data.msg,
type: 'error'
})
}
})
})
.catch(() => {})
}
},
mounted() {}

View File

@@ -5,9 +5,9 @@
</el-header>
<el-main>
<el-menu :default-active="$route.path" class="el-menu-demo" mode="horizontal" router>
<el-menu-item index="/notice/noticeView/all">所有公告</el-menu-item>
<el-menu-item index="/notice/noticeView/toRead">未读</el-menu-item>
<el-menu-item index="/notice/noticeView/alRead">已读</el-menu-item>
<el-menu-item index="/notice/view/all">所有公告</el-menu-item>
<el-menu-item index="/notice/view/toRead">未读</el-menu-item>
<el-menu-item index="/notice/view/alRead">已读</el-menu-item>
</el-menu>
<router-view />
</el-main>