Przeglądaj źródła

联调提交扦样信息

mq 2 lat temu
rodzic
commit
4c3a415548

+ 40 - 0
lib/model/rsp/district_rsp.dart

@@ -0,0 +1,40 @@
1
+import 'package:json_annotation/json_annotation.dart';
2
+
3
+import '../num_converter.dart';
4
+import '../string_converter.dart';
5
+
6
+part 'district_rsp.g.dart';
7
+
8
+@JsonSerializable(converters: [NumConverter(), StringConverter()])
9
+class DistrictRsp {
10
+  /*
11
+  "id": 6,
12
+  "parentCode": "0",
13
+  "createTime": null,
14
+  "ucode": "210000000000",
15
+  "ulevel": 1,
16
+  "uname": "辽宁省"
17
+   */
18
+
19
+  /// 编号
20
+  final num? id;
21
+
22
+  /// 等级 1-省,2-市,3-县,4-乡,5-村
23
+  final num? ulevel;
24
+
25
+  final String? parentCode;
26
+  final String? uname;
27
+  final String? ucode;
28
+
29
+  const DistrictRsp({
30
+    this.id,
31
+    this.ulevel,
32
+    this.parentCode,
33
+    this.uname,
34
+    this.ucode,
35
+  });
36
+
37
+  factory DistrictRsp.fromJson(Map<String, dynamic> json) => _$DistrictRspFromJson(json);
38
+
39
+  Map<String, dynamic> toJson() => _$DistrictRspToJson(this);
40
+}

+ 14 - 1
lib/network/api.dart

@@ -8,9 +8,11 @@ import 'package:lszlgl/model/rsp/user_rsp.dart';
8 8
 import 'package:lszlgl/network/base_dio.dart';
9 9
 import 'package:retrofit/retrofit.dart';
10 10
 
11
+import '../model/rsp/district_rsp.dart';
12
+
11 13
 part 'api.g.dart';
12 14
 
13
-@RestApi(baseUrl: 'http://121.36.17.6:9099')
15
+@RestApi(baseUrl: 'http://121.36.17.6:49099')
14 16
 abstract class Api {
15 17
   factory Api({Dio? dio, String? baseUrl}) {
16 18
     dio ??= BaseDio.get().dio;
@@ -36,4 +38,15 @@ abstract class Api {
36 38
   /// 获取app下载地址
37 39
   @GET('/admin-api/zj/base-file/getAppDownLoadUrl')
38 40
   Future<ApiRsp<String?>> getAppDownloadUrl();
41
+
42
+  /// 扦样任务更新
43
+  @PUT('/admin-api/zj/code-sampling-task-details-sgjc/update')
44
+  Future<ApiRsp<bool?>> updateSampleTask(@Body() Map<String, dynamic> map);
45
+
46
+  /// 省市县
47
+  @GET('/admin-api/zj/base-administrative-division/list')
48
+  Future<ApiRsp<List<DistrictRsp>?>> districtList(
49
+    @Query('uLevel') num uLevel, {
50
+    @Query('id') num? id,
51
+  });
39 52
 }

+ 12 - 4
lib/network/base_dio.dart

@@ -118,6 +118,12 @@ class MyInterceptor extends Interceptor {
118 118
 
119 119
   @override
120 120
   void onError(DioException err, ErrorInterceptorHandler handler) async {
121
+    if (err.type == DioExceptionType.badResponse) {
122
+      logger.e('ApiErrorSource: $err');
123
+      logger.e('ApiErrorResponse: ${err.response}');
124
+    } else {
125
+      logger.e('ApiErrorSource: $err');
126
+    }
121 127
     // 增加网络检测
122 128
     if (err.type == DioExceptionType.unknown) {
123 129
       bool isConnectNetWork = await isConnected();
@@ -133,7 +139,6 @@ class MyInterceptor extends Interceptor {
133 139
     map['url'] = err.requestOptions.uri;
134 140
     map['errorType'] = err.type;
135 141
     map['statusCode'] = err.response?.statusCode;
136
-    map['data'] = err.response?.data;
137 142
     map['msg'] = appException.message;
138 143
     if (err.response?.extra.isNotEmpty ?? false) map['extra'] = err.response?.extra;
139 144
     logger.e('ApiError: $map');
@@ -168,9 +173,12 @@ class AppException implements Exception {
168 173
       case DioExceptionType.badCertificate:
169 174
         return AppException(-1, '证书错误');
170 175
       case DioExceptionType.badResponse:
171
-        var code = error.response?.data['code'] ?? -1;
172
-        if (code == 401) UserService.get().logout();
173
-        return AppException(code, error.response?.data['msg'] ?? '');
176
+        if (error.response?.data is Map) {
177
+          var code = error.response?.data['code'] ?? -1;
178
+          if (code == 401) UserService.get().logout();
179
+          return AppException(code, error.response?.data['msg'] ?? '');
180
+        }
181
+        return AppException(-1, '请求失败');
174 182
       case DioExceptionType.cancel:
175 183
         return AppException(-1, "请求取消");
176 184
       case DioExceptionType.connectionError:

+ 1 - 1
lib/page/home/home_page.dart

@@ -32,7 +32,7 @@ class _HomePageState extends BaseState<HomePage> with AutomaticKeepAliveClientMi
32 32
   void initState() {
33 33
     super.initState();
34 34
     serviceList = [
35
-      ServiceModel(name: '收环节', icon: imgHomeListPzjc, onTap: startReap),
35
+      ServiceModel(name: '收环节', icon: imgHomeListPzjc, onTap: startReap),
36 36
       ServiceModel(name: '库存环节', icon: imgHomeListZcjy, onTap: startStore),
37 37
     ];
38 38
   }

+ 4 - 3
lib/page/login/login_page.dart

@@ -28,7 +28,7 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
28 28
       MyNavigator.showToast('请输入账号和密码');
29 29
       return;
30 30
     }
31
-    MyNavigator.showLoading(clickDismiss: false);
31
+    MyNavigator.showLoading();
32 32
     try {
33 33
       // 登录
34 34
       var login = await Api().login(LoginReq(username: account, password: pwd));
@@ -108,14 +108,15 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
108 108
   Widget buildBody() {
109 109
     return Column(
110 110
       children: [
111
-        const SizedBox(height: 56),
111
+        const Spacer(flex: 3),
112 112
         Container(
113 113
           width: double.infinity,
114 114
           padding: const EdgeInsets.symmetric(horizontal: 48),
115 115
           child: Image.asset(imgLoginTitle, fit: BoxFit.fill),
116 116
         ),
117
-        const SizedBox(height: 20),
117
+        const Spacer(),
118 118
         loginContainer(),
119
+        const Spacer(flex: 7),
119 120
       ],
120 121
     );
121 122
   }

+ 269 - 15
lib/page/sample_task/reap_sample_detail/reap_sample_basic_detail_page.dart

@@ -1,5 +1,8 @@
1 1
 import 'package:flutter/material.dart';
2
+import 'package:lszlgl/network/api.dart';
2 3
 import '../../../base/base_lifecycle_state.dart';
4
+import '../../../config/colors.dart';
5
+import '../../../model/rsp/district_rsp.dart';
3 6
 import '../../../model/rsp/sample_task_rsp.dart';
4 7
 import '../../../service/dict_service.dart';
5 8
 import '../../../widget/button.dart';
@@ -8,8 +11,15 @@ import '../../../widget/card_item.dart';
8 11
 /// 收获扦样-基础信息
9 12
 class ReapSampleBasicDetailPage extends StatefulWidget {
10 13
   final SampleTaskItem? data;
14
+  final bool detail;
15
+  final VoidCallback? nextCallback;
11 16
 
12
-  const ReapSampleBasicDetailPage(this.data, {super.key});
17
+  const ReapSampleBasicDetailPage(
18
+    this.data, {
19
+    super.key,
20
+    this.detail = true,
21
+    this.nextCallback,
22
+  });
13 23
 
14 24
   @override
15 25
   State<ReapSampleBasicDetailPage> createState() => _ReapSampleBasicDetailPageState();
@@ -19,9 +29,120 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
19 29
     with AutomaticKeepAliveClientMixin {
20 30
   SampleTaskItem? data;
21 31
 
32
+  late Widget arrowDown;
33
+  final sfList = <DistrictRsp>[].notifier<List<DistrictRsp>>();
34
+  final sqList = <DistrictRsp>[].notifier<List<DistrictRsp>>();
35
+  final qxList = <DistrictRsp>[].notifier<List<DistrictRsp>>();
36
+  final xzList = <DistrictRsp>[].notifier<List<DistrictRsp>>();
37
+  final czList = <DistrictRsp>[].notifier<List<DistrictRsp>>();
38
+  final sf = null.notifier<int?>();
39
+  final sq = null.notifier<int?>();
40
+  final qx = null.notifier<int?>();
41
+  final xz = null.notifier<int?>();
42
+  final cz = null.notifier<int?>();
43
+
44
+  final dllx = null.notifier<int?>();
45
+
22 46
   @override
23 47
   void onInit() {
24 48
     data = widget.data;
49
+    arrowDown = Image.asset(imgItemArrowDown, width: 20);
50
+    // 省
51
+    districtList(1);
52
+    // 市
53
+    if (data?.shengXzqh != null) {
54
+      districtList(2, id: data?.shengXzqh);
55
+    }
56
+    // 区
57
+    if (data?.shiXzqh != null) {
58
+      districtList(3, id: data?.shiXzqh);
59
+    }
60
+    // 县
61
+    if (data?.quXzqh != null) {
62
+      districtList(4, id: data?.quXzqh);
63
+    }
64
+    // 村
65
+    if (data?.xiangXzqh != null) {
66
+      districtList(5, id: data?.xiangXzqh);
67
+    }
68
+  }
69
+
70
+  Future<void> districtList(num level, {num? id}) async {
71
+    MyNavigator.showLoading();
72
+    try {
73
+      var rsp = await Api().districtList(level, id: id);
74
+      if (level == 1) {
75
+        sfList.value = rsp.data ?? [];
76
+      } else if (level == 2) {
77
+        sqList.value = rsp.data ?? [];
78
+      } else if (level == 3) {
79
+        qxList.value = rsp.data ?? [];
80
+      } else if (level == 4) {
81
+        xzList.value = rsp.data ?? [];
82
+      } else if (level == 5) {
83
+        czList.value = rsp.data ?? [];
84
+      }
85
+    } catch (e) {}
86
+    MyNavigator.dismissLoading();
87
+  }
88
+
89
+  void onSelect(ValueNotifier<int?> selNotifier, int index) {
90
+    late DistrictRsp item;
91
+    if (selNotifier == sf) {
92
+      item = sfList.value[index];
93
+      data?.sheng = item.uname;
94
+      data?.shengXzqh = item.id;
95
+      sq.value = null;
96
+      qx.value = null;
97
+      xz.value = null;
98
+      cz.value = null;
99
+      sqList.value = [];
100
+      qxList.value = [];
101
+      xzList.value = [];
102
+      czList.value = [];
103
+    } else if (selNotifier == sq) {
104
+      item = sqList.value[index];
105
+      data?.shi = item.uname;
106
+      data?.shiXzqh = item.id;
107
+      qx.value = null;
108
+      xz.value = null;
109
+      cz.value = null;
110
+      qxList.value = [];
111
+      xzList.value = [];
112
+      czList.value = [];
113
+    } else if (selNotifier == qx) {
114
+      item = qxList.value[index];
115
+      data?.qu = item.uname;
116
+      data?.quXzqh = item.id;
117
+      xz.value = null;
118
+      cz.value = null;
119
+      xzList.value = [];
120
+      czList.value = [];
121
+    } else if (selNotifier == xz) {
122
+      item = xzList.value[index];
123
+      data?.xian = item.uname;
124
+      data?.xiangXzqh = item.id;
125
+      cz.value = null;
126
+      czList.value = [];
127
+    } else if (selNotifier == cz) {
128
+      item = sfList.value[index];
129
+      widget.data?.cun = item.uname;
130
+      data?.cun = item.uname;
131
+      data?.cunXzqh = item.id;
132
+    }
133
+    if ((item.ulevel ?? 100) < 5) {
134
+      districtList((item.ulevel ?? 100) + 1, id: item.id ?? 0);
135
+    }
136
+  }
137
+
138
+  Future<void> updateTask() async {
139
+    // widget.nextCallback?.call();
140
+    MyNavigator.showLoading();
141
+    try {
142
+      var rsp = await Api().updateSampleTask(data?.toJson() ?? {});
143
+      MyNavigator.showToast((rsp.data ?? false) ? '提交成功' : '提交失败');
144
+    } catch (e) {}
145
+    MyNavigator.dismissLoading();
25 146
   }
26 147
 
27 148
   @override
@@ -41,28 +162,81 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
41 162
   Widget buildList() {
42 163
     return Column(
43 164
       children: [
44
-        CardItemWidget('扦样任务单号', rightText: data?.qyrwdh, bottomLine: true),
45
-        CardItemWidget('扦样单位', rightText: data?.dwmc, bottomLine: true),
46
-        CardItemWidget('扦样人员', rightText: data?.name, bottomLine: true),
165
+        CardItemWidget(
166
+          '扦样任务单号',
167
+          rightText: data?.qyrwdh,
168
+          bottomLine: true,
169
+        ),
170
+        CardItemWidget(
171
+          '扦样单位',
172
+          rightText: data?.dwmc,
173
+          bottomLine: true,
174
+        ),
175
+        CardItemWidget(
176
+          '扦样人员',
177
+          rightText: data?.name,
178
+          bottomLine: true,
179
+        ),
47 180
         CardItemWidget(
48 181
           '监测类别',
49 182
           rightText: DictService.getLabel(DictType.jclb, value: data?.jclb),
50 183
           bottomLine: true,
51 184
         ),
52
-        CardItemWidget('省份', rightText: data?.sheng, bottomLine: true),
53
-        CardItemWidget('市区', rightText: data?.shi, bottomLine: true),
54
-        CardItemWidget('区县', rightText: data?.qu, bottomLine: true),
55
-        CardItemWidget('乡镇', rightText: data?.xian, bottomLine: true),
56
-        CardItemWidget('村', rightText: data?.cun, bottomLine: true),
57
-        CardItemWidget('扦样地点经纬度', rightText: data?.qyddjwd, bottomLine: true),
58
-        CardItemWidget('种植面积(亩地)', rightText: data?.zzmj?.toString(), bottomLine: true),
185
+        CardItemWidget(
186
+          '省份',
187
+          rightText: widget.detail ? data?.sheng : null,
188
+          rightChild: widget.detail ? null : buildMenu(sfList, sf, onSelect),
189
+          bottomLine: true,
190
+        ),
191
+        CardItemWidget(
192
+          '市区',
193
+          rightText: widget.detail ? data?.shi : null,
194
+          rightChild: widget.detail ? null : buildMenu(sqList, sq, onSelect),
195
+          bottomLine: true,
196
+        ),
197
+        CardItemWidget(
198
+          '区县',
199
+          rightText: widget.detail ? data?.qu : null,
200
+          rightChild: widget.detail ? null : buildMenu(qxList, qx, onSelect),
201
+          bottomLine: true,
202
+        ),
203
+        CardItemWidget(
204
+          '乡镇',
205
+          rightText: widget.detail ? data?.xian : null,
206
+          rightChild: widget.detail ? null : buildMenu(xzList, xz, onSelect),
207
+          bottomLine: true,
208
+        ),
209
+        CardItemWidget(
210
+          '村',
211
+          rightText: widget.detail ? data?.cun : null,
212
+          rightChild: widget.detail ? null : buildMenu(czList, cz, onSelect),
213
+          bottomLine: true,
214
+        ),
215
+        CardItemWidget(
216
+          '扦样地点经纬度',
217
+          rightText: data?.qyddjwd,
218
+          bottomLine: true,
219
+        ),
220
+        CardItemWidget(
221
+          '种植面积(亩地)',
222
+          rightText: data?.zzmj?.toString(),
223
+          bottomLine: true,
224
+        ),
59 225
         CardItemWidget(
60 226
           '土壤地理类型',
61 227
           rightText: DictService.getLabel(DictType.jclb, value: data?.trdllx),
62 228
           bottomLine: true,
63 229
         ),
64
-        CardItemWidget('被调查农户或合作社', rightText: data?.bdcnhhhzs, bottomLine: true),
65
-        CardItemWidget('联系方式', rightText: data?.lxfs, bottomLine: true),
230
+        CardItemWidget(
231
+          '被调查农户或合作社',
232
+          rightText: data?.bdcnhhhzs,
233
+          bottomLine: true,
234
+        ),
235
+        CardItemWidget(
236
+          '联系方式',
237
+          rightText: data?.lxfs,
238
+          bottomLine: true,
239
+        ),
66 240
       ],
67 241
     );
68 242
   }
@@ -72,8 +246,88 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
72 246
       color: const Color(0xFFF1F7F6),
73 247
       padding: const EdgeInsets.all(12),
74 248
       child: MyButton(
75
-        '重新录入',
76
-        onTap: () => MyRouter.startReapSampleTask(),
249
+        widget.detail ? '重新录入' : '下一步',
250
+        onTap: () => widget.detail ? MyRouter.startReapSampleTask() : updateTask(),
251
+      ),
252
+    );
253
+  }
254
+
255
+  Widget buildMenu(
256
+    ValueNotifier<List<DistrictRsp>> listNotifier,
257
+    ValueNotifier<int?> selNotifier,
258
+    Function(ValueNotifier<int?>, int) onItemTap,
259
+  ) {
260
+    return listNotifier.builder(
261
+      (list) => selNotifier.builder(
262
+        (sel) {
263
+          return MenuAnchor(
264
+            style: const MenuStyle(
265
+              padding: MaterialStatePropertyAll(EdgeInsets.zero),
266
+              alignment: Alignment.bottomRight,
267
+            ),
268
+            builder: (_, ctrl, __) => buildMenuText(ctrl, list, sel),
269
+            menuChildren: List.generate(list.length, (index) {
270
+              return buildMenuItem(
271
+                list[index],
272
+                index == sel,
273
+                () {
274
+                  if (selNotifier.value == index) return;
275
+                  selNotifier.value = index;
276
+                  onItemTap.call(selNotifier, index);
277
+                },
278
+              );
279
+            }).toList(),
280
+          );
281
+        },
282
+      ),
283
+    );
284
+  }
285
+
286
+  Widget buildMenuText(MenuController ctrl, List<DistrictRsp> list, int? index) {
287
+    return GestureDetector(
288
+      behavior: HitTestBehavior.opaque,
289
+      onTap: () {
290
+        if (list.isEmpty) {
291
+          MyNavigator.showToast('请先选择上级选项');
292
+          return;
293
+        }
294
+        if (ctrl.isOpen) {
295
+          ctrl.close();
296
+        } else {
297
+          ctrl.open();
298
+        }
299
+      },
300
+      child: Row(
301
+        mainAxisSize: MainAxisSize.min,
302
+        children: [
303
+          Expanded(
304
+            child: Text(
305
+              index == null ? '' : list[index].uname ?? '',
306
+              textAlign: TextAlign.right,
307
+              style: const TextStyle(
308
+                color: Color(0xFF01B2C8),
309
+                fontSize: 14,
310
+                fontWeight: FontWeight.w500,
311
+              ),
312
+            ),
313
+          ),
314
+          const SizedBox(width: 8),
315
+          arrowDown,
316
+        ],
317
+      ),
318
+    );
319
+  }
320
+
321
+  Widget buildMenuItem(DistrictRsp value, bool isSelect, VoidCallback? onPressed) {
322
+    return MenuItemButton(
323
+      onPressed: onPressed,
324
+      child: Container(
325
+        constraints: const BoxConstraints(minWidth: 120),
326
+        alignment: Alignment.center,
327
+        child: Text(
328
+          value.uname ?? '',
329
+          style: TextStyle(color: isSelect ? const Color(0xFF01B2C8) : MyColor.c_666666),
330
+        ),
77 331
       ),
78 332
     );
79 333
   }

+ 125 - 46
lib/page/sample_task/reap_sample_task/reap_sample_basic_page.dart

@@ -3,6 +3,8 @@ import 'package:lszlgl/base/base_state.dart';
3 3
 import 'package:lszlgl/widget/button.dart';
4 4
 import 'package:lszlgl/widget/card_item.dart';
5 5
 
6
+import '../../../config/colors.dart';
7
+
6 8
 /// 收获扦样-基础信息
7 9
 class ReapSampleBasicPage extends StatefulWidget {
8 10
   final VoidCallback nextCallback;
@@ -19,6 +21,7 @@ class ReapSampleBasicPage extends StatefulWidget {
19 21
 class _ReapSampleBasicPageState extends BaseState<ReapSampleBasicPage> with AutomaticKeepAliveClientMixin {
20 22
   late Widget arrowDown;
21 23
 
24
+  ValueNotifier<String?> sf = ValueNotifier(null);
22 25
   ValueNotifier<String?> sq = ValueNotifier(null);
23 26
   ValueNotifier<String?> qx = ValueNotifier(null);
24 27
   ValueNotifier<String?> xz = ValueNotifier(null);
@@ -48,20 +51,77 @@ class _ReapSampleBasicPageState extends BaseState<ReapSampleBasicPage> with Auto
48 51
   Widget buildList() {
49 52
     return Column(
50 53
       children: [
51
-        CardItemWidget('扦样任务单号', rightText: '自动生成', bottomLine: true),
52
-        CardItemWidget('扦样单位', rightText: '自动生成', bottomLine: true),
53
-        CardItemWidget('扦样人员', rightText: '自动生成', bottomLine: true),
54
-        CardItemWidget('任务类型', rightText: '自动生成', bottomLine: true),
55
-        CardItemWidget('省份选择', rightText: '北京市', bottomLine: true),
56
-        CardItemWidget('市区选择', rightChild: buildMenu(sq), bottomLine: true),
57
-        CardItemWidget('区县选择', rightChild: buildMenu(qx), bottomLine: true),
58
-        CardItemWidget('乡镇选择', rightChild: buildMenu(xz), bottomLine: true),
59
-        CardItemWidget('村选择', rightChild: buildMenu(cz), bottomLine: true),
60
-        CardItemWidget('扦样地点经纬度', rightText: '', hint: '点击获取', bottomLine: true),
61
-        CardItemWidget('种植面积(亩地)', rightChild: buildField(hint: '点击填写'), bottomLine: true),
62
-        CardItemWidget('土壤地理类型', rightChild: buildMenu(dllx), bottomLine: true),
63
-        CardItemWidget('被调查农户或合作社', rightChild: buildField(hint: '点击填写'), bottomLine: true),
64
-        CardItemWidget('联系方式', rightChild: buildField(hint: '点击填写'), bottomLine: true),
54
+        CardItemWidget(
55
+          '扦样任务单号',
56
+          rightText: '自动生成',
57
+          bottomLine: true,
58
+        ),
59
+        CardItemWidget(
60
+          '扦样单位',
61
+          rightText: '自动生成',
62
+          bottomLine: true,
63
+        ),
64
+        CardItemWidget(
65
+          '扦样人员',
66
+          rightText: '自动生成',
67
+          bottomLine: true,
68
+        ),
69
+        CardItemWidget(
70
+          '任务类型',
71
+          rightText: '自动生成',
72
+          bottomLine: true,
73
+        ),
74
+        CardItemWidget(
75
+          '省份选择',
76
+          rightChild: buildMenu(sf),
77
+          bottomLine: true,
78
+        ),
79
+        CardItemWidget(
80
+          '市区选择',
81
+          rightChild: buildMenu(sq),
82
+          bottomLine: true,
83
+        ),
84
+        CardItemWidget(
85
+          '区县选择',
86
+          rightChild: buildMenu(qx),
87
+          bottomLine: true,
88
+        ),
89
+        CardItemWidget(
90
+          '乡镇选择',
91
+          rightChild: buildMenu(xz),
92
+          bottomLine: true,
93
+        ),
94
+        CardItemWidget(
95
+          '村选择',
96
+          rightChild: buildMenu(cz),
97
+          bottomLine: true,
98
+        ),
99
+        CardItemWidget(
100
+          '扦样地点经纬度',
101
+          rightText: '',
102
+          hint: '点击获取',
103
+          bottomLine: true,
104
+        ),
105
+        CardItemWidget(
106
+          '种植面积(亩地)',
107
+          rightChild: buildField(hint: '点击填写'),
108
+          bottomLine: true,
109
+        ),
110
+        CardItemWidget(
111
+          '土壤地理类型',
112
+          rightChild: buildMenu(dllx),
113
+          bottomLine: true,
114
+        ),
115
+        CardItemWidget(
116
+          '被调查农户或合作社',
117
+          rightChild: buildField(hint: '点击填写'),
118
+          bottomLine: true,
119
+        ),
120
+        CardItemWidget(
121
+          '联系方式',
122
+          rightChild: buildField(hint: '点击填写'),
123
+          bottomLine: true,
124
+        ),
65 125
       ],
66 126
     );
67 127
   }
@@ -98,44 +158,63 @@ class _ReapSampleBasicPageState extends BaseState<ReapSampleBasicPage> with Auto
98 158
       valueListenable: notifier,
99 159
       builder: (_, value, __) {
100 160
         return MenuAnchor(
101
-          builder: (_, ctrl, __) {
102
-            return GestureDetector(
103
-              behavior: HitTestBehavior.opaque,
104
-              onTap: () {
105
-                if (ctrl.isOpen) {
106
-                  ctrl.close();
107
-                } else {
108
-                  ctrl.open();
109
-                }
110
-              },
111
-              child: Row(
112
-                mainAxisSize: MainAxisSize.min,
113
-                children: [
114
-                  Text(
115
-                    value ?? '',
116
-                    textAlign: TextAlign.right,
117
-                    style: const TextStyle(
118
-                      color: Color(0xFF01B2C8),
119
-                      fontSize: 16,
120
-                      fontWeight: FontWeight.w500,
121
-                    ),
122
-                  ),
123
-                  const SizedBox(width: 8),
124
-                  arrowDown,
125
-                ],
126
-              ),
127
-            );
128
-          },
161
+          style: const MenuStyle(
162
+            padding: MaterialStatePropertyAll(EdgeInsets.zero),
163
+            alignment: Alignment.bottomRight,
164
+          ),
165
+          builder: (_, ctrl, __) => buildMenuText(ctrl, value ?? ''),
129 166
           menuChildren: ['选项一', '选项二', '选项三', '选项四']
130 167
               .map(
131
-                (e) => MenuItemButton(
132
-                  child: Text(e),
133
-                  onPressed: () => notifier.value = e,
134
-                ),
168
+                (e) => buildMenuItem(e, notifier),
135 169
               )
136 170
               .toList(),
137 171
         );
138 172
       },
139 173
     );
140 174
   }
175
+
176
+  Widget buildMenuText(MenuController ctrl, String value) {
177
+    return GestureDetector(
178
+      behavior: HitTestBehavior.opaque,
179
+      onTap: () {
180
+        if (ctrl.isOpen) {
181
+          ctrl.close();
182
+        } else {
183
+          ctrl.open();
184
+        }
185
+      },
186
+      child: Row(
187
+        mainAxisSize: MainAxisSize.min,
188
+        children: [
189
+          Expanded(
190
+            child: Text(
191
+              value,
192
+              textAlign: TextAlign.right,
193
+              style: const TextStyle(
194
+                color: Color(0xFF01B2C8),
195
+                fontSize: 14,
196
+                fontWeight: FontWeight.w500,
197
+              ),
198
+            ),
199
+          ),
200
+          const SizedBox(width: 8),
201
+          arrowDown,
202
+        ],
203
+      ),
204
+    );
205
+  }
206
+
207
+  Widget buildMenuItem(String item, ValueNotifier<String?> notifier) {
208
+    return MenuItemButton(
209
+      child: Container(
210
+        constraints: const BoxConstraints(minWidth: 120),
211
+        alignment: Alignment.center,
212
+        child: Text(
213
+          item,
214
+          style: TextStyle(color: item == notifier.value ? const Color(0xFF01B2C8) : MyColor.c_666666),
215
+        ),
216
+      ),
217
+      onPressed: () => notifier.value = item,
218
+    );
219
+  }
141 220
 }

+ 2 - 2
lib/page/sample_task/reap_sample_task/reap_sample_task_page.dart

@@ -8,7 +8,6 @@ import 'package:lszlgl/page/sample_task/reap_sample_detail/reap_sample_disaster_
8 8
 import 'package:lszlgl/page/sample_task/reap_sample_detail/reap_sample_medicine_detail_page.dart';
9 9
 import 'package:lszlgl/page/sample_task/reap_sample_detail/reap_sample_org_detail_page.dart';
10 10
 import 'package:lszlgl/page/sample_task/reap_sample_detail/reap_sample_variety_detail_page.dart';
11
-import 'package:lszlgl/page/sample_task/reap_sample_task/reap_sample_basic_page.dart';
12 11
 import 'package:lszlgl/page/sample_task/reap_sample_task/reap_sample_disaster_page.dart';
13 12
 import 'package:lszlgl/page/sample_task/reap_sample_task/reap_sample_medicine_page.dart';
14 13
 import 'package:lszlgl/page/sample_task/reap_sample_task/reap_sample_org_page.dart';
@@ -85,7 +84,8 @@ class _ReapSampleTaskPageState extends BaseState<ReapSampleTaskPage> with Ticker
85 84
       ];
86 85
     } else {
87 86
       pageList = [
88
-        ReapSampleBasicPage(nextCallback: next),
87
+        ReapSampleBasicDetailPage(args.data, detail: false, nextCallback: next),
88
+        // ReapSampleBasicPage(nextCallback: next),
89 89
         ReapSampleVarietyPage(nextCallback: next, previousCallback: previous),
90 90
         ReapSampleDisasterPage(nextCallback: next, previousCallback: previous),
91 91
         ReapSampleMedicinePage(nextCallback: next, previousCallback: previous),

+ 4 - 4
lib/page/sample_task/sample_task_list_page.dart

@@ -38,7 +38,7 @@ class _SampleTaskListPageState extends BaseLifecycleState<SampleTaskListPage> wi
38 38
     if (!widget.complete) return;
39 39
     switch (widget.type) {
40 40
       case StepType.reap:
41
-        MyRouter.startReapSampleTask(args: ReapSampleTaskPageArgs(detail: true,data: data));
41
+        MyRouter.startReapSampleTask(args: ReapSampleTaskPageArgs(detail: true, data: data));
42 42
         break;
43 43
       case StepType.stock:
44 44
         break;
@@ -46,10 +46,10 @@ class _SampleTaskListPageState extends BaseLifecycleState<SampleTaskListPage> wi
46 46
   }
47 47
 
48 48
   /// 扦样
49
-  void startSample() {
49
+  void startSample(SampleTaskItem data) {
50 50
     switch (widget.type) {
51 51
       case StepType.reap:
52
-        MyRouter.startReapSampleTask();
52
+        MyRouter.startReapSampleTask(args: ReapSampleTaskPageArgs(detail: false, data: data));
53 53
         break;
54 54
       case StepType.stock:
55 55
         break;
@@ -244,7 +244,7 @@ class _SampleTaskListPageState extends BaseLifecycleState<SampleTaskListPage> wi
244 244
             const SizedBox(width: 4),
245 245
             MyButton(
246 246
               '开始扦样',
247
-              onTap: () => startSample(),
247
+              onTap: () => startSample(item),
248 248
               fountSize: 13,
249 249
               alignment: null,
250 250
               padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),