index.vue 4.05 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 16
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-cascader
qzhxx's avatar
qzhxx committed
17
            v-model="form.areaId"
18 19
            :options="areaOptions"
            :props="defaultProps"
20
            change-on-select
21 22 23 24 25 26 27 28 29 30 31
          ></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
32
        <span class="page-tips"
33
          >机顶盒账号为机顶盒所属单位名称,新建后生成6位数字及字母的随机密码,作为机顶盒的登录密码。</span
乐宝呗666's avatar
乐宝呗666 committed
34
        >
35
      </div>
36 37 38 39
    </div>
    <div class="table-content">
      <div class="btn-group">
        <el-button type="primary" @click="addBox">新建机顶盒账号</el-button>
40
      </div>
41 42
      <party-table :currentPage="page._index" :feildList="feildList" :list="tableData"/>
      <party-pagination :page="page" @changePage="handleCurrentChange"/>
43 44
    </div>
    <custom-dialog ref="formItem" @refreshFn="onSearch" />
45 46 47
  </div>
</template>
<script>
48
import { partyPagination,partyTable} from "@/components/index";
49 50
import customDialog from "./components/dialog.vue";
import { getAreas } from "@/config/area.js";
qzhxx's avatar
qzhxx committed
51
import { getOrgListWithOutPage } from "@/config/organ.js";
52
export default {
乐宝呗666's avatar
乐宝呗666 committed
53
  components: { partyPagination, customDialog,partyTable },
54 55
  data() {
    return {
乐宝呗666's avatar
乐宝呗666 committed
56
      page: { 
57 58
        _index: 1, 
        _size: 10, 
乐宝呗666's avatar
乐宝呗666 committed
59 60
        total: 0 
      },
乐宝呗666's avatar
乐宝呗666 committed
61 62 63 64
      feildList: [
        { prop: "mac", label: "MAC地址" },
        { prop: "organName", label: "所属单位" }
      ],
乐宝呗666's avatar
乐宝呗666 committed
65 66
      orgOptions: [], // 单位信息
      areaOptions: [], //区域信息
67 68 69
      defaultProps: {
        label: "name",
        value: "id",
乐宝呗666's avatar
乐宝呗666 committed
70
        checkStrictly: true,
71 72
      },
      form: {
qzhxx's avatar
qzhxx committed
73
        orgId: "",
乐宝呗666's avatar
乐宝呗666 committed
74
        areaId: [],
75
      },
乐宝呗666's avatar
乐宝呗666 committed
76
      tableData: [], // 表格信息
77 78 79 80 81
    };
  },

  mounted() {
    this.getAreas();
qzhxx's avatar
qzhxx committed
82 83
    this.onSearch();
    this.getOrgList();
84 85
  },
  methods: {
乐宝呗666's avatar
乐宝呗666 committed
86 87 88
    // 获取单位信息
    async getOrgList() {
      this.orgOptions = await getOrgListWithOutPage()
qzhxx's avatar
qzhxx committed
89
    },
乐宝呗666's avatar
乐宝呗666 committed
90 91 92
    // 获取区域信息
    async getAreas() {
      this.areaOptions = await getAreas()
93 94 95
    },
    // 查询
    onSearch() {
96
      this.page._index = 1
乐宝呗666's avatar
乐宝呗666 committed
97
      this.getTableData()
98 99 100 101 102
    },
    // 获得数据接口
    getTableData() {
      let vm = this;
      let param = {
103 104
        _index: this.page._index,
        _size: this.page._size,
乐宝呗666's avatar
乐宝呗666 committed
105 106
        areaId: this.form.areaId.length ? this.form.areaId[this.form.areaId.length - 1] : '',
        organId: this.form.orgId
107 108 109
      };
      vm.$https(
        {
qzhxx's avatar
qzhxx committed
110
          url: "boxOperation/selectPageList",
111
          method: "post",
乐宝呗666's avatar
乐宝呗666 committed
112
          authType: this.backToken,
113 114 115
        },
        vm.$qs.stringify(param)
      )
乐宝呗666's avatar
乐宝呗666 committed
116 117 118 119 120 121 122 123
        .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)
          }
124
        })
乐宝呗666's avatar
乐宝呗666 committed
125 126
        .catch(function (err) {
          console.log(err)
127 128 129 130
        });
    },
    // 新增弹框打开
    addBox() {
qzhxx's avatar
qzhxx committed
131
      this.$refs.formItem.backFn(this.orgOptions);
132
    },
乐宝呗666's avatar
乐宝呗666 committed
133
    // 重置
134
    handleReset() {
qzhxx's avatar
qzhxx committed
135 136
      this.form = {
        orgId: "",
乐宝呗666's avatar
乐宝呗666 committed
137
        areaId: [],
qzhxx's avatar
qzhxx committed
138
      };
乐宝呗666's avatar
乐宝呗666 committed
139
      this.onSearch();
140 141 142
    },
    // 分页
    handleCurrentChange(val) {
143
      this.page._index = val;
144
      this.getTableData();
乐宝呗666's avatar
乐宝呗666 committed
145 146
    },
  },
147
};
148 149
</script>
<style lang="less">
乐宝呗666's avatar
乐宝呗666 committed
150
// @import "~@/style/table.less";
151
</style>