<template>
|
<el-dialog
|
:model-value="modelValue"
|
@update:model-value="handleDialogChange"
|
top="2vh"
|
class="dialog-wrapper"
|
v-loading="loading"
|
>
|
<el-scrollbar ref="scrollbarRef" height="86vh" v-loading="loading" :always="true">
|
<template v-if="formScene && formScene.typeid == 1">
|
<div class="sub-title">工地信息</div>
|
<el-row>
|
<FormCol>
|
<CompSceneConstructionInfo showStyle="form" :form-info="formSubScene" />
|
</FormCol>
|
</el-row>
|
<!-- <el-divider /> -->
|
<!-- <div class="sub-title">设备信息</div>
|
<el-row>
|
<FormCol>
|
<CompSceneDeviceInfo
|
:form-info="formSceneDevice"
|
:scene-type="formScene.typeid"
|
/>
|
</FormCol>
|
</el-row> -->
|
<el-divider />
|
</template>
|
<div class="sub-title">基本信息</div>
|
<el-row>
|
<FormCol>
|
<CompSceneBaseInfo :model="formScene" />
|
</FormCol>
|
</el-row>
|
<el-divider />
|
<div class="sub-title">账户信息</div>
|
<el-row>
|
<FormCol>
|
<CompUserInfo :form-info="formUser" />
|
</FormCol>
|
</el-row>
|
</el-scrollbar>
|
</el-dialog>
|
</template>
|
<script setup>
|
import { ref, watch } from 'vue'
|
|
import sceneApi from '@/api/fysp/sceneApi'
|
import userApi from '@/api/fysp/userApi'
|
import CompSceneBaseInfo from './CompSceneBaseInfo.vue'
|
import CompSceneConstructionInfo from './CompSceneConstructionInfo.vue'
|
import CompSceneDeviceInfo from './CompSceneDeviceInfo.vue'
|
import CompUserInfo from '../user/CompUserInfo.vue'
|
|
const props = defineProps({
|
modelValue: Boolean,
|
sceneId: String,
|
})
|
|
const emits = defineEmits(['update:modelValue'])
|
|
const formUser = ref({})
|
const formScene = ref()
|
const formSubScene = ref({})
|
const formSceneDevice = ref({})
|
const loading = ref(false)
|
const scrollbarRef = ref()
|
|
watch(
|
() => [props.modelValue, props.sceneId],
|
(nV, oV) => {
|
if (nV[0] && nV[1]) {
|
fetchSceneInfo()
|
}
|
},
|
)
|
|
function handleDialogChange(value) {
|
formUser.value = {}
|
formScene.value = undefined
|
formSubScene.value = {}
|
formSceneDevice.value = {}
|
|
emits('update:modelValue', value)
|
}
|
|
function fetchSceneInfo() {
|
const sid = props.sceneId
|
loading.value = true
|
sceneApi
|
.getSceneDetail(sid)
|
.then((res) => {
|
userApi
|
.getUserByScene(sid)
|
.then((user) => {
|
//场景
|
if (res.data.scense) formScene.value = res.data.scense
|
if (res.data.subScene) {
|
formSubScene.value = res.data.subScene
|
} else {
|
formSubScene.value = {
|
sGuid: formScene.value.guid,
|
}
|
}
|
if (res.data.sceneDevice) {
|
formSceneDevice.value = res.data.sceneDevice
|
} else {
|
formSceneDevice.value = {
|
sGuid: formScene.value.guid,
|
}
|
}
|
//账户
|
if (user) {
|
formUser.value = user
|
} else {
|
formUser.value = {
|
dguid: sid,
|
}
|
}
|
})
|
.finally(() => {
|
loading.value = false
|
scrollbarRef.value.setScrollTop(0)
|
})
|
})
|
.catch(() => (loading.value = false))
|
}
|
</script>
|
<style scoped>
|
.sub-title {
|
font-size: var(--el-font-size-large);
|
margin-bottom: 30px;
|
margin-left: 20px;
|
}
|
</style>
|