|
@@ -12,6 +12,7 @@ import androidx.compose.ui.platform.LocalLifecycleOwner
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
import androidx.compose.ui.unit.dp
|
|
import androidx.compose.ui.unit.dp
|
|
import androidx.compose.ui.unit.sp
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
+import androidx.core.graphics.scaleMatrix
|
|
import androidx.lifecycle.Lifecycle
|
|
import androidx.lifecycle.Lifecycle
|
|
import androidx.lifecycle.flowWithLifecycle
|
|
import androidx.lifecycle.flowWithLifecycle
|
|
import com.ys.bdtp.adm.app.theme.textBlackColor
|
|
import com.ys.bdtp.adm.app.theme.textBlackColor
|
|
@@ -21,24 +22,27 @@ import com.ys.bdtp.adm.mvvm.model.Data
|
|
import com.ys.bdtp.adm.mvvm.model.State
|
|
import com.ys.bdtp.adm.mvvm.model.State
|
|
import com.ys.bdtp.adm.mvvm.model.db.entity.task.CadEntity
|
|
import com.ys.bdtp.adm.mvvm.model.db.entity.task.CadEntity
|
|
import com.ys.bdtp.adm.mvvm.model.db.entity.task.FloorEntity
|
|
import com.ys.bdtp.adm.mvvm.model.db.entity.task.FloorEntity
|
|
|
|
+import com.ys.bdtp.adm.mvvm.model.db.relation.FloorWithCads
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.Blank
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.Blank
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.SelectState
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.SelectState
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.Table
|
|
import com.ys.bdtp.adm.mvvm.ui.compose.Table
|
|
import com.ys.bdtp.adm.mvvm.vm.cad.CadViewModel
|
|
import com.ys.bdtp.adm.mvvm.vm.cad.CadViewModel
|
|
|
|
+import kotlinx.coroutines.launch
|
|
import org.kodein.di.compose.rememberViewModel
|
|
import org.kodein.di.compose.rememberViewModel
|
|
|
|
|
|
-@Composable
|
|
|
|
|
|
+/*@Composable
|
|
fun CadContent(selectState: SelectState, floorEntity: FloorEntity?) {
|
|
fun CadContent(selectState: SelectState, floorEntity: FloorEntity?) {
|
|
val vm by rememberViewModel<CadViewModel>()
|
|
val vm by rememberViewModel<CadViewModel>()
|
|
- val floorState by remember { mutableStateOf(floorEntity) }
|
|
|
|
- // 根据floor 获取 cad 文件
|
|
|
|
- val lifecycleOwner = LocalLifecycleOwner.current
|
|
|
|
- val lifecycleWare = remember(lifecycleOwner) {
|
|
|
|
- vm.getFloorWithCads(floorEntity?.id ?: "")
|
|
|
|
- .flowWithLifecycle(lifecycleOwner.lifecycle, Lifecycle.State.STARTED)
|
|
|
|
|
|
+ val floor by rememberUpdatedState(floorEntity)
|
|
|
|
+ println("floor::::: $floor")
|
|
|
|
+
|
|
|
|
+ var floorState by remember { mutableStateOf<FloorWithCads?>(null) }
|
|
|
|
+ LaunchedEffect(Unit) {
|
|
|
|
+ if (floorEntity != null) {
|
|
|
|
+ floorState = vm.getFloorWithCads(floor?.id ?: "")
|
|
|
|
+ println("floorState: $floorState")
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
- val projectData = lifecycleWare.collectAsState(Data.loading())
|
|
|
|
|
|
|
|
Column(
|
|
Column(
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
@@ -46,93 +50,62 @@ fun CadContent(selectState: SelectState, floorEntity: FloorEntity?) {
|
|
.background(whiteColor)
|
|
.background(whiteColor)
|
|
.padding(horizontal = 50.dp, vertical = 50.dp)
|
|
.padding(horizontal = 50.dp, vertical = 50.dp)
|
|
) {
|
|
) {
|
|
- if (selectState == SelectState.Left) {
|
|
|
|
- Table(
|
|
|
|
- name = {
|
|
|
|
- Text(text = "土建图纸核查", color = textBlackColor, fontSize = 16.sp)
|
|
|
|
- },
|
|
|
|
- th = {
|
|
|
|
- CadDrawingTitle()
|
|
|
|
- },
|
|
|
|
- tr = {
|
|
|
|
- val data = projectData.value
|
|
|
|
- when (data.state) {
|
|
|
|
- is State.Loading -> {}
|
|
|
|
- is State.Success -> {
|
|
|
|
- LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
|
|
- data.data?.let {
|
|
|
|
- items(it.cads) { cad: CadEntity ->
|
|
|
|
- Box {
|
|
|
|
- CadDrawingItem(cad)
|
|
|
|
- Spacer(
|
|
|
|
- modifier = Modifier
|
|
|
|
- .align(Alignment.BottomCenter)
|
|
|
|
- .fillMaxWidth().height(1.dp)
|
|
|
|
- .background(trDivColor)
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ val title = if (selectState == SelectState.Left) "土建图纸核查" else "机电图纸核查"
|
|
|
|
+ Table(
|
|
|
|
+ name = {
|
|
|
|
+ Text(text = title, color = textBlackColor, fontSize = 16.sp)
|
|
|
|
+ },
|
|
|
|
+ th = {
|
|
|
|
+ CadDrawingTitle()
|
|
|
|
+ },
|
|
|
|
+ tr = {
|
|
|
|
+ LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
|
|
+ floorState?.cads?.let { cads ->
|
|
|
|
+ items(cads) { cad: CadEntity ->
|
|
|
|
+ Box {
|
|
|
|
+ CadDrawingItem(cad)
|
|
|
|
+ Spacer(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .align(Alignment.BottomCenter)
|
|
|
|
+ .fillMaxWidth().height(1.dp)
|
|
|
|
+ .background(trDivColor)
|
|
|
|
+ )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- is State.Failure -> {}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- )
|
|
|
|
- } else {
|
|
|
|
- Table(
|
|
|
|
- name = {
|
|
|
|
- Text(text = "机电图纸核查", color = textBlackColor, fontSize = 16.sp)
|
|
|
|
- },
|
|
|
|
- th = {
|
|
|
|
- CadDrawingTitle()
|
|
|
|
- },
|
|
|
|
- tr = {
|
|
|
|
- val data = projectData.value
|
|
|
|
- when (data.state) {
|
|
|
|
- is State.Loading -> {}
|
|
|
|
- is State.Success -> {
|
|
|
|
- LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
|
|
- data.data?.let {
|
|
|
|
- items(it.cads) { cad: CadEntity ->
|
|
|
|
- Box {
|
|
|
|
- CadDrawingItem(cad)
|
|
|
|
- Spacer(
|
|
|
|
- modifier = Modifier
|
|
|
|
- .align(Alignment.BottomCenter)
|
|
|
|
- .fillMaxWidth().height(1.dp)
|
|
|
|
- .background(trDivColor)
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ *//*val data = projectData.value
|
|
|
|
+ when (data.state) {
|
|
|
|
+ is State.Loading -> {}
|
|
|
|
+ is State.Success -> {
|
|
|
|
+ LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
|
|
+ data.data?.let {
|
|
|
|
+ items(it.cads) { cad: CadEntity ->
|
|
|
|
+ Box {
|
|
|
|
+ CadDrawingItem(cad)
|
|
|
|
+ Spacer(
|
|
|
|
+ modifier = Modifier
|
|
|
|
+ .align(Alignment.BottomCenter)
|
|
|
|
+ .fillMaxWidth().height(1.dp)
|
|
|
|
+ .background(trDivColor)
|
|
|
|
+ )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- is State.Failure -> {}
|
|
|
|
}
|
|
}
|
|
|
|
+ is State.Failure -> {}*//*
|
|
|
|
+ }
|
|
|
|
|
|
- /* LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
|
|
- items(20) {
|
|
|
|
- Box {
|
|
|
|
- CadDrawingItem()
|
|
|
|
- Spacer(
|
|
|
|
- modifier = Modifier
|
|
|
|
- .align(Alignment.BottomCenter)
|
|
|
|
- .fillMaxWidth().height(1.dp)
|
|
|
|
- .background(trDivColor)
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ )
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}*/
|
|
|
|
+/*
|
|
|
|
|
|
@Preview(widthDp = 910, heightDp = 711)
|
|
@Preview(widthDp = 910, heightDp = 711)
|
|
@Composable
|
|
@Composable
|
|
fun PreviewCadContent() {
|
|
fun PreviewCadContent() {
|
|
// CadContent(SelectState.Left)
|
|
// CadContent(SelectState.Left)
|
|
-}
|
|
|
|
|
|
+}
|
|
|
|
+ */
|