From a0b1fdec2bc5ddad11e981936b80d0fdf1e4bc69 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 03 七月 2024 09:25:06 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/center-lims-before into master

---
 src/components/do/b3-work-time-management/work-time-statistics.vue |  236 ++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 129 insertions(+), 107 deletions(-)

diff --git a/src/components/do/b3-work-time-management/work-time-statistics.vue b/src/components/do/b3-work-time-management/work-time-statistics.vue
index 321f637..3b873af 100644
--- a/src/components/do/b3-work-time-management/work-time-statistics.vue
+++ b/src/components/do/b3-work-time-management/work-time-statistics.vue
@@ -5,20 +5,24 @@
 				<div class="search_label">鏃ユ湡锛�</div>
 				<div class="search_input" style="display: flex;align-items: center;">
           <el-date-picker
-            v-model="componentData.entity.laboratory"
+            v-model="entity.month"
             type="month"
-            format="yyyy-MM-dd HH:mm:ss"
-            value-format="yyyy-MM-dd HH:mm:ss"
-            placeholder="閫夋嫨鏈�" size="small" style="width: 100%;">
+            format="yyyy-MM"
+            value-format="yyyy-MM"
+            placeholder="閫夋嫨鏈�" size="small" style="width: 100%;"
+            :clearable="false"
+            @change="refreshTable()">
           </el-date-picker>
         </div>
 			</div>
 			<div class="search_thing">
 				<div class="search_label">鍛樺伐锛�</div>
-				<el-select v-model="componentData.entity.laboratory" placeholder="鍏ㄩ儴" size="small" @change="refreshTable()">
+				<!-- <el-select v-model="entity.name" placeholder="鍏ㄩ儴" size="small" @change="refreshTable()" clearable>
 					<el-option v-for="item in personList" :key="item.id" :label="item.name" :value="item.id">
 					</el-option>
-				</el-select>
+				</el-select> -->
+        <el-input size="small" placeholder="璇疯緭鍏�" clearable
+          v-model="entity.name" @keyup.enter.native="refreshTable()"></el-input>
 			</div>
 			<div class="search_thing">
 				<div class="search_label">閮ㄩ棬锛�</div>
@@ -28,99 +32,82 @@
             </el-option>
           </el-select> -->
           <el-input size="small" placeholder="璇疯緭鍏�" clearable
-						v-model="componentData.entity.department" @keyup.enter.native="refreshTable()"></el-input>
+						v-model="entity.departLims" @keyup.enter.native="refreshTable()"></el-input>
         </div>
 			</div>
-			<div class="search_thing" style="padding-left: 30px;width: 100px;">
+			<div class="search_thing" style="padding-left: 30px;">
 				<el-button size="small" @click="refresh()">閲� 缃�</el-button>
 				<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
 			</div>
-      <el-button size="small" type="primary" style="position: absolute;right: 50px;" @click="handleDown">瀵� 鍑�</el-button>
-      <el-button size="small" type="primary" style="position: absolute;right: 120px;" @click="handleUp" v-show="currentTable == 'value0'">瀵� 鍏�</el-button>
+      <div class="search_thing">
+        <el-button size="small" type="primary"  @click="handleDown" v-show="currentTable == 'value0'&&down" :loading="outLoading">瀵� 鍑�</el-button>
+        <el-button size="small" type="primary"  @click="handleUp" v-show="currentTable == 'value1'&&up">瀵� 鍏�</el-button>
+      </div>
 		</div>
-    <el-radio-group v-model="currentTable" size="small" :key="'111'" style="margin-top: 10px;">
-      <el-radio-button label="value0">
-        鍘熷宸ユ椂
-      </el-radio-button>
-      <el-radio-button label="value1">
-        淇宸ユ椂
-      </el-radio-button>
-    </el-radio-group>
+    <div style="text-align: left">
+      <el-radio-group v-model="currentTable" size="small" :key="'111'" style="margin-top: 10px;">
+        <el-radio-button label="value0">
+          鍘熷宸ユ椂
+        </el-radio-button>
+        <el-radio-button label="value1">
+          淇宸ユ椂
+        </el-radio-button>
+      </el-radio-group>
+    </div>
     <div class="table">
       <ValueTable ref="ValueTable0"
-        v-show="currentTable == 'value0'"
-				:url="$api.auxiliaryWorkingHours.selectAuxiliaryWorkingHours"
-				:componentData="componentData" :inputUrl="$api.auxiliaryWorkingHours.selectAuxiliaryWorkingHours" :downUrl="$api.auxiliaryWorkingHours.selectAuxiliaryWorkingHours" :key="upIndex" />
+        v-if="currentTable == 'value0'"
+				:url="$api.auxiliaryOriginalHours.selectAuxiliaryOriginalHours"
+				:componentData="componentData" :key="upIndex" />
       <ValueTable ref="ValueTable1"
-        v-show="currentTable == 'value1'"
-				:url="$api.auxiliaryWorkingHours.selectAuxiliaryWorkingHours"
-				:componentData="componentData0" :key="upIndex" />
+        v-if="currentTable == 'value1'"
+				:url="$api.auxiliaryCorrectionHours.selectAuxiliaryCorrectionHours"
+        :inputUrl="$api.auxiliaryCorrectionHours.upload"
+				:componentData="componentData0"
+        :key="upIndex1" />
     </div>
   </div>
 </template>
 
 <script>
 import ValueTable from '../../tool/value-table.vue'
+import {
+		getYearAndMonthAndDays
+	} from '../../../util/date'
 export default {
   components: {
     ValueTable
   },
   data () {
     return{
+      down:false,
+      up:false,
       componentData: {
 					entity: {
-						number: null,
-						department: null,
-						laboratory: null,
-						orderBy: {
-							field: 'id',
-							order: 'desc'
-						}
+						month: getYearAndMonthAndDays().split('-')[0]+'-'+getYearAndMonthAndDays().split('-')[1],
+						name: null,
+						departLims: null,
 					},
 					isIndex: true,
 					showSelect: false,
 					select: false,
 					do: [],
-					tagField: {
-						deviceStatus: {
-							select: []
-						},
-						equipmentManager: {
-							select: []
-						},
-						authorizedPerson: {
-							select: []
-						},
-            insProductIds:{
-              select:[]
-            }
-					},
-					linkEvent: {
-						deviceName: {
-							method: 'selectAllByOne'
-						}
-					},
-					selectField: {
-						authorizedPerson: {
-							select: [],
-							choose: true
-						},
-						equipmentManager: {
-							select: []
-						},
-            insProductIds:{
-              select:[],
-              choose: true
-            }
-					},
+					tagField: {},
+					linkEvent: {},
+					selectField: {},
 					requiredAdd: [],
-					requiredUp: []
+					requiredUp: [],
+          accept:聽'.xlsx',
+          inputType:聽'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+          cellSpecialStyle:{
+            redColorByKey:'Hours'
+          }
 			},
       componentData0: {
 					entity: {
-						number: null,
-						department: null,
-						laboratory: null,
+						month: getYearAndMonthAndDays().split('-')[0]+'-'+getYearAndMonthAndDays().split('-')[1],
+						name: null,
+						departLims: null,
 						orderBy: {
 							field: 'id',
 							order: 'desc'
@@ -130,53 +117,61 @@
 					showSelect: false,
 					select: false,
 					do: [],
-					tagField: {
-						deviceStatus: {
-							select: []
-						},
-						equipmentManager: {
-							select: []
-						},
-						authorizedPerson: {
-							select: []
-						},
-            insProductIds:{
-              select:[]
-            }
-					},
+					tagField: {},
 					linkEvent: {
-						deviceName: {
-							method: 'selectAllByOne'
-						}
-					},
-					selectField: {
-						authorizedPerson: {
-							select: [],
-							choose: true
 						},
-						equipmentManager: {
-							select: []
-						},
-            insProductIds:{
-              select:[],
-              choose: true
-            }
-					},
+					selectField: {},
 					requiredAdd: [],
-					requiredUp: []
+					requiredUp: [],
+          accept:聽'.xlsx',
+          inputType:聽'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
 			},
+      entity:{
+        month:getYearAndMonthAndDays(),
+        name:'',
+        departLims:''
+      },
+      entityCopy:{},
+      entityCopy0:{},
       upIndex:0,
+      upIndex1:100,
       weekList:[],
       personList:[],
-      currentTable:'value0'
+      currentTable:'value0',
+      outLoading:false
     }
   },
   mounted(){
     this.getUsers()
+    this.entityCopy = this.HaveJson(this.componentData.entity);
+    this.entityCopy0 = this.HaveJson(this.componentData0.entity);
+    this.getPower()
   },
   methods: {
-    refresh(){},
-    refreshTable(){},
+    refresh(){
+      this.entity = {
+        month:getYearAndMonthAndDays()
+      }
+      if(this.currentTable=='value0'){
+        this.componentData.entity = this.HaveJson(this.entityCopy)
+        this.upIndex++
+      }else{
+        this.componentData0.entity = this.HaveJson(this.entityCopy0)
+        this.upIndex1++
+      }
+      this.refreshTable()
+    },
+    refreshTable(){
+      let entity = {...this.entity}
+      entity.month = entity.month.split('-')[0]+'-'+entity.month.split('-')[1]
+      if(this.currentTable=='value0'){
+        this.componentData.entity = {...this.componentData.entity,...entity}
+        this.$refs['ValueTable0'].selectList()
+      }else{
+        this.componentData0.entity = {...this.componentData0.entity,...entity}
+        this.$refs['ValueTable1'].selectList()
+      }
+    },
     getUsers(){
       this.$axios.post(this.$api.user.selectUserList, {
 					page: {
@@ -199,14 +194,41 @@
         })
     },
     handleDown(){
-      if(this.currentTable == 'value0'){
-        this.$refs.ValueTable0.downFile(false)
-      }else{
-        this.$refs.ValueTable1.downFile(false)
-      }
+      // this.$refs.ValueTable0.downFile(false)
+      let entity = {...this.entity}
+      entity.month = entity.month.split('-')[0]+'-'+entity.month.split('-')[1]
+      this.outLoading = true
+      this.$axios.post(this.$api.auxiliaryOriginalHours.exportOriginalHours,{
+        ...entity
+        // params:entity,
+      },{responseType: "blob"}).then(res => {
+        this.outLoading = false
+        this.$message.success('瀵煎嚭鎴愬姛')
+        const blob = new Blob([res],{ type: 'application/octet-stream' });
+        const url = URL.createObjectURL(blob);
+        const link = document.createElement('a');
+        link.href = url;
+        link.download = entity.month+'宸ユ椂缁熻琛�.xlsx';
+        link.click();
+      })
     },
     handleUp(){
-      this.$refs.ValueTable0.openUpload()
+      this.$refs.ValueTable1.openUpload()
+    },
+    getPower(){
+      let power = JSON.parse(sessionStorage.getItem('power'))
+        let up = false
+        let down = false
+        for (var i = 0; i < power.length; i++) {
+					if (power[i].menuMethod == 'exportOriginalHours') {
+						down = true
+					}
+					if (power[i].menuMethod == 'upload') {
+						up = true
+					}
+				}
+        this.down = down
+        this.up = up
     }
   }
 }

--
Gitblit v1.9.3