<style scoped>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }

  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }

  .appmenumanage .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 50px;
    text-align: center;
  }

  .avatar {
    width: 50px;
    height: 50px;
    display: block;
  }
  table.companyalipay {
           font-family: verdana,arial,sans-serif;
          font-size:11px;
          color:#333333;
          border: 1px solid #DCDFE6;
          border-collapse: collapse;
      }

      table.companyalipay th {
          border: 1px solid #ccc;
          padding: 8px;
          background-color: #dedede ;
      }
      table.companyalipay td {
          border: 1px solid #DCDFE6;
          padding: 8px;
          background-color: #ffffff;
          text-align:center;
     }
     .aliClass ._addUpload_box {
    display: initial;
    margin-top: 20px;
    width: 138px !important;
  }

  .aliClass ._addUpload_box>div {
    float: left;
    width: 100px;
    height: 92px;

    border-radius: 2px;
    cursor: pointer;
    padding: 5px;
    margin: 0 10px 10px 0;
    position: relative;
  }

  .aliClass ._addUpload_box .icon-guanbi1 {
    font-size: 12px;
    color: white;
    display: inline-block;
    margin-left: 15px;
    position: absolute;
    right: -6px;
    top: -9px;
    background-color: #f56c6c;
    border-radius: 50%;
    height: 20px;
    width: 20px;
    text-align: center;
    line-height: 20px;
  }

  .aliClass ._addUpload_box .icon-guanbi1:hover {
    font-size: 12px;
    color: #c94052;
  }

  /deep/.aliClass ._pic_upload .el-upload-dragger {
    width: 100px !important;
    height: 50px !important;
  }
  .TB-Title {
    float: left;
    position: relative;
    top: 10px;
  }
    .TB_comtitle {
    color: #333333;
    padding-left: 10px;
    height: 14px;
    line-height: 14px;
    font-size: 14px;
    border-left: 3px solid #e95252;
    margin-bottom: 20px;
  }
  .TeamBalancePayment .TB_PrintDiv {
    height: 40px;
    margin-top:20px;
  }
  .TeamAddBtn {
    float: right;
    margin-bottom: 10px;
  }
</style>
<template>
  <div class="flexOne appmenumanage" width="95%">
    <div class="TB_comtitle TB-Title">{{$t('objFill.v101.LeaderManagement.yuangedfpxx')}}</div>
    <table  class="companyalipay" style="width:100%;">
      <tr style="width:100%;">
        <th style="width:10%;">{{$t('objFill.v101.LeaderManagement.zhidumc')}}</th>
        <th style="width:10%;">制度描述</th>
        <th style="width:10%;">{{$t('objFill.v101.LeaderManagement.zhiduzt')}}</th>
        <th style="width:10%;">{{$t('objFill.v101.LeaderManagement.zhidyxqi')}}</th>
        <th style="width:10%;">{{$t('system.table_staffs')}}</th>
       <th  style="width:10%;" v-if="IsEdit==1&&DataList.IsEndTCID==0">{{$t('system.table_operation')}}</th>          
       </tr>
       <tr >
        <td>{{DataList.InstitutionName}}</td>
        <td>  {{DataList.InstitutionDesc}}  </td>
        <td>  {{DataList.Effective==1?$t('fnc.qiyong'):$t('fnc.tingyong')}}</td>
        <td> {{DataList.EffectiveStartDate}}-{{DataList.EffectiveEndDate}} </td>
        <td> {{DataList.EmployeeName}} </td>           
        <td v-if="IsEdit==1&&DataList.IsEndTCID==0">
           <el-tooltip class="item" effect="dark" :content="$t('objFill.v101.LeaderManagement.xiugaizhid')" placement="top-start">
               <el-button @click="AddMsgBaseInfo(DataList)" type="primary"  icon="el-icon-edit" circle></el-button>
              </el-tooltip>
               <el-tooltip class="item" effect="dark" :content="$t('objFill.v101.LeaderManagement.xiugaiyuang')" placement="top-start">
                 <el-button @click="EditEmployee()" type="primary"   icon="el-icon-user" circle></el-button>
               </el-tooltip>
         </td>            
      </tr>        
    </table>    
    <div class="TB_comtitle TB-Title">{{$t('objFill.v101.LeaderManagement.yuangedfpxx')}}</div>
          
            <table  class="companyalipay" style="width:100%;">
                <tr style="width:100%;">
                    <th style="width:10%;">{{$t('system.table_staffs')}}</th>
                    <th style="width:10%;">{{$t('objFill.v101.LeaderManagement.edudwy')}}</th>
                    <th style="width:10%;">{{$t('objFill.v101.LeaderManagement.keyeddwy')}}</th>
                    <th style="width:10%;">{{$t('objFill.v101.LeaderManagement.yiyjedwy')}}</th>
                    <th style="width:10%;">{{$t('objFill.v101.LeaderManagement.suodjwdwy')}}</th>
                    <th style="width:5%;">{{$t('objFill.v101.LeaderManagement.shifkyzz')}}</th>
                    <th  style="width:20%;">{{$t('objFill.v101.LeaderManagement.eduyxsj')}}</th>
                    <th  style="width:10%;" v-if="IsEdit==1&&DataList.IsEndTCID==0">{{$t('system.table_operation')}}</th>
                </tr>
                <template v-if="DataList.QuotaList&&DataList.QuotaList.length>0">
                <tr  v-for="(item,index) in DataList.QuotaList" :key="index">
                    <td>{{item.EmployeeName}}</td>
                    <td>
                      <template v-if="item.Id&&item.Id>0"> {{item.QuotaValue}}</template>
                     </td>
                     <td>
                      <template v-if="item.Id&&item.Id>0"> {{item.QuotaAvailable}}</template>
                     </td>
                     <td>
                      <template v-if="item.Id&&item.Id>0"> {{item.QuotaUsed}}</template>
                     </td>
                     <td>
                      <template v-if="item.Id&&item.Id>0"> {{item.QuotaLocked}}</template>
                     </td>
                    <td>
                      <template v-if="item.Id&&item.Id>0"> {{item.ShareMode==0?$t('pub.no'):''}}</template>
                    </td>
                    <td>
                      <template v-if="item.Id&&item.Id>0">  {{item.EffectiveStartDate}}-{{item.EffectiveEndDate}}</template>
                    </td>
                    <td v-if="IsEdit==1&&DataList.IsEndTCID==0">
                      <template v-if="item.Id&&item.Id>0">
                        <el-tooltip class="item" effect="dark" :content="$t('pub.updateMsg')" placement="top-start">
                           <el-button @click="AddQuota(item)" type="primary"  icon="el-icon-edit" circle></el-button>
                        </el-tooltip>
                      </template>
                     <template v-else>
                        <el-tooltip class="item" effect="dark" :content="$t('pub.addBtn')" placement="top-start">
                          <el-button @click="AddNewMsgQuota(item)" type="primary"   icon="el-icon-edit" circle></el-button>
                        </el-tooltip>
                      </template>
                    </td>
                </tr>
              </template>
            </table>
     
        <div class="TB_comtitle TB-Title">{{$t('hotel.hotel_Order')}}</div>
        
            <table  class="companyalipay" style="width:100%;">
           
                <tr style="width:100%;">
                    <th style="width:10%;">{{$t('fnc.danhao')}}</th>
                    <th style="width:10%;">单据流程</th>
                    <th style="width:10%;">{{$t('salesModule.CostType')}}</th>
                    <th  style="width:10%;" >{{$t('fnc.fkduixiang')}}</th>
                    <th style="width:10%;">{{$t('tips.jiaoyifangshi')}}</th>
                    <th style="width:10%;">{{$t('fnc.jine')}}</th>
                    <th style="width:10%;">{{$t('fnc.jiaoyiriqi')}}</th>
                    <th style="width:5%;">{{$t('fnc.zdrenyuan')}}</th>
                    <th  style="width:20%;">{{$t('fnc.shzhuangtai')}}</th>
                    <th  style="width:10%;" >当前审核人</th>
                </tr>
                <template v-if="DataList.FinanceList&&DataList.FinanceList.length>0">
                <tr  v-for="(item,index) in DataList.FinanceList" :key="index">
                    <td> <span style="text-decoration: underline; cursor: pointer;" @click="goUrlDetail('FinancialDocumentsDetail',item)"> {{item.FrID}}</span>  </td>
                   <td>{{item.FinanceName}}</td>
                    <td>   
                        <template v-for="(s,si) in item.CostTypeList">
                         <span style="background-color: rgba(64,158,255,.1);display: inline-block;padding: 0 5px;height: 22px;line-height: 20px;font-size: 12px;color: #646464;border-radius: 4px;box-sizing: border-box;border: 1px solid rgba(64,158,255,.2);white-space: nowrap;margin-bottom: 4px;">{{s}}</span></br>
                         </template>  
                    </td>
                    <td>   {{item.RemitterName}} </td>
                    <td>   <div>
              <template v-if="item.TradeWayList&&item.TradeWayList.length>0">
                <div class="_TradeWayList" v-for="(tw,twIn) in item.TradeWayList"
                  style="line-height: normal !important;padding: 5px 10px;background-color: #EEEEEE;border-radius: 4px;margin: 10px 0;width:230px">
                  <p><span style="font-weight: bold;color:#333333">{{tw.Alias}}</span><span class="_bank_name"
                      style="height:20px;;display: inline-block;background-color: #333333;color: white;padding: 2px 4px;border-radius: 4px;margin-left:10px;margin-letf:10px">
                      {{item.TradeWayList[0].TypeName}}</span>
                    <span
                      style="height:20px;display: inline-block;background-color: #333333;color: white;padding: 2px 4px;border-radius: 4px;margin-left:10px;"
                      :style="{'background-color':tw.AccountType=='私'?'#2AAEF2':'#FF9C01'}">{{tw.AccountType==""?$t('fnc.no'):tw.AccountType}}</span>
                  </p>
                  <p style="color:#333333">{{tw.BankNo}}</p>
                </div>
              </template>
              <template v-else>
                <div class="_pad5">
                  {{$t('fnc.no')}}
                </div>
              </template>
            </div> </td>
                    <td>  <p style="line-height:20px">{{item.Type==1?$t('fnc.yingshou'):$t('fnc.yingfu')}}：<span>{{item.Money}}</span></p>
              <p style="line-height:20px">{{item.Type==1?$t('fnc.shishou'):$t('fnc.shifu')}}：<span>{{item.PayMoney}}</span></p> </td>
              <td>{{item.TradeDate}}</td>
                 
                    <td>   
                      <div>{{item.EmName}}</div>
                      <div>{{item.CreateDate}}</div>
            </td>
            <td>   {{item.StatusStr}} </td>
            <td>   {{item.AuditList&&item.AuditList.length>0? item.AuditList[0].EmName:""}} </td>
                </tr>
              </template>
            </table>
       
          <template v-if="DataList.ChangeNotifyList&&DataList.ChangeNotifyList.length>0">
            <div class="TeamBalancePayment">
              <div data-v-4bc4b302="" class="clearfix TB_PrintDiv">
                  <div data-v-4bc4b302="" class="TB_comtitle TB-Title">{{$t('fnc.zfxinxi')}}</div> 
                  <!--   -->
                  <el-button type="button" class="normalBtn TeamAddBtn"  @click="DJFEnd()"  :loading="jsloading"  v-if="msg.IsDiJi==1&&DataList.IsEndTCID==1&&DataList.FrIds&&DataList.FrIds.length==0">{{$t('fnc.djfjs')}}</el-button>
                  <el-button type="button" class="normalBtn TeamAddBtn"   :loading="loading" @click="GetAlipayCommerceEcConsumeDetailQuery(DataList)"  >{{$t('fnc.tbshxx')}}</el-button>
              </div>
            </div>
            <table  class="companyalipay" style="width:100%;">
             
                <tr style="width:100%;">
                    <th style="width:20%;">{{$t('OrderList.search.orderId')}}</th>
                    <th style="width:10%;">{{$t('system.payTime')}}</th>
                    <th style="width:10%;">{{$t('system.payTotalMoney')}}</th>
                    <th style="width:10%;">{{$t('system.payType')}}</th>
                    <th style="width:15%;">{{$t('system.table_staffs')}}</th>
                    <th style="width:10%;">{{$t('fnc.shxx')}}</th>
                    <template v-if="msg.IsDiJi==1&&DataList.IsEndTCID==1&&DataList.FrIds&&DataList.FrIds.length==0">   <th style="width:20%;" >{{$t('fnc.fyshuoming')}}</th></template>
                </tr>
                <tr  v-for="(item,index) in DataList.ChangeNotifyList" :key="item.pay_no">
                    <td>  {{item.pay_no}}</td>
                    <td>
                     {{item.gmt_biz_create}}
                     </td>
                     <td>
                      {{item.peer_pay_amount}}
                     </td>
                     <td>
                      {{item.consume_type=="CONSUME"?$t('fnc.fukuan'):$t('fnc.shoukuan')}}
                     </td>
                     <td>
                  {{item.employeeName}}
                     </td>
                     <td>
                  {{item.ConsumeInfo.OppositeFullName}}- {{item.ConsumeInfo.CategoryName}}
                     </td>
                     <template v-if="msg.IsDiJi==1&&DataList.IsEndTCID==1&&DataList.FrIds&&DataList.FrIds.length==0"> 
                        <td>
                          <el-select  v-model="item.CostTypeId" :placeholder="$t('pub.pleaseSel')" >
                             <el-option   v-for="costItem in DataList.CostList" :label='costItem.Name' :value='costItem.ID' :key="costItem.ID">  </el-option>
                          </el-select>
                        </td>
                      </template>
                </tr>
            </table>
            <!--  -->
          
            <template v-if="msg.IsDiJi==1&&DataList.IsEndTCID==1&&DataList.FrIds&&DataList.FrIds.length==0" >
              <div class="aliClass"> 
                <div class="_addUpload_box clearfix">
                  <template v-for="(file,fIndex) in VorcherInos">
                    <div v-if="file.Type==3">
                      <div class="iconfont " style="width:100px;height:50px;overflow: hidden;">
                        <el-image style="width:100%;height:100%;" :src="file.Url?file.Url:file.Content"
                          :preview-src-list="VorcherInosImg">
                        </el-image>
                      </div>
                      <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
                    </div>
                    <div v-if="file.Type==1" style="text-align:center;height:50px;line-height: 50px;background:#eee;">
                      <div class="iconfont "
                        :class="file.Content.substring(file.Content.lastIndexOf('.')+1,file.Content.length).toUpperCase()=='PDF'? 'icon-pdf' : 'icon-excel'"
                        @click="showUpLoadFile(file)">

                      </div>
                      <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
                    </div>
                    <div v-if="file.Type==2">
                      <div class="iconfont icon-excel" @click="showUpLoadFile(file)">

                      </div>
                      <span class="iconfont icon-guanbi1" @click="deleteUploadFile(fIndex)"></span>
                    </div>
                  </template>
                  <div class="_pic_upload" >
                    <el-upload drag :http-request="uploadFileBtn" :multiple="true" :show-file-list="false" action="">
                      <i class="el-icon-plus avatar-uploader-icon" style="font-size:14px;height:auto"></i>
                      <div class="el-upload__text">{{$t('active.ld_djscwj')}}</div>
                    </el-upload>
                  </div>
                </div>
              </div>
            </template>
            <template v-else><div style="margin-bottom:10px;"></div></template>
        </template>
    
    <el-dialog custom-class='w500' :title="$t('objFill.v101.LeaderManagement.xiugygkyed')" :visible.sync="AddMsgQuotaShow" center
               :before-close="clearMsgQuota">
      <el-form :model="AddMsgQuota" :rules="rules" ref="AddMsgQuota" label-width="120px">
       <!-- <span style="color:red;">{{$t('objFill.v101.LeaderManagement.shiygdedbnsc')}}</span> -->
        <table class="layerNoIcon">
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.xianyoued')" >
              {{AddMsgQuota.TotalPrice}}
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('system.query_type')" prop="action">
                <el-radio v-model="AddMsgQuota.Action" label="1">{{$t('objFill.v101.LeaderManagement.zenjiaed')}}</el-radio>
                     <el-radio v-model="AddMsgQuota.Action" label="2">{{$t('objFill.v101.LeaderManagement.jianshaoed')}}</el-radio>
                     <!-- <el-radio v-model="AddMsgQuota.Action" label="3">{{$t('objFill.v101.LeaderManagement.shangchued')}}</el-radio> -->
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.shifkyzz')" prop="ShareMode">
                <el-radio v-model="AddMsgQuota.ShareMode" label="0">{{$t('pub.no')}}</el-radio>
                     <el-radio v-model="AddMsgQuota.ShareMode" label="1">{{$t('pub.yes')}}</el-radio>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.edudwy')" prop="Amount">
                <el-input  type="number" v-model="AddMsgQuota.Amount"
                          :placeholder="$t('pub.pleaseImport')"></el-input>
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <button class="hollowFixedBtn" @click="clearMsgQuota()">
          {{$t('pub.cancelBtn')}}
        </button> &nbsp;
        <el-button class="normalBtn" type="primary" @click="AddQuotaModify()"  :loading="updateloading">{{$t('pub.saveBtn')}}</el-button>
      </div>
    </el-dialog>
    <el-dialog custom-class='w500' :title="$t('objFill.v101.LeaderManagement.xinzygkyed')" :visible.sync="NewMsgQuotaShow" center
               :before-close="clearNewMsgQuota">
      <el-form :model="NewMsgQuota" :rules="NewMsgRules" ref="NewMsgQuota" label-width="120px">
        <table class="layerNoIcon">
          <tr>
            <td>
              <el-form-item :label="$t('system.table_staffs')" >
              {{NewMsgQuota.EmployeeName}}
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.shifkyzz')" prop="ShareMode">
                <el-radio v-model="NewMsgQuota.ShareMode" label="0">{{$t('pub.no')}}</el-radio>
                     <el-radio v-model="NewMsgQuota.ShareMode" label="1">{{$t('pub.yes')}}</el-radio>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.edudwy')" prop="QuotaValue">
                <el-input  type="number" v-model="NewMsgQuota.QuotaValue"
                          :placeholder="$t('pub.pleaseImport')"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.eduyxq')" prop="EffectiveDateList">
              <el-date-picker value-format="yyyy-MM-dd"  v-model="NewMsgQuota.EffectiveDateList" type="daterange"  :range-separator="$t('OrderList.zhi')" :start-placeholder="$t('OrderList.star')"  :end-placeholder="$t('OrderList.end')"> </el-date-picker>
            </el-form-item>
            </td>
          </tr>
        </table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <button class="hollowFixedBtn" @click="clearNewMsgQuota()">
          {{$t('pub.cancelBtn')}}
        </button> &nbsp;
        <el-button class="normalBtn" type="primary" @click="AddNewMsgQuotaModify()" :loading="updateloading">{{$t('pub.saveBtn')}}</el-button>
      </div>
    </el-dialog>
    <el-dialog custom-class='w500' :title="dialogTitle" :visible.sync="outerVisible" center
               :before-close="clearAddMsg">
      <el-form :model="addMsg" :rules="rulesMsg" ref="addMsg" label-width="120px">
        <table class="layerNoIcon">
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.feiyzdmc')" prop="InstitutionName">
                <el-input maxlength='20' class='w200' type="text" v-model="addMsg.InstitutionName"
                          :placeholder="$t('pub.pleaseImport')"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.feikongms')" prop="MenuUrl">
                <el-input maxlength='200' class='w200' type="text" v-model="addMsg.InstitutionDesc"
                          :placeholder="$t('pub.pleaseImport')"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('objFill.v101.LeaderManagement.zhidusxrq')" prop="Sort">
                <el-date-picker value-format="yyyy-MM-dd"  v-model="addMsg.effectiveDateList" type="daterange"  :range-separator="$t('OrderList.zhi')" :start-placeholder="$t('OrderList.star')"  :end-placeholder="$t('OrderList.end')"> </el-date-picker>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item :label="$t('visa.v_shifouqiyong')">
                <el-switch v-model="addMsg.Effective" active-value="0" active-color="#ff4949" inactive-color="#13ce66" :active-text="$t('fnc.tingyong')" inactive-value="1" :inactive-text="$t('fnc.qiyong')"></el-switch>
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <button class="hollowFixedBtn" @click="clearAddMsg()">
          {{$t('pub.cancelBtn')}}
        </button> &nbsp;
        <el-button class="normalBtn" type="primary" @click="UpdateInvoiceInstitutionModify()" :loading="updateloading">{{$t('pub.saveBtn')}}</el-button>
      </div>
    </el-dialog>
    <el-dialog custom-class='w500' :title="$t('objFill.v101.LeaderManagement.xiugaiyuang')" :visible.sync="EditEmployeeShow" center  :before-close="clearEditEmployeeMsg">
       <el-form :model="EditEmployeeMsg" :rules="EditEmployeerules" ref="EditEmployeeMsg" label-width="120px">
              <table class="layerNoIcon">
                  <tr>
                    <td>
                      <el-form-item :label="$t('system.table_staffs')" prop="EmployeeIdList">
                        <el-select
                            v-model="EditEmployeeMsg.EmployeeIdList"
                            filterable
                            multiple
                            :placeholder="$t('pub.pleaseSel')" >
                            <el-option
                              v-for="item in EmployeeList"
                              :label='item.EmName'
                              :value='item.EmployeeId'
                              :key='item.EmployeeId'>
                            </el-option>
                        </el-select>
                      </el-form-item>
                  </td>
                  </tr>
                </table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <button class="hollowFixedBtn" @click="clearEditEmployeeMsg()">
          {{$t('pub.cancelBtn')}}
        </button> &nbsp;
        <el-button class="normalBtn" type="primary" @click="EditEmployeeModify()" :loading="updateloading">{{$t('pub.saveBtn')}}</el-button>
      </div>
   </el-dialog>

  </div>
</template>

<script>
  export default {
    data() {
      return {
        EmployeeList:[],
        employeeMsg:{ // 员工
                GroupId:'',
                BranchId:-1,
                DepartmentId:0,
                PostId:0,
                IsLeave:0,
            },
        DataList: '',
        VorcherInos:[],
        VorcherInosImg: [],
        picObj:[],
        loading:false,
        jsloading:false,
        updateloading:false,
        msg: {
          Id:0,
          IsDiJi:0,
        },
        AddMsgQuota:{
          Id:0,
          Action:"1",//1-增加，2-减少，3-删除
          ShareMode:0,//
          Amount:'',//新增/减少额度
          TotalPrice:0,//现有额度
        },
        AddMsgQuotaShow:false,
        rules: {
          Amount: [{
            required: true,
            message: this.$t('objFill.v101.LeaderManagement.qingsredu'),
            trigger: "blur"
          }],
          action: [ { required: true, message: this.$t('system.ph_type'), trigger: 'change' }],
        },
        NewMsgQuota:{
          Id:0,
          EmployeeId:0,
          EmployeeName:"",
          QuotaValue:0,
          ShareMode:"0",//0:不可转赠 1:可以转增
          EffectiveEndDate:"",
          EffectiveStartDate:"",
          EffectiveDateList: [],
        },
        NewMsgQuotaShow:false,
        NewMsgRules: {
          QuotaValue: [{
            required: true,
            message: this.$t('objFill.v101.LeaderManagement.qingsredu'),
            trigger: "blur"
          }],
          EffectiveDateList: [ { required: true, message: this.$t('objFill.v101.LeaderManagement.qingxuanzyxq'), trigger: 'change' }],
        },
        IsEdit:0,//=1的时候可以编辑费控信息
        outerVisible:false,
        dialogTitle: this.$t('objFill.v101.LeaderManagement.bianjifkzd'),
        addMsg:{
          InstitutionName:"",//制度名称
          Id:0,
          Effective:0,//是否启用 停用: 0   启用: 1
          InstitutionDesc:"",//费控描述
          EffectiveEndDate:"",
          EffectiveStartDate:"",
          effectiveDateList:'',
        },
        rulesMsg: {
            InstitutionName: [{
            required: true,
            message: this.$t('objFill.v101.LeaderManagement.qingsrzfmc'),
            trigger: "blur"
          }],
          effectiveDateList: [{
            required: true,
            message: this.$t('objFill.v101.LeaderManagement.qingxzfksjyxq'),
            trigger: 'blur',
          }],
        },
        EditEmployeerules: {

          EmployeeIdList: [{
            required: true,
            message: this.$t('objFill.v101.FinancialModule.qingxuanzyg'),
            trigger: 'change',
            type: 'array',
          }],
        },
        EditEmployeeMsg:{
          Id:0,
          EmployeeIds:"",
          EmployeeIdList:[],
        },
        EditEmployeeShow:false,
        pickerBeginDateBefore: {
          disabledDate: time => {
            if (this.msg.PayEndTime == null) {
              return false;
            } else {
              let endTime = new Date(this.msg.PayEndTime)
              return endTime.getTime() < time.getTime()
            }
          }
        },
        pickerBeginDateAfter: {
          disabledDate: time => {
            let startTime = new Date(this.msg.PayStartTime)
            return startTime.getTime() >= time.getTime()
          }
        },
      }
    },
    mounted() {
      if(this.$route.query.Id){
        this.msg.Id=this.$route.query.Id;
      }
      let userInfo = this.getLocalStorage();    // 读取缓存数据
        this.employeeMsg.GroupId = userInfo.RB_Group_id;
      if(this.$route.query.Type){
        this.IsEdit=this.$route.query.Type;
      }
      if(this.$route.query.IsDiJi){
        this.msg.IsDiJi=this.$route.query.IsDiJi;
      }
      this.getList();
    },
    methods: {
      getEmployee() { //员工
        this.apipost('admin_get_EmployeeGetList', this.employeeMsg, res => {
            if(res.data.resultCode == 1) {
            this.EmployeeList = res.data.data;
            }
        }, err => {})
     },
     goUrlDetail(path, rowData) {
        this.$router.push({
          path: path,
          query: {
            id: rowData.FrID,
            blank: 'y',
            tab: rowData.FrID + this.$t('objFill.documentparticulars')
          }
        })
      },
      AddQuota(obj){
        this.AddMsgQuota.ShareMode=obj.ShareMode;
        this.AddMsgQuota.Id=obj.Id;
        this.AddMsgQuota.TotalPrice=obj.QuotaValue;
        this.AddMsgQuota.Action="1";
        this.AddMsgQuota.Amount="";
        this.AddMsgQuotaShow=true;
        this.updateloading=false;
      },
      clearMsgQuota(){
        this.AddMsgQuotaShow=false;
        this.AddMsgQuota.ShareMode=0;
        this.AddMsgQuota.TotalPrice=0;
        this.AddMsgQuota.Id=0;
        this.AddMsgQuota.Amount="";
        this.AddMsgQuota.Action="1";
        this.updateloading=false;
      },
      AddNewMsgQuota(obj){
        this.NewMsgQuota.EmployeeName=obj.EmployeeName;
        this.NewMsgQuota.Id=this.DataList.Id;
        this.NewMsgQuota.EmployeeId=obj.EmployeeId;
        this.NewMsgQuota.ShareMode="0";
        this.NewMsgQuotaShow=true;
        this.NewMsgQuota.EffectiveDateList=[];
        this.NewMsgQuota.EffectiveDateList=obj.EffectiveDateList;
        this.updateloading=false;
      },
      clearNewMsgQuota(){
        this.NewMsgQuotaShow=false;
        this.NewMsgQuota.ShareMode="0";
        this.NewMsgQuota.EmployeeId=0;
        this.NewMsgQuota.Id=0;
        this.NewMsgQuota.QuotaValue="";
        this.NewMsgQuota.EmployeeName="";
        this.NewMsgQuota.EffectiveEndDate="";
        this.NewMsgQuota.EffectiveStartDate="";
        this.NewMsgQuota.EffectiveDateList=[];
        this.NewMsgQuota.ShareMode="0";
        this.updateloading=false;
      },
      EditEmployee(){
        this.getEmployee();
        this.EditEmployeeMsg.Id=this.DataList.Id;
        this.EditEmployeeMsg.EmployeeIdList=this.DataList.EmployeeIdList;
        this.EditEmployeeShow=true;
        this.updateloading=false;
      },
      clearEditEmployeeMsg(){
        this.EditEmployeeMsg.Id=0;
        this.EditEmployeeMsg.EmployeeIds="";
        this.EditEmployeeMsg.EmployeeIdList=[];
        this.EditEmployeeShow=false;
        this.updateloading=false;
      },
      EditEmployeeModify(){
        this.updateloading=true;
        if (this.EditEmployeeMsg.EmployeeIdList && this.EditEmployeeMsg.EmployeeIdList.length > 0) {
          this.EditEmployeeMsg.EmployeeIds = this.EditEmployeeMsg.EmployeeIdList.join(",");
          }
        this.apipost('alipay_post_AlipayEbppInvoiceInstitutionScopeModify', this.EditEmployeeMsg, res => {
          if (res.data.resultCode == 1) {
            this.clearNewMsgQuota();
            this.Success(res.data.message);
            this.updateloading=false;
            this.getList();
          }
          else{
                this.Error(res.data.message);
                this.updateloading=false
              }
        }, err => {
        })
      },
      AddQuotaModify(obj){
        this.updateloading=true;
        this.apipost('alipay_post_AlipayEbppInvoiceExpensecontrolQuotaModify', this.AddMsgQuota, res => {
          if (res.data.resultCode == 1) {
            this.clearMsgQuota();
            this.Success(res.data.message);
            this.updateloading=false;
            this.getList();
          }
          else{
                this.Error(res.data.message);
                this.updateloading=false;
              }
        }, err => {
        })
      },
      AddNewMsgQuotaModify(){
        this.updateloading=true;
        if (this.NewMsgQuota.EffectiveDateList && this.NewMsgQuota.EffectiveDateList.length > 0) {
          this.NewMsgQuota.EffectiveStartDate = this.NewMsgQuota.EffectiveDateList[0];
          this.NewMsgQuota.EffectiveEndDate = this.NewMsgQuota.EffectiveDateList[1];
          }
        this.apipost('alipay_post_AlipayEbppInvoiceExpensecontrolQuotaCreate', this.NewMsgQuota, res => {
          if (res.data.resultCode == 1) {
            this.clearNewMsgQuota();
            this.Success(res.data.message);
            this.getList();
            this.updateloading=false;
          }
          else{
                this.Error(res.data.message);
                this.updateloading=false;
              }
        }, err => {
        })
      },
      AlipayEbppInvoiceExpensecontrolQuotaQuery() { //获取用户使用额度情况
        this.apipost('alipay_post_AlipayEbppInvoiceExpensecontrolQuotaQuery', {InstitutionId:this.DataList.Id}, res => {
          if (res.data.resultCode == 1) {
            let RoyaltyList = []
              RoyaltyList = res.data.data
              this.DataList.QuotaList.forEach(x => {
                RoyaltyList.forEach(y => {
                  if (x.EmployeeId == y.EmployeeId) {
                    x.QuotaTotal =  Number(y.QuotaTotal)/100;//总金额
                    x.QuotaAvailable =  Number(y.QuotaAvailable)/100;//可用金额（单位分）
                    x.QuotaLocked = Number( y.QuotaLocked )/100;//锁定金额（单位分）
                    x.QuotaUsed = Number( y.QuotaUsed )/100;//已用金额（单位分）
                    x.Freeze =  y.Freeze;//额度是否冻结，冻结后因公付不可用
                  }
                })
              })
              this.$forceUpdate()
          }
          else{
            this.Error(res.data.message);
          }
        }, err => {
        })
      },

      UpdateInvoiceInstitutionModify() { //制度编辑
        this.updateloading=true;
        if(this.addMsg.effectiveDateList&&this.addMsg.effectiveDateList.length>0){
          this.addMsg.EffectiveStartDate=this.addMsg.effectiveDateList[0];
          this.addMsg.EffectiveEndDate=this.addMsg.effectiveDateList[1];
        }
        this.apipost('alipay_post_AlipayEbppInvoiceInstitutionModify', this.addMsg, res => {
          if (res.data.resultCode == 1) {
            this.Success(res.data.message);
            this.clearAddMsg();
             this.updateloading=false;
            this.getList();
          }
          else{
            this.Error(res.data.message);
            this.updateloading=false;
          }
        }, err => {
        })
      },
      GetAlipayCommerceEcConsumeDetailQuery() { //企业码账单详情查询
        this.loading=true;
        this.apipost('alipay_post_AlipayCommerceEcConsumeDetailQuery', this.msg, res => {
          if (res.data.resultCode == 1) {
              this.DataList.ChangeNotifyList= res.data.data.ChangeNotifyList
              this.DataList.CostList= res.data.data.CostList
            this.$forceUpdate()
            this.loading=false;
          }
        }, err => {
        })
      },
      AddMsgBaseInfo(obj){//给编辑数据赋值
        this.addMsg.InstitutionName=obj.InstitutionName;//制度名称
        this.addMsg.Id=obj.Id;
        this.outerVisible=true,
        this.addMsg.Effective=obj.Effective;//是否启用 停用: 0   启用: 1
        this.addMsg.InstitutionDesc=obj.InstitutionDesc;//费控描述
        this.addMsg.EffectiveEndDate=obj.EffectiveEndDate;
        this.addMsg.EffectiveStartDate=obj.EffectiveStartDate;
        this.addMsg.effectiveDateList=[];
        this.addMsg.effectiveDateList=obj.EffectiveDateList;
        this.updateloading=false;
      },
      clearAddMsg(){//清空编辑数据
        this.InstitutionName="";//制度名称
        this.Id=0;
        this.outerVisible=false,
        this.Effective=0;//是否启用 停用: 0   启用: 1
        this. InstitutionDesc="";//费控描述
        this. EffectiveEndDate="";
        this.EffectiveStartDate="";
        this. effectiveDateList=[];
        this.updateloading=false;
      },
      getList() { //列表查询
        this.apipost('alipay_post_AlipayEbppInvoiceInstitutionDetailinfoQuery', this.msg, res => {
          if (res.data.resultCode == 1) {
            this.DataList = res.data.data;
            this.AlipayEbppInvoiceExpensecontrolQuotaQuery();
          }
        }, err => {
        })
      },
      DJFEnd(){//地接费结算
        this.jsloading=true;
        this.apipost('alipay_post_InstitutionSettlementTCID', {Id:this.msg.Id,ChangeNotifyList:this.DataList.ChangeNotifyList,VorcherInos:this.VorcherInos} , res => {
          if (res.data.resultCode == 1) {
            this.DataList = res.data.data;
            this.getList();
            this.jsloading=false;
          }
        }, err => {
        })
      },
      showUpLoadFile(i) { // 预览上传文件
        if (i.Type == 3) {
          this.picObj.push(i.Url);
        } else {
          if (i.Content.substring(i.Content.lastIndexOf('.') + 1, i.Content.length).toUpperCase() == 'PDF') {
            this.previewPDF(i.Url)
          } else {
            window.open("https://view.officeapps.live.com/op/view.aspx?src=" + i.Url)
          }
        }
      },
      deleteUploadFile(i) { // 删除上传文件
        this.VorcherInos.splice(i, 1);
        //this.UpdateApply.InvoiceFile = [];
      },

      uploadFileBtn(file) { //上传
        if (file.file.size > 1024 * 1024 * 10) {
          this.Error(this.$t('tips.wjdxbncgsz'))
          return
        }
        //  1 文档  2 数据 3 图片
        let typeArr = [{
            stringArr: 'GIF|JPG|JPEG|PNG|BMP',
            type: 3
          },
          {
            stringArr: 'DOCX|DOC|XLSX|XLS|PPT|PPTX|PDF',
            type: 1
          },
        ]
        let ft = file.file.name.substring(file.file.name.lastIndexOf('.') + 1, file.file.name.length).toUpperCase();
        let fileTypeNumber = 2;
        let typeOk = false;
        typeArr.forEach(x => {
          if (x.stringArr.indexOf(ft) != '-1') {
            fileTypeNumber = x.type
            typeOk = true;
          }
        })
        if (!typeOk) return this.error(this.$t('tips.qscWEfile'));
        let newArr = [];
        newArr.push(file.file)
        let path = "/Upload/Temporary/"
        this.$message.info(this.$t('tips.shangchuanzhong'))
        this.UploadSelfFileT(path, newArr, x => {
          this.VorcherInos.push({
            Content: x.data.FilePath,
            Type: fileTypeNumber,
            Url: this.domainManager().ViittoFileUrl + x.data.FilePath,
          })
          if(fileTypeNumber==3) this.VorcherInosImg.push(this.domainManager().ViittoFileUrl + x.data.FilePath)
          this.Success(this.$t('tips.scchenggong'));
        });
      },
  } }
</script>
