index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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. <basic-container>
  16. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick">
  17. <span class="el-tree-node__label" slot-scope="{ node, data }">
  18. <span>
  19. <i class="el-icon-office-building"></i>
  20. {{ (node || {}).label }}
  21. </span>
  22. </span>
  23. </avue-tree>
  24. </basic-container>
  25. </el-scrollbar>
  26. </div>
  27. </el-col>
  28. <el-col :span="20">
  29. <basic-container>
  30. <avue-crud :option="option" :table-loading="loading" :page.sync="page" :data="data" ref="crud"
  31. v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate"
  32. @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
  33. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  34. @refresh-change="refreshChange" @on-load="onLoad" @sort-change="sortChange">
  35. <template slot-scope="scope" slot="menuLeft">
  36. <div class="line">
  37. <div class="lineText">
  38. <span class="inspectionCount">本年度已巡检设备数量(至少一次): {{ inspectionCountInfo.inspectionCount
  39. }}</span>
  40. </div>
  41. <div class="lineText">
  42. <span style="color: gray;">/</span>
  43. </div>
  44. <div class="lineText">
  45. <span class="beforeRainInspectionCount">汛前巡检设备数量: {{
  46. inspectionCountInfo.beforeRainInspectionCount
  47. }}</span>
  48. </div>
  49. <div class="lineText">
  50. <span style="color: gray;">/</span>
  51. </div>
  52. <div class="lineText">
  53. <span class="rainFirstInspectionCount">汛中第一次巡检设备数量: {{
  54. inspectionCountInfo.firstRainInspectionCount
  55. }}</span>
  56. </div>
  57. <div class="lineText">
  58. <span style="color: gray;">/</span>
  59. </div>
  60. <div class="lineText">
  61. <span class="rainSencodInspectionCount">汛中第二次巡检设备数量: {{
  62. inspectionCountInfo.sencodRainInspectionCount
  63. }}</span>
  64. </div>
  65. </div>
  66. </template>
  67. <template slot-scope="{ row, index }" slot="menu">
  68. <el-button type="text" size="small" @click="openBeforeRainReportDetail(row)"
  69. icon="el-icon-edit-outline">汛前详情
  70. </el-button>
  71. <el-button type="text" size="small" @click="openRainFirstReportDetail(row)"
  72. icon="el-icon-edit-outline">汛中(一)详情
  73. </el-button>
  74. <el-button type="text" size="small" @click="openRainSencodReportDetail(row)"
  75. icon="el-icon-edit-outline">汛中(二)详情
  76. </el-button>
  77. </template>
  78. </avue-crud>
  79. </basic-container>
  80. </el-col>
  81. </el-row>
  82. <el-drawer title="巡检填报记录" :visible.sync="reportDialog" v-if="reportDialog" :size="drawerSize" :direction="direction"
  83. :close-on-click-modal="false" append-to-body>
  84. <div slot="title" class="header-title">
  85. <span class="name">{{ dialogTitle }}</span>
  86. </div>
  87. <inspectionreportdetail :id="id" ref="inspectionreportdetail"></inspectionreportdetail>
  88. </el-drawer>
  89. </div>
  90. </template>
  91. <script>
  92. import {
  93. getPage,
  94. getCountInfo,
  95. } from "@/api/business/inspection/inspection.js";
  96. import { getTree } from "@/api/baseinfo/region.js";
  97. import { mapGetters } from "vuex";
  98. import inspectionreportdetail from "./inspectionreportdetail.vue";
  99. export default {
  100. components: {
  101. inspectionreportdetail,
  102. },
  103. data() {
  104. return {
  105. id: '',
  106. inspectionDate: '',
  107. beforeRainSeasonReportId: '',
  108. rainSeasonFirstReportId: '',
  109. rainSeasonSecondReportId: '',
  110. inspectionCountInfo: {
  111. },
  112. drawerSize: '50%',
  113. reportDialog: false,
  114. dialogTitle: '',
  115. selectionList: [],
  116. query: {},
  117. sort: {},
  118. loading: true,
  119. page: {
  120. pageSize: 10,
  121. currentPage: 1,
  122. total: 0,
  123. },
  124. treeCode: '',
  125. treeParentCode: '',
  126. treeData: [],
  127. treeOption: {
  128. nodeKey: "id",
  129. defaultExpandedKeys: [],
  130. lazy: false,
  131. addBtn: false,
  132. menu: true,
  133. size: "small",
  134. props: {
  135. labelText: "标题",
  136. label: "title",
  137. value: "value",
  138. children: "children",
  139. },
  140. },
  141. option: {
  142. labelWidth: 140,
  143. viewLabelWidth: 140,
  144. searchlabelWidth: 140,
  145. height: "auto",
  146. calcHeight: 80,
  147. align: "center",
  148. headerAlign: "center",
  149. tip: true,
  150. simplePage: true,
  151. searchShow: true,
  152. searchMenuSpan: 6,
  153. addBtn: false,
  154. border: true,
  155. index: true,
  156. editBtn: false,
  157. delBtn: false,
  158. viewBtn: false,
  159. menuWidth: 300,
  160. dialogType: "drawer",
  161. dialogClickModal: false,
  162. columnBtn: false,
  163. column: [
  164. {
  165. label: "测站编码",
  166. prop: "rtuCode",
  167. span: 12,
  168. search: true,
  169. width: 120,
  170. },
  171. {
  172. label: "测站名称",
  173. prop: "rtuName",
  174. span: 12,
  175. search: true,
  176. minWidth: 160,
  177. overHidden: true,
  178. // html: true,
  179. // formatter: (val) => {
  180. // if (val.rtuName) {
  181. // return '<b>' + val.rtuName + '</b>/' + '<b style="color:grey">' + val.rtuCode + '</b>'
  182. // } else {
  183. // return '<b>' + val.rtuName + '</b>'
  184. // }
  185. // }
  186. },
  187. {
  188. label: "汛前巡检ID",
  189. prop: "beforeRainSeasonReportId",
  190. span: 24,
  191. hide: true,
  192. },
  193. {
  194. label: "汛前巡检",
  195. prop: "beforeRainSeasonStatus",
  196. span: 24,
  197. width: 120,
  198. html: true,
  199. formatter: (val) => {
  200. if (val.beforeRainSeasonStatus == 1) {
  201. return '<b style="color:darkcyan;">已填报</b>'
  202. } else {
  203. return '<b style="color:darkorange;">未填报</b>'
  204. }
  205. }
  206. },
  207. {
  208. label: "汛前填报人",
  209. prop: "beforeRainSeasonReportUserName",
  210. span: 24,
  211. width: 160,
  212. },
  213. {
  214. label: "汛前填报时间",
  215. prop: "beforeRainSeasonReportTime",
  216. span: 24,
  217. width: 160,
  218. sortable: 'custom',
  219. },
  220. {
  221. label: "汛中巡检(一)ID",
  222. prop: "rainSeasonFirstReportId",
  223. span: 24,
  224. hide: true,
  225. },
  226. {
  227. label: "汛中巡检(一)",
  228. prop: "rainSeasonFirstStatus",
  229. span: 24,
  230. width: 120,
  231. html: true,
  232. formatter: (val) => {
  233. if (val.rainSeasonFirstStatus == 1) {
  234. return '<b style="color:darkcyan;">已填报</b>'
  235. } else {
  236. return '<b style="color:darkorange;">未填报</b>'
  237. }
  238. }
  239. },
  240. {
  241. label: "汛中填报人(一)",
  242. prop: "rainSeasonFirstReportUserName",
  243. span: 24,
  244. width: 160,
  245. },
  246. {
  247. label: "汛中填报时间(一)",
  248. prop: "rainSeasonFirstReportTime",
  249. span: 24,
  250. width: 160,
  251. sortable: 'custom',
  252. },
  253. {
  254. label: "汛中巡检(二)ID",
  255. prop: "rainSeasonSecondReportId",
  256. span: 24,
  257. hide: true,
  258. },
  259. {
  260. label: "汛中巡检(二)",
  261. prop: "rainSeasonSecondStatus",
  262. span: 24,
  263. width: 120,
  264. html: true,
  265. formatter: (val) => {
  266. if (val.rainSeasonSecondStatus == 1) {
  267. return '<b style="color:darkcyan;">已填报</b>'
  268. } else {
  269. return '<b style="color:darkorange;">未填报</b>'
  270. }
  271. }
  272. },
  273. {
  274. label: "汛中填报人(二)",
  275. prop: "rainSeasonSecondReportUserName",
  276. span: 24,
  277. width: 160,
  278. },
  279. {
  280. label: "汛中填报时间(二)",
  281. prop: "rainSeasonSecondReportTime",
  282. span: 24,
  283. width: 160,
  284. sortable: 'custom',
  285. },
  286. ],
  287. },
  288. data: [],
  289. };
  290. },
  291. computed: {
  292. ...mapGetters(["userInfo", "permission"]),
  293. permissionList() {
  294. return {
  295. };
  296. },
  297. },
  298. created() {
  299. this.initTree();
  300. },
  301. watch: {
  302. // 'editForm.planId': {
  303. // handler(val) {
  304. // if (val != '' && val != undefined && val != null) {
  305. // this.planId = val;
  306. // }
  307. // },
  308. // immediate: true
  309. // }
  310. },
  311. methods: {
  312. initTree() {
  313. this.treeData = [];
  314. getTree().then(res => {
  315. this.treeData = res.data.data.map(item => {
  316. return {
  317. ...item,
  318. leaf: !item.hasChildren
  319. }
  320. })
  321. this.treeOption.defaultExpandedKeys.push(this.treeData[0].id);
  322. this.treeCode = this.treeData[0].id;
  323. this.getCountInfo(this.treeCode);
  324. });
  325. },
  326. nodeClick(data) {
  327. this.treeCode = data.id;
  328. this.treeParentCode = data.parentId;
  329. this.query = {};
  330. this.query['adCode'] = this.treeCode;
  331. this.page.currentPage = 1;
  332. var params = {};
  333. this.onLoad(this.page, params);
  334. this.getCountInfo(this.treeCode);
  335. },
  336. sortChange(val) {
  337. console.log(JSON.stringify(val))
  338. //prop":"tm","order":"ascending" descending
  339. let prop = val.prop;
  340. if (prop === 'beforeRainSeasonReportTime') {
  341. this.page.currentPage = 1;
  342. let params = {};
  343. let order = val.order;
  344. if (order) {
  345. params['order'] = order;
  346. params['prop'] = prop;
  347. this.sort = {};
  348. Object.assign(this.sort, params)
  349. } else {
  350. this.sort = {};
  351. }
  352. this.onLoad(this.page);
  353. } else if (prop === 'rainSeasonFirstReportTime') {
  354. this.page.currentPage = 1;
  355. let params = {};
  356. let order = val.order;
  357. if (order) {
  358. params['order'] = order;
  359. params['prop'] = prop;
  360. this.sort = {};
  361. Object.assign(this.sort, params)
  362. } else {
  363. this.sort = {};
  364. }
  365. this.onLoad(this.page);
  366. } else if (prop === 'rainSeasonSecondReportTime') {
  367. this.page.currentPage = 1;
  368. let params = {};
  369. let order = val.order;
  370. if (order) {
  371. params['order'] = order;
  372. params['prop'] = prop;
  373. this.sort = {};
  374. Object.assign(this.sort, params)
  375. } else {
  376. this.sort = {};
  377. }
  378. this.onLoad(this.page);
  379. }
  380. },
  381. getCountInfo(adCode) {
  382. getCountInfo(adCode).then((res) => {
  383. this.inspectionCountInfo = res.data.data;
  384. });
  385. },
  386. openBeforeRainReportDetail(item) {
  387. if (item.beforeRainSeasonStatus == 1) {
  388. this.reportDialog = true;
  389. this.dialogTitle = '汛前巡检填报信息';
  390. this.id = item.beforeRainSeasonReportId;
  391. this.$nextTick(() => {
  392. this.$refs["inspectionreportdetail"].init();
  393. });
  394. } else {
  395. this.$confirm("汛前巡检暂未填报!", "提示", {
  396. confirmButtonText: "确定",
  397. cancelButtonText: "取消",
  398. showCancelButton: false,
  399. type: "warning",
  400. })
  401. .then(() => {
  402. })
  403. .catch(() => { });
  404. }
  405. },
  406. openRainFirstReportDetail(item) {
  407. if (item.rainSeasonFirstStatus == 1) {
  408. this.reportDialog = true;
  409. this.dialogTitle = '汛中第一次巡检填报信息';
  410. this.id = item.rainSeasonFirstReportId;
  411. this.$nextTick(() => {
  412. this.$refs["inspectionreportdetail"].init();
  413. });
  414. } else {
  415. this.$confirm("汛中第一次巡检暂未填报!", "提示", {
  416. confirmButtonText: "确定",
  417. cancelButtonText: "取消",
  418. showCancelButton: false,
  419. type: "warning",
  420. })
  421. .then(() => {
  422. })
  423. .catch(() => { });
  424. }
  425. },
  426. openRainSencodReportDetail(item) {
  427. if (item.rainSeasonSecondStatus == 1) {
  428. this.reportDialog = true;
  429. this.dialogTitle = '汛中第二次巡检填报信息';
  430. this.id = item.rainSeasonSecondReportId;
  431. this.$nextTick(() => {
  432. this.$refs["inspectionreportdetail"].init();
  433. });
  434. } else {
  435. this.$confirm("汛中第二次巡检暂未填报!", "提示", {
  436. confirmButtonText: "确定",
  437. cancelButtonText: "取消",
  438. showCancelButton: false,
  439. type: "warning",
  440. })
  441. .then(() => {
  442. })
  443. .catch(() => { });
  444. }
  445. },
  446. searchReset() {
  447. this.query = {};
  448. this.query['adCode'] = this.treeCode;
  449. this.page.currentPage = 1;
  450. this.onLoad(this.page);
  451. },
  452. searchChange(params, done) {
  453. this.query = params;
  454. this.page.currentPage = 1;
  455. this.onLoad(this.page, params);
  456. done();
  457. },
  458. selectionChange(list) {
  459. this.selectionList = list;
  460. },
  461. selectionClear() {
  462. this.selectionList = [];
  463. this.$refs.crud.toggleSelection();
  464. },
  465. beforeOpen(done, type) {
  466. if (["edit", "view"].includes(type)) {
  467. // getDetail(this.form.id).then((res) => {
  468. // this.form = res.data.data;
  469. // });
  470. }
  471. done();
  472. },
  473. currentChange(currentPage) {
  474. this.page.currentPage = currentPage;
  475. },
  476. sizeChange(pageSize) {
  477. this.page.pageSize = pageSize;
  478. },
  479. refreshChange() {
  480. var params = {};
  481. this.onLoad(this.page, params);
  482. },
  483. onLoad(page, params = {}) {
  484. this.loading = true;
  485. getPage(
  486. page.currentPage,
  487. page.pageSize,
  488. Object.assign(params, this.sort, this.query)
  489. ).then((res) => {
  490. const data = res.data.data;
  491. this.page.total = data.total;
  492. this.data = data.records;
  493. this.loading = false;
  494. this.selectionClear();
  495. });
  496. },
  497. },
  498. };
  499. </script>
  500. <style lang="scss" scoped>
  501. .common-dialog {
  502. display: flex;
  503. align-items: center;
  504. justify-content: center;
  505. overflow: hidden;
  506. .el-dialog {
  507. margin: 0 auto !important;
  508. position: relative;
  509. overflow: hidden;
  510. .el-dialog__header {
  511. position: absolute;
  512. left: 0;
  513. right: 0;
  514. bottom: 0;
  515. width: 100%;
  516. height: 60px;
  517. z-index: 1;
  518. }
  519. .el-dialog__body {
  520. position: relative;
  521. left: 0;
  522. top: 60px;
  523. bottom: 0;
  524. right: 0;
  525. padding: 0;
  526. width: 100%;
  527. overflow: hidden;
  528. overflow-y: auto;
  529. max-height: 90vh;
  530. padding-top: 80px;
  531. padding-bottom: 100px;
  532. z-index: 1;
  533. }
  534. .el-dialog__footer {
  535. position: absolute;
  536. left: 0;
  537. right: 0;
  538. bottom: 0;
  539. width: 100%;
  540. height: 80px;
  541. z-index: 1;
  542. }
  543. }
  544. }
  545. .line {
  546. display: flex;
  547. flex-direction: row;
  548. justify-content: flex-start;
  549. }
  550. .line .lineText {
  551. margin-left: 10px;
  552. margin-right: 0px;
  553. display: flex;
  554. flex-direction: column;
  555. justify-content: center;
  556. }
  557. .line .lineText .inspectionCount {
  558. color: dodgerblue;
  559. font-size: 0.8rem;
  560. }
  561. .line .lineText .beforeRainInspectionCount {
  562. color: darkorange;
  563. font-size: 0.8rem;
  564. }
  565. .line .lineText .rainFirstInspectionCount {
  566. color: lightcoral;
  567. font-size: 0.8rem;
  568. }
  569. .line .lineText .rainSencodInspectionCount {
  570. color: darkcyan;
  571. font-size: 0.8rem;
  572. }
  573. </style>