| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <!--
- * @Title:
- * @Description:
- * @Author: 893699165@qq.com
- * @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>
- <template slot-scope="{ row, index }" slot="menu">
- <el-button icon="el-icon-link" type="text" size="small" @click="toWarnInfoDetail(row)">预警详情
- </el-button>
- </template>
- </avue-crud>
- <el-drawer :visible.sync="drawer" title="预警信息详情" direction="rtl" size="40%" append-to-body="true">
- <originalWarnInfoDetail :id="dataFromId" ref="originalWarnInfoDetail"></originalWarnInfoDetail>
- </el-drawer>
- </basic-container>
- </div>
- </template>
- <script>
- import { getPage, getDetail } from "@/api/warning/warning";
- // import { mapGetters } from "vuex";
- import originalWarnInfoDetail from "./originalWarnInfoDetail";
- export default {
- components: { originalWarnInfoDetail },
- data() {
- return {
- dataFromId: '',
- drawer: false,
- // rtuCode: "",
- editForm: {},
- editDialog: false,
- form: {},
- selectionList: [],
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- option: {
- labelWidth: 120,
- viewLabelWidth: 100,
- searchlabelWidth: 100,
- // height: "auto",
- calcHeight: 30,
- align: "center",
- headerAlign: "center",
- tip: false,
- simplePage: true,
- searchShow: true,
- searchMenuSpan: 6,
- menu: true,
- border: true,
- index: true,
- height: 300,
- editBtn: false,
- delBtn: false,
- addBtn: false,
- viewBtn: false,
- viewBtnText: "预警详情",
- menuWidth: 220,
- dialogType: "drawer",
- dialogClickModal: false,
- column: [
- {
- label: "预警类型",
- prop: "warningKind",
- span: 12,
- },
- {
- label: "预警信息",
- prop: "warningDesc",
- span: 12,
- },
- {
- label: "预警时间",
- prop: "warningHappenTime",
- span: 12,
- search: true,
- },
- {
- label: "恢复时间",
- prop: "warningRecoveryTime",
- span: 12,
- search: true,
- },
- {
- label: "预警状态",
- prop: "warningStatus",
- span: 12,
- solt: true,
- },
- ],
- },
- data: [],
- };
- },
- props: {
- rtuCode: {
- type: [String],
- required: true
- },
- },
- created() {
- this.init();
- },
- methods: {
- init() {
- //this.$message.success(this.rtuCode)
- this.onLoad(this.page);
- },
- toWarnInfoDetail(row) {
- this.dataFromId = row.dataFromId;
- this.drawer = true;
- },
- 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;
- 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>
|