leadAllocation.vue 7.53 KB
<template>
  <div>
    <div class="scrm-sub-client-container">
      <div class="pageContent" :style="{ height: clientHeight + 'px' }">
        <div class="baseTitle">
          <p class="title">基本信息</p>
          <hr />
        </div>
        <div class="combine">
          <!-- 售前线索跟进员工 -->
          <div class="drainage-form-item">
            <label>
              售前线索跟进员工
              <el-popover placement="top" width="400" trigger="hover" content="请在首页-跟进专员模块里创建售前专员,并选择员工来跟进新车询价、试驾预约线索。">
                <img src="@/assets/leadManage/grayquestion.png" slot="reference" class="count-item-question" />
              </el-popover>
              :
            </label>
            <div style="position: relative">
              <el-button size="small" @click="handleAddEmp(1)">
                <i class="el-icon-plus"></i>
                选择跟进专员
              </el-button>
              <span class="drainage-coutom-count">
                只能选择
                <span class="count">1</span>
                个
              </span>
              <div class="el-input-tag input-tag-wrapper" v-if="choicedStaff.beforeUserName">
                <el-tag effect="plain" type="info" :key="idx" :disable-transitions="false" closable @close="handleClose(1)">
                  <!-- <i class="el-icon-user-solid"></i> -->
                  <img class="headPortrait" src="@/assets/headPortrait.png" />
                  {{ this.choicedStaff.beforeUserName }}
                </el-tag>
              </div>
            </div>
          </div>
          <!-- 售后线索跟进员工 -->
          <div class="drainage-form-item">
            <label>
              售后线索跟进员工
              <el-popover placement="top" width="400" trigger="hover" content="请在首页-跟进专员模块里创建售后专员,并选择员工来跟进维保预约、救援服务线索。">
                <img src="@/assets/leadManage/grayquestion.png" slot="reference" class="count-item-question" />
              </el-popover>
              :
            </label>
            <div style="position: relative">
              <el-button size="small" @click="handleAddEmp(2)">
                <i class="el-icon-plus"></i>
                选择跟进专员
              </el-button>
              <span class="drainage-coutom-count">
                只能选择
                <span class="count">1</span>
                个
              </span>
              <div class="el-input-tag input-tag-wrapper" v-if="choicedStaff.afterUserName">
                <el-tag effect="plain" type="info" :key="idx" :disable-transitions="false" closable @close="handleClose(2)">
                  <!-- <i class="el-icon-user-solid"></i> -->
                  <img class="headPortrait" src="@/assets/headPortrait.png" />
                  {{ choicedStaff.afterUserName }}
                </el-tag>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <select-emp ref="selectEmpForm" @selectTable="selectTable"></select-emp>
    <GLFooter class="gl-footer">
      <el-button @click="goback()">取消</el-button>
      <el-button type="primary" @click="comEmployee()">确定</el-button>
    </GLFooter>
  </div>
</template>

<script>
import { getfollowstaff, editfollowstaff } from '@/api/modules/leadManage'
import selectEmp from '@/components/selectEmp'
export default {
  name: 'leadAllocation',
  components: { selectEmp },
  data() {
    return {
      choicedStaff: {
        afterUserId: '',
        afterUserName: '',
        afterUserUuid: '',
        beforeUserId: '',
        beforeUserName: '',
        beforeUserUuid: ''
      }, //已选择的员工
      clientHeight: '',
      type: ''
    }
  },
  created() {
    this.getStaff()
  },
  mounted() {
    this.clientHeight = document.documentElement.clientHeight - 130
  },
  methods: {
    // 删除跟进员工
    handleClose(tag) {
      if (tag == 1) {
        ;(this.choicedStaff.beforeUserId = ''), (this.choicedStaff.beforeUserName = ''), (this.choicedStaff.beforeUserUuid = '')
      }
      if (tag == 2) {
        ;(this.choicedStaff.afterUserId = ''), (this.choicedStaff.afterUserName = ''), (this.choicedStaff.afterUserUuid = '')
      }
    },
    // 获取到跟进员工
    getStaff() {
      getfollowstaff({}).then(res => {
        this.choicedStaff = res
      })
    },
    goback() {
      this.$router.push({ path: '/leadManage/index' })
    },
    // 确认修改跟进员工
    comEmployee() {
      let params = this.choicedStaff
      editfollowstaff(params).then(res => {
        if (!res) {
          return
        }
        this.goback()
        this.$message.success('修改成功')
      })
    },
    //选择跟进员工的类型和高亮
    handleAddEmp(type) {
      this.type = type
      if (this.type == 1) {
        this.$refs.selectEmpForm.init(type, this.choicedStaff.beforeUserUuid)
      }
      if (this.type == 2) {
        this.$refs.selectEmpForm.init(type, this.choicedStaff.afterUserUuid)
      }
    },
    // 跟进员工列表选择回显在页面
    selectTable(item) {
      if (this.type == 1) {
        ;(this.choicedStaff.beforeUserId = item.userId), (this.choicedStaff.beforeUserName = item.userName), (this.choicedStaff.beforeUserUuid = item.userUuid)
      }
      if (this.type == 2) {
        ;(this.choicedStaff.afterUserId = item.userId), (this.choicedStaff.afterUserName = item.userName), (this.choicedStaff.afterUserUuid = item.userUuid)
      }
      
    }
  }
}
</script>

<style lang="scss" scoped>
.gl-footer {
  margin-top: 16px;
}
.scrm-sub-client-container {
  .pageContent {
    
    background-color: #fff;
    .baseTitle {
      .title {
        padding: 15px 30px 0px 20px;
        font-size: 16px;
        color: #333333;
        font-weight: 600;
      }
    }
    .combine {
      padding: 0px 20px 30px;
      .drainage-form-item {
        display: flex;
        margin-top: 20px;
        /deep/ {
          .el-input__inner {
            width: 448px;
          }
        }
        label {
          color: #333;
          text-align: right;
          margin-right: 10px;
          height: 36px;
          line-height: 36px;
          font-size: 14px;
          img {
            width: 16px;
            height: 16px;
            vertical-align: middle;
            // margin-left: 5px;
          }
        }
        .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: #666;
          display: inline-block;
          outline: none;
          padding-left: 5px;
          max-height: 68px;
          overflow: auto;
          transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
          width: 567px;
          display: flex;
          align-items: center;
          margin-top: 6px;
          font-size: 14px;
          height: 46px;
          /deep/ .el-tag {
            height: 26px;
            line-height: 26px;
            padding: 0 8px;
            margin-left: 5px;
          }
          i {
            // margin-left: 3px;
            color: #75acff;
            font-size: 14px;
          }
        }
        .drainage-coutom-count {
          color: #999;
          font-size: 14px;
          .count {
            color: #5850ff;
          }
        }
        /deep/ .el-button--small {
          height: 36px;
        }
      }
    }
  }
}
</style>