viewConfig.vue 6.14 KB
<template>
  <div>
    <div class="container">
      <div class="title">{{ routerInfo.merchantName }}</div>
      <GLCombiForm :formObj="searchForm" :rowNumber="1" :formData="searchFormData" @handleOk="getListApi" @handleRest="handleReset"></GLCombiForm>
      <div class="tableBox">
        <GLTable ref="accountCodeTable" @refreshTable="getListApi" :noDataImg="url" :layout="layout" :tableData="accountTableData" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :tableTotal="tableTotal" @setTableFinishFun="setTableFinishFun">
          <!-- 账号许可类型 -->
          <div slot="type" slot-scope="scope">
            <span v-if="scope.scope.type == 1">基础帐号</span>
            <span v-else>互通帐号</span>
          </div>
          <!-- 账号激活状态 -->
          <div slot="status" class="dot" slot-scope="scope">
            <div :class="accountStatus[scope.scope.status]"></div>
            <span v-if="scope.scope.status == 1">未绑定</span>
            <span v-if="scope.scope.status == 2">已绑定</span>
            <span v-if="scope.scope.status == 3">已过期</span>
            <span v-if="scope.scope.status == 4">待转移</span>
            <span v-if="scope.scope.status == 5">已合并</span>
          </div>
          <template slot="auth-button" slot-scope="scope" :data="scope.scope" v-if="scope.scope.status == 2">
            <el-button type="text" @click="handelTransfer(scope.scope)">转移</el-button>
          </template>
        </GLTable>
      </div>
    </div>
    <TransferDia ref="TransferDia" :dialogTransferVisible="dialogTransferVisible" @transferStaff="getListApi"></TransferDia>
  </div>
</template>

<script>
const accountStatus = {
  '1': 'dot1',
  '2': 'normal',
  '3': 'dot3',
  '4': 'dot6',
  '5': 'normal'
}
import url from '@/assets/empty.png'
import TransferDia from './transferDia'
export default {
  name: 'ConfigDetail',
  components: {
    TransferDia
  },
  data() {
    return {
      url,
      accountStatus,
      searchForm: {
        status: '',
        staffName: ''
      },
      transferForm: {
        staff: ''
      },
      routerInfo: '',
      dialogTransferVisible: false,
      accountTableData: [],
      tableTotal: 0,
      notActiveStaffList: [],
      expireTime: '',
      takeoverUserid: '',
      handoverUserid: '',
      searchFormData: [
        {
          label: '激活状态',
          name: 'status',
          type: 'select',
          optionList: [
            {
              label: '全部',
              value: ''
            },
            {
              label: '未绑定',
              value: 1
            },
            {
              label: '已绑定',
              value: 2
            },
            {
              label: '已过期',
              value: 3
            },
            {
              label: '待转移',
              value: 4
            },
            {
              label: '已合并',
              value: 5
            }
          ],
          optionId: 'value',
          optionLabel: 'label',
          isClear: true
        },
        {
          label: '员工姓名',
          name: 'staffName',
          type: 'input',
          isClear: true,
          placeholder: '输入关键字搜索'
        }
      ],
      tableParams: {
        listName: 'list',
        tableOption: true,
        tableColumns: [
          {
            label: '帐号许可类型',
            prop: 'type',
            addHtml: 'type'
          },
          {
            label: '激活状态',
            prop: 'status',
            addHtml: 'status'
          },
          {
            label: '绑定员工',
            prop: 'staffName'
          },
          {
            label: '手机号码',
            prop: 'staffPhone'
          },
          {
            label: '激活时间',
            prop: 'activeTime'
          },
          {
            label: '有效期',
            prop: 'expireTime'
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      layout: 'sizes, prev, pager, next, jumper, ->, total'
    }
  },
  mounted() {
    this.routerInfo = this.$route.query
    this.getListApi()
  },
  methods: {
    getListApi() {
      const { status, staffName } = this.searchForm
      const { merchantId, corpId } = this.routerInfo
      let params = {
        merchantId,
        corpId,
        status,
        staffName
      }
      params.pageSize = this.$refs.accountCodeTable.page.pageSize
      params.pageNum = this.$refs.accountCodeTable.page.pageNum
      this.$apis.accountConfig.listAccountCodeWithPage(params).then(res => {
        if (res) {
          this.accountTableData = res.list
          this.tableTotal = res.total
        }
      })
    },
    // 账号许可转移弹窗
    handelTransfer(scope) {
      this.dialogTransferVisible = true
      this.$refs.TransferDia.init(scope, this.routerInfo)
    },
    // 选择转移员工
    selectTransferStaff(id) {
      this.takeoverUserid = id
    },
    // 关闭弹窗
    handleClose() {
      this.dialogTransferVisible = false
      this.transferForm.staff = ''
    },
    // 搜索框搜索
    handleSearch() {
      this.$refs.accountCodeTable.refreshTable()
    },
    // 重置搜索框搜索
    handleReset() {
      this.searchForm = {
        status: '',
        staffName: ''
      }
      this.getListApi()
    },
    setTableFinishFun() {
      //接收到的数据为空
      this.$refs.accountCodeTable.data.length ? (this.$refs.accountCodeTable.tableHeightValues = '') : this.$refs.accountCodeTable.setTableHeightFun()
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  background-color: #fff;
  .title {
    height: 58px;
    margin-bottom: 20px;
    padding-left: 20px;
    font-size: 16px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 600;
    color: #333333;
    line-height: 58px;
    border-bottom: 1px solid #e5e5e5;
  }
  .tableBox {
    padding: 0 20px 60px 20px;
  }
}
.trans-dia {
  /deep/ .el-form-item__label {
    width: 154px;
  }
  /deep/ .el-select {
    width: 474px;
  }
}
/deep/ .el-dialog__title {
  font-weight: 600;
}
.global-messageZindex {
  z-index: 3000 !important;
}
</style>