gaoluyang
2024-07-17 a0faa6ff04f38f53728b97c21c82fd9798488e45
src/components/do/b3-work-time-management/work-time-management.vue
@@ -1,7 +1,7 @@
<template>
  <div class="work-time-management">
    <div class="search">
      <div class="search_thing">
      <!-- <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
@@ -10,7 +10,7 @@
          <el-input size="small" placeholder="结束周次" clearable
                  v-model="entity.week2"></el-input>
        </div>
         </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>
@@ -18,7 +18,7 @@
               </el-option>
            </el-select>
         </div>
         <div class="search_thing">
         <div class="search_thing" style="width: 390px;">
            <div class="search_label" style="width: 90px;">时间范围:</div>
            <div class="search_input">
          <el-date-picker
@@ -65,10 +65,12 @@
        <p style="font-size: 14px;margin-right: 30px;">
          总工时汇总:<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'&&add">录入数据</el-button>
        <el-button size="small" type="primary" @click="openAdd" v-show="currentTable == 'ValueTable0'&&add">录入数据</el-button>
        <el-button size="small" type="primary"
        v-if="down"
        @click="handleOut" :loading="outLoading">导 出</el-button>
        <el-button size="small" type="primary" v-show="currentTable == 'ValueTable0'&&add" @click="openBatchCheck(0)">批量审核</el-button>
        <el-button size="small" type="primary" v-show="currentTable == 'ValueTable0'&&add" @click="openBatchCheck(1)">批量批准</el-button>
      </div>
    </div>
    <div class="table">
@@ -203,6 +205,17 @@
            </el-row>
         </span>
      </el-dialog>
    <el-dialog
      :title="batchCheckTitle"
      :visible.sync="batchCheckDialog"
      width="30%"
      :before-close="closeBatchCheckDialog">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
    <el-button @click="batchCheckDialog = false">取 消</el-button>
    <el-button type="primary" @click="batchCheck">确 定</el-button>
  </span>
    </el-dialog>
  </div>
</template>
@@ -223,97 +236,104 @@
      down:false,
      add:false,
      componentData: {
               entity: {
                  week: null,
                  weekDay: null,
                  dateTime: null,
            name:null,
                  orderBy: {
                     field: 'id',
                     order: 'desc'
                  }
               },
               isIndex: true,
               showSelect: false,
               select: false,
               do: [{
                  id: 'delete',
                  font: '删除',
                  type: 'text',
                  method: 'doDiy'
               }, {
                  id: 'handleEdit',
                  font: '编辑',
                  type: 'text',
                  method: 'handleEdit'
               },{
                  id: 'handleCheck',
                  font: '审核',
                  type: 'text',
                  method: 'handleCheck'
               }, {
                  id: 'handleRatify',
                  font: '批准',
                  type: 'text',
                  method: 'handleRatify'
               }],
               tagField: {
            shift:{
              select:[]
            },
            state:{
              select:[
                {
                  label:'已提交',
                  value:'已提交',
                  type:'primary'
                },
                {
                  label:'已审核',
                  value:'已审核',
                  type:'warning'
                },
                {
                  label:'已批准',
                  value:'已批准',
                  type:'success'
                },
              ]
            },
            weekDay:{
              select:[]
            }
        entity: {
          week: null,
          weekDay: null,
          dateTime: null,
          name:null,
          orderBy: {
            field: 'id',
            order: 'desc'
          }
        },
        isIndex: true,
        showSelect: true,
        select: true,
        selectMethod: 'handleChangeTask',
        do: [{
          id: 'delete',
          font: '删除',
          type: 'text',
          method: 'doDiy'
        }, {
          id: 'handleEdit',
          font: '编辑',
          type: 'text',
          method: 'handleEdit'
        },{
          id: 'handleCheck',
          font: '审核',
          type: 'text',
          method: 'handleCheck',
          disabFun: (row, index) => {
            return row.state === '已审核' || row.state === '已批准'
          }
        }, {
          id: 'handleRatify',
          font: '批准',
          type: 'text',
          method: 'handleRatify',
          disabFun: (row, index) => {
            return row.state === '已批准'
          }
        }],
        tagField: {
          shift:{
            select:[]
          },
               linkEvent: {},
               selectField: {
            shift:{
              select:[]
            },
            state:{
              select:[
                {
                  label:'已提交',
                  value:'已提交',
                  type:'primary'
                },
                {
                  label:'已审核',
                  value:'已审核',
                  type:'warning'
                },
                {
                  label:'已批准',
                  value:'已批准',
                  type:'success'
                },
              ]
            },
            weekDay:{
              select:[]
            }
          state:{
            select:[
              {
                label:'已提交',
                value:'已提交',
                type:'primary'
              },
              {
                label:'已审核',
                value:'已审核',
                type:'warning'
              },
              {
                label:'已批准',
                value:'已批准',
                type:'success'
              },
            ]
          },
               requiredAdd: [],
               requiredUp: []
          weekDay:{
            select:[]
          }
        },
        linkEvent: {},
        selectField: {
          shift:{
            select:[]
          },
          state:{
            select:[
              {
                label:'已提交',
                value:'已提交',
                type:'primary'
              },
              {
                label:'已审核',
                value:'已审核',
                type:'warning'
              },
              {
                label:'已批准',
                value:'已批准',
                type:'success'
              },
            ]
          },
          weekDay:{
            select:[]
          }
        },
        requiredAdd: [],
        requiredUp: []
         },
      entityCopy: {},
         upIndex: 0,
@@ -343,13 +363,13 @@
      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,
@@ -402,7 +422,10 @@
      ],
      totalInfo:null,
      auxiliaryWorking:null,
      outLoading:false
      outLoading:false,
      batchCheckTitle: '批量审核',
      batchCheckDialog: false,
      ValueTable0Selected: []
    }
  },
  watch:{
@@ -477,12 +500,11 @@
      let year = currentDate.getFullYear();
      let month = String(currentDate.getMonth() + 1).padStart(2, '0');
      let day = String(currentDate.getDate()).padStart(2, '0');
      let formattedDate = `${year}-${month}-${day} 00:00:00`;
      this.entity.dateTime.push(formattedDate);
      this.entity.dateTime.push(formattedDate);
      this.$nextTick(() => {
        this.refreshTable()
      })
      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);
      this.refreshTable()
    },
    getPower(){
      let power = JSON.parse(sessionStorage.getItem('power'))
@@ -612,7 +634,13 @@
            this.addLoad = false
            if (res.code == 201) return
            this.$message.success('已提交')
            this.addVisible = false
            this.formData.number = ''
            this.formData.amount = ''
            this.formData.remarks = ''
            this.formData.approvedWorkingHour = ''
            this.formData.nonproductiveTime = ''
            this.formData.auxiliaryProject = ''
            // this.addVisible = false
            this.refreshTable()
            this.collectWorkingHours()
          })
@@ -627,7 +655,13 @@
            this.addLoad = false
            if (res.code == 201) return
            this.$message.success('操作成功')
            this.addVisible = false
            this.formData.number = ''
            this.formData.amount = ''
            this.formData.remarks = ''
            this.formData.approvedWorkingHour = ''
            this.formData.nonproductiveTime = ''
            this.formData.auxiliaryProject = ''
            // this.addVisible = false
            this.refreshTable()
            this.collectWorkingHours()
          })
@@ -642,6 +676,44 @@
      this.title = '批准'
      this.formData0 = row;
      this.checkVisible = true
    },
    handleChangeTask (row) {
      this.ValueTable0Selected = JSON.parse(JSON.stringify(row))
    },
    openBatchCheck (e) {
      if (this.ValueTable0Selected.length > 0) {
        const isChecked = this.ValueTable0Selected.every(item => item.state === '已提交')
        const isApprove = this.ValueTable0Selected.every(item => item.state !== '已批准')
        console.log('this.isApprove---', isApprove)
        this.batchCheckTitle = e === 0 ? '批量审核' : '批量批准'
        if (this.batchCheckTitle === '批量审核') {
          if (isChecked) {
            this.batchCheckDialog = true
          } else {
            this.$message.error('请选择未审核或未批准的数据')
          }
        } else {
          if (isApprove) {
            this.batchCheckDialog = true
          } else {
            this.$message.error('请选择未批准的数据')
          }
        }
      } else {
        this.$message.error('请选择至少一条数据')
      }
    },
    batchCheck () {
      const e = this.batchCheckTitle === '批量审核' ? 0 : 1
      this.$refs.ValueTable0.batchCheck(e)
    },
    closeBatchCheckDialog () {
      this.batchCheckDialog = false
    },
    submitBatchCheckDialog () {
      this.batchCheckDialog = false
      this.refreshTable()
      this.collectWorkingHours()
    },
    submitCheck(e){
      if(!this.formData0.number){
@@ -824,4 +896,7 @@
      height: calc(100% - 60px - 80px - 10px - 40px - 25px);
      padding: 20px;
   }
>>>.el-dialog__wrapper {
  z-index: 9999 !important; /* 根据需要调整层级 */
}
</style>