From cc6914dff1a91dd00e3a86d5daae2c3dba2d6ba8 Mon Sep 17 00:00:00 2001
From: gaoluyang <gaoluyang@rengu.cc>
Date: 星期三, 24 七月 2024 16:28:00 +0800
Subject: [PATCH] 检测中心-班次时间配置功能

---
 src/components/do/b3-work-time-management/work-time-statistics.vue |   79 ++++++++++++++++++++++++++++++---------
 1 files changed, 61 insertions(+), 18 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 8ffa444..d7d6d4c 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
@@ -10,7 +10,8 @@
             format="yyyy-MM"
             value-format="yyyy-MM"
             placeholder="閫夋嫨鏈�" size="small" style="width: 100%;"
-            :clearable="false">
+            :clearable="false"
+            @change="refreshTable()">
           </el-date-picker>
         </div>
 			</div>
@@ -39,25 +40,28 @@
 				<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
 			</div>
       <div class="search_thing">
-        <el-button size="small" type="primary"  @click="handleDown" v-show="currentTable == 'value0'">瀵� 鍑�</el-button>
-        <el-button size="small" type="primary" @click="handleUp" v-show="currentTable == 'value1'">瀵� 鍏�</el-button>
+        <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-if="currentTable == 'value0'"
+        v-if="currentTable == 'value0'" :isColumnWidth="true"
+                  :isShowZero="true"
 				:url="$api.auxiliaryOriginalHours.selectAuxiliaryOriginalHours"
-				:componentData="componentData" :downUrl="$api.auxiliaryWorkingHours.selectAuxiliaryWorkingHours" :key="upIndex" />
-      <ValueTable ref="ValueTable1"
-        v-if="currentTable == 'value1'"
+				:componentData="componentData" :key="upIndex" />
+      <ValueTable ref="ValueTable1" :isShowZero="true"
+        v-if="currentTable == 'value1'" :isColumnWidth="true"
 				:url="$api.auxiliaryCorrectionHours.selectAuxiliaryCorrectionHours"
         :inputUrl="$api.auxiliaryCorrectionHours.upload"
 				:componentData="componentData0"
@@ -77,6 +81,8 @@
   },
   data () {
     return{
+      down:false,
+      up:false,
       componentData: {
 					entity: {
 						month: getYearAndMonthAndDays().split('-')[0]+'-'+getYearAndMonthAndDays().split('-')[1],
@@ -93,6 +99,7 @@
 					requiredAdd: [],
 					requiredUp: [],
           accept:聽'.xlsx',
+        sort: false,
           inputType:聽'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
           cellSpecialStyle:{
             redColorByKey:'Hours'
@@ -108,6 +115,7 @@
 							order: 'desc'
 						}
 					},
+        sort: false,
 					isIndex: true,
 					showSelect: false,
 					select: false,
@@ -122,7 +130,9 @@
           inputType:聽'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
 			},
       entity:{
-        month:getYearAndMonthAndDays()
+        month:getYearAndMonthAndDays(),
+        name:'',
+        departLims:''
       },
       entityCopy:{},
       entityCopy0:{},
@@ -130,13 +140,15 @@
       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(){
@@ -185,10 +197,41 @@
         })
     },
     handleDown(){
-      this.$refs.ValueTable0.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.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