index.vue 7.5 KB
Newer Older
1 2 3
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4
      <el-form-item label="设备编号" prop="deviceCode">
5
        <el-input
6 7
          v-model="queryParams.deviceCode"
          placeholder="请输入设备编号"
8 9 10 11 12 13 14
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报警类型" prop="alarmType">
        <el-select v-model="queryParams.alarmType" placeholder="请选择报警类型" clearable size="small">
15 16 17 18 19 20
          <el-option
            v-for="dict in typeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          ></el-option>
21 22 23 24 25 26 27 28 29 30
        </el-select>
      </el-form-item>
      <el-form-item>
        <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>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="deviceAlarmList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
31 32
      <el-table-column label="序号" align="center" type="index" />
      <el-table-column label="设备编号" align="center" prop="deviceCode" />
33 34 35 36
      <el-table-column label="报警类型" align="center" prop="alarmType" />
      <el-table-column label="报警值" align="center" prop="alarmValue" />
      <el-table-column label="报警开始时间" align="center" prop="startTime" width="180">
        <template slot-scope="scope">
37
          <span>{{ parseTime(scope.row.startTime) }}</span>
38 39 40 41
        </template>
      </el-table-column>
      <el-table-column label="报警结束时间" align="center" prop="endTime" width="180">
        <template slot-scope="scope">
42 43 44 45 46 47 48 49
          <span>{{ parseTime(scope.row.endTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="处理状态" align="center" prop="dealStatus" >
        <template slot-scope="scope">
          <span v-if="scope.row.dealStatus == null">未处理</span>
          <span v-if="scope.row.dealStatus == 3">已解决</span>
          <span v-if="scope.row.dealStatus != 3 && scope.row.dealStatus != null">已解决</span>
50 51 52 53 54 55 56 57
        </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"
58 59 60 61
            @click="handleAdd(scope.row)"
            v-hasPermi="['workOrder:basicsInfo:add']"
            v-if="scope.row.orderId == '' || scope.row.orderId == null"
          >下发工单</el-button>
62 63 64
          <el-button
            size="mini"
            type="text"
65 66 67 68
            icon="el-icon-edit"
            @click="showDetail(scope.row)"
            v-if="scope.row.orderId != '' && scope.row.orderId != null"
          >详情</el-button>
69 70 71
        </template>
      </el-table-column>
    </el-table>
72

73 74 75 76 77 78 79 80
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

81 82 83 84 85
    <!-- 添加工单信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
        <el-form-item label="工单名称" prop="orderName">
          <el-input v-model="form.orderName" placeholder="请输入工单名称" />
86
        </el-form-item>
87 88
        <el-form-item label="指定执行人员" prop="appointInspector">
          <el-input v-model="form.appointInspector" placeholder="请输入指定执行人员" />
89 90 91 92 93 94 95 96 97 98 99
        </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>
100 101 102
import { listDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import { inspectorList } from "@/api/system/user";
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

export default {
  name: "DeviceAlarm",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 报警信息表格数据
      deviceAlarmList: [],
126 127 128 129
      // 巡检员列表数据
      inspectorList: [],
      // 报警类型字典
      typeOptions: [],
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
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        deviceId: null,
        orderId: null,
        alarmType: null,
        alarmValue: null,
        startTime: null,
        endTime: null,
        dealStatus: null,
        remarks: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
156 157 158
    this.getDicts("t_alarm_type").then(response => {
      this.typeOptions = response.data;
    });
159 160 161 162 163 164 165 166 167 168 169
  },
  methods: {
    /** 查询报警信息列表 */
    getList() {
      this.loading = true;
      listDeviceAlarm(this.queryParams).then(response => {
        this.deviceAlarmList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
170 171 172 173 174 175 176 177
    /** 获取用户信息列表 */
    getUserList() {
      this.loading = true;
      inspectorList().then(response => {
        this.inspectorList = response.rows;
        this.loading = false;
      });
    },
178 179 180 181 182 183 184 185 186
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
187 188 189
        orderType: null,
        orderName: null,
        orderStatus: "0",
190
        createTime: null,
191 192 193 194
        appointInspector: null,
        allotTime: null,
        actualInspector: null,
        actualTime: null,
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
        remarks: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.alarmId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
216
    handleAdd(row) {
217
      this.reset();
218 219
      this.form.resourceId = row.alarmId;
      this.form.orderType = "3";
220
      this.open = true;
221
      this.title = "填写工单信息";
222 223 224 225 226
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
227 228 229 230 231
          addBasicsInfo(this.form).then(response => {
            this.msgSuccess("下发工单成功");
            this.open = false;
            this.getList();
          });
232 233 234
        }
      });
    },
235 236 237 238 239 240 241 242
    /** 工单详细信息跳转 */
    showDetail(row) {
      this.$router.push({
        path: '/basicsInfo/detail',
        query:{
          orderId : row.orderId
        }
      }) //带参跳转
243 244 245 246
    },
  }
};
</script>