parkingmonitor.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  1. <template>
  2. <basic-container>
  3. <el-dialog :modal-append-to-body="false" :visible.sync="heartbeatVisible" title="设备心跳" width="80%">
  4. <deviceHeartbeat :deviceId="deviceId" :data="heartbeatData" ref="heartbeat"></deviceHeartbeat>
  5. </el-dialog>
  6. <el-dialog :append-to-body="true" :close-on-click-modal="false" :modal-append-to-body="false"
  7. :visible.sync="editVisible" title="编辑" width="60%">
  8. <avue-form v-model="editForm" :option="option" @submit="submitSmartgas"></avue-form>
  9. </el-dialog>
  10. <avue-data-tabs :option="countOption" style="margin-left: 200px"></avue-data-tabs>
  11. <avue-crud :option="option" :table-loading="loading" :data="data" :page="page" :permission="permissionList"
  12. :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
  13. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  14. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
  15. <template slot="menu" slot-scope="scope">
  16. <el-button icon="el-icon-setting" size="small" type="text">
  17. <el-dropdown>
  18. <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
  19. <el-dropdown-menu slot="dropdown">
  20. <el-dropdown-item icon="el-icon-view" type="text" @click.native="viewDetail(scope.row)">详情
  21. </el-dropdown-item>
  22. <el-dropdown-item icon="el-icon-view" type="text" v-if="permission.device_heartbeat"
  23. @click.native="viewHeartBeat(scope.row)">心跳</el-dropdown-item>
  24. <el-dropdown-item type="text" v-if="permission.smartdevice_edit" @click.native="edit(scope.row)"
  25. icon="el-icon-edit">编辑</el-dropdown-item>
  26. </el-dropdown-menu>
  27. </el-dropdown>
  28. </el-button>
  29. </template>
  30. <template slot="mapSelectForm" slot-scope="scope">
  31. <div>
  32. <el-button @click="openMap"> 选择地址</el-button>
  33. <el-dialog :append-to-body="true" :close-on-click-modal="false" :modal-append-to-body="false"
  34. :visible.sync="mapVisible" title="编辑地址" width="80%">
  35. <!-- <customAvueMap v-if="mapVisible" v-model="scope.row.mapSelect"></customAvueMap>-->
  36. <editPolygonMap editForm="{}" ref="map" :region.sync="form.deviceInstallAddress"
  37. :longitude.sync="form.longitude" :latitude.sync="form.latitude" v-if="mapVisible"
  38. v-model="scope.row.mapSelect" :visible.sync="mapVisible"></editPolygonMap>
  39. </el-dialog>
  40. </div>
  41. <!-- <avue-map v-model="scope.row.mapSelect"></avue-map> -->
  42. </template>
  43. <template slot="battery" slot-scope="scope">
  44. <!-- <battery style=" width: 90px;height: 30px;" :proIsCharge="proIsCharge" :proQuantity="scope.row.battery"></battery> -->
  45. <el-progress v-if="scope.row.battery>20" color="green" :text-inside="true" :stroke-width="18"
  46. :percentage="scope.row.battery"></el-progress>
  47. <el-progress v-if="scope.row.battery<20 ||scope.row.battery == 20" color="red" :text-inside="true"
  48. :stroke-width="18" :percentage="scope.row.battery"></el-progress>
  49. </template>
  50. <template slot="signalIntensity" slot-scope="scope">
  51. </template>
  52. <template slot="menuLeft">
  53. <el-tabs :value="query.deviceType" @tab-click="handleClickType">
  54. <el-tab-pane></el-tab-pane>
  55. <el-tab-pane label="智能地磁" name="100007"></el-tab-pane>
  56. </el-tabs>
  57. </template>
  58. </avue-crud>
  59. </basic-container>
  60. </template>
  61. <script>
  62. import {
  63. getList,
  64. getDetail,
  65. add,
  66. update,
  67. remove,
  68. deviceListCount
  69. } from "@/api/device/iotdevice";
  70. import {
  71. getDetail as getResidentialDetail
  72. } from "@/api/community/residential"
  73. import {
  74. mapGetters
  75. } from "vuex";
  76. import editPolygonMap from "../../../components/residential/editPolygonMap.vue"
  77. import {
  78. getList as getIotList
  79. } from "@/api/system/terminal/iotaepproduct"
  80. import {
  81. getHeartBeatByDeviceId
  82. } from "@/api/device/iotdeviceheartbeat";
  83. import deviceHeartbeat from "../../../components/device/deviceheartbeat.vue"
  84. export default {
  85. components: {
  86. editPolygonMap,
  87. deviceHeartbeat
  88. },
  89. data() {
  90. return {
  91. heartbeatData: [],
  92. deviceId: "",
  93. mapVisible: false,
  94. heartbeatVisible: false,
  95. smartDeviceStaticVo: {},
  96. location: {},
  97. detailForm: {},
  98. editVisible: false,
  99. editForm: {},
  100. proIsCharge: true,
  101. activeName: "first",
  102. detailVisible: false,
  103. form: {},
  104. alarmForm: {},
  105. homeUserForm: {},
  106. orderUserForm: {},
  107. query: {
  108. deviceType: "100007"
  109. },
  110. loading: true,
  111. alarmSetOptionLoading: true,
  112. homeUserLoading: true,
  113. orderUserLoading: true,
  114. page: {
  115. pageSize: 10,
  116. currentPage: 1,
  117. total: 0
  118. },
  119. alarmPage: {
  120. pageSize: 10,
  121. currentPage: 1,
  122. total: 0
  123. },
  124. homeUserPage: {
  125. pageSize: 10,
  126. currentPage: 1,
  127. total: 0
  128. },
  129. selectionList: [],
  130. countOption: {
  131. span: 3,
  132. data: [{
  133. click: function(item) {},
  134. title: '设备总数',
  135. count: 0,
  136. color: '#409EFF',
  137. key: '设备总数'
  138. },
  139. {
  140. click: function(item) {},
  141. title: '正常',
  142. count: 0,
  143. color: '#67C23A',
  144. key: '正常'
  145. },
  146. {
  147. click: function(item) {},
  148. title: '失联',
  149. count: 0,
  150. color: '#F56C6C',
  151. key: '失联'
  152. },
  153. {
  154. click: function(item) {},
  155. title: '告警',
  156. count: 0,
  157. color: '#E6A23C',
  158. key: '告警'
  159. },
  160. {
  161. click: function(item) {},
  162. title: '停用',
  163. count: 0,
  164. color: '#909399',
  165. key: '停用'
  166. },
  167. {
  168. click: function(item) {},
  169. title: '待布防',
  170. count: 0,
  171. color: '#987856',
  172. key: '待布防'
  173. }
  174. ]
  175. },
  176. option: {
  177. height: 'auto',
  178. menuWidth: 200,
  179. labelWidth: 140,
  180. calcHeight: 60,
  181. tip: false,
  182. searchShow: true,
  183. searchMenuSpan: 20,
  184. border: true,
  185. index: true,
  186. // viewBtn: false,
  187. // addBtn: false,
  188. // delBtn: false,
  189. editBtn: false,
  190. selection: true,
  191. dialogClickModal: false,
  192. group: [{
  193. icon: 'el-icon-info',
  194. label: '基础信息',
  195. prop: 'group1',
  196. column: [{
  197. label: '设备名称',
  198. prop: 'deviceName',
  199. },
  200. {
  201. label: 'IMEI',
  202. prop: 'imei',
  203. },
  204. {
  205. label: "操作者",
  206. prop: "person",
  207. rules: [{
  208. required: false,
  209. message: "请输入操作者",
  210. trigger: "blur"
  211. }]
  212. },
  213. ]
  214. }, {
  215. icon: 'el-icon-bangzhu',
  216. label: '产品分类',
  217. // arrow: false,
  218. prop: 'group2',
  219. column: [{
  220. label: "平台",
  221. prop: "platform",
  222. type: "select",
  223. value: "AEP",
  224. cascaderItem: ['productId'],
  225. dicData: [{
  226. label: "AEP",
  227. value: "AEP"
  228. },
  229. {
  230. label: "scepctwing",
  231. value: "scepctwing",
  232. }
  233. ],
  234. }, {
  235. label: "设备注册平台标识",
  236. prop: "isAep",
  237. search: true,
  238. searchSpan: 6,
  239. type: "select",
  240. display: false,
  241. width: 120,
  242. // cascaderItem: ['productId'],
  243. dicUrl: "/api/blade-system/dict-biz/dictionary?code=device_registry_label",
  244. props: {
  245. label: 'dictValue',
  246. value: 'dictKey'
  247. },
  248. // dataType: "number",
  249. search: true,
  250. searchLabelWidth: 140,
  251. // searchSpan: 8,
  252. display: false,
  253. rules: [{
  254. required: true,
  255. message: "请输入设备注册平台标识,1:aep,2:华为,3:厂商",
  256. trigger: "blur"
  257. }]
  258. }, {
  259. label: "产品类型",
  260. prop: "productId",
  261. type: "select",
  262. remote: true,
  263. dicUrl: `/api/cyzh-third/iotaepproduct/list?platform=AEP`,
  264. props: {
  265. label: "productName",
  266. value: "productId"
  267. },
  268. dicFormatter: (res) => {
  269. return res.data.records;
  270. },
  271. }]
  272. }, {
  273. icon: 'el-icon-location',
  274. label: '位置信息',
  275. prop: 'group3',
  276. column: [{
  277. label: '设备用途',
  278. prop: 'deviceUsage',
  279. type: "select",
  280. value: 20,
  281. dicData: [{
  282. label: "公共设备",
  283. value: 20
  284. },
  285. {
  286. label: "居家设备",
  287. value: 10
  288. },
  289. ],
  290. rules: [{
  291. required: true,
  292. message: "设备用途",
  293. trigger: "blur"
  294. }]
  295. },
  296. {
  297. label: '所属区域',
  298. prop: 'residentialId',
  299. type: "select",
  300. remote: true,
  301. cascaderItem: ['buildingId'],
  302. dicUrl: "/api/cyzh-community/residential/list?size=500&name={{key}}",
  303. props: {
  304. label: "name",
  305. value: "id"
  306. },
  307. dicFormatter: (res) => {
  308. return res.data.records;
  309. },
  310. rules: [{
  311. required: true,
  312. message: "所属区域",
  313. trigger: "blur"
  314. }]
  315. },
  316. {
  317. label: '所属楼栋',
  318. prop: 'buildingId',
  319. type: "select",
  320. display: true,
  321. cascaderItem: ['unitId'],
  322. dicUrl: "/api/cyzh-community/building/list?size=500&residentialId={{key}}",
  323. props: {
  324. label: "name",
  325. value: "id"
  326. },
  327. dicFormatter: (res) => {
  328. return res.data.records;
  329. },
  330. },
  331. {
  332. label: '所属单元',
  333. prop: 'unitId',
  334. display: true,
  335. type: "select",
  336. cascaderItem: ['roomId'],
  337. dicUrl: "/api/cyzh-community/unit/list?size=500&buildingId={{key}}",
  338. props: {
  339. label: "name",
  340. value: "id"
  341. },
  342. dicFormatter: (res) => {
  343. return res.data.records;
  344. },
  345. },
  346. {
  347. label: '所属房间',
  348. prop: 'roomId',
  349. type: "select",
  350. display: true,
  351. dicUrl: "/api/cyzh-community/room/list?size=500&unitId={{key}}",
  352. props: {
  353. label: "name",
  354. value: "id"
  355. },
  356. dicFormatter: (res) => {
  357. return res.data.records;
  358. },
  359. },
  360. {
  361. label: '',
  362. prop: 'mapSelect',
  363. // row: true,
  364. // span: 20,
  365. formslot: true,
  366. hide: true,
  367. },
  368. {
  369. label: "经度",
  370. prop: "longitude",
  371. // disabled: true,
  372. },
  373. {
  374. label: "纬度",
  375. prop: "latitude",
  376. // disabled: true,
  377. },
  378. {
  379. label: "安装位置",
  380. prop: "deviceInstallAddress",
  381. row: true,
  382. span: 24,
  383. // disabled: true,
  384. }
  385. ]
  386. }],
  387. column: [{
  388. label: "设备唯一标识",
  389. prop: "deviceId",
  390. display: false,
  391. hide: true,
  392. rules: [{
  393. required: true,
  394. message: "请输入设备唯一标识",
  395. trigger: "blur"
  396. }]
  397. },
  398. {
  399. label: "设备名称",
  400. prop: "deviceName",
  401. search: true,
  402. display: false,
  403. rules: [{
  404. required: true,
  405. message: "请输入设备名称",
  406. trigger: "blur"
  407. }]
  408. },
  409. {
  410. label: "设备注册平台标识",
  411. prop: "isAep",
  412. search: true,
  413. searchSpan: 6,
  414. display: false,
  415. type: "select",
  416. width: 120,
  417. // cascaderItem: ['productId'],
  418. dicUrl: "/api/blade-system/dict-biz/dictionary?code=device_registry_label",
  419. props: {
  420. label: 'dictValue',
  421. value: 'dictKey'
  422. },
  423. // dataType: "number",
  424. search: true,
  425. searchLabelWidth: 140,
  426. // searchSpan: 8,
  427. rules: [{
  428. required: true,
  429. message: "请输入设备注册平台标识,1:aep,2:华为,3:厂商",
  430. trigger: "blur"
  431. }]
  432. },
  433. {
  434. label: "操作者",
  435. prop: "operator",
  436. hide: true,
  437. display: false,
  438. rules: [{
  439. required: false,
  440. message: "请输入操作者",
  441. trigger: "blur"
  442. }]
  443. },
  444. {
  445. label: "订阅事件",
  446. prop: "autoObserver",
  447. type: "select",
  448. hide: true,
  449. display: false,
  450. dicUrl: "/api/blade-system/dict-biz/dictionary?code=auto_subscribe",
  451. props: {
  452. label: "dictValue",
  453. value: "dictKey"
  454. },
  455. dataType: "number",
  456. rules: [{
  457. required: true,
  458. message: "请输入0 自动订阅(默认),1 取消自动订阅 (LWM2M 协议选填,其他协议不填)",
  459. trigger: "blur"
  460. }]
  461. },
  462. {
  463. label: "设备类型",
  464. prop: "deviceType",
  465. type: "select",
  466. hide: true,
  467. display: false,
  468. // search: true,
  469. dicUrl: "/api/blade-system/dict-biz/dictionary?code=device_type",
  470. props: {
  471. label: "dictValue",
  472. value: "dictKey",
  473. },
  474. rules: [{
  475. required: true,
  476. message: "请输入设备类型",
  477. trigger: "blur"
  478. }]
  479. },
  480. {
  481. label: "安装位置",
  482. prop: "deviceInstallAddress",
  483. search: true,
  484. display: false,
  485. overHidden: true,
  486. rules: [{
  487. required: true,
  488. message: "请输入安装位置",
  489. trigger: "blur"
  490. }]
  491. },
  492. {
  493. label: "设备状态",
  494. prop: "deviceStatus",
  495. type: "select",
  496. search: true,
  497. display: false,
  498. dicUrl: "/api/blade-system/dict-biz/dictionary?code=device_status",
  499. props: {
  500. label: "dictValue",
  501. value: "dictKey"
  502. },
  503. dataType: "number",
  504. rules: [{
  505. required: true,
  506. message: "请输入设备状态",
  507. trigger: "blur"
  508. }]
  509. },
  510. {
  511. label: "电池电量",
  512. prop: "battery",
  513. slot: true,
  514. display: false,
  515. rules: [{
  516. required: true,
  517. message: "请输入电池电量",
  518. trigger: "blur"
  519. }]
  520. },
  521. {
  522. label: "信号强度",
  523. prop: "signalIntensity",
  524. slot: true,
  525. display: false,
  526. rules: [{
  527. required: true,
  528. message: "请输入信号强度",
  529. trigger: "blur"
  530. }]
  531. },
  532. {
  533. label: "厂家名称",
  534. prop: "manufacturers",
  535. hide: true,
  536. display: false,
  537. rules: [{
  538. required: true,
  539. message: "请输入厂家名称",
  540. trigger: "blur"
  541. }]
  542. },
  543. {
  544. label: "厂商编号(附录)",
  545. prop: "manufacturersNo",
  546. hide: true,
  547. display: false,
  548. rules: [{
  549. required: false,
  550. message: "请输入厂商编号(附录)",
  551. trigger: "blur"
  552. }]
  553. },
  554. {
  555. label: "设备型号",
  556. prop: "deviceSpecld",
  557. hide: true,
  558. display: false,
  559. rules: [{
  560. required: true,
  561. message: "请输入设备型号",
  562. trigger: "blur"
  563. }]
  564. },
  565. {
  566. label: "IMEI号",
  567. hide: true,
  568. display: false,
  569. prop: "imei",
  570. rules: [{
  571. required: true,
  572. message: "请输入IMEI号",
  573. trigger: "blur"
  574. }]
  575. },
  576. {
  577. label: "iccid",
  578. prop: "iccid",
  579. hide: true,
  580. display: false,
  581. rules: [{
  582. required: true,
  583. message: "请输入iccid",
  584. trigger: "blur"
  585. }]
  586. },
  587. {
  588. label: "Mcu软件版本",
  589. prop: "mcuEdition",
  590. hide: true,
  591. display: false,
  592. rules: [{
  593. required: true,
  594. message: "请输入Mcu软件版本",
  595. trigger: "blur"
  596. }]
  597. },
  598. {
  599. label: "NB模组型号",
  600. prop: "nbModuleModel",
  601. hide: true,
  602. display: false,
  603. rules: [{
  604. required: true,
  605. message: "请输入NB模组型号",
  606. trigger: "blur"
  607. }]
  608. },
  609. {
  610. label: "NB模组版本信息",
  611. prop: "nbModuleEdition",
  612. hide: true,
  613. display: false,
  614. rules: [{
  615. required: true,
  616. message: "请输入NB模组版本信息",
  617. trigger: "blur"
  618. }]
  619. },
  620. {
  621. label: "最后更新时间",
  622. prop: "lastUpdateTime",
  623. hide: true,
  624. display: false,
  625. type: "datetime",
  626. valueFormat: "yyyy-MM-dd HH:mm:ss",
  627. rules: [{
  628. required: true,
  629. message: "请输入最后更新时间",
  630. trigger: "blur"
  631. }]
  632. },
  633. {
  634. label: "心跳保护时间",
  635. prop: "heartbeatTime",
  636. hide: true,
  637. display: false,
  638. type: "datetime",
  639. valueFormat: "yyyy-MM-dd HH:mm:ss",
  640. rules: [{
  641. required: true,
  642. message: "请输入心跳保护时间",
  643. trigger: "blur"
  644. }]
  645. },
  646. {
  647. label: "无线信号覆盖等级",
  648. prop: "wirelessLevel",
  649. hide: true,
  650. display: false,
  651. rules: [{
  652. required: true,
  653. message: "请输入无线信号覆盖等级",
  654. trigger: "blur"
  655. }]
  656. },
  657. {
  658. label: "当前磁场值",
  659. prop: "magneticField",
  660. hide: true,
  661. display: false,
  662. rules: [{
  663. required: true,
  664. message: "请输入当前磁场值",
  665. trigger: "blur"
  666. }]
  667. },
  668. {
  669. label: "终端发射功率",
  670. prop: "transmittingPower",
  671. hide: true,
  672. display: false,
  673. rules: [{
  674. required: true,
  675. message: "请输入终端发射功率",
  676. trigger: "blur"
  677. }]
  678. },
  679. {
  680. label: "终端接收功率",
  681. prop: "receivingPower",
  682. hide: true,
  683. display: false,
  684. rules: [{
  685. required: true,
  686. message: "请输入终端接收功率",
  687. trigger: "blur"
  688. }]
  689. },
  690. {
  691. label: "信噪比",
  692. prop: "signalNoiseRatio",
  693. hide: true,
  694. display: false,
  695. rules: [{
  696. required: true,
  697. message: "请输入信噪比",
  698. trigger: "blur"
  699. }]
  700. },
  701. {
  702. label: "IMSI",
  703. prop: "imsi",
  704. hide: true,
  705. display: false,
  706. rules: [{
  707. required: false,
  708. message: "请输入IMSI",
  709. trigger: "blur"
  710. }]
  711. },
  712. ]
  713. },
  714. data: []
  715. };
  716. },
  717. watch: {
  718. "form.platform"() {
  719. let platformColumn = this.option.group[1].column[0];
  720. let isAepColumn = this.option.group[1].column[1];
  721. let productColumn = this.option.group[1].column[2];
  722. if (this.form.platform == "AEP") {
  723. getIotList(1, 10000, {
  724. "platform": "AEP"
  725. }).then(res => {
  726. productColumn['dicData'] = res.data.data.records
  727. // platformColumn.cascaderItem = ['productId']
  728. productColumn.dicUrl = "/api/cyzh-third/iotaepproduct/list?platform=AEP&productName={{key}}"
  729. isAepColumn.display = false;
  730. productColumn.display = true
  731. })
  732. } else if (this.form.platform == "scepctwing") {
  733. getIotList(1, 10000, {
  734. "platform": "scepctwing"
  735. }).then(res => {
  736. productColumn['dicData'] = res.data.data.records
  737. productColumn.dicUrl = "/api/cyzh-third/iotaepproduct/list?platform=scepctwing&productName={{key}}"
  738. isAepColumn.display = true;
  739. if (this.form.isAep == 1) {
  740. productColumn.display = true
  741. } else {
  742. productColumn.display = false
  743. }
  744. })
  745. }
  746. this.option = Object.assign({}, this.option)
  747. },
  748. "form.isAep"() {
  749. if (this.form.platform == "AEP") return
  750. let productColumn = this.option.group[1].column[2];
  751. if (this.form.isAep == 1) {
  752. productColumn.display = true;
  753. } else {
  754. productColumn.display = false;
  755. }
  756. this.option = Object.assign({}, this.option)
  757. },
  758. "form.deviceUsage"() {
  759. console.log(this.form.deviceUsage + "dddd")
  760. const buildingColumn = this.option.group[2].column[2];
  761. const unitColumn = this.option.group[2].column[3];
  762. const roomColumn = this.option.group[2].column[4];
  763. if (this.form.deviceUsage === 20) { //公共设备
  764. buildingColumn.display = false;
  765. unitColumn.display = false;
  766. roomColumn.display = false;
  767. } else {
  768. buildingColumn.display = true;
  769. unitColumn.display = true;
  770. roomColumn.display = true;
  771. }
  772. },
  773. "form.residentialId"() {
  774. if (this.form.residentialId != '' && this.form.residentialId != undefined) {
  775. getResidentialDetail(this.form.residentialId).then(res => {
  776. this.form.latitude = res.data.data.latitude;
  777. this.form.longitude = res.data.data.longitude;
  778. })
  779. }
  780. }
  781. },
  782. computed: {
  783. ...mapGetters(["permission"]),
  784. permissionList() {
  785. return {
  786. addBtn: this.vaildData(this.permission.parkingmonitor_add, false),
  787. viewBtn: this.vaildData(this.permission.parkingmonitor_view, false),
  788. delBtn: this.vaildData(this.permission.parkingmonitor_delete, false),
  789. editBtn: this.vaildData(this.permission.parkingmonitor_update, false),
  790. };
  791. },
  792. ids() {
  793. let ids = [];
  794. this.selectionList.forEach(ele => {
  795. ids.push(ele.id);
  796. });
  797. return ids.join(",");
  798. }
  799. },
  800. methods: {
  801. openMap() {
  802. this.mapVisible = true;
  803. this.$nextTick(() => {
  804. // this.$refs.map.mounted();
  805. })
  806. },
  807. handleClick(tab, event) {
  808. console.log(tab + " " + event)
  809. },
  810. handleClickType(tab, event) {
  811. // this.$refs.crud.searchForm.deviceType = tab.name;
  812. this.query.deviceType = tab.name;
  813. this.onLoad(this.page, this.query);
  814. },
  815. viewHeartBeat(row) {
  816. this.deviceId = row.id;
  817. getHeartBeatByDeviceId({
  818. deviceId: this.deviceId
  819. }).then(res => {
  820. this.heartbeatVisible = true;
  821. this.heartbeatData = res.data.data;
  822. this.$nextTick(() => {
  823. this.$refs.heartbeat.init()
  824. })
  825. })
  826. },
  827. viewDetail(row) {
  828. if (row.latitudeLongitude != null && row.latitudeLongitude != "") {
  829. var latitudeLongitude = row.latitudeLongitude.split(",");
  830. this.location.latitude = latitudeLongitude[0];
  831. this.location.longitude = latitudeLongitude[1];
  832. this.location.name = row.deviceName;
  833. }
  834. this.detailForm = row;
  835. this.detailVisible = true;
  836. },
  837. rowSave(row, done, loading) {
  838. row.latitudeLongitude = row.latitude + "," + row.longitude;
  839. add(row).then(() => {
  840. this.onLoad(this.page);
  841. this.$message({
  842. type: "success",
  843. message: "操作成功!"
  844. });
  845. done();
  846. }, error => {
  847. loading();
  848. window.console.log(error);
  849. });
  850. },
  851. rowUpdate(row, index, done, loading) {
  852. row.latitudeLongitude = row.latitude + "," + row.longitude;
  853. update(row).then(() => {
  854. this.onLoad(this.page);
  855. this.$message({
  856. type: "success",
  857. message: "操作成功!"
  858. });
  859. done();
  860. }, error => {
  861. loading();
  862. console.log(error);
  863. });
  864. },
  865. rowDel(row) {
  866. this.$confirm("确定将选择数据删除?", {
  867. confirmButtonText: "确定",
  868. cancelButtonText: "取消",
  869. type: "warning"
  870. })
  871. .then(() => {
  872. return remove(row.id);
  873. })
  874. .then(() => {
  875. this.onLoad(this.page);
  876. this.$message({
  877. type: "success",
  878. message: "操作成功!"
  879. });
  880. });
  881. },
  882. handleDelete() {
  883. if (this.selectionList.length === 0) {
  884. this.$message.warning("请选择至少一条数据");
  885. return;
  886. }
  887. this.$confirm("确定将选择数据删除?", {
  888. confirmButtonText: "确定",
  889. cancelButtonText: "取消",
  890. type: "warning"
  891. })
  892. .then(() => {
  893. return remove(this.ids);
  894. })
  895. .then(() => {
  896. this.onLoad(this.page);
  897. this.$message({
  898. type: "success",
  899. message: "操作成功!"
  900. });
  901. this.$refs.crud.toggleSelection();
  902. });
  903. },
  904. beforeOpen(done, type) {
  905. if (["edit", "view"].includes(type)) {
  906. getDetail(this.form.id).then(res => {
  907. this.form = res.data.data;
  908. });
  909. }
  910. done();
  911. },
  912. searchReset() {
  913. this.query = {};
  914. this.onLoad(this.page);
  915. },
  916. searchChange(params, done) {
  917. this.query = params;
  918. this.page.currentPage = 1;
  919. this.onLoad(this.page, params);
  920. done();
  921. },
  922. selectionChange(list) {
  923. this.selectionList = list;
  924. },
  925. selectionClear() {
  926. this.selectionList = [];
  927. this.$refs.crud.toggleSelection();
  928. },
  929. currentChange(currentPage) {
  930. this.page.currentPage = currentPage;
  931. },
  932. sizeChange(pageSize) {
  933. this.page.pageSize = pageSize;
  934. },
  935. refreshChange() {
  936. this.onLoad(this.page, this.query);
  937. },
  938. edit(row) {
  939. this.editForm = row;
  940. this.editVisible = true;
  941. },
  942. submitSmartgas(row, done, loading) {
  943. update(this.editForm).then(() => {
  944. this.onLoad(this.page);
  945. this.editVisible = false;
  946. this.$message({
  947. type: "success",
  948. message: "操作成功!"
  949. });
  950. done();
  951. }, error => {
  952. loading();
  953. console.log(error);
  954. });
  955. },
  956. onLoad(page, params = {}) {
  957. this.loading = true;
  958. // params.prefix = "ctwing/smoke3";
  959. params.deviceUsage = 20; //公共区域
  960. deviceListCount(params).then(res => {
  961. this.smartDeviceStaticVo = res.data.data;
  962. this.smartDeviceStaticVo.forEach(staticDevice => {
  963. if (staticDevice.deviceType == params.deviceType) {
  964. this.countOption.data[0].count = staticDevice.deviceCount;
  965. this.countOption.data[1].count = staticDevice.normalCount;
  966. this.countOption.data[2].count = staticDevice.outlineCount;
  967. this.countOption.data[3].count = staticDevice.alarmCount;
  968. this.countOption.data[4].count = staticDevice.pauseCount;
  969. this.countOption.data[5].count = staticDevice.armedCount;
  970. }
  971. })
  972. })
  973. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  974. const data = res.data.data;
  975. this.page.total = data.total;
  976. this.data = data.records;
  977. this.loading = false;
  978. this.selectionClear();
  979. });
  980. }
  981. }
  982. };
  983. </script>
  984. <style scoped>
  985. .el-divider--vertical {
  986. /* height: 100%; */
  987. }
  988. >>>.el-divider--horizontal {
  989. margin: 30px 0 !important;
  990. }
  991. >>>.el-card__body {
  992. padding-top: 0px !important;
  993. }
  994. >>>.avue-crud__menu {
  995. /*display: none;*/
  996. }
  997. >>>section header .el-row {
  998. margin-top: 15px;
  999. }
  1000. >>>.avue-data-tabs .item {
  1001. height: auto;
  1002. }
  1003. .el-dropdown-link {
  1004. cursor: pointer;
  1005. color: #409eff;
  1006. font-size: small;
  1007. margin-left: 10px;
  1008. }
  1009. </style>