index.vue 11.9 KB
Newer Older
1 2
<template>
  <div class="app-container">
纪泽龙's avatar
纪泽龙 committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
    <el-row v-if="$route.query.back">
      <el-col :span="24" style="padding-left: 15px">
        <div style="height: 45px" @click="$router.go(-1)">
          <el-button
            size="medium"
            type="text"
            style="font-size: 18px; color: rgb(7, 63, 112); float: left"
            >返回
          </el-button>
          <div style="float: left; margin-top: 8px; margin-left: 5px">
            <img
              src="../../../assets/logo/fanhui.png"
              style="width: 25px"
              alt=""
            />
          </div>
        </div>
      </el-col>
    </el-row>
纪泽龙's avatar
纪泽龙 committed
22 23 24 25 26
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
王晓倩's avatar
王晓倩 committed
27
      label-width="100px"
纪泽龙's avatar
纪泽龙 committed
28
    >
王晓倩's avatar
王晓倩 committed
29
      <el-form-item label="设备编号" prop="deviceCode">
30
        <el-input
31 32
          v-model="queryParams.deviceCode"
          placeholder="请输入设备编号"
33 34 35 36 37 38
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报警类型" prop="alarmType">
纪泽龙's avatar
纪泽龙 committed
39 40 41 42
        <el-select
          v-model="queryParams.alarmType"
          placeholder="请选择报警类型"
          clearable
王晓倩's avatar
王晓倩 committed
43
          filterable
纪泽龙's avatar
纪泽龙 committed
44 45
          size="small"
        >
46 47 48 49 50 51
          <el-option
            v-for="dict in typeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          ></el-option>
52 53
        </el-select>
      </el-form-item>
王晓倩's avatar
王晓倩 committed
54 55
      <el-form-item label="报警开始时间" prop="startTime1">
        <el-date-picker
纪泽龙's avatar
纪泽龙 committed
56 57
          clearable
          size="small"
王晓倩's avatar
王晓倩 committed
58 59 60 61
          v-model="queryParams.startTime1"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          placeholder="请选择起始时间"
纪泽龙's avatar
纪泽龙 committed
62 63
          align="right"
        >
王晓倩's avatar
王晓倩 committed
64 65 66 67 68
        </el-date-picker>
        <font color="#C0C4CC"></font>
      </el-form-item>
      <el-form-item label="" prop="endTime1">
        <el-date-picker
纪泽龙's avatar
纪泽龙 committed
69 70
          clearable
          size="small"
王晓倩's avatar
王晓倩 committed
71 72 73 74
          v-model="queryParams.endTime1"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          placeholder="请选择截止时间"
纪泽龙's avatar
纪泽龙 committed
75 76
          align="right"
        >
王晓倩's avatar
王晓倩 committed
77 78
        </el-date-picker>
      </el-form-item>
79
      <el-form-item>
纪泽龙's avatar
纪泽龙 committed
80 81 82 83 84 85 86 87 88 89
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
王晓倩's avatar
王晓倩 committed
90
      </el-form-item>
91 92
    </el-form>

纪泽龙's avatar
纪泽龙 committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
    <el-table
      v-loading="loading"
      :data="deviceAlarmList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column
        label="设备名称"
        align="center"
        prop="deviceName"
        width="280px"
      />
      <el-table-column
        label="设备编号"
        align="center"
        prop="deviceCode"
        width="240px"
      />
      <el-table-column label="设备类型" align="center" prop="deviceType" />
王晓倩's avatar
王晓倩 committed
111
      <el-table-column label="报警类型" align="center" prop="alarmType" />
纪泽龙's avatar
纪泽龙 committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
      <el-table-column
        label="报警值"
        align="center"
        prop="alarmValue"
        width="150px"
      />
      <el-table-column
        label="报警开始时间"
        align="center"
        prop="startTime"
        width="220px"
      />
      <el-table-column
        label="报警结束时间"
        align="center"
        prop="endTime"
        width="220px"
      >
130
        <template slot-scope="scope">
纪泽龙's avatar
纪泽龙 committed
131 132 133 134 135 136
          <span v-if="scope.row.endTime == null || scope.row.endTime == ''"
            >-</span
          >
          <span v-if="scope.row.endTime != null && scope.row.endTime != ''">{{
            scope.row.endTime
          }}</span>
137 138
        </template>
      </el-table-column>
纪泽龙's avatar
纪泽龙 committed
139 140 141 142 143 144
      <el-table-column
        label="处理状态"
        align="center"
        prop="dealStatus"
        width="150px"
      >
145
        <template slot-scope="scope">
纪泽龙's avatar
纪泽龙 committed
146 147 148 149 150 151 152 153 154 155 156
          <span v-if="scope.row.orderId == null || scope.row.orderId == ''"
            >未生成工单</span
          >
          <span
            v-if="
              (scope.row.dealStatus == null || scope.row.dealStatus == '') &&
              scope.row.orderId != null &&
              scope.row.orderId != ''
            "
            >暂未处理</span
          >
157 158 159
          <span v-if="scope.row.dealStatus == 1">不需处理</span>
          <span v-if="scope.row.dealStatus == 2">已处理完成</span>
          <span v-if="scope.row.dealStatus == 3">未处理完成</span>
160 161
        </template>
      </el-table-column>
纪泽龙's avatar
纪泽龙 committed
162 163 164 165 166
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
167
        <template slot-scope="scope">
王晓倩's avatar
王晓倩 committed
168 169 170 171 172 173
          <el-button
            size="normal"
            type="text"
            icon="el-icon-edit"
            @click="handleIssue(scope.row)"
            v-hasPermi="['workOrder:basicsInfo:add']"
纪泽龙's avatar
纪泽龙 committed
174 175
            v-if="scope.row.orderId == '' || scope.row.orderId == null"
          >
王晓倩's avatar
王晓倩 committed
176 177 178 179 180 181
            生成工单
          </el-button>
          <el-button
            size="normal"
            type="text"
            icon="el-icon-edit"
182
            @click="showDetail(scope.row)"
纪泽龙's avatar
纪泽龙 committed
183 184
            v-hasPermi="['dataMonitoring:deviceAlarm:query']"
          >
王晓倩's avatar
王晓倩 committed
185
            详情
yaqizhang's avatar
yaqizhang committed
186
          </el-button>
187 188 189
        </template>
      </el-table-column>
    </el-table>
190

王晓倩's avatar
王晓倩 committed
191
    <pagination
纪泽龙's avatar
纪泽龙 committed
192
      v-show="total > 0"
王晓倩's avatar
王晓倩 committed
193
      :total="total"
194 195
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
纪泽龙's avatar
纪泽龙 committed
196 197
      @pagination="getList"
    />
198

199 200 201
    <!-- 添加工单信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
202
        <el-form-item label="报警设备" prop="deviceName">
纪泽龙's avatar
纪泽龙 committed
203
          <font>{{ form.deviceName }}</font>
204 205
        </el-form-item>
        <el-form-item label="报警类型" prop="alarmType">
纪泽龙's avatar
纪泽龙 committed
206
          <font>{{ form.alarmType }}</font>
207 208
        </el-form-item>
        <el-form-item label="报警值" prop="alarmValue">
纪泽龙's avatar
纪泽龙 committed
209
          <font>{{ form.alarmValue }}</font>
210
        </el-form-item>
211
        <el-form-item label="工单名称" prop="orderName">
纪泽龙's avatar
纪泽龙 committed
212 213 214 215 216
          <el-input
            v-model="form.orderName"
            placeholder="请输入工单名称"
            style="width: 590px"
          />
217
        </el-form-item>
218
        <el-form-item label="指定执行人员" prop="appointInspector">
纪泽龙's avatar
纪泽龙 committed
219 220 221 222 223 224 225 226 227
          <el-select
            v-model="form.appointInspector"
            placeholder="请选择执行人员"
            clearable
            filterable
            size="small"
            @change="setUserId"
            style="width: 590px"
          >
王晓倩's avatar
王晓倩 committed
228 229 230 231 232 233
            <el-option
              v-for="item in inspector"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId"
            ></el-option>
234 235 236
          </el-select>
        </el-form-item>
        <el-form-item label="工单描述" prop="remarks">
纪泽龙's avatar
纪泽龙 committed
237 238 239 240 241 242
          <el-input
            type="textarea"
            v-model="form.remarks"
            placeholder="请输入工单描述"
            style="width: 590px"
          />
243 244 245 246 247 248 249 250 251 252 253
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
纪泽龙's avatar
纪泽龙 committed
254 255 256 257 258 259
import {
  listDeviceAlarm,
  getDeviceAlarm,
} from "@/api/dataMonitoring/deviceAlarm";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import { inspectorList } from "@/api/system/user";
260 261 262

export default {
  name: "DeviceAlarm",
纪泽龙's avatar
纪泽龙 committed
263
  components: {},
264 265
  data() {
    return {
纪泽龙's avatar
纪泽龙 committed
266
      // 判断是从哪里来的,如果是地图里来的,则可以返回
纪泽龙's avatar
纪泽龙 committed
267
      fromGisMap: false,
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 报警信息表格数据
      deviceAlarmList: [],
284 285
      // 报警类型字典
      typeOptions: [],
286 287 288 289 290 291 292 293 294 295 296 297 298
      // 设备级联
      options: [],

      props: {
        multiple: true,
        value: "id",
        label: "name",
        level: "level",
        children: "childList",
      },
      devices: null,
      // 巡检员列表
      inspector: [],
299 300 301 302 303 304
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
305 306
        pageNum: 1,
        pageSize: 10,
王晓倩's avatar
王晓倩 committed
307
        deviceCode: null,
308 309
        orderId: null,
        alarmType: null,
王晓倩's avatar
王晓倩 committed
310 311
        startTime1: null,
        endTime1: null,
纪泽龙's avatar
纪泽龙 committed
312
        dealStatus: null,
313 314
      },
      // 表单参数
纪泽龙's avatar
纪泽龙 committed
315
      form: {},
316 317
      // 表单校验
      rules: {
318
        orderName: [
纪泽龙's avatar
纪泽龙 committed
319
          { required: true, message: "工单名称不能为空", trigger: "blur" },
320
        ],
321
        appointInspector: [
纪泽龙's avatar
纪泽龙 committed
322
          { required: true, message: "请选择巡检人员", trigger: "blur" },
323
        ],
纪泽龙's avatar
纪泽龙 committed
324
      },
325 326 327 328
    };
  },
  created() {
    this.getList();
纪泽龙's avatar
纪泽龙 committed
329
    this.getDicts("t_alarm_type").then((response) => {
330 331
      this.typeOptions = response.data;
    });
332
  },
纪泽龙's avatar
纪泽龙 committed
333 334 335
  beforeRouteEnter: (to, from, next) => {
    next((vm) => {
      // 如果是从地图里来的
纪泽龙's avatar
纪泽龙 committed
336
      if (from.path == "/enterprise/mapView") {
纪泽龙's avatar
纪泽龙 committed
337
        // console.log(123)
纪泽龙's avatar
纪泽龙 committed
338 339 340
        vm.fromGisMap = true;
      } else {
        vm.fromGisMap = false;
纪泽龙's avatar
纪泽龙 committed
341 342 343
      }
    });
  },
344 345 346 347
  methods: {
    /** 查询报警信息列表 */
    getList() {
      this.loading = true;
纪泽龙's avatar
纪泽龙 committed
348
      listDeviceAlarm(this.queryParams).then((response) => {
349 350 351 352 353
        this.deviceAlarmList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
纪泽龙's avatar
纪泽龙 committed
354
    getInspectorList() {
355
      this.loading = true;
纪泽龙's avatar
纪泽龙 committed
356
      inspectorList().then((response) => {
357
        this.inspector = response.data;
358 359 360
        this.loading = false;
      });
    },
纪泽龙's avatar
纪泽龙 committed
361
    setUserId(val) {
362 363
      this.form.appointInspector = val;
    },
364 365 366 367 368
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
王晓倩's avatar
王晓倩 committed
369 370 371 372 373 374 375 376 377 378 379 380
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
        orderType: null,
        orderName: null,
        orderStatus: "0",
        createTime: null,
        appointInspector: null,
        allotTime: null,
        actualInspector: null,
        actualTime: null,
纪泽龙's avatar
纪泽龙 committed
381
        remarks: null,
382
      };
王晓倩's avatar
王晓倩 committed
383
      this.resetForm("form");
384
    },
王晓倩's avatar
王晓倩 committed
385 386
    /** 搜索按钮操作 */
    handleQuery() {
387
      this.queryParams.pageNum = 1;
388
      this.getList();
王晓倩's avatar
王晓倩 committed
389 390 391 392 393 394 395 396
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
纪泽龙's avatar
纪泽龙 committed
397 398 399
      this.ids = selection.map((item) => item.alarmId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
王晓倩's avatar
王晓倩 committed
400 401 402 403 404
    },
    /** 下发按钮操作 */
    handleIssue(row) {
      this.reset();
      this.getInspectorList();
纪泽龙's avatar
纪泽龙 committed
405 406
      const alarmId = row.alarmId || this.ids;
      getDeviceAlarm(alarmId).then((response) => {
王晓倩's avatar
王晓倩 committed
407 408 409
        this.form = response.data;
        this.open = true;
        this.title = "填写工单信息";
410
      });
411
    },
王晓倩's avatar
王晓倩 committed
412 413
    /** 提交按钮 */
    submitForm() {
纪泽龙's avatar
纪泽龙 committed
414
      this.$refs["form"].validate((valid) => {
王晓倩's avatar
王晓倩 committed
415 416 417
        if (valid) {
          this.form.resourceId = this.form.alarmId;
          this.form.orderType = "3";
纪泽龙's avatar
纪泽龙 committed
418
          addBasicsInfo(this.form).then((response) => {
王晓倩's avatar
王晓倩 committed
419 420 421 422 423 424 425
            this.msgSuccess("生成工单成功");
            this.open = false;
            this.getList();
          });
        }
      });
    },
426
    /** 详细信息跳转 */
王晓倩's avatar
王晓倩 committed
427 428
    showDetail(row) {
      this.$router.push({
纪泽龙's avatar
纪泽龙 committed
429
        path: "/dataMonitoring/alarmdetail",
王晓倩's avatar
王晓倩 committed
430
        query: {
yaqizhang's avatar
yaqizhang committed
431
          alarmId: row.alarmId,
纪泽龙's avatar
纪泽龙 committed
432 433 434
          deviceType: row.deviceType,
        },
      }); //带参跳转
王晓倩's avatar
王晓倩 committed
435
    },
纪泽龙's avatar
纪泽龙 committed
436
  },
王晓倩's avatar
王晓倩 committed
437 438
};
</script>