index.vue 9.44 KB
Newer Older
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 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 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
<template>
  <div class="data-watch">
    <el-card class="box-card">
      <div class="watch-left">
        <img :src="`${appPicApi}${picUrl}`" alt="" />
        <div class="watch-topRight">
          <div class="ex-pic">
            <img src="../../../assets/images/dixiashuiwei/02.png" alt="" />
            <span>监测示意图</span>
          </div>
        </div>
      </div>
      <div class="watch-right">
        <div class="lcl-title">地下水位监测数据</div>
        <div id="radar-table">
          <el-table
            :data="NbwyTableData"
            height="230"
            border
            stripe
            style="width: 100%"
            :header-cell-style="{
              textAlign: 'center',
              height: '20px',
            }"
            :row-style="{ height: '20px' }"
          >
            <el-table-column align="center" prop="monNumber" label="监测编号">
            </el-table-column>
            <el-table-column align="center" prop="pointName" label="监测点位">
            </el-table-column>
            <el-table-column
              align="center"
              prop="monValue"
              label="监测值(mm)"
            >
            </el-table-column>

            <el-table-column
              align="center"
              prop="monAlarmLevel"
              label="预警状态"
            >
            </el-table-column>
            <el-table-column align="center" prop="monStatus" label="工作状态">
              <template slot-scope="scope">
                <span v-if="scope.row.monStatus == 0">正常</span>
                <span v-if="scope.row.monStatus == 1">停止</span>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="clb"></div>
        <div class="lcl-title">地下水位监测曲线</div>
        <div
          class="chart-container"
          v-for="item in AllChartData"
          :key="item.id"
        >
          <div class="chartNbwy">
            <ChartsForLine :ChartsForLineParant="item" />
          </div>
          <div class="chartNbwyName">{{ item.name }}</div>
        </div>
        <div class="clb"></div>
      </div>
      <div class="clb"></div>
    </el-card>
  </div>
</template>
<script>
// import { defineComponent } from "@vue/composition-api";
import ChartsForLine from "@/components/lclEcharts/ChartsForLine";
import { waterreal, waterimage, imageList } from "@/api/lclApi/lclapi";
export default {
  data() {
    return {
      NbwyTableData: [
        {
          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",
        },
      ],
      AllChartData: [
        {
          name: "+205马道 地下水位监测点",
          chartId: "radar-chart",
          color: ["#f7af0b", "#05f57a", "#f40852"],
          value: [
            {
              name: "1-1测斜仪",
              value: [
                {
                  createTime: "2023-03-11 14:05:51",
                  updateTime: "2023-03-11 08:37:51",
                  monStatus: 0,
                  pointName: "+205马道 地下水位监测点",
                  id: 8,
                  monNumber: "1-1测斜仪",
                  monName: "1-1测斜仪",
                  monValueA: "0.1",
                  monValueB: "0.11",
                  monAlarmStatus: 0,
                  monDept: "10m",
                  disValue: "0.149",
                },
              ],
            },
          ],
        },
      ],
      allYDataForEchart: [],
      allXDataForEchart: [],
      appPicApi: "",
      picUrl: "",
    };
  },
  components: {
    ChartsForLine,
  },
  created() {},
  mounted() {
    this.$nextTick(() => {
      this.getRealList();
      this.getchart();
      this.appPicApi = this.$store.getters.appPicApi;
      imageList({ monType: 7 }).then((res) => {
        this.picUrl = res.rows[0].image;
      });
    });
  },
  methods: {
    getRealList() {
      waterreal().then((res) => {
        if (res && res.code === 200 && res.rows) {
          this.NbwyTableData = res.rows;
        }
      });
    },
    getchart() {
      waterimage()
        .then((res) => {
          if (res && res.code === 200 && res.rows) {
            this.AllChartData = res.rows;
          }
        })
        .then(() => {
          var yFData = this.AllChartData.map((v) => v.value);
          var allYdata = [];
          var sonData = [];
          for (let i = 0; i < yFData.length; i++) {
            var yDataitem = [];
            for (let j = 0; j < yFData[i].length; j++) {
              yDataitem.push(yFData[i][j].value);
            }
            sonData.push(yDataitem);
          }
          for (let i = 0; i < sonData.length; i++) {
            var hhh = [];
            for (let j = 0; j < sonData[i].length; j++) {
              hhh.push(sonData[i][j].map((v) => v.disValue));
            }
            allYdata.push(hhh);
          }

          this.allYDataForEchart = allYdata;
        })
        .then(() => {
          let that = this;
          this.AllChartData = this.AllChartData.map((v, k) => {
            console.log(v.value[0]);
            return {
              name: v.name,
              chartId: `nbwy-${k + 1}`,
              color: ["#f7af0b", "#05f57a", "#f40852"],
              chartType: "line",
              axisLabel: "#0562AF",
              itemColor: "rgba(42,148,226,1)",
              unit: "mm",
              bgc: "#fff",
              grid: {
                left: "10%",
                right: "5%",
                bottom: "10%",
                top: "15%",
                z: 22,
              },
              showlegend: true,
              legendItem: v.value.map((item) => item.name),
              // xAxisData: that.allXDataForEchart,
              xAxisData: v.value[0].value.map((item, kk) => item.createTime),
              yData: that.allYDataForEchart[k],
            };
          });
        });
    },
  },
};
</script>
<style lang="scss" scoped>
.clb {
  clear: both;
}
.data-watch {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  height: 100%;
  // border-radius: 10px;
  // background-color: teal;
  .box-card {
    width: 100%;
    .watch-left {
      width: 45%;
      float: left;
      position: relative;
      > img {
        border-radius: 4px;

        display: block;
        max-height: 100%;
        max-width: 100%;
        margin: 0 auto;
        object-fit: scale-down;
      }
      .watch-topRight {
        width: 20%;
        height: 20%;
        position: absolute;
        right: 10px;
        top: 10px;
        background-color: rgba(255, 255, 255, 0.5);
        border-radius: 10px;
        .ex-pic {
          position: relative;
          width: 100%;
          height: 100%;
          > img {
            width: 100%;
            height: 100%;
            object-fit: scale-down;
          }
          > span {
            position: absolute;
            left: 10px;
            top: 0px;
            font-size: 20px;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #333333;
          }
        }
      }
    }
    .watch-right {
      width: 55%;
      padding: 10px;
      float: left;
      .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;
        }
      }
      #radar-table {
        width: 100%;
        height: 100%;
        // border: 1px solid #c7d8ee;
        box-sizing: border-box;
        ::v-deep .el-table--border,
        ::v-deep .el-table--group {
          border: 1px solid #c7d8ee !important;
        }
        // 设置滚动条的宽度
        ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
          width: 6px;
        }
        // 设置滚动条的背景色和圆角
        ::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
          background-color: #c7d8ee;
          border-radius: 8px;
        }
        /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
        ::v-deep ::-webkit-scrollbar {
          width: 6px;
          /*滚动条宽度*/
          height: 12px;
          /*滚动条高度*/
          background-color: white;
        }

        /*定义滑块 内阴影+圆角*/
        ::v-deep ::-webkit-scrollbar-thumb {
          box-shadow: inset 0 0 0px white;
          -webkit-box-shadow: inset 0 0 0px white;
          background-color: rgb(193, 193, 193);
          /*滚动条的背景颜色*/
          border-radius: 20px;
        }

        //解决表格固定列时的压样式问题
        .el-table__fixed {
          height: 100px;
          width: 12px;
        }
      }
      .chart-container {
        width: 49%;
        height: 240px;
        float: left;
        border: 1px solid #0562af;
        box-sizing: border-box;
        margin: 1% 0 5px 1%;
        overflow: hidden;
        .chartNbwy {
          width: 100%;
          height: 200px;
        }
        .chartNbwyName {
          font-size: 20px;
          text-align: center;
          line-height: 40px;
        }
      }
    }
  }
}
</style>