feat: 国际进港-电报详情
This commit is contained in:
@@ -358,6 +358,13 @@
|
||||
android:exported="false"
|
||||
android:screenOrientation="userLandscape" />
|
||||
|
||||
<!-- 国际进港-电报详情 -->
|
||||
<activity
|
||||
android:name="com.lukouguoji.gjj.activity.IntArrTelegramDetailsActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:exported="false"
|
||||
android:screenOrientation="userLandscape" />
|
||||
|
||||
<service android:name="com.huitao.printer.service.PrinterService" />
|
||||
<service android:name="com.lukouguoji.gnc.bluetooth.service.AncillaryService" />
|
||||
<service android:name="com.lukouguoji.gnc.bluetooth.service.MyService" />
|
||||
|
||||
@@ -338,6 +338,9 @@ interface Constant {
|
||||
// ID
|
||||
const val ID = "id"
|
||||
|
||||
// 流向
|
||||
const val FLOW = "flow"
|
||||
|
||||
// 页面类型
|
||||
const val PAGE_TYPE = "pageType"
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ object ARouterConstants {
|
||||
const val ACTIVITY_URL_GJJ_Tally = "/gjj/GjjTallyListActivity" //国际进港 理货
|
||||
const val ACTIVITY_URL_GJJ_GOODS = "/gjj/GjjGoodsListActivity" //国际进港 货物交接
|
||||
const val ACTIVITY_URL_INT_IMP_MSG_PARSE = "/gjj/IntImpMsgParseActivity" //国际进港 电报解析(电报生成)
|
||||
const val ACTIVITY_URL_INT_ARR_TELEGRAM_DETAILS = "/gjj/IntArrTelegramDetailsActivity" //国际进港 电报详情
|
||||
|
||||
///////////////// 航班查询模块
|
||||
/**
|
||||
|
||||
8
module_base/src/main/res/drawable/bg_blue_radius_8.xml
Normal file
8
module_base/src/main/res/drawable/bg_blue_radius_8.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#1C8CF5" />
|
||||
<corners android:radius="8dp" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.lukouguoji.gjj.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.databinding.ActivityIntArrTelegramDetailsBinding
|
||||
import com.lukouguoji.gjj.viewModel.IntArrTelegramDetailsViewModel
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
/**
|
||||
* 国际进港电报详情
|
||||
*/
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_INT_ARR_TELEGRAM_DETAILS)
|
||||
class IntArrTelegramDetailsActivity : BaseBindingActivity<ActivityIntArrTelegramDetailsBinding, IntArrTelegramDetailsViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_int_arr_telegram_details
|
||||
override fun viewModelClass() = IntArrTelegramDetailsViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
setBackArrow("国际进港电报详情")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
// 初始化数据
|
||||
viewModel.initOnCreated(intent)
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 启动电报详情页面
|
||||
* @param context 上下文
|
||||
* @param id 电报ID
|
||||
* @param flow 流向(接收0、发送1)
|
||||
*/
|
||||
@JvmStatic
|
||||
fun start(context: Context, id: String, flow: String) {
|
||||
val starter = Intent(context, IntArrTelegramDetailsActivity::class.java)
|
||||
.putExtra(Constant.Key.ID, id)
|
||||
.putExtra(Constant.Key.FLOW, flow)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.lukouguoji.gjj.viewModel
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.lukouguoji.module_base.base.BaseViewModel
|
||||
import com.lukouguoji.module_base.bean.TelegramBean
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.http.net.NetApply
|
||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||
import com.lukouguoji.module_base.ktx.showToast
|
||||
|
||||
/**
|
||||
* 国际进港电报详情 ViewModel
|
||||
*/
|
||||
class IntArrTelegramDetailsViewModel : BaseViewModel() {
|
||||
|
||||
var id = ""
|
||||
var flow = ""
|
||||
|
||||
// 电报内容
|
||||
val telegramContent = MutableLiveData<String>("")
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
fun initOnCreated(intent: Intent) {
|
||||
id = intent.getStringExtra(Constant.Key.ID) ?: ""
|
||||
flow = intent.getStringExtra(Constant.Key.FLOW) ?: ""
|
||||
if (id.isNotEmpty() && flow.isNotEmpty()) {
|
||||
getData()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电报详情
|
||||
*/
|
||||
private fun getData() {
|
||||
launchLoadingCollect({ NetApply.api.getTelegramDetails(flow, id) }) {
|
||||
onSuccess = { result ->
|
||||
val data = result.data
|
||||
if (data is TelegramBean) {
|
||||
telegramContent.value = data.teleContent
|
||||
} else if (data is Map<*, *>) {
|
||||
telegramContent.value = data["teleContent"]?.toString() ?: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报文按钮点击
|
||||
*/
|
||||
fun onModifyClick() {
|
||||
showToast("修改报文功能待实现")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.lukouguoji.gjj.viewModel.IntArrTelegramDetailsViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_f2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 标题栏 -->
|
||||
<include layout="@layout/title_tool_bar" />
|
||||
|
||||
<!-- 电报内容区域 -->
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="20dp"
|
||||
android:background="@color/white"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewModel.telegramContent}"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:lineSpacingExtra="4dp" />
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/bg_blue_radius_8"
|
||||
android:gravity="center"
|
||||
android:onClick="@{()-> viewModel.onModifyClick()}"
|
||||
android:text="修改报文"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
Reference in New Issue
Block a user