selectMembers.vue 4.96 KB
<template>
  <div class="drawer-sale-panel">
    <el-form label-width="100px" :model="addForm">
      <el-form-item label="请选择成员">
        <div class="sale-select">
          <div class="el-input-tag input-tag-wrapper" @click="foucusTagInput">
            <div class="tag-box">
              <el-tag v-for="(tag, idx) in innerTags" :key="idx" type="info" closable :disable-transitions="false" @close="remove(tag)">
                <!-- <i class="el-icon-user-solid"></i> -->
                <img class="headPortrait" src="@/assets/headPortrait.png" />
                {{ tag.staffName }}
              </el-tag>
            </div>
            <el-input size="small" v-model.trim="newTag" placeholder="选择员工" @input="inputTag" style="outline: none; border: none"></el-input>
          </div>
          <div>
            <el-button size="small" class="sale-select-btn" type="primary" @click="searchEmp">查询</el-button>
          </div>
        </div>
        <div>
          <div class="select-sale-panel">
            <select-emp :selectData="selectData" :islord="islord" @selectTable="selectTable" ref="selectEmpTabel"></select-emp>
            <div class="popper__arrow"></div>
          </div>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import selectEmp from './selectEmp.vue'
export default {
  name: 'SelectMembers',
  props: ['selectData', 'islord'],
  components: {
    selectEmp
  },
  data() {
    return {
      addForm: {},
      typeIndex: 0,
      empType: [],
      // empTypeValue: '',
      newTag: '',
      innerTags: [],
      dialog_temp: {}
    }
  },
  methods: {
    init() {
      this.newTag = ''
      this.innerTags = []
      this.empTypeValue = ''
      if (this.$refs.selectEmpTabel.listTree.length != 0) {
        this.$refs.selectEmpTabel.listEntmicroStaff()
        this.$refs.selectEmpTabel.clearSelection()
      }
    },
    selectTable(val) {
      this.innerTags = val
    },
    foucusTagInput() {
      if (this.readOnly || !this.$el.querySelector('.tag-input')) {
        return
      } else {
        this.$el.querySelector('.tag-input').focus()
      }
    },
    remove(row) {
      this.$refs.selectEmpTabel.clearSelect(row)
    },
    //查询
    searchEmp() {
      this.$refs.selectEmpTabel.searchTable(this.newTag)
    },
    onSubmit() {
      if (this.innerTags.length == 0) {
        this.$message({
          message: '请选择成员',
          type: 'error'
        })
        return
      }
      let userIds = []
      this.innerTags.forEach(item => {
        userIds.push(item.userId)
      })
    }
  },
  mounted() {}
}
</script>
<style scoped lang="scss">
@import '@/styles/variables.scss';
.drawer-sale-panel {
  padding: 0px 20px;
  .sale-reload {
    margin-bottom: 10px;
  }
  .sale-select {
    display: flex;
    align-items: center;
  }
  .sale-select-btn {
    margin-left: 8px;
  }
  .sale-type-desc {
    font-size: 14px;
    font-weight: 400;
    color: #adadad;
    line-height: 17px;
    margin-top: 10px;
  }
}
.emp-type {
  margin-bottom: 10px;
  &-btn {
    cursor: pointer;
    display: inline-block;
    padding: 8px 10px;
    margin-bottom: 10px;
    margin-right: 10px;
    position: relative;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #e8e8ea;
    line-height: 1;
    font-size: 14px;
    color: #7d7d7d;
    &.checked {
      border: 1px solid $btnBlue;
      color: $btnBlue;
    }
    i {
      position: absolute;
      right: -6px;
      top: -6px;
      font-size: 12px;
      color: #999999;
    }
  }
}
.tag-box {
  max-height: 66px;
  overflow: auto;
}
.input-tag-wrapper {
  position: relative;
  font-size: 14px;
  background-color: #fff;
  background-image: none;
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  box-sizing: border-box;
  color: #606266;
  display: inline-block;
  outline: none;
  padding: 0 0 0 5px;
  flex-wrap: wrap;
  line-height: 32px;
  transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  width: 100%;
  display: flex;
  align-items: center;
  i {
    color: #75acff;
    margin-right: 3px;
    font-size: 14px;
  }
  /deep/ input {
    /* input { */
    /* background-color: red!important;  调试用的样式 */
    outline: none !important;
    border: none !important;
  }
  /deep/ .el-input {
    min-width: 150px;
    width: auto;
    flex: 1;
  }
}
.el-tag {
  margin-right: 4px;
  height: 26px;
  line-height: 24px;
}
.tag-input {
  background: transparent;
  border: none !important;
  font-size: 14px;
  height: 32px;
  outline: none;
  padding-left: 0;
  width: 100px;
}
.el-input-tag--mini .tag-input {
  height: 24px;
  line-height: 24px;
}
.el-input-tag--small .tag-input {
  height: 32px;
  line-height: 32px;
}
.el-input-tag--medium .tag-input {
  height: 32px;
  line-height: 32px;
}
// ::-webkit-scrollbar {
//   /*滚动条整体样式*/
//   width: 6px;
//   height: 4px;
// }

// ::-webkit-scrollbar-thumb {
//   /*滚动条里面小方块*/
//   border-radius: 4px;
//   background-color: rgba(144, 147, 153, 0.3);
// }
</style>