index.vue 4.81 KB
Newer Older
1 2
<template>
  <div class="STBbase-wrapper height100">
3 4 5
    <div class="search-container">
      <el-form :inline="true" :model="form">
        <el-form-item>
乐宝呗666's avatar
乐宝呗666 committed
6
          <el-select v-model="form.orgId" placeholder="请选择所属单位">
7
            <el-option
乐宝呗666's avatar
乐宝呗666 committed
8 9 10 11
              v-for="item in orgOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
12 13 14 15
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
乐宝呗666's avatar
乐宝呗666 committed
16
          <el-select v-model="form.status" placeholder="请选择机顶盒状态">
17
            <el-option
乐宝呗666's avatar
乐宝呗666 committed
18
              v-for="item in statusOptions"
19 20 21 22 23 24 25 26
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-cascader
乐宝呗666's avatar
乐宝呗666 committed
27
            v-model="form.areaId"
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
            :options="areaOptions"
            :props="defaultProps"
            :show-all-levels="false"
          ></el-cascader>
        </el-form-item>
        <el-form-item>
          <div class="btn-group">
            <el-button type="primary" @click="onSearch">查询</el-button>
            <el-button @click="handleReset">重置</el-button>
          </div>
        </el-form-item>
      </el-form>
      <div class="page-tip">
        <span class="page-tip-title">页面说明:</span>
        <span class="page-tips">可按照机顶盒状态及所属单位进行信息筛选。可查看当前系统所有机顶盒运维状态信息。</span>
43
      </div>
44 45 46 47 48
    </div>
    <div class="table-content">
      <div class="party-table">
        <el-table border style="width: 100%;height:100%" height="100%" :data="tableData">
          <el-table-column type="index" width="120" label="序号"></el-table-column>
乐宝呗666's avatar
乐宝呗666 committed
49 50 51 52 53 54 55 56 57
          <el-table-column label="mac地址" prop="mac"></el-table-column>
          <el-table-column label="所属单位" prop="organName"></el-table-column>
          <el-table-column label="机顶盒状态" prop="status">
            <template slot-scope="scope">
              <span v-if="scope.row.status===1">待激活</span>
              <span v-if="scope.row.status===2">已激活</span>
              <span v-if="scope.row.status===3">故障</span>
            </template>
          </el-table-column>
58
        </el-table>
59
      </div>
乐宝呗666's avatar
乐宝呗666 committed
60 61 62 63 64 65 66 67 68 69
      <div class="partyt-pagination" style="margin:0 20px;">
        <el-pagination
          background
          @current-change="handleCurrentChange"
          :current-page="page.currentPage"
          :page-size="page.pageSize"
          layout="prev, pager, next, jumper"
          :total="page.total"
        ></el-pagination>
      </div>
70
    </div>
71 72 73
  </div>
</template>
<script>
74
import { getAreas } from "@/config/area.js";
乐宝呗666's avatar
乐宝呗666 committed
75
import { getOrgListWithOutPage } from "@/config/organ.js";
76
export default {
77 78 79 80 81 82 83 84 85
  data() {
    return {
      page: { currentPage: 1, pageSize: 10, total: 0 },
      areaOptions: [],
      defaultProps: {
        label: "name",
        value: "id",
        checkStrictly: true,
      },
乐宝呗666's avatar
乐宝呗666 committed
86 87
      orgOptions: [],
      statusOptions: [
88 89 90 91 92 93
        {
          value: "1",
          label: "待激活"
        },
        {
          value: "2",
乐宝呗666's avatar
乐宝呗666 committed
94
          label: "已激活"
95 96 97
        },
        {
          value: "3",
乐宝呗666's avatar
乐宝呗666 committed
98
          label: "故障"
99 100 101
        }
      ],
      form: {
乐宝呗666's avatar
乐宝呗666 committed
102 103 104
        orgId: "",
        status: "",
        areaId: []
105
      },
乐宝呗666's avatar
乐宝呗666 committed
106
      tableData:[]
107 108 109 110
    };
  },
  mounted() {
    this.getAreas();
乐宝呗666's avatar
乐宝呗666 committed
111 112
    this.onSearch();
    this.getOrgList()
113 114 115 116 117 118
  },
  methods: {
    getAreas() {
      getAreas().then(res => {
        this.areaOptions = res;
      });
119
    },
乐宝呗666's avatar
乐宝呗666 committed
120 121 122 123 124
    getOrgList(){
      getOrgListWithOutPage().then(res => {
        this.orgOptions = res;
      });
    },
125 126 127 128
    // 查询
    onSearch() {
      this.page.currentPage = 1;
      this.getTableData();
129
    },
130 131 132 133 134 135
    // 获得数据接口
    getTableData() {
      let vm = this;
      let param = {
        _index: this.page.currentPage,
        _size: this.page.pageSize,
乐宝呗666's avatar
乐宝呗666 committed
136 137 138
        areaId: this.form.areaId[this.form.areaId.length-1],
        organId: this.form.orgId,
        status: this.form.status,
139 140 141
      };
      vm.$https(
        {
乐宝呗666's avatar
乐宝呗666 committed
142
          url: "boxOperation/getPageList",
143 144
          method: "post",
          authType: this.backToken
145
        },
146 147 148
        vm.$qs.stringify(param)
      )
        .then(res => {
乐宝呗666's avatar
乐宝呗666 committed
149
          let data = res.data.data;
150
          vm.page.total = data.total;
乐宝呗666's avatar
乐宝呗666 committed
151
          vm.tableData = data.records;
152 153 154 155 156 157
        })
        .catch(function(err) {
          console.log(err);
        });
    },
    handleReset() {
乐宝呗666's avatar
乐宝呗666 committed
158 159 160 161 162 163
      this.form = {
        orgId: "",
        status: "",
        areaId: []
      };
      this.onSearch()
164 165 166 167 168
    },
    // 分页
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.getTableData();
169
    }
170 171
  }
};
172 173
</script>
<style lang="less">
174 175
@import "../../../style/table.less";
@import "../../../style/pagination.less";
176
</style>