|
@@ -4,12 +4,17 @@ import androidx.compose.foundation.background
|
|
|
import androidx.compose.foundation.layout.*
|
|
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
|
import androidx.compose.foundation.lazy.items
|
|
|
+import androidx.compose.material.Tab
|
|
|
+import androidx.compose.material.TabRow
|
|
|
+import androidx.compose.material.TabRowDefaults
|
|
|
+import androidx.compose.material.TabRowDefaults.tabIndicatorOffset
|
|
|
import androidx.compose.material.Text
|
|
|
-import androidx.compose.runtime.Composable
|
|
|
+import androidx.compose.runtime.*
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
+import com.ys.bdtp.adm.app.theme.*
|
|
|
import com.ys.bdtp.adm.app.theme.textBlackColor
|
|
|
import com.ys.bdtp.adm.app.theme.trDivColor
|
|
|
import com.ys.bdtp.adm.app.theme.whiteColor
|
|
@@ -18,44 +23,110 @@ import com.ys.bdtp.adm.mvvm.model.db.relation.FloorWithCads
|
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.SelectState
|
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.Table
|
|
|
|
|
|
+/**
|
|
|
+ * AC 空调
|
|
|
+ * FF 消防
|
|
|
+ * WS 给排水
|
|
|
+ */
|
|
|
@Composable
|
|
|
fun CadContent(selectState: SelectState, floor: FloorWithCads?, itemClick: (CadEntity) -> Unit) {
|
|
|
+ var state by remember { mutableStateOf(0) }
|
|
|
+ val title = if (selectState == SelectState.Left) "土建图纸核查" else "机电图纸核查"
|
|
|
+ val titles = listOf("空调", "消防", "给排水")
|
|
|
+ var code by remember { mutableStateOf("AC") }
|
|
|
+
|
|
|
Column(
|
|
|
modifier = Modifier
|
|
|
.fillMaxSize()
|
|
|
.background(whiteColor)
|
|
|
- .padding(horizontal = 50.dp, vertical = 50.dp)
|
|
|
+ .padding(horizontal = 0.dp, vertical = 0.dp)
|
|
|
) {
|
|
|
- val title = if (selectState == SelectState.Left) "土建图纸核查" else "机电图纸核查"
|
|
|
- Table(
|
|
|
- name = {
|
|
|
- Text(text = title, color = textBlackColor, fontSize = 16.sp)
|
|
|
- },
|
|
|
- th = {
|
|
|
- CadDrawingTitle()
|
|
|
- },
|
|
|
- tr = {
|
|
|
- LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
|
- floor?.let {
|
|
|
- items(it.cads) { cad: CadEntity ->
|
|
|
- Box {
|
|
|
- CadDrawingItem(cad) {
|
|
|
- itemClick(cad)
|
|
|
+ if (selectState == SelectState.Right) {
|
|
|
+ TabRow(
|
|
|
+ selectedTabIndex = state,
|
|
|
+ backgroundColor = whiteColor,
|
|
|
+ divider = {
|
|
|
+ TabRowDefaults.Divider(color = divColor)
|
|
|
+ },
|
|
|
+ indicator = { tabPositions ->
|
|
|
+ TabRowDefaults.Indicator(
|
|
|
+ Modifier.tabIndicatorOffset(tabPositions[state]),
|
|
|
+ color = textBlueColor
|
|
|
+ )
|
|
|
+ }
|
|
|
+ ) {
|
|
|
+ titles.forEachIndexed { index, title ->
|
|
|
+ Tab(
|
|
|
+ modifier = Modifier.width(56.dp),
|
|
|
+ text = { Text(title) },
|
|
|
+ selected = state == index,
|
|
|
+ onClick = {
|
|
|
+ state = index
|
|
|
+ when (index) {
|
|
|
+ 0 -> {
|
|
|
+ code = "AC"
|
|
|
+ }
|
|
|
+ 1 -> {
|
|
|
+ code = "FF"
|
|
|
+ }
|
|
|
+ 2 -> {
|
|
|
+ code = "WS"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selectedContentColor = textBlueColor,
|
|
|
+ unselectedContentColor = textBlackColor
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Spacer(modifier = Modifier.height(40.dp))
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize()
|
|
|
+ .padding(horizontal = 50.dp)
|
|
|
+ ) {
|
|
|
+ Table(
|
|
|
+ name = {
|
|
|
+ Text(text = title, color = textBlackColor, fontSize = 16.sp)
|
|
|
+ },
|
|
|
+ th = {
|
|
|
+ CadDrawingTitle()
|
|
|
+ },
|
|
|
+ tr = {
|
|
|
+ LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
|
+ floor?.let {
|
|
|
+ val cads = when (selectState) {
|
|
|
+ is SelectState.Left -> {
|
|
|
+ it.cads.filter { cad -> cad.majorCode == "CF" }
|
|
|
+ }
|
|
|
+ is SelectState.Right -> {
|
|
|
+ it.cads.filter { cad -> cad.majorCode == code }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ items(cads) { cad: CadEntity ->
|
|
|
+ Box {
|
|
|
+ CadDrawingItem(cad) {
|
|
|
+ itemClick(cad)
|
|
|
+ }
|
|
|
+ Spacer(
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.BottomCenter)
|
|
|
+ .fillMaxWidth().height(1.dp)
|
|
|
+ .background(trDivColor)
|
|
|
+ )
|
|
|
}
|
|
|
- Spacer(
|
|
|
- modifier = Modifier
|
|
|
- .align(Alignment.BottomCenter)
|
|
|
- .fillMaxWidth().height(1.dp)
|
|
|
- .background(trDivColor)
|
|
|
- )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- )
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/*
|
|
|
|
|
|
@Preview(widthDp = 910, heightDp = 711)
|