  <template>
  <div class="main">
    <header class="sl-header">
      <div class="sl-header-ul">
        <img class="sl-header-li-logo" src="../assets/img/xylogo.png" alt="产供销管理信息系统">
        <img class="sl-header-li-logo" style="margin-top: 14px;" src="../assets/img/ytg_xtico.png" alt="产供销管理信息系统">
        <!--<div class="sl-header-li-lgo">-->
        <!--<a @click.prevent="loginOut" class="sl-header-li-lgob" style="cursor: pointer;">-->
        <!--<span class="xs-icons xs-icons-user"></span>退出登录-->
        <!--</a>-->
        <!--</div>-->
        <div class="oa-header-user">
          <div class="oa-header-upt">
            <a>
              <template v-if="loginUser.image">
                <img class="oa-sign-tul-ui" :src="'data:image/png;base64,' + loginUser.image" alt="头像">
              </template>
              <template v-else>
                <img class="oa-sign-tul-ui" src="../../static/img/photo-default.png" alt="头像">
              </template>
            </a>
          </div>
          <div class="oa-header-ucon">
            <div class="oa-header-ulist">
              <div class="oa-header-uin">
                <template v-if="loginUser.image">
                  <img :src="'data:image/png;base64,' + loginUser.image" alt="头像" @click="photoModal=true">
                </template>
                <template v-else>
                  <img src="../../static/img/photo-default.png" alt="头像" @click="photoModal=true">
                </template>
                <h3>{{ loginUser.username }}</h3>
              </div>
              <ul class="oa-header-uul">
                <li @click="showPersonInfo()">
                  <span class="st-icons st-icons-user"></span>个人信息
                </li>
                <li @click="pwdModal = true">
                  <span class="st-icons st-icons-pwd"></span>修改密码
                </li>
                <li @click="signOut">
                  <span class="st-icons st-icons-out"></span>退出登录
                </li>
              </ul>
            </div>
          </div>
        </div>
        <div class="hnstLogo">
          <img src="../assets/img/hnst_logo.png" alt="">
        </div>
        <div class="sl-header-li-lgbc" v-if="currentList && currentList.length > 0">
          <span class="xs-icons xs-icons-right-arrow am-xz"></span>
          <span class="sl-breadcrumb-text">当前位置：</span>
          <el-breadcrumb separator-class="el-icon-arrow-right" class="sl-breadcrumb-list">
            <el-breadcrumb-item v-for="item in currentList" :key="'bdb' + item.id">{{item.name}}</el-breadcrumb-item>
          </el-breadcrumb>
        </div>
      </div>
      <!--<div class="sl-breadcrumb">
        <span class="sl-breadcrumb-text">当前位置：</span>
      </div>-->
    </header>
    <div class="sl-menu-main" :class="{'sl-menu-main2': menuType === '2'}">
      <div style="text-align: center; padding-top: 10px; padding-bottom: 5px;">
        <span class="el-icon-d-arrow-right sl-menu-ops" style="cursor: pointer;" @click="changeMenuType"></span>
      </div>
      <nav class="sl-menu">
        <a v-for="item in menuData" :key="item.id"
           :class="{'sl-menu-reverse': item.childrenPlacement === 'reverse', 'sl-menu-sed': sedArray.length > 0 && sedArray[0] === item.id }"
           class="sl-menu-a">
          <span class="sl-menu-lit">{{item.name}}</span>
          <span class="sl-menu-lic xs-icons" :class="item.icon"></span>
          <!-- <el-tooltip effect="dark" :content="item.name" placement="top-start">
             <span class="sl-menu-tip-cover"></span>
           </el-tooltip> -->
          <template v-if="item.children && item.children.length > 0">
            <span class="sl-menu-ric sl-menu-ricu"></span>
            <div class="sl-menu-s sl-menu-sham">
              <a v-for="sitem in item.children" :key="sitem.id"
                 :href="sitem.url ? ($store.state.ctx + sitem.url) : 'javascript:void(0);'"
                 :target="'page_' + sitem.id"
                 :class="{'sl-menu-reverse': sitem.childrenPlacement === 'reverse', 'sl-menu-sdis': sitem.unused, 'sl-menu-ssed': sedArray.length > 1 && sedArray[1] === sitem.id }"
                 class="sl-menu-sa">
                {{sitem.name}}
                <template v-if="sitem.children && sitem.children.length > 0">
                  <span class="el-icon-caret-right sl-menu-ricr"></span>
                  <div class="sl-menu-ss sl-menu-sham"
                       :style="{'margin-top': sitem.marginTop ? sitem.marginTop : '0px'}">
                    <!-- @click.prevent.stop="routerGo(ssitem.url, ssitem.id)" -->
                    <a v-for="ssitem in sitem.children" :key="ssitem.id"
                       :href="ssitem.url ? ($store.state.ctx + ssitem.url) : 'javascript:void(0);'"
                       :target="'page_' + ssitem.id"
                       :class="{'sl-menu-reverse': ssitem.childrenPlacement === 'reverse', 'sl-menu-sdis': ssitem.unused, 'sl-menu-ssed': sedArray.length > 2 && sedArray[2] === ssitem.id }"
                       class="sl-menu-sa">
                      <span>{{ssitem.name}}</span>
                      <template v-if="ssitem.children && ssitem.children.length > 0">
                        <span class="el-icon-caret-right sl-menu-ricr"></span>
                        <div class="sl-menu-ss sl-menu-sham"
                             :style="{'margin-top': ssitem.marginTop ? ssitem.marginTop : '0px'}">
                          <a v-for="sssitem in ssitem.children" :key="sssitem.id"
                             :href="sssitem.url ? ($store.state.ctx + sssitem.url) : 'javascript:void(0);'"
                             :target="'page_' + sssitem.id"
                             :class="{'sl-menu-sdis': sssitem.unused, 'sl-menu-ssed': sedArray.length > 3 && sedArray[3] === sssitem.id }"
                             class="sl-menu-sa">
                            <span>{{sssitem.name}}</span>
                          </a>
                        </div>
                      </template>
                    </a>
                  </div>
                </template>
              </a>
            </div>
          </template>
        </a>
      </nav>
    </div>
    <section class="sl-container" :class="{'sl-container2': menuType === '2' }" id="mainContainer">
      <div class="sl-content-main">
        <transition enter-active-class="fade-in" leave-active-class="leave-immediately"
                    :duration="{ enter: 400, leave: 100 }">
          <router-view></router-view>
        </transition>
      </div>
    </section>
    <el-dialog :visible.sync="pwdModal" class="oa-pwd-modal" title="修改密码" width="500px" :loading="pwdModalLoading">
      <el-form ref="pwdForm" :model="pwdForm" :rules="rulePwdForm" label-width="120px" style="padding-right: 40px;">
        <el-form-item label="原密码" prop="oldPwd">
          <el-input size="small" type="password" v-model="pwdForm.oldPwd" :maxlength="64"></el-input>
        </el-form-item>
        <el-form-item label="新密码" prop="newPwd">
          <el-input size="small" type="password" v-model="pwdForm.newPwd" :maxlength="64"></el-input>
        </el-form-item>
        <el-form-item label="确认密码" prop="newPwdCheck">
          <el-input size="small" type="password" v-model="pwdForm.newPwdCheck" :maxlength="64"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="pwdModal = false">取 消</el-button>
        <el-button size="small" type="primary" @click="pwdSubmit('pwdForm')">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 上传头像Modal -->
    <el-dialog :show-close="false" :visible.sync="photoModal" width="300px">
      <span class="main-upload_text_logo">上传头像</span>
      <div class="main-file_upload">
        <div class="main-file_con">
          <div class="main-img_holder">
            <div style="position: relative;top: -20px; height: 90px">
              <img v-if="loginUser.image" :src="'data:image/png;base64,' + loginUser.image">
              <img v-if="!loginUser.image" src="../../static/img/photo-default.png"
                   style="position: relative;top: 20px;"/>
            </div>
          </div>
          <div class="main-file_btn_upload">
            <input type="file" class="hide" @change="getPic" id="mainInputFile">
            <span class="main-file_uploader" @click="getPicClick">上传头像</span>
          </div>
          <div>
            <div style="display: inline-block;width: 45%;">
              <el-button size="small" @click="noGetPicData">取消</el-button>
            </div>
            <div style="display: inline-block;width: 45%;">
              <el-button type='primary' size="small" @click="getPicData">确定</el-button>
            </div>
          </div>
        </div>
      </div>
    </el-dialog>
    <div is="userInfo" :loginUserInfo="loginUser2" @modifyUserName="modifyUserName"></div>
  </div>
</template>
<script>
import userInfo from '@/components/userInfo.vue';
import { cookieUserId } from '@/config/config.js';
import { setCookie, getCookie } from '@/utils/util.js'
export default {
  components: {
    userInfo
  },
  data () {
    const validatePass = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入新密码'));
      } else {
        let reg = /^[A-Za-z0-9]+$/
        if (!reg.test(value)) {
          return callback(new Error('请输入英文和数字'));
        }
        if (this.pwdForm.newPwdCheck !== '') {
          // 对第二个密码框单独验证
          this.$refs.pwdForm.validateField('newPwdCheck');
        }
        callback();
      }
    };
    const validatePassCheck = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请再次输入新密码'));
      } else if (value !== this.pwdForm.newPwd) {
        callback(new Error('两次输入密码不一致'));
      } else {
        callback();
      }
    };
    return {
      pwdModalLoading: true,
      pwdModal: false,
      photoModal: false,
      loginUser: {},
      loginUser2: {},
      photoTemp: null,
      photoModalLoading: false,
      photoSubmitDisable: false,
      menuType: '2',
      contentChanged: false,
      menuData: [
        // 销售管理 unused
        {
          id: 'xsgl',
          name: '销售管理',
          icon: 'xs-icons-menu1',
          children: [
            {
              id: 'xsgl-03',
              name: '销售计划',
              children: [
                {id: 'xsgl-03-01', name: '年度销售计划', unused: true},
                {id: 'xsgl-03-02', name: '季度销售计划', unused: true},
                {id: 'xsgl-04-03', name: '月度销售计划', unused: true},
                {id: 'xsgl-04-04', name: '年度计划跟踪', unused: true},
                {id: 'xsgl-04-05', name: '季度计划跟踪', unused: true},
                {id: 'xsgl-04-06', name: '月度计划跟踪', unused: true}
              ]
            },
            {id: 'xsgl-01', name: '客户管理', url: './sales.html#/customer'},
            {
              id: 'xsgl-04',
              name: '合同管理',
              icon: 'xs-icons-slm',
              children: [
                // {id: 'xsgl-04-01', name: '合同维护', url: 'contractMaintain'},
                {id: 'xsgl-04-01', name: '合同维护', url: './sales.html#/maintain'},
                {id: 'xsgl-04-03', name: '合同评审', unused: true},
                // {id: 'xsgl-04-04', name: '合同生效', url: 'effective'},
                {id: 'xsgl-04-04', name: '合同生效', url: './sales.html#/effective'},
                // {id: 'xsgl-04-10', name: '合同打印', url: 'contractPrint'},
                {id: 'xsgl-04-10', name: '合同打印', url: './sales.html#/print'},
                {id: 'xsgl-04-05', name: '合同变更', unused: true},
                // {id: 'xsgl-04-08', name: '合同结案', url: 'close-case'}
                {id: 'xsgl-04-08', name: '合同结案', url: './sales.html#/closeCase'},
                {id: 'xsgl-04-09', name: '合同跟踪', url: './sales.html#/tracing2'}
              ]
            },
            {
              id: 'xsgl-05',
              name: '订单管理',
              icon: 'xs-icons-slm',
              children: [
                // {id: 'xsgl-05-01', name: '订单维护', url: 'order-info'},
                {id: 'xsgl-05-01', name: '订单维护', url: './sales.html#/info'},
                {id: 'xsgl-05-05', name: '订单评审', unused: true},
                {id: 'xsgl-05-06', name: '订单生效', unused: true},
                {id: 'xsgl-05-07', name: '订单变更', unused: true},
                // {id: 'xsgl-05-02', name: '订单下发', url: 'order-issued'},
                {id: 'xsgl-05-02', name: '订单下发', url: './sales.html#/issued'},
                // {id: 'xsgl-05-04', name: '订单关闭', url: 'order-close'}
                {id: 'xsgl-05-04', name: '订单关闭', url: './sales.html#/close'},
                {id: 'xsgl-05-03', name: '订单跟踪', url: './sales.html#/orderTracing2'}
                // {id: 'xsgl-05-08', name: '订单跟踪测试页面', url: './sales.html#/orderTracing2'}
              ]
            },
            {
              id: 'xsgl-06',
              name: '交付管理',
              icon: 'xs-icons-slm',
              children: [
                {id: 'xsgl-06-01', name: '发运计划维护', url: './sales.html#/despatchPlanMt'}, // url: 'payInfoMag-despatchPlanMt'
                {id: 'xsgl-06-02', name: '发运计划审核', url: './sales.html#/despatchPlanAudit'}, // url: 'payInfoMag-despatchPlanAudit'
                {id: 'xsgl-06-10', name: '发运计划关闭', url: './sales.html#/despatchPlanClose'},
                {id: 'xsgl-06-03', name: '发运计划跟踪', url: './sales.html#/despatchPlanFollow'}, // url: 'payInfoMag-despatchPlanFollow'
                {id: 'xsgl-06-04', name: '火运提货单维护', url: './sales.html#/ladingMt'}, // url: 'payInfoMag-ladingMt'
                {id: 'xsgl-06-11', name: '汽运提货单维护', url: './sales.html#/ladingCarMt'}, // url: 'payInfoMag-ladingMt'
                {id: 'xsgl-06-05', name: '提货单审核', url: './sales.html#/ladingAudit'},
                {id: 'xsgl-06-06', name: '提货单下发', url: './sales.html#/ladingIssues'},
                {id: 'xsgl-06-07', name: '提货单打印', url: './sales.html#/ladingPrint'},
                {id: 'xsgl-06-08', name: '提货单跟踪', url: './sales.html#/ladingFollow'},
                {id: 'xsgl-06-09', name: '提货单失效', url: './sales.html#/loseEfficacy'}
                // {id: 'xsgl-06-11', name: '收货实绩管理', unused: true}
              ]
            },
            {
              id: 'xsgl-07',
              name: '账务管理',
              children: [
                {id: 'xsgl-07-01', name: '账户管理', url: './sales.html#/accountMag'},
                {id: 'xsgl-07-02', name: '回款管理', url: './sales.html#/paymentMag'},
                {id: 'xsgl-07-04', name: '资金调拨', url: './sales.html#/cashTransfer'}
              ]
            },
            {
              id: 'xsgl-08',
              name: '结算管理',
              marginTop: '-100px',
              children: [
                {id: 'xsgl-08-03', name: '资金结算', url: './sales.html#/fundSettlement'},
                {id: 'xsgl-08-06', name: '资金冲减', url: './sales.html#/writeDown'},
                {id: 'xsgl-08-14', name: '票据核算', url: './sales.html#/billCheck'},
                {id: 'xsgl-08-07', name: '票据对齐', url: './sales.html#/billAlign'},
                {id: 'xsgl-08-15', name: '结算单编制', url: './sales.html#/editFundForm'},
                {
                  id: 'xsgl-08-09',
                  name: '发票管理',
                  children: [
                    {id: 'xsgl-08-09-01', name: '开票申请', url: './sales.html#/receiptApply'},
                    {id: 'xsgl-08-09-02', name: '票据管理', url: './sales.html#/receiptManager'},
                    {id: 'xsgl-08-09-03', name: '发票跟踪', url: './sales.html#/receiptFollow'}
                  ]
                },
                {id: 'xsgl-08-17', name: '贴息管理', unused: true},
                {id: 'xsgl-08-10', name: '结算单价申报', unused: true},
                {id: 'xsgl-08-11', name: '结算单价审批', unused: true},
                {id: 'xsgl-08-12', name: '合同明细查询', url: './sales.html#/capitalBalance'},
                {id: 'xsgl-08-16', name: '结算明细查询', url: './sales.html#/balanceDetail'},
                {id: 'xsgl-08-13', name: '资金占用明细查询', url: './sales.html#/capitalOccupy'}
              ]
            },
            {
              id: 'xsgl-02',
              name: '价格库管理',
              children: [
                {id: 'xsgl-02-01', name: '计价因子维护', unused: true},
                {id: 'xsgl-02-02', name: '计价因子范围分类', unused: true},
                {id: 'xsgl-02-03', name: '价格库维护', unused: true}
              ]
            },
            {
              id: 'xsgl-09',
              name: '服务管理',
              children: [
                {id: 'xsgl-09-01', name: '异议管理', unused: true},
                {id: 'xsgl-09-02', name: '客户回访', unused: true},
                {id: 'xsgl-09-03', name: '客户投诉', unused: true}
              ]
            }
          ]
        },
        {
          id: 'cggl',
          name: '采购管理',
          icon: 'xs-icons-menu2',
          children: [
            {id: 'cggl-01', name: '物料管理', unused: true},
            {id: 'cggl-02', name: '供应商管理', unused: true},
            {id: 'cggl-04', name: '专家库管理', unused: true},
            {id: 'cggl-05', name: '采购需求管理', unused: true},
            {id: 'cggl-06', name: '招投标管理', unused: true},
            {id: 'cggl-07', name: '采购合同管理', unused: true},
            {id: 'cggl-08', name: '采购订单管理', unused: true},
            {id: 'cggl-09', name: '采购结算管理', unused: true},
            {id: 'cggl-10', name: '采购异议管理', unused: true}
          ]
        },
        {
          id: 'gfgl',
          name: '规范管理',
          icon: 'xs-icons-menu3',
          children: [
            {
              id: 'gfgl-01',
              name: '产品规范管理',
              icon: 'xs-icons-slm',
              children: [
                {id: 'gfgl-01-01', name: '产品名称管理', icon: 'xs-icons-slm', url: './standard.html#/productName'},
                {id: 'gfgl-01-02', name: '钢级牌号管理', icon: 'xs-icons-slm', url: './standard.html#/steelGrade'},
                {id: 'gfgl-01-04', name: '炼钢牌号管理', url: './standard.html#/steelMarking'},
                {id: 'gfgl-01-03', name: '交货状态管理', icon: 'xs-icons-slm', url: './standard.html#/deliveryState'},
                {id: 'gfgl-01-11', name: '订货标准管理', url: './standard.html#/standardCodePay'}, // 原 标准号管理-交付
                {id: 'gfgl-01-05', name: '其他标准管理', url: './standard.html#/standardCodeOther'} // 原 标准号管理-其他
              ]
            },
            {
              id: 'gfgl-02',
              name: '制造规范管理',
              unused: true
              /*
              children: [
                {id: 'gfgl-02-09', name: '制造规范管理', url: './standard.html#/metaManger'},
                {id: 'gfgl-02-11', name: '工艺标准管理', unused: true},
                {id: 'gfgl-02-05', name: '内控标准管理', url: './standard.html#/innerControl'},
                {id: 'gfgl-02-04', name: '产能资源配置', url: './basicconfig.html#/well'}, // 产能井
                {id: 'gfgl-02-01', name: '产线工序机台信息配置', url: './standard.html#/information'},
                {id: 'gfgl-02-02', name: '工序点与二级工序配置', url: './standard.html#/pointConfig'},
                {id: 'gfgl-02-03', name: '工序点与附加要求配置', url: './standard.html#/pointAdditional'},
                {id: 'gfgl-02-08', name: '工序点与工艺参数配置', url: './standard.html#/parameterConfig'},
                {id: 'gfgl-02-06', name: '生产产线适用条件配置', icon: 'xs-icons-slm', url: './standard.html#/proLineConfig'},
                {id: 'gfgl-02-12', name: '公差引用标准信息管理', url: './standard.html#/ToleranceStandard'},
                {id: 'gfgl-02-07', name: '试样组与试验标准配置', icon: 'xs-icons-slm', url: './standard.html#/testGroupStaConf'}
              ]
              */
            }
          ]
        },
        {
          id: 'zlgl',
          name: '质量管理',
          icon: 'xs-icons-menu4',
          children: [
            {
              id: 'zlgl-01',
              name: '质量设计管理',
              children: [
                {id: 'zlgl-01-01', name: '质量设计确认', unused: true},
                // {id: 'zlgl-01-01', name: '质量设计确认', url: './qualityControl.html#/qualityDesign'},
                {id: 'zlgl-01-02', name: '设计结果查询', unused: true},
                {id: 'zlgl-01-03', name: '检验方案管理', unused: true}
              ]
            },
            {
              id: 'zlgl-02',
              name: '检化验信息管理',
              unused: true
              /*
              children: [
                {id: 'zlgl-02-02', name: '检验委托管理', url: './qualityControl.html#/InspectionEntrustmen'},
                {id: 'zlgl-02-01', name: '检验信息管理', url: './qualityControl.html#/inspectionInformation'}
              ]
              */
            },
            {
              id: 'zlgl-03',
              name: '质量判定管理',
              // unused: true
              children: [
                // {id: 'zlgl-03-06', name: '成分判定管理', url: './qualityControl.html#/ingredientJudge'},
                // {id: 'zlgl-03-05', name: '材质判定管理', url: './qualityControl.html#/materialJudge'},
                // {id: 'zlgl-03-01', name: '上表检验管理', url: './qualityControl.html#/surfaceInspection'},
                // {id: 'zlgl-03-02', name: '下表检验管理', url: './qualityControl.html#/downSurfaceInspection'},
                // {id: 'zlgl-03-03', name: '边部检验管理', url: './qualityControl.html#/marginInspection'},
                // {id: 'zlgl-03-04', name: '卡量检验管理', url: './qualityControl.html#/rulerInspection'},
                {id: 'zlgl-03-07', name: '表面检验管理', url: './qualityControl.html#/threeInOne'}
                // {id: 'zlgl-03-08', name: '探伤检验管理', url: '', unused: true},
                // {id: 'zlgl-03-09', name: '综合判定管理', url: '', unused: true},
                // {id: 'zlgl-03-10', name: '改判申请管理', url: '', unused: true},
                // {id: 'zlgl-03-11', name: '改判确认管理', url: '', unused: true},
                // {id: 'zlgl-03-12', name: '异常材料处理', url: '', unused: true}
              ]
            },
            {
              id: 'zlgl-04',
              name: '质量证明书管理',
              children: [
                {id: 'zlgl-04-01', name: '质量证明书模板管理', url: '', unused: true},
                {id: 'zlgl-04-02', name: '质量证明书制作管理', url: '', unused: true}
              ]
            }
          ]
        },
        {
          id: 'scgl',
          name: '生产管理',
          icon: 'xs-icons-menu5',
          children: [
            {id: 'scgl-01', name: '生产合同管理', unused: true},
            {
              id: 'scgl-02',
              name: '生产订单管理',
              children: [
                {id: 'scgl-02-01', name: '订单接收', url: './produce.html#/orderReception'},
                {id: 'scgl-02-02', name: '生产订单管理', url: './produce.html#/produceOrder'}
              ]
            },
            {
              id: 'scgl-03',
              name: '分条计划管理',
              children: [
                {id: 'scgl-03-07', name: '分条挂单', url: './produce.html#/slittingPutTemple'},
                {id: 'scgl-03-05', name: '分条计划编制', url: './produce.html#/slittingPlan'},
                {id: 'scgl-03-04', name: '分条脱单', url: './produce.html#/slittingStrip'},
                {id: 'scgl-03-11', name: '挂单历史', url: './produce.html#/slittingActived'}
              ]
            },
            {
              id: 'scgl-04',
              name: '包装计划编制',
              unused: true
              // children: [
              //   { id: 'scgl-04-07', name: '包装计划编制', url: 'produce-plan-packagePlan' }
              // ]
            }
          ]
        },
        {
          id: 'cjmes',
          name: '车间MES',
          icon: 'xs-icons-menu6',
          children: [
            {id: 'cjmes-01', name: '作业指示管理', unused: true},
            {
              id: 'cjmes-02',
              name: '作业实绩管理',
              children: [
                {id: 'cjmes-02-01', name: '4mm分条机作业管理', url: './workshop.html#/slitting'}
              ]
            },
            {
              id: 'cjmes-09',
              name: '交接班管理',
              children: [
                {id: 'cjmes-09-01', name: '4mm分条机交接班管理', url: './workshop.html#/changeShift'}
              ]
            },
            {
              id: 'cjmes-03',
              name: '生产监视',
              children: [
                {id: 'cjmes-03-01', name: '4mm分条机生产监视', url: './workshop.html#/monitor'}
              ]
            },
            {id: 'cjmes-04', name: '工器具管理', unused: true},
            {id: 'cjmes-05', name: '工序消耗管理', unused: true}
          ]
        },
        {
          id: 'wlgl',
          name: '物流管理',
          icon: 'xs-icons-menu7',
          children: [
            {
              id: 'wlgl-00',
              name: '基础信息配置',
              children: [
                {id: 'wlgl-00-01', name: '垛位配置', url: './logistics.html#/logisticsMain/logistics-dwconfig'}
              ]
            },
            {
              id: 'wlgl-07',
              marginTop: '-50px',
              name: '报表查询',
              children: [
                {id: 'wlgl-07-01', name: '原料库收发存报表', url: './logistics.html#/logisticsMain/logistics-recMovSearch#500201'},
                {id: 'wlgl-07-02', name: '在制库收发存报表', url: './logistics.html#/logisticsMain/logistics-recMovSearch#500202'},
                {id: 'wlgl-07-03', name: '成品库收发存报表', url: './logistics.html#/logisticsMain/logistics-recMovSearch#500203'},
                {id: 'wlgl-07-04', name: '原料库入库查询', url: './logistics.html#/logisticsMain/logistics-instorage#500201'},
                {id: 'wlgl-07-05', name: '在制库入库查询', url: './logistics.html#/logisticsMain/logistics-instorage#500202'},
                {id: 'wlgl-07-06', name: '成品库入库查询', url: './logistics.html#/logisticsMain/logistics-instorage#500203'},
                {id: 'wlgl-07-07', name: '原料库出库查询', url: './logistics.html#/logisticsMain/logistics-outStorage#500201'},
                {id: 'wlgl-07-08', name: '在制库出库查询', url: './logistics.html#/logisticsMain/logistics-outStorage#500202'},
                {id: 'wlgl-07-09', name: '成品库出库查询', url: './logistics.html#/logisticsMain/logistics-outStorage#500203'},
                {id: 'wlgl-07-10', name: '原料库库存查询', url: './logistics.html#/logisticsMain/logistics-querystorage#500201'},
                {id: 'wlgl-07-11', name: '在制库库存查询', url: './logistics.html#/logisticsMain/logistics-querystorage#500202'},
                {id: 'wlgl-07-12', name: '成品库库存查询', url: './logistics.html#/logisticsMain/logistics-querystorage#500203'}
              ]
            },
            {
              id: 'wlgl-01',
              name: '原料库管理',
              marginTop: '-50px',
              children: [
                {id: 'wlgl-01-00', name: '接收入库管理维护', url: './logistics.html#/logisticsMain/logistics-receiveMagMaint#500201'},
                {id: 'wlgl-01-01', name: '接收入库管理', url: './logistics.html#/logisticsMain/logistics-receiveMag#500201'},
                {id: 'wlgl-01-02', name: '外购入库管理', url: './logistics.html#/logisticsMain/logistics-outSource#500201'},
                // {id: 'wlgl-01-03', name: '出库查询', url: './logistics.html#/logisticsMain/logistics-outStorage'},
                {id: 'wlgl-01-04', name: '倒垛管理', url: './logistics.html#/logisticsMain/logistics-restorage#500201'},
                // {id: 'wlgl-01-05', name: '库存查询', url: './logistics.html#/logisticsMain/logistics-querystorage'},
                {id: 'wlgl-01-06', name: '盘库管理', url: './logistics.html#/logisticsMain/logistics-panku#500201'},
                // {id: 'wlgl-01-07', name: '入库查询', url: './logistics.html#/logisticsMain/logistics-instorage'},
                {id: 'wlgl-01-08', name: '入库管理', url: './logistics.html#/logisticsMain/logistics-instomag#500201'},
                {id: 'wlgl-01-09', name: '调拨装车', url: './logistics.html#/logisticsMain/logistics-allocateLoadCar#500201'},
                {id: 'wlgl-01-10', name: '移送管理', url: './logistics.html#/logisticsMain/logistics-moveMag#500201'},
                {id: 'wlgl-01-11', name: '移送接收管理', url: './logistics.html#/logisticsMain/logistics-recMovMag#500201'}
              ]
            },
            {
              id: 'wlgl-02',
              name: '在制成品库',
              marginTop: '-50px',
              children: [
                // {id: 'wlgl-02-03', name: '出库查询', url: './logistics.html#/logisticsMain/logistics-outStorage'},
                {id: 'wlgl-02-04', name: '倒垛管理', url: './logistics.html#/logisticsMain/logistics-restorage#500202'},
                // {id: 'wlgl-02-05', name: '库存查询', url: './logistics.html#/logisticsMain/logistics-querystorage'},
                {id: 'wlgl-02-06', name: '盘库管理', url: './logistics.html#/logisticsMain/logistics-panku#500202'},
                // {id: 'wlgl-02-07', name: '入库查询', url: './logistics.html#/logisticsMain/logistics-instorage'},
                {id: 'wlgl-02-08', name: '入库管理', url: './logistics.html#/logisticsMain/logistics-instomag#500202'},
                {id: 'wlgl-02-09', name: '调拨装车', url: './logistics.html#/logisticsMain/logistics-allocateLoadCar#500202'},
                {id: 'wlgl-02-10', name: '移送管理', url: './logistics.html#/logisticsMain/logistics-moveMag#500202'},
                {id: 'wlgl-02-11', name: '移送接收管理', url: './logistics.html#/logisticsMain/logistics-recMovMag#500202'}
              ]
            },
            {
              id: 'wlgl-03',
              name: '成品库管理',
              // childrenPlacement: 'reverse',
              marginTop: '-150px',
              children: [
                {id: 'wlgl-03-02', name: '调拨单管理', url: './logistics.html#/logisticsMain/logistics-allocate#500203'},
                // {id: 'wlgl-03-03', name: '出库查询', url: './logistics.html#/logisticsMain/logistics-outStorage'},
                {id: 'wlgl-03-04', name: '倒垛管理', url: './logistics.html#/logisticsMain/logistics-restorage#500203'},
                // {id: 'wlgl-03-05', name: '库存查询', url: './logistics.html#/logisticsMain/logistics-querystorage#500203'},
                {id: 'wlgl-03-06', name: '盘库管理', url: './logistics.html#/logisticsMain/logistics-panku#500203'},
                // {id: 'wlgl-03-07', name: '入库查询', url: './logistics.html#/logisticsMain/logistics-instorage'},
                {id: 'wlgl-03-08', name: '入库管理', url: './logistics.html#/logisticsMain/logistics-instomag#500203'},
                {id: 'wlgl-03-09', name: '调拨装车', url: './logistics.html#/logisticsMain/logistics-allocateLoadCar#500203'},
                {id: 'wlgl-03-10', name: '移送管理', url: './logistics.html#/logisticsMain/logistics-moveMag#500203'},
                {id: 'wlgl-03-11', name: '移送接收管理', url: './logistics.html#/logisticsMain/logistics-recMovMag#500203'}
                // {id: 'wlgl-03-12', name: '收发存数据', url: './logistics.html#/logisticsMain/logistics-recMovSearch'}
              ]
            },
            {
              id: 'wlgl-04',
              name: '客户库管理',
              marginTop: '-150px',
              children: [
                // {id: 'wlgl-04-03', name: '出库查询', url: './logistics.html#/logisticsMain/logistics-outStorage'},
                {id: 'wlgl-04-04', name: '倒垛管理', url: './logistics.html#/logisticsMain/logistics-restorage#500204'},
                // {id: 'wlgl-04-05', name: '库存查询', url: './logistics.html#/logisticsMain/logistics-querystorage'},
                {id: 'wlgl-04-06', name: '盘库管理', url: './logistics.html#/logisticsMain/logistics-panku#500204'},
                // {id: 'wlgl-04-07', name: '入库查询', url: './logistics.html#/logisticsMain/logistics-instorage'},
                {id: 'wlgl-04-08', name: '入库管理', url: './logistics.html#/logisticsMain/logistics-instomag#500204'},
                {id: 'wlgl-04-10', name: '移送管理', url: './logistics.html#/logisticsMain/logistics-moveMag#500204'},
                {id: 'wlgl-04-11', name: '移送接收管理', url: './logistics.html#/logisticsMain/logistics-recMovMag#500204'}
              ]
            },
            {
              id: 'wlgl-05',
              name: '销售物流管理',
              children: [
                {id: 'wlgl-05-01', name: '提货单管理', url: './logistics.html#/logisticsMain/logistics-deliveryOrder#500203'},
                // {id: 'wlgl-05-02', name: '理货单管理', url: './logistics.html#/logisticsMain/logistics-tallying'},
                {id: 'wlgl-05-03', name: '装车管理', url: './logistics.html#/logisticsMain/logistics-loading#500203'},
                {id: 'wlgl-05-04', name: '出厂管理', url: './logistics.html#/logisticsMain/logistics-outMag#500203'},
                {
                  id: 'wlgl-05-05',
                  name: 'AB跨库存报表',
                  children: [
                    {id: 'wlgl-05-05-01', name: '（AB跨）发运计划日报表汇总', url: './logistics.html#/logisticsMain/logistics-dailySum'},
                    {id: 'wlgl-05-05-02', name: '（AB跨）成品库发运计划日报表明细', url: './logistics.html#/logisticsMain/logistics-dailyDetail'},
                    {id: 'wlgl-05-05-03', name: '（AB跨）成品库交货明细', url: './logistics.html#/logisticsMain/logistics-deliverySum'}
                  ]
                }
              ]
            },
            {
              id: 'wlgl-06',
              name: '配件资产管理',
              childrenPlacement: 'reverse',
              children: [
                {id: 'wlgl-06-00', name: '资产管理', url: './logistics.html#/logisticsMain/asset-management'},
                {id: 'wlgl-06-01', name: '耗材管理', url: './logistics.html#/logisticsMain/supplies-management'},
                {id: 'wlgl-06-02', name: '备品清单', url: './logistics.html#/logisticsMain/spare-List'},
                {id: 'wlgl-06-03', name: '资产模板', url: './logistics.html#/logisticsMain/asset_demo'}
              ]
            }
          ]
        },
        {
          id: 'jcgl',
          name: '进程管理',
          // childrenPlacement: 'left',
          icon: 'xs-icons-menu8',
          children: [
            {
              id: 'jcgl-01',
              name: '订单进程管理',
              children: [
                {id: 'jcgl-01-00', name: '生产订单进程', url: './process.html#/production'}
              ]
            },
            {
              id: 'jcgl-02',
              name: '物料进程管理',
              children: [
                {id: 'jcgl-02-00', name: '物料进程跟踪', url: './process.html#/logistics-materialProcessTrace'}
              ]
            }
          ]
        },
        {
          id: 'cbgl',
          name: '成本管理',
          icon: 'xs-icons-menu9',
          // childrenPlacement: 'left',
          children: [
            {id: 'cbgl-01', name: '业务数据管理', unused: true},
            {id: 'cbgl-02', name: '成本核算', unused: true},
            {id: 'cbgl-03', name: '成本报表', unused: true}
          ]
        },
        {
          id: 'scbbgl',
          name: '报表管理',
          icon: 'xs-icons-menu12',
          childrenPlacement: 'reverse',
          children: [
            {
              id: 'scbbgl-01',
              name: '销售报表',
              children: [
                // {id: 'scbbgl-01-01', name: '用户协议完成情况表', url: './reportform.html#/userAgree'},
                {id: 'scbbgl-01-01', name: '用户协议完成情况表', unused: true},
                {id: 'scbbgl-01-02', name: '品种完成情况表', unused: true}
              ]
            },
            {
              id: 'scbbgl-02',
              name: '生产报表',
              children: [
                {id: 'scbbgl-02-01', name: '分条产量报表', url: './reportform.html#/strip'},
                {id: 'scbbgl-02-02', name: '各牌号分条产量报表', url: './reportform.html#/grade'},
                {id: 'scbbgl-02-03', name: '排刀占比报表', unused: true},
                // {id: 'scbbgl-02-03', name: '排刀占比报表', url: 'rowKnives'}
                {id: 'scbbgl-02-04', name: '分条机组作业时间报表', url: './reportform.html#/operationTime'},
                {id: 'scbbgl-02-05', name: '分条综合产量报表', url: './reportform.html#/partitionSynthesis'}
              ]
            }
          ]
        },
        {
          id: 'pzgl',
          name: '基础配置管理',
          icon: 'xs-icons-menu10',
          childrenPlacement: 'reverse',
          children: [
            {
              id: 'pzgl-02',
              name: '公有基础配置',
              children: [
                // {id: 'cbgl-02-00', name: '基础配置', url: 'baseData'},
                {id: 'cbgl-02-00', name: '基础配置', url: './basicconfig.html#/baseData'},
                // {id: 'cbgl-02-01', name: '单位换算', url: 'unitChange'}
                {id: 'cbgl-02-01', name: '单位换算', url: './basicconfig.html#/unitChange'}
                /* { id: 'cbgl-02-01', name: '用户管理', url: 'usersManage' },
                 { id: 'cbgl-02-02', name: '功能管理', url: 'functionMain' },
                 { id: 'cbgl-02-03', name: '权限管理', url: 'rolesManage' },
                 { id: 'cbgl-02-04', name: '组织管理', url: 'organizManage' } */
              ]
            },
            {
              id: 'pzgl-01',
              name: '销售基础配置',
              children: [
                // {id: 'cbgl-01-02', name: '行政区域', url: 'administrationArea'},
                {id: 'cbgl-01-02', name: '行政区域', url: './basicconfig.html#/administrationArea'},
                {id: 'cbgl-01-03', name: '销售区域', url: './basicconfig.html#/saleArea'},
                // {id: 'cbgl-01-03', name: '销售区域', url: 'saleArea'},
                // {id: 'cbgl-01-04', name: '长度配置', url: 'lengthConfig'},
                {id: 'cbgl-01-04', name: '长度配置', url: './basicconfig.html#/lengthConfig'},
                // {id: 'cbgl-01-05', name: '港口配置', url: 'portConfig'},
                {id: 'cbgl-01-05', name: '港口配置', url: './basicconfig.html#/portConfig'},
                // {id: 'cbgl-01-06', name: '机场配置', url: 'airPortConfig'},
                {id: 'cbgl-01-06', name: '机场配置', url: './basicconfig.html#/airPortConfig'},
                // {id: 'cbgl-01-07', name: '车站配置', url: 'stationConfig'},
                {id: 'cbgl-01-07', name: '车站配置', url: './basicconfig.html#/stationConfig'},
                // {id: 'cbgl-01-08', name: '供货单位', url: 'supplyUnitConfig'}
                {id: 'cbgl-01-08', name: '供货单位', url: './basicconfig.html#/supplyUnitConfig'}
              ]
            },
            {id: 'pzgl-03', name: '采购基础配置', unused: true},
            {id: 'pzgl-04', name: '规范基础配置', unused: true},
            {
              id: 'pzgl-05',
              name: '质量基础配置',
              children: [
                // {id: 'pzgl-05-09', name: '化学元素管理', url: 'chemical-elements'},
                {id: 'pzgl-05-09', name: '化学元素管理', url: './basicconfig.html#/chemicalElements'},
                // {id: 'pzgl-05-08', name: '材质项目管理', url: 'material'},
                {id: 'pzgl-05-08', name: '材质项目管理', url: './basicconfig.html#/material'},
                // {id: 'pzgl-05-01', name: '生产产线管理', url: 'produced-config'},
                {id: 'pzgl-05-01', name: '生产产线管理', url: './basicconfig.html#/producedConfig'},
                // {id: 'pzgl-05-02', name: '一级工序管理', url: 'first-process'},
                {id: 'pzgl-05-02', name: '一级工序管理', url: './basicconfig.html#/firstProcess'},
                // {id: 'pzgl-05-03', name: '二级工序管理', url: 'second-process'},
                {id: 'pzgl-05-03', name: '二级工序管理', url: './basicconfig.html#/secondProcess'},
                // {id: 'pzgl-05-05', name: '工序点管理', url: 'process-point'},
                {id: 'pzgl-05-05', name: '工序点管理', url: './basicconfig.html#/processPoint'},
                // {id: 'pzgl-05-04', name: '机台信息管理', url: 'machine-infor'},
                {id: 'pzgl-05-04', name: '机台信息管理', url: './basicconfig.html#/machineInfor'},
                /*
                 { id: 'pzgl-05-06',
                 name: '材质项目管理',
                 childrenPlacement: 'reverse',
                 children: [
                 { id: 'pzgl-05-06-01', name: '材质项目管理', url: 'material-project' },
                 { id: 'pzgl-05-06-02', name: '试样组管理', url: 'sample' },
                 { id: 'pzgl-05-06-03', name: '检验项基础管理', url: 'base-inspection' },
                 { id: 'pzgl-05-06-04', name: '检验项补充管理', url: 'supplement-inspection' },
                 // { id: 'pzgl-05-06-05', name: '试样组关系管理' },
                 { id: 'pzgl-05-06-06', name: '检验项关系管理', url: 'testRelatMag' },
                 { id: 'pzgl-05-06-07', name: '检验项关联管理', url: 'testReleMag' }
                 ]
                 },
                 */
                // {id: 'pzgl-05-10', name: '工艺参数项管理', url: 'process-ment'},
                {id: 'pzgl-05-10', name: '工艺参数项管理', url: './basicconfig.html#/processMent'},
                // {id: 'pzgl-05-07', name: '附加项信息管理', url: 'addAsk'},
                {id: 'pzgl-05-07', name: '附加项信息管理', url: './basicconfig.html#/addAsk2'},
                // {id: 'pzgl-05-12', name: '产能井信息管理', url: 'well'},
                {id: 'pzgl-05-12', name: '产能井信息管理', url: './basicconfig.html#/well'},
                // {id: 'pzgl-05-11', name: '取样基础信息', url: 'sampling-requirements'},
                {id: 'pzgl-05-11', name: '取样基础信息', url: './basicconfig.html#/samplingRequirements'}
                // {id: 'pzgl-05-12', name: '试样组关系管理', url: 'relation-manage'}
                // {id: 'pzgl-05-11', name: '复合元素系数', url: 'composite-element'}
              ]
            },
            {id: 'pzgl-06', name: '生产基础配置', unused: true},
            { id: 'pzgl-07',
              name: '车间基础配置',
              // unused: true
              children: [
                { id: 'pzgl-07-01',
                  name: '交接班管理',
                  children: [
                    {id: 'pzgl-07-01-01', name: '操作岗位信息', url: './basicconfig.html#/operationPost'},
                    {id: 'pzgl-07-01-02', name: '作业人员信息', url: './basicconfig.html#/operators'},
                    {id: 'pzgl-07-01-03', name: '点检项目信息', url: './basicconfig.html#/spotInspection'},
                    {id: 'pzgl-07-01-04', name: '消耗项目信息', url: './basicconfig.html#/consumeItem'},
                    {id: 'pzgl-07-01-05', name: '操作岗位配置', url: './basicconfig.html#/config'},
                    {id: 'pzgl-07-01-06', name: '点检项目配置', url: './basicconfig.html#/spotcheckConfiguration'},
                    {id: 'pzgl-07-01-07', name: '消耗项目配置', url: './basicconfig.html#/onsumptionConfiguration'}
                  ]
                }
              ]
            },
            {id: 'pzgl-08', name: '物流基础配置', unused: true},
            {id: 'pzgl-09', name: '进程基础配置', unused: true},
            {id: 'pzgl-10', name: '成本基础配置', unused: true}
          ]
        },
        {
          id: 'xtpzgl',
          name: '系统配置管理',
          icon: 'xs-icons-menu11',
          childrenPlacement: 'reverse',
          children: [
            {id: 'xtpzgl-02-01', name: '用户管理', url: './system.html#/usersManage'},
            {id: 'xtpzgl-02-05', name: '用户登录记录', url: './system.html#/userLoginlog'},
            {id: 'xtpzgl-02-02', name: '功能管理', url: './system.html#/functionMain'},
            {id: 'xtpzgl-02-03', name: '权限管理', url: './system.html#/rolesManage'},
            {id: 'xtpzgl-02-04', name: '组织管理', url: './system.html#/organizManage'}
          ]
        }
      ],
      sedArray: [],
      currentList: [],
      pwdForm: {
        oldPwd: '',
        newPwd: '',
        newPwdCheck: ''
      },
      rulePwdForm: {
        oldPwd: [
          {required: true, message: '原密码不能为空', trigger: 'blur'}
        ],
        newPwd: [
          {required: true, message: '新密码不能为空', trigger: 'blur'},
          {type: 'string', max: 64, message: '密码不能多于64个字符', trigger: 'blur'},
          {validator: validatePass, trigger: 'blur'}
        ],
        newPwdCheck: [
          {required: true, message: '确认密码不能为空', trigger: 'blur'},
          {type: 'string', max: 64, message: '密码不能多于64个字符', trigger: 'blur'},
          {validator: validatePassCheck, trigger: 'blur'}
        ]
      }
    }
  },
  computed: {
    pageBreadcrumb: function () {
      return this.$store.state.breadcrumb;
    }
  },
  watch: {
    photoTemp () {
      if (this.photoTemp) {
        this.photoSubmitDisable = false;
      } else {
        this.photoSubmitDisable = true;
      }
    },
    pageBreadcrumb (ov, nv) {
      this.sedArray = ov;
    },
    sedArray () {
      if (this.sedArray) {
        let ol1 = null, ol2 = null, ol3 = null, o14 = null, aRet = [];
        if (this.sedArray.length > 0) {
          ol1 = this.getMenuById(this.sedArray[0], this.menuData);
        }
        if (ol1) {
          if (this.sedArray.length > 1) {
            ol2 = this.getMenuById(this.sedArray[1], ol1.children);
          }
          aRet.push(Object.assign({}, ol1, {children: null}));
        }
        if (ol2) {
          if (this.sedArray.length > 2) {
            ol3 = this.getMenuById(this.sedArray[2], ol2.children);
          }
          aRet.push(Object.assign({}, ol2, {children: null}));
        }
        if (ol3) {
          if (this.sedArray.length > 2) {
            o14 = this.getMenuById(this.sedArray[3], ol3.children);
          }
          aRet.push(Object.assign({}, ol3, {children: null}));
        }
        if (o14) {
          aRet.push(Object.assign({}, o14, {children: null}));
        }
        this.currentList = aRet;
        if (aRet && aRet.length > 0) {
          $('title').text(aRet[aRet.length - 1].name + ' - 产供销管理信息系统');
        }
      }
    }
  },
  mounted () {
    this.sedArray = this.sedArray.concat([]);
    this.queryDetail(getCookie(cookieUserId));
  },
  methods: {
    getPic (e) {
      var file = e.target.files[0];
      var type = file.type.split('/')[0];
      if (type !== 'image') {
        this.$message({
          message: '请上传图片',
          type: 'warning'
        });
        return;
      }
      var size = Math.floor(file.size / 1024 / 1024);
      if (size > 2) {
        this.$message({
          message: '图片不能超过2M',
          type: 'warning'
        });
        return;
      }
      ;
      var reader = new FileReader();
      reader.readAsDataURL(file);
      reader.onprogress = function (e) {
        var p = '已完成：' + Math.round(e.loaded / e.total * 100) + '%';
        $('.main-file_upload').find('.progress').html(p);
      };
      reader.onloadend = function (e) {
        var dataURL = reader.result;
        setImage(dataURL, 100, 100)
      };
    },
    getPicClick () {
      var ie = navigator.appName === 'Microsoft Internet Explorer' ? 1 : 0;
      if (ie === 1) {
        document.getElementById('mainInputFile').click();
      } else {
        var a = document.createEvent('MouseEvents'); // FF的处理
        a.initEvent('click', true, true);
        document.getElementById('mainInputFile').dispatchEvent(a);
      }
    },
    noGetPicData () {
      if (this.loginUser.image) {
        $('.main-img_box img').attr('src', this.loginUser.image)
      } else {
        let imgUrl = "<div style='position: relative;top: -20px; height: 90px'> <img src='../../static/img/photo-default.png' style='position: relative;top: 20px;'></img> </div>"
        $('.main-img_holder').html(imgUrl);
      }
      this.photoModal = false
    },
    getPicData () {
      let _this = this;
      let logo = $('.main-img_box img').attr('src');
      if (logo !== null && logo !== '' && typeof logo !== 'undefined') {
        logo = logo.replace(/data:image\/png;base64,/g, '');
      }
      let oUser = Object.assign({}, _this.loginUser, {
        image: logo
      });
      _this.axios.post('/core/auth/user/updateWeb',
        [oUser]
      ).then(function (res) {
        if (res) {
          _this.loginUser.image = oUser.image;
          _this.$message.success('修改成功');
          _this.photoModal = false;
        }
      }).catch(function () {
      });
    },
    pwdSubmit (name) {
      let _this = this;
      _this.$refs[name].validate((valid) => {
        if (valid) {
          // this.$message.success('提交成功!');
          _this.axios.post('/core/auth/user/resetPasswordWeb',
            [{
              memo1: _this.loginUser.id,
              memo2: _this.pwdForm.oldPwd,
              memo3: _this.pwdForm.newPwd
            }]
          ).then(function (response) {
            if (response) {
              if (response.data && (response.data.state === 200 || response.data.state === '200')) {
                _this.pwdModal = false;
                _this.$message.success('密码修改成功，请重新登录');
                setCookie(cookieUserId, _this.loginUser.id, -1, '/');
                _this.$store.commit('setToken', {tokenVal: false});
                window.location.href = './index.html';
              }
            }
            _this.pwdModalLoading = false;
            setTimeout(function () {
              _this.pwdModalLoading = true;
            }, 200);
          });
        } else {
          _this.pwdModalLoading = false;
          setTimeout(function () {
            _this.pwdModalLoading = true;
          }, 200);
        }
      });
    },
    signOut () {
      let _this = this;
      _this.$msgbox({
        title: '退出提示',
        message: '确定退出登录吗？',
        showCancelButton: true,
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        beforeClose: (action, instance, done) => {
          if (action === 'confirm') {
            instance.confirmButtonLoading = true;
            instance.confirmButtonText = '执行中...';
            // ajax
            _this.axios.post('/core/home/exit', []).then(function (res) {
              if (res) {
                setCookie(cookieUserId, _this.loginUser.id, -1, '/');
                _this.$store.commit('setToken', {tokenVal: false});
                // _this.$router.push({name: 'login'});
                // window.location.href = _this.$store.state.ctx + '../index/index.html';
              }
              instance.confirmButtonText = '确定';
              instance.confirmButtonLoading = false;
              done();
              window.location.href = './index.html';
            }).catch(function () {
              instance.confirmButtonText = '确定';
              instance.confirmButtonLoading = false;
              done();
            });
          } else {
            done();
          }
        }
      }).then(action => {
      });
    },
    showPersonInfo () {
      this.queryDetail2(getCookie(cookieUserId));
    },
    modifyUserName (username) {
      this.loginUser.username = username;
    },
    queryDetail (id) {
      let _this = this;
      _this.axios.post('/core/auth/user/findUserById',
        [id]
      ).then(function (response) {
        if (response) {
          _this.loginUser = response.data;
        }
      })
    },
    queryDetail2 (id) {
      let _this = this;
      _this.axios.post('/core/auth/user/findUserById',
        [id]
      ).then(function (response) {
        if (response) {
          _this.loginUser2 = response.data;
          $('#headerPersonInfo').slider('show');
        }
      })
    },
    changeMenuType () {
      if (this.menuType === '2') {
        this.menuType = '1';
      } else {
        this.menuType = '2';
      }
    },
    getMenuById (sid, aObj) {
      let retO = null;
      if (aObj && aObj.length > 0) {
        for (let i in aObj) {
          if (sid === aObj[i].id) {
            retO = aObj[i];
            break;
          }
        }
      }
      return retO;
    },
    routerGo (pathName, sid) {
      this.$router.push({name: pathName});
      // 物流仓库编码
      if (sid.indexOf('wlgl-01') >= 0) {
        setCookie('storageAttr', '500201') // 原料库
        this.$store.commit('setStorageattr', {storageattr: '500201'});
      } else if (sid.indexOf('wlgl-02') >= 0) {
        setCookie('storageAttr', '500202') // 在制品库
        this.$store.commit('setStorageattr', {storageattr: '500202'}) // 在制品库
      } else if (sid.indexOf('wlgl-03') >= 0) {
        setCookie('storageAttr', '500203') // 成品库
        this.$store.commit('setStorageattr', {storageattr: '500203'}) // 成品库
      } else if (sid.indexOf('wlgl-04') >= 0) {
        setCookie('storageAttr', '500204') // 客户库
        this.$store.commit('setStorageattr', {storageattr: '500204'}) // 客户库
      } else if (sid.indexOf('wlgl-05') >= 0) {
        setCookie('storageAttr', '500203') // 原料库
        this.$store.commit('setStorageattr', {storageattr: '500203'}) // 成品库
      } else if (sid.indexOf('wlgl-07') >= 0) {
        setCookie('storageAttr', '') // 原料库
        this.$store.commit('setStorageattr', {storageattr: ''}) // 成品库
      }
    }
  }
}
function setImage (src, w, h) {
  resizeImage(src, function (dataURL) {
    var image = '<img src="' + dataURL + '"/>';
    //  file里面存放有文件的名字(name)、格式(type)、大小(size)、上传时间(time)等等
    var imglist = '<div class="main-img_box" style="position: relative;top: -20px; height: 90px">' + image + '</div>';
    $('.main-img_holder').html(imglist);
  }, w, h);
}
function resizeImage (src, callback, w, h) {
  var canvas = document.createElement('canvas'),
    ctx = canvas.getContext('2d'),
    im = new Image();
  w = w || 0;
  h = h || 0;
  im.onload = function () {
    // 为传入缩放尺寸用原尺寸
    !w && (w = this.width);
    !h && (h = this.height);
    // 以长宽最大值作为最终生成图片的依据
    if (w !== this.width || h !== this.height) {
      var ratio;
      if (w > h) {
        ratio = this.width / w;
        h = this.height / ratio;
      } else if (w === h) {
        if (this.width > this.height) {
          ratio = this.width / w;
          h = this.height / ratio;
        } else {
          ratio = this.height / h;
          w = this.width / ratio;
        }
      } else {
        ratio = this.height / h;
        w = this.width / ratio;
      }
    }
    // 以传入的长宽作为最终生成图片的尺寸
    if (w > h) {
      var offset = (w - h) / 2;
      canvas.width = canvas.height = w;
      ctx.drawImage(im, 0, offset, w, h);
    } else if (w < h) {
      offset = (h - w) / 2;
      canvas.width = canvas.height = h;
      ctx.drawImage(im, offset, 0, w, h);
    } else {
      canvas.width = canvas.height = h;
      ctx.drawImage(im, 0, 0, w, h);
    }
    callback(canvas.toDataURL('image/png'));
  }
  im.src = src;
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .main {
    height: 100%;
  }

  .sl-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1002;
    width: 100%;
    min-width: 1150px;
    background-color: #fff;
    background-color: rgba(255, 255, 255, .9);
  }

  .sl-container {
    height: 100%;
    position: relative;
    padding-top: 60px;
    padding-left: 79px;
    /* transition: padding-left .3s ease-out; */
  }

  .sl-container2 {
    padding-left: 179px;
  }

  .sl-content-main {
    width: 100%;
    height: 100%;
    overflow: auto;
  }

  .sl-menu-main {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    width: 80px;
    height: 100%;
    padding-top: 60px;
    border-right: 1px solid #ccc;
    background-color: #fff;
    /* transition: width .25s ease-out;*/
  }

  .sl-menu-main2 {
    width: 180px;
  }

  .sl-content {
    transition: margin-left .2s linear;
  }

  .sl-header-ul {
    height: 60px;
    border-bottom: 1px solid #ccc;
    background-image: url(../assets/img/ytg_tab.png);
  }

  .sl-header-li-logo {
    float: left;
    margin-top: 13px;
    margin-left: 20px;
  }

  .sl-header-li-line {
    float: left;
    margin-top: 5px;
    height: 26px;
  }

  .sl-header-li-lgo {
    float: right;
    margin-top: 21px;
    width: 120px;
  }

  .sl-header-li-lgob {
    display: inline-block;
    padding-left: 25px;
    position: relative;
    color: white;
    height: 20px;
    line-height: 20px;
    vertical-align: middle;
  }

  .sl-header-li-lgob > .xs-icons {
    position: absolute;
    top: -8px;
    left: -18px;
  }

  .sl-menu-ops {
    font-size: 16px;
    color: #666;
    transition: transform .3s ease-out;
  }

  .sl-menu-main2 .sl-menu-ops {
    transform: rotate(180deg);
  }

  /* header menu style --> begin */
  .sl-menu {
  }

  .sl-menu-a {
    position: relative;
    display: inline-block;
    width: 100%;
    padding-left: 54px;
    -webkit-transition: color .3s;
    transition: color .3s;
    cursor: pointer;
    border-right: 2px solid #fff;
  }

  .sl-menu-tip-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .sl-menu-a-noc {
    padding-right: 2px;
  }

  .sl-menu-lit {
    opacity: 0;
    display: inline-block;
    margin-top: 4px;
    height: 36px;
    line-height: 36px;
    vertical-align: middle;
    overflow: hidden;
    transition: opacity .3s ease-out;
  }

  .sl-menu-main2 .sl-menu-lit {
    opacity: 1;
  }

  .sl-menu-main2 .sl-menu-tip-cover {
    display: none;
  }

  .sl-menu-lic {
    position: absolute;
    top: 50%;
    left: 30px;
    margin-top: -10px;
  }

  .sl-menu-ric {
    position: absolute;
    top: 50%;
    right: 4px;
    margin-top: -3px;
    font-family: element-icons !important;
    speak: none;
    font-style: normal;
    font-weight: 400;
    font-variant: normal;
    color: #999;
    text-transform: none;
    line-height: 1;
    vertical-align: baseline;
    display: inline-block;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
    -webkit-transition: transform .3s;
    transition: transform .3s;
  }

  /* .sl-menu-ric:before{
     content: "\E603";
   }*/
  .sl-menu-ricr {
    color: #999;
  }

  .sl-menu-s {
    position: absolute;
    top: -7px;
    left: 100%;
    z-index: 1004;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px #999;
    border-radius: 2px;
    background-color: #fff;
    min-width: 130px;
    padding: 10px 0;
  }

  .sl-menu-sham {
    -webkit-transform: scaleY(0);
    transform: scaleY(0);
    -webkit-transition: transform, display .4s;
    transition: transform .4s;
    -webkit-transform-origin: center top;
    transform-origin: center top;
  }

  .sl-menu-a:hover > .sl-menu-sham, .sl-menu-sa:hover > .sl-menu-sham {
    opacity: 1;
    -webkit-transform: scaleY(1);
    transform: scaleY(1);
  }

  .sl-menu-s.sl-menu-s-right {
    left: auto;
    right: 15px;
  }

  .main-upload_text_logo {
    display: block;
    text-align: center;
    position: relative;
    margin: 0px -20px;
    top: -35px;
    border-bottom: 1px solid #cccccc;
  }

  .main-file_upload {
    width: 100%;
    text-align: center;
    position: relative;
    display: inline-block;
    vertical-align: top;
  }

  .main-file_con .hide {
    width: 120px;
    position: absolute;
    height: 30px;
    left: 58px;
    margin-top: -8px;
    opacity: 0;
    filter: alpha(opacity=0);
    z-index: 22;
  }

  .main-file_con .main-file_uploader, .upload_bt {
    left: 0;
    top: -5px;
    position: relative;
    color: #fff;
    display: inline-block;
    padding: 0px 20px;
    background: #2ECC71;
    text-align: center;
    z-index: 11;
    border-radius: 15px;
    cursor: pointer;
  }

  .upload_bt {
    left: 130px;
  }

  .main-file_con .hide:hover {
    box-shadow: 1px 2px #44795b;
  }

  .main-img_holder, .m_main-img_holder {
    height: 100px;
    line-height: 70px;
  }

  .main-img_holder img, .m_main-img_holder img {
    max-width: 200px;
  }

  .main-file_btn_upload {
    margin-top: -20px;
    margin-bottom: 20px;
  }

  .sl-menu-sa {
    display: block;
    min-width: 120px;
    white-space: nowrap;
    padding: 0 20px;
    line-height: 32px;
    position: relative;
  }

  .sl-menu-a:hover {
    color: #2391e5;
    background-color: #e2f1fc;
    border-right-color: #e2f1fc;
  }

  .sl-menu-a:hover > .sl-menu-ric {
    color: #2391e5;
    -webkit-transform: rotate(180deg);
    transform: rotate(180deg);
  }

  .sl-menu-sa:hover {
    background-color: #e2f1fc;
    color: #2391e5;
  }

  .sl-menu-sa:hover > .sl-menu-ricr {
    color: #2391e5;
  }

  .sl-menu-ss {
    opacity: 0;
    position: absolute;
    left: 100%;
    top: -11px;
    z-index: 1005;
    padding: 10px 0;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px #999;
    border-radius: 2px;
    background-color: #fff;
  }

  .sl-menu-sed {
    border-right-color: #2391e5;
  }

  .sl-menu-sed, .sl-menu-ssed, .sl-menu-sssed {
    color: #2391e5;
  }

  .sl-menu-sed > .sl-menu-ricr, .sl-menu-ssed > .sl-menu-ricr, .sl-menu-sed > .sl-menu-ric {
    color: #2391e5;
  }

  .sl-menu-sdis {
    cursor: default !important;
    cursor: not-allowed !important;
    color: #999 !important;
    background-color: #fff !important;
  }

  .sl-menu-reverse > .sl-menu-s, .sl-menu-reverse > .sl-menu-ss {
    top: auto;
    bottom: -11px;
    -webkit-transform-origin: center bottom;
    transform-origin: center bottom;
  }

  /* header menu style --> end */
  .sl-breadcrumb {
    overflow: hidden;
    background-color: #fff;
    height: 30px;
    padding: 7px 0 0 20px;
  }

  .sl-header-li-lgbc {
    float: right;
    padding-right: 202px;
    padding-top: 23px;
    padding-left: 50px;
  }

  .sl-breadcrumb-text {
    float: left;
    color: white;
  }

  .sl-breadcrumb-list {
    float: left;
    padding-left: 10px;
    font-size: 12px;
    position: relative;
    top: 3px;
  }

  .sl-footer {
    padding: 20px 0 0px;
  }

  .sl-footer > p {
    text-align: center;
    height: 20px;
    line-height: 20px;
    vertical-align: middle;
  }

  .am-xz {
    float: left;
    margin-right: 7px;
    margin-top: 2px;
    animation: amXuanzhuan 4s linear infinite;
  }

  @keyframes amXuanzhuan {
    0% {
      transform: rotate3d(1, 0, 0, 360deg);
    }
    100% {
      transform: rotate3d(1, 0, 0, 0);
    }
  }

  .oa-header-photo-uld {
    width: 200px;
    height: 200px;
    line-height: 200px;
    vertical-align: middle;
    margin: 0 auto;
    overflow: hidden;
    cursor: pointer;
  }

  .oa-header-photo-uld > img {
    max-width: 100%;
    max-height: 100%;
    vertical-align: middle;
  }

  /*.oa-header-content {*/
  /*background: url("../../static/img/top_bgimg.png") left center no-repeat rgb(60,207,255);*/
  /*height: 60px;*/
  /*}*/

  .oa-header-logo {
    float: left;
    padding: 15px 0 0 30px;
    height: 50px;
    overflow: hidden;
  }

  .oa-header-logo > img {
    animation: fadeInLeft .5s ease-out 0s both;
  }

  .oa-header-user {
    float: right;
    position: relative;
    height: 100%;
    width: 100px;
    right: 140px;
  }

  .oa-header-upt {
    position: absolute;
    right: 0;
    top: 0;
    width: 100px;
    height: 60px;
    overflow: hidden;
    text-align: center;
  }

  .oa-header-upt > a {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin-top: 10px;
    animation: fadeInRight .5s ease-out 0s both;
  }

  .oa-header-upt > a > img {
    width: 40px;
    height: 40px;
    line-height: 40px;
    vertical-align: middle;
    color: #333;
    border-radius: 20px;
    box-shadow: 0 0 10px #333;
  }

  .oa-header-user:hover .oa-header-upt > a > img {
    animation: circle 4s linear 0s infinite;
  }

  .oa-header-ucon {
    display: none;
    overflow: hidden;
    position: absolute;
    top: 50px;
    left: -8px;
    z-index: 18000;
    padding: 10px 0 10px 10px;
  }

  .oa-header-ulist {
    position: relative;
    width: 180px;
    border: 1px solid #ddd;
    box-shadow: 0 0 8px #999;
    background-color: #fff;
    background-color: rgba(255, 255, 255, .95);
  }

  .oa-header-user:hover .oa-header-ucon {
    display: block;
  }

  .oa-header-user:hover .oa-header-ulist {
    animation: fadeInRight .4s ease-out 0s both;
  }

  .oa-header-uin {
    text-align: center;
    overflow: hidden;
    padding: 20px 0 15px 0;
  }

  .oa-header-uin > img {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    cursor: pointer;
  }

  .oa-header-uin > img:hover {
    animation: largen2 .6s ease-out 0s both;
  }

  .oa-header-uin > h3 {
    padding-top: 10px;
    color: #666;
  }

  .oa-header-uul {
    padding-bottom: 10px;
  }

  .oa-header-uul > li {
    height: 40px;
    line-height: 40px;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color .3s linear 0s;
  }

  .oa-header-uul .st-icons {
    position: relative;
    top: 6px;
    margin-right: 8px;
    transition: all .3s linear;
  }

  .st-icons-out {
    margin-right: 4px;
  }

  .oa-header-uul > li:hover {
    background-color: #ebebeb;
  }

  .oa-header-uul::before, .oa-header-uul::after {
    border-bottom-color: rgba(0, 0, 0, 0.2);
    content: "";
    display: inline-block;
    position: absolute;
  }

  .oa-header-uul::after {
    left: 41px;
    top: -6px;
    border-bottom: 6px solid #fff;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
  }

  .oa-header-uul::before {
    left: 40px;
    top: -7px;
    border-bottom: 7px solid #ccc;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
  }

  .hnstLogo {
    position: absolute;
    right: 20px;
    top: 14px;
  }

  .hnstLogo > img {
    height: 32px;
  }
</style>
