周睿 2 роки тому
батько
коміт
fd54e5a3cc

+ 42 - 0
app_business/lib/generated/track_offical.pb.dart

@@ -194,6 +194,7 @@ class ToActivityRulesSaveInfo extends $pb.GeneratedMessage {
   factory ToActivityRulesSaveInfo({
     $core.int? arrId,
     $core.String? arValue,
+    $core.bool? isLock,
   }) {
     final $result = create();
     if (arrId != null) {
@@ -202,6 +203,9 @@ class ToActivityRulesSaveInfo extends $pb.GeneratedMessage {
     if (arValue != null) {
       $result.arValue = arValue;
     }
+    if (isLock != null) {
+      $result.isLock = isLock;
+    }
     return $result;
   }
   ToActivityRulesSaveInfo._() : super();
@@ -211,6 +215,7 @@ class ToActivityRulesSaveInfo extends $pb.GeneratedMessage {
   static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ToActivityRulesSaveInfo', package: const $pb.PackageName(_omitMessageNames ? '' : 'to.v1'), createEmptyInstance: create)
     ..a<$core.int>(1, _omitFieldNames ? '' : 'arrId', $pb.PbFieldType.O3, protoName: 'arrId')
     ..aOS(2, _omitFieldNames ? '' : 'arValue', protoName: 'arValue')
+    ..aOB(3, _omitFieldNames ? '' : 'isLock', protoName: 'isLock')
     ..hasRequiredFields = false
   ;
 
@@ -252,6 +257,15 @@ class ToActivityRulesSaveInfo extends $pb.GeneratedMessage {
   $core.bool hasArValue() => $_has(1);
   @$pb.TagNumber(2)
   void clearArValue() => clearField(2);
+
+  @$pb.TagNumber(3)
+  $core.bool get isLock => $_getBF(2);
+  @$pb.TagNumber(3)
+  set isLock($core.bool v) { $_setBool(2, v); }
+  @$pb.TagNumber(3)
+  $core.bool hasIsLock() => $_has(2);
+  @$pb.TagNumber(3)
+  void clearIsLock() => clearField(3);
 }
 
 class ToActivityRulesQueryReply extends $pb.GeneratedMessage {
@@ -306,6 +320,8 @@ class ToActivityRulesInfo extends $pb.GeneratedMessage {
     $core.int? arType,
     $core.Iterable<ToActivityRulesSelect>? arValueSelectList,
     $core.String? arValue,
+    $core.bool? toLock,
+    $core.bool? toIsLockEdit,
   }) {
     final $result = create();
     if (arrId != null) {
@@ -326,6 +342,12 @@ class ToActivityRulesInfo extends $pb.GeneratedMessage {
     if (arValue != null) {
       $result.arValue = arValue;
     }
+    if (toLock != null) {
+      $result.toLock = toLock;
+    }
+    if (toIsLockEdit != null) {
+      $result.toIsLockEdit = toIsLockEdit;
+    }
     return $result;
   }
   ToActivityRulesInfo._() : super();
@@ -339,6 +361,8 @@ class ToActivityRulesInfo extends $pb.GeneratedMessage {
     ..a<$core.int>(4, _omitFieldNames ? '' : 'arType', $pb.PbFieldType.O3, protoName: 'arType')
     ..pc<ToActivityRulesSelect>(5, _omitFieldNames ? '' : 'arValueSelectList', $pb.PbFieldType.PM, protoName: 'arValueSelectList', subBuilder: ToActivityRulesSelect.create)
     ..aOS(6, _omitFieldNames ? '' : 'arValue', protoName: 'arValue')
+    ..aOB(7, _omitFieldNames ? '' : 'toLock', protoName: 'toLock')
+    ..aOB(8, _omitFieldNames ? '' : 'toIsLockEdit', protoName: 'toIsLockEdit')
     ..hasRequiredFields = false
   ;
 
@@ -410,6 +434,24 @@ class ToActivityRulesInfo extends $pb.GeneratedMessage {
   $core.bool hasArValue() => $_has(5);
   @$pb.TagNumber(6)
   void clearArValue() => clearField(6);
+
+  @$pb.TagNumber(7)
+  $core.bool get toLock => $_getBF(6);
+  @$pb.TagNumber(7)
+  set toLock($core.bool v) { $_setBool(6, v); }
+  @$pb.TagNumber(7)
+  $core.bool hasToLock() => $_has(6);
+  @$pb.TagNumber(7)
+  void clearToLock() => clearField(7);
+
+  @$pb.TagNumber(8)
+  $core.bool get toIsLockEdit => $_getBF(7);
+  @$pb.TagNumber(8)
+  set toIsLockEdit($core.bool v) { $_setBool(7, v); }
+  @$pb.TagNumber(8)
+  $core.bool hasToIsLockEdit() => $_has(7);
+  @$pb.TagNumber(8)
+  void clearToIsLockEdit() => clearField(8);
 }
 
 class ToActivityRulesSelect extends $pb.GeneratedMessage {

+ 7 - 2
app_business/lib/generated/track_offical.pbjson.dart

@@ -60,13 +60,14 @@ const ToActivityRulesSaveInfo$json = {
   '2': [
     {'1': 'arrId', '3': 1, '4': 1, '5': 5, '10': 'arrId'},
     {'1': 'arValue', '3': 2, '4': 1, '5': 9, '10': 'arValue'},
+    {'1': 'isLock', '3': 3, '4': 1, '5': 8, '10': 'isLock'},
   ],
 };
 
 /// Descriptor for `ToActivityRulesSaveInfo`. Decode as a `google.protobuf.DescriptorProto`.
 final $typed_data.Uint8List toActivityRulesSaveInfoDescriptor = $convert.base64Decode(
     'ChdUb0FjdGl2aXR5UnVsZXNTYXZlSW5mbxIUCgVhcnJJZBgBIAEoBVIFYXJySWQSGAoHYXJWYW'
-    'x1ZRgCIAEoCVIHYXJWYWx1ZQ==');
+    'x1ZRgCIAEoCVIHYXJWYWx1ZRIWCgZpc0xvY2sYAyABKAhSBmlzTG9jaw==');
 
 @$core.Deprecated('Use toActivityRulesQueryReplyDescriptor instead')
 const ToActivityRulesQueryReply$json = {
@@ -91,6 +92,8 @@ const ToActivityRulesInfo$json = {
     {'1': 'arType', '3': 4, '4': 1, '5': 5, '10': 'arType'},
     {'1': 'arValueSelectList', '3': 5, '4': 3, '5': 11, '6': '.to.v1.ToActivityRulesSelect', '10': 'arValueSelectList'},
     {'1': 'arValue', '3': 6, '4': 1, '5': 9, '10': 'arValue'},
+    {'1': 'toLock', '3': 7, '4': 1, '5': 8, '10': 'toLock'},
+    {'1': 'toIsLockEdit', '3': 8, '4': 1, '5': 8, '10': 'toIsLockEdit'},
   ],
 };
 
@@ -99,7 +102,9 @@ final $typed_data.Uint8List toActivityRulesInfoDescriptor = $convert.base64Decod
     'ChNUb0FjdGl2aXR5UnVsZXNJbmZvEhQKBWFycklkGAEgASgFUgVhcnJJZBIWCgZhck5hbWUYAi'
     'ABKAlSBmFyTmFtZRIWCgZpc0xvY2sYAyABKAhSBmlzTG9jaxIWCgZhclR5cGUYBCABKAVSBmFy'
     'VHlwZRJKChFhclZhbHVlU2VsZWN0TGlzdBgFIAMoCzIcLnRvLnYxLlRvQWN0aXZpdHlSdWxlc1'
-    'NlbGVjdFIRYXJWYWx1ZVNlbGVjdExpc3QSGAoHYXJWYWx1ZRgGIAEoCVIHYXJWYWx1ZQ==');
+    'NlbGVjdFIRYXJWYWx1ZVNlbGVjdExpc3QSGAoHYXJWYWx1ZRgGIAEoCVIHYXJWYWx1ZRIWCgZ0'
+    'b0xvY2sYByABKAhSBnRvTG9jaxIiCgx0b0lzTG9ja0VkaXQYCCABKAhSDHRvSXNMb2NrRWRpdA'
+    '==');
 
 @$core.Deprecated('Use toActivityRulesSelectDescriptor instead')
 const ToActivityRulesSelect$json = {

+ 6 - 2
app_business/lib/service/api.dart

@@ -259,7 +259,9 @@ class ApiService extends IService {
   Future<void> eventSettingsRulesSave(Iterable<Rule> rules) async {
     await stub.toActivityRulesSave(pb.ToActivityRulesSaveRequest()
       ..list.addAll(rules.map((e) {
-        final one = pb.ToActivityRulesSaveInfo()..arrId = e.id;
+        final one = pb.ToActivityRulesSaveInfo()
+          ..arrId = e.id
+          ..isLock = e.isAppLock;
         final vt = e.value;
         if (vt is RuleValueBool) {
           one.arValue = vt.value ? 'true' : 'false';
@@ -309,7 +311,9 @@ class Rule {
   var id = 0;
   var idx = 0;
   var name = '';
-  var isLock = false;
+  var isAppLock = false;
+  var isAllowEditAppLock = true;
+  var isLockAll = false;
   RuleValue value = RuleValueBool();
 }
 

+ 19 - 4
app_business/lib/view/home/event_manage/dialog_settings.dart

@@ -19,7 +19,9 @@ class SettingsController extends GetxController {
             ..id = e.arrId
             ..idx = i
             ..name = e.arName
-            ..isLock = !e.isLock
+            ..isAppLock = e.isLock
+            ..isAllowEditAppLock = e.toIsLockEdit
+            ..isLockAll = e.toLock
             ..value = e.arType == 1
                 ? (RuleValueBool()..value = e.arValue == 'true')
                 : (RuleValueArrStr()
@@ -74,7 +76,7 @@ class DialogSettings extends GetView<SettingsController> {
 
     return SizedBox(
         height: context.height * 0.6,
-        width: 420,
+        width: 470,
         child: ListView(
           children: l.map((data) => _RuleElem(data)).toList(),
         ));
@@ -94,7 +96,7 @@ class _RuleElem extends GetView<SettingsController> {
       option = Switch(
           value: value.value,
           activeColor: Colors.blue,
-          onChanged: data.isLock
+          onChanged: data.isLockAll
               ? null
               : (b) {
                   value.value = b;
@@ -112,7 +114,7 @@ class _RuleElem extends GetView<SettingsController> {
                 value: e.value,
                 show: e.show,
                 groupValue: value.value,
-                onChanged: data.isLock
+                onChanged: data.isLockAll
                     ? null
                     : (v) {
                         if (v != null) {
@@ -131,6 +133,19 @@ class _RuleElem extends GetView<SettingsController> {
       children: [
         SizedBox(width: 110, child: Text(data.name, textAlign: TextAlign.end)),
         const SizedBox(width: 22),
+        IconButton(
+            onPressed: !data.isAllowEditAppLock || data.isLockAll
+                ? null
+                : () {
+                    controller.rules.update((val) {
+                      val![data.id]!.isAppLock = !val[data.id]!.isAppLock;
+                    });
+                  },
+            icon: Icon(
+              data.isAppLock ? Icons.lock_outline : Icons.lock_open_outlined,
+              color: data.isAppLock ? Colors.deepOrange : Colors.amber,
+            )),
+        const SizedBox(width: 12),
         option!,
       ],
     );

+ 1 - 1
protos/app_api

@@ -1 +1 @@
-Subproject commit 39c1aeaaeb2b42a8306591652dd1e359cbe8db91
+Subproject commit 53aedde50699b258abfa8867beee1ec25e97849c