airconditioningCard.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <div class="sceneCard">
  3. <div class="sceneCard-query">
  4. <Query :query-data.sync="queryData" :search="search" :reset="reset" >
  5. <template #extraItem>
  6. <a-form-model-item label="开关:" class="formItem">
  7. <a-select default-value="0" style="width: 120px" v-model="queryData.switch">
  8. <a-select-option value="0"> 全部 </a-select-option>
  9. <a-select-option value="1"> 开 </a-select-option>
  10. <a-select-option value="2"> 关 </a-select-option>
  11. </a-select>
  12. </a-form-model-item>
  13. <a-form-model-item label="模式:" class="formItem">
  14. <a-select default-value="0" style="width: 120px" v-model="queryData.mode">
  15. <a-select-option value="0"> 全部 </a-select-option>
  16. <a-select-option value="cold"> 制冷 </a-select-option>
  17. <a-select-option value="hot"> 制热 </a-select-option>
  18. </a-select>
  19. </a-form-model-item>
  20. <a-form-model-item label="温度:" class="formItem">
  21. <a-select default-value="0" style="width: 120px" v-model="queryData.tm">
  22. <a-select-option value="0"> 全部 </a-select-option>
  23. <a-select-option value="18"> 18°C </a-select-option>
  24. <a-select-option value="19"> 19°C </a-select-option>
  25. <a-select-option value="20"> 20°C </a-select-option>
  26. <a-select-option value="21"> 21°C </a-select-option>
  27. <a-select-option value="22"> 22°C </a-select-option>
  28. <a-select-option value="23"> 23°C </a-select-option>
  29. <a-select-option value="24"> 24°C </a-select-option>
  30. <a-select-option value="25"> 25°C </a-select-option>
  31. <a-select-option value="26"> 26°C </a-select-option>
  32. <a-select-option value="27"> 27°C </a-select-option>
  33. <a-select-option value="28"> 28°C </a-select-option>
  34. </a-select>
  35. </a-form-model-item>
  36. <!--<a-form-model-item label="设备编号:" class="formItem">-->
  37. <!-- <a-input v-model="queryData.deviceNo" placeholder="请输入设备编号" />-->
  38. <!--</a-form-model-item>-->
  39. </template>
  40. </Query>
  41. </div>
  42. <div class="sceneCard-control">
  43. <div style="display: inline-block;width: 50%;text-align: left">
  44. <a-space>
  45. <a-button style="font-size: 12px" size="small" @click="allPowerOff"><a-icon type="poweroff" />全开</a-button>
  46. <a-button style="font-size: 12px" size="small" @click="allPowerOn"><a-icon type="poweroff" />全关</a-button>
  47. <a-button type="primary" size="small" style="font-size: 12px" >批量执行策略</a-button>
  48. </a-space>
  49. </div>
  50. <div style="display: inline-block;width: 50%;text-align: right">
  51. <a-select default-value="0">
  52. <a-select-option value="0">
  53. 按楼层显示
  54. </a-select-option>
  55. <a-select-option value="1">
  56. 按公司
  57. </a-select-option>
  58. <a-select-option value="2">
  59. 按功能
  60. </a-select-option>
  61. <a-select-option value="3">
  62. 按分组
  63. </a-select-option>
  64. </a-select>
  65. <a-button type="link" @click="toggleShowCard"><a-icon type="unordered-list" />
  66. <span v-if="showCard">列表模式</span>
  67. <span v-if="!showCard">卡片模式</span>
  68. </a-button>
  69. </div>
  70. </div>
  71. <div class="airContainer">
  72. <div class="airContainer-left">
  73. <div class="deviceFloorIndex">
  74. <a-input-search placeholder="请输入楼层"></a-input-search>
  75. <a-anchor :getContainer="getContainer" :target-offset="100" style="margin-top: 12px" @change="floorChange">
  76. <template v-for="item in floors" >
  77. <a-anchor-link :href="'#'+item.label" :key="item.value" >
  78. <template #title>
  79. <!--<span style="display: inline-block;padding-left: 5px; width: 20px;height: 40px;overflow: hidden">-->
  80. <!-- <div style="position: absolute;top: 15px;left: -2px;width: 4px;height: 4px;border-radius: 2px;background-color: #2EA8E6"></div>-->
  81. <!-- <div style="width: 18px;height: 18px;border-bottom: 1px dashed #2EA8E6;" ></div>-->
  82. <!-- <div style="width: 18px;height: 18px;border-left: 1px dashed #2EA8E6" ></div>-->
  83. <!--</span>-->
  84. {{ item.label }}
  85. </template>
  86. </a-anchor-link>
  87. </template>
  88. </a-anchor>
  89. </div>
  90. </div>
  91. <div class="airContainer-right" ref="airContainerRight">
  92. <template v-for="item in floors">
  93. <template v-if="showCard">
  94. <div :key="item.value" style="margin-bottom: 15px">
  95. <a-divider :id="item.label" style="margin: 0 0 15px;padding: 0" orientation="left" dashed >{{ item.label }}</a-divider>
  96. <div style="padding: 0 15px">
  97. <a-row :gutter="[30,12]">
  98. <a-col v-for="device in item.devices" :key="device.id" :span="6">
  99. <DeviceCardAir :item="device" :toggle="toggleOnline" />
  100. </a-col>
  101. </a-row>
  102. </div>
  103. </div>
  104. </template>
  105. <template v-if="!showCard">
  106. <div :key="item.value" :id="item.label" v-show="currFloor==item.label">
  107. <a-table></a-table>
  108. </div>
  109. </template>
  110. </template>
  111. </div>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import Query from "@/components/common/query.vue";
  117. import DeviceCardAir from "@/components/scene/energy/common/deviceCardAir.vue";
  118. export default {
  119. components: {
  120. Query,
  121. DeviceCardAir,
  122. },
  123. data() {
  124. return {
  125. currFloor: '1F',
  126. showCard: true,
  127. queryData: {
  128. switch: '0',
  129. mode: '0',
  130. tm: '0'
  131. },
  132. oriFloors: [],
  133. floors: [
  134. {
  135. label: '1F',
  136. value: '1',
  137. devices: [
  138. {
  139. id: '1101-1',
  140. mode: 'hot',
  141. tm: '26',
  142. wind: '一级',
  143. online: true
  144. },{
  145. id: '1101-2',
  146. mode: 'hot',
  147. tm: '26',
  148. wind: '一级',
  149. online: true
  150. },{
  151. id: '1102-1',
  152. mode: 'hot',
  153. tm: '26',
  154. wind: '一级',
  155. online: true
  156. },{
  157. id: '1102-2',
  158. mode: 'hot',
  159. tm: '26',
  160. wind: '一级',
  161. online: true
  162. },
  163. ]
  164. },
  165. {
  166. label: '2F',
  167. value: '2',
  168. devices: [
  169. {
  170. id: '2101-1',
  171. mode: 'cold',
  172. tm: '26',
  173. wind: '一级',
  174. online: true
  175. },{
  176. id: '2101-2',
  177. mode: 'hot',
  178. tm: '26',
  179. wind: '一级',
  180. online: true
  181. }
  182. ]
  183. },
  184. {
  185. label: '3F',
  186. value: '3',
  187. devices: [
  188. {
  189. id: '3101-1',
  190. mode: 'hot',
  191. tm: '26',
  192. wind: '一级',
  193. online: true
  194. },{
  195. id: '3101-2',
  196. mode: 'hot',
  197. tm: '26',
  198. wind: '一级',
  199. online: true
  200. }
  201. ]
  202. },
  203. {
  204. label: '4F',
  205. value: '4',
  206. devices: [
  207. {
  208. id: '3101-1',
  209. mode: 'hot',
  210. tm: '26',
  211. wind: '一级',
  212. online: true
  213. },{
  214. id: '3101-2',
  215. mode: 'hot',
  216. tm: '26',
  217. wind: '一级',
  218. online: true
  219. }
  220. ]
  221. },
  222. {
  223. label: '5F',
  224. value: '5',
  225. devices: [
  226. {
  227. id: '3101-1',
  228. mode: 'hot',
  229. tm: '26',
  230. wind: '一级',
  231. online: true,
  232. },{
  233. id: '3101-2',
  234. mode: 'hot',
  235. tm: '26',
  236. wind: '一级',
  237. online: true
  238. }
  239. ]
  240. },
  241. {
  242. label: '6F',
  243. value: '6',
  244. devices: [
  245. {
  246. id: '3101-1',
  247. mode: 'hot',
  248. tm: '26',
  249. wind: '一级',
  250. online: true
  251. },{
  252. id: '3101-2',
  253. mode: 'hot',
  254. tm: '26',
  255. wind: '一级',
  256. online: true
  257. }
  258. ]
  259. },
  260. {
  261. label: '7F',
  262. value: '7',
  263. devices: [
  264. {
  265. id: '3101-1',
  266. mode: 'hot',
  267. tm: '26',
  268. wind: '一级',
  269. online: true
  270. },{
  271. id: '3101-2',
  272. mode: 'hot',
  273. tm: '26',
  274. wind: '一级',
  275. online: true
  276. }
  277. ]
  278. },
  279. ]
  280. }
  281. },
  282. mounted() {
  283. this.oriFloors = JSON.parse(JSON.stringify(this.floors));
  284. },
  285. methods: {
  286. reset() {
  287. this.floors = JSON.parse(JSON.stringify(this.oriFloors));
  288. },
  289. search() {
  290. let objarr = JSON.parse(JSON.stringify(this.oriFloors));
  291. let app = this
  292. objarr.forEach(item=>{
  293. if (item.devices) {
  294. item.devices = item.devices.filter(item=>{
  295. if (!app.queryData.switch || app.queryData.switch=='0') {
  296. } else {
  297. return app.queryData.switch==item.online
  298. }
  299. if (!app.queryData.mode || app.queryData.mode=='0') {
  300. } else {
  301. return app.queryData.mode==item.mode
  302. }
  303. if (!app.queryData.tm || app.queryData.tm=='0') {
  304. } else {
  305. return app.queryData.tm==item.tm
  306. }
  307. return true;
  308. })
  309. }
  310. })
  311. this.floors = objarr
  312. },
  313. toggleOnline(device) {
  314. device.online=!device.online;
  315. },
  316. floorChange(val) {
  317. let obj = val.replace('#','')
  318. this.currFloor = obj;
  319. //console.log(this.currFloor)
  320. },
  321. getContainer() {
  322. return this.$refs.airContainerRight
  323. },
  324. toggleShowCard() {
  325. this.showCard = !this.showCard;
  326. },
  327. allPowerOn() {
  328. this.floors.forEach(item=>{
  329. if (item.devices) {
  330. item.devices.forEach(i=>{
  331. i.online = false
  332. })
  333. }
  334. })
  335. },
  336. allPowerOff() {
  337. this.floors.forEach(item=>{
  338. if (item.devices) {
  339. item.devices.forEach(i=>{
  340. i.online = true
  341. })
  342. }
  343. })
  344. }
  345. }
  346. }
  347. </script>
  348. <style lang="less" scoped>
  349. .sceneCard {
  350. width: 100%;
  351. height: 100%;
  352. .sceneCard-query {
  353. }
  354. .sceneCard-control {
  355. margin-top: 12px;
  356. }
  357. .airContainer {
  358. width: 100%;
  359. height: 600px;
  360. padding: 15px 8px;
  361. .airContainer-left {
  362. background-color: #fafafa;
  363. width: 20%;
  364. height: 100%;
  365. display: inline-block;
  366. vertical-align: top;
  367. padding: 12px;
  368. overflow-y: auto;
  369. }
  370. .airContainer-right {
  371. display: inline-block;
  372. width: 80%;
  373. height: 100%;
  374. vertical-align: top;
  375. padding: 12px 20px;
  376. overflow-y: auto;
  377. }
  378. .ant-anchor-link {
  379. line-height: 45px;
  380. font-size: 16px;
  381. }
  382. .ant-anchor-link-active {
  383. background-color: #e0effa;
  384. border-radius: 0px 4px 4px 0px;
  385. }
  386. }
  387. }
  388. </style>