index.vue 6.65 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">
xulili's avatar
xulili committed
49 50 51 52 53 54
        <div class="btn-group">
        <el-button class="export" type="primary" @click="handleExport"
          >导出</el-button
        >
      </div>
      <div class="party-table">
乐宝呗666's avatar
乐宝呗666 committed
55 56 57 58 59 60
        <el-table
          border
          style="width: 100%; height: 100%"
          height="100%"
          :data="tableData"
        >
61 62 63 64 65
          <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
66
          <el-table-column
乐宝呗666's avatar
乐宝呗666 committed
67
            align="center"
xulili's avatar
xulili committed
68
            label="MAC地址"
69 70 71 72 73 74
            prop="mac"
          ></el-table-column>
          <el-table-column
            align="center"
            label="所属单位"
            prop="organName"
乐宝呗666's avatar
乐宝呗666 committed
75
          ></el-table-column>
xulili's avatar
xulili committed
76 77 78 79 80 81 82 83 84 85
          <el-table-column
            align="center"
            label="单位管理员"
            prop="userName"
          ></el-table-column>
          <el-table-column
            align="center"
            label="所属区域"
            prop="areaName"
          ></el-table-column>
乐宝呗666's avatar
乐宝呗666 committed
86
          <el-table-column align="center" label="机顶盒状态" prop="status">
qzhxx's avatar
qzhxx committed
87
            <template slot-scope="scope">
88
              <span>{{ statusOptions[scope.row.status - 1].label }}</span>
qzhxx's avatar
qzhxx committed
89 90
            </template>
          </el-table-column>
91
        </el-table>
92
      </div>
93
      <party-pagination :page="page" @changePage="handleCurrentChange" />
94
    </div>
95 96 97
  </div>
</template>
<script>
98
import { partyPagination } from "@/components/index";
99
import { getAreas } from "@/config/area.js";
qzhxx's avatar
qzhxx committed
100
import { getOrgListWithOutPage } from "@/config/organ.js";
101
export default {
102
  components: { partyPagination },
103 104
  data() {
    return {
乐宝呗666's avatar
乐宝呗666 committed
105
      page: {
106 107
        _index: 1,
        _size: 10,
乐宝呗666's avatar
乐宝呗666 committed
108 109 110 111
        total: 0,
      },
      orgOptions: [], // 单位信息
      areaOptions: [], // 区域信息
112 113 114 115 116
      defaultProps: {
        label: "name",
        value: "id",
        checkStrictly: true,
      },
qzhxx's avatar
qzhxx committed
117
      statusOptions: [
乐宝呗666's avatar
乐宝呗666 committed
118
        // 状态信息
119 120
        {
          value: "1",
乐宝呗666's avatar
乐宝呗666 committed
121
          label: "待激活",
122 123 124
        },
        {
          value: "2",
乐宝呗666's avatar
乐宝呗666 committed
125
          label: "已激活",
126 127 128
        },
        {
          value: "3",
乐宝呗666's avatar
乐宝呗666 committed
129 130
          label: "故障",
        },
131 132
      ],
      form: {
qzhxx's avatar
qzhxx committed
133 134
        orgId: "",
        status: "",
乐宝呗666's avatar
乐宝呗666 committed
135
        areaId: [],
136
      },
乐宝呗666's avatar
乐宝呗666 committed
137
      tableData: [], // 表格信息
138 139 140 141
    };
  },
  mounted() {
    this.getAreas();
乐宝呗666's avatar
乐宝呗666 committed
142
    this.getOrgList();
qzhxx's avatar
qzhxx committed
143
    this.onSearch();
144 145
  },
  methods: {
乐宝呗666's avatar
乐宝呗666 committed
146 147 148
    // 获取区域信息
    async getAreas() {
      this.areaOptions = await getAreas();
149
    },
乐宝呗666's avatar
乐宝呗666 committed
150 151 152
    // 获取单位信息
    async getOrgList() {
      this.orgOptions = await getOrgListWithOutPage();
qzhxx's avatar
qzhxx committed
153
    },
154 155
    // 查询
    onSearch() {
156
      this.page._index = 1;
乐宝呗666's avatar
乐宝呗666 committed
157
      this.requestForm = JSON.parse(JSON.stringify(this.form))
158
      this.getTableData();
159
    },
160 161 162 163
    // 获得数据接口
    getTableData() {
      let vm = this;
      let param = {
164 165
        _index: this.page._index,
        _size: this.page._size,
乐宝呗666's avatar
乐宝呗666 committed
166 167
        areaId: this.requestForm.areaId.length
          ? this.requestForm.areaId[this.requestForm.areaId.length - 1]
乐宝呗666's avatar
乐宝呗666 committed
168
          : "",
乐宝呗666's avatar
乐宝呗666 committed
169 170
        organId: this.requestForm.orgId,
        status: this.requestForm.status,
171 172 173
      };
      vm.$https(
        {
qzhxx's avatar
qzhxx committed
174
          url: "boxOperation/getPageList",
175
          method: "post",
乐宝呗666's avatar
乐宝呗666 committed
176
          authType: this.backToken,
177
        },
178 179
        vm.$qs.stringify(param)
      )
乐宝呗666's avatar
乐宝呗666 committed
180 181 182 183 184 185 186 187
        .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);
          }
188
        })
乐宝呗666's avatar
乐宝呗666 committed
189
        .catch(function (err) {
190 191 192
          console.log(err);
        });
    },
乐宝呗666's avatar
乐宝呗666 committed
193
    // 重置
194
    handleReset() {
qzhxx's avatar
qzhxx committed
195 196 197
      this.form = {
        orgId: "",
        status: "",
乐宝呗666's avatar
乐宝呗666 committed
198
        areaId: [],
qzhxx's avatar
qzhxx committed
199
      };
乐宝呗666's avatar
乐宝呗666 committed
200
      this.onSearch();
201 202 203
    },
    // 分页
    handleCurrentChange(val) {
204
      this.page._index = val;
205
      this.getTableData();
乐宝呗666's avatar
乐宝呗666 committed
206
    },
xulili's avatar
xulili committed
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
     // 导出
    handleExport() {
      let dates = {};
      if (this.form.date) {
        dates.startDate = this.requestForm.date[0];
        dates.endDate = this.requestForm.date[1];
      }
      let param = {
        areaId: this.requestForm.areaId.length
          ? this.requestForm.areaId[this.requestForm.areaId.length - 1]
          : "",
        organId: this.requestForm.orgId,
        status: this.requestForm.status,
      };
      this.$https(
        {
          url: "/boxOperation/excel/getPageList",
          method: "post",
          authType: this.backToken,
          responseType: "blob",
        },
        this.$qs.stringify(param)
      ).then((res) => {
        let blobUrl = window.URL.createObjectURL(res.data);
        const aElement = document.createElement("a");
        aElement.href = blobUrl;
        aElement.download = "机顶盒运维信息.xls";
        aElement.click();
        window.URL.revokeObjectURL(blobUrl);
      });
    },
乐宝呗666's avatar
乐宝呗666 committed
238
  },
239
};
240 241
</script>
<style lang="less">
乐宝呗666's avatar
乐宝呗666 committed
242
@import "~@/style/table.less";
243
</style>