dbUnitAdmin.vue 3.71 KB
Newer Older
xulili's avatar
xulili committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<template>
  <!-- 单位用户单位管理员账号管理 -->
  <div class="dbUnit-wrapper height100">
    <div class="search-container">
      <div class="page-tip">
        <span class="page-tip-title">页面说明:</span>
        <span class="page-tips"
          >可查看本单位其他管理员信息,可以修改自己的管理员信息,修改后的信息同步到平台管理员信息列表中</span
        >
      </div>
    </div>
    <div class="table-content">
      <db-unit-table
        :feildList="feildList"
        :list="list"
        @action="handleAction"
      />
      <party-pagination :page="page" @changePage="handleChangeCurrent" />
    </div>
    <edit-dialog ref="editDialog" @success="getFirstPageList()" />
  </div>
</template>
<script>
import { partyPagination } from "@/components/index";
import dbUnitTable from "./components/dbUnitTable";
import { editDialog } from "./dbUnitDialog";
export default {
  data() {
    return {
      form: {
xulili's avatar
xulili committed
31
        type: 2, //1.用户账号 2.平台单位单位管理员账号 3.机顶盒账号 4.运维账号
xulili's avatar
xulili committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
      },
      feildList: [
        { prop: "userName", label: "管理员姓名" },
        { prop: "phone", label: "手机号码" },
        { prop: "telephone", label: "固定电话" },
        { prop: "weChat", label: "微信号" },
        { prop: "email", label: "邮箱" },
        { prop: "", label: "操作", isEdit: true, width: 120 },
      ],
      list: [],
      page: {
        _index: 1,
        _size: 10,
        total: 0,
      },
xulili's avatar
xulili committed
47
      activeRow: {},
xulili's avatar
xulili committed
48 49 50 51 52
    };
  },
  components: {
    partyPagination,
    dbUnitTable,
xulili's avatar
xulili committed
53
    editDialog,
xulili's avatar
xulili committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
  },
  mounted() {
    this.getFirstPageList();
  },
  methods: {
    // 获取第一页数据列表
    getFirstPageList() {
      this.page._index = 1;
      this.getPageList();
    },
    getPageList() {
      let requestParams = {};
      requestParams._index = this.page._index;
      requestParams._size = this.page._size;
      requestParams.type = this.form.type;
      this.$https(
        {
          method: "get",
          url: "tUser/getPageList",
          authType: this.backToken,
        },
        requestParams
      )
        .then((res) => {
          if (res.status != 200) {
            this.getResWithOutData();
          } else {
            if (res.data.resultCode == 200) {
              this.list = res.data.data.records;
              this.page._size = res.data.data.size;
              this.page.total = res.data.data.total;
            } else {
              this.getResWithOutData();
            }
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
xulili's avatar
xulili committed
94 95 96 97 98 99 100 101 102
    // 页面返回值为空
    getResWithOutData() {
      this.list = [];
      this.page = {
        _index: 1,
        _size: 10,
        total: 0,
      };
    },
xulili's avatar
xulili committed
103 104 105 106 107
    // 编辑
    handleEdit() {
      this.$refs.editDialog.id = this.activeRow.id;
      this.$refs.editDialog.getDetailById();
      this.$refs.editDialog.dialogVisible = true;
xulili's avatar
xulili committed
108
      this.$refs.editDialog.isEdit = true;
xulili's avatar
xulili committed
109 110 111 112 113 114
    },
    // 查看详情
    handleDetail() {
      this.$refs.editDialog.id = this.activeRow.id;
      this.$refs.editDialog.getDetailById();
      this.$refs.editDialog.dialogVisible = true;
xulili's avatar
xulili committed
115
      this.$refs.editDialog.isEdit = false;
xulili's avatar
xulili committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
    },
    handleAction(params) {
      this.activeRow = params.row;
      switch (params.type) {
        case "detail":
          this.handleDetail();
          break;
        case "edit":
          this.handleEdit();
          break;
        default:
          break;
      }
    },
    // 翻页
    handleChangeCurrent() {
      this.page._index = val;
      this.getPageList();
    },
  },
};
</script>
<style lang="less" scoped>
xulili's avatar
xulili committed
139 140 141 142
.dbUnit-wrapper {
  .page-tips {
    white-space: nowrap;
  }
xulili's avatar
xulili committed
143 144
}
</style>