index.vue 10.4 KB
Newer Older
王晓倩's avatar
王晓倩 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 62 63 64 65 66 67 68 69 70 71 72 73 74 75
<template>
  <div class="app-container">
    <div style="width: 100%;height: 10em;">
      <div class="first-div">
        <div style="width: 40%;height: 100%; text-align: center;float: left;font-size: 15px;">
          <img src="../../../assets/trouble.png" width="25%" style="margin-top: 2rem;">
          <p>事故发生数</p>
        </div>
        <div style="width: 60%;height: 100%;text-align: center;line-height: 9rem;float: right;font-size: 3rem;font-family: 'UnidreamLED';">{{troubleObj.troubleTotal}}</div>
      </div>
      <div class="first-div">
        <div style="width: 40%;height: 100%; text-align: center;float: left;font-size: 15px;">
          <img src="../../../assets/trouble.png" width="25%" style="margin-top: 2rem;">
          <p>伤亡人数</p>
        </div>
        <div style="width: 60%;height: 100%;text-align: center;line-height: 9rem;float: right;font-size: 3rem;font-family: 'UnidreamLED';">{{troubleObj.injuryTotal+troubleObj.deathTotal}}</div>
      </div>
      <div class="first-div">
        <div style="width: 40%;height: 100%; text-align: center;float: left;font-size: 15px;">
          <img src="../../../assets/trouble.png" width="25%" style="margin-top: 2rem;">
          <p>事故处理办结率</p>
        </div>
        <div style="width: 60%;height: 100%;text-align: center;line-height: 9rem;float: right;font-size: 3rem;font-family: 'UnidreamLED';">{{troubleObj.completionRate}}%</div>
      </div>
    </div>

    <div style="width: 100%; padding: 30px;">
      <el-table v-loading="loading" :data="troubleList" >
        <el-table-column label="事故名称" align="center" prop="troubleName" width="200px"/>
        <el-table-column label="事故类型" align="center" prop="troubleType" width="130px">
          <template slot-scope="scope">
            <span v-if="scope.row.troubleType == 1">生产安全事故</span>
            <span v-if="scope.row.troubleType == 2">非生产安全事故</span>
          </template>
        </el-table-column>
        <el-table-column label="事故地点" align="center" prop="troubleLocation" width="300px"/>
        <el-table-column label="事故发生时间" align="center" prop="happenDate" width="150px"/>
        <el-table-column label="是否人员伤亡" align="center" prop="isCasualties" width="150px">
          <template slot-scope="scope">
            <span v-if="scope.row.isCasualties == 1"></span>
            <span v-if="scope.row.isCasualties == 2"></span>
          </template>
        </el-table-column>
        <el-table-column label="责任单位" align="center" prop="responsibleUnit" width="180px"/>
        <el-table-column label="责任人员" align="center" prop="responsiblePeople"/>
        <el-table-column label="是否处理" align="center" prop="isDeal">
          <template slot-scope="scope">
            <span v-if="scope.row.isDeal == 1">已处理</span>
            <span v-if="scope.row.isDeal == 2">未处理</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="120px">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="showDetail(scope.row)"
            >详情</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"
      />
      <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body @cancel="cancel" @close="cancel">
        <el-row>
          <el-col :span="14">
            <el-form ref="detailForm" :model="detailForm" label-width="120px">
              <el-row>
王晓倩's avatar
王晓倩 committed
76
                <el-col :span="11">
王晓倩's avatar
王晓倩 committed
77
                  <el-form-item label="事故名称:">
王晓倩's avatar
王晓倩 committed
78
                    <el-input v-model="detailForm.troubleName" disabled/>
王晓倩's avatar
王晓倩 committed
79 80
                  </el-form-item>
                  <el-form-item label="事故原因:">
王晓倩's avatar
王晓倩 committed
81
                    <el-input v-model="detailForm.troubleReason" disabled/>
王晓倩's avatar
王晓倩 committed
82 83
                  </el-form-item>
                  <el-form-item label="责任单位:">
王晓倩's avatar
王晓倩 committed
84
                    <el-input v-model="detailForm.responsibleUnit" disabled/>
王晓倩's avatar
王晓倩 committed
85 86
                  </el-form-item>
                  <el-form-item label="是否人员伤亡:">
王晓倩's avatar
王晓倩 committed
87 88
                    <el-input v-if="detailForm.isCasualties == '1'" value="是" disabled/>
                    <el-input v-if="detailForm.isCasualties == '2'" value="是" disabled/>
王晓倩's avatar
王晓倩 committed
89 90
                  </el-form-item>
                </el-col>
王晓倩's avatar
王晓倩 committed
91
                <el-col :span="12">
王晓倩's avatar
王晓倩 committed
92
                  <el-form-item label="事故类型:">
王晓倩's avatar
王晓倩 committed
93 94
                    <el-input v-if="detailForm.troubleType == '1'" value="安全生产事故" disabled/>
                    <el-input v-if="detailForm.troubleType == '2'" value="非生产安全事故" disabled/>
王晓倩's avatar
王晓倩 committed
95 96
                  </el-form-item>
                  <el-form-item label="事故地点:">
王晓倩's avatar
王晓倩 committed
97
                    <el-input v-model="detailForm.troubleLocation" disabled/>
王晓倩's avatar
王晓倩 committed
98 99
                  </el-form-item>
                  <el-form-item label="责任人员:">
王晓倩's avatar
王晓倩 committed
100
                    <el-input v-model="detailForm.responsiblePeople" disabled/>
王晓倩's avatar
王晓倩 committed
101 102
                  </el-form-item>
                  <el-form-item label="是否处理:">
王晓倩's avatar
王晓倩 committed
103 104
                    <el-input v-if="detailForm.isDeal == '1'" value="已处理" disabled/>
                    <el-input v-if="detailForm.isDeal == '2'" value="未处理" disabled/>
王晓倩's avatar
王晓倩 committed
105 106 107 108 109 110
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row v-if="detailForm.isCasualties == '1'">
                <el-col :span="11">
                  <el-form-item label="受伤人数:">
王晓倩's avatar
王晓倩 committed
111
                    <el-input v-model="detailForm.injuryNum" disabled/>
王晓倩's avatar
王晓倩 committed
112 113 114 115
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="死亡人数:">
王晓倩's avatar
王晓倩 committed
116
                    <el-input v-model="detailForm.deathNum" disabled/>
王晓倩's avatar
王晓倩 committed
117 118 119 120
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
王晓倩's avatar
王晓倩 committed
121 122 123 124 125
                <el-col :span="23">
                  <el-form-item label="处理完成时间:">
                    <el-input v-model="detailForm.dealDate" disabled/>
                  </el-form-item>
                </el-col>
王晓倩's avatar
王晓倩 committed
126 127
              </el-row>
              <el-row>
王晓倩's avatar
王晓倩 committed
128 129 130 131 132
                <el-col :span="23">
                  <el-form-item label="简要经过:">
                    <el-input type="textarea" v-model="detailForm.briefProcess" disabled/>
                  </el-form-item>
                </el-col>
王晓倩's avatar
王晓倩 committed
133 134
              </el-row>
              <el-row>
王晓倩's avatar
王晓倩 committed
135 136 137 138 139
                <el-col :span="23">
                  <el-form-item label="备注信息:">
                    <el-input type="textarea" v-model="detailForm.remarks" disabled/>
                  </el-form-item>
                </el-col>
王晓倩's avatar
王晓倩 committed
140 141 142 143 144
              </el-row>
            </el-form>
          </el-col>

          <el-col :span="9">
王晓倩's avatar
王晓倩 committed
145
            <div style="width: 100%;height: 390px; border: 1px solid rgb(218, 213, 213);margin-bottom: 10px;">
王晓倩's avatar
王晓倩 committed
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
              <div style="width: 100%;height: 100%" id="troubleContainer"></div>
            </div>
          </el-col>
        </el-row>
      </el-dialog>
    </div>
  </div>
</template>

<script>
  import { troubleStatistic } from "@/api/statistic/statisticAnalysis";
  import { listTrouble, getTrouble } from "@/api/standingBook/trouble";
  import { EditorMap } from "@/utils/mapClass/getPath.js";

  export default {
    name: "TroubleStatisticAnalysis",
    components: {
    },
    data() {
      return {
        // 统计数据
        troubleObj: {},
        // 遮罩层
        loading: true,
        // 事故台账表格数据
        troubleList: [],
        // 总条数
        total: 0,
        // 地图
        map: null,
        devicePos: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
        },
        // 表单参数
        detailForm: {},
      };
    },
    created() {
    },
    mounted() {
      this.getStatiData();
      this.getList();
    },
    methods: {
      getStatiData() {
        troubleStatistic().then(response => {
          this.troubleObj = response.data;
        });
      },
      getList() {
        this.loading = true;
        listTrouble(this.queryParams).then(response => {
          this.troubleList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      reset() {
        this.detailForm = {
          troubleId: null,
          troubleName: null,
          troubleLocation: null,
          longitude: null,
          latitude: null,
          troubleType: null,
          briefProcess: null,
          troubleReason: null,
          isCasualties: null,
          injuryNum: null,
          deathNum: null,
          responsibleUnit: null,
          responsiblePeople: null,
          isDeal: null,
          happenDate: null,
          dealDate: null,
          createBy: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          isDel: null,
          remarks: null
        };
        this.resetForm("detailForm");
        this.devicePos = [];
      },
      /** 详细信息跳转 */
      showDetail(row) {
        this.reset();
        getTrouble(row.troubleId).then(response => {
          this.detailForm = response.data;
          this.devicePos = [this.detailForm.longitude, this.detailForm.latitude];
          console.log("this.devicePos",this.devicePos);
          this.open = true;
          this.title = "燃气事故台账详情";

          this.$nextTick(() => {
            this.map = new EditorMap("troubleContainer", {}, this);
            this.map.addDevice({ path: this.devicePos });
            this.map.nowMouseTarget = null;
            this.map.mousetoolClose(false);
          });
        });
      },
      cancel() {
        this.open = false;
        this.reset();
        this.map.destroy();
      },
    }
  };
</script>
<style>
  .first-div{
    margin-top: 20px;
    width: 30%;
    float: left;
    margin-left: 2.5%;
    height: 9rem;
    color: #515a6e;
    background-color: #FFF;
    border-radius: 5px;
    border: 2px solid rgb(22, 151, 207, 0.3);
    box-shadow:  0 0 8px 8px rgba(131, 229, 255, 0.1)inset, 0 0 7px 7px rgba(22, 151, 207, 0.2);
  }
</style>