lineTable.vue 10.3 KB
Newer Older
yanzhongrong's avatar
yanzhongrong committed
1 2 3 4 5 6 7 8 9 10 11
<template>
  <div>
    <div class="leakage-top">
      <div style="color: #666666"></div>
      <div class="operate-btn">
        <delids :multipleSelection2="multipleSelection" @del="del()"
          >删除</delids
        >
        <el-button type="primary" @click="refresh">刷新</el-button>
        <el-button type="primary" @click="block = !block">查询</el-button>
        <el-button type="primary" @click="exportData">导出</el-button>
12
        
yanzhongrong's avatar
yanzhongrong committed
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
      </div>
    </div>
    <el-form
      class="search-div"
      v-if="block"
      :model="form"
      :inline="true"
      size="mini"
    >
      <el-form-item label="天馈线描述:">
        <el-input
          placeholder="请输入天馈线描述"
          v-model="form.feederDescribe"
          clearable
        >
        </el-input>
      </el-form-item>
      <el-form-item label="天馈线编号:">
        <el-input
          placeholder="请输入天馈线编号"
          v-model="form.feederCode"
          clearable
        >
        </el-input>
      </el-form-item>
      <el-form-item label="天馈线型号:">
        <el-select
          placeholder="请选择天馈线型号"
          v-model="form.feederModel"
          clearable
        >
          <el-option
            v-for="item in equipTypeList"
            :key="item.feederModel"
            :label="item.feederModel"
            :value="item.feederModel"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="所在铁路线:">
        <el-select
          placeholder="请选择所在铁路线"
          v-model="form.wayId"
          clearable
          @change="changerailWay()"
        >
          <el-option
            v-for="item in railWaySelect"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="所在站点:">
        <el-select
          placeholder="请选择所在站点"
          v-model="form.siteId"
          @change="changesite()"
          clearable
        >
          <el-option
            v-for="item in stationSelect2"
            :key="item.id"
            :label="item.siteName"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="所在FSU:">
        <el-select
          placeholder="请选择所在FSU"
          v-model="form.fsuId"
          @change="changefsu()"
          clearable
        >
          <el-option
            v-for="item in fsuSelect2"
            :key="item.id"
            :label="item.equipName"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="所在监测设备:">
        <el-select
          placeholder="请选择所在监测设备"
          v-model="form.monitor"
          clearable
        >
          <el-option
            v-for="item in monitor2"
            :key="item.id"
            :label="item.equipName"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="success" @click="searchQuery()">查询</el-button>
        <el-button type="primary" @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table
      ref="multipleTable"
      class="statistics-table"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      :row-class-name="tableRowClassName"
      :row-style="{ height: '50px' }"
      :header-cell-style="{
        background: '#eaf1fe',
        color: '#000',
        fontWeight: 700,
        height: '50px',
      }"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column
        prop="feederDescribe"
        label="天馈线描述"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        prop="feederCode"
        label="天馈线编号"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        prop="feederModel"
        label="天馈线型号"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column prop="railWayName" label="所在铁路线" align="center" />
      <el-table-column prop="siteName" label="所在站点" align="center" />
      <el-table-column prop="fsuName" label="所在FSU" align="center" />
      <el-table-column prop="equipName" label="所在监测设备" align="center" />
      <el-table-column
        prop="action"
yanzhongrong's avatar
yanzhongrong committed
157
        label="操作"
yanzhongrong's avatar
yanzhongrong committed
158 159 160 161
        show-overflow-tooltip
        align="center"
      >
        <template slot-scope="{ row }">
yanzhongrong's avatar
yanzhongrong committed
162 163 164 165 166
          <el-link type="primary" :underline="false" @click="handleView(row)"
            >查看</el-link
          >
          <el-link type="primary" :underline="false" @click="toEdit(row)"
            >编辑</el-link
167 168 169
          >
                    <el-link type="primary" :underline="false" @click="handleSetting(row)"
            >参数设置</el-link
yanzhongrong's avatar
yanzhongrong committed
170
          >
yanzhongrong's avatar
yanzhongrong committed
171 172 173 174 175 176 177 178 179 180
        </template>
      </el-table-column>
    </el-table>
    <Pagination
      :limit="form.size"
      :page="form.current"
      :total="total"
      class="pagination"
      @pagination="handlePageChange"
    />
yanzhongrong's avatar
yanzhongrong committed
181 182

    <el-dialog
yanzhongrong's avatar
yanzhongrong committed
183 184 185 186
      title="编辑-天馈线"
      :visible.sync="visible"
      width="40%"
      :close-on-click-modal="false"
yanzhongrong's avatar
yanzhongrong committed
187 188 189
    >
      <lineVue :curInfo="curInfo" :isEdit="1" @update="update" />
    </el-dialog>
yanzhongrong's avatar
yanzhongrong committed
190 191 192
  </div>
</template>
<script>
yanzhongrong's avatar
yanzhongrong committed
193
import lineVue from "../../add/comp/line.vue";
yanzhongrong's avatar
yanzhongrong committed
194 195 196 197 198 199 200 201 202 203 204 205
import {
  antennaFeederList,
  antennaFeederDelete,
  railWaylist,
  selectForSite,
  selectForFsu,
  selectForEquip,
} from "../../api";
import { cableTypeEnum } from "../../../maintain/api";
import { successAlert, warningAlert } from "@/utils/alert";
import download from "@/utils/download";
import { exportFeeder } from "@/api/export";
yanzhongrong's avatar
yanzhongrong committed
206

yanzhongrong's avatar
yanzhongrong committed
207
export default {
yanzhongrong's avatar
yanzhongrong committed
208
  components: { lineVue },
yanzhongrong's avatar
yanzhongrong committed
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
  data() {
    return {
      railWaySelect: [],
      stationSelect2: [],
      fsuSelect2: [],
      equipTypeList: [],
      monitor2: [],
      form: formInit(),
      tableData: [],
      params: {
        current: 1,
        size: 10,
      },
      total: 10,
      multipleSelection: [],
      ids: [],
      block: 0,
      istrue: 0,
      exids: [],
yanzhongrong's avatar
yanzhongrong committed
228 229
      curInfo: {},
      visible: false,
yanzhongrong's avatar
yanzhongrong committed
230 231
    };
  },
yanzhongrong's avatar
yanzhongrong committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245
  created() {
    var that = this;
    document.onkeydown = function (e) {
      var key = window.event.keyCode;
      if (key == 13) {
        that.searchQuery();
      }
    };
  },
  mounted() {
    this.getTableData();
    this.getLeakyCablel();
    this.getAllWay();
  },
yanzhongrong's avatar
yanzhongrong committed
246
  methods: {
yanzhongrong's avatar
yanzhongrong committed
247
    toEdit(row) {
yanzhongrong's avatar
yanzhongrong committed
248 249
      this.visible = true;
      this.curInfo = row;
yanzhongrong's avatar
yanzhongrong committed
250 251
    },
    update(data) {
yanzhongrong's avatar
yanzhongrong committed
252 253 254
      this.visible = false;
      if (data) {
        this.getTableData();
yanzhongrong's avatar
yanzhongrong committed
255 256
      }
    },
yanzhongrong's avatar
yanzhongrong committed
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
    changerailWay() {
      selectForSite({ wayId: this.form.wayId }).then((res) => {
        this.stationSelect2 = res;
      });
    },
    changesite() {
      selectForFsu({ siteId: this.form.siteId }).then((res) => {
        this.fsuSelect2 = res;
      });
    },
    changefsu() {
      selectForEquip({ fsuId: this.form.fsuId }).then((res) => {
        this.monitor2 = res;
      });
    },
    tableRowClassName({ row, rowIndex }) {
      return rowIndex % 2 === 0 ? "" : "single-row";
    },
    changeType(item) {
      this.activeName = item.key;
    },
    del() {
      let ids = this.ids;
      antennaFeederDelete({ ids }).then((res) => {
        if (res.code == 200) {
          successAlert("删除成功");
          this.getTableData();
        } else {
          warningAlert("删除失败");
        }
      });
    },
    refresh() {
      this.reset();
    },
    searchQuery() {
      this.istrue = 1;
      this.getTableData();
    },
    reset() {
      this.form = formInit();
      this.searchQuery();
    },
    exportData() {
      if (this.exids.length == 0) {
        this.$message.warning("暂无数据");
        return false;
      } else {
        exportFeeder({ ids: this.exids }).then((res) => {
          download(res, "vnd.ms-excel", `天馈线表.xls`);
        });
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
      this.ids = this.multipleSelection.map((i) => i.id);
    },
    handleView(row) {
      this.$router.push({
        path: "/detail",
        query: {
          id: row.id,
yanzhongrong's avatar
yanzhongrong committed
319 320
          type: 6,
          name: row.feederDescribe
yanzhongrong's avatar
yanzhongrong committed
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 350 351 352 353 354 355 356 357 358 359 360
        },
      });
    },
    handlePageChange(pageData) {
      this.form.size = pageData.size;
      this.form.current = pageData.page;
      this.getTableData();
    },
    getTableData() {
      antennaFeederList(this.form).then((res) => {
        let list = res.records || [];
        this.tableData = list;
        this.total = res.total;
        this.exids = list.map((i) => i.id);
        if (this.istrue == 1) {
          if (this.tableData.length) {
            successAlert("操作成功");
          } else {
            warningAlert("查询结果为空");
          }
          this.istrue = 0;
        }
      });
    },
    getAllWay() {
      railWaylist(this.params).then((res) => {
        this.railWaySelect = res.records;
        if (res.total > this.params.size) {
          this.params.size = res.total;
          this.getAllWay();
        }
      });
    },
    getLeakyCablel() {
      cableTypeEnum().then((res) => {
        let list = res || [];
        this.equipTypeList = list;
      });
    },
  },
yanzhongrong's avatar
yanzhongrong committed
361 362
}

yanzhongrong's avatar
yanzhongrong committed
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
function formInit(data = {}) {
  return {
    wayId: "",
    parentId: "",
    siteId: "",
    fsuId: "",
    monitor: "",
    feederCode: "",
    feederDescribe: "",
    siteName: "",
    feederModel: "",
    current: 1,
    size: 10,
    ...data,
  };
}
</script>
<style lang="scss" scoped>
yanzhongrong's avatar
yanzhongrong committed
381 382 383
.el-link {
  margin-right: 20px;
}
yanzhongrong's avatar
yanzhongrong committed
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
.leakage-cable {
  .leakage-top {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
  }
  & ::v-deep .cell {
    color: #333333;
  }
  & ::v-deep .stripe {
    background-color: #eaf1fe;
  }
  & ::v-deep .red {
    background-color: #f00;
  }
  & ::v-deep .green {
    background-color: green;
  }
  .page {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    .pageNum {
      margin: 0 20px;
    }
  }
}
</style>
<style lang="scss">
.statistics-table {
  .single-row {
    background: #f1f6ff;
  }
  td {
    padding: 5px !important;
  }
}
</style>