index.vue 8.31 KB
Newer Older
xinzhedeai's avatar
xinzhedeai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
<template>
  <div class="data-watch">
    <el-card class="box-card">
      <div class="lcl-title">报警记录</div>
      <div class="mt20">
        <span>报警时间:</span>
        <el-date-picker
          v-model="queryParams.dates"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"
          @change="timeBE"
        >
        </el-date-picker>
        <el-select
          v-model="queryParams.monNumber"
          placeholder="请选择设备"
          class="mr10"
          clearable
        >
          <el-option
            v-for="item in deviceSelectList"
            :key="item.monNumber"
            :label="item.monName"
            :value="item.monNumber"
          >
          </el-option>
        </el-select>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="medium"
          @click="handleQuery"
          >搜索</el-button
        >
        <!-- <el-button size="medium">生成曲线</el-button> -->
      </div>
    </el-card>
    <el-card class="mt10 box-card">
      <div class="lcl-title">内部位移报警记录表</div>
      <div class="mt10" id=" radar-table">
        <el-table
          :data="alarmList"
          border
          stripe
          style="width: 100%"
          :header-cell-style="{
            textAlign: 'center',
            height: '20px',
          }"
          :row-style="{ height: '20px' }"
        >
          <el-table-column
            label="监测编号"
            align="center"
            prop="alarmMonNumber"
          />
          <el-table-column label="监测值-a" align="center" prop="alarmValueA" />
          <el-table-column label="监测值-b" align="center" prop="alarmValueB" />
xinzhedeai's avatar
xinzhedeai committed
62
          <el-table-column label="监测值-c" align="center" prop="alarmValueC" />
xinzhedeai's avatar
xinzhedeai committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
          <el-table-column
            label="报警时间"
            align="center"
            prop="alarmTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.alarmTime, "{y}-{m}-{d}") }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="报警解除时间"
            align="center"
            prop="alarmResTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{
                parseTime(scope.row.alarmResTime, "{y}-{m}-{d}")
              }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="报警解除时长"
            align="center"
            prop="alarmResHours"
          />
          <el-table-column label="报警级别" align="center" prop="alarmLevel">
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.slope_alarm_level"
                :value="Number(scope.row.alarmLevel)"
              />
            </template>
          </el-table-column>
          <el-table-column label="是否报警 " align="center" prop="alarmIfRes">
            <template slot-scope="scope">
              <span v-if="scope.row.alarmIfRes == 0"></span>
              <span v-if="scope.row.alarmIfRes == 1"></span>
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="cancleAlarm(scope.row)"
                :disabled="scope.row.alarmIfRes === 1 ? true : false"
                >解除报警</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </div>
    </el-card>
    <el-dialog
      :title="cancleAlarmList.monName"
      :visible.sync="cancleAlarmVisible"
      width="30%"
      top="50vh"
    >
      <el-form :model="cancleAlarmform">
        <el-form-item
          label="解除时长(小时)"
          label-width="120"
          prop="hours"
          :rules="[
            { required: true, message: '解除时长不能为空' },
            { type: 'number', message: '解除时长必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="cancleAlarmform.hours"
            autocomplete="off"
          ></el-input>
        </el-form-item>
        <el-form-item label="解除原因" label-width="120">
          <el-input
            v-model="cancleAlarmform.reason"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancleAlarmVisible = false"> </el-button>
        <el-button type="primary" @click="submitCancleAlarm"> </el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
// import { defineComponent } from "@vue/composition-api";
import { dataAlarm, monDic, alarmRelieve } from "@/api/lclApi/lclapi";
export default {
  dicts: ["slope_alarm_level"],
  data() {
    return {
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        monNumber: null,
        monValue: null,
        monValueAll: null,
        monAlarmStatus: null,
        monType: 2,
        dates: [],
      },
      // 总条数
      total: 0,
      alarmList: [
        {
          createTime: "2023-03-11 19:06:20",
          updateTime: "2023-03-11 08:38:13",
          monStatus: 0,
          pointName: 0,
          id: 14,
          monNumber: "2#沉降仪",
          monValueA: "0.2",
          monValueB: "0.21",
          monAlarmStatus: 0,
          monDept: "10m/20m",
        },
      ],
      selectValue: "ss",
      cancleAlarmVisible: false,
      cancleAlarmList: {
        reason: null,
        hours: null,
      },
      cancleAlarmform: {
        reason: null,
        hours: null,
      },
      deviceSelectList: [
        {
          monName: "1-1测斜仪",
          monNumber: "1-1测斜仪",
        },
      ],
      monNumber: "",
    };
  },
  created() {},
  mounted() {
    this.$nextTick(() => {
      this.monDicData();
      this.getList();
    });
  },
  methods: {
    alarmreset() {
      this.cancleAlarmList = {
        reason: null,
        hours: null,
      };
      this.cancleAlarmform = {
        reason: null,
        hours: null,
      };
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    getList() {
      let that = this;
      dataAlarm(this.queryParams).then((res) => {
        if (res && res.code === 200 && res.rows) {
          this.alarmList = res.rows;
          this.total = res.total;
        }
      });
    },
    cancleAlarm(row) {
      console.log(row);
      this.cancleAlarmList = row;
      this.cancleAlarmVisible = true;
    },
    submitCancleAlarm() {
      this.cancleAlarmform.monNumber = this.cancleAlarmList.alarmMonNumber;
      this.cancleAlarmform.monType = Number(this.cancleAlarmList.monTypes);
      alarmRelieve(this.cancleAlarmform).then((res) => {
        if (res && res.code === 200) {
          this.alarmreset();
          this.$modal.msgSuccess("解除成功");
          this.getList();
          this.cancleAlarmVisible = false;
        }
      });
    },
    monDicData() {
      monDic({ monType: 2 }).then((res) => {
        if (res && res.code === 200 && res.rows) {
          this.deviceSelectList = res.rows;
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.data-watch {
  width: 100%;
  min-height: 100%;
  // border-radius: 10px;
  // background-color: teal;
  .box-card {
    width: 100%;
    .lcl-title {
      font-size: 22px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #333333;
      line-height: 30px;
      position: relative;
      padding-left: 10px;
      &:before {
        content: "";
        position: absolute;
        left: 0px;
        top: 4px;
        width: 6px;
        height: 22px;
        background: #0d85f4;
      }
    }
  }
}
</style>