src/components/do/b3-work-time-management/work-time-management.vue
@@ -1,16 +1,16 @@
<template>
  <div class="work-time-management">
    <div class="search">
      <div class="search_thing">
            <div class="search_label">周次:</div>
            <div class="search_input" style="display: flex;align-items: center;">
          <el-input size="small" placeholder="开始周次" clearable
                  v-model="entity.week1"></el-input>
            <span>&nbsp;-&nbsp;</span>
          <el-input size="small" placeholder="结束周次" clearable
                  v-model="entity.week2"></el-input>
        </div>
         </div>
<!--      <div class="search_thing">-->
<!--            <div class="search_label">周次:</div>-->
<!--            <div class="search_input" style="display: flex;align-items: center;">-->
<!--          <el-input size="small" placeholder="开始周次" clearable-->
<!--                  v-model="entity.week1"></el-input>-->
<!--            <span>&nbsp;-&nbsp;</span>-->
<!--          <el-input size="small" placeholder="结束周次" clearable-->
<!--                  v-model="entity.week2"></el-input>-->
<!--        </div>-->
<!--         </div>-->
         <div class="search_thing" style="width: 200px;">
            <div class="search_label">星期:</div>
            <el-select v-model="entity.weekDay" placeholder="全部" size="small" @change="refreshTable()" clearable>
@@ -63,10 +63,12 @@
      </el-radio-group>
      <div style="display: flex;align-items: center;">
        <p style="font-size: 14px;margin-right: 30px;">
          总工时汇总:<span style="font-size: 16px;color: #3A7BFA;">{{ (totalInfo['产量工时汇总']+totalInfo['辅助工时汇总'])? (totalInfo['产量工时汇总']+totalInfo['辅助工时汇总']):0 }}</span>&nbsp;&nbsp;&nbsp;&nbsp;产量工时汇总:<span style="font-size: 16px;color: #3A7BFA;">{{totalInfo['产量工时汇总']?totalInfo['产量工时汇总']:0}}</span>&nbsp;&nbsp;&nbsp;&nbsp;辅助工时汇总:<span style="font-size: 16px;color: #3A7BFA;">{{totalInfo['辅助工时汇总']?totalInfo['辅助工时汇总']:0}}</span>
          总工时汇总:<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{ (totalInfo['产量工时汇总']+totalInfo['辅助工时汇总'])? (totalInfo['产量工时汇总']+totalInfo['辅助工时汇总']):0 }}</span>&nbsp;&nbsp;&nbsp;&nbsp;产量工时汇总:<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{totalInfo['产量工时汇总']?totalInfo['产量工时汇总']:0}}</span>&nbsp;&nbsp;&nbsp;&nbsp;辅助工时汇总:<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{totalInfo['辅助工时汇总']?totalInfo['辅助工时汇总']:0}}</span>
        </p>
        <el-button size="small" type="primary" style="margin-right: 16px;" @click="openAdd" v-show="currentTable == 'ValueTable0'">录入数据</el-button>
        <el-button size="small" type="primary" @click="handleOut" :loading="outLoading">导 出</el-button>
        <el-button size="small" type="primary" style="margin-right: 16px;" @click="openAdd" v-show="currentTable == 'ValueTable0'&&add">录入数据</el-button>
        <el-button size="small" type="primary"
        v-if="down"
        @click="handleOut" :loading="outLoading">导 出</el-button>
      </div>
    </div>
    <div class="table">
@@ -215,7 +217,11 @@
  },
  data () {
    return{
      entity:{},
      entity:{
        dateTime: []
      },
      down:false,
      add:false,
      componentData: {
               entity: {
                  week: null,
@@ -333,16 +339,17 @@
               requiredAdd: [],
               requiredUp: []
         },
      addFileVisible:false,
      entityCopy1: {},
      upIndex1:100,
      weekList:[
        {label: '星期一', value: '1',type:'primary'},
        {label: '星期二', value: '2',type:'primary'},
        {label: '星期三', value: '3',type:'primary'},
        {label: '星期四', value: '4',type:'primary'},
        {label: '星期五', value: '5',type:'primary'},
        {label: '星期六', value: '6',type:'primary'},
        {label: '星期日', value: '7',type:'primary'}
        {label: '周一', value: '1',type:'primary'},
        {label: '周二', value: '2',type:'primary'},
        {label: '周三', value: '3',type:'primary'},
        {label: '周四', value: '4',type:'primary'},
        {label: '周五', value: '5',type:'primary'},
        {label: '周六', value: '6',type:'primary'},
        {label: '周日', value: '7',type:'primary'}
      ],
      currentTable:'ValueTable0',
      addVisible:false,
@@ -393,7 +400,7 @@
          label:'已批准'
        },
      ],
      totalInfo:{},
      totalInfo:null,
      auxiliaryWorking:null,
      outLoading:false
    }
@@ -449,6 +456,9 @@
      }
    }
  },
  created() {
    this.setDate()
  },
  mounted(){
    this.getCurrentWeekNumber()
    this.selectEnumByCategory()
@@ -458,8 +468,64 @@
    this.entityCopy1 = this.HaveJson(this.componentData1.entity);
    this.componentData.tagField.weekDay.select = this.weekList
    this.componentData.selectField.weekDay.select = this.weekList
    this.getPower()
  },
  methods:{
    /** 将时间选择器默认选为当天的日期 */
    setDate(){
      let currentDate = new Date();
      let year = currentDate.getFullYear();
      let month = String(currentDate.getMonth() + 1).padStart(2, '0');
      let day = String(currentDate.getDate()).padStart(2, '0');
      let formattedDate1 = `${year}-${month}-${day} 00:00:00`;
      let formattedDate2 = `${year}-${month}-${day} 23:59:59`;
      this.entity.dateTime.push(formattedDate1);
      this.entity.dateTime.push(formattedDate2);
    },
    getPower(){
      let power = JSON.parse(sessionStorage.getItem('power'))
        let del = false
        let down = false
        let add = false
        let up = false
        let check = false
        let ratify = false
        for (var i = 0; i < power.length; i++) {
               if (power[i].menuMethod == 'exportWorkingHours') {
                  down = true
               }
               if (power[i].menuMethod == 'deleteAuxiliaryWorkingHoursDay') {
                  del = true
               }
          if (power[i].menuMethod == 'insertAuxiliaryWorkingHoursDay') {
                  add = true
               }
          console.log(add)
          if (power[i].menuMethod == 'updateAuxiliaryWorkingHoursDay') {
                  up = true
               }
          if (power[i].menuMethod == 'check') {
                  check = true
               }
          if (power[i].menuMethod == 'approve') {
                  ratify = true
               }
            }
        if (!ratify) {
               this.componentData.do.splice(3, 1)
            }
        if (!check) {
               this.componentData.do.splice(2, 1)
            }
        if (!up) {
               this.componentData.do.splice(1, 1)
            }
        if (!del) {
               this.componentData.do.splice(0, 1)
            }
        this.down = down
        this.add = add
    },
    getYearAndMonthAndDays(date){
      return getYearAndMonthAndDays(date)
    },