Переглянути джерело

.通风记录只有发起人才可以修改
.更改版本号

mq 5 роки тому
батько
коміт
20e2586e74

+ 6 - 10
app/build.gradle

@@ -8,8 +8,8 @@ android {
8 8
         applicationId "com.unis.sxzcl"
9 9
         minSdkVersion 16
10 10
         targetSdkVersion 28
11
-        versionCode 1
12
-        versionName "1.0"
11
+        versionCode 2
12
+        versionName "1.2"
13 13
         ndk {
14 14
             //设置支持的SO库架构
15 15
             abiFilters 'armeabi-v7a' //,'x86', 'x86_64', 'arm64-v8a'
@@ -67,16 +67,12 @@ android {
67 67
         variant.outputs.all { output ->
68 68
 //            def flavorsName = variant.productFlavors[0].name
69 69
             def date = new Date().format("yyyyMMddHHmm")
70
-            def versionname = defaultConfig.versionName
71
-            def versioncode = defaultConfig.versionCode
70
+            def versionName = defaultConfig.versionName
71
+            def versionCode = defaultConfig.versionCode
72
+            def buildType = variant.buildType.name
72 73
 
73 74
 //            ${date}
74
-            if (variant.buildType.name.equals('debug')) {
75
-                outputFileName = "sxzcl_${versionname}_${versioncode}_debug.apk"
76
-            }
77
-            if (variant.buildType.name.equals('release')) {
78
-                outputFileName = "sxzcl_${versionname}_${versioncode}_release.apk"
79
-            }
75
+            outputFileName = "sxzcl_${buildType}_${versionName}_${versionCode}.apk"
80 76
         }
81 77
     }
82 78
 }

+ 1 - 1
app/src/main/java/com/unis/sxzcl/ui/aeration/AerationDetailAdapter.java

@@ -162,7 +162,7 @@ public class AerationDetailAdapter extends BaseProviderMultiAdapter<DetailItemBe
162 162
                 // 存储选中index
163 163
                 currentItem.setSelectIndex(index);
164 164
                 // 存储选中时间
165
-                currentItem.setTime(DateTool.formatDate(new Date(), DateTool.FULL_DATE));
165
+                currentItem.setTime(DateTool.formatDate(new Date(), DateTool.YTDTD_DATE));
166 166
 
167 167
                 // 刷新当前项
168 168
                 notifyItemChanged(getItemPosition(currentItem));

+ 66 - 39
app/src/main/java/com/unis/sxzcl/ui/aeration/AerationDetailFragment.java

@@ -288,29 +288,25 @@ public class AerationDetailFragment extends BaseListFragment<FragmentAerationDet
288 288
             mBinding.tvSubmit.setText("保存并提交审批");
289 289
         } else {
290 290
             // 切换按钮显示
291
-            String flowId = item.getFlowId();
292
-            mFinish = true;
293
-            for (DetailItemBean bean : mAdapter.getData()) {
294
-                if (bean.getFlowId().equals(flowId)) {
295
-                    // 选中项为空时 是暂存
296
-                    String selectIndex = bean.getSelectIndex();
297
-                    if (selectIndex == null || selectIndex.equals("-1")) {
298
-                        mFinish = false;
299
-                        break;
300
-                    }
301
-                }
302
-            }
291
+            showButton(item.getFlowId());
292
+        }
293
+    }
303 294
 
304
-            if (mFinish) {
305
-                // 显示提交
306
-                mBinding.tvSave.setVisibility(View.GONE);
307
-                mBinding.tvSubmit.setVisibility(View.VISIBLE);
308
-                mBinding.tvSubmit.setText("保存并提交");
309
-            } else {
310
-                // 显示暂存
311
-                mBinding.tvSave.setVisibility(View.VISIBLE);
312
-                mBinding.tvSubmit.setVisibility(View.GONE);
313
-            }
295
+    /**
296
+     * 根据流程id 判断底部按钮的显示
297
+     *
298
+     * @param flowId
299
+     */
300
+    public void showButton(String flowId) {
301
+        if (isStepSelectFinish(flowId)) {
302
+            // 选项已全选 保存并提交
303
+            mBinding.tvSave.setVisibility(View.GONE);
304
+            mBinding.tvSubmit.setVisibility(View.VISIBLE);
305
+            mBinding.tvSubmit.setText("保存并提交");
306
+        } else {
307
+            // 选项未全选 暂存
308
+            mBinding.tvSave.setVisibility(View.VISIBLE);
309
+            mBinding.tvSubmit.setVisibility(View.GONE);
314 310
         }
315 311
     }
316 312
 
@@ -334,9 +330,6 @@ public class AerationDetailFragment extends BaseListFragment<FragmentAerationDet
334 330
             subList.add(map);
335 331
         }
336 332
 
337
-        // 流程索引
338
-        int ongoingStep = mStepAdapter.getMaxClickIndex();
339
-
340 333
         showProgress("正在提交...", false);
341 334
         if (mPageType.equals("add")) {
342 335
             ProcessModel.get().add(
@@ -346,31 +339,30 @@ public class AerationDetailFragment extends BaseListFragment<FragmentAerationDet
346 339
                     depotId,
347 340
                     user.getUid(),
348 341
                     user.getUid(),
349
-                    String.valueOf(ongoingStep),
342
+                    "0",
350 343
                     mDataCallBack);
351 344
         } else {
352 345
 
353 346
             // 进行中
354 347
             String auditState = "3";
355 348
             // 当前最大可见流程
356
-            ongoingStep = mStepAdapter.getMaxClickIndex();
349
+            String ongoingStep = mBean.getOngoingStep();
357 350
 
358
-            // 保存并提交时
359
-            if (mFinish) {
360
-                if (ongoingStep < mStepAdapter.getData().size() - 1) {
361
-                    // 不是最后一个流程
351
+            // 取出最高可见流程id
352
+            int maxClickIndex = mStepAdapter.getMaxClickIndex();
353
+            String id = mStepAdapter.getData().get(maxClickIndex).id;
354
+            if (isStepSelectFinish(id)) {
355
+                // 保存并提交 最大可见流程
362 356
 
363
-                    // 状态 3=进行中
364
-                    auditState = "3";
365
-                    // 索引传下个流程索引
366
-                    if (mStepAdapter.getCurrentIndex() == mStepAdapter.getMaxClickIndex())
367
-                        ongoingStep = mStepAdapter.getMaxClickIndex() + 1;
368
-                } else {
357
+                if (Integer.parseInt(ongoingStep) == mStepAdapter.getData().size() - 1) {
369 358
                     // 最后一个流程
370 359
                     // 状态 4=已完成
371 360
                     auditState = "4";
372
-                    // 索引 当前流程
373
-                    ongoingStep = mStepAdapter.getMaxClickIndex();
361
+                } else {
362
+                    // 不是最后一个流程
363
+                    // 流程索引+1
364
+                    int index = Integer.parseInt(ongoingStep) + 1;
365
+                    ongoingStep = String.valueOf(index);
374 366
                 }
375 367
             }
376 368
 
@@ -385,6 +377,27 @@ public class AerationDetailFragment extends BaseListFragment<FragmentAerationDet
385 377
 
386 378
     }
387 379
 
380
+
381
+    /**
382
+     * 最高流程的所有选项
383
+     * 是否已全部选中
384
+     *
385
+     * @return true=已全部选中   false=有未选中项
386
+     */
387
+    public boolean isStepSelectFinish(String flowId) {
388
+        // 判断流程是否完成
389
+        for (DetailItemBean item : mAdapter.getData()) {
390
+            if (item.getFlowId().equals(flowId)) {
391
+                // 流程选项
392
+                if (item.getSelectIndex() == null)
393
+                    // 有未选中项
394
+                    return false;
395
+            }
396
+        }
397
+        // 全部选中
398
+        return true;
399
+    }
400
+
388 401
     DataCallBack mDataCallBack = new DataCallBack<String>() {
389 402
         @Override
390 403
         public void onSuccess(String data) {
@@ -404,10 +417,24 @@ public class AerationDetailFragment extends BaseListFragment<FragmentAerationDet
404 417
         }
405 418
     };
406 419
 
420
+    /**
421
+     * 顶部流程切换监听
422
+     *
423
+     * @param item
424
+     */
407 425
     @Override
408 426
     public void onSwitchListener(ProcessStepBean item) {
409 427
         // 流程切换回调方法
410 428
         mAdapter.setFlowId(item.id);
429
+        mBinding.recyclerView.scrollToPosition(0);
430
+
431
+        if (mStepAdapter.getCurrentIndex() == 0 && !mPageType.equals("add")) {
432
+            // 非新增页 的第一个流程 隐藏提交按钮
433
+            mBinding.tvSave.setVisibility(View.GONE);
434
+            mBinding.tvSubmit.setVisibility(View.GONE);
435
+        } else
436
+            // 切换底部按钮的显示
437
+            showButton(item.id);
411 438
     }
412 439
 
413 440
 

+ 7 - 2
app/src/main/java/com/unis/sxzcl/ui/aeration/AerationListFragment.java

@@ -8,6 +8,7 @@ import com.google.gson.Gson;
8 8
 import com.unis.model.DataCallBack;
9 9
 import com.unis.model.HouseModel;
10 10
 import com.unis.model.ProcessModel;
11
+import com.unis.model.UserModel;
11 12
 import com.unis.model.bean.HouseListBean;
12 13
 import com.unis.model.bean.aeration.AerationBean;
13 14
 import com.unis.model.event.AerationEvent;
@@ -129,11 +130,15 @@ public class AerationListFragment extends BaseListFragment<FragmentBaseListTitle
129 130
         Bundle bundle = new Bundle();
130 131
         bundle.putString("data", new Gson().toJson(item));
131 132
 
132
-        // 状态是已完成时  跳转详情
133
+
133 134
         String auditState = item.getAuditState();
134
-        if (auditState != null && auditState.equals("4")) {
135
+        String uid = UserModel.get().getUser().getUid();
136
+
137
+        if (auditState != null && auditState.equals("4") || !uid.equals(item.getApplyPeople())) {
138
+            // 状态是已完成 登录人不是申请人  跳转详情
135 139
             bundle.putString("pageType", "detail");
136 140
         } else {
141
+            // 跳转编辑
137 142
             bundle.putString("pageType", "edit");
138 143
         }
139 144
         navigation(R.id.aerationDetailFragment, bundle);

+ 10 - 13
app/src/main/java/com/unis/sxzcl/ui/grain_check/GrainCheckDetailFragment.java

@@ -209,9 +209,6 @@ public class GrainCheckDetailFragment extends BaseListFragment<FragmentAddBindin
209 209
      * 显示信息
210 210
      */
211 211
     private void showData() {
212
-        if (mPageType.equals("add")) {
213
-            mBinding.tvSave.setVisibility(View.VISIBLE);
214
-        }
215 212
         if (mData == null)
216 213
             return;
217 214
 
@@ -298,16 +295,16 @@ public class GrainCheckDetailFragment extends BaseListFragment<FragmentAddBindin
298 295
         }
299 296
 
300 297
         // 设置状态
301
-        String recordStatus = mData.recordStatus;
302
-        if (recordStatus != null && recordStatus.equals("1")) {
303
-            // 1已完成
304
-            mBinding.tvSave.setVisibility(View.GONE);
305
-            mBinding.tvSubmit.setVisibility(View.GONE);
306
-        } else {
307
-            // 0进行中
308
-            mBinding.tvSave.setVisibility(View.VISIBLE);
309
-            mBinding.tvSubmit.setVisibility(View.GONE);
310
-        }
298
+//        String recordStatus = mData.recordStatus;
299
+//        if (recordStatus != null && recordStatus.equals("1")) {
300
+//            // 1已完成
301
+//            mBinding.tvSave.setVisibility(View.GONE);
302
+//            mBinding.tvSubmit.setVisibility(View.GONE);
303
+//        } else {
304
+//            // 0进行中
305
+//            mBinding.tvSave.setVisibility(View.VISIBLE);
306
+//            mBinding.tvSubmit.setVisibility(View.GONE);
307
+//        }
311 308
 
312 309
     }
313 310
 

+ 11 - 1
app/src/main/java/com/unis/sxzcl/ui/todo/TodoApplyListAdapter.java

@@ -65,7 +65,7 @@ public class TodoApplyListAdapter extends BaseQuickAdapter<AerationBean, BaseVie
65 65
         ;
66 66
         holder.setText(R.id.tv_content, sb.toString());
67 67
         // 业务时间
68
-        holder.setText(R.id.tv_time, item.getAuditTime());
68
+        holder.setText(R.id.tv_time, item.getApplyTime());
69 69
 
70 70
         // 业务状态
71 71
         TextView tvStatus = holder.getView(R.id.tv_status);
@@ -86,6 +86,16 @@ public class TodoApplyListAdapter extends BaseQuickAdapter<AerationBean, BaseVie
86 86
                 tvStatus.setText("审批不通过");
87 87
                 tvStatus.setTextColor(ContextCompat.getColor(getContext(), R.color.colorRed));
88 88
                 break;
89
+            case "3":
90
+                // 进行中
91
+                tvStatus.setText("进行中");
92
+                tvStatus.setTextColor(ContextCompat.getColor(getContext(), R.color.colorText55));
93
+                break;
94
+            case "4":
95
+                // 已完成
96
+                tvStatus.setText("已完成");
97
+                tvStatus.setTextColor(ContextCompat.getColor(getContext(), R.color.colorTheme));
98
+                break;
89 99
         }
90 100
 
91 101
         holder.itemView.setTag(item);

+ 1 - 1
app/src/main/java/com/unis/sxzcl/ui/todo/TodoDetailFragment.java

@@ -54,7 +54,7 @@ public class TodoDetailFragment extends BaseListFragment<FragmentTodoDetailBindi
54 54
             public void onSuccess(ProcessDetailBean data) {
55 55
                 if (!isActive()) return;
56 56
                 // 获取当前审批流程数据
57
-                String flowId = data.process.get(mOngoingStep).step.id;
57
+                String flowId = data.process.get(0).step.id;
58 58
                 approveMap.put(flowId, data.audit);
59 59
 
60 60
                 // 选项列表 和 流程

+ 10 - 0
app/src/main/java/com/unis/sxzcl/ui/todo/TodoFinishListAdapter.java

@@ -89,6 +89,16 @@ public class TodoFinishListAdapter extends BaseQuickAdapter<AerationBean, BaseVi
89 89
                 tvStatus.setText("审批不通过");
90 90
                 tvStatus.setTextColor(ContextCompat.getColor(getContext(), R.color.colorRed));
91 91
                 break;
92
+            case "3":
93
+                // 进行中
94
+                tvStatus.setText("进行中");
95
+                tvStatus.setTextColor(ContextCompat.getColor(getContext(), R.color.colorText55));
96
+                break;
97
+            case "4":
98
+                // 已完成
99
+                tvStatus.setText("已完成");
100
+                tvStatus.setTextColor(ContextCompat.getColor(getContext(), R.color.colorTheme));
101
+                break;
92 102
         }
93 103
 
94 104
         holder.itemView.setTag(item);

+ 5 - 1
app/src/main/res/navigation/nav_graph.xml

@@ -169,7 +169,11 @@
169 169
     <fragment
170 170
         android:id="@+id/aerationDetailFragment"
171 171
         android:name="com.unis.sxzcl.ui.aeration.AerationDetailFragment"
172
-        android:label="机械通风详情" />
172
+        android:label="机械通风详情" >
173
+        <action
174
+            android:id="@+id/action_aerationDetailFragment_to_todoHomeFragment"
175
+            app:destination="@id/todoHomeFragment" />
176
+    </fragment>
173 177
     <fragment
174 178
         android:id="@+id/todoDetailFragment"
175 179
         android:name="com.unis.sxzcl.ui.todo.TodoDetailFragment"

+ 12 - 8
model/src/main/java/com/unis/model/ProcessModel.java

@@ -178,9 +178,7 @@ public class ProcessModel {
178 178
     }
179 179
 
180 180
     /**
181
-     * 增加记录
182
-     *
183
-     * @param callBack
181
+     * 修改机械通风
184 182
      */
185 183
     public void update(
186 184
             List<Map<String, Object>> subList,
@@ -189,12 +187,18 @@ public class ProcessModel {
189 187
             String processId,
190 188
             String ongoingStep,
191 189
             final DataCallBack<String> callBack) {
190
+
192 191
         Map<String, Object> map = new HashMap<>();
193
-        map.put("processId", processId);// 流程id
194
-        map.put("type", type);// 流程类型(如:tf)
195
-        map.put("subList", subList);// 流程选项
196
-        map.put("auditState", Integer.parseInt(auditState));// 审批状态(0:提交,1审批通过:,2:审批不通过,3:审批完成进行中,4已完成)
197
-        map.put("ongoingStep", ongoingStep);// 进行到哪一步的主流程id
192
+        // 流程id
193
+        map.put("processId", processId);
194
+        // 流程类型(如:tf)
195
+        map.put("type", type);
196
+        // 流程选项
197
+        map.put("subList", subList);
198
+        // 审批状态(0:提交,1审批通过:,2:审批不通过,3:审批完成进行中,4已完成)
199
+        map.put("auditState", Integer.parseInt(auditState));
200
+        // 进行到哪一步的流程索引
201
+        map.put("ongoingStep", ongoingStep);
198 202
         PostRequest<String> request = OkGo.post(UrlPath.process_update);
199 203
         request.upJson(new Gson().toJson(map));
200 204
         request.execute(new MyStringCallback() {