Browse Source

新赛事管理

周睿 1 year ago
parent
commit
ef0ff65515

+ 15 - 0
app_business/lib/service/api.dart

@@ -230,6 +230,21 @@ class ApiService extends IService {
       ..id = checkId
       ..cId = routeId);
   }
+
+  Future<void> eventUserAllocRouteAll(Iterable<int> checkIdList) async {
+    await stub
+        .allCourseChackMatch(pb.IdArrRequest()..idArr.addAll(checkIdList));
+  }
+
+  Future<void> eventUserStartAll(Iterable<int> checkIdList) async {
+    await stub
+        .allMatchChackInsStart(pb.IdArrRequest()..idArr.addAll(checkIdList));
+  }
+
+  Future<void> eventUserRestartAll(Iterable<int> checkIdList) async {
+    await stub.allMatchChackInsForceResume(
+        pb.IdArrRequest()..idArr.addAll(checkIdList));
+  }
 }
 
 class EventRegisterInfo {

+ 57 - 17
app_business/lib/view/home/event_manage/event_manage.dart

@@ -17,12 +17,52 @@ class EventManage extends GetView<EventManagerController> {
         level1Title: '赛事列表',
         level1Action: wDate(context),
         level2Title: '用户列表',
-        level2SubTitle: Obx(() => Text(
-              controller.selected?.name != null
-                  ? '(${controller.selected!.name})'
-                  : '',
-              style: const TextStyle(color: Colors.grey, fontSize: 14.22),
-            )));
+        level2SubTitle: Row(
+          children: [
+            Obx(() => Text(
+                  controller.selected?.name != null
+                      ? '(${controller.selected!.name})'
+                      : '',
+                  style: const TextStyle(color: Colors.grey, fontSize: 14.22),
+                )),
+            const Spacer(),
+            SizedBox(
+              height: 27.73,
+              width: 260,
+              child: Row(
+                mainAxisSize: MainAxisSize.min,
+                mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                children: [
+                  SizedBox(
+                      width: 70,
+                      child: SmallButton(
+                        isOutline: true,
+                        color: Colors.orange,
+                        onPressed: controller.userRestartAll,
+                        child: const Text('一键重赛'),
+                      )),
+                  SizedBox(
+                      width: 70,
+                      child: SmallButton(
+                        isOutline: true,
+                        color: Colors.blue,
+                        onPressed: controller.routeAllocAll,
+                        child: const Text('一键分发'),
+                      )),
+                  SizedBox(
+                      width: 70,
+                      child: SmallButton(
+                        isOutline: true,
+                        color: Colors.green,
+                        onPressed: controller.userStartAll,
+                        child: const Text('一键开始'),
+                      ))
+                ],
+              ),
+            ),
+            const SizedBox(width: 20)
+          ],
+        ));
   }
 
   Widget wDate(BuildContext context) {
@@ -168,25 +208,25 @@ class EventManage extends GetView<EventManagerController> {
                 onPressed: () => controller.userStart(one),
                 text: '开始')
             : Text(stateStr, style: TextStyle(color: stateColor)),
-        SizedBox(
-            width: 51.2,
-            height: 22.76,
-            child: SmallButton(
-              color: optColor,
-              isOutline: true,
-              onPressed: opt,
-              child: Text(optStr),
-            ))
+        button(text: optStr, color: optColor, isOutline: true, onPressed: opt)
       ]);
     });
   }
 
-  Widget button({Color? color, VoidCallback? onPressed, required String text}) {
+  Widget button(
+      {Color? color,
+      VoidCallback? onPressed,
+      isOutline = false,
+      required String text}) {
     return SizedBox(
         height: 22.78,
         width: 51.2,
         child: SmallButton(
-            color: Colors.blue, onPressed: onPressed, child: Text(text)));
+          color: color,
+          onPressed: onPressed,
+          isOutline: isOutline,
+          child: Text(text),
+        ));
   }
 
   Future<void> routeSelect(UserInManage user) async {

+ 24 - 2
app_business/lib/view/home/event_manage/event_manage_controller.dart

@@ -152,9 +152,31 @@ class EventManagerController extends GetxController {
     await _api.stub.matchChackInsStart(IdRequest()..id = Int64(user.checkId));
   }
 
-  Future<void> routeSelectAll() async {
+  Future<void> routeAllocAll() async {
     final idList = selectedUser.value.toList();
-    // await routeSelect(idList);
+    if (idList.isEmpty) {
+      Get.snackbar('操作失败', '请选择1个以上的用户');
+      return;
+    }
+    await _api.eventUserAllocRouteAll(idList);
+  }
+
+  Future<void> userStartAll() async {
+    final idList = selectedUser.value.toList();
+    if (idList.isEmpty) {
+      Get.snackbar('操作失败', '请选择1个以上的用户');
+      return;
+    }
+    await _api.eventUserStartAll(idList);
+  }
+
+  Future<void> userRestartAll() async {
+    final idList = selectedUser.value.toList();
+    if (idList.isEmpty) {
+      Get.snackbar('操作失败', '请选择1个以上的用户');
+      return;
+    }
+    await _api.eventUserRestartAll(idList);
   }
 
   Future<void> deleteSignIn(UserInManage user) async {

+ 1 - 1
libs/track_common/lib/widget/level2_view.dart

@@ -66,7 +66,7 @@ class Level2View extends StatelessWidget {
           children: [
             const Padding(padding: EdgeInsets.all(8), child: TitlePoint()),
             Text(level2Title, style: titleStyle),
-            level2SubTitle,
+            Expanded(child: level2SubTitle),
           ],
         ),
         Expanded(