rtumanage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. <!--
  2. * @Title:
  3. * @Description: 管理工作台
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="container">
  11. <uni-nav-bar :fixed="true" backgroundColor="#3F9EFF" statusBar="false" height="75px">
  12. <view style="width:100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
  13. <text style="color: #ffffff; font-size: 1rem;font-family: Microsoft YaHei;">{{title}}</text>
  14. </view>
  15. </uni-nav-bar>
  16. <uni-section title="查询" type="line">
  17. <view class="search-block">
  18. <view class="adcd-adnm">
  19. <uni-data-picker placeholder="请选择地区" popup-title="请选择所在地区" :localdata="regionTree"
  20. v-model="selectedTreeNode" @change="onTreeChange" @nodeclick="onTreeNodeClick"
  21. @popupopened="onTreePopupOpened" @popupclosed="onTreePopupClosed" :clear-icon="false">
  22. </uni-data-picker>
  23. </view>
  24. <view class="rtu-code">
  25. <uni-easyinput :styles="inputStyles" @input="searchRtuCodeValClear" prefixIcon="search"
  26. v-model="searchRtuCodeVal" placeholder="请输入测站编码">
  27. </uni-easyinput>
  28. </view>
  29. <view class="rtu-name">
  30. <uni-easyinput :styles="inputStyles" @input="searchRtuNameValClear" prefixIcon="search"
  31. v-model="searchRtuNameVal" placeholder="请输入测站名称">
  32. </uni-easyinput>
  33. </view>
  34. <view class="submit-btn">
  35. <button type="default" @click="search">查 询</button>
  36. </view>
  37. </view>
  38. </uni-section>
  39. <view class="count-info-line">
  40. <view class="rtuCount">
  41. <span class="name">测站数量: </span>
  42. <span v-if="countInfo.rtuCount" class="count">{{ countInfo.rtuCount }}</span>
  43. </view>
  44. <view class="warnRtuCount">
  45. <span class="name">异常测站数量: </span>
  46. <span v-if="countInfo.warningRtuCount" class="count">{{
  47. countInfo.warningRtuCount }}</span>
  48. </view>
  49. </view>
  50. <view style="padding-left: 0px;padding-right: 0px;">
  51. <uni-collapse v-model="value">
  52. <uni-collapse-item title="异常类别筛选条件" :show-animation="true">
  53. <view class="select-checkbox">
  54. <uni-data-checkbox v-model="warnKindOption" :localdata="warnKindItems"
  55. @change="warnKindOptionChange">
  56. </uni-data-checkbox>
  57. </view>
  58. </uni-collapse-item>
  59. </uni-collapse>
  60. </view>
  61. <uni-list>
  62. <uni-list-item v-for="item in list" :key="item.id">
  63. <template v-slot:body>
  64. <view class="list-item-block">
  65. <!-- 测站名称 -->
  66. <uni-row>
  67. <uni-col :span="20">
  68. <view class="items-line">
  69. <image v-if="item.runStatusId==1" class="item-title-run-status-icon" mode="widthFix"
  70. src="/static/images/icon_warning.png">
  71. </image>
  72. <image v-else class="item-title-run-status-icon" mode="widthFix"
  73. src="/static/images/icon_ok.png">
  74. </image>
  75. <text class="item-title-rtu-name">{{item.rtuName}}</text>
  76. <text class="item-title-rtu-code">[{{item.rtuCode}}]</text>
  77. </view>
  78. </uni-col>
  79. <uni-col :span="4">
  80. <view class="items-line" style="padding-top: 5px;"
  81. @click="onRtuDetailClick(item.rtuCode)">
  82. <text
  83. style="text-decoration-line: underline;font-size: 0.6rem;color:gray;">测站信息</text>
  84. </view>
  85. </uni-col>
  86. </uni-row>
  87. <!-- 最近上报时间 -->
  88. <view class="items-line">
  89. <uni-icons class="input-uni-icon" type="calendar" size="18" color="lightblue" />
  90. <text class="item-up-time-text">最后上线时间:</text>
  91. <text class="item-up-time-text">{{item.lastUpTime}}</text>
  92. </view>
  93. <view v-if="item.runStatusId==1" class="items-line">
  94. <uni-icons class="input-uni-icon" type="bars" size="18" color="lightblue" />
  95. <text class="item-up-time-text">异常类型:</text>
  96. <text class="item-up-time-text">{{item.warnKindInfo}}</text>
  97. </view>
  98. <view class="items-line">
  99. <uni-icons class="input-uni-icon" type="location" size="18" color="lightblue" />
  100. <text class="item-adcd-adnm-text">{{item.areaName}}</text>
  101. </view>
  102. <!-- 操作 -->
  103. <view class="item-button-group">
  104. <view class="item-button" @click="onLocationClick(item)">
  105. <view class="items-line">
  106. <uni-icons class="input-uni-icon" type="location" size="18" color="coral" />
  107. <text class="button-text">导航</text>
  108. </view>
  109. </view>
  110. <view class="item-button" @click="onWarningPageClick(item.rtuCode)">
  111. <view class="items-line">
  112. <uni-icons class="input-uni-icon" type="gear" size="18" color="coral" />
  113. <text class="button-text">异常信息</text>
  114. </view>
  115. </view>
  116. <view class="item-button" @click="onCheckOrderPageClick(item.rtuCode)">
  117. <view class="items-line">
  118. <uni-icons class="input-uni-icon" type="gear" size="18" color="coral" />
  119. <text class="button-text">维修任务</text>
  120. </view>
  121. </view>
  122. <view class="item-button" @click="onInspectionReportClick(item.rtuCode)">
  123. <view class="items-line">
  124. <uni-icons class="input-uni-icon" type="reload" size="18" color="coral" />
  125. <text class="button-text">设备巡检</text>
  126. </view>
  127. </view>
  128. <view class="item-button" @click="onSiteRealDataClick(item)">
  129. <view class="items-line">
  130. <uni-icons class="input-uni-icon" type="info" size="18" color="coral" />
  131. <text class="button-text">实时数据</text>
  132. </view>
  133. </view>
  134. <view v-if="permission.admin || permission.orgAdmin" class="item-button"
  135. @click="onManuallyOrderClick(item.rtuCode)">
  136. <view class="items-line">
  137. <uni-icons class="input-uni-icon" type="email" size="18" color="coral" />
  138. <text class="button-text">人工派单</text>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. </uni-list-item>
  145. </uni-list>
  146. <uni-group>
  147. <view class="pagination-block">
  148. <uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total"
  149. @change="pageChange" />
  150. </view>
  151. </uni-group>
  152. <!-- </view> -->
  153. </view>
  154. </template>
  155. <script>
  156. import
  157. navBtns
  158. from "@/api/home.js";
  159. import {
  160. role
  161. } from "@/api/role.js";
  162. import http from '@/http/api.js';
  163. export default {
  164. name: '',
  165. components: {
  166. },
  167. data() {
  168. return {
  169. title: '管理工作台',
  170. permission: {
  171. 'admin': false,
  172. 'orgAdmin': false,
  173. 'companyAdmin': false,
  174. 'companyServciePerson': false,
  175. },
  176. currentRole: '',
  177. barcurrent: 1,
  178. pageSize: 10,
  179. pageCurrent: 1,
  180. total: 0,
  181. list: [],
  182. regionTree: [],
  183. regionCode: '',
  184. selectedTreeNode: '',
  185. searchRtuNameVal: '',
  186. searchRtuCodeVal: '',
  187. query: {},
  188. inputStyles: {
  189. color: '#808080',
  190. borderColor: '#d3d3d3'
  191. },
  192. countInfo: {},
  193. loading: false,
  194. value: [],
  195. warnKindItems: [{
  196. 'value': 0,
  197. 'text': '全部'
  198. }, {
  199. 'value': 1,
  200. 'text': '离线'
  201. }, {
  202. 'value': 2,
  203. 'text': '时钟异常'
  204. }, {
  205. 'value': 3,
  206. 'text': '雨量漏报'
  207. }, {
  208. 'value': 4,
  209. 'text': '水位漏报'
  210. }, {
  211. 'value': 5,
  212. 'text': '5分钟上报延时'
  213. }, {
  214. 'value': 6,
  215. 'text': '雨量小时上报延时'
  216. }, {
  217. 'value': 7,
  218. 'text': '水位小时上报延时'
  219. }, {
  220. 'value': 8,
  221. 'text': '雨量疑似异常值'
  222. }],
  223. warnKindOption: 0,
  224. }
  225. },
  226. computed: {
  227. },
  228. onLoad(option) {
  229. if (this.$u.func.checkLogin()) {
  230. if (this.userInfo.role_name === role.admin) {
  231. this.permission.admin = true;
  232. this.currentRole = role.admin;
  233. } else if (this.userInfo.role_name === role.orgAdmin) {
  234. this.permission.orgAdmin = true;
  235. this.currentRole = role.orgAdmin;
  236. } else if (this.userInfo.role_name === role.companyAdmin) {
  237. this.permission.companyAdmin = true;
  238. this.currentRole = role.companyAdmin;
  239. } else if (this.userInfo.role_name === role.companyServciePerson) {
  240. this.permission.companyServciePerson = true;
  241. this.currentRole = role.companyServciePerson;
  242. }
  243. this.getRegionTree();
  244. } else {
  245. this.$u.func.logout();
  246. }
  247. },
  248. onShow() {
  249. if (this.$u.func.checkLogin()) {
  250. if (this.userInfo.role_name !== this.currentRole) {
  251. this.permission.admin = false;
  252. this.permission.orgAdmin = false;
  253. this.permission.companyAdmin = false;
  254. this.permission.companyServciePerson = false;
  255. if (this.userInfo.role_name === role.admin) {
  256. this.permission.admin = true;
  257. this.currentRole = role.admin;
  258. } else if (this.userInfo.role_name === role.orgAdmin) {
  259. this.permission.orgAdmin = true;
  260. this.currentRole = role.orgAdmin;
  261. } else if (this.userInfo.role_name === role.companyAdmin) {
  262. this.permission.companyAdmin = true;
  263. this.currentRole = role.companyAdmin;
  264. } else if (this.userInfo.role_name === role.companyServciePerson) {
  265. this.permission.companyServciePerson = true;
  266. this.currentRole = role.companyServciePerson;
  267. }
  268. this.getRegionTree();
  269. }
  270. } else {
  271. this.$u.func.logout();
  272. }
  273. },
  274. methods: {
  275. // 分页触发
  276. pageChange(e) {
  277. this.pageCurrent = e.current;
  278. this.getPage()
  279. },
  280. //行政区划选择
  281. onTreeNodeClick(node) {
  282. console.log(JSON.stringify(node))
  283. },
  284. onTreePopupOpened(e) {
  285. console.log(JSON.stringify(e))
  286. },
  287. onTreePopupClosed(e) {
  288. console.log(JSON.stringify(e))
  289. },
  290. onTreeChange(e) {
  291. console.log(JSON.stringify(e))
  292. let nodes = e.detail.value;
  293. if (nodes.length > 0) {
  294. let node = nodes[nodes.length - 1];
  295. this.regionCode = node.value;
  296. this.query = {};
  297. this.query['adCode'] = this.regionCode;
  298. this.searchRtuNameVal = '';
  299. this.searchRtuCodeVal = '';
  300. this.pageCurrent = 1;
  301. this.getPage();
  302. this.getCountInfo(this.regionCode);
  303. } else {
  304. this.regionCode = '';
  305. this.query = {};
  306. this.searchRtuNameVal = '';
  307. this.searchRtuCodeVal = '';
  308. this.pageCurrent = 1;
  309. this.getPage();
  310. this.getCountInfo(this.regionCode);
  311. }
  312. },
  313. //录入查询
  314. search() {
  315. this.pageCurrent = 1;
  316. // console.log(JSON.stringify(res))
  317. let params = {};
  318. if (this.searchRtuCodeVal.length > 0) {
  319. params['rtuCode'] = this.searchRtuCodeVal;
  320. }
  321. if (this.searchRtuNameVal.length > 0) {
  322. params['rtuName'] = this.searchRtuNameVal;
  323. }
  324. this.getPage(params);
  325. },
  326. searchRtuNameValClear(e) {
  327. if (e == null || e.length == 0) {
  328. this.searchRtuNameVal = '';
  329. if (this.searchRtuNameVal.length == 0) {
  330. let params = {};
  331. if (this.searchRtuCodeVal.length > 0) {
  332. params['rtuCode'] = this.searchRtuCodeVal;
  333. }
  334. this.getPage(params);
  335. }
  336. }
  337. },
  338. searchRtuCodeValClear(e) {
  339. if (e == null || e.length == 0) {
  340. this.searchRtuCodeVal = '';
  341. if (this.searchRtuCodeVal.length == 0) {
  342. let params = {};
  343. if (this.searchRtuNameVal.length > 0) {
  344. params['rtuName'] = this.searchRtuNameVal;
  345. }
  346. this.getPage(params);
  347. }
  348. }
  349. },
  350. onBackPress() {
  351. // #ifdef APP-PLUS
  352. plus.key.hideSoftKeybord();
  353. // #endif
  354. },
  355. onRtuDetailClick(rtuCode) {
  356. uni.navigateTo({
  357. url: '/pages/rtu-manage/rtudetail?rtuCode=' + rtuCode
  358. })
  359. },
  360. onWarningPageClick(rtuCode) {
  361. uni.navigateTo({
  362. url: '/pages/warning/rtuwarninglist?rtuCode=' + rtuCode
  363. })
  364. },
  365. onLocationClick(item) {
  366. let lat = item.lat;
  367. let lng = item.lng;
  368. let name = item.rtuName;
  369. let add = item.locationDesc;
  370. uni.openLocation({
  371. latitude: Number(lat),
  372. longitude: Number(lng),
  373. name: name,
  374. address: "",
  375. success() {}
  376. })
  377. },
  378. onCheckOrderPageClick(rtuCode) {
  379. uni.navigateTo({
  380. url: '/pages/check-order/rtu/rtucheckorderlist?rtuCode=' + rtuCode
  381. })
  382. },
  383. onInspectionReportClick(rtuCode) {
  384. console.log("onInspectionReportClick")
  385. uni.navigateTo({
  386. url: '/pages/equipment-inspection/rtuinspectionreportview?rtuCode=' + rtuCode
  387. })
  388. },
  389. onSiteRealDataClick(item) {
  390. uni.navigateTo({
  391. url: '/pages/rtu-manage/rturealdatadetail?rtuCode=' + item.rtuCode + '&isRain=' + item.isRain +
  392. '&isRiver=' + item.isRiver + '&isRes=' + item.isRes + '&isGround=' + item.isGround,
  393. })
  394. },
  395. onManuallyOrderClick(rtuCode) {
  396. uni.navigateTo({
  397. url: '/pages/check-order/manuallyaddcheckorder?rtuCode=' + rtuCode
  398. })
  399. },
  400. warnKindOptionChange: function(evt) {
  401. let params = {};
  402. this.getPage(params);
  403. },
  404. getSiteData(val) {
  405. let htmltext = '';
  406. if (val.isRain === 1) {
  407. htmltext = htmltext + "降水:";
  408. if (val.drp) {
  409. htmltext = htmltext + val.drp;
  410. } else {
  411. htmltext = htmltext + "--";
  412. }
  413. }
  414. if (val.isRiver == 1) {
  415. if (htmltext.length > 0) {
  416. htmltext = htmltext + ' / ';
  417. }
  418. htmltext = htmltext + '水位:';
  419. if (val.rz) {
  420. htmltext = htmltext + val.rz;
  421. } else {
  422. htmltext = htmltext + "--";
  423. }
  424. } else if (val.isRes == 1) {
  425. if (htmltext.length > 0) {
  426. htmltext = htmltext + ' / ';
  427. }
  428. htmltext = htmltext + '水位:';
  429. if (val.z) {
  430. htmltext = htmltext + val.z;
  431. } else {
  432. htmltext = htmltext + "--";
  433. }
  434. }
  435. if (val.isGround == 1) {
  436. if (htmltext.length > 0) {
  437. htmltext = htmltext + ' / ';
  438. }
  439. htmltext = htmltext + '墒情含水层:';
  440. if (val.ground) {
  441. htmltext = htmltext + val.ground;
  442. } else {
  443. htmltext = htmltext + "--";
  444. }
  445. }
  446. return htmltext;
  447. },
  448. getRegionTree() {
  449. var that = this;
  450. http.request({
  451. url: '/galaxy-business/baseinfo/region/tree',
  452. method: 'GET',
  453. }).then(res => {
  454. if (res.data != null) {
  455. that.regionTree = res.data;
  456. that.regionCode = that.regionTree[0].id;
  457. that.selectedTreeNode = that.regionTree[0].id;
  458. that.query = {};
  459. that.query['adCode'] = that.regionCode;
  460. that.getPage();
  461. that.getCountInfo(that.regionCode);
  462. }
  463. }).catch(err => {
  464. console.log(err)
  465. })
  466. },
  467. getCountInfo(adCode) {
  468. let that = this;
  469. http.request({
  470. url: '/galaxy-business/rtu/manage/count',
  471. method: 'GET',
  472. data: {
  473. adCode
  474. }
  475. }).then(res => {
  476. that.countInfo = res.data;
  477. })
  478. },
  479. getPage(params = {}) {
  480. this.loading = true
  481. if (this.warnKindOption == 0) {} else {
  482. params['warnKind'] = this.warnKindOption;
  483. }
  484. const current = this.pageCurrent;
  485. const size = this.pageSize;
  486. let postData = Object.assign(params, this.query);
  487. var that = this;
  488. http.request({
  489. url: '/galaxy-business/rtu/manage/page',
  490. method: 'GET',
  491. params: {
  492. current,
  493. size,
  494. },
  495. data: postData,
  496. }).then(res => {
  497. // console.log(JSON.stringify(res.data))
  498. if (res.data.records != null) {
  499. that.list = res.data.records;
  500. }
  501. that.total = res.data.total;
  502. this.loading = false
  503. }).catch(err => {
  504. console.log(err)
  505. this.loading = false
  506. })
  507. },
  508. }
  509. }
  510. </script>
  511. <style>
  512. /* page {
  513. background-color: rgb(240, 242, 244);
  514. } */
  515. </style>
  516. <style lang="scss" scoped>
  517. $nav-height: 75px;
  518. .select-checkbox {
  519. margin-top: 0px;
  520. margin-bottom: 5px;
  521. padding-left: 15px;
  522. }
  523. .count-info-line {
  524. padding-top: 5px;
  525. padding-bottom: 5px;
  526. padding-left: 10px;
  527. padding-right: 10px;
  528. display: flex;
  529. flex-direction: row;
  530. align-items: center;
  531. }
  532. .count-info-line .rtuCount {
  533. display: flex;
  534. flex-direction: row;
  535. align-items: center;
  536. .name {
  537. color: dimgray;
  538. font-size: 0.7rem;
  539. }
  540. .count {
  541. margin-left: 5px;
  542. color: dodgerblue;
  543. font-size: 0.7rem;
  544. }
  545. }
  546. .count-info-line .warnRtuCount {
  547. margin-left: 10px;
  548. display: flex;
  549. flex-direction: row;
  550. align-items: center;
  551. .name {
  552. color: dimgray;
  553. font-size: 0.7rem;
  554. }
  555. .count {
  556. margin-left: 5px;
  557. color: red;
  558. font-size: 0.7rem;
  559. }
  560. }
  561. </style>