index.vue 5.19 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>
qzhxx's avatar
qzhxx committed
6
          <el-select v-model="form.orgId" placeholder="请选择所属单位">
7
            <el-option
qzhxx's avatar
qzhxx 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>
qzhxx's avatar
qzhxx committed
16
          <el-select v-model="form.status" placeholder="请选择机顶盒状态">
17
            <el-option
qzhxx's avatar
qzhxx 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
qzhxx's avatar
qzhxx committed
27
            v-model="form.areaId"
28 29 30 31 32 33 34 35 36 37 38 39 40 41
            :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>
乐宝呗666's avatar
乐宝呗666 committed
42 43 44
        <span class="page-tips"
          >可按照机顶盒状态及所属单位进行信息筛选。可查看当前系统所有机顶盒运维状态信息。</span
        >
45
      </div>
46 47 48
    </div>
    <div class="table-content">
      <div class="party-table">
乐宝呗666's avatar
乐宝呗666 committed
49 50 51 52 53 54 55 56 57 58
        <el-table
          border
          style="width: 100%; height: 100%"
          height="100%"
          :data="tableData"
        >
          <el-table-column
            type="index"
            width="120"
            label="序号"
乐宝呗666's avatar
乐宝呗666 committed
59
            align="center"
乐宝呗666's avatar
乐宝呗666 committed
60
          ></el-table-column>
乐宝呗666's avatar
乐宝呗666 committed
61 62 63
          <el-table-column align="center" label="mac地址" prop="mac"></el-table-column>
          <el-table-column align="center" label="所属单位" prop="organName"></el-table-column>
          <el-table-column align="center" label="机顶盒状态" prop="status">
qzhxx's avatar
qzhxx committed
64
            <template slot-scope="scope">
乐宝呗666's avatar
乐宝呗666 committed
65
              <span>{{statusOptions[scope.row.status-1].label}}</span>
qzhxx's avatar
qzhxx committed
66 67
            </template>
          </el-table-column>
68
        </el-table>
69
      </div>
乐宝呗666's avatar
乐宝呗666 committed
70
      <div class="partyt-pagination" style="margin: 0 20px">
qzhxx's avatar
qzhxx committed
71 72 73 74 75 76 77 78 79
        <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>
80
    </div>
81 82 83
  </div>
</template>
<script>
84
import { getAreas } from "@/config/area.js";
qzhxx's avatar
qzhxx committed
85
import { getOrgListWithOutPage } from "@/config/organ.js";
86
export default {
87 88
  data() {
    return {
乐宝呗666's avatar
乐宝呗666 committed
89 90 91 92 93 94 95
      page: {
        currentPage: 1,
        pageSize: 10,
        total: 0,
      },
      orgOptions: [], // 单位信息
      areaOptions: [], // 区域信息
96 97 98 99 100
      defaultProps: {
        label: "name",
        value: "id",
        checkStrictly: true,
      },
qzhxx's avatar
qzhxx committed
101
      statusOptions: [
乐宝呗666's avatar
乐宝呗666 committed
102
        // 状态信息
103 104
        {
          value: "1",
乐宝呗666's avatar
乐宝呗666 committed
105
          label: "待激活",
106 107 108
        },
        {
          value: "2",
乐宝呗666's avatar
乐宝呗666 committed
109
          label: "已激活",
110 111 112
        },
        {
          value: "3",
乐宝呗666's avatar
乐宝呗666 committed
113 114
          label: "故障",
        },
115 116
      ],
      form: {
qzhxx's avatar
qzhxx committed
117 118
        orgId: "",
        status: "",
乐宝呗666's avatar
乐宝呗666 committed
119
        areaId: [],
120
      },
乐宝呗666's avatar
乐宝呗666 committed
121
      tableData: [], // 表格信息
122 123 124 125
    };
  },
  mounted() {
    this.getAreas();
乐宝呗666's avatar
乐宝呗666 committed
126
    this.getOrgList();
qzhxx's avatar
qzhxx committed
127
    this.onSearch();
128 129
  },
  methods: {
乐宝呗666's avatar
乐宝呗666 committed
130 131 132
    // 获取区域信息
    async getAreas() {
      this.areaOptions = await getAreas();
133
    },
乐宝呗666's avatar
乐宝呗666 committed
134 135 136
    // 获取单位信息
    async getOrgList() {
      this.orgOptions = await getOrgListWithOutPage();
qzhxx's avatar
qzhxx committed
137
    },
138 139 140 141
    // 查询
    onSearch() {
      this.page.currentPage = 1;
      this.getTableData();
142
    },
143 144 145 146 147 148
    // 获得数据接口
    getTableData() {
      let vm = this;
      let param = {
        _index: this.page.currentPage,
        _size: this.page.pageSize,
乐宝呗666's avatar
乐宝呗666 committed
149 150 151
        areaId: this.form.areaId.length
          ? this.form.areaId[this.form.areaId.length - 1]
          : "",
qzhxx's avatar
qzhxx committed
152 153
        organId: this.form.orgId,
        status: this.form.status,
154 155 156
      };
      vm.$https(
        {
qzhxx's avatar
qzhxx committed
157
          url: "boxOperation/getPageList",
158
          method: "post",
乐宝呗666's avatar
乐宝呗666 committed
159
          authType: this.backToken,
160
        },
161 162
        vm.$qs.stringify(param)
      )
乐宝呗666's avatar
乐宝呗666 committed
163 164 165 166 167 168 169 170
        .then((res) => {
          if (res.data.resultCode === "200") {
            let data = res.data.data;
            vm.page.total = data.total;
            vm.tableData = data.records;
          } else {
            this.$message.error(res.data.message);
          }
171
        })
乐宝呗666's avatar
乐宝呗666 committed
172
        .catch(function (err) {
173 174 175
          console.log(err);
        });
    },
乐宝呗666's avatar
乐宝呗666 committed
176
    // 重置
177
    handleReset() {
qzhxx's avatar
qzhxx committed
178 179 180
      this.form = {
        orgId: "",
        status: "",
乐宝呗666's avatar
乐宝呗666 committed
181
        areaId: [],
qzhxx's avatar
qzhxx committed
182
      };
乐宝呗666's avatar
乐宝呗666 committed
183
      this.onSearch();
184 185 186 187 188
    },
    // 分页
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.getTableData();
乐宝呗666's avatar
乐宝呗666 committed
189 190
    },
  },
191
};
192 193
</script>
<style lang="less">
乐宝呗666's avatar
乐宝呗666 committed
194 195
@import "~@/style/table.less";
@import "~@/style/pagination.less";
196
</style>