index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div class="box">
  3. <div class="condition">
  4. <div class="header">
  5. <el-button style="float:left;" size="small" type="default" icon="el-icon-back" @click="goBack"></el-button>
  6. <span>{{exampleData.RoomLocalName||exampleData.RoomName||''}}</span>
  7. </div>
  8. <el-row class="spaceTypes">
  9. <div class="types">
  10. <el-tabs v-model="activeTab" type='card'>
  11. <template v-for="(item,index) in tabsList">
  12. <el-tab-pane :name="item.Code" :key="index" :label="item.Name"></el-tab-pane>
  13. </template>
  14. </el-tabs>
  15. </div>
  16. <div class="deleBtn">
  17. <el-button size="small" @click="deleteSpace">删除业务空间</el-button>
  18. </div>
  19. </el-row>
  20. <div v-if="activeTab=='detail'" class="content">
  21. <iframe v-if="params.isMyTab == 1" height="100%" width="100%" :src="iframeSrc"></iframe>
  22. <div v-else class="content-left">
  23. <div class="content-showType"></div>
  24. <div class="content-point">
  25. <div class="content-point-left">
  26. <el-scrollbar style="height:100%;">
  27. <div style="height:1000px"></div>
  28. </el-scrollbar>
  29. </div>
  30. <div class="content-point-right">
  31. <el-scrollbar style="height:100%;">
  32. <div style="height:1000px"></div>
  33. </el-scrollbar>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="content-right">
  38. <div class="content-repair"></div>
  39. <div class="content-media">
  40. <el-scrollbar style="height:100%;">
  41. <div style="height:1000px"></div>
  42. </el-scrollbar>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- 空间内设备列表--服务于空间的设备 -->
  47. <eqToSpaceTable v-else-if="activeTab=='Equipment' || activeTab=='EquipmentFor'" :params="params" :type="activeTab"></eqToSpaceTable>
  48. <!-- 空间内系统 -->
  49. <syInSpaceTable v-else-if="activeTab=='generalSystem'" :params="params" :type="activeTab"></syInSpaceTable>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import { mapGetters } from "vuex";
  55. import tools from "@/utils/scan/tools";
  56. import { getDataDictionary, queryZone, deleteZone } from '@/api/scan/request';
  57. import eqToSpaceTable from '@/components/business_space/newTables/eqToSpaceTable';
  58. import syInSpaceTable from '@/components/business_space/newTables/syInSpaceTable';
  59. export default {
  60. data() {
  61. return {
  62. params: {}, //参数-包含空间id 分区类型 进入方式(1-平面图 2-列表)
  63. tabsList: [
  64. { Code: 'detail', Name: '空间详情' },
  65. { Code: 'Equipment', Name: '空间内设备' },
  66. { Code: 'EquipmentFor', Name: '服务于空间的设备' },
  67. { Code: 'generalSystem', Name: '空间内系统' },
  68. ], //tab页
  69. activeTab: 'detail', //当前选中的tab
  70. pointData: [], //信息点数据
  71. exampleData: {}, //实例数据
  72. criterias: [], //动态参数
  73. iframeSrc: '', //空间详情iframe
  74. }
  75. },
  76. computed: {
  77. ...mapGetters("layout", ["projectId", "userId", "secret"])
  78. },
  79. components: {
  80. eqToSpaceTable,
  81. syInSpaceTable
  82. },
  83. created() {
  84. this.params = this.$route.query;
  85. this.getData();
  86. this.setFrame();
  87. },
  88. mounted() { },
  89. watch: {
  90. projectId() { }
  91. },
  92. methods: {
  93. // 返回
  94. goBack() {
  95. this.$router.push({
  96. name: "spacelist",
  97. params: this.params
  98. })
  99. },
  100. // 查询空间详情
  101. getData() {
  102. let params1 = {
  103. data: {
  104. Orders: "sort asc",
  105. PageNumber: 1,
  106. PageSize: 1000
  107. },
  108. type: this.params.zone
  109. }, params2 = {
  110. data: {
  111. Filters: `RoomID='${this.params.RoomID}'`
  112. },
  113. zone: this.params.zone
  114. };
  115. let promise1 = new Promise((resolve, reject) => {
  116. getDataDictionary(params1, res => {
  117. resolve(res)
  118. })
  119. })
  120. let promise2 = new Promise((resolve, reject) => {
  121. queryZone(params2, res => {
  122. resolve(res)
  123. })
  124. })
  125. Promise.all([promise1, promise2]).then(values => {
  126. this.pointData = values[0].Content;
  127. this.exampleData = values[1].Content[0];
  128. this.pointData.forEach(item => {
  129. if (item.InputMode == "L" || item.InputMode == "L1" || item.InputMode == "L2" || item.InputMode == "M") {
  130. let cur = tools.dataForKey(this.exampleData, item.Path);
  131. if (cur) {
  132. this.criterias.push({
  133. id: exampleData.EquipID,
  134. code: item.InfoPointCode
  135. })
  136. }
  137. }
  138. })
  139. })
  140. },
  141. // 设置iframe
  142. setFrame() {
  143. this.iframeSrc = `${process.env.BASE_URL}:8889/#/changeMess?perjectId=${this.projectId}&secret=${this.secret}&id=${this.params.RoomID}&type=${this.params.zone}`;
  144. // this.iframeSrc = this.params.isMyTab == 2 ?
  145. // `${process.env.BASE_URL}:8889/#/details?perjectId=${this.projectId}&secret=${this.secret}&FmId=${this.params.RoomID}&type=0&code=${this.params.zone}`
  146. // : `${process.env.BASE_URL}:8889/#/changeMess?perjectId=${this.projectId}&secret=${this.secret}&id=${this.params.RoomID}&type=${this.params.zone}`;
  147. },
  148. // 删除业务空间
  149. deleteSpace() {
  150. this.$confirm("此操作将删除业务空间,是否继续?", "提示", {
  151. confirmButtonText: '确定',
  152. cancelButtonText: '取消',
  153. type: 'warning'
  154. }).then(() => {
  155. let pa = {
  156. data: [{
  157. RoomID: this.exampleData.RoomID
  158. }],
  159. zone: this.params.zone
  160. }
  161. deleteZone(pa, res => {
  162. this.$message.success('删除成功')
  163. this.goBack()
  164. })
  165. }).catch(() => {
  166. this.getData()
  167. this.$message("取消删除")
  168. })
  169. }
  170. }
  171. };
  172. </script>
  173. <style scoped lang='less'>
  174. .box {
  175. .condition {
  176. padding: 10px;
  177. display: flex;
  178. height: 100%;
  179. flex-direction: column;
  180. border: 1px solid #dfe6ec;
  181. box-sizing: border-box;
  182. background: #fff;
  183. .header {
  184. padding-bottom: 10px;
  185. span {
  186. line-height: 33px;
  187. margin-left: 15px;
  188. }
  189. }
  190. .spaceTypes {
  191. .types {
  192. float: left;
  193. width: calc(100% - 200px);
  194. /deep/ .el-tabs__item.is-top {
  195. border-top: 2px solid transparent;
  196. &.is-active {
  197. border-top: 2px solid #409eff;
  198. }
  199. }
  200. }
  201. .deleBtn {
  202. float: left;
  203. width: 200px;
  204. text-align: right;
  205. height: 40px;
  206. border-bottom: 1px solid #e4e7ed;
  207. }
  208. }
  209. .content {
  210. display: flex;
  211. flex-direction: row;
  212. box-sizing: border-box;
  213. height: calc(100% - 99px);
  214. .content-left {
  215. display: flex;
  216. flex-direction: column;
  217. flex: 1;
  218. .content-showType {
  219. height: 50px;
  220. border: 1px solid #ccc;
  221. border-bottom: none;
  222. box-sizing: border-box;
  223. }
  224. .content-point {
  225. display: flex;
  226. flex-direction: row;
  227. height: calc(100% - 50px);
  228. border: 1px solid #ccc;
  229. box-sizing: border-box;
  230. .content-point-left {
  231. flex: 1;
  232. }
  233. .content-point-right {
  234. width: 400px;
  235. border-left: 1px solid #ccc;
  236. }
  237. }
  238. }
  239. .content-right {
  240. width: 400px;
  241. margin-left: 10px;
  242. .content-repair {
  243. height: 50px;
  244. margin-bottom: 10px;
  245. border: 1px solid #ccc;
  246. box-sizing: border-box;
  247. }
  248. .content-media {
  249. height: calc(100% - 60px);
  250. border: 1px solid #ccc;
  251. box-sizing: border-box;
  252. }
  253. }
  254. }
  255. .main {
  256. margin-top: 10px;
  257. height: calc(100% - 96px);
  258. }
  259. .footer {
  260. margin-bottom: 10px;
  261. }
  262. /deep/ .el-scrollbar__wrap {
  263. overflow-x: hidden;
  264. }
  265. }
  266. }
  267. </style>
  268. <style lang="less">
  269. .el-table th {
  270. background-color: #d9d9d9;
  271. color: #000;
  272. }
  273. </style>