index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <!--
  2. * @Title:
  3. * @Description:
  4. * @Author: 893699165@qq.com
  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 type="flex" justify="center">
  12. <el-col :span="19" style="padding-left:8px;">
  13. <avue-form :option="planOption" v-model="editForm" ref="editForm"></avue-form>
  14. </el-col>
  15. <el-col :span="5">
  16. <div style="display:flex; justify-content: center;align-items: center;height: 100%;">
  17. <el-button type="primary" @click="openPlanManage()" plain>巡检计划管理
  18. </el-button>
  19. </div>
  20. </el-col>
  21. </el-row>
  22. <el-row>
  23. <el-col :span="5">
  24. <div class="box">
  25. <el-scrollbar>
  26. <basic-container>
  27. <avue-tree :option="treeOption" :data="projectTreeData" @node-click="nodeClick">
  28. <span class="el-tree-node__label" slot-scope="{ node, data }">
  29. <span>
  30. <i class="el-icon-user-solid"></i>
  31. {{ (node || {}).label }}
  32. </span>
  33. </span>
  34. <template slot-scope="scope" slot="menu">
  35. <div class="avue-tree__item" @click.native="tip(scope.node,scope.data)">自定义按钮</div>
  36. </template>
  37. </avue-tree>
  38. </basic-container>
  39. </el-scrollbar>
  40. </div>
  41. </el-col>
  42. <el-col :span="19">
  43. <basic-container>
  44. <avue-crud :option="option" :table-loading="loading" :page.sync="page" :data="data" ref="crud"
  45. v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate"
  46. @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
  47. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  48. @refresh-change="refreshChange" @on-load="onLoad">
  49. <template slot-scope="{ row, index }" slot="menu">
  50. <el-button type="text" size="small" @click="openReportDetail(row)">填报详情
  51. </el-button>
  52. <!-- <el-button type="text" size="small" @click="orderOff(row)">人工关闭
  53. </el-button> -->
  54. </template>
  55. </avue-crud>
  56. </basic-container>
  57. </el-col>
  58. </el-row>
  59. <!-- <el-dialog
  60. title="预警配置"
  61. :visible.sync="configDialog"
  62. width="600px"
  63. :before-close="handleClose"
  64. :close-on-click-modal="false"
  65. append-to-body
  66. >
  67. <el-form label-width="120px">
  68. <el-form-item label="预警总开关">
  69. <el-switch
  70. v-model="warningConfig.configSw"
  71. active-color="#13ce66"
  72. inactive-color="#ff4949"
  73. active-text="开"
  74. inactive-text="关"
  75. >
  76. </el-switch>
  77. </el-form-item>
  78. </el-form>
  79. <span slot="footer" class="dialog-footer">
  80. <el-button @click="configDialog = false" size="small">取 消</el-button>
  81. <el-button type="primary" @click="confirmConfig" size="small"
  82. >确 定</el-button
  83. >
  84. </span>
  85. </el-dialog> -->
  86. <!-- <el-dialog title="预警信息" :visible.sync="warnInfoDialog" width="80%" :close-on-click-modal="false" append-to-body>
  87. <rtuWarningList :rtuCode="rtuCode" ref="rtuWarningList"></rtuWarningList>
  88. </el-dialog> -->
  89. <el-dialog title="巡检填报记录" :visible.sync="reportDialog" v-if="reportDialog" width="80%"
  90. :close-on-click-modal="false" append-to-body>
  91. <inspectionRportDetail :id="id" ref="inspectionRportDetail"></inspectionRportDetail>
  92. </el-dialog>
  93. <el-dialog title="巡检计划" :visible.sync="projectPlanDialog" v-if="projectPlanDialog" width="60%"
  94. :close-on-click-modal="false" append-to-body>
  95. <ProjectPlan :planSetting="planSetting" rel="planSetting"></ProjectPlan>
  96. </el-dialog>
  97. </div>
  98. </template>
  99. <script>
  100. import { getList as getPlanList } from "@/api/project/projectPlan.js";
  101. import { getTree } from "@/api/business/manage/manage.js";
  102. import projectPlan from '@/views/project/projectPlan.vue'
  103. import {
  104. getPage,
  105. getDetail,
  106. } from "@/api/business/inspection/inspection";
  107. // import { mapGetters } from "vuex";
  108. import inspectionRportDetail from "./inspectionRportDetail";
  109. import ProjectPlan from "../../project/projectPlan.vue";
  110. //let baseUrl = 'http://localhost:40004/api/galaxy-test'
  111. export default {
  112. components: {
  113. inspectionRportDetail,
  114. projectPlan,
  115. ProjectPlan
  116. },
  117. data() {
  118. return {
  119. id: '',
  120. projectPlanDialog: false,
  121. planSetting: {
  122. orgId: 0,
  123. projectId: 0,
  124. planTitle: ''
  125. },
  126. planOption: {
  127. submitBtn: false,
  128. emptyBtn: false,
  129. column: [{
  130. label: '巡检计划',
  131. prop: 'planId',
  132. type: 'select',
  133. dicUrl: `./api/galaxy-test/equipment/inspection/plan/all/list`,
  134. props: {
  135. label: "planTitle",
  136. value: "id",
  137. }
  138. }]
  139. },
  140. planId: '',
  141. reportDialog: false,
  142. editForm: {
  143. },
  144. editDialog: false,
  145. form: {},
  146. selectionList: [],
  147. query: {},
  148. loading: true,
  149. page: {
  150. pageSize: 10,
  151. currentPage: 1,
  152. total: 0,
  153. },
  154. treeCache: {
  155. orgId: '',
  156. projectId: '',
  157. },
  158. projectTreeData: [
  159. ],
  160. treeOption: {
  161. nodeKey: "id",
  162. lazy: false,
  163. // treeLoad: function (node, resolve) {
  164. // const parentId = node.level === 0 ? 0 : node.data.id;
  165. // getDeptLazyTree(parentId).then((res) => {
  166. // resolve(
  167. // res.data.data.map((item) => {
  168. // return {
  169. // ...item,
  170. // leaf: !item.hasChildren,
  171. // };
  172. // })
  173. // );
  174. // });
  175. // },
  176. defaultExpandAll: true,
  177. addBtn: false,
  178. menu: false,
  179. size: "small",
  180. props: {
  181. labelText: "标题",
  182. label: "title",
  183. value: "value",
  184. children: "children",
  185. },
  186. },
  187. option: {
  188. labelWidth: 120,
  189. viewLabelWidth: 100,
  190. searchlabelWidth: 100,
  191. // height: "auto",
  192. calcHeight: 30,
  193. align: "center",
  194. headerAlign: "center",
  195. tip: false,
  196. simplePage: true,
  197. searchShow: true,
  198. searchMenuSpan: 6,
  199. addBtn: false,
  200. border: true,
  201. index: true,
  202. height: 500,
  203. editBtn: false,
  204. delBtn: false,
  205. menuWidth: 160,
  206. dialogType: "drawer",
  207. dialogClickModal: false,
  208. column: [
  209. // {
  210. // label: "计划名称",
  211. // prop: "planId",
  212. // span: 12,
  213. // type: "select",
  214. // hide: true,
  215. // search:true,
  216. // dicUrl:`./api/galaxy-test/equipment/inspection/plan/all/list`,
  217. // props:{
  218. // label:"planTitle",
  219. // value:"id",
  220. // }
  221. // },
  222. {
  223. label: "测站名称",
  224. prop: "rtuName",
  225. span: 12,
  226. search: true,
  227. },
  228. {
  229. label: "测站编码",
  230. prop: "rtuCode",
  231. span: 12,
  232. search: true,
  233. },
  234. {
  235. label: "填报总结说明",
  236. prop: "reportDesc",
  237. span: 12,
  238. },
  239. {
  240. label: "填报人",
  241. prop: "createUser",
  242. span: 12,
  243. },
  244. {
  245. label: "填报时间",
  246. prop: "createTime",
  247. span: 12,
  248. },
  249. ],
  250. },
  251. data: [],
  252. };
  253. },
  254. created() {
  255. this.init();
  256. },
  257. watch: {
  258. 'editForm.planId': {
  259. handler(val) {
  260. if (val != '' && val != undefined && val != null) {
  261. this.planId = val;
  262. // this.$message.success(this.planId)
  263. }
  264. },
  265. immediate: true
  266. }
  267. },
  268. methods: {
  269. openPlanManage() {
  270. const planDate = new Date();
  271. // this.planSetting.orgId = item.orgId;
  272. // this.planSetting.projectId = item.id;
  273. const y = planDate.getFullYear();
  274. this.planSetting.planTitle = "" + y + "年度巡检计划";
  275. this.projectPlanDialog = true;
  276. },
  277. init() {
  278. this.initTree();
  279. this.initPlan();
  280. },
  281. initTree() {
  282. getTree(
  283. ).then((res) => {
  284. const data = res.data.data;
  285. this.projectTreeData = data;
  286. });
  287. },
  288. initPlan() {
  289. getPlanList(
  290. ).then((res) => {
  291. this.editForm.planId = res.data.data[0].id;
  292. this.planId = res.data.data[0].id;
  293. this.onLoad(this.page);
  294. });
  295. },
  296. nodeClick(data) {
  297. this.treeCache.orgId = data.orgId;
  298. this.treeCache.projectId = data.projectId;
  299. //this.$message.success(JSON.stringify(data))
  300. this.query = {};
  301. this.page.currentPage = 1;
  302. this.onLoad(this.page);
  303. },
  304. openReportDetail(item) {
  305. this.reportDialog = true;
  306. this.id = item.id;
  307. this.$nextTick(() => {
  308. this.$refs["inspectionRportDetail"].init();
  309. });
  310. },
  311. // orderOff(item) {
  312. // this.$prompt("请输入处理意见","是否确认关闭此工单?", {
  313. // confirmButtonText: "确定",
  314. // cancelButtonText: "取消",
  315. // })
  316. // .then(({ value }) => {
  317. // confirm({ id: item.id, orderDesc: value }).then((res) => {
  318. // if (res.data.code == 200) {
  319. // this.$message({
  320. // type: "info",
  321. // message: "操作成功",
  322. // });
  323. // this.refreshChange();
  324. // }
  325. // });
  326. // })
  327. // .catch(() => { });
  328. // },
  329. searchReset() {
  330. this.query = {};
  331. this.onLoad(this.page);
  332. },
  333. searchChange(params, done) {
  334. this.query = params;
  335. this.page.currentPage = 1;
  336. this.onLoad(this.page, params);
  337. done();
  338. },
  339. selectionChange(list) {
  340. this.selectionList = list;
  341. },
  342. selectionClear() {
  343. this.selectionList = [];
  344. this.$refs.crud.toggleSelection();
  345. },
  346. beforeOpen(done, type) {
  347. if (["edit", "view"].includes(type)) {
  348. getDetail(this.form.id).then((res) => {
  349. this.form = res.data.data;
  350. });
  351. }
  352. done();
  353. },
  354. currentChange(currentPage) {
  355. this.page.currentPage = currentPage;
  356. },
  357. sizeChange(pageSize) {
  358. this.page.pageSize = pageSize;
  359. },
  360. refreshChange() {
  361. this.onLoad(this.page, this.query);
  362. },
  363. onLoad(page, params = {}) {
  364. this.loading = true;
  365. params['planId'] = this.planId;
  366. params['orgId'] = this.treeCache.orgId;
  367. params['projectId'] = this.treeCache.projectId;
  368. getPage(
  369. page.currentPage,
  370. page.pageSize,
  371. Object.assign(params, this.query)
  372. ).then((res) => {
  373. const data = res.data.data;
  374. this.page.total = data.total;
  375. this.data = data.records;
  376. this.loading = false;
  377. this.selectionClear();
  378. });
  379. },
  380. },
  381. };
  382. </script>
  383. <style lang="scss" scoped>
  384. .common-dialog {
  385. display: flex;
  386. align-items: center;
  387. justify-content: center;
  388. overflow: hidden;
  389. .el-dialog {
  390. margin: 0 auto !important;
  391. position: relative;
  392. overflow: hidden;
  393. .el-dialog__header {
  394. position: absolute;
  395. left: 0;
  396. right: 0;
  397. bottom: 0;
  398. width: 100%;
  399. height: 60px;
  400. z-index: 1;
  401. }
  402. .el-dialog__body {
  403. position: relative;
  404. left: 0;
  405. top: 60px;
  406. bottom: 0;
  407. right: 0;
  408. padding: 0;
  409. width: 100%;
  410. overflow: hidden;
  411. overflow-y: auto;
  412. max-height: 90vh;
  413. padding-top: 80px;
  414. padding-bottom: 100px;
  415. z-index: 1;
  416. }
  417. .el-dialog__footer {
  418. position: absolute;
  419. left: 0;
  420. right: 0;
  421. bottom: 0;
  422. width: 100%;
  423. height: 80px;
  424. z-index: 1;
  425. }
  426. }
  427. }
  428. </style>