| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- <!--
- * @Title:
- * @Description: 巡检上报列表
- * @Author: swp
- * @Date: 2022-08-24 10:49:21
- * @LastEditors:
- * @LastEditTime: 2022-08-24 10:49:21
- -->
- <template>
- <div>
- <el-row>
- <el-col :span="4">
- <div class="box">
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick">
- <span class="el-tree-node__label" slot-scope="{ node, data }">
- <span>
- <i class="el-icon-office-building"></i>
- {{ (node || {}).label }}
- </span>
- </span>
- </avue-tree>
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="20">
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :page.sync="page" :data="data" ref="crud"
- v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate"
- @row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
- @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad" @sort-change="sortChange">
- <template slot-scope="scope" slot="menuLeft">
- <div class="line">
- <div class="lineText">
- <span class="inspectionCount">本年度已巡检设备数量(至少一次): {{ inspectionCountInfo.inspectionCount
- }}</span>
- </div>
- <div class="lineText">
- <span style="color: gray;">/</span>
- </div>
- <div class="lineText">
- <span class="beforeRainInspectionCount">汛前巡检设备数量: {{
- inspectionCountInfo.beforeRainInspectionCount
- }}</span>
- </div>
- <div class="lineText">
- <span style="color: gray;">/</span>
- </div>
- <div class="lineText">
- <span class="rainFirstInspectionCount">汛中第一次巡检设备数量: {{
- inspectionCountInfo.firstRainInspectionCount
- }}</span>
- </div>
- <div class="lineText">
- <span style="color: gray;">/</span>
- </div>
- <div class="lineText">
- <span class="rainSencodInspectionCount">汛中第二次巡检设备数量: {{
- inspectionCountInfo.sencodRainInspectionCount
- }}</span>
- </div>
- </div>
- </template>
- <template slot-scope="{ row, index }" slot="menu">
- <el-button type="text" size="small" @click="openBeforeRainReportDetail(row)"
- icon="el-icon-edit-outline">汛前详情
- </el-button>
- <el-button type="text" size="small" @click="openRainFirstReportDetail(row)"
- icon="el-icon-edit-outline">汛中(一)详情
- </el-button>
- <el-button type="text" size="small" @click="openRainSencodReportDetail(row)"
- icon="el-icon-edit-outline">汛中(二)详情
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <el-drawer title="巡检填报记录" :visible.sync="reportDialog" v-if="reportDialog" :size="drawerSize" :direction="direction"
- :close-on-click-modal="false" append-to-body>
- <div slot="title" class="header-title">
- <span class="name">{{ dialogTitle }}</span>
- </div>
- <inspectionreportdetail :id="id" ref="inspectionreportdetail"></inspectionreportdetail>
- </el-drawer>
- </div>
- </template>
- <script>
- import {
- getPage,
- getCountInfo,
- } from "@/api/business/inspection/inspection.js";
- import { getTree } from "@/api/baseinfo/region.js";
- import { mapGetters } from "vuex";
- import inspectionreportdetail from "./inspectionreportdetail.vue";
- export default {
- components: {
- inspectionreportdetail,
- },
- data() {
- return {
- id: '',
- inspectionDate: '',
- beforeRainSeasonReportId: '',
- rainSeasonFirstReportId: '',
- rainSeasonSecondReportId: '',
- inspectionCountInfo: {
- },
- drawerSize: '50%',
- reportDialog: false,
- dialogTitle: '',
- selectionList: [],
- query: {},
- sort: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- treeCode: '',
- treeParentCode: '',
- treeData: [],
- treeOption: {
- nodeKey: "id",
- defaultExpandedKeys: [],
- lazy: false,
- addBtn: false,
- menu: true,
- size: "small",
- props: {
- labelText: "标题",
- label: "title",
- value: "value",
- children: "children",
- },
- },
- option: {
- labelWidth: 140,
- viewLabelWidth: 140,
- searchlabelWidth: 140,
- height: "auto",
- calcHeight: 80,
- align: "center",
- headerAlign: "center",
- tip: true,
- simplePage: true,
- searchShow: true,
- searchMenuSpan: 6,
- addBtn: false,
- border: true,
- index: true,
- editBtn: false,
- delBtn: false,
- viewBtn: false,
- menuWidth: 300,
- dialogType: "drawer",
- dialogClickModal: false,
- columnBtn: false,
- column: [
- {
- label: "测站编码",
- prop: "rtuCode",
- span: 12,
- search: true,
- width: 120,
- },
- {
- label: "测站名称",
- prop: "rtuName",
- span: 12,
- search: true,
- minWidth: 160,
- overHidden: true,
- // html: true,
- // formatter: (val) => {
- // if (val.rtuName) {
- // return '<b>' + val.rtuName + '</b>/' + '<b style="color:grey">' + val.rtuCode + '</b>'
- // } else {
- // return '<b>' + val.rtuName + '</b>'
- // }
- // }
- },
- {
- label: "汛前巡检ID",
- prop: "beforeRainSeasonReportId",
- span: 24,
- hide: true,
- },
- {
- label: "汛前巡检",
- prop: "beforeRainSeasonStatus",
- span: 24,
- width: 120,
- html: true,
- formatter: (val) => {
- if (val.beforeRainSeasonStatus == 1) {
- return '<b style="color:darkcyan;">已填报</b>'
- } else {
- return '<b style="color:darkorange;">未填报</b>'
- }
- }
- },
- {
- label: "汛前填报人",
- prop: "beforeRainSeasonReportUserName",
- span: 24,
- width: 160,
- },
- {
- label: "汛前填报时间",
- prop: "beforeRainSeasonReportTime",
- span: 24,
- width: 160,
- sortable: 'custom',
- },
- {
- label: "汛中巡检(一)ID",
- prop: "rainSeasonFirstReportId",
- span: 24,
- hide: true,
- },
- {
- label: "汛中巡检(一)",
- prop: "rainSeasonFirstStatus",
- span: 24,
- width: 120,
- html: true,
- formatter: (val) => {
- if (val.rainSeasonFirstStatus == 1) {
- return '<b style="color:darkcyan;">已填报</b>'
- } else {
- return '<b style="color:darkorange;">未填报</b>'
- }
- }
- },
- {
- label: "汛中填报人(一)",
- prop: "rainSeasonFirstReportUserName",
- span: 24,
- width: 160,
- },
- {
- label: "汛中填报时间(一)",
- prop: "rainSeasonFirstReportTime",
- span: 24,
- width: 160,
- sortable: 'custom',
- },
- {
- label: "汛中巡检(二)ID",
- prop: "rainSeasonSecondReportId",
- span: 24,
- hide: true,
- },
- {
- label: "汛中巡检(二)",
- prop: "rainSeasonSecondStatus",
- span: 24,
- width: 120,
- html: true,
- formatter: (val) => {
- if (val.rainSeasonSecondStatus == 1) {
- return '<b style="color:darkcyan;">已填报</b>'
- } else {
- return '<b style="color:darkorange;">未填报</b>'
- }
- }
- },
- {
- label: "汛中填报人(二)",
- prop: "rainSeasonSecondReportUserName",
- span: 24,
- width: 160,
- },
- {
- label: "汛中填报时间(二)",
- prop: "rainSeasonSecondReportTime",
- span: 24,
- width: 160,
- sortable: 'custom',
- },
- ],
- },
- data: [],
- };
- },
- computed: {
- ...mapGetters(["userInfo", "permission"]),
- permissionList() {
- return {
- };
- },
- },
- created() {
- this.initTree();
- },
- watch: {
- // 'editForm.planId': {
- // handler(val) {
- // if (val != '' && val != undefined && val != null) {
- // this.planId = val;
- // }
- // },
- // immediate: true
- // }
- },
- methods: {
- initTree() {
- this.treeData = [];
- getTree().then(res => {
- this.treeData = res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- }
- })
- this.treeOption.defaultExpandedKeys.push(this.treeData[0].id);
- this.treeCode = this.treeData[0].id;
- this.getCountInfo(this.treeCode);
- });
- },
- nodeClick(data) {
- this.treeCode = data.id;
- this.treeParentCode = data.parentId;
- this.query = {};
- this.query['adCode'] = this.treeCode;
- this.page.currentPage = 1;
- var params = {};
- this.onLoad(this.page, params);
- this.getCountInfo(this.treeCode);
- },
- sortChange(val) {
- console.log(JSON.stringify(val))
- //prop":"tm","order":"ascending" descending
- let prop = val.prop;
- if (prop === 'beforeRainSeasonReportTime') {
- this.page.currentPage = 1;
- let params = {};
- let order = val.order;
- if (order) {
- params['order'] = order;
- params['prop'] = prop;
- this.sort = {};
- Object.assign(this.sort, params)
- } else {
- this.sort = {};
- }
- this.onLoad(this.page);
- } else if (prop === 'rainSeasonFirstReportTime') {
- this.page.currentPage = 1;
- let params = {};
- let order = val.order;
- if (order) {
- params['order'] = order;
- params['prop'] = prop;
- this.sort = {};
- Object.assign(this.sort, params)
- } else {
- this.sort = {};
- }
- this.onLoad(this.page);
- } else if (prop === 'rainSeasonSecondReportTime') {
- this.page.currentPage = 1;
- let params = {};
- let order = val.order;
- if (order) {
- params['order'] = order;
- params['prop'] = prop;
- this.sort = {};
- Object.assign(this.sort, params)
- } else {
- this.sort = {};
- }
- this.onLoad(this.page);
- }
- },
- getCountInfo(adCode) {
- getCountInfo(adCode).then((res) => {
- this.inspectionCountInfo = res.data.data;
- });
- },
- openBeforeRainReportDetail(item) {
- if (item.beforeRainSeasonStatus == 1) {
- this.reportDialog = true;
- this.dialogTitle = '汛前巡检填报信息';
- this.id = item.beforeRainSeasonReportId;
- this.$nextTick(() => {
- this.$refs["inspectionreportdetail"].init();
- });
- } else {
- this.$confirm("汛前巡检暂未填报!", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- showCancelButton: false,
- type: "warning",
- })
- .then(() => {
- })
- .catch(() => { });
- }
- },
- openRainFirstReportDetail(item) {
- if (item.rainSeasonFirstStatus == 1) {
- this.reportDialog = true;
- this.dialogTitle = '汛中第一次巡检填报信息';
- this.id = item.rainSeasonFirstReportId;
- this.$nextTick(() => {
- this.$refs["inspectionreportdetail"].init();
- });
- } else {
- this.$confirm("汛中第一次巡检暂未填报!", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- showCancelButton: false,
- type: "warning",
- })
- .then(() => {
- })
- .catch(() => { });
- }
- },
- openRainSencodReportDetail(item) {
- if (item.rainSeasonSecondStatus == 1) {
- this.reportDialog = true;
- this.dialogTitle = '汛中第二次巡检填报信息';
- this.id = item.rainSeasonSecondReportId;
- this.$nextTick(() => {
- this.$refs["inspectionreportdetail"].init();
- });
- } else {
- this.$confirm("汛中第二次巡检暂未填报!", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- showCancelButton: false,
- type: "warning",
- })
- .then(() => {
- })
- .catch(() => { });
- }
- },
- searchReset() {
- this.query = {};
- this.query['adCode'] = this.treeCode;
- this.page.currentPage = 1;
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- // getDetail(this.form.id).then((res) => {
- // this.form = res.data.data;
- // });
- }
- done();
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- var params = {};
- this.onLoad(this.page, params);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getPage(
- page.currentPage,
- page.pageSize,
- Object.assign(params, this.sort, this.query)
- ).then((res) => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .common-dialog {
- display: flex;
- align-items: center;
- justify-content: center;
- overflow: hidden;
- .el-dialog {
- margin: 0 auto !important;
- position: relative;
- overflow: hidden;
- .el-dialog__header {
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- width: 100%;
- height: 60px;
- z-index: 1;
- }
- .el-dialog__body {
- position: relative;
- left: 0;
- top: 60px;
- bottom: 0;
- right: 0;
- padding: 0;
- width: 100%;
- overflow: hidden;
- overflow-y: auto;
- max-height: 90vh;
- padding-top: 80px;
- padding-bottom: 100px;
- z-index: 1;
- }
- .el-dialog__footer {
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- width: 100%;
- height: 80px;
- z-index: 1;
- }
- }
- }
- .line {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .line .lineText {
- margin-left: 10px;
- margin-right: 0px;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .line .lineText .inspectionCount {
- color: dodgerblue;
- font-size: 0.8rem;
- }
- .line .lineText .beforeRainInspectionCount {
- color: darkorange;
- font-size: 0.8rem;
- }
- .line .lineText .rainFirstInspectionCount {
- color: lightcoral;
- font-size: 0.8rem;
- }
- .line .lineText .rainSencodInspectionCount {
- color: darkcyan;
- font-size: 0.8rem;
- }
- </style>
|