Просмотр исходного кода

部分页面提示弹框补充以及页面显示调整

Frankensteinly 8 месяцев назад
Родитель
Сommit
381cdfee27

+ 21 - 0
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialFetchReturnFragment.kt

@@ -1,11 +1,13 @@
 package com.grkj.iscs_mc.view.fragment
 
+import android.view.View
 import com.bumptech.glide.Glide
 import com.grkj.iscs_mc.R
 import com.grkj.iscs_mc.databinding.FragmentMaterialFetchReturnBinding
 import com.grkj.iscs_mc.extentions.navigateUp
 import com.grkj.iscs_mc.model.vo.material.MaterialListRespVO
 import com.grkj.iscs_mc.view.base.BaseMvpFragment
+import com.grkj.iscs_mc.view.dialog.TipDialog
 import com.grkj.iscs_mc.view.iview.IMaterialFetchReturnView
 import com.grkj.iscs_mc.view.presenter.MaterialFetchReturnPresenter
 import com.grkj.iscs_mc.view.widget.ExpandableTabLayout
@@ -67,6 +69,25 @@ class MaterialFetchReturnFragment :
             }
             mBinding?.rvFetchReturn?.adapter?.notifyDataSetChanged()
         }
+
+        mBinding?.cbOpen?.setOnClickListener {
+            openCabinetConfirm()
+        }
+    }
+
+    /**
+     * 开柜确认
+     */
+    private fun openCabinetConfirm() {
+        val dlg = TipDialog(requireContext())
+        dlg.setTip(getString(R.string.open_cabinet_confirm_tip))
+        dlg.setConfirmListener {
+            // TODO 打开接口 + 隐藏按钮
+            mBinding?.cbOpen?.visibility = View.GONE
+            mBinding?.ivTip?.visibility = View.VISIBLE
+            mBinding?.tvTip?.visibility = View.VISIBLE
+        }
+        dlg.show()
     }
 
     override fun initPresenter(): MaterialFetchReturnPresenter {

+ 10 - 1
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialInspectionPlanFragment.kt

@@ -96,7 +96,7 @@ class MaterialInspectionPlanFragment :
         }
 
         mBinding?.cbSubmit?.setOnClickListener {
-
+            submitConfirm()
         }
 
         val bundle = arguments
@@ -117,6 +117,15 @@ class MaterialInspectionPlanFragment :
         dialog.show()
     }
 
+    private fun submitConfirm() {
+        val dialog = TipDialog(requireContext())
+        dialog.setTip(getString(R.string.inspection_submit_confirm_tip))
+        dialog.setConfirmListener {
+            // TODO 提交检查结果
+        }
+        dialog.show()
+    }
+
     override fun initPresenter(): MaterialInspectionPlanPresenter {
         return MaterialInspectionPlanPresenter()
     }

+ 11 - 2
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialInspectionSignatureFragment.kt

@@ -11,6 +11,7 @@ import com.grkj.iscs_mc.extentions.serialNo
 import com.grkj.iscs_mc.util.ImgUtil
 import com.grkj.iscs_mc.util.NetApi
 import com.grkj.iscs_mc.view.base.BaseFragment
+import com.grkj.iscs_mc.view.dialog.TipDialog
 
 /**
  * 物资检查签名页
@@ -37,7 +38,6 @@ class MaterialInspectionSignatureFragment :
         mPlanId = args.planId
 
         mBinding?.cbConfirm?.setOnClickListener {
-            val bitmap = mBinding?.sv?.drawingCache
             // 页面回传图片,暂时取消,改成直接上传后端
 //            val bundle = Bundle()
 //            bundle.putString("bitmap", ImgUtil.imageToBase64(bitmap!!))
@@ -51,6 +51,15 @@ class MaterialInspectionSignatureFragment :
 //                    .build()
 //            )
 
+            saveSignConfirm()
+        }
+    }
+
+    private fun saveSignConfirm() {
+        val dlg = TipDialog(requireContext())
+        dlg.setTip(getString(R.string.save_sign_confirm_tip))
+        dlg.setConfirmListener {
+            val bitmap = mBinding?.sv?.drawingCache
             mPlanId?.let {
                 NetApi.insertSign(it, requireContext().serialNo(), ImgUtil.imageToBase64(bitmap!!)) {
                     if (it) {
@@ -58,7 +67,7 @@ class MaterialInspectionSignatureFragment :
                     }
                 }
             }
-
         }
+        dlg.show()
     }
 }

+ 10 - 0
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialManualReplacementFragment.kt

@@ -8,6 +8,7 @@ import com.grkj.iscs_mc.model.vo.material.MaterialPropertyValuePageRespVO
 import com.grkj.iscs_mc.model.vo.material.MaterialTypePageRespVO
 import com.grkj.iscs_mc.model.vo.replacement.ManualReplacementListRespVO
 import com.grkj.iscs_mc.view.base.BaseMvpFragment
+import com.grkj.iscs_mc.view.dialog.TipDialog
 import com.grkj.iscs_mc.view.iview.IMaterialManualReplacementView
 import com.grkj.iscs_mc.view.presenter.MaterialManualReplacementPresenter
 import com.grkj.iscs_mc.view.widget.ExpandableTabLayout
@@ -202,10 +203,19 @@ class MaterialManualReplacementFragment :
         }
 
         mBinding?.cbSubmit?.setOnClickListener {
+            submitConfirm()
+        }
+    }
+
+    private fun submitConfirm() {
+        val dialog = TipDialog(requireContext())
+        dialog.setTip(getString(R.string.manual_replacement_submit_confirm_tip))
+        dialog.setConfirmListener {
             presenter?.submit(mMaterialList, mPropertyList) {
                 if (it) navigateUp()
             }
         }
+        dialog.show()
     }
 
     override fun initPresenter(): MaterialManualReplacementPresenter {

+ 34 - 1
app/src/main/java/com/grkj/iscs_mc/view/fragment/MaterialReplacementFragment.kt

@@ -8,6 +8,7 @@ import com.grkj.iscs_mc.extentions.navigateTo
 import com.grkj.iscs_mc.extentions.navigateUp
 import com.grkj.iscs_mc.model.vo.replacement.ManualReplacementListRespVO
 import com.grkj.iscs_mc.view.base.BaseMvpFragment
+import com.grkj.iscs_mc.view.dialog.TipDialog
 import com.grkj.iscs_mc.view.iview.IMaterialReplacementView
 import com.grkj.iscs_mc.view.presenter.MaterialReplacementPresenter
 import com.grkj.iscs_mc.view.widget.ExpandableTabLayout
@@ -22,6 +23,7 @@ class MaterialReplacementFragment :
 
     private val mTypeList = mutableListOf<ManualReplacementListRespVO>()
     private val mDetailList = mutableListOf<ManualReplacementListRespVO.MaterialsPageVO>()
+    private var mDialog: TipDialog? = null
 
     override val viewBinding: FragmentMaterialReplacementBinding
         get() = FragmentMaterialReplacementBinding.inflate(layoutInflater)
@@ -60,8 +62,12 @@ class MaterialReplacementFragment :
             }
         })
 
+        mBinding?.cbAutoReplace?.setOnClickListener {
+            showConfirmDialog(true)
+        }
+
         mBinding?.cbManualReplace?.setOnClickListener {
-            navigateTo(MaterialReplacementFragmentDirections.actionReplacementFragmentToManualReplacementFragment())
+            showConfirmDialog(false)
         }
 
         presenter?.getManualReplacementList {
@@ -85,6 +91,33 @@ class MaterialReplacementFragment :
         }
     }
 
+    /**
+     * 弹框确认
+     *
+     * @param isAuto 是否自动更换 true:自动更换 false:手动更换
+     */
+    private fun showConfirmDialog(isAuto: Boolean) {
+        mDialog ?: let {
+            mDialog = TipDialog(requireContext())
+        }
+        mDialog?.setTip(
+            if (isAuto) getString(R.string.open_cabinet_auto_replacement_confirm_tip)
+            else getString(R.string.open_cabinet_manual_replacement_confirm_tip)
+        )
+        mDialog?.setConfirmListener {
+            if (isAuto) {
+                // TODO 看门接口 + 按钮隐藏 + 提示显示
+                mBinding?.cbAutoReplace?.visibility = View.GONE
+                mBinding?.cbManualReplace?.visibility = View.GONE
+                mBinding?.ivAutoTip?.visibility = View.VISIBLE
+                mBinding?.tvAutoTip?.visibility = View.VISIBLE
+            } else {
+                navigateTo(MaterialReplacementFragmentDirections.actionReplacementFragmentToManualReplacementFragment())
+            }
+        }
+        mDialog?.show()
+    }
+
     fun getStatusStr(status: String?): String {
         return when (status) {
             "0" -> getString(R.string.normal)

+ 45 - 8
app/src/main/res/layout/fragment_material_fetch_return.xml

@@ -13,19 +13,56 @@
         app:bar_icon="@mipmap/material_fetch_return"
         app:bar_title="@string/material_fetch_return" />
 
-    <com.grkj.iscs_mc.view.widget.CommonBtn
-        android:id="@+id/cb_back"
-        android:layout_width="wrap_content"
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/cl_control"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentBottom="true"
-        app:btn_bg="@drawable/common_btn_blue_bg"
-        app:btn_name="@string/back" />
+        android:layout_alignParentBottom="true">
+
+        <ImageView
+            android:id="@+id/iv_tip"
+            android:layout_width="@dimen/common_icon_size"
+            android:layout_height="@dimen/common_icon_size"
+            android:layout_centerVertical="true"
+            android:background="@mipmap/settings"
+            app:layout_constraintBottom_toBottomOf="@id/cb_back"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toTopOf="@id/cb_back" />
+
+        <TextView
+            android:id="@+id/tv_tip"
+            style="@style/CommonTextView"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="@dimen/common_spacing_small"
+            android:text="@string/waiting_for_material_fetch_and_return"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toRightOf="@id/iv_tip"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <com.grkj.iscs_mc.view.widget.CommonBtn
+            android:id="@+id/cb_back"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:btn_bg="@drawable/common_btn_blue_bg"
+            app:btn_name="@string/back"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintRight_toRightOf="parent" />
+
+        <com.grkj.iscs_mc.view.widget.CommonBtn
+            android:id="@+id/cb_open"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/common_spacing_small"
+            app:btn_bg="@drawable/common_btn_red_bg"
+            app:btn_name="@string/open_cabinet"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintRight_toLeftOf="@id/cb_back" />
+    </androidx.constraintlayout.widget.ConstraintLayout>
 
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_above="@id/cb_back"
+        android:layout_above="@id/cl_control"
         android:layout_below="@id/tb"
         android:layout_marginVertical="@dimen/common_spacing"
         android:background="@drawable/item_rv_technology_sop_bg_normal">

+ 54 - 27
app/src/main/res/layout/fragment_material_replacement.xml

@@ -13,38 +13,65 @@
         app:bar_icon="@mipmap/material_replacement"
         app:bar_title="@string/material_replacement" />
 
-    <com.grkj.iscs_mc.view.widget.CommonBtn
-        android:id="@+id/cb_back"
-        android:layout_width="wrap_content"
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/cl_control"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentBottom="true"
-        app:btn_bg="@drawable/common_btn_blue_bg"
-        app:btn_name="@string/back" />
+        android:layout_alignParentBottom="true">
 
-    <com.grkj.iscs_mc.view.widget.CommonBtn
-        android:id="@+id/cb_auto_replace"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_marginHorizontal="@dimen/common_spacing"
-        android:layout_toLeftOf="@id/cb_back"
-        app:btn_bg="@drawable/common_btn_red_bg"
-        app:btn_name="@string/auto_replace" />
+        <ImageView
+            android:id="@+id/iv_auto_tip"
+            android:layout_width="@dimen/common_icon_size"
+            android:layout_height="@dimen/common_icon_size"
+            android:layout_centerVertical="true"
+            android:background="@mipmap/settings"
+            app:layout_constraintBottom_toBottomOf="@id/cb_back"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toTopOf="@id/cb_back" />
 
-    <com.grkj.iscs_mc.view.widget.CommonBtn
-        android:id="@+id/cb_manual_replace"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_toLeftOf="@id/cb_auto_replace"
-        app:btn_bg="@drawable/common_btn_green_bg"
-        app:btn_name="@string/manual_replace" />
+        <TextView
+            android:id="@+id/tv_auto_tip"
+            style="@style/CommonTextView"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="@dimen/common_spacing_small"
+            android:text="@string/auto_replacement_tip"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toRightOf="@id/iv_auto_tip"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <com.grkj.iscs_mc.view.widget.CommonBtn
+            android:id="@+id/cb_back"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:btn_bg="@drawable/common_btn_blue_bg"
+            app:btn_name="@string/back"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintRight_toRightOf="parent" />
+
+        <com.grkj.iscs_mc.view.widget.CommonBtn
+            android:id="@+id/cb_auto_replace"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginHorizontal="@dimen/common_spacing"
+            app:btn_bg="@drawable/common_btn_red_bg"
+            app:btn_name="@string/auto_replace"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintRight_toLeftOf="@id/cb_back" />
+
+        <com.grkj.iscs_mc.view.widget.CommonBtn
+            android:id="@+id/cb_manual_replace"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:btn_bg="@drawable/common_btn_green_bg"
+            app:btn_name="@string/manual_replace"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintRight_toLeftOf="@id/cb_auto_replace" />
+    </androidx.constraintlayout.widget.ConstraintLayout>
 
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_above="@id/cb_back"
+        android:layout_above="@id/cl_control"
         android:layout_below="@id/tb"
         android:layout_marginVertical="@dimen/common_spacing"
         android:background="@drawable/item_rv_technology_sop_bg_normal">
@@ -52,8 +79,8 @@
         <TextView
             android:id="@+id/tv_tip"
             style="@style/CommonTextView"
-            android:text="@string/material_replacement_tip"
-            android:layout_centerInParent="true"/>
+            android:layout_centerInParent="true"
+            android:text="@string/material_replacement_tip" />
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/rv_material"

+ 12 - 0
app/src/main/res/values/strings.xml

@@ -110,4 +110,16 @@
     <string name="manual_replacement_mode_check_tip">请选择型号</string>
     <string name="manual_replacement_mode_rfid_tip">请输入RFID</string>
     <string name="manual_replacement_mode_date_tip">请选择有效的日期</string>
+
+    <string name="open_cabinet_confirm_tip">确认要开柜取还物资吗?</string>
+    <string name="waiting_for_material_fetch_and_return">等待取还物资……</string>
+
+    <string name="save_sign_confirm_tip">确定要保存签名吗?</string>
+    <string name="inspection_submit_confirm_tip">确定要提交检查结果吗?</string>
+
+    <string name="open_cabinet_manual_replacement_confirm_tip">确定要开柜进行手动更换物资吗?</string>
+    <string name="open_cabinet_auto_replacement_confirm_tip">确定要开柜进行自动更换物资吗?</string>
+    <string name="auto_replacement_tip">请取出要被替换的物资,并放入新物资……</string>
+
+    <string name="manual_replacement_submit_confirm_tip">确定要手动更换记录吗?</string>
 </resources>