|
@@ -8,7 +8,7 @@
|
|
|
* @typedef {import("@/api/announcement").NoticeRecord} NoticeRecord
|
|
|
*/
|
|
|
|
|
|
-import { getList, update, add, getAnnouncement, getCategoryList } from "@/api/announcement";
|
|
|
+import { getList, update, add, getAnnouncement, getCategoryList, deleteNotice } from "@/api/announcement";
|
|
|
import { getCustomerList } from "@/api/common/index";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import {
|
|
@@ -499,6 +499,49 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ // 新增:单行删除(操作列按钮)
|
|
|
+ /**
|
|
|
+ * 行删除(操作列按钮)
|
|
|
+ * @this {import('@/views/announcement/types').AnnouncementComponent & import('vue').default}
|
|
|
+ * @param {Partial<NoticeItem>} row - 当前行数据
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ async handleRowDelete(row) {
|
|
|
+ const id = row && row.id;
|
|
|
+ if (!id) {
|
|
|
+ this.$message.warning("缺少公告ID,无法删除");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ await this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+
|
|
|
+ await deleteNotice(id);
|
|
|
+
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ // 刷新列表
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
+ } catch (error) {
|
|
|
+ if (error !== 'cancel') {
|
|
|
+ console.error('删除公告失败:', error);
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: "删除失败,请稍后重试"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消删除"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 保存行数据
|
|
|
* @async
|