add.html 25.5 KB
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="utf-8" />
  <meta content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="description" content="广联帐户管理中心-员工管理" />
  <meta name="author" content="GLSX Web Team" />
  <meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
  <link rel="stylesheet" type="text/css" href="/css/main.css" />
  <title>员工管理</title>
  <style>
      .upload-img-box {
          position: relative;
          width: 80px;
          height: 80px;
          color: #999999;
          border: 1px dashed #d9d9d9;
          cursor: pointer;
      }
      .upload-img-box .upload-img {
          position: absolute;
          width: 80px;
          top: 0;
          left: 0;
      }
      .icon-add {
          position: absolute;
          top: 50%;
          font-size: 40px;
          left: 50%;
          transform: translate3d(-50%, -50%, 0);
      }
      .upload-img-wh {
          width: 80px !important;
          height: 80px;
      }
      .show {
          display: inline-block;
          /* width: 360px; */
      }
      .hide {
          display: none;
      }
      .tips {
          font-size: 14px;
          color: #999;
      }
      .form-right {
          position: absolute;
          right: 0;
          top: 0;
          transform: translateX(110%);
      }
      .sub-bg-white {
          background-color: #fff;
      }
      .edit-box {
          padding: 0 20px 20px;
          box-sizing: border-box;
          color: #333333;
          background-color: #ffffff;
          margin: 15px auto;
          position: relative;
          margin-bottom: 100px;
      }
      .edit-box .grayLine {
          position: absolute;
          left: 0;
          top: 48px;
          background-color: #d8d8d8;
          width: 100%;
          height: 1px;
      }
      .edit-title {
          height: 48px;
          line-height: 48px;
          padding: 0 20px;
          margin-bottom: 15px;
          font-size: 16px;
          color: #333333;
          font-weight: 600;
      }
      .hide {
          display: none;
      }
      .show {
          display: block;
      }
      .pageTitle {
          background-color: #fff;
          height: 78px;
          font-size: 20px;
          font-weight: bold;
          color: #333333;
          line-height: 78px;
          padding-left: 20px;
      }
      .Wrap {
          margin: 8px 20px 0;
          /* height: 100%; */
      }
      .xm-select-demo,
      xm-select > .xm-body .scroll-body {
          width: 360px;
      }
      xm-select:hover {
          border: 1px solid #2A58AD !important;
      }
  </style>
</head>
<body>
<div id="app">
  <main>
    <div class="Wrap">
      <div class="pageTitle">
        <span id="addUpdateTitle">新增员工</span>
      </div>
      <div class="sub-bg-white edit-box">
        <div class="grayLine"></div>
        <form class="layui-form add" lay-filter="employeeForm" action="">
          <div class="layui-form-item edit-title" style="position: relative">
            <div class="layui-input-inline">员工基本信息</div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label required">所属商户:</label>
            <div class="layui-input-block" id="merchantBox">
              <!-- <div id="merchantSelect" class="hide"> -->
              <!-- <select id="merchantName" name="merchantId" lay-filter="merchants" lay-verify="required" autocomplete="off" placeholder="请选择商户名称" required></select> -->
              <div id="merchantNameSelect" class="xm-select-demo"></div>
              <!-- </div> -->
              <div class="hide" id="merchantIdText" style="line-height: 32px"></div>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label required">员工姓名:</label>
            <div class="layui-input-block">
              <input type="text" name="staffName" maxlength="15" required lay-verify="required" placeholder="请输入员工姓名" autocomplete="off" class="layui-input" />
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label required">登录手机号:</label>
            <div class="layui-input-block">
              <input
                id="staffPhone"
                type="text"
                name="staffPhone"
                maxlength="11"
                required
                lay-verify="required|phone"
                placeholder="请输入您有效的手机号作为登录账户"
                autocomplete="off"
                class="layui-input"
              />
              <div style="height:22px">
                <input id="mesVerifyFlag"  type="checkbox" name="mesVerifyFlag" lay-filter="encrypt" lay-skin="primary" title="开启短信验证登录" />
              </div>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label required">登录密码:</label>
            <div class="layui-input-block" style="position: relative">
              <input
                type="password"
                name="password"
                id="password"
                maxlength="20"
                required
                onkeyup="this.value=this.value.replace(/[, ]/g,'')"
                lay-verify="required|merchantLoginPassword"
                placeholder="请输入登录密码"
                autocomplete="off"
                class="layui-input"
              />
              <button type="button" class="layui-btn form-right hide" id="resetpsw">重置密码</button>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label required">可见商户:</label>
            <div class="hide" id="allMerchant" style="line-height: 32px">全部商户</div>
            <div class="layui-input-block" id="otherMerchant">
              <input class="layui-input" placeholder="可见商户" id="searchMerchant" />
              <div style="position: absolute; top: 0; left: 380px">
                <button type="button" class="layui-btn" id="checkAll">全选</button>
              </div>
              <ul id="visibleInferiorMerTree" style="max-height: 200px; overflow-y: auto" class="ztree wrapper-tree"></ul>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label required">角色权限:</label>
            <div class="layui-input-block" style="position: relative">
              <select name="roleIds" id="roleAuth" lay-verify="required"></select>
              <div id="btnGroup" class="layui-btn-group hide" style="position: absolute; top: 0; right: -170px">
                <button type="button" class="layui-btn" id="refresh">刷新</button>
                <button type="button" class="layui-btn" id="addRole">创建角色</button>
              </div>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">头像:</label>
            <div class="layui-input-block">
              <div class="upload-img-box">
                <div class="icon-add img-add show">+</div>
                <img class="upload-img upload-img-wh hide" id="img" />
                <input
                  type="file"
                  id="upload"
                  name="merhcnatImg"
                  ref="file"
                  class="upload upload-img-box upload-img-wh"
                  accept="image/png, image/jpeg, image/gif, image/jpg"
                  data-idx="0"
                  style="opacity: 0"
                />
              </div>
              <span class="tips">图片格式仅支持JPG,PNG格式,大小1M以内</span>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">邮箱:</label>
            <div class="layui-input-block">
              <input type="text" name="staffEmail" maxlength="30" lay-verify="" placeholder="请输入邮箱" autocomplete="off" class="layui-input" />
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">主要职务:</label>
            <div class="layui-input-block">
              <input type="text" name="staffJob" maxlength="10" placeholder="请输入主要职务" autocomplete="off" class="layui-input" />
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">所属部门:</label>
            <div class="layui-input-block">
              <select name="department" id="departmentAuth">
                <!-- <option value="0">其他</option>
                <option value="1">销售部</option>
                <option value="2">售后部</option>
                <option value="3">客服部</option>
                <option value="4">续保部</option> -->
              </select>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">员工标签:</label>
            <div class="layui-input-block">
              <div id="tagAuth" name="staffLabel" class="xm-select-demo"></div>
              <!-- <select name="staffLabel" id="tagAuth" xm-select="selectId">
              <option value="0">1.0新车权益销售</option>
              <option value="1">1.1次新车精品升级</option>
              <option value="2">1.2次新车线上转化</option>
              <option value="3">1.3存量用户众筹</option>
            </select> -->
            </div>
          </div>
          <div class="layui-form-item hide" id="wechatNick">
            <label class="layui-form-label">微信昵称:</label>
            <div class="layui-input-block">
              <input type="text" name="weChatNickName" readonly class="layui-input" />
            </div>
          </div>
          <div class="layui-form-item hide" id="wechatPhone">
            <label class="layui-form-label">微信手机号:</label>
            <div class="layui-input-block">
              <input type="text" name="weChatPhone" readonly class="layui-input" />
            </div>
          </div>
          <div class="layui-form-item hide" id="wechatId">
            <label class="layui-form-label">微信openid:</label>
            <div class="layui-input-block">
              <input type="text" name="weChatOpenId" readonly class="layui-input" />
            </div>
          </div>
          <div class="footer-close">
            <button class="layui-btn" lay-submit lay-filter="employeeSubmit">确定</button>
            <button type="reset" class="layui-btn" id="return">取消</button>
          </div>
        </form>
      </div>
    </div>
  </main>
</div>
<script src="https://img02.glsx.com.cn/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
  //Demo
  layui.use(['form', 'upload', 'gtree', 'request', 'helper', 'xmSelect'], function () {
    var id = qs('id')
    var form = layui.form
    var upload = layui.upload
    var tree = layui.gtree
    var request = layui.request
    var helper = layui.helper
    var $ = layui.$
    var xmSelect = layui.xmSelect
    var merchantFileRequest = {}
    var all_nodes = []
    var employeeForm = {}
    var pwd = $('#password') // 密码输入框
    var resetpsw = $('#resetpsw')
    var roleAuth = $('#roleAuth')
    var departmentSelect = $('#departmentAuth')
    var wechatNick = $('#wechatNick')
    var wechatPhone = $('#wechatPhone')
    var wechatId = $('#wechatId')
    var merchantName = $('#merchantName')
    var merchantId = ''
    var visibleMerchant = {}
    pwd.attr('readonly', false)
    var accountInfo = helper.store.get('accountInfo')
    // 是否是特殊商户
    var specialVisible = ''
    // 禁用所有input框的回车事件
    var inputs = document.getElementsByTagName('input')
    for (let i = 0; i < inputs.length; i++) {
      var input = inputs[i]
      input.onkeydown = function (event) {
        if (event.keyCode == 13) {
          event.keyCode = 0
          event.returnValue = false
        }
      }
    }
    // 员工标签
    var tagAuth = xmSelect.render({
      el: '#tagAuth',
      prop: {
        name: 'name',
        value: 'value'
      },
      // layVerify: `${qs('channel') ? '' : 'required'}`,
      // model: {
      //   label: {
      //     type: 'text',
      //     text: {}
      //   }
      // },
      name: 'staffLabel',
      selected: true,
      data: [
        {
          name: '精品升级(太阳膜)',
          value: '1'
        },
        {
          name: '次新车转化(车衣、改色膜)',
          value: '4'
        },
        {
          name: '售后众筹活动',
          value: '3'
        },
        {
          name: '会员权益/升级',
          value: '0'
        },
        {
          name: '膨胀金活动',
          value: '2'
        },
        {
          name: '送修线索',
          value: '5'
        },
        {
          name: '权益核赔',
          value: '6'
        }
      ],
      on: function (data) {
        staffLabel = data.change[0].value
      }
    })
    var merchantNameSelect = xmSelect.render({
      el: '#merchantNameSelect',
      prop: {
        name: 'merchantName',
        value: 'id'
      },
      layVerify: `${qs('channel') ? '' : 'required'}`,
      model: {
        label: {
          type: 'text',
          text: {}
        }
      },
      name: 'merchantId',
      filterable: true,
      clickClose: true,
      radio: true,
      data: [],
      on: function (data) {
        merchantId = data.change[0].id
        getList(merchantId)
      }
    })
    if (accountInfo && !id) {
      $('#btnGroup').addClass('show')
    }
    // 判断是从商户过来还是员工
    if (qs('channel')) {
      getList(qs('merchantId'))
      merchantId = qs('merchantId')
      $('#merchantIdText').text(decodeURIComponent(qs('merchantName')))
      $('#merchantIdText').removeClass('hide')
      $('#merchantIdText').addClass('show')
      $('#merchantNameSelect').addClass('hide')
      $('#staffPhone').removeAttr('disabled')
    } else {
      if (qs('id')) {
        // 判断是否是编辑
        resetpsw.removeClass('hide')
        resetpsw.addClass('show')
        wechatNick.removeClass('hide')
        wechatNick.addClass('show')
        wechatPhone.removeClass('hide')
        wechatPhone.addClass('show')
        wechatId.removeClass('hide')
        wechatId.addClass('show')
        merchantId = encodeURI(qs('merchantId'))
        $('#merchantIdText').text(decodeURIComponent(qs('merchantName')))
        $('#merchantIdText').removeClass('hide')
        $('#merchantIdText').addClass('show')
        $('#staffPhone').attr('disabled', true)
        getList(qs('merchantId'))
        $('#addUpdateTitle').text('修改员工')
        $('#merchantNameSelect').remove()
      }
      findAllMerchant(function (result) {
        if (accountInfo && accountInfo.merchantAccountLevel == 4) {
          const merchantName = result[0].merchantName
          $('#merchantIdText').text(merchantName)
          merchantId = result[0].id
          form.render()
          $('#merchantIdText').removeClass('hide')
          $('#merchantIdText').addClass('show')
          $('#merchantNameSelect').remove()
          getList(merchantId)
        }
      })
    }
    /** 手动触发事件 */
    // 上传图片
    $('.upload').on('change', function (e) {
      var el = $('#upload')
      var imgEl = $('#img')
      var addEl = $('.img-add')
      var reader = new FileReader()
      var fileInfo = el[0].files[0]
      merchantFileRequest.fileName = fileInfo.name
      reader.readAsDataURL(fileInfo)
      reader.onload = function (e) {
        if (e) {
          const imgFile = e.target.result
          const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
          request(
            {
              method: 'glsx.accounts.biz.common.pictureUpload',
              file: base64
            },
            function (result) {
              merchantFileRequest.fileUrl = result.data
              imgEl.attr('src', result.data)
              imgEl.removeClass('hide')
              imgEl.addClass('show')
              addEl.removeClass('show')
              addEl.addClass('hide')
            },
            {},
            ['file'],
            true
          )
        }
      }
      reader.onload()
    })
    // 返回上个页面
    $('#return').on('click', function () {
      window.history.back()
    })
    // 重置密码
    resetpsw.on('click', function () {
      pwd.attr('readonly', false)
      pwd.val('')
    })
    var checkAll = false
    var checkBtn = $('#checkAll')
    // 全选可见商户
    checkBtn.on('click', function () {
      if (!merchantId) {
        layer.msg('请选择所属商户!')
      } else {
        checkAll = !checkAll
        visibleMerchant.checkAllNodes(checkAll)
        if (checkAll) {
          checkBtn.html('全不选')
        } else {
          checkBtn.html('全选')
        }
      }
    })
    // 刷新
    $('#refresh').on('click', function () {
      if (!merchantId) {
        layer.msg('请选择所属商户!')
      } else {
        findRoleList(merchantId)
      }
    })
    // 创建角色
    $('#addRole').on('click', function () {
      go('role', 'add')
      // $messenger.emit('route-to', { path: '/settings/role/add' })
    })
    // 提交表单
    form.on('submit(employeeSubmit)', function (data) {
      if (specialVisible != '-1' && visibleMerchant.getCheckedNodes(true).length == 0) {
        layer.msg('可见商户必选', {
          icon: 2
        })
        return false
      }
      var visibleInferiorMer = ''
      if (specialVisible == '-1') {
        visibleInferiorMer = '-1'
      } else {
        visibleInferiorMer = visibleMerchant
          .getCheckedNodes(true)
          .map(function (i) {
            return i.id
          })
          .join(',')
      }
      var otherParams = {
        visibleInferiorMer: visibleInferiorMer,
        merchantId: merchantId
      }
      if (merchantFileRequest.fileName) {
        otherParams.merchantFileRequest = JSON.stringify(merchantFileRequest)
      }
      if (id) {
        otherParams.id = id
        otherParams.method = 'merchants.api.staff.updateStaff'
      } else {
        otherParams.method = 'merchants.api.staff.saveStaff'
      }
      var params = helper.clone(true, data.field, otherParams)
      params.mesVerifyFlag = params.mesVerifyFlag == 'on' ? 1 : 0
      delete params.merhcnatImg
      params.createdSource = 1
      request(params, function (result) {
        if (result.code == '0') {
          layer.msg('操作成功', {
            icon: 1
          })
          window.history.back()
        }
      })
      return false
    })
    // 表单验证
    form.verify({
      merchantLoginPassword: function (value) {
        if (value) {
          if (value.length < 8 || value.length > 20) {
            return '登录密码请填入8-20位字符'
          }
          // if (!/^(?=.*\d)(?=.*[a-zA-Z])[\s\S]{6,20}$/.test(value)) {
          if (!/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{8,20}$/.test(value)) {
            return '请输入密码(8-20位,必须包含大写字母、小写字母、数字、特殊符号中3种或以上)'
          }
        }
      }
    })
    // select 选择触发
    form.on('select(merchants)', function (data) {
      merchantId = data.value
      getList(merchantId)
    })
    /** 定义方法 */
    function getList(merchantId) {
      getVisibleMerchant(merchantId)
      findRoleList(merchantId)
      findAllDepartment()
    }
    // 可见商户
    function getVisibleMerchant(merchantId) {
      var visibleMerchantParams = { id: merchantId, method: 'merchants.api.merchant.findMerchantTree' }
      request(visibleMerchantParams, function (res) {
        if (res.code == '0') {
          const data = res.data
          if (id) {
            findAllMerchant(function (result) {
              if (result) {
                getById(function (checkedList) {
                  if (data.length == 1 && data[0].id == -1) {
                    $('#allMerchant').removeClass('hide')
                    specialVisible = data[0].id
                    // createMerchant(data[0].id, data)
                    $('#otherMerchant').addClass('hide')
                  } else {
                    createMerchant(checkedList, res.data)
                  }
                })
              }
            })
          } else {
            if (data.length == 1 && data[0].id == -1) {
              $('#allMerchant').removeClass('hide')
              specialVisible = data[0].id
              // createMerchant(data[0].id, data)
              $('#otherMerchant').addClass('hide')
            } else {
              const arr = []
              arr.push(+merchantId)
              createMerchant(arr, res.data)
              specialVisible = ''
              $('#otherMerchant').removeClass('hide')
              $('#allMerchant').addClass('hide')
            }
          }
        }
      })
    }
    function createMerchant(arr, data) {
      visibleMerchant = tree.create('visibleInferiorMerTree', data, null, {
        check: {
          enable: true,
          chkboxType: {
            Y: '',
            N: ''
          }
        }
      })
      visibleMerchant.checkNodes(arr)
      all_nodes = visibleMerchant.transformToArray(visibleMerchant.getNodes())
      bindEvent()
    }
    // 查询所属部门
    function findAllDepartment(){
      var params = { dictType:'staff_department',
        method:'merchants.api.menu.findAllDictData'}
      request(params, function (res) {
        console.log(res)
        if (res.code == '0') {
          var list = res.data
          departmentSelect.empty()
          list.unshift('')
          $.each(list, function (index, item) {
            departmentSelect.append(new Option(item.dictLabel, item.dictValue))
          })
          form.render('select')
        }
      })
    }
    // 查询所有商户
    function findAllMerchant(callback) {
      var params = { method: 'merchants.api.menu.findAllMerchant' }
      request(params, function (result) {
        if (result.code == '0') {
          merchantNameSelect.update({
            data: result.data,
            autoRow: true,
            paging: result.data.length > 20
          })
          // merchantNameSelect.setValue([merchantId])
          // var list = result.data
          // list.unshift('')
          // $.each(list, function (index, item) {
          //   merchantName.append(new Option(item.merchantName, item.id))
          // })
          // form.render('select')
          callback(result.data)
        }
      })
    }
    // 查询角色权限列表
    function findRoleList(merchantId) {
      var params = { method: 'merchants.api.role.list', id: merchantId, delFlag: 0 }
      request(params, function (res) {
        if (res.code == '0') {
          var list = res.data
          roleAuth.empty()
          list.unshift('')
          $.each(list, function (index, item) {
            roleAuth.append(new Option(item.roleName, item.id))
          })
          form.render('select')
        }
      })
    }
    function getById(callback) {
      // 查询员工详情
      var params = { id: id, method: 'merchants.api.staff.staffSearchRequest' }
      pwd.attr('readonly', true)
      request(params, function (res) {
        if (res.code == '0') {
          var data = res.data
          employeeForm = {
            id: 8,
            merchantId: data.merchantId,
            staffName: data.staffName,
            staffPhone: data.staffPhone,
            password: data.password,
            mesVerifyFlag: data.mesVerifyFlag,
            // visibleInferiorMer: "1",
            roleIds: data.roleIds ? +data.roleIds.join('') : '',
            staffEmail: data.staffEmail,
            staffJob: data.staffJob,
            department: data.department,
            weChatNickName: data.weChatNickName,
            weChatPhone: data.weChatPhone,
            weChatOpenId: data.weChatOpenId
          }
          if (data.staffLabel) {
            var item = data.staffLabel.split(','.toString())
            tagAuth.setValue(item)
          }
          if (data.merchantFileResponse) {
            merchantFileRequest = { fileName: data.merchantFileResponse.fileName, fileUrl: data.merchantFileResponse.fileUrl }
            $('#img').attr('src', merchantFileRequest.fileUrl)
            $('#img').removeClass('hide')
            $('#img').addClass('show')
            $('.img-add').removeClass('show')
            $('.img-add').addClass('hide')
          }
          var visibleInferiorMerArr = data.visibleInferiorMer ? data.visibleInferiorMer.split(',') : []
          $.each(visibleInferiorMerArr, function (index, item) {
            visibleInferiorMerArr[index] = +item
          })
          // var visibleInferiorMerArr = [32, 38]
          callback(visibleInferiorMerArr)
        }
        form.val('employeeForm', employeeForm)
        form.render('select')
        if (!$('#staffPhone').val()) {
          $('#staffPhone').removeAttr('disabled')
        }
      })
    }
    function bindEvent() {
      $('#searchMerchant').on(
        'input',
        helper.debounce(function () {
          var txt = $(this).val()
          if (!txt) {
            visibleMerchant.showNodes(all_nodes)
          } else {
            var nodesList = visibleMerchant.getNodesByParamFuzzy('label', txt)
            show_nodes = helper.findShowNode(nodesList, all_nodes)
            visibleMerchant.hideNodes(all_nodes)
            visibleMerchant.showNodes(show_nodes)
          }
        }, 500)
      )
    }
  })
</script>
</body>