|
@@ -411,14 +411,14 @@ export default {
|
|
|
} catch (error) {
|
|
|
console.error('加载分类选项失败:', error);
|
|
|
this.$message.error('加载分类选项失败,使用默认分类');
|
|
|
-
|
|
|
+
|
|
|
// 使用默认分类选项
|
|
|
/** @type {Array<CategoryOption>} */
|
|
|
this.categoryOptions = [
|
|
|
{ id: 1, name: '系统公告', value: 1, label: '系统公告', sortOrder: 0 },
|
|
|
{ id: 2, name: '部门公告', value: 2, label: '部门公告', sortOrder: 1 }
|
|
|
];
|
|
|
-
|
|
|
+
|
|
|
const categoryColumn = this.option.column.find(col => col.prop === 'categoryId');
|
|
|
if (categoryColumn) {
|
|
|
categoryColumn.dicData = this.categoryOptions;
|
|
@@ -437,7 +437,7 @@ export default {
|
|
|
this.$message.warning("请选择一条数据查看详情");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
const response = await getAnnouncement(this.selectionList[0].id);
|
|
|
/** @type {NoticeItem} */
|
|
@@ -466,7 +466,7 @@ export default {
|
|
|
loading();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!row.content?.trim()) {
|
|
|
this.$message.error('公告内容不能为空');
|
|
|
loading();
|
|
@@ -542,13 +542,13 @@ export default {
|
|
|
loading();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!row.title?.trim()) {
|
|
|
this.$message.error('公告标题不能为空');
|
|
|
loading();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!row.content?.trim()) {
|
|
|
this.$message.error('公告内容不能为空');
|
|
|
loading();
|
|
@@ -573,7 +573,7 @@ export default {
|
|
|
const selectedIds = (row.customerBlacklist || []).map(item => item.id);
|
|
|
return selectedIds.includes(customer.id);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 构建更新数据
|
|
|
/** @type {import('@/api/announcement').NoticeFormData} */
|
|
|
const formData = {
|
|
@@ -675,11 +675,11 @@ export default {
|
|
|
done();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const response = await getAnnouncement(this.form.id);
|
|
|
/** @type {NoticeItem} */
|
|
|
const formData = response.data?.data || {};
|
|
|
-
|
|
|
+
|
|
|
// 将掩码值转换为数值数组格式供表单使用
|
|
|
const roleObjects = this.parseRolesMask(formData.visibleRoles || 0);
|
|
|
formData.visibleRoles = roleObjects.map(role => role.value);
|
|
@@ -736,7 +736,7 @@ export default {
|
|
|
if (!page || typeof page.currentPage !== 'number' || typeof page.pageSize !== 'number') {
|
|
|
throw new Error('分页参数无效');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/** @type {QueryParams} */
|
|
|
const query = {
|
|
|
...params,
|
|
@@ -746,11 +746,11 @@ export default {
|
|
|
|
|
|
const response = await getList(page.currentPage, page.pageSize, query);
|
|
|
const data = response.data.data;
|
|
|
-
|
|
|
+
|
|
|
if (!data) {
|
|
|
throw new Error('响应数据格式错误');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.page.total = data.total || 0;
|
|
|
/** @type {Array<NoticeItem>} */
|
|
|
this.data = Array.isArray(data.records) ? data.records : [];
|