소스 검색

修改内容

yangg 1 개월 전
부모
커밋
cfa3e98f3f

+ 2 - 2
.env.development

@@ -5,8 +5,8 @@ ENV = 'development'
 #线下:http://192.168.100.187:8083
 # 本地环境接口地址 121.36.251.245
 
-#VITE_API_URL = 'http://192.168.100.106:8086'
-VITE_API_URL = 'http://1.94.168.85:8086'
+VITE_API_URL = 'http://192.168.100.106:8086'
+#VITE_API_URL = 'http://1.94.168.85:8086'
 # VITE_API_URL = 'https://backend.qicai321.com'
 VITE_API_WX_URL='https://api.weixin.qq.com/'
 VITE_API_URL_MINLONG='http://117.185.80.170:7861'

+ 1 - 1
src/views/system/device/crud.tsx

@@ -223,7 +223,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 				onSelectionChange
 			},
 			toolbar:{
-				show:true,
+				show:false,
 			},
 			rowHandle: {
 				fixed: 'right',

+ 1 - 1
src/views/system/login/index.vue

@@ -23,7 +23,7 @@
 					<div class="flex flex-col items-center justify-center p-8 pt-14">
 						<!-- Logo -->
 						<div class="logo-title">
-							<img src="../../../assets/rayLogo.png" alt="" style="width: 70px; height: 70px;margin-right: 10px;">
+							<img :src="siteLogo||'../../../assets/rayLogo.png'" alt="" style="width: 70px; height: 70px;margin-right: 10px;">
 							<span style="font-size: 20px;font-weight: 600;letter-spacing: 3px;color: #595959;">账号登录</span>
 						</div>
 

+ 15 - 0
src/views/system/messageCenter/api.ts

@@ -58,3 +58,18 @@ export function DelObj(id: DelReq) {
         data: {id},
     });
 }
+
+/**
+ * 批量标记消息为已读
+ * @param messageIds 消息ID数组
+ * @returns {*}
+ */
+export function MarkMessagesRead(messageIds: number[]) {
+    return request({
+        url: apiPrefix + 'mark_app_user_message_read/',
+        method: 'post',
+        data: {
+            message_ids: messageIds
+        },
+    });
+}

+ 88 - 4
src/views/system/messageCenter/crud.tsx

@@ -1,9 +1,10 @@
 import * as api from './api';
 import { dict, useCompute, PageQuery, AddReq, DelReq, EditReq, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud';
 import tableSelector from '/@/components/tableSelector/index.vue';
-import { shallowRef, computed } from 'vue';
+import { shallowRef, computed, ref } from 'vue';
 import manyToMany from '/@/components/manyToMany/index.vue';
 import { auth } from '/@/utils/authFunction';
+import { ElMessage, ElMessageBox } from 'element-plus';
 const { compute } = useCompute();
 
 export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
@@ -34,6 +35,56 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
 		return tabActivted.value === 'receive';
 	});
 
+	// 选中行的状态管理
+	const selectedIds = ref<any[]>([]);
+
+	// 选择变化处理
+	const onSelectionChange = (changed: any[]) => {
+		console.log("selection", changed);
+		selectedIds.value = changed.map((item: any) => item.id);
+	};
+
+	// 将selectedIds暴露给crudExpose
+	(crudExpose as any).selectedIds = selectedIds;
+
+	// 批量已读功能
+	const handleBatchRead = async () => {
+		try {
+			if (selectedIds.value.length === 0) {
+				ElMessage.warning('请先选择要标记为已读的消息');
+				return;
+			}
+
+			// 确认对话框
+			await ElMessageBox.confirm(
+				`确定要将选中的 ${selectedIds.value.length} 条消息标记为已读吗?`,
+				'批量已读确认',
+				{
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning',
+				}
+			);
+
+			// 调用批量已读API
+			await api.MarkMessagesRead(selectedIds.value);
+			
+			ElMessage.success('批量已读操作成功');
+			
+			// 清空选中状态
+			selectedIds.value = [];
+			
+			// 刷新表格
+			crudExpose.doRefresh();
+			
+		} catch (error) {
+			if (error !== 'cancel') {
+				console.error('批量已读失败:', error);
+				ElMessage.error('批量已读操作失败');
+			}
+		}
+	};
+
 	return {
 		crudOptions: {
 			toolbar:{
@@ -45,18 +96,20 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
                     // 紧凑模式
                     compact:{show:false},
                     // 导出按钮
-                   /*  export:{
+                    export:{
                         text: '导出',
                         type: 'primary',
                         size: 'small',
                         icon: 'upload',
                         circle: false,
-                        display: true
-                    }, */
+                        display: true,
+						show:false
+                    },
                     // 列设置按钮
                     columns:{
                         show:false
                     },
+                  
                 }
             },
 			request: {
@@ -65,6 +118,14 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
 				editRequest,
 				delRequest,
 			},
+			table: {
+				rowKey: 'id',
+				selection: {
+					enabled: true,
+					multiple: true,
+				},
+				onSelectionChange,
+			},
 			actionbar: {
 				buttons: {
 					add: {
@@ -73,6 +134,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
 						// 	return tabActivted.value !== 'receive' && auth('messageCenter:Create');
 						// }),
 					},
+					  // 全部已读按钮
+					  batchRead: {
+                        text: '全部已读',
+                        circle: false,
+						type: 'primary',
+                        display: true,
+                        show: computed(() => tabActivted.value === 'receive'),
+                        click: handleBatchRead,
+                    },
 				},
 			},
 			form:{
@@ -121,6 +191,20 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
 						show: false,
 					},
 				}, */
+				$checked: {
+					title: "选择",
+					form: { show: false },
+					column: {
+						type: "selection",
+						align: "center",
+						width: "55px",
+						columnSetDisabled: true, //禁止在列设置中选择
+						show: computed(() => tabActivted.value === 'receive'),
+						selectable(row: any, index: any) {
+							return row.id;
+						}
+					}
+				},
 				_index: {
 					title: '序号',
 					form: { show: false },

+ 1 - 1
src/views/system/organization/api.ts

@@ -7,7 +7,7 @@ export interface OrganizationParams {
   code: string;
   org_type: 1 | 2 | 3 | 4; // 1=学院,2=系部,3=年级,4=班级/组别
   parent: number | null;
-  sort_order: number;
+  sort: number;
   description: string;
   is_active: boolean;
 }

+ 5 - 5
src/views/system/organization/index.vue

@@ -61,8 +61,8 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="排序" prop="sort_order">
-          <el-input-number v-model="form.sort_order" :min="1" />
+        <el-form-item label="排序" prop="sort">
+          <el-input-number v-model="form.sort" :min="0" />
         </el-form-item>
         <el-form-item label="描述" prop="description">
           <el-input
@@ -116,7 +116,7 @@ const form = ref<OrganizationParams>({
   code: '',
   org_type: 1,
   parent: null,
-  sort_order: 0, // 默认为0
+  sort: 0, // 默认为0
   description: '',
   is_active: true
 })
@@ -125,7 +125,7 @@ const rules: FormRules = {
   name: [{ required: true, message: '请输入机构名称', trigger: 'blur' }],
   code: [{ required: true, message: '请输入机构编码', trigger: 'blur' }],
   org_type: [{ required: true, message: '请选择机构类型', trigger: 'change' }],
-  sort_order: [{ required: true, message: '请输入排序号', trigger: 'blur' }]
+  sort: [{ required: true, message: '请输入排序号', trigger: 'blur' }]
 }
 
 // 获取组织机构树数据
@@ -147,7 +147,7 @@ const handleAdd = (data?: any) => {
     code: '',
     org_type: data ? (data.org_type === 1 ? 2 : data.org_type === 2 ? 3 : 4) : 1, // 根据父级类型自动选择子级类型
     parent: data?.id || null,
-    sort_order: 0,
+    sort: 0,
     description: '',
     is_active: true
   }