selectStaff.vue 6.05 KB
<template>
  <div class="select-staff">
    <!--  class="staffDailog" -->
    <GLDialog bigTitle="选择员工"
              mode="big"
              width="600px"
              :visible.sync="dialogVisible"
              :before-close="handleClose"
              :close-on-click-modal="false"
              @onOk="handleConfirm"
              @onCancel="handleClose">
      <glsx-combi-form ref="showSearch"
                       labelWidth="105px"
                       :formObj="searchForm"
                       :formData="searchFormData">
        <span slot="footer">
          <el-button :size="size"
                     type="primary"
                     @click="getList">查询</el-button>
        </span>
      </glsx-combi-form>
      <!--     :pageConf="pageConf" -->
      <GLTable ref="staffRef"
               :hasPage="false"
               :hasNum="false"
               :noDataImg="url"
               :tableData="staffList"
               :tableTotal="total"
               :tableParams="tableParams"
               @refreshTable="getList"
               :setTableFinishFun="setTableFinishFun">
        <div slot="radioHtml"
             class="staff-table"
             slot-scope="scope">
          <el-radio v-model="staffUuid"
                    :label="scope.scope.uuid"
                    @click.native="handleClick(scope.scope)"></el-radio>
        </div>
      </GLTable>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="handleClose">取 消</el-button>
        <el-button size="small" type="primary" @click="handleConfirm">确 定</el-button>
      </span> -->
    </GLDialog>
  </div>
</template>

<script>
import url from '@/assets/empty.png'
export default {
  name: 'selectStaff',
  data() {
    return {
      url: url,
      searchForm: {
        name: ''
      },
      total: 0,
      staffList: [],
      heightBox: 200,
      staffUuid: '',
      // 搜索
      searchFormData: [
        {
          label: '员工',
          name: 'name',
          type: 'input',
          placeholder: '请输入员工名称',
          width: '300px',
          labelWidth: '10px'
        }
      ],
      // 表格
      // getListApi: this.$apis.common.getstaffTreeListApi,
      tableParams: {
        listName: 'staffUnitList',
        // 行数据的key
        // mutiSelectUniqueKey: 'staffId',
        // checkSelectKey: 'staffId',
        // checkSelectVal: [],
        // 多选ref的名称
        // mutiSelectName: 'list',
        tableColumns: [
          {
            label: '',
            prop: '',
            width: 80,
            addHtml: 'radioHtml'
          },
          {
            label: '序号',
            prop: 'idx',
            width: 80
          },
          {
            label: '员工姓名',
            prop: 'staffName',
            formatter: cellValue => {
              return cellValue.staffName || '-'
            }
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      baseData: {}
    }
  },

  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    selectedstaffUuid: {
      type: String
    },
    merchantId: {
      type: String,
      required: true
    },
    orderCode: {
      type: String,
      required: true
    }
  },

  mounted() {
    // this.userInfo = this.$globalState.session
    let clientHeight = document.documentElement.clientHeight
    this.heightBox = clientHeight - 0.15 * clientHeight - 425
    this.staffUuid = this.selectedstaffUuid
    this.getList()
  },

  methods: {
    getList() {
      var params = {
        merchantId: this.merchantId,
        // merchantId: '44209390',
        ...this.searchForm
      }
      this.$apis.common.getMerchantStaff(params).then(res => {
        console.log(res)
        this.staffList = res
        // this.staffList = res.staffUnitList
        // this.total = res.total
        // var page = this.$refs.staffRef.page
        // // 添加序号
        this.staffList.forEach((item, index) => {
          item.idx = index + 1
        })
        this.$refs.staffRef.tableHeightValues = '460px'
      })
    },

    setTableFinishFun() {
      this.staffList = this.$refs.staffRef.data
      //接收到的数据为空
      this.$refs.staffRef.tableHeightValues = '460px'
    },

    handleClick(val) {
      console.log(val)
      // let temp = JSON.parse(JSON.stringify(val))
      // delete temp.idx
      // this.staffUuid = val.uuid
    },

    handleClose() {
      // console.log('handleStoreClose')
      this.$emit('handleStaffClose')
    },
    handleConfirm() {
      if (!this.staffUuid)
        return this.$message({
          message: '请先选择员工',
          type: 'error'
        })
      let parmas = {
        subOrderCode: this.orderCode,
        staffUuid: this.staffUuid
      }
      this.$apis.orderManage.signerOrder(parmas).then(res => {
        console.log(res)

        this.$emit('handleStaffConfirm', this.staffUuid)
      })
    }
  }
}
</script>

<style lang="scss">
.select-staff {
  .staffDailog {
    width: 500px;
  }
  .title {
    margin-bottom: 12px;
  }
  .customer-tag-box {
    display: flex;
    margin: 20px 16px;
    .tag-label {
      display: inline-block;
      height: 30px;
      line-height: 30px;
    }
    .input-tag-wrapper {
      max-height: 75px;
      overflow: auto;
      position: relative;
      font-size: 14px;
      background-color: #fff;
      background-image: none;
      border-radius: 4px;
      border: 1px solid #dcdfe6;
      box-sizing: border-box;
      color: #666;
      display: inline-block;
      outline: none;
      padding: 5px;
      flex-wrap: wrap;
      transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
      width: 648px;
      display: flex;
      align-items: center;
      cursor: pointer;
      i {
        color: #75acff;
        margin-right: 3px;
        font-size: 14px;
      }
    }
  }
  // .customer-list {
  //   width: calc(100% - 280px);
  //   margin-right: 10px;
  // }
  .p-16 {
    padding: 16px;
  }
  .staff-table .el-radio__label {
    display: none;
  }
}
</style>