index.vue 5.23 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
            :options="areaOptions"
            :props="defaultProps"
30
            change-on-select
31 32 33 34 35 36 37 38 39 40 41
          ></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
    </div>
    <div class="table-content">
qzhxx's avatar
qzhxx committed
48
      <div class="party-table noAdd">
乐宝呗666's avatar
乐宝呗666 committed
49 50 51 52 53 54
        <el-table
          border
          style="width: 100%; height: 100%"
          height="100%"
          :data="tableData"
        >
55 56 57 58 59
          <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
60
          <el-table-column
乐宝呗666's avatar
乐宝呗666 committed
61
            align="center"
62 63 64 65 66 67 68
            label="mac地址"
            prop="mac"
          ></el-table-column>
          <el-table-column
            align="center"
            label="所属单位"
            prop="organName"
乐宝呗666's avatar
乐宝呗666 committed
69
          ></el-table-column>
乐宝呗666's avatar
乐宝呗666 committed
70
          <el-table-column align="center" label="机顶盒状态" prop="status">
qzhxx's avatar
qzhxx committed
71
            <template slot-scope="scope">
72
              <span>{{ statusOptions[scope.row.status - 1].label }}</span>
qzhxx's avatar
qzhxx committed
73 74
            </template>
          </el-table-column>
75
        </el-table>
76
      </div>
77
      <party-pagination :page="page" @changePage="handleCurrentChange" />
78
    </div>
79 80 81
  </div>
</template>
<script>
82
import { partyPagination } from "@/components/index";
83
import { getAreas } from "@/config/area.js";
qzhxx's avatar
qzhxx committed
84
import { getOrgListWithOutPage } from "@/config/organ.js";
85
export default {
86
  components: { partyPagination },
87 88
  data() {
    return {
乐宝呗666's avatar
乐宝呗666 committed
89
      page: {
90 91
        _index: 1,
        _size: 10,
乐宝呗666's avatar
乐宝呗666 committed
92 93 94 95
        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
    // 查询
    onSearch() {
140
      this.page._index = 1;
乐宝呗666's avatar
乐宝呗666 committed
141
      this.requestForm = JSON.parse(JSON.stringify(this.form))
142
      this.getTableData();
143
    },
144 145 146 147
    // 获得数据接口
    getTableData() {
      let vm = this;
      let param = {
148 149
        _index: this.page._index,
        _size: this.page._size,
乐宝呗666's avatar
乐宝呗666 committed
150 151
        areaId: this.requestForm.areaId.length
          ? this.requestForm.areaId[this.requestForm.areaId.length - 1]
乐宝呗666's avatar
乐宝呗666 committed
152
          : "",
乐宝呗666's avatar
乐宝呗666 committed
153 154
        organId: this.requestForm.orgId,
        status: this.requestForm.status,
155 156 157
      };
      vm.$https(
        {
qzhxx's avatar
qzhxx committed
158
          url: "boxOperation/getPageList",
159
          method: "post",
乐宝呗666's avatar
乐宝呗666 committed
160
          authType: this.backToken,
161
        },
162 163
        vm.$qs.stringify(param)
      )
乐宝呗666's avatar
乐宝呗666 committed
164 165 166 167 168 169 170 171
        .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);
          }
172
        })
乐宝呗666's avatar
乐宝呗666 committed
173
        .catch(function (err) {
174 175 176
          console.log(err);
        });
    },
乐宝呗666's avatar
乐宝呗666 committed
177
    // 重置
178
    handleReset() {
qzhxx's avatar
qzhxx committed
179 180 181
      this.form = {
        orgId: "",
        status: "",
乐宝呗666's avatar
乐宝呗666 committed
182
        areaId: [],
qzhxx's avatar
qzhxx committed
183
      };
乐宝呗666's avatar
乐宝呗666 committed
184
      this.onSearch();
185 186 187
    },
    // 分页
    handleCurrentChange(val) {
188
      this.page._index = val;
189
      this.getTableData();
乐宝呗666's avatar
乐宝呗666 committed
190 191
    },
  },
192
};
193 194
</script>
<style lang="less">
乐宝呗666's avatar
乐宝呗666 committed
195
@import "~@/style/table.less";
196
</style>