From 5ecb7958c96d3f0b6d47b79aff7eb306c2cf690f Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期二, 06 八月 2024 11:16:58 +0800
Subject: [PATCH] gitlab上面的wms转移到公司git

---
 src/views/reportForm/monthboundDetail/index.vue |  163 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 142 insertions(+), 21 deletions(-)

diff --git a/src/views/reportForm/monthboundDetail/index.vue b/src/views/reportForm/monthboundDetail/index.vue
index 8bf20f9..8050960 100644
--- a/src/views/reportForm/monthboundDetail/index.vue
+++ b/src/views/reportForm/monthboundDetail/index.vue
@@ -1,20 +1,49 @@
 <template>
   <div class="rightContent">
+    <el-dialog
+            title="閰嶇疆鍒濇湡鏃堕棿"
+            :visible.sync="timeModal"
+            width="30%"
+            :before-close="handlerClose">
+      <el-form style="width: 80%;margin: 20px auto;" ref="sysFormRef">
+        <el-form-item label="鏃ユ湡閰嶇疆:">
+          <el-select v-model="startDate.day" style="margin-left: 20px">
+            <el-option v-for="day in 28" :value="day.toString().padStart(2,'0')":label="day.toString().padStart(2,'0')"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="鏃堕棿閰嶇疆:">
+          <el-time-select
+                  :picker-options="startPickerOptions"
+                  v-model="startDate.time"
+                  type="time"
+                  format="HH:mm"
+                  value-format="HH:mm"
+                  :clearable='true'
+                  class='margin_left_20px'>
+          </el-time-select>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="timeModal = false" size="mini">鍙� 娑�</el-button>
+        <el-button type="primary" @click="saveStartDate" size="mini">淇濆瓨</el-button>
+      </span>
+    </el-dialog>
     <div class="top">
-      <SearchCommonView :add-title="'鏂板缓'" :showAdd="false" :placeholder="'璇疯緭鍏ヤ骇鍝佺紪鐮�/浜у搧鍚嶇О鎼滅储'" :amount-view="false"
+      <SearchCommonView :add-title="'鏂板缓'" :showAdd="false" :placeholder="'璇疯緭鍏ヤ骇鍝佺紪鐮�/浜у搧鍚嶇О鎼滅储'" :amount-view="false" :showDownload="true" @downloadClick="downHttpClick"
          @searchClick="getList" >
         <template slot="leftButton">
           <el-date-picker
                     v-model="monthBoundObject.date"
                     value-format="yyyy-MM"
+                    format="yyyy-MM"
                     type="month"
                     :clearable='false'
                     class='margin_left_20px'
                     @change='getData'
                     placeholder="閫夋嫨鏃ユ湡"
-                    :picker-options="pickerOptions"
-                  >
+                    :picker-options="pickerOptions">
           </el-date-picker>
+          <el-button size="mini" @click="timeModal=true" class="el-icon-setting" type="text" style="margin-left: 10px">閰嶇疆</el-button>
         </template>
       </SearchCommonView>
     </div>
@@ -23,7 +52,12 @@
         <TableCommonView ref="tableListRef" :loading="isTableOneLoading" :table-list="tableList" :showCheckcol='false' @selTableCol="selTableCol">
           <template slot="tableButton">
               <el-table-column label="鏈熷垵搴撳瓨" prop='inventoryStart'>
-                <el-table-column label="浠�" prop='inventoryStart' min="90">
+                <el-table-column v-for="unit in unitList" :label="unit.name" prop='inventoryStart' min="90">
+                  <template slot-scope="scope">
+                    {{getUnitValue(scope.row.beginMoreUnitsArr,unit.name,scope.row.beginAmount,scope.row.unit)}}
+                  </template>
+                </el-table-column>
+                <!--<el-table-column label="浠�" prop='inventoryStart' min="90">
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.beginMoreUnitsArr,'浠�',scope.row.beginAmount,scope.row.unit)}}
                   </template>
@@ -42,10 +76,15 @@
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.beginMoreUnitsArr,'閲嶉噺',scope.row.beginAmount,scope.row.unit)}}
                   </template>
-                </el-table-column>
+                </el-table-column>-->
               </el-table-column>
               <el-table-column label="鏈湀鍏ュ簱" prop='inInventoryCurrentMonth'>
-                <el-table-column label="浠�" prop='inventoryStart' min="90">
+                <el-table-column v-for="unit in unitList" :label="unit.name" prop='inInventoryCurrentMonth' min="90">
+                  <template slot-scope="scope">
+                    {{getUnitValue(scope.row.inputMoreUnitsArr,unit.name,scope.row.inputAmount,scope.row.unit)}}
+                  </template>
+                </el-table-column>
+                <!--<el-table-column label="浠�" prop='inventoryStart' min="90">
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.inputMoreUnitsArr,'浠�',scope.row.inputAmount,scope.row.unit)}}
                   </template>
@@ -64,10 +103,15 @@
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.inputMoreUnitsArr,'閲嶉噺',scope.row.inputAmount,scope.row.unit)}}
                   </template>
-                </el-table-column>
+                </el-table-column>-->
               </el-table-column>
               <el-table-column label="鏈湀鍑哄簱" prop='outInventoryCurrentMonth'>
-                <el-table-column label="浠�" prop='inventoryStart' min="90">
+                <el-table-column v-for="unit in unitList" :label="unit.name" prop='outInventoryCurrentMonth' min="90">
+                  <template slot-scope="scope">
+                    {{getUnitValue(scope.row.outputMoreUnitsArr,unit.name,scope.row.outputAmount,scope.row.unit)}}
+                  </template>
+                </el-table-column>
+                <!--<el-table-column label="浠�" prop='inventoryStart' min="90">
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.outputMoreUnitsArr,'浠�',scope.row.outputAmount,scope.row.unit)}}
                   </template>
@@ -86,10 +130,15 @@
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.outputMoreUnitsArr,'閲嶉噺',scope.row.outputAmount,scope.row.unit)}}
                   </template>
-                </el-table-column>
+                </el-table-column>-->
               </el-table-column>
               <el-table-column label="鏈熸湯搴撳瓨" prop='inventoryEnd'>
-                <el-table-column label="浠�" prop='inventoryStart' min="90">
+                <el-table-column v-for="unit in unitList" :label="unit.name" prop='inventoryEnd' min="90">
+                  <template slot-scope="scope">
+                    {{getUnitValue(scope.row.MoreUnitsArr,unit.name,scope.row.amount,scope.row.unit)}}
+                  </template>
+                </el-table-column>
+                <!--<el-table-column label="浠�" prop='inventoryStart' min="90">
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.MoreUnitsArr,'浠�',scope.row.amount,scope.row.unit)}}
                   </template>
@@ -108,7 +157,7 @@
                   <template slot-scope="scope">
                     {{getUnitValue(scope.row.MoreUnitsArr,'閲嶉噺',scope.row.amount,scope.row.unit)}}
                   </template>
-                </el-table-column>
+                </el-table-column>-->
               </el-table-column>
             </template>
         </TableCommonView>
@@ -123,9 +172,14 @@
 <script>
 
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-import { getmonthStats } from "@/api/reportForm/inventoryRwport"
+import { getmonthStats ,getSystemConfigApi,saveSystemConfigApi} from "@/api/reportForm/inventoryRwport"
 import newDate from "@/api/date";
-const { getPreviousMonth,formatTime} = newDate;
+import { downloadMonthStats } from "@/api/downFile"
+import FileSaver from 'file-saver'
+import _ from 'lodash'
+const { getPreviousMonth,formatTime,getCurrentMonth} = newDate;
+import {getUnitInfo} from "@/api/basic/standard";
+
 export default {
   name: "outboundDetail",
   props: {},
@@ -134,25 +188,91 @@
   computed: {},
   data() {
     return {
+        unitList:[],
+        systemParams:{
+            ID:0,
+            configType:1,
+            name:'',
+        },
+        startDate:{
+            day:'01',
+            time:'00:00'
+        },
+        timeModal:false,
       monthBoundObject:{
         keyWord:'',
-        date:getPreviousMonth(),
+        date:getCurrentMonth(),
       },
+        startPickerOptions:{
+            start:'00:00',
+            step:'00:30',
+            end:'23:59'
+        },
       tableList: {},
       showcol: [],
       pickerOptions: {
         disabledDate(time) {
-          return time.getTime() > formatTime(getPreviousMonth());
+          return time.getTime() > formatTime(getCurrentMonth());
         },
       },
       isTableOneLoading: false,
     }
   },
   created() {
-    this.setTable()
-    this.getData()
+    this.setTable();
+    this.getData();
+    this.querySystemConfig();
+      this.getUnitInfo();
   },
   methods: {
+      async getUnitInfo(){
+          const { code,data }=await getUnitInfo();
+          if(code===200){
+              this.unitList=data;
+          }
+      },
+      async querySystemConfig(){
+          const params={configType:1};
+          const {code,data}=await getSystemConfigApi(params);
+          if(code===200){
+              if(data.val){
+                  this.systemParams.ID=data.id;
+                  this.systemParams.name=data.name;
+                  this.startDate.day=data.val.split("-")[0];
+                  this.startDate.time=data.val.split("-")[1];
+                  //this.monthBoundObject.date=this.$moment(this.monthBoundObject.date).format('yyyy-MM')+'-'+this.startDate.day
+              }
+          }
+      },
+      handlerClose(){
+        this.timeModal=false;
+        this.$refs.sysFormRef.resetFields();
+      },
+      async saveStartDate(){
+        const params={...this.systemParams,val:this.startDate.day+'-'+this.startDate.time};
+        const {code} =await saveSystemConfigApi(params);
+        if(code===200){
+            this.$message.success('閰嶇疆鎴愬姛');
+            this.querySystemConfig();
+            this.timeModal=false;
+        }else{
+            this.$message.error('閰嶇疆澶辫触');
+        }
+      },
+     // 涓嬭浇
+     downHttpClick: _.debounce(function(){
+      downloadMonthStats({
+          date:this.monthBoundObject.date,
+          keyword: this.monthBoundObject.keyWord,
+          page: this.pagerOptions.currPage,
+          pageSize: this.pagerOptions.pageSize
+      }).then(res => {
+        if (res) {
+          FileSaver.saveAs(res, '鏈堝害缁熻鎶ヨ〃.xlsx');
+          this.$message.success("涓嬭浇鎴愬姛锛�");
+        }
+      })
+    }, 1000),
     getUnitValue(list,val,num,unit){
       let  string='--'
       if(list){
@@ -178,8 +298,8 @@
         showcol: this.showcol,
         allcol: [],
         tableColumn: this.setTableColumn(this.showcol)
-      }
-      let allcol = []
+      };
+      let allcol = [];
       for (let i = 0; i < this.tableList.tableColumn.length; i++) {
         if (!this.tableList.tableColumn[i].default) {
           const label = this.tableList.tableColumn[i].label
@@ -204,16 +324,17 @@
           isShowColumn: true,
           default: true
         },
-      ]
+      ];
       return tableColumn
     },
     selTableCol(val) {
-      this.showcol = val
+      this.showcol = val;
       this.tableList.tableColumn = this.setTableColumn(val)
     },
     // 搴撳瓨鎶ヨ〃璺宠浆璇锋眰鏁版嵁
     async getData() {
       this.isTableOneLoading = true;
+      //this.monthBoundObject.date=this.$moment(this.monthBoundObject.date).format('yyyy-MM')+'-'+this.startDate.day;
         await getmonthStats({
           date:this.monthBoundObject.date,
           keyword: this.monthBoundObject.keyWord,

--
Gitblit v1.8.0