|
@@ -60,7 +60,6 @@ class _ReapSampleVarietyDetailPageState extends BaseLifecycleState<ReapSampleVar
|
60
|
60
|
|
61
|
61
|
/// 获取粮食信息列表
|
62
|
62
|
Future<void> getLsxxList() async {
|
63
|
|
- MyNavigator.showLoading();
|
64
|
63
|
try {
|
65
|
64
|
var rsp = await MyApi.get().lsxxList(data?.cypzName ?? '');
|
66
|
65
|
List<CardMenuData> list = [];
|
|
@@ -127,14 +126,20 @@ class _ReapSampleVarietyDetailPageState extends BaseLifecycleState<ReapSampleVar
|
127
|
126
|
'删除',
|
128
|
127
|
alignment: null,
|
129
|
128
|
backgroundColor: const Color(0xFFCE615A),
|
130
|
|
- onTap: () => MyNavigator.dismiss(tag: 'delete', result: true),
|
|
129
|
+ onTap: () {
|
|
130
|
+ if (data!.codeSamplingNonghuList!.length > 1) {
|
|
131
|
+ MyNavigator.dismiss(tag: 'delete', result: true);
|
|
132
|
+ } else {
|
|
133
|
+ MyNavigator.showToast('必须有一条扦样农户信息');
|
|
134
|
+ MyNavigator.dismiss(tag: 'delete');
|
|
135
|
+ }
|
|
136
|
+ },
|
131
|
137
|
),
|
132
|
138
|
MyButton('取消', alignment: null, onTap: () => MyNavigator.dismiss(tag: 'delete')),
|
133
|
139
|
],
|
134
|
140
|
),
|
135
|
141
|
);
|
136
|
142
|
if (!(delete ?? false)) return;
|
137
|
|
-
|
138
|
143
|
setState(() {
|
139
|
144
|
data?.codeSamplingNonghuList?.remove(item);
|
140
|
145
|
});
|
|
@@ -142,6 +147,56 @@ class _ReapSampleVarietyDetailPageState extends BaseLifecycleState<ReapSampleVar
|
142
|
147
|
|
143
|
148
|
/// 校验数据
|
144
|
149
|
bool verifyData() {
|
|
150
|
+ // 粮食品类
|
|
151
|
+ if ((data?.lspz ?? '').isEmpty) {
|
|
152
|
+ MyNavigator.showToast('粮食品类不能为空');
|
|
153
|
+ return false;
|
|
154
|
+ }
|
|
155
|
+ // 是否优质品种
|
|
156
|
+ if (data?.sfyzpz == null) {
|
|
157
|
+ MyNavigator.showToast('是否优质品种不能为空');
|
|
158
|
+ return false;
|
|
159
|
+ }
|
|
160
|
+ // 品种优质类型
|
|
161
|
+ if (data?.sfyzpz == 0 && data?.yzpzlx == null) {
|
|
162
|
+ MyNavigator.showToast('品种优质类型不能为空');
|
|
163
|
+ return false;
|
|
164
|
+ }
|
|
165
|
+ debugPrint('天气情况: ${data?.tqqk}');
|
|
166
|
+ // 天气情况
|
|
167
|
+ if ((data?.tqqk ?? 0) == 0) {
|
|
168
|
+ MyNavigator.showToast('天气情况不能为空');
|
|
169
|
+ return false;
|
|
170
|
+ }
|
|
171
|
+ // 收获时间
|
|
172
|
+ if ((data?.shsj ?? '').isEmpty) {
|
|
173
|
+ MyNavigator.showToast('收获时间不能为空');
|
|
174
|
+ return false;
|
|
175
|
+ }
|
|
176
|
+ // 扦样时间
|
|
177
|
+ if ((data?.qysj ?? '').isEmpty) {
|
|
178
|
+ MyNavigator.showToast('扦样时间不能为空');
|
|
179
|
+ return false;
|
|
180
|
+ }
|
|
181
|
+ // 农户信息
|
|
182
|
+ for (var item in data?.codeSamplingNonghuList ?? <NonghuItem>[]) {
|
|
183
|
+ if (item.qysl == null) {
|
|
184
|
+ MyNavigator.showToast('扦样数量不能为空');
|
|
185
|
+ return false;
|
|
186
|
+ }
|
|
187
|
+ if (item.qydbsl == null) {
|
|
188
|
+ MyNavigator.showToast('扦样代表数量不能为空');
|
|
189
|
+ return false;
|
|
190
|
+ }
|
|
191
|
+ if ((item.lxfs ?? '').isEmpty) {
|
|
192
|
+ MyNavigator.showToast('联系方式不能为空');
|
|
193
|
+ return false;
|
|
194
|
+ }
|
|
195
|
+ if ((item.bdcnhhhzs ?? '').isEmpty) {
|
|
196
|
+ MyNavigator.showToast('被调查农户或合作社不能为空');
|
|
197
|
+ return false;
|
|
198
|
+ }
|
|
199
|
+ }
|
145
|
200
|
return true;
|
146
|
201
|
}
|
147
|
202
|
|
|
@@ -154,10 +209,7 @@ class _ReapSampleVarietyDetailPageState extends BaseLifecycleState<ReapSampleVar
|
154
|
209
|
isDetail = widget.detail;
|
155
|
210
|
widget.ctrl.verifyData = verifyData;
|
156
|
211
|
arrowDown = Image.asset(imgItemArrowDown, width: 20, color: const Color(0xFF01B2C8));
|
157
|
|
- }
|
158
|
212
|
|
159
|
|
- @override
|
160
|
|
- void onFirstShow(Duration timeStamp) {
|
161
|
213
|
// 粮食品类菜单数据
|
162
|
214
|
getLsxxList();
|
163
|
215
|
// 是否优选品种
|
|
@@ -182,11 +234,18 @@ class _ReapSampleVarietyDetailPageState extends BaseLifecycleState<ReapSampleVar
|
182
|
234
|
return menu;
|
183
|
235
|
}).toList();
|
184
|
236
|
if (!isDetail && (data?.codeSamplingNonghuList ?? []).isEmpty) {
|
185
|
|
- data?.codeSamplingNonghuList = [NonghuItem()];
|
|
237
|
+ setState(() {
|
|
238
|
+ data?.codeSamplingNonghuList = [NonghuItem()];
|
|
239
|
+ });
|
186
|
240
|
}
|
187
|
241
|
}
|
188
|
242
|
|
189
|
243
|
@override
|
|
244
|
+ void onFirstShow(Duration timeStamp) {
|
|
245
|
+ MyNavigator.showLoading();
|
|
246
|
+ }
|
|
247
|
+
|
|
248
|
+ @override
|
190
|
249
|
Widget build(BuildContext context) {
|
191
|
250
|
super.build(context);
|
192
|
251
|
return SingleChildScrollView(child: buildList());
|