index.vue 11.1 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 22 23 24 25 26 27 28
    <div v-if="fromGisMap">
      <div
        style="width: 5%; height: 45px; margin-left: 20px"
        @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>
    </div>

    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
王晓倩's avatar
王晓倩 committed
29
      label-width="100px"
纪泽龙's avatar
纪泽龙 committed
30
    >
王晓倩's avatar
王晓倩 committed
31
      <el-form-item label="设备编号" prop="deviceCode">
32
        <el-input
33 34
          v-model="queryParams.deviceCode"
          placeholder="请输入设备编号"
35 36 37 38 39 40
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报警类型" prop="alarmType">
纪泽龙's avatar
纪泽龙 committed
41 42 43 44 45 46
        <el-select
          v-model="queryParams.alarmType"
          placeholder="请选择报警类型"
          clearable
          size="small"
        >
47 48 49 50 51 52
          <el-option
            v-for="dict in typeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          ></el-option>
53 54
        </el-select>
      </el-form-item>
王晓倩's avatar
王晓倩 committed
55 56
      <el-form-item label="报警开始时间" prop="startTime1">
        <el-date-picker
纪泽龙's avatar
纪泽龙 committed
57 58
          clearable
          size="small"
王晓倩's avatar
王晓倩 committed
59 60 61 62
          v-model="queryParams.startTime1"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          placeholder="请选择起始时间"
纪泽龙's avatar
纪泽龙 committed
63 64
          align="right"
        >
王晓倩's avatar
王晓倩 committed
65 66 67 68 69
        </el-date-picker>
        <font color="#C0C4CC"></font>
      </el-form-item>
      <el-form-item label="" prop="endTime1">
        <el-date-picker
纪泽龙's avatar
纪泽龙 committed
70 71
          clearable
          size="small"
王晓倩's avatar
王晓倩 committed
72 73 74 75
          v-model="queryParams.endTime1"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetime"
          placeholder="请选择截止时间"
纪泽龙's avatar
纪泽龙 committed
76 77
          align="right"
        >
王晓倩's avatar
王晓倩 committed
78 79
        </el-date-picker>
      </el-form-item>
80
      <el-form-item>
纪泽龙's avatar
纪泽龙 committed
81 82 83 84 85 86 87 88 89 90
        <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
91
      </el-form-item>
92 93
    </el-form>

94
    <el-table v-loading="loading" :data="deviceAlarmList.slice((pageNum-1)*pageSize,pageNum*pageSize)" @selection-change="handleSelectionChange" >
王晓倩's avatar
王晓倩 committed
95 96
      <el-table-column label="设备名称" align="center" prop="deviceName" />
      <el-table-column label="设备编号" align="center" prop="deviceCode" />
97
      <el-table-column label="设备类型" align="center" prop="deviceType" />
王晓倩's avatar
王晓倩 committed
98
      <el-table-column label="报警类型" align="center" prop="alarmType" />
99
      <el-table-column label="报警值" align="center" prop="alarmValue" />
王晓倩's avatar
王晓倩 committed
100
      <el-table-column label="报警开始时间" align="center" prop="startTime" />
101 102 103 104 105 106 107
      <el-table-column label="报警结束时间" align="center" prop="endTime" >
        <template slot-scope="scope">
          <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>
        </template>
      </el-table-column>
      <el-table-column label="处理状态" align="center" prop="dealStatus">n
108
        <template slot-scope="scope">
王晓倩's avatar
王晓倩 committed
109 110
          <span v-if="scope.row.orderId == null || scope.row.orderId == ''">未生成工单</span>
          <span v-if="(scope.row.dealStatus == null || scope.row.dealStatus == '') &&
111
              scope.row.orderId != null && scope.row.orderId != ''">暂未处理</span>
112 113 114
          <span v-if="scope.row.dealStatus == 1">不需处理</span>
          <span v-if="scope.row.dealStatus == 2">已处理完成</span>
          <span v-if="scope.row.dealStatus == 3">未处理完成</span>
115 116
        </template>
      </el-table-column>
王晓倩's avatar
王晓倩 committed
117
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
118
        <template slot-scope="scope">
王晓倩's avatar
王晓倩 committed
119 120 121 122 123 124 125 126 127 128 129 130 131
          <el-button
            size="normal"
            type="text"
            icon="el-icon-edit"
            @click="handleIssue(scope.row)"
            v-hasPermi="['workOrder:basicsInfo:add']"
            v-if="scope.row.orderId == '' || scope.row.orderId == null">
            生成工单
          </el-button>
          <el-button
            size="normal"
            type="text"
            icon="el-icon-edit"
132 133
            @click="showDetail(scope.row)"
            v-hasPermi="['dataMonitoring:deviceAlarm:query']">
王晓倩's avatar
王晓倩 committed
134
            详情
yaqizhang's avatar
yaqizhang committed
135
          </el-button>
136 137 138
        </template>
      </el-table-column>
    </el-table>
139

王晓倩's avatar
王晓倩 committed
140 141 142
    <pagination
      v-show="total>0"
      :total="total"
143 144
      :page.sync="pageNum"
      :limit.sync="pageSize"
yaqizhang's avatar
yaqizhang committed
145
      @pagination="getList" />
146

147 148 149
    <!-- 添加工单信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
150
        <el-form-item label="报警设备" prop="deviceName">
纪泽龙's avatar
纪泽龙 committed
151
          <font>{{ form.deviceName }}</font>
152 153
        </el-form-item>
        <el-form-item label="报警类型" prop="alarmType">
纪泽龙's avatar
纪泽龙 committed
154
          <font>{{ form.alarmType }}</font>
155 156
        </el-form-item>
        <el-form-item label="报警值" prop="alarmValue">
纪泽龙's avatar
纪泽龙 committed
157
          <font>{{ form.alarmValue }}</font>
158
        </el-form-item>
159
        <el-form-item label="工单名称" prop="orderName">
160
          <el-input v-model="form.orderName" placeholder="请输入工单名称" style="width: 590px" />
161
        </el-form-item>
162
        <el-form-item label="指定执行人员" prop="appointInspector">
163
          <el-select v-model="form.appointInspector" placeholder="请选择执行人员" clearable size="small" @change="setUserId" style="width: 590px">
王晓倩's avatar
王晓倩 committed
164 165 166 167 168 169
            <el-option
              v-for="item in inspector"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId"
            ></el-option>
170 171 172
          </el-select>
        </el-form-item>
        <el-form-item label="工单描述" prop="remarks">
173
          <el-input type="textarea" v-model="form.remarks" placeholder="请输入工单描述" style="width: 590px" />
174 175 176 177 178 179 180 181 182 183 184
        </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>
yaqizhang's avatar
yaqizhang committed
185 186 187
  import { listDeviceAlarm, getDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm";
  import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
  import { inspectorList } from "@/api/system/user";
188 189 190

export default {
  name: "DeviceAlarm",
纪泽龙's avatar
纪泽龙 committed
191
  components: {},
192 193
  data() {
    return {
纪泽龙's avatar
纪泽龙 committed
194 195
      // 判断是从哪里来的,如果是地图里来的,则可以返回
      fromGisMap:false,
196 197 198 199 200 201 202 203 204 205 206 207 208 209
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
210 211
      pageNum: 1,
      pageSize: 10,
212 213
      // 报警信息表格数据
      deviceAlarmList: [],
214 215
      // 报警类型字典
      typeOptions: [],
216 217 218 219 220 221 222 223 224 225 226 227 228
      // 设备级联
      options: [],

      props: {
        multiple: true,
        value: "id",
        label: "name",
        level: "level",
        children: "childList",
      },
      devices: null,
      // 巡检员列表
      inspector: [],
229 230 231 232 233 234
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
王晓倩's avatar
王晓倩 committed
235
        deviceCode: null,
236 237
        orderId: null,
        alarmType: null,
王晓倩's avatar
王晓倩 committed
238 239
        startTime1: null,
        endTime1: null,
纪泽龙's avatar
纪泽龙 committed
240
        dealStatus: null,
241 242
      },
      // 表单参数
纪泽龙's avatar
纪泽龙 committed
243
      form: {},
244 245
      // 表单校验
      rules: {
246
        orderName: [
纪泽龙's avatar
纪泽龙 committed
247
          { required: true, message: "工单名称不能为空", trigger: "blur" },
248
        ],
249
        appointInspector: [
纪泽龙's avatar
纪泽龙 committed
250
          { required: true, message: "请选择巡检人员", trigger: "blur" },
251
        ],
纪泽龙's avatar
纪泽龙 committed
252
      },
253 254 255 256
    };
  },
  created() {
    this.getList();
纪泽龙's avatar
纪泽龙 committed
257
    this.getDicts("t_alarm_type").then((response) => {
258 259
      this.typeOptions = response.data;
    });
260
  },
纪泽龙's avatar
纪泽龙 committed
261 262 263 264 265 266 267 268 269 270 271
  beforeRouteEnter: (to, from, next) => {
    next((vm) => {
      // 如果是从地图里来的
      if(from.path=="/enterprise/mapView"){
        // console.log(123)
        vm.fromGisMap=true;
      }else{
        vm.fromGisMap=false;
      }
    });
  },
272 273 274 275
  methods: {
    /** 查询报警信息列表 */
    getList() {
      this.loading = true;
纪泽龙's avatar
纪泽龙 committed
276
      listDeviceAlarm(this.queryParams).then((response) => {
277 278 279 280 281
        this.deviceAlarmList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
纪泽龙's avatar
纪泽龙 committed
282
    getInspectorList() {
283
      this.loading = true;
纪泽龙's avatar
纪泽龙 committed
284
      inspectorList().then((response) => {
285
        this.inspector = response.data;
286 287 288
        this.loading = false;
      });
    },
纪泽龙's avatar
纪泽龙 committed
289
    setUserId(val) {
290 291
      this.form.appointInspector = val;
    },
292 293 294 295 296
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
王晓倩's avatar
王晓倩 committed
297 298 299 300 301 302 303 304 305 306 307 308
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
        orderType: null,
        orderName: null,
        orderStatus: "0",
        createTime: null,
        appointInspector: null,
        allotTime: null,
        actualInspector: null,
        actualTime: null,
纪泽龙's avatar
纪泽龙 committed
309
        remarks: null,
310
      };
王晓倩's avatar
王晓倩 committed
311
      this.resetForm("form");
312
    },
王晓倩's avatar
王晓倩 committed
313 314
    /** 搜索按钮操作 */
    handleQuery() {
315
      this.pageNum = 1;
316
      this.getList();
王晓倩's avatar
王晓倩 committed
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.alarmId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 下发按钮操作 */
    handleIssue(row) {
      this.reset();
      this.getInspectorList();
纪泽龙's avatar
纪泽龙 committed
333 334
      const alarmId = row.alarmId || this.ids;
      getDeviceAlarm(alarmId).then((response) => {
王晓倩's avatar
王晓倩 committed
335 336 337
        this.form = response.data;
        this.open = true;
        this.title = "填写工单信息";
338
      });
339
    },
王晓倩's avatar
王晓倩 committed
340 341
    /** 提交按钮 */
    submitForm() {
纪泽龙's avatar
纪泽龙 committed
342
      this.$refs["form"].validate((valid) => {
王晓倩's avatar
王晓倩 committed
343 344 345
        if (valid) {
          this.form.resourceId = this.form.alarmId;
          this.form.orderType = "3";
纪泽龙's avatar
纪泽龙 committed
346
          addBasicsInfo(this.form).then((response) => {
王晓倩's avatar
王晓倩 committed
347 348 349 350 351 352 353
            this.msgSuccess("生成工单成功");
            this.open = false;
            this.getList();
          });
        }
      });
    },
354
    /** 详细信息跳转 */
王晓倩's avatar
王晓倩 committed
355 356
    showDetail(row) {
      this.$router.push({
yaqizhang's avatar
yaqizhang committed
357
        path: '/dataMonitoring/alarmdetail',
王晓倩's avatar
王晓倩 committed
358
        query: {
yaqizhang's avatar
yaqizhang committed
359 360
          alarmId: row.alarmId,
          deviceType:row.deviceType
王晓倩's avatar
王晓倩 committed
361 362 363
        }
      }) //带参跳转
    },
纪泽龙's avatar
纪泽龙 committed
364
  },
王晓倩's avatar
王晓倩 committed
365 366
};
</script>