riku
2025-09-19 58c0f11fe2f23a1be2dec768f9ac02107301a634
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
  <el-page-header @back="onBack" class="page-header">
    <template #content>
      <span> 场景信息编辑 </span>
    </template>
  </el-page-header>
  <el-divider />
  <div class="sub-title">账户信息</div>
  <el-row>
    <FormCol>
      <CompUserInfo :form-info="formUser" />
    </FormCol>
  </el-row>
  <el-divider />
  <div class="sub-title">基本信息</div>
  <el-row>
    <FormCol>
      <CompSceneBaseInfo :model="formScene" />
    </FormCol>
  </el-row>
  <template v-if="formScene.typeid == 1">
    <el-divider />
    <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>
  </template>
</template>
 
<script>
import sceneApi from '@/api/fysp/sceneApi';
import userApi from '@/api/fysp/userApi';
// import FormCol from '../../../../components/layout/FormCol.vue';
import CompSceneBaseInfo from './CompSceneBaseInfo.vue';
import CompSceneConstructionInfo from './CompSceneConstructionInfo.vue';
import CompSceneDeviceInfo from './CompSceneDeviceInfo.vue';
import CompUserInfo from '../user/CompUserInfo.vue';
 
export default {
  components: {
    // FormCol,
    CompSceneBaseInfo,
    CompSceneConstructionInfo,
    CompSceneDeviceInfo,
    CompUserInfo,
  },
  data() {
    return {
      formUser: {},
      formScene: {},
      formSubScene: {},
      formSceneDevice: {},
    };
  },
  beforeRouteEnter(to, from, next) {
    sceneApi.getSceneDetail(to.params.sid).then((res) => {
      userApi.getUserByScene(to.params.sid).then((user) => {
        next((vm) => {
          //场景
          if (res.data.scense) vm.formScene = res.data.scense;
          if (res.data.subScene) {
            vm.formSubScene = res.data.subScene;
          } else {
            vm.formSubScene = {
              sGuid: vm.formScene.guid,
            };
          }
          if (res.data.sceneDevice) {
            vm.formSceneDevice = res.data.sceneDevice;
          } else {
            vm.formSceneDevice = {
              sGuid: vm.formScene.guid,
            };
          }
          //账户
          if (user) {
            vm.formUser = user;
          } else {
            vm.formUser = {
              dguid: to.params.sid,
            };
          }
        });
      });
    });
  },
  methods: {
    // 回退页面
    onBack() {
      this.$router.back();
    },
  },
};
</script>
<style scoped>
.sub-title {
  font-size: var(--el-font-size-large);
  margin-bottom: 30px;
  margin-left: 20px;
}
.page-header {
  /* position: absolute; */
}
</style>