|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.rehome.zhdcoa.ui.activity
|
|
|
|
|
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
import android.os.Build
|
|
|
|
|
import android.text.TextUtils
|
|
|
|
|
import android.util.Log
|
|
|
|
|
import android.view.View
|
|
|
|
|
@ -97,28 +98,23 @@ class AddDagerEnterApplyActivity :
|
|
|
|
|
private fun setAdapter() {
|
|
|
|
|
adapter = WhpListAdapter(context, whpList, object : WhpListAdapter.CallBack {
|
|
|
|
|
override fun deleteClick(position: Int) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
binding.lv.adapter = adapter
|
|
|
|
|
binding.lv.onItemClickListener = AdapterView.OnItemClickListener { parent: AdapterView<*>?, view: View?, position: Int, id: Long ->
|
|
|
|
|
val item = whpList[position]
|
|
|
|
|
// if( item.istj==0){
|
|
|
|
|
// //已保存,未提交,进入新增/编辑页面
|
|
|
|
|
// //编辑危化品入厂申请
|
|
|
|
|
// val intent = Intent(context, AddDagerEnterApplyActivity::class.java)
|
|
|
|
|
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
|
// intent.putExtra("isEdit",true)
|
|
|
|
|
// intent.putExtra("id",item.id)
|
|
|
|
|
// startActivity(intent)
|
|
|
|
|
// }else{
|
|
|
|
|
// //已提交,进入审核页面
|
|
|
|
|
// val intent = Intent(context, DagerEnterApplyDetailActivity::class.java)
|
|
|
|
|
// intent.putExtra("id", item.id)
|
|
|
|
|
// intent.putExtra("DepartmentNameId", item.dcfzbz)
|
|
|
|
|
// startActivity(intent)
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
binding.lv.adapter = adapter
|
|
|
|
|
binding.lv.onItemClickListener =
|
|
|
|
|
AdapterView.OnItemClickListener { parent: AdapterView<*>?, view: View?, position: Int, id: Long ->
|
|
|
|
|
val item = whpList[position]
|
|
|
|
|
//编辑危化品入厂申请
|
|
|
|
|
val intent = Intent(context, AddDagerEnterApplyListActivity::class.java)
|
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
|
intent.putExtra("item", item)
|
|
|
|
|
launcherResultAddList.launch(intent)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -138,17 +134,46 @@ class AddDagerEnterApplyActivity :
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//创建一个ActivityResultLauncher
|
|
|
|
|
//创建一个ActivityResultLauncher,添加一条危化品清单数据
|
|
|
|
|
private fun createActivityResultLauncherAddList(): ActivityResultLauncher<Intent> {
|
|
|
|
|
//kotlin写法
|
|
|
|
|
return registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
|
|
|
|
val data = it.data
|
|
|
|
|
val resultCode = it.resultCode
|
|
|
|
|
if (resultCode == RESULT_OK) {
|
|
|
|
|
val callbackItem = data != null
|
|
|
|
|
showLog("---------------------")
|
|
|
|
|
showLog("$callbackItem")
|
|
|
|
|
if (data != null) {
|
|
|
|
|
departmentId = data.getStringExtra("departmentId")
|
|
|
|
|
departmentName = data.getStringExtra("departmentName")
|
|
|
|
|
binding.ilDinnerUnit.content = departmentName
|
|
|
|
|
val item: WhpListItemBean? =
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
|
|
|
data.getParcelableExtra("item", WhpListItemBean::class.java)
|
|
|
|
|
} else {
|
|
|
|
|
data.getParcelableExtra("item")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val callbackItem1 =item != null
|
|
|
|
|
showLog("$callbackItem1")
|
|
|
|
|
if (item != null) {
|
|
|
|
|
if (item.id == null) {
|
|
|
|
|
whpList.add(item)
|
|
|
|
|
} else {
|
|
|
|
|
for (i in whpList.indices){
|
|
|
|
|
val itemBean = whpList[i]
|
|
|
|
|
if(itemBean.id.equals(item.id)){
|
|
|
|
|
itemBean.hspmc = item.hspmc
|
|
|
|
|
itemBean.wslb = item.wslb
|
|
|
|
|
itemBean.sybm = item.sybm
|
|
|
|
|
itemBean.zrr = item.zrr
|
|
|
|
|
itemBean.srcl = item.srcl
|
|
|
|
|
itemBean.ccdd = item.ccdd
|
|
|
|
|
itemBean.rt = item.rt
|
|
|
|
|
itemBean.msds = item.msds
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
adapter.notifyDataSetChanged()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|