index.vue 18 KB

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