basement.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div class="yui-tree-box">
  3. <project-item-tree @treeclick="treeclick" iconfontClass="el-icon-place"></project-item-tree>
  4. <div class="hui-tree-content">
  5. <div class="basement box-background">
  6. <div class="basement-box">
  7. <div class="basement-center">
  8. <test-alarm ref="testAlarm" :type="30"></test-alarm>
  9. <div class="bim-box">
  10. <model type="basement" fileId="10000786668082"></model>
  11. </div>
  12. </div>
  13. <div class="basement-right">
  14. <div class="basement-operation">
  15. <div class="basement-title">
  16. <div class="hui-chart-title">
  17. 风机柜控制
  18. </div>
  19. </div>
  20. <div class="light-list hui-no-tips" v-if="windList.length === 0">
  21. <empty width="40" description="暂无风柜机"></empty>
  22. </div>
  23. <div class="light-list" v-else>
  24. <div class="light-item" v-for="(item,index) in windList" :key="index">
  25. <div class="item-box">
  26. <div class="light-top">
  27. <i class="iconfont huifont-fengdiangui"></i>
  28. <el-switch v-model="item.state" :active-value="1" :inactive-value="2"
  29. @change="value=>changeDoor(value,item)">
  30. </el-switch>
  31. </div>
  32. <div class="label hui-ellipsis">{{item.name}}</div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="co-operation">
  38. <div class="basement-title">
  39. <div class="hui-chart-title">
  40. CO传感器
  41. </div>
  42. </div>
  43. <div class="co-list hui-no-tips" v-if="windList.length === 0">
  44. <empty width="100" description="暂无CO传感器"></empty>
  45. </div>
  46. <div class="co-list" v-else>
  47. <basement-item v-for="(item,index) in list" :key="index" :list="item"></basement-item>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import testAlarm from '@/components/work/common/testAlarm'
  58. import projectItemTree from '@/components/common/projectItemTree'
  59. import model from '@/components/work/common/model'
  60. import basementItem from '@/components/work/energy/ventilate/basementItem'
  61. import {
  62. getEnergyDeviceList,
  63. updateEnergyDevice
  64. } from '@/httpApi/test'
  65. export default {
  66. data() {
  67. return {
  68. option: null,
  69. windList: [],
  70. list: []
  71. }
  72. },
  73. created() {
  74. this.init();
  75. },
  76. components: {
  77. testAlarm,
  78. projectItemTree,
  79. model,
  80. basementItem
  81. },
  82. methods: {
  83. init(option) {
  84. let postData = {
  85. type: 12,
  86. projectId: this.$store.getters.project.id
  87. }
  88. this.option = option;
  89. if (option) postData = Object.assign(postData, option);
  90. getEnergyDeviceList(postData).then(res => {
  91. if (res.state) {
  92. this.windList = res.data.filter(node => node.column3 === '风机柜');
  93. let data = res.data.filter(node => node.column3 === 'CO传感器');
  94. let obj = {},list = [];
  95. for (let i = 0; i < data.length; i++) {
  96. if(!obj[data[i].name]){
  97. obj[data[i].name] = 1;
  98. list.push({
  99. name:data[i].name,
  100. node:[]
  101. })
  102. }
  103. list.find(node=>node.name === data[i].name).node.push(data[i])
  104. }
  105. this.list = list;
  106. }
  107. })
  108. },
  109. treeclick(item) {
  110. let obj = item.id ? {
  111. projectItemTargetId: item.id
  112. } : {}
  113. if (this.$refs.testAlarm) this.$refs.testAlarm.init(obj);
  114. this.init(obj);
  115. },
  116. changeDoor(value, item) {
  117. updateEnergyDevice({
  118. id: item.id,
  119. state: value
  120. }).then(res => {
  121. if (res.state) {
  122. this.$message.success('操作成功');
  123. this.init(this.option);
  124. }
  125. })
  126. }
  127. },
  128. }
  129. </script>
  130. <style lang="scss">
  131. .basement {
  132. width: 100%;
  133. height: 100%;
  134. padding: 20px;
  135. overflow: auto;
  136. .co-list {
  137. padding: 0 20px;
  138. flex: 1;
  139. height: 0;
  140. overflow-y: auto;
  141. margin-bottom: 20px;
  142. .co-item {
  143. margin-top: 10px;
  144. background: #181F2D;
  145. border: 1px solid rgba(97, 133, 214, 0.15);
  146. }
  147. .co-title {
  148. line-height: 36px;
  149. background: rgba(97, 133, 214, 0.08);
  150. padding: 0 16px;
  151. }
  152. .co-label {
  153. display: flex;
  154. align-items: center;
  155. padding: 20px;
  156. border-bottom: 1px solid rgba(97, 133, 214, 0.15);
  157. .co-icon {
  158. width: 28px;
  159. height: 28px;
  160. background: #AFB9CC;
  161. border-radius: 7px;
  162. text-align: center;
  163. line-height: 28px;
  164. margin-right: 8px;
  165. i {
  166. font-size: 20px;
  167. color: #fff;
  168. }
  169. }
  170. .label {
  171. flex: 1;
  172. width: 0;
  173. }
  174. .number {
  175. font-size: 20px;
  176. margin-right: 6px;
  177. }
  178. .unit {
  179. opacity: 0.6;
  180. }
  181. }
  182. .co-chart {
  183. height: 178px;
  184. }
  185. }
  186. .basement-title {
  187. padding: 20px 20px 0 20px;
  188. margin-bottom: 10px;
  189. }
  190. .basement-box {
  191. width: 100%;
  192. height: 100%;
  193. min-width: 1100px;
  194. min-height: 699px;
  195. display: flex;
  196. }
  197. .basement-center {
  198. flex: 1;
  199. width: 0;
  200. height: 100%;
  201. display: flex;
  202. flex-direction: column;
  203. }
  204. .basement-right {
  205. height: 100%;
  206. width: 350px;
  207. margin-left: 12px;
  208. display: flex;
  209. flex-direction: column;
  210. }
  211. .basement-operation {
  212. background: rgba(0, 4, 10, 0.3);
  213. height: 194px;
  214. display: flex;
  215. flex-direction: column;
  216. }
  217. .co-operation {
  218. flex: 1;
  219. background: rgba(0, 4, 10, 0.3);
  220. margin-top: 10px;
  221. display: flex;
  222. flex-direction: column;
  223. height: 0;
  224. }
  225. .light-list {
  226. display: flex;
  227. flex-wrap: wrap;
  228. padding: 0 10px 0 20px;
  229. margin-bottom: 20px;
  230. flex: 1;
  231. overflow-y: auto;
  232. .light-line {
  233. width: 10px;
  234. }
  235. .light-top {
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-between;
  239. i {
  240. font-size: 28px;
  241. }
  242. }
  243. .light-item {
  244. flex: 1;
  245. min-width: 33.33333%;
  246. margin-top: 12px;
  247. padding-right: 10px;
  248. }
  249. .item-box {
  250. height: 100px;
  251. padding: 14px 10px 16px 10px;
  252. background: #1E2430;
  253. border-radius: 8px;
  254. display: flex;
  255. flex-direction: column;
  256. justify-content: space-between;
  257. }
  258. }
  259. .el-switch {
  260. .el-switch__core {
  261. width: 24px !important;
  262. height: 12px;
  263. line-height: 12px;
  264. background: rgba(255, 255, 255, 0.2);
  265. border: none;
  266. }
  267. }
  268. .el-switch.is-checked .el-switch__core {
  269. background: $--color-primary;
  270. }
  271. .el-switch .el-switch__core::after {
  272. width: 10px;
  273. height: 10px;
  274. top: 1px;
  275. }
  276. .el-switch.is-checked .el-switch__core::after {
  277. margin-left: -10px;
  278. }
  279. }
  280. </style>