Răsfoiți Sursa

解决GIT提交问题

dylan 2 ani în urmă
părinte
comite
29694f33c5
1 a modificat fișierele cu 188 adăugiri și 0 ștergeri
  1. 188 0
      src/views/business/warning/rtuwarninglist.vue

+ 188 - 0
src/views/business/warning/rtuwarninglist.vue

@@ -0,0 +1,188 @@
+<!--
+ * @Title: 
+ * @Description: 每个测站产生的预警信息列表
+ * @Author: swp
+ * @Date: 2022-08-24 10:49:21
+ * @LastEditors: 
+ * @LastEditTime: 2022-08-24 10:49:21
+-->
+<template>
+    <div>
+        <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"
+                @before-open="beforeOpen">
+                <template slot="warningStatus" slot-scope="row">
+                    <div v-if="row.row.warningStatus == 0" style="color: orangered;">
+                        预警中
+                    </div>
+                    <div v-else style="color: blue;">
+                        已关闭
+                    </div>
+                </template>
+            </avue-crud>
+        </basic-container>
+    </div>
+</template>
+
+<script>
+import { getPage, getDetail } from "@/api/warning/warning.js";
+export default {
+    components: {},
+    name: 'rtuwarninglist',
+    data() {
+        return {
+            drawer: false,
+            form: {},
+            selectionList: [],
+            query: {},
+            loading: true,
+            page: {
+                pageSize: 10,
+                currentPage: 1,
+                total: 0,
+            },
+            option: {
+                labelWidth: 120,
+                viewLabelWidth: 100,
+                searchlabelWidth: 100,
+                height: "auto",
+                calcHeight: 80,
+                align: "center",
+                headerAlign: "center",
+                tip: false,
+                simplePage: true,
+                searchShow: true,
+                searchMenuSpan: 6,
+                menu: false,
+                border: true,
+                index: true,
+                editBtn: false,
+                delBtn: false,
+                addBtn: false,
+                viewBtn: false,
+                viewBtnText: "当前异常详情",
+                menuWidth: 220,
+                dialogType: "drawer",
+                dialogClickModal: false,
+                columnBtn: false,
+                column: [
+                    {
+                        label: "异常类别",
+                        prop: "warningKind",
+                        span: 12,
+                        // props: {
+                        //     label: 'dictValue',
+                        //     value: 'id'
+                        // },
+                        // dicUrl: '/api/galaxy-system/dict-biz/dictionary?code=warn_kinds',
+                        html: true,
+                        formatter: (val) => {
+                            if (val.warningKind) {
+                                let htmltext = '';
+                                if (val.warningKind == 1) {
+                                    htmltext = '<b style="color:red">测站离线</b>';
+                                } else if (val.warningKind == 2) {
+                                    htmltext = '<b style="color:red">测站时钟异常</b>';
+                                } else if (val.warningKind == 3) {
+                                    htmltext = '<b style="color:red">测站雨量小时报漏报</b>';
+                                } else if (val.warningKind == 4) {
+                                    htmltext = '<b style="color:red">测站水位小时报漏报</b>';
+                                } else if (val.warningKind == 5) {
+                                    htmltext = '<b style="color:red">雨量5分钟上报延时</b>';
+                                } else if (val.warningKind == 6) {
+                                    htmltext = '<b style="color:red">雨量站小时上报延时</b>';
+                                } else if (val.warningKind == 7) {
+                                    htmltext = '<b style="color:red">水位站小时上报延时</b>';
+                                } else if (val.warningKind == 8) {
+                                    htmltext = '<b style="color:red">雨量疑似异常值</b>';
+                                }
+
+                                return htmltext;
+                            }
+                        }
+                    },
+                    {
+                        label: "异常信息",
+                        prop: "warningDesc",
+                        span: 12,
+                    },
+                    {
+                        label: "发生时间",
+                        prop: "warningHappenTime",
+                        span: 12,
+                    },
+                ],
+            },
+            data: [],
+            dialogTitle: '',
+        };
+    },
+    props: {
+        rtuCode: {
+            type: [String],
+            required: true
+        },
+    },
+    created() {
+        this.init();
+    },
+    methods: {
+        init() {
+            this.onLoad(this.page);
+        },
+        searchReset() {
+            this.query = {};
+            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 (["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() {
+            this.onLoad(this.page, this.query);
+        },
+        onLoad(page, params = {}) {
+            this.loading = true;
+            params['rtuCode'] = this.rtuCode;
+            params['warningStatus'] = 0;
+            getPage(
+                page.currentPage,
+                page.pageSize,
+                Object.assign(params, this.query)
+            ).then((res) => {
+                const data = res.data.data;
+                this.page.total = data.total;
+                this.data = data.records;
+                this.loading = false;
+                this.selectionClear();
+            });
+        },
+    },
+};
+</script>