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