Kaynağa Gözat

Update 优化个体绑定页面离线模式可以手动输入批次家系号

Yue 3 hafta önce
ebeveyn
işleme
155d126466

+ 71 - 2
UI/CF.APP/chicken_farm/lib/pages/breeding/batch_create_page_win.dart

@@ -1,3 +1,4 @@
+import 'package:chicken_farm/core/config/app_config.dart';
 import 'package:chicken_farm/core/utils/datetime_util.dart';
 import 'package:chicken_farm/apis/index.dart';
 import 'package:chicken_farm/components/vb_search_select.dart';
@@ -31,10 +32,10 @@ class _BatchCreatePageWinState extends State<BatchCreatePageWin> {
           crossAxisAlignment: CrossAxisAlignment.start,
           children: [
             // 批次选择
-            _buildBatchSearchSelect(),
+            _buildBatchInput(),
             const SizedBox(height: 10),
             // 家系号选择
-            _buildFamilySearchSelect(),
+            _buildFamilyInput(),
             const SizedBox(height: 20),
             // 电子编号区域
             _buildElectronicIdSection(),
@@ -117,6 +118,74 @@ class _BatchCreatePageWinState extends State<BatchCreatePageWin> {
     );
   }
 
+  Widget _buildBatchInput() {
+    if (AppConfig.isOffline) {
+      // 离线模式下使用文本输入框
+      return Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          const Text('批次号', style: TextStyle(fontWeight: FontWeight.bold)),
+          const SizedBox(height: 10),
+          Container(
+            padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
+            decoration: BoxDecoration(
+              border: Border.all(color: Colors.grey),
+              borderRadius: BorderRadius.circular(8),
+            ),
+            child: TextField(
+              decoration: const InputDecoration(
+                hintText: '请输入批次号',
+                border: InputBorder.none,
+              ),
+              onChanged: (value) {
+                setState(() {
+                  _batchNum = value.isNotEmpty ? value : null;
+                });
+              },
+            ),
+          ),
+        ],
+      );
+    } else {
+      // 在线模式下使用原来的搜索选择器
+      return _buildBatchSearchSelect();
+    }
+  }
+
+  Widget _buildFamilyInput() {
+    if (AppConfig.isOffline) {
+      // 离线模式下使用文本输入框
+      return Column(
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          const Text('家系号', style: TextStyle(fontWeight: FontWeight.bold)),
+          const SizedBox(height: 10),
+          Container(
+            padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
+            decoration: BoxDecoration(
+              border: Border.all(color: Colors.grey),
+              borderRadius: BorderRadius.circular(8),
+            ),
+            child: TextField(
+              decoration: const InputDecoration(
+                hintText: '请输入家系号',
+                border: InputBorder.none,
+              ),
+              onChanged: (value) {
+                setState(() {
+                  _familyNum = value.isNotEmpty ? value : null;
+                });
+              },
+            ),
+          ),
+        ],
+      );
+    } else {
+      // 在线模式下使用原来的搜索选择器
+      return _buildFamilySearchSelect();
+    }
+  }
+
   Widget _buildBatchSearchSelect() {
     return Column(
       crossAxisAlignment: CrossAxisAlignment.start,