index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196
  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. <div>
  11. <el-row>
  12. <el-col :span="4">
  13. <div class="box">
  14. <el-scrollbar>
  15. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick">
  16. <span class="el-tree-node__label" slot-scope="{ node, data }">
  17. <span>
  18. <i class="el-icon-office-building"></i>
  19. {{ (node || {}).label }}
  20. </span>
  21. </span>
  22. </avue-tree>
  23. </el-scrollbar>
  24. </div>
  25. </el-col>
  26. <el-col :span="20">
  27. <basic-container>
  28. <avue-crud :option="option" :table-loading="loading" :page.sync="page" :data="data" ref="crud"
  29. v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate"
  30. @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
  31. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  32. @refresh-change="refreshChange" @on-load="onLoad" @before-open="beforeOpen"
  33. @sort-change="sortChange" @cell-click="cellClick">
  34. <template slot-scope="scope" slot="menuLeft">
  35. <div class="line">
  36. <el-button type="primary" icon="el-icon-download" size="small"
  37. @click="openEquipmentListExportDialog">导出测站设备清单</el-button>
  38. <div class="lineText">
  39. <div>
  40. <span class="rtuCount">当前行政区测站总数量: </span> <span class="rtuCount"> {{
  41. countInfo.rtuCount
  42. }}</span>
  43. </div>
  44. </div>
  45. <div class="lineText">
  46. <span class="spliteLine">/</span>
  47. </div>
  48. <div class="lineText">
  49. <span class="warnRtuCount">当前行政区异常测站总数量: {{
  50. countInfo.warningRtuCount }}</span>
  51. </div>
  52. </div>
  53. </template>
  54. <template slot="runStatusId" slot-scope="row">
  55. <div v-if="row.row.runStatusId == 0" style="color: blue;">
  56. 正常
  57. </div>
  58. <div v-else-if="row.row.runStatusId == 1"
  59. style="color: red;cursor:pointer;text-decoration-line: underline;"
  60. @click="openWarningInfo(row.row)">
  61. 设备异常
  62. </div>
  63. <div v-else>
  64. </div>
  65. </template>
  66. <template slot-scope="{ row, index }" slot="menu">
  67. <el-button type="text" size="small" @click="openRtuDetail(row)" icon="el-icon-view">测站信息
  68. </el-button>
  69. <el-button type="text" size="small" @click="openWarnInfo(row)"
  70. icon="el-icon-warning-outline">异常信息
  71. </el-button>
  72. <el-button type="text" size="small" @click="openOrder(row)" icon="el-icon-edit-outline">维修任务
  73. </el-button>
  74. <el-button type="text" size="small" @click="openInspection(row)" icon="el-icon-date">设备巡检
  75. </el-button>
  76. <el-button type="text" size="small" @click="openRealData(row)" icon="el-icon-s-data">实时数据
  77. </el-button>
  78. <el-button v-if="permission.rtu_manage_btn_order" type="text" size="small"
  79. @click="toManageCheckOrder(row)" icon="el-icon-position">人工派单
  80. </el-button>
  81. </template>
  82. </avue-crud>
  83. </basic-container>
  84. </el-col>
  85. </el-row>
  86. <el-drawer :visible.sync="warnInfoDialog" v-if="warnInfoDialog" title="设备异常信息" direction="rtl" size="50%"
  87. append-to-body="true">
  88. <div slot="title" class="header-title">
  89. <span class="name">{{ dialogTitle }}</span>
  90. </div>
  91. <rtuwarnlist :rtuCode="rtuCode" ref="rtuwarnlist"></rtuwarnlist>
  92. </el-drawer>
  93. <el-drawer :visible.sync="warningInfoDialog" v-if="warningInfoDialog" title="设备异常信息" direction="rtl" size="50%"
  94. append-to-body="true">
  95. <div slot="title" class="header-title">
  96. <span class="name">{{ dialogTitle }}</span>
  97. </div>
  98. <rtuwarninglist :rtuCode="rtuCode" ref="rtuwarninglist"></rtuwarninglist>
  99. </el-drawer>
  100. <el-drawer :visible.sync="orderDialog" v-if="orderDialog" title="维修任务信息" direction="rtl" size="50%"
  101. append-to-body="true">
  102. <div slot="title" class="header-title">
  103. <span class="name">{{ dialogTitle }}</span>
  104. </div>
  105. <rtucheckorderlist :rtuCode="rtuCode" ref="rtucheckorderlist"></rtucheckorderlist>
  106. </el-drawer>
  107. <el-drawer :visible.sync="inspectionDialog" v-if="inspectionDialog" title="测站巡检信息" direction="rtl" size="50%"
  108. append-to-body="true">
  109. <div slot="title" class="header-title">
  110. <span class="name">{{ dialogTitle }}</span>
  111. </div>
  112. <inspectionreport :rtuCode="rtuCode" ref="inspectionreport"></inspectionreport>
  113. </el-drawer>
  114. <el-drawer :visible.sync="rtuDetailDialog" v-if="rtuDetailDialog" title="测站基础信息" direction="rtl" size="50%"
  115. append-to-body="true">
  116. <div slot="title" class="header-title">
  117. <span class="name">{{ dialogTitle }}</span>
  118. </div>
  119. <rtudetail :id="id" ref="rtudetail"></rtudetail>
  120. </el-drawer>
  121. <el-drawer :visible.sync="realDataDialog" v-if="realDataDialog" title="测站实时数据" direction="rtl" size="50%"
  122. append-to-body="true">
  123. <div slot="title" class="header-title">
  124. <span class="name">{{ dialogTitle }}</span>
  125. </div>
  126. <realdatadetail :rtuCode="rtuCode" :isRain="isRain" :isRiver="isRiver" :isRes="isRes" :isGround="isGround"
  127. ref="realdatadetail"></realdatadetail>
  128. </el-drawer>
  129. <el-drawer :visible.sync="rtureplacelistDialog" v-if="rtureplacelistDialog" title="测站RTU更换信息" direction="rtl"
  130. size="50%" append-to-body="true">
  131. <div slot="title" class="header-title">
  132. <span class="name">{{ dialogTitle }}</span>
  133. </div>
  134. <rtureplacelist :rtuCode="rtuCode" ref="rtureplacelist"></rtureplacelist>
  135. </el-drawer>
  136. <el-drawer :visible.sync="rainsensorreplacelistDialog" v-if="rainsensorreplacelistDialog" title="测站雨量计更换信息"
  137. direction="rtl" size="50%" append-to-body="true">
  138. <div slot="title" class="header-title">
  139. <span class="name">{{ dialogTitle }}</span>
  140. </div>
  141. <rainsensorreplacelist :rtuCode="rtuCode" ref="rainsensorreplacelist"></rainsensorreplacelist>
  142. </el-drawer>
  143. <el-drawer :visible.sync="watersensorreplacelistDialog" v-if="watersensorreplacelistDialog" title="测站水位计更换信息"
  144. direction="rtl" size="50%" append-to-body="true">
  145. <div slot="title" class="header-title">
  146. <span class="name">{{ dialogTitle }}</span>
  147. </div>
  148. <watersensorreplacelist :rtuCode="rtuCode" ref="watersensorreplacelist"></watersensorreplacelist>
  149. </el-drawer>
  150. <el-drawer :visible.sync="groundsensorreplacelistDialog" v-if="groundsensorreplacelistDialog" title="测站墒情计更换信息"
  151. direction="rtl" size="50%" append-to-body="true">
  152. <div slot="title" class="header-title">
  153. <span class="name">{{ dialogTitle }}</span>
  154. </div>
  155. <groundsensorreplacelist :rtuCode="rtuCode" ref="groundsensorreplacelist"></groundsensorreplacelist>
  156. </el-drawer>
  157. <el-drawer :visible.sync="batteryreplacelistDialog" v-if="batteryreplacelistDialog" title="测站蓄电池更换信息"
  158. direction="rtl" size="50%" append-to-body="true">
  159. <div slot="title" class="header-title">
  160. <span class="name">{{ dialogTitle }}</span>
  161. </div>
  162. <batteryreplacelist :rtuCode="rtuCode" ref="batteryreplacelist"></batteryreplacelist>
  163. </el-drawer>
  164. <el-dialog title="人工派单" :visible.sync="addCheckOrderDialog" v-if="addCheckOrderDialog" width="800px"
  165. :close-on-click-modal="false" append-to-body>
  166. <avue-form :option="checkOrderOption" v-model="checkOrderForm" @submit="addCheckOrder" />
  167. </el-dialog>
  168. <el-dialog title="测站设备数据导出" :visible.sync="exportDialog" v-if="exportDialog" width="800px"
  169. :close-on-click-modal="false" append-to-body>
  170. <el-form label-width="160px">
  171. <el-form-item label="当前行政区划名称">
  172. <el-input v-model="adcdName" aria-readonly="true"></el-input>
  173. </el-form-item>
  174. </el-form>
  175. <span slot="footer" class="dialog-footer">
  176. <el-button @click="exportDialog = false" size="small">取 消</el-button>
  177. <el-button type="primary" @click="equipmentListExport" size="small">导 出</el-button>
  178. </span>
  179. </el-dialog>
  180. </div>
  181. </template>
  182. <script>
  183. import { getList, getDetail, add, update, remove, equipmentExport, getCountInfo } from "@/api/business/manage/manage.js";
  184. import { manuallyOrder } from "@/api/business/order/order.js";
  185. import { getTree } from "@/api/baseinfo/region.js";
  186. import rtuwarninglist from "../warning/rtuwarninglist.vue";
  187. import rtuwarnlist from "../warning/rtuwarnlist.vue";
  188. import rtucheckorderlist from "../order/rtucheckorderlist.vue";
  189. import rtudetail from "./rtudetail.vue";
  190. import inspectionreport from "./inspectionreport.vue";
  191. import realdatadetail from "./realdatadetail.vue";
  192. import rtureplacelist from "./rtureplacelist.vue";
  193. import rainsensorreplacelist from "./rainsensorreplacelist.vue";
  194. import watersensorreplacelist from "./watersensorreplacelist.vue";
  195. import groundsensorreplacelist from "./groundsensorreplacelist.vue";
  196. import batteryreplacelist from "./batteryreplacelist.vue";
  197. import { mapGetters } from "vuex";
  198. export default {
  199. components: {
  200. rtuwarnlist,
  201. rtuwarninglist,
  202. rtucheckorderlist,
  203. rtudetail,
  204. inspectionreport,
  205. realdatadetail,
  206. rtureplacelist,
  207. rainsensorreplacelist,
  208. watersensorreplacelist,
  209. groundsensorreplacelist,
  210. batteryreplacelist
  211. },
  212. data() {
  213. return {
  214. id: "",
  215. orderDialog: false,
  216. warnInfoDialog: false,
  217. warningInfoDialog: false,
  218. exportDialog: false,
  219. rtuDetailDialog: false,
  220. inspectionDialog: false,
  221. realDataDialog: false,
  222. addCheckOrderDialog: false,
  223. rtureplacelistDialog: false,
  224. rainsensorreplacelistDialog: false,
  225. watersensorreplacelistDialog: false,
  226. groundsensorreplacelistDialog: false,
  227. batteryreplacelistDialog: false,
  228. dialogTitle: "",
  229. rtuCode: '',
  230. isRain: '',
  231. isRiver: '',
  232. isRes: '',
  233. isGround: '',
  234. checked: true,
  235. countInfo: {
  236. rtuCount: 0,
  237. warnRtuCount: 0,
  238. },
  239. checkOrderForm: {
  240. id: '',
  241. rtuName: '',
  242. rtuCode: '',
  243. orderDesc: '',
  244. },
  245. checkOrderOption: {
  246. labelWidth: 100,
  247. emptyBtn: false,
  248. column: [
  249. {
  250. label: "id",
  251. prop: "id",
  252. span: 24,
  253. display: false,
  254. type: 'input'
  255. },
  256. {
  257. label: "测站编码",
  258. prop: "rtuCode",
  259. span: 24,
  260. readonly: true,
  261. clearable: false,
  262. rules: [{
  263. required: true,
  264. message: "请输入测站编码",
  265. trigger: "blur"
  266. }]
  267. },
  268. {
  269. label: "测站名称",
  270. prop: "rtuName",
  271. span: 24,
  272. readonly: true,
  273. clearable: false,
  274. rules: [{
  275. required: true,
  276. message: "请输入测站名称",
  277. trigger: "blur"
  278. }]
  279. },
  280. {
  281. label: "任务说明",
  282. prop: "orderDesc",
  283. span: 24,
  284. rules: [{
  285. required: true,
  286. message: "请输入任务说明",
  287. trigger: "blur"
  288. }]
  289. },
  290. ]
  291. },
  292. form: {},
  293. selectionList: [],
  294. query: {},
  295. sort: {},
  296. loading: true,
  297. page: {
  298. pageSize: 10,
  299. currentPage: 1,
  300. total: 0,
  301. },
  302. treeCode: '',
  303. treeParentCode: '',
  304. adcdName: '',
  305. treeData: [],
  306. treeOption: {
  307. nodeKey: "id",
  308. defaultExpandedKeys: [],
  309. lazy: false,
  310. addBtn: false,
  311. menu: true,
  312. size: "small",
  313. props: {
  314. labelText: "标题",
  315. label: "title",
  316. value: "value",
  317. children: "children",
  318. },
  319. },
  320. option: {
  321. labelWidth: 140,
  322. viewLabelWidth: 140,
  323. searchlabelWidth: 140,
  324. height: "auto",
  325. calcHeight: 80,
  326. align: "center",
  327. headerAlign: "center",
  328. tip: false,
  329. simplePage: true,
  330. searchShow: true,
  331. searchMenuSpan: 6,
  332. tree: true,
  333. border: true,
  334. index: true,
  335. selection: false,
  336. viewBtn: false,
  337. editBtn: false,
  338. delBtn: false,
  339. addBtn: false,
  340. menuWidth: 300,
  341. dialogType: "drawer",
  342. dialogClickModal: false,
  343. columnBtn: false,
  344. column: [
  345. {
  346. label: "测站编码",
  347. prop: "rtuCode",
  348. span: 6,
  349. width: 120,
  350. search: true,
  351. searchSpan: 5,
  352. },
  353. {
  354. label: "测站名称",
  355. prop: "rtuName",
  356. search: true,
  357. searchSpan: 5,
  358. span: 6,
  359. width: 120,
  360. // html: true,
  361. // formatter: (val) => {
  362. // if (val.rtuName) {
  363. // return '<b>' + val.rtuName + '</b>/' + '<b style="color:grey">' + val.rtuCode + '</b>'
  364. // } else {
  365. // return '<b style="color:grey">' + val.rtuName + '</b>'
  366. // }
  367. // }
  368. },
  369. {
  370. label: "运行状态",
  371. prop: "runStatusId",
  372. span: 24,
  373. width: 100,
  374. //html:true,
  375. // formatter:(val)=>{
  376. // if(val.runStatusId==0){
  377. // return '<b style="color:blue">正常</b>'
  378. // }else{
  379. // return '<b style="color:orangered">预警</b>'
  380. // }
  381. // }
  382. },
  383. {
  384. label: "最后上线时间",
  385. prop: "lastUpTime",
  386. span: 24,
  387. width: 160,
  388. sortable: 'custom',
  389. },
  390. {
  391. label: "实时数据",
  392. prop: "isRain",
  393. span: 24,
  394. width: 160,
  395. overHidden: true,
  396. html: true,
  397. formatter: (val) => {
  398. let htmltext = '';
  399. if (val.isRain == 1 && val.drp) {
  400. htmltext = htmltext + '<b style="color:grey">降水:' + val.drp + '</b>';
  401. }
  402. if (val.isRiver == 1 && val.z) {
  403. if (htmltext.length > 0) {
  404. htmltext = htmltext + '/';
  405. }
  406. htmltext = htmltext + '<b style="color:grey">水位:' + val.z + '</b>';
  407. }
  408. else if (val.isRes == 1 && val.rz) {
  409. if (htmltext.length > 0) {
  410. htmltext = htmltext + '/';
  411. }
  412. htmltext = htmltext + '<b style="color:grey">水位:' + val.rz + '</b>';
  413. }
  414. if (val.isGround == 1 && val.ground) {
  415. if (htmltext.length > 0) {
  416. htmltext = htmltext + '/';
  417. }
  418. htmltext = htmltext + '<b style="color:grey">墒情含水层:' + val.ground + '</b>';
  419. }
  420. return htmltext;
  421. }
  422. },
  423. {
  424. label: "测站类型",
  425. prop: "rtuKindDesc",
  426. span: 24,
  427. width: 160
  428. },
  429. {
  430. label: '测站类型',
  431. prop: 'rtuKind',
  432. type: 'select',
  433. width: 100,
  434. hide: true,
  435. editDisplay: false,
  436. addDisplay: false,
  437. search: true,
  438. searchSpan: 5,
  439. props: {
  440. label: 'name',
  441. value: 'code'
  442. },
  443. span: 6,
  444. dicData: [{
  445. name: '雨量站',
  446. code: 1
  447. }, {
  448. name: '水位站',
  449. code: 2
  450. }, {
  451. name: '墒情站',
  452. code: 3
  453. }, {
  454. name: '视频站',
  455. code: 4
  456. }]
  457. },
  458. {
  459. label: '异常类型',
  460. prop: 'warnKind',
  461. type: 'select',
  462. width: 100,
  463. hide: true,
  464. editDisplay: false,
  465. addDisplay: false,
  466. search: true,
  467. searchSpan: 5,
  468. props: {
  469. label: 'name',
  470. value: 'code'
  471. },
  472. span: 6,
  473. dicData: [{
  474. name: '测站离线',
  475. code: 1
  476. }, {
  477. name: '测站时钟异常',
  478. code: 2
  479. }, {
  480. name: '测站雨量小时报漏报',
  481. code: 3
  482. }, {
  483. name: '测站水位小时报漏报',
  484. code: 4
  485. }, {
  486. name: '雨量5分钟上报延时',
  487. code: 5
  488. }, {
  489. name: '雨量站小时上报延时',
  490. code: 6
  491. }, {
  492. name: '水位站小时上报延时',
  493. code: 7
  494. }, {
  495. name: '雨量疑似异常值',
  496. code: 8
  497. }]
  498. },
  499. {
  500. label: "行政区",
  501. prop: "areaName",
  502. span: 24,
  503. width: 120,
  504. editDisplay: false,
  505. addDisplay: false,
  506. },
  507. {
  508. label: "测站位置",
  509. prop: "locationDesc",
  510. span: 24,
  511. width: 180,
  512. editDisplay: false,
  513. addDisplay: false,
  514. overHidden: true,
  515. },
  516. {
  517. label: "经度",
  518. prop: "lng",
  519. span: 24,
  520. width: 120,
  521. editDisplay: false,
  522. addDisplay: false,
  523. },
  524. {
  525. label: "纬度",
  526. prop: "lat",
  527. span: 24,
  528. width: 120,
  529. editDisplay: false,
  530. addDisplay: false,
  531. },
  532. {
  533. label: "RTU品牌",
  534. prop: "rtuBrand",
  535. span: 24,
  536. width: 120,
  537. editDisplay: false,
  538. addDisplay: false,
  539. },
  540. {
  541. label: "RTU型号",
  542. prop: "rtuModel",
  543. span: 24,
  544. width: 120,
  545. editDisplay: false,
  546. addDisplay: false,
  547. },
  548. {
  549. label: "RTU更换时间",
  550. prop: "rtuReplaceDate",
  551. span: 24,
  552. width: 120,
  553. editDisplay: false,
  554. addDisplay: false,
  555. html: true,
  556. formatter: (val) => {
  557. if (val.rtuReplaceDate) {
  558. let htmltext = '<b style="cursor:pointer;text-decoration-line: underline;color:blue">' + val.rtuReplaceDate + '</b>';
  559. return htmltext;
  560. }
  561. }
  562. },
  563. {
  564. label: "雨量计品牌",
  565. prop: "rainSensorBrand",
  566. span: 24,
  567. width: 120,
  568. editDisplay: false,
  569. addDisplay: false,
  570. },
  571. {
  572. label: "雨量计型号",
  573. prop: "rainSensorModel",
  574. span: 24,
  575. width: 120,
  576. editDisplay: false,
  577. addDisplay: false,
  578. },
  579. {
  580. label: "雨量计更换时间",
  581. prop: "rainSensorReplaceDate",
  582. span: 24,
  583. width: 120,
  584. editDisplay: false,
  585. addDisplay: false,
  586. html: true,
  587. formatter: (val) => {
  588. if (val.rainSensorReplaceDate) {
  589. let htmltext = '<b style="cursor:pointer;text-decoration-line: underline;color:blue">' + val.rainSensorReplaceDate + '</b>';
  590. return htmltext;
  591. }
  592. }
  593. },
  594. {
  595. label: "水位计品牌",
  596. prop: "waterSensorBrand",
  597. span: 24,
  598. width: 120,
  599. editDisplay: false,
  600. addDisplay: false,
  601. },
  602. {
  603. label: "水位计型号",
  604. prop: "waterSensorModel",
  605. span: 24,
  606. width: 120,
  607. editDisplay: false,
  608. addDisplay: false,
  609. },
  610. {
  611. label: "水位计更换时间",
  612. prop: "waterSensorReplaceDate",
  613. span: 24,
  614. width: 120,
  615. editDisplay: false,
  616. addDisplay: false,
  617. html: true,
  618. formatter: (val) => {
  619. if (val.waterSensorReplaceDate) {
  620. let htmltext = '<b style="cursor:pointer;text-decoration-line: underline;color:blue">' + val.waterSensorReplaceDate + '</b>';
  621. return htmltext;
  622. }
  623. }
  624. },
  625. {
  626. label: "墒情计品牌",
  627. prop: "groundSensorBrand",
  628. span: 24,
  629. width: 120,
  630. editDisplay: false,
  631. addDisplay: false,
  632. },
  633. {
  634. label: "墒情计型号",
  635. prop: "groundSensorModel",
  636. span: 24,
  637. width: 120,
  638. editDisplay: false,
  639. addDisplay: false,
  640. },
  641. {
  642. label: "墒情计更换时间",
  643. prop: "groundSensorReplaceDate",
  644. span: 24,
  645. width: 120,
  646. editDisplay: false,
  647. addDisplay: false,
  648. html: true,
  649. formatter: (val) => {
  650. if (val.groundSensorReplaceDate) {
  651. let htmltext = '<b style="cursor:pointer;text-decoration-line: underline;color:blue">' + val.groundSensorReplaceDate + '</b>';
  652. return htmltext;
  653. }
  654. }
  655. }, {
  656. label: "蓄电池容量",
  657. prop: "batteryModel",
  658. span: 24,
  659. width: 120,
  660. editDisplay: false,
  661. addDisplay: false,
  662. }, {
  663. label: "蓄电池更换时间",
  664. prop: "batteryReplaceDate",
  665. span: 24,
  666. width: 120,
  667. editDisplay: false,
  668. addDisplay: false,
  669. html: true,
  670. formatter: (val) => {
  671. if (val.batteryReplaceDate) {
  672. let htmltext = '<b style="cursor:pointer;text-decoration-line: underline;color:blue">' + val.batteryReplaceDate + '</b>';
  673. return htmltext;
  674. }
  675. }
  676. }, {
  677. label: "太阳能板",
  678. prop: "sunPowerModel",
  679. span: 24,
  680. width: 120,
  681. editDisplay: false,
  682. addDisplay: false,
  683. }, {
  684. label: "SIM卡号",
  685. prop: "networkSimId",
  686. span: 24,
  687. width: 120,
  688. editDisplay: false,
  689. addDisplay: false,
  690. }, {
  691. label: "SIM卡开卡单位",
  692. prop: "networkPayer",
  693. span: 24,
  694. width: 120,
  695. editDisplay: false,
  696. addDisplay: false,
  697. }, {
  698. label: "SIM卡缴费截止时间",
  699. prop: "networkPayEndDate",
  700. span: 24,
  701. width: 120,
  702. editDisplay: false,
  703. addDisplay: false,
  704. html: true,
  705. formatter: (val) => {
  706. if (val.networkPayEndDate) {
  707. let htmltext = '<b style="color:grey">' + val.networkPayEndDate + '</b>';
  708. return htmltext;
  709. }
  710. }
  711. }, {
  712. label: "是否卫星通讯",
  713. prop: "isSatellite",
  714. span: 24,
  715. width: 120,
  716. editDisplay: false,
  717. addDisplay: false,
  718. html: true,
  719. formatter: (val) => {
  720. let htmltext = '';
  721. if (val.isSatellite !== null) {
  722. if (val.isSatellite === 0) {
  723. htmltext = htmltext + '<b style="color:grey">否</b>';
  724. } else {
  725. htmltext = htmltext + '<b style="color:grey">是</b>';
  726. }
  727. }
  728. return htmltext;
  729. }
  730. },
  731. ],
  732. },
  733. data: [],
  734. };
  735. },
  736. computed: {
  737. ...mapGetters(["userInfo", "permission"]),
  738. permissionList() {
  739. return {
  740. addBtn: false,
  741. viewBtn: false,
  742. delBtn: false,
  743. editBtn: false,
  744. };
  745. },
  746. ids() {
  747. let ids = [];
  748. this.selectionList.forEach((ele) => {
  749. ids.push(ele.id);
  750. });
  751. return ids.join(",");
  752. },
  753. },
  754. mounted() { },
  755. created() {
  756. this.initTree();
  757. },
  758. methods: {
  759. initTree() {
  760. this.treeData = [];
  761. getTree().then(res => {
  762. this.treeData = res.data.data.map(item => {
  763. return {
  764. ...item,
  765. leaf: !item.hasChildren
  766. }
  767. })
  768. this.treeOption.defaultExpandedKeys.push(this.treeData[0].id);
  769. this.treeCode = this.treeData[0].id;
  770. this.query = {};
  771. this.query['adCode'] = this.treeCode;
  772. this.adcdName = this.treeData[0].title;
  773. this.getCountInfo(this.treeCode);
  774. });
  775. },
  776. toOss(path) {
  777. return this.website.ossServer + path;
  778. },
  779. nodeClick(data) {
  780. this.treeCode = data.id;
  781. this.adcdName = data.title;
  782. this.treeParentCode = data.parentId;
  783. this.query = {};
  784. this.query['adCode'] = this.treeCode;
  785. this.page.currentPage = 1;
  786. var params = {};
  787. this.onLoad(this.page, params);
  788. this.getCountInfo(this.treeCode);
  789. },
  790. sortChange(val) {
  791. console.log(JSON.stringify(val))
  792. //prop":"tm","order":"ascending" descending
  793. let prop = val.prop;
  794. if (prop === 'lastUpTime') {
  795. this.page.currentPage = 1;
  796. var params = {};
  797. let order = val.order;
  798. if (order) {
  799. params['order'] = order;
  800. params['prop'] = prop;
  801. this.sort = {};
  802. Object.assign(this.sort, params)
  803. } else {
  804. this.sort = {};
  805. }
  806. this.onLoad(this.page);
  807. }
  808. },
  809. cellClick(row, column, cell, event) {
  810. if (event.isTrusted) {
  811. this.rtuCode = row.rtuCode;
  812. if (column.label === 'RTU更换时间') {
  813. if (row.rtuReplaceDate) {
  814. this.dialogTitle = row.rtuName + 'RTU更换信息';
  815. this.rtureplacelistDialog = true;
  816. this.$nextTick(() => {
  817. this.$refs["rtureplacelist"].init();
  818. });
  819. }
  820. } else if (column.label === '雨量计更换时间') {
  821. if (row.rainSensorReplaceDate) {
  822. this.dialogTitle = row.rtuName + '雨量计更换信息';
  823. this.rainsensorreplacelistDialog = true;
  824. this.$nextTick(() => {
  825. this.$refs["rainsensorreplacelist"].init();
  826. });
  827. }
  828. } else if (column.label === '水位计更换时间') {
  829. if (row.waterSensorReplaceDate) {
  830. this.dialogTitle = row.rtuName + '水位计更换信息';
  831. this.watersensorreplacelistDialog = true;
  832. this.$nextTick(() => {
  833. this.$refs["watersensorreplacelist"].init();
  834. });
  835. }
  836. } else if (column.label === '墒情计更换时间') {
  837. if (row.groundSensorReplaceDate) {
  838. this.dialogTitle = row.rtuName + '墒情计更换信息';
  839. this.groundsensorreplacelistDialog = true;
  840. this.$nextTick(() => {
  841. this.$refs["groundsensorreplacelist"].init();
  842. });
  843. }
  844. } else if (column.label === '蓄电池更换时间') {
  845. if (row.batteryReplaceDate) {
  846. this.dialogTitle = row.rtuName + '蓄电池更换信息';
  847. this.batteryreplacelistDialog = true;
  848. this.$nextTick(() => {
  849. this.$refs["batteryreplacelist"].init();
  850. });
  851. }
  852. }
  853. }
  854. },
  855. getCountInfo(adCode) {
  856. getCountInfo(adCode
  857. ).then((res) => {
  858. this.countInfo = res.data.data;
  859. });
  860. },
  861. addCheckOrder(form, done) {
  862. manuallyOrder(form
  863. ).then((res) => {
  864. console.log(res)
  865. this.$message({
  866. type: "success",
  867. message: "提交成功",
  868. });
  869. this.addCheckOrderDialog = false;
  870. done();
  871. }, (error) => {
  872. console.log(error)
  873. this.addCheckOrderDialog = false;
  874. done();
  875. });
  876. },
  877. openWarnInfo(item) {
  878. window.console.log(JSON.stringify(item));
  879. this.rtuCode = item.rtuCode;
  880. this.dialogTitle = "异常信息[" + item.rtuName + item.rtuCode + "]";
  881. this.warnInfoDialog = true;
  882. this.$nextTick(() => {
  883. this.$refs["rtuwarnlist"].init();
  884. });
  885. },
  886. openWarningInfo(item) {
  887. window.console.log(JSON.stringify(item));
  888. this.rtuCode = item.rtuCode;
  889. this.dialogTitle = "设备异常信息[" + item.rtuName + item.rtuCode + "]";
  890. this.warningInfoDialog = true;
  891. this.$nextTick(() => {
  892. this.$refs["rtuwarninglist"].init();
  893. });
  894. },
  895. openOrder(item) {
  896. this.rtuCode = item.rtuCode;
  897. this.dialogTitle = "维修任务[" + item.rtuName + item.rtuCode + "]";
  898. this.orderDialog = true;
  899. this.$nextTick(() => {
  900. this.$refs["rtucheckorderlist"].init();
  901. });
  902. },
  903. openInspection(item) {
  904. this.rtuCode = item.rtuCode;
  905. this.dialogTitle = "巡检信息[" + item.rtuName + item.rtuCode + "]";
  906. this.inspectionDialog = true;
  907. this.$nextTick(() => {
  908. this.$refs["inspectionreport"].init();
  909. });
  910. },
  911. openRtuDetail(item) {
  912. this.id = item.id;
  913. this.dialogTitle = "测站设备[" + item.rtuName + item.rtuCode + "]";
  914. this.rtuDetailDialog = true;
  915. this.$nextTick(() => {
  916. this.$refs["rtudetail"].init();
  917. });
  918. },
  919. openRealData(item) {
  920. this.rtuCode = item.rtuCode;
  921. this.isRain = item.isRain;
  922. this.isRiver = item.isRiver;
  923. this.isRes = item.isRes;
  924. this.isGround = item.isGround;
  925. this.dialogTitle = "实时数据[" + item.rtuName + item.rtuCode + "]";
  926. this.realDataDialog = true;
  927. this.$nextTick(() => {
  928. this.$refs["realdatadetail"].init();
  929. });
  930. },
  931. toManageCheckOrder(item) {
  932. this.id = item.id;
  933. this.dialogTitle = "人工派单[" + item.rtuName + item.rtuCode + "]";
  934. this.checkOrderForm.id = this.id;
  935. this.checkOrderForm.rtuCode = item.rtuCode;
  936. this.checkOrderForm.rtuName = item.rtuName;
  937. this.checkOrderForm.orderDesc = '';
  938. this.addCheckOrderDialog = true;
  939. },
  940. openEquipmentListExportDialog() {
  941. this.exportDialog = true;
  942. },
  943. getBlob(url) {
  944. return new Promise(resolve => {
  945. const xhr = new XMLHttpRequest();
  946. xhr.open("GET", url, true);
  947. xhr.responseType = "blob";
  948. xhr.crossOrigin = "*";
  949. xhr.onload = () => {
  950. if (xhr.status === 200) {
  951. resolve(xhr.response);
  952. }
  953. };
  954. xhr.send();
  955. })
  956. },
  957. saveAs(blob, filename) {
  958. // if (window.navigator.msSaveOrOpenBlob) {
  959. // navigator.msSaveBlob(blob, filename);
  960. // } else {
  961. const link = document.createElement('a');
  962. const body = document.querySelector("body");
  963. link.href = window.URL.createObjectURL(blob);
  964. link.download = filename;
  965. link.style.display = "none";
  966. body.appendChild(link);
  967. //var event = new MouseEvent('click')
  968. //link.dispatchEvent(event)
  969. link.click();
  970. body.removeChild(link);
  971. window.URL.revokeObjectURL(link.href);
  972. // }
  973. },
  974. equipmentListExport() {
  975. let that = this;
  976. equipmentExport(this.treeCode, this.adcdName).then(
  977. (res) => {
  978. window.console.log(JSON.stringify(res));
  979. that.exportDialog = false;
  980. if (res.data.data.status == 1) {
  981. this.$message({
  982. type: "success",
  983. message: "导出成功!",
  984. });
  985. var url = res.data.data.url;
  986. var filename = res.data.data.filename;
  987. this.getBlob(this.toOss(url)).then(res => {
  988. this.saveAs(res, filename + ".xlsx");
  989. });
  990. } else {
  991. this.$message({
  992. type: "fail",
  993. message: "操作失败!",
  994. });
  995. }
  996. },
  997. (error) => {
  998. that.exportDialog = false;
  999. window.console.log(error);
  1000. this.$message({
  1001. type: "fail",
  1002. message: "操作失败!",
  1003. });
  1004. }
  1005. );
  1006. },
  1007. rowSave(row, done, loading) {
  1008. add(row).then(
  1009. () => {
  1010. this.onLoad(this.page);
  1011. this.$message({
  1012. type: "success",
  1013. message: "操作成功!",
  1014. });
  1015. done();
  1016. },
  1017. (error) => {
  1018. window.console.log(error);
  1019. loading();
  1020. }
  1021. );
  1022. },
  1023. rowUpdate(row, index, done, loading) {
  1024. update(row).then(
  1025. () => {
  1026. this.onLoad(this.page);
  1027. this.$message({
  1028. type: "success",
  1029. message: "操作成功!",
  1030. });
  1031. done();
  1032. },
  1033. (error) => {
  1034. window.console.log(error);
  1035. loading();
  1036. }
  1037. );
  1038. },
  1039. rowDel(row) {
  1040. this.$confirm("确定将选择数据删除?", {
  1041. confirmButtonText: "确定",
  1042. cancelButtonText: "取消",
  1043. type: "warning",
  1044. })
  1045. .then(() => {
  1046. return remove(row.id);
  1047. })
  1048. .then(() => {
  1049. this.onLoad(this.page);
  1050. this.$message({
  1051. type: "success",
  1052. message: "操作成功!",
  1053. });
  1054. });
  1055. },
  1056. searchReset() {
  1057. this.query = {};
  1058. this.query['adCode'] = this.treeCode;
  1059. this.page.currentPage = 1;
  1060. this.onLoad(this.page);
  1061. },
  1062. searchChange(params, done) {
  1063. this.query = {};
  1064. this.query['adCode'] = this.treeCode;
  1065. Object.assign(this.query, params)
  1066. this.page.currentPage = 1;
  1067. this.onLoad(this.page, params);
  1068. done();
  1069. },
  1070. selectionChange(list) {
  1071. this.selectionList = list;
  1072. },
  1073. selectionClear() {
  1074. this.selectionList = [];
  1075. this.$refs.crud.toggleSelection();
  1076. },
  1077. handleDelete() {
  1078. if (this.selectionList.length === 0) {
  1079. this.$message.warning("请选择至少一条数据");
  1080. return;
  1081. }
  1082. this.$confirm("确定将选择数据删除?", {
  1083. confirmButtonText: "确定",
  1084. cancelButtonText: "取消",
  1085. type: "warning",
  1086. })
  1087. .then(() => {
  1088. return remove(this.ids);
  1089. })
  1090. .then(() => {
  1091. this.onLoad(this.page);
  1092. this.$message({
  1093. type: "success",
  1094. message: "操作成功!",
  1095. });
  1096. this.$refs.crud.toggleSelection();
  1097. });
  1098. },
  1099. beforeOpen(done, type) {
  1100. if (["edit", "view"].includes(type)) {
  1101. getDetail(this.form.id).then((res) => {
  1102. this.form = res.data.data;
  1103. });
  1104. }
  1105. done();
  1106. },
  1107. currentChange(currentPage) {
  1108. this.page.currentPage = currentPage;
  1109. },
  1110. sizeChange(pageSize) {
  1111. this.page.pageSize = pageSize;
  1112. },
  1113. refreshChange() {
  1114. var params = {};
  1115. this.onLoad(this.page, params);
  1116. },
  1117. onLoad(page, params = {}) {
  1118. this.loading = true;
  1119. getList(
  1120. page.currentPage,
  1121. page.pageSize,
  1122. Object.assign(params, this.sort, this.query)
  1123. ).then((res) => {
  1124. const data = res.data.data;
  1125. console.log(JSON.stringify(data))
  1126. this.page.total = data.total;
  1127. this.data = data.records;
  1128. this.loading = false;
  1129. this.selectionClear();
  1130. });
  1131. },
  1132. },
  1133. };
  1134. </script>
  1135. <style lang="scss" scoped>
  1136. .cell-click-line {
  1137. text-decoration-line: underline;
  1138. }
  1139. .line {
  1140. display: flex;
  1141. flex-direction: row;
  1142. justify-content: flex-start;
  1143. }
  1144. .line .lineText {
  1145. margin-left: 10px;
  1146. margin-right: 0px;
  1147. display: flex;
  1148. flex-direction: column;
  1149. justify-content: center;
  1150. }
  1151. .line .lineText .spliteLine {
  1152. color: gray;
  1153. font-size: 0.8rem;
  1154. }
  1155. .line .lineText .adname {
  1156. color: dodgerblue;
  1157. font-size: 0.8rem;
  1158. }
  1159. .line .lineText .rtuCount {
  1160. color: darkcyan;
  1161. font-size: 0.8rem;
  1162. }
  1163. .line .lineText .warnRtuCount {
  1164. color: lightcoral;
  1165. font-size: 0.8rem;
  1166. }
  1167. </style>