|
|
|
|
@ -109,23 +109,23 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
|
|
|
|
|
binding.lv.emptyView = binding.tvNodata
|
|
|
|
|
//headView = View.inflate(this, R.layout.header_work_ticket_select_list, null)
|
|
|
|
|
//cb = headView.findViewById<View>(R.id.cb) as CheckBox
|
|
|
|
|
binding.itemHead.cb.setOnClickListener {
|
|
|
|
|
if (binding.itemHead.cb.isChecked) {
|
|
|
|
|
for (i in datas.indices) {
|
|
|
|
|
datas[i].isChecked = true
|
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
|
}
|
|
|
|
|
deleteIdList.clear()
|
|
|
|
|
} else {
|
|
|
|
|
for (i in datas.indices) {
|
|
|
|
|
datas[i].isChecked = false
|
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
|
}
|
|
|
|
|
if(selectList.size>0){
|
|
|
|
|
deleteIdList.addAll(selectList)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// binding.itemHead.cb.setOnClickListener {
|
|
|
|
|
// if (binding.itemHead.cb.isChecked) {
|
|
|
|
|
// for (i in datas.indices) {
|
|
|
|
|
// datas[i].isChecked = true
|
|
|
|
|
// mAdapter.notifyDataSetChanged()
|
|
|
|
|
// }
|
|
|
|
|
// deleteIdList.clear()
|
|
|
|
|
// } else {
|
|
|
|
|
// for (i in datas.indices) {
|
|
|
|
|
// datas[i].isChecked = false
|
|
|
|
|
// mAdapter.notifyDataSetChanged()
|
|
|
|
|
// }
|
|
|
|
|
// if(selectList.size>0){
|
|
|
|
|
// deleteIdList.addAll(selectList)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
mAdapter = WorkTickerCustomListAdapter(this,datas,{ view, position ->
|
|
|
|
|
val checkBox = view as CheckBox
|
|
|
|
|
@ -147,17 +147,22 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
binding.itemHead.cb.isChecked = count == datas.size
|
|
|
|
|
//binding.itemHead.cb.isChecked = count == datas.size
|
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
|
},{ position ->
|
|
|
|
|
val item:WorkRiskLevelListBean.RowsBean = datas[position]
|
|
|
|
|
//showToast("修改")
|
|
|
|
|
val intent = Intent(context, WorkTickerCustomAddActivity::class.java)
|
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
|
|
|
|
intent.putExtra("isEdit", true)
|
|
|
|
|
intent.putExtra("item", GsonUtils.GsonString(item))
|
|
|
|
|
startActivity(intent)
|
|
|
|
|
},{ position ->
|
|
|
|
|
val item:WorkRiskLevelListBean.RowsBean = datas[position]
|
|
|
|
|
//showToast("删除")
|
|
|
|
|
val dialog = CommitDialog(context, object : CommitDialogListener {
|
|
|
|
|
override fun confirm() {
|
|
|
|
|
//authenticationLoginAISubmit()
|
|
|
|
|
authenticationLoginAIDelete(item.id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun cancel() {
|
|
|
|
|
@ -332,6 +337,29 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun authenticationLoginAIDelete(id:Int) {
|
|
|
|
|
try {
|
|
|
|
|
//AI三维登录接口
|
|
|
|
|
val userName = Contans.SP.AI_ACCOUNT
|
|
|
|
|
//String strPrivateEncode=RSAAndroid.encryptByPrivateKeyForSpiltStr(Contans.SP.AI_PWD,RSAAndroid.privateRsaKeyLocal);
|
|
|
|
|
val strPublicDecode = RSAAndroid.decryptByPublicKeyForSpiltStr(
|
|
|
|
|
Contans.SP.AI_PWD_ENCODE,
|
|
|
|
|
RSAAndroid.publicRsaKeyLocal
|
|
|
|
|
)
|
|
|
|
|
AuthenticationLoginAIUtils.authenticationAILoginShowProgress(
|
|
|
|
|
this, userName, strPublicDecode
|
|
|
|
|
) { _, token ->
|
|
|
|
|
if (token != null && token == "") {
|
|
|
|
|
showToast("AI三维平台登录失败")
|
|
|
|
|
} else {
|
|
|
|
|
deleteWorkTicketData(id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
e.printStackTrace()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun getSubmitJsonData(): String {
|
|
|
|
|
val param = HashMap<String, Any>()
|
|
|
|
|
param["assignmentDate"] = binding.tvSt.text.toString().trim()
|
|
|
|
|
@ -345,6 +373,15 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
|
|
|
|
|
return json
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun getDeleteJsonData(id:Int): String {
|
|
|
|
|
val param = HashMap<String, Any>()
|
|
|
|
|
param["id"] = id
|
|
|
|
|
val json = GsonUtils.GsonString(param)
|
|
|
|
|
showLog(json)
|
|
|
|
|
return json
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun submitWorkTicketData() {
|
|
|
|
|
val url = Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_RISK_LIST_SUBMIT_WORK_TICKET_LIST
|
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
|
@ -393,17 +430,62 @@ class WorkTickerCustomListActivity : BaseActivityOaToolbarViewBinding<ActivityWo
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun deleteWorkTicketData(id:Int) {
|
|
|
|
|
val url = Contans.BASE_URL_AI_3D_SERVER + Contans.DAYLY_DELETE_CUSTOM_WORK_TICKET
|
|
|
|
|
val request = NoHttp.createStringRequest(
|
|
|
|
|
url,
|
|
|
|
|
RequestMethod.POST
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
val json: String = getDeleteJsonData(id)
|
|
|
|
|
request.setDefineRequestBodyForJson(json)
|
|
|
|
|
|
|
|
|
|
if (Contans.BASE_URL_AI_3D_SERVER == Contans.BASE_URL_AI_3D_SERVER_EXTRANET) {
|
|
|
|
|
val socketFactory = NohttpUtils.getSSLSocketFactory(context)
|
|
|
|
|
if (socketFactory != null) {
|
|
|
|
|
request.sslSocketFactory = socketFactory
|
|
|
|
|
request.hostnameVerifier = HostnameVerifier { _, _ -> true }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//class WorkTickerCustomListActivity : AppCompatActivity() {
|
|
|
|
|
// override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
|
// super.onCreate(savedInstanceState)
|
|
|
|
|
// enableEdgeToEdge()
|
|
|
|
|
// setContentView(R.layout.activity_work_ticker_custom_list)
|
|
|
|
|
// ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
|
|
|
|
// val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
|
|
|
|
// v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
|
|
|
|
// insets
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
NohttpUtils.getInstance().add(this, 0, request, object : HttpListener<String?> {
|
|
|
|
|
|
|
|
|
|
override fun onSucceed(what: Int, response: Response<String?>?) {
|
|
|
|
|
val result = response?.get()
|
|
|
|
|
showLog("--------删除手动添加的作业风险信息成功--------")
|
|
|
|
|
showLog(url)
|
|
|
|
|
showLog(result)
|
|
|
|
|
val bean = GsonUtils.GsonToBean(
|
|
|
|
|
result,
|
|
|
|
|
AIBaseBean::class.java
|
|
|
|
|
)
|
|
|
|
|
if (bean != null && bean.isSuccess) {
|
|
|
|
|
if(datas.size>0){
|
|
|
|
|
for(item in datas){
|
|
|
|
|
if(item.id==id){
|
|
|
|
|
datas.remove(item)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mAdapter.notifyDataSetChanged()
|
|
|
|
|
//提交成功
|
|
|
|
|
val confirmDialog = ConfirmDialog(
|
|
|
|
|
context, "删除手动添加的作业风险信息成功"
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
confirmDialog.setTvTitle("提示")
|
|
|
|
|
confirmDialog.setCancelable(true)
|
|
|
|
|
confirmDialog.show()
|
|
|
|
|
}else{
|
|
|
|
|
showToast("删除手动添加的作业风险信息失败")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onFailed(what: Int, response: Response<String?>?) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|