zxz 2 years ago
parent
commit
f4eb7f9e12

+ 3 - 0
src/api/V2/warehouse/index.js

@@ -153,3 +153,6 @@ export const API_POST_DELETEINFO='/dryWarehouse/api/deleteDryWarehouse'
 export const API_GET_BINTYPE='/warehousePositionInfo/selectBinNumberList'
 // 发起人撤回
 export const API_SPONSOR_WITHDRAW ='/newWorkflow/api/stopInstance'
+API_EXPORT_ORDER
+// 导出入库单
+export const API_EXPORT_ORDER ='/warehousingOrder/exportWarehousingOrder'

+ 3 - 0
src/model/warehouse/index.js

@@ -75,6 +75,7 @@ import {
      API_POST_DELETEINFO,
      API_GET_BINTYPE,
     API_SPONSOR_WITHDRAW,
+    API_EXPORT_ORDER
     // API_GET_EXPENSEINFO
 } from '@/api/V2/warehouse'
 // import { app } from 'electron'
@@ -229,3 +230,5 @@ export const delRecord= appRx.post(API_POST_DELETEINFO,errorCatcher, errorHandle
 export const getbintype= appRx.get(API_GET_BINTYPE,errorCatcher, errorHandle, filter)
 // 发起人撤回
 export const sponsorWithdraw = appRx.post(API_SPONSOR_WITHDRAW, errorCatcher, errorHandle, filter)
+// 导出入库单
+export const exportOrder = appRx.post(API_EXPORT_ORDER)

+ 195 - 6
src/views/warehousenew/warehousingOrder.vue

@@ -62,6 +62,7 @@
       <el-col style='text-align:right;' :span="12">
         <!-- <ws-button v-hasPermission="
             `warehouseManagement.warehousingOrder.yufu`" type="primary" @click="interestrate()" >{{interestratevalue.value}}利率</ws-button> -->
+            <ws-button  type="primary" @click="exportList()">导出</ws-button>
         <ws-button v-hasPermission="
         `warehouseManagement.warehousingOrder.yufu`" type="primary" @click="fieldrations()">折干</ws-button>
         <ws-button v-hasPermission="
@@ -416,6 +417,34 @@
 
       </div>
     </el-dialog>
+    <div class="mask" v-show="isShowPrintType"></div>
+    <div class="print-type" v-show="isShowPrintType">
+      <div class="print-type-content">
+        <div class="print-type-title">{{headerText}}</div>
+        <div class="print-type-checkbox">
+          <el-form ref="form" label-width="110px">
+            <el-form-item label="起始日期">
+              <el-date-picker type="datetime" @change="startDataChange" format="yyyy-MM-dd HH:mm:ss"  value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择起始日期" v-model="parameter.exportStartDate"  default-time="00:00:00"></el-date-picker>
+            </el-form-item>
+            <el-form-item label="截止日期">
+              <el-date-picker type="datetime" @change="endDataChange" format="yyyy-MM-dd HH:mm:ss"  value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择截止日期" v-model="parameter.exportEndDate"  default-time="00:00:00">
+              </el-date-picker>
+            </el-form-item>
+            <!--仓库名称-->
+            <el-form-item label="仓库名称" span="1" prop="warehouseName" >
+              <el-select v-model="parameter.warehouseName" placeholder="请选择仓库名称" filterable clearable>
+                 <el-option  key="" label="全部仓库" value="全部仓库" />
+                <el-option v-for="item in warehouseList" :key="item.warehouseName" :label="item.warehouseName" :value="item.warehouseName" />
+              </el-select>
+            </el-form-item>
+          </el-form>
+        </div>
+      </div>
+      <div class="bottom-btn">
+        <el-button @click="submitClick()">确定</el-button>
+        <el-button @click="removePrint">取消</el-button>
+      </div>
+    </div>
     <!-- <el-dialog
       title="提示"
       :visible.sync="dialogVisible"
@@ -507,11 +536,12 @@ import {
   workflowhandle,
   getposition,
   dryout,
+  xiala,
   getenabledinfo,
   setenabledinfo,
   getbyname,
   sponsorWithdraw,
-  updateApprove
+  exportOrder
 } from '@/model/warehouse/index'
 import {
   selectWarehouseSelf,
@@ -544,7 +574,6 @@ export default {
   },
   data() {
     return {
-
       currectdata: {},
       //弹出框
       dialogViewSpareMoney: false,
@@ -553,10 +582,17 @@ export default {
       dataList: [],
       payeeinfo: [],
       title1:'',
+      StartDate:'',
+      EndDate:'',
       rejectshow:false,
       options: [],
+      isShowPrintType: false,
+      // warehouseAllXiaLa:[],
       textarea: '',
       weightGreater:'',
+      warehouseList:[],
+      // warehouseXiaLaCopy:[],
+      headerText: '入库单导出',
       dialogVisiblecontent: false,
       // 船舶类型
       monetaryKey: null,
@@ -641,6 +677,7 @@ export default {
       searchKeyWord: '',
       inOutType: '',
       contractType: 2,
+      warehouseType:1,
       auditdata:[],
       fieldrationsshow: false,
       // 提交类型
@@ -673,7 +710,15 @@ export default {
           return time.getTime() > Date.now()
         },
       },
-      warehouseList: [],
+      parameter:{
+          startDate:'',
+          endDate:'',
+        },
+        date: {
+          year: dayjs().format('YYYY'),
+          month: dayjs().format('MM'),
+        },
+      // warehouseList: [],
       currectfocusdata: {},
       customershow: false,
       interestratevalue: {},
@@ -707,6 +752,92 @@ export default {
     this.showType = this.isShow
   },
   methods: {
+    exportList() {
+          let date = new Date()
+          var year = date.getFullYear();
+          var month = date.getMonth() + 1;
+          var strDate = date.getDate()
+          if(strDate<10){ 
+             strDate = '0'+strDate
+          }
+          var pastdate = new Date(date.getTime() - 24 * 60 * 60 * 1000)
+          this.StartDate =pastdate.getFullYear() + '-' + (pastdate.getMonth() + 1) + '-' + (pastdate.getDate()>10?pastdate.getDate():'0'+pastdate.getDate())+' 00:00:00'
+          this.$set(this.parameter,'exportStartDate',this.StartDate)
+          this.EndDate = '' + year + '-' + month + '-' + strDate+' 00:00:00'
+          this.$set(this.parameter,'exportEndDate',this.EndDate)
+        this.$forceUpdate();
+        this.isShowPrintType = true
+        
+      },
+      startDataChange(e){
+          var d = new Date(e);
+          let year =  d.getFullYear()
+          let month =  (d.getMonth() + 1)
+          month= month<10?'0'+month:month
+          let date = d.getDate()<10?'0'+d.getDate():d.getDate()
+          let hours = d.getHours()<10?'0'+d.getHours():d.getHours()
+          let minutes = d.getMinutes()<10?'0'+d.getMinutes():d.getMinutes()
+          let seconds = d.getSeconds()<10?'0'+d.getSeconds():d.getSeconds()
+          this.parameter.exportStartDate = year + '-' + month+ '-' +date + ' '+hours+':'+minutes+':'+seconds;
+      },
+      endDataChange(e){
+            var d = new Date(e);
+            let year =  d.getFullYear()
+          let month =  (d.getMonth() + 1)
+          month= month<10?'0'+month:month
+          let date = d.getDate()<10?'0'+d.getDate():d.getDate()
+          let hours = d.getHours()<10?'0'+d.getHours():d.getHours()
+          let minutes = d.getMinutes()<10?'0'+d.getMinutes():d.getMinutes()
+          let seconds = d.getSeconds()<10?'0'+d.getSeconds():d.getSeconds()
+           this.parameter.exportEndDate = year + '-' + month+ '-' +date + ' '+hours+':'+minutes+':'+seconds;
+      },
+       removePrint() {
+        this.parameter.warehouseName = ''
+        this.isShowPrintType = false
+      },
+      // warehouseQuery(query){
+      //   if(query){
+      //     this.warehouseList = this.warehouseAllXiaLa
+      //     this.warehouseList = this.warehouseAllXiaLa.filter(item=>item.warehouseName.indexOf(query)>-1)
+      //   }else{
+      //     this.warehouseList = this.warehouseXiaLaCopy
+      //   }
+      // },
+      async submitClick() {
+        if (!this.parameter.exportStartDate) {
+          this.$message.error('请选择起始日期')
+          return
+        }
+        if (!this.parameter.exportEndDate) {
+          this.$message.error('请选择截止日期')
+          return
+        }
+        if (new Date(this.parameter.exportEndDate).getTime() < new Date(this.parameter.exportStartDate).getTime()) {
+          this.$message.error('截止日期输入错误')
+          return
+        }
+        if (this.parameter.warehouseName == '全部仓库') {
+          this.parameter.warehouseName = ''
+        }
+        this.isShowPrintType = false
+        const {
+          data
+        } = await exportOrder({
+          exportStartDate: this.parameter.exportStartDate,
+          exportEndDate: this.parameter.exportEndDate,
+          warehouseName: this.parameter.warehouseName,
+        }, {}, {
+          
+          responseType: 'blob'
+        }).toPromise()
+        downloadFile({
+          res: data,
+          fileName: `${this.date.year + (this.date.month ? `-${this.date.month}` : '')
+            }导出入库单`,
+          type: 'xls',
+        })
+        this.parameter.warehouseName = ''
+      },
     weightGreaterChange(e){
       this.getList()
     },
@@ -765,6 +896,8 @@ export default {
               }
             }
             this.baseId = this.warehouseList[i].id
+            
+
             break
           }
           this.reserve=this.reserve.toFixed(3)
@@ -772,6 +905,8 @@ export default {
         this.goodsName= '0'
         this.reserves = ''
       }
+      this.warehouseXiaLaCopy = this.warehouseList
+      this.warehouseAllXiaLa = this.warehouseList
       this.multipleSelection1={}
       this.getList()
     },
@@ -2166,7 +2301,61 @@ export default {
   padding: 10px;
 }
 
-// /deep/.el-table .cell{
-//   padding:0;
-// }
+//打印弹窗
+.mask {
+    background: black;
+    width: 100vw;
+    height: 100vh;
+    position: fixed;
+    top: 0;
+    z-index: 99;
+    opacity: 0.3;
+  }
+
+  .count {
+    text-align: center;
+    margin-bottom: 10px;
+  }
+
+  .print-type {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    margin: auto;
+    width: 400px;
+    height: 250px;
+    background: white;
+    border-radius: 10px;
+    z-index: 999;
+
+    .bottom-btn {
+      margin-top: 10px;
+      text-align: center;
+    }
+  }
+
+  .print-type-title {
+    text-align: center;
+    font-size: 18px;
+    // margin: 20px;
+    margin: 20px 20px 10px;
+  }
+
+  .print-type-checkbox {
+    padding-left: 20px;
+
+    .el-date-editor.el-input {
+      width: 85% !important;
+    }
+
+    .proportion_css {
+      width: 85%;
+    }
+  }
+    /deep/.el-table td,/deep/.el-table th{
+      text-align: center;
+     
+    }
 </style>