手动添加作业风险信息 接口调用完成

master
wenfei 4 months ago
parent a699ee9aac
commit d2f309fb45

@ -1148,6 +1148,10 @@
android:name=".ui.activity.WorkTickerCustomAddActivity" android:name=".ui.activity.WorkTickerCustomAddActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateHidden" /> <!-- 作业风险清单-手动添加 点击进入已审批通过的手动添加列表选择 --> android:windowSoftInputMode="adjustResize|stateHidden" /> <!-- 作业风险清单-手动添加 点击进入已审批通过的手动添加列表选择 -->
<activity
android:name=".ui.activity.WorkTickerHazardAddActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateHidden" /> <!-- 作业风险清单-手动添加 点击进入已审批通过的手动添加列表选择 -->
<activity <activity
android:name=".ui.activity.WorkRiskListHuiBaoActivity" android:name=".ui.activity.WorkRiskListHuiBaoActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"

@ -551,9 +551,9 @@ public class Contans {
//每日作业风险清单提交报告 //每日作业风险清单提交报告
public final static String DAYLY_RISK_LIST_SUBMIT_REPORT = "sc_v1/api/work/report/add"; public final static String DAYLY_RISK_LIST_SUBMIT_REPORT = "sc_v1/api/work/report/add";
//查询每日工作报告 //查询每日工作报告
public final static String DAYLY_RISK_LIST_DAYLY = "/sc_v1/api/work/report/page"; public final static String DAYLY_RISK_LIST_DAYLY = "sc_v1/api/work/report/page";
//每日作业风险清单提交工作票,更新显示列表 //每日作业风险清单提交工作票,更新显示列表
public final static String DAYLY_RISK_LIST_SUBMIT_WORK_TICKET_LIST = "/sc_v1/api/ticket/assignment_date/add"; public final static String DAYLY_RISK_LIST_SUBMIT_WORK_TICKET_LIST = "sc_v1/api/ticket/assignment_date/add";
//查询每日作业风险清单新接口 //查询每日作业风险清单新接口
public final static String DAYLY_RISK_LIST_NEW = "sc_v1/api/ticket/active/listSummaryTicketAndLevel"; public final static String DAYLY_RISK_LIST_NEW = "sc_v1/api/ticket/active/listSummaryTicketAndLevel";
@ -564,6 +564,18 @@ public class Contans {
//每日作业风险清单 修改每日作业风险等级 //每日作业风险清单 修改每日作业风险等级
public final static String UPDATE_RISK_LEVEL = "sc_v1/api/ticket/level/update"; public final static String UPDATE_RISK_LEVEL = "sc_v1/api/ticket/level/update";
//每日作业风险清单 提交手动添加的工作票
public final static String DAYLY_SUBMIT_CUSTOM_WORK_TICKET = "sc_v1/api/dailyOperation/add";
//每日作业风险清单 更新手动添加的作业风险信息
public final static String DAYLY_UPDATE_CUSTOM_WORK_TICKET = "/sc_v1/api/dailyOperation/update";
//每日作业风险清单 删除手动添加的作业风险信息
public final static String DAYLY_DELETE_CUSTOM_WORK_TICKET = "sc_v1/api/dailyOperation/delete";
//每日作业风险清单 查询自定义作业风险信息
public final static String DAYLY_SELECT_CUSTOM_WORK_TICKET = "sc_v1/api/dailyOperation/select";
//通讯录 //通讯录
public static String GETCONTACTLIST_URL="PubFile/Data/GetAddressbookRsa.ashx"; public static String GETCONTACTLIST_URL="PubFile/Data/GetAddressbookRsa.ashx";

@ -0,0 +1,44 @@
package com.rehome.zhdcoa.adapter;
import static android.text.Html.FROM_HTML_MODE_LEGACY;
import android.content.Context;
import android.text.Html;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
import com.rehome.zhdcoa.R;
import com.rehome.zhdcoa.bean.WorkRiskLevelTipListBean;
import java.util.List;
public class WorkRiskListTipModifyAdapter extends CommonAdapter<WorkRiskLevelTipListBean> {
private final Context context;
private List<WorkRiskLevelTipListBean> datas;
private OnWorkTicketModifyDeleteClickListener onWorkTicketModifyDeleteClickListener;
public WorkRiskListTipModifyAdapter(Context context, List<WorkRiskLevelTipListBean> datas,OnWorkTicketModifyDeleteClickListener onWorkTicketModifyDeleteClickListener) {
super(context, R.layout.adapter_item_work_risk_list_tip_modify, datas);
this.context = context;
this.datas = datas;
this.onWorkTicketModifyDeleteClickListener= onWorkTicketModifyDeleteClickListener;
}
@Override
protected void convert(ViewHolder viewHolder, WorkRiskLevelTipListBean item, int position) {
if (item != null) {
viewHolder.setText(R.id.tv_xh, String.valueOf(position+1));
viewHolder.setText(R.id.tv_weiHai, item.getType());
viewHolder.setText(R.id.tv_yuFang, item.getPrecaution());
viewHolder.setOnClickListener(R.id.tv_delete, v -> {
onWorkTicketModifyDeleteClickListener.onItemClick(position);
});
}
}
public interface OnWorkTicketModifyDeleteClickListener {
void onItemClick(int position);
}
}

@ -8,6 +8,10 @@ public class AIBaseBean {
//状态码 //状态码
private int flag; private int flag;
private int code;
private String message;
public boolean isSuccess() { public boolean isSuccess() {
return success; return success;
} }
@ -31,4 +35,20 @@ public class AIBaseBean {
public void setFlag(int flag) { public void setFlag(int flag) {
this.flag = flag; this.flag = flag;
} }
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
} }

@ -145,10 +145,8 @@ class WorkRiskListActivity : BaseActivityOaToolbarViewBinding<ActivityWorkRiskLi
//进入风险提示页面 WorkTickerAssistantSelectListActivity //进入风险提示页面 WorkTickerAssistantSelectListActivity
val intent = Intent(context, WorkTickerCustomListActivity::class.java) val intent = Intent(context, WorkTickerCustomListActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
// intent.putExtra("selectList", GsonUtils.GsonString(selectListCustom)) intent.putExtra("selectList", GsonUtils.GsonString(selectListCustom))
// intent.putExtra("jobNoList", GsonUtils.GsonString(jobNoListCustom)) intent.putExtra("jobNoList", GsonUtils.GsonString(jobNoListCustom))
intent.putExtra("selectList", GsonUtils.GsonString(selectList))
intent.putExtra("jobNoList", GsonUtils.GsonString(jobNoList))
startActivity(intent) startActivity(intent)
}else{ }else{
showToast("列表数据加载失败,请检查网络环境或重新加载列表数据") showToast("列表数据加载失败,请检查网络环境或重新加载列表数据")
@ -266,6 +264,9 @@ class WorkRiskListActivity : BaseActivityOaToolbarViewBinding<ActivityWorkRiskLi
selectListAssistant.clear() selectListAssistant.clear()
jobNoListAssistant.clear() jobNoListAssistant.clear()
selectListCustom.clear()
jobNoListCustom.clear()
for(item in datas){ for(item in datas){
if("ticket" == item.type){ if("ticket" == item.type){
selectList.add(item.id) selectList.add(item.id)

@ -2,15 +2,22 @@ package com.rehome.zhdcoa.ui.activity
import android.R import android.R
import android.content.Intent
import android.text.TextUtils
import android.view.View import android.view.View
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.CompoundButton import android.widget.CompoundButton
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import com.rehome.zhdcoa.App import com.rehome.zhdcoa.App
import com.rehome.zhdcoa.Contans import com.rehome.zhdcoa.Contans
import com.rehome.zhdcoa.adapter.WorkRiskListTipAdapter
import com.rehome.zhdcoa.adapter.WorkRiskListTipModifyAdapter
import com.rehome.zhdcoa.adapter.WorkTickerCustomListAdapter import com.rehome.zhdcoa.adapter.WorkTickerCustomListAdapter
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
import com.rehome.zhdcoa.bean.AIBaseBean import com.rehome.zhdcoa.bean.AIBaseBean
import com.rehome.zhdcoa.bean.WorkRiskLevelListBean import com.rehome.zhdcoa.bean.WorkRiskLevelListBean
import com.rehome.zhdcoa.bean.WorkRiskLevelTipListBean
import com.rehome.zhdcoa.databinding.ActivityWorkTickerCustomAddBinding import com.rehome.zhdcoa.databinding.ActivityWorkTickerCustomAddBinding
import com.rehome.zhdcoa.utils.AuthenticationLoginAIUtils import com.rehome.zhdcoa.utils.AuthenticationLoginAIUtils
import com.rehome.zhdcoa.utils.GsonUtils import com.rehome.zhdcoa.utils.GsonUtils
@ -58,28 +65,58 @@ class WorkTickerCustomAddActivity : BaseActivityOaToolbarViewBinding<ActivityWor
private lateinit var adapter: ArrayAdapter<String> private lateinit var adapter: ArrayAdapter<String>
private lateinit var launcherResult: ActivityResultLauncher<Intent>
private lateinit var calendarSt: Calendar private lateinit var calendarSt: Calendar
private lateinit var calendarEt: Calendar private lateinit var calendarEt: Calendar
private var isEdit = false
//格式化日期的对象(转化成习惯的时间格式) //格式化日期的对象(转化成习惯的时间格式)
private val sdFormat = SimpleDateFormat("yyyy-MM-dd HH:mm") private val sdFormat = SimpleDateFormat("yyyy-MM-dd HH:mm")
private var workRiskLevelTipListBeanList : MutableList<WorkRiskLevelTipListBean> = mutableListOf()
private lateinit var mAdapterHazard: WorkRiskListTipModifyAdapter
override fun getViewBinding() = ActivityWorkTickerCustomAddBinding.inflate(layoutInflater) override fun getViewBinding() = ActivityWorkTickerCustomAddBinding.inflate(layoutInflater)
override fun getToolbar() = binding.toolbarView.toolbar override fun getToolbar() = binding.toolbarView.toolbar
override fun initView() { override fun initView() {
initToolbar("手动添加工作票", "") { initToolbar("手动添加作业风险信息", "") {
} }
launcherResult = createActivityResultLauncher()
resetToday() resetToday()
isEdit = intent.getBooleanExtra("isEdit",false)
adapter = ArrayAdapter(this, R.layout.simple_spinner_item, items) adapter = ArrayAdapter(this, R.layout.simple_spinner_item, items)
binding.spinnerZy.adapter = adapter binding.spinnerZy.adapter = adapter
mAdapterHazard = WorkRiskListTipModifyAdapter(this,workRiskLevelTipListBeanList
) { position ->
val dialog = CommitDialog(context, object : CommitDialogListener {
override fun confirm() {
val item:WorkRiskLevelTipListBean = workRiskLevelTipListBeanList[position]
workRiskLevelTipListBeanList.removeAt(position)
mAdapterHazard.notifyDataSetChanged()
}
override fun cancel() {
}
})
dialog.setTvMsg("您确定要删除当前记录吗?")
dialog.show()
};
binding.lv.adapter = mAdapterHazard
binding.tvSt.setOnClickListener(View.OnClickListener { view: View? -> binding.tvSt.setOnClickListener(View.OnClickListener { view: View? ->
@ -105,32 +142,27 @@ class WorkTickerCustomAddActivity : BaseActivityOaToolbarViewBinding<ActivityWor
binding.tvSubmit.setOnClickListener { binding.tvSubmit.setOnClickListener {
var canSubmit = false if(checkCanSubmit()){
ticketIdList.clear()
for (i in datas.indices) {
if (datas[i].isChecked) {
canSubmit = true
ticketIdList.add(datas[i].id)
}
}
if (canSubmit||deleteIdList.size>0) {
val dialog = CommitDialog(context, object : CommitDialogListener { val dialog = CommitDialog(context, object : CommitDialogListener {
override fun confirm() { override fun confirm() {
showLog(GsonUtils.GsonString(ticketIdList)) authenticationLoginAISubmit()
showLog(ticketIdList.size.toString())
//authenticationLoginAISubmit()
} }
override fun cancel() { override fun cancel() {
} }
}) })
dialog.setTvMsg("您确定要设置工作票作业?") dialog.setTvMsg("您确定要提交手动添加的作业风险信息吗?")
dialog.show() dialog.show()
}else{
showToast("致少选择一个工作票才能提交")
} }
} }
binding.ivAdd.setOnClickListener {
//进入手动添加页面
val intent = Intent(context, WorkTickerHazardAddActivity::class.java) // WorkTickerHazardAddActivity
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
launcherResult.launch(intent)
}
binding.rb1.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener { binding.rb1.setOnCheckedChangeListener(object: CompoundButton.OnCheckedChangeListener {
override fun onCheckedChanged( override fun onCheckedChanged(
buttonView: CompoundButton, buttonView: CompoundButton,
@ -227,6 +259,28 @@ class WorkTickerCustomAddActivity : BaseActivityOaToolbarViewBinding<ActivityWor
authenticationLoginAI() authenticationLoginAI()
} }
//创建一个ActivityResultLauncher
private fun createActivityResultLauncher(): ActivityResultLauncher<Intent> {
//kotlin写法
return registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
val data = it.data
val resultCode = it.resultCode
if (resultCode == RESULT_OK) {
if (data != null) {
val workRiskLevelTipListBeanStr = data.getStringExtra("hazard")
if(workRiskLevelTipListBeanStr!=null){
val workRiskLevelTipListBean = GsonUtils.GsonToBean(workRiskLevelTipListBeanStr,
WorkRiskLevelTipListBean::class.java
)
workRiskLevelTipListBeanList.add(workRiskLevelTipListBean)
mAdapterHazard.notifyDataSetChanged()
}
}
}
}
}
private fun authenticationLoginAI() { private fun authenticationLoginAI() {
try { try {
//AI三维登录接口 //AI三维登录接口
@ -336,11 +390,27 @@ class WorkTickerCustomAddActivity : BaseActivityOaToolbarViewBinding<ActivityWor
private fun getSubmitJsonData(): String { private fun getSubmitJsonData(): String {
val param = HashMap<String, Any>() val param = HashMap<String, Any>()
param["assignmentDate"] = binding.tvSt.text.toString().trim() param["major"] = items[binding.spinnerZy.selectedItemPosition]
param["ticketIdList"] = ticketIdList param["jobNo"] = userInfo!!.manid
param["deleteIdList"]= deleteIdList param["content"] = binding.etMs.text.toString().trim()
param["jobNo"]= App.getInstance().userInfo.manid
param["type"]= "custom" if(binding.rb1.isChecked){
param["level"] = "A"
}else if(binding.rb2.isChecked){
param["level"] = "B"
}else if(binding.rb3.isChecked){
param["level"] = "C1"
}else if(binding.rb4.isChecked){
param["level"] = "C2"
}else if(binding.rb5.isChecked){
param["level"] = "C3"
}else if(binding.rb6.isChecked){
param["level"] = "低风险"
}
param["startTime"]= binding.tvSt.text.toString().trim()
param["endTime"]= binding.tvEt.text.toString().trim()
param["hazardList"]= workRiskLevelTipListBeanList
val json = GsonUtils.GsonString(param) val json = GsonUtils.GsonString(param)
showLog(json) showLog(json)
@ -349,7 +419,7 @@ class WorkTickerCustomAddActivity : BaseActivityOaToolbarViewBinding<ActivityWor
private fun submitWorkTicketData() { private fun submitWorkTicketData() {
val request = NoHttp.createStringRequest( val request = NoHttp.createStringRequest(
Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_SUBMIT_WORK_TICKET_LIST, Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_SUBMIT_CUSTOM_WORK_TICKET,
RequestMethod.POST RequestMethod.POST
) )
@ -377,13 +447,13 @@ class WorkTickerCustomAddActivity : BaseActivityOaToolbarViewBinding<ActivityWor
if (bean != null && bean.isSuccess) { if (bean != null && bean.isSuccess) {
//提交成功 //提交成功
val confirmDialog = ConfirmDialog( val confirmDialog = ConfirmDialog(
context, "设置工作票作业日期成功" context, "手动添加作业风险信息成功"
) { finish() } ) { finish() }
confirmDialog.setTvTitle("提示") confirmDialog.setTvTitle("提示")
confirmDialog.setCancelable(true) confirmDialog.setCancelable(true)
confirmDialog.show() confirmDialog.show()
}else{ }else{
showToast("设置工作票作业日期失败") showToast("手动添加作业风险信息失败")
} }
} }
@ -392,5 +462,13 @@ class WorkTickerCustomAddActivity : BaseActivityOaToolbarViewBinding<ActivityWor
} }
}) })
} }
//检查是否可以提交
private fun checkCanSubmit():Boolean {
if(TextUtils.isEmpty(binding.etMs.text.toString().trim())){
showToast("工作内容必填")
return false
}
return true;
}
} }

@ -64,16 +64,18 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
override fun initView() { override fun initView() {
initToolbar("手动添加工作票", "新增") { initToolbar("手动添加作业风险信息", "新增") {
//进入手动添加页面 //进入手动添加页面
val intent = Intent(context, WorkTickerCustomAddActivity::class.java) val intent = Intent(context, WorkTickerCustomAddActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
intent.putExtra("isEdit", false)
startActivity(intent) startActivity(intent)
} }
resetToday() resetToday()
showLog("--------------------custom--------------------------")
val selectListStr = intent.getStringExtra("selectList")!! val selectListStr = intent.getStringExtra("selectList")!!
showLog(selectListStr) showLog(selectListStr)
val gson = Gson() val gson = Gson()
@ -149,10 +151,10 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
mAdapter.notifyDataSetChanged() mAdapter.notifyDataSetChanged()
},{ position -> },{ position ->
val item:WorkRiskLevelListBean.RowsBean = datas[position] val item:WorkRiskLevelListBean.RowsBean = datas[position]
showToast("修改") //showToast("修改")
},{ position -> },{ position ->
val item:WorkRiskLevelListBean.RowsBean = datas[position] val item:WorkRiskLevelListBean.RowsBean = datas[position]
showToast("删除") //showToast("删除")
val dialog = CommitDialog(context, object : CommitDialogListener { val dialog = CommitDialog(context, object : CommitDialogListener {
override fun confirm() { override fun confirm() {
//authenticationLoginAISubmit() //authenticationLoginAISubmit()
@ -161,7 +163,7 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
override fun cancel() { override fun cancel() {
} }
}) })
dialog.setTvMsg("您确定要删除手动添加的工作票吗?") dialog.setTvMsg("您确定要删除手动添加作业风险信息吗?")
dialog.show() dialog.show()
}) })
@ -179,9 +181,13 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
if (canSubmit||deleteIdList.size>0) { if (canSubmit||deleteIdList.size>0) {
val dialog = CommitDialog(context, object : CommitDialogListener { val dialog = CommitDialog(context, object : CommitDialogListener {
override fun confirm() { override fun confirm() {
showLog("----------ticketIdList---------")
showLog(GsonUtils.GsonString(ticketIdList)) showLog(GsonUtils.GsonString(ticketIdList))
showLog(ticketIdList.size.toString()) showLog(ticketIdList.size.toString())
//authenticationLoginAISubmit() showLog("---------deleteIdList----------")
showLog(GsonUtils.GsonString(deleteIdList))
showLog(deleteIdList.size.toString())
authenticationLoginAISubmit()
} }
override fun cancel() { override fun cancel() {
@ -196,6 +202,12 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
} }
override fun initData() { override fun initData() {
}
override fun onResume() {
super.onResume()
showLog("onResume")
authenticationLoginAI() authenticationLoginAI()
} }
@ -224,11 +236,11 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
private fun getWorkRiskListData() { private fun getWorkRiskListData() {
val request = NoHttp.createStringRequest( val request = NoHttp.createStringRequest(
Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_NEW, Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_SELECT_CUSTOM_WORK_TICKET,
RequestMethod.GET RequestMethod.GET
) )
request.add("filter",false); request.add("date",binding.tvSt.text.toString().trim());
if (Contans.BASE_URL_AI_3D_SERVER == Contans.BASE_URL_AI_3D_SERVER_EXTRANET) { if (Contans.BASE_URL_AI_3D_SERVER == Contans.BASE_URL_AI_3D_SERVER_EXTRANET) {
val socketFactory = NohttpUtils.getSSLSocketFactory(context) val socketFactory = NohttpUtils.getSSLSocketFactory(context)
@ -334,8 +346,9 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
} }
private fun submitWorkTicketData() { private fun submitWorkTicketData() {
val url = Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_SUBMIT_WORK_TICKET_LIST
val request = NoHttp.createStringRequest( val request = NoHttp.createStringRequest(
Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_SUBMIT_WORK_TICKET_LIST, url,
RequestMethod.POST RequestMethod.POST
) )
@ -354,7 +367,8 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
override fun onSucceed(what: Int, response: Response<String?>?) { override fun onSucceed(what: Int, response: Response<String?>?) {
val result = response?.get() val result = response?.get()
showLog("----------------") showLog("--------设置工作票作业日期成功--------")
showLog(url)
showLog(result) showLog(result)
val bean = GsonUtils.GsonToBean( val bean = GsonUtils.GsonToBean(
result, result,

@ -0,0 +1,58 @@
package com.rehome.zhdcoa.ui.activity
import android.content.Intent
import android.text.TextUtils
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
import com.rehome.zhdcoa.bean.WorkRiskLevelTipListBean
import com.rehome.zhdcoa.databinding.ActivityWorkTickerHazardAddBinding
import com.rehome.zhdcoa.utils.GsonUtils
/**
* Create By HuangWenFei
* 创建日期2025-08-12 09:30
* 描述添加危害后果及防范措施
*/
class WorkTickerHazardAddActivity : BaseActivityOaToolbarViewBinding<ActivityWorkTickerHazardAddBinding>() {
override fun getViewBinding() = ActivityWorkTickerHazardAddBinding.inflate(layoutInflater)
override fun getToolbar() = binding.toolbarView.toolbar
override fun initView() {
initToolbar("添加危害后果及防范措施", "") {
}
binding.tvSubmit.setOnClickListener {
if(checkInput()){
val workRiskLevelTipListBean = WorkRiskLevelTipListBean()
workRiskLevelTipListBean.type=binding.etWhhg.text.toString().trim()
workRiskLevelTipListBean.precaution=binding.etFfcs.text.toString().trim()
//处理回填
val intent = Intent()
intent.putExtra("hazard", GsonUtils.GsonString(workRiskLevelTipListBean))
setResult(RESULT_OK, intent)
finish()
}
}
}
override fun initData() {
}
private fun checkInput():Boolean {
if(TextUtils.isEmpty(binding.etWhhg.text.toString().trim())){
showToast("危害后果必填")
return false
}
if(TextUtils.isEmpty(binding.etFfcs.text.toString().trim())){
showToast("防范措施必填")
return false
}
return true;
}
}

@ -237,7 +237,7 @@
</LinearLayout> </LinearLayout>
<include <include
android:id="@+id/item_head" android:id="@+id/item_head"
layout="@layout/item_work_risk_list_tip" layout="@layout/item_work_risk_list_tip_head"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
@ -249,13 +249,17 @@
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"> android:layout_weight="1">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<ListView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#00000000"
android:dividerHeight="0px"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -272,13 +276,15 @@
android:minHeight="25dp" android:minHeight="25dp"
android:text="危害后果及防范措施" android:text="危害后果及防范措施"
android:textSize="18sp" /> android:textSize="18sp" />
<ImageButton <ImageButton
android:id="@+id/iv_add"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_margin="3dp" android:layout_margin="3dp"
android:contentDescription="addicon" android:contentDescription="addicon"
android:gravity="center_vertical" android:gravity="center_vertical"
android:src="@drawable/add_gray"/> android:src="@drawable/add_gray" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.activity.WorkTickerHazardAddActivity">
<include
android:id="@+id/toolbarView"
layout="@layout/layout_base" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#dddddd"
android:padding="3dp"
android:gravity="center_vertical"
android:minHeight="30px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:gravity="center"
android:minHeight="25dp"
android:text="危害后果:"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:gravity="center">
<EditText
android:id="@+id/et_whhg"
style="@style/editTextTheme"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="top|start"
android:inputType="textMultiLine"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#dddddd"
android:padding="3dp"
android:gravity="center_vertical"
android:minHeight="30px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:gravity="center"
android:minHeight="25dp"
android:text="防范措施:"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_margin="10dp"
android:gravity="center">
<EditText
android:id="@+id/et_ffcs"
style="@style/editTextTheme"
android:layout_width="match_parent"
android:layout_height="110dp"
android:gravity="top|start"
android:inputType="textMultiLine"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:background="@color/colorPrimary"
android:orientation="vertical">
<TextView
android:id="@+id/tv_submit"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/white"
android:gravity="center"
android:textSize="18sp"
android:text="保存"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="62px"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="60px">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_xh"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:gravity="center"
android:text="序号" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_weiHai"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.0"
android:gravity="center"
android:text="危害后果" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_yuFang"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center|start"
android:layout_marginLeft="10px"
android:layout_marginEnd="10px"
android:layout_weight="2.4"
android:text="预防措施" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.8"
android:gravity="center"
android:textColor="@color/colorPrimaryDark"
android:text="删除" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#524658" />
</LinearLayout>

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="62px"
android:orientation="vertical">
<View
android:id="@+id/head"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#524658"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="60px">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_xh"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:gravity="center"
android:text="序号" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_paiHao"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.0"
android:gravity="center"
android:text="危害后果" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_qymc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginLeft="10px"
android:layout_marginEnd="10px"
android:layout_weight="2.4"
android:text="防范措施" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.8"
android:gravity="center"
android:text="操作" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#524658" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#524658" />
</LinearLayout>
Loading…
Cancel
Save