zhangyuewww vor 2 Jahren
Ursprung
Commit
399e0ce211

+ 3 - 1
src/api/V2/taskspost/index.js

@@ -62,4 +62,6 @@ export const API_GET_GOODSOURCEINFO= '/warehousingOrder/selectGoodSourceInfo'
 // 退库选择任务
 export const API_GET_TASKNO= '/inOutWarehouseTask/getOutTaskNo'
 // 发起人撤回
-export const API_SPONSOR_WITHDRAW ='/newWorkflow/api/stopInstance'
+export const API_SPONSOR_WITHDRAW ='/newWorkflow/api/stopInstance'
+// 导出销售出库任务
+export const API_EXPOET_TASK ='/inOutWarehouseTask/exportSaleTask'

+ 6 - 3
src/model/tasksport/index.js

@@ -32,7 +32,8 @@ import {
     API_SET_CORRECT,
     API_GET_SOURCEOFGOODS,
     API_GET_GOODSOURCEINFO,
-    API_GET_TASKNO
+    API_GET_TASKNO,
+    API_EXPOET_TASK
 } from '@/api/V2/taskspost'
 //运输任务列表
 export const gain = appRx.get(API_GET_TRAN_LIST, errorCatcher, errorHandle, filter)
@@ -94,5 +95,7 @@ export const setcorrect = appRx.post(API_SET_CORRECT, errorCatcher, errorHandle,
 export const getSourceOfGoodsinfo = appRx.get(API_GET_GOODSOURCEINFO, errorCatcher, errorHandle, filter)
 //退库选择的任务编号
 export const gettaskNo = appRx.get(API_GET_TASKNO, errorCatcher, errorHandle, filter)
-	// 发起人撤回
-    export const sponsorWithdraw = appRx.post(API_SPONSOR_WITHDRAW, errorCatcher, errorHandle, filter)
+// 发起人撤回
+export const sponsorWithdraw = appRx.post(API_SPONSOR_WITHDRAW, errorCatcher, errorHandle, filter)
+// 导出销售出库任务
+export const exportSaleTask = appRx.post(API_EXPOET_TASK)

+ 159 - 1
src/views/taskManagement/tranManagementWarehouseInOutTask.vue

@@ -7,6 +7,10 @@
             `warehouseManagement.warehouse.warehouseInfoTask.add`
           ">添加
         </ws-button>
+         <ws-button type="primary" @click="outData()" v-hasPermission="
+            `warehouseManagement.warehouse.warehouseInfoTask.add`
+          ">导出销售出库任务
+        </ws-button>
       </template>
       <template slot="right">
         <el-select filterable v-model="warehouseNametext" placeholder class="typeselect" @change="warehousechange" :value="warehouseName">
@@ -150,6 +154,27 @@
           </template>
         </el-table-column>
       </el-table>
+      <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"  value-format="yyyy-MM-dd" placeholder="请选择起始日期" v-model="parameter.startDate"  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"  value-format="yyyy-MM-dd" placeholder="请选择截止日期" v-model="parameter.endDate"  default-time="00:00:00">
+              </el-date-picker>
+            </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-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
         :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal"></el-pagination>
   </div>
@@ -160,7 +185,8 @@
     outdelete,
     movestates,
     setcorrect,
-    sponsorWithdraw
+    sponsorWithdraw,
+    exportSaleTask
   } from '@/model/tasksport/index'
 
   import {
@@ -210,6 +236,8 @@
         year: '',
         gainList: [],
         currentPage: 1,
+        isShowPrintType: false,
+        headerText: '导出销售出库任务',
         primary: '1',
         pageSize: 10,
         searchType: '',
@@ -291,6 +319,10 @@
         submitType: true,
         size: 10,
         spanArr: [],
+        parameter:{
+          startDate:'',
+          endDate:'',
+        },
         warehouseNametext: '全部仓库',
         warehouseName:'',
         deptBudgetTotal: 0,
@@ -299,6 +331,10 @@
         deptCircularPage: {},
         historyList: [],
         staffList:[],
+        date: {
+          year: dayjs().format('YYYY'),
+          month: dayjs().format('MM'),
+        },
         pickerBeginDateBefore: {
           disabledDate: (time) => {
             return time.getTime() > Date.now()
@@ -332,6 +368,75 @@
       this.showType = this.isShow
     },
     methods: {
+       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.startDate = year + '-' + month+ '-' +date ;
+      },
+      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.endDate = year + '-' + month+ '-' +date;
+      },
+       removePrint() {
+        this.isShowPrintType = false
+      },
+      async submitClick() {
+        if (!this.parameter.startDate) {
+          this.$message.error('请选择导出的起始日期')
+          return
+        }
+        if (!this.parameter.endDate) {
+          this.$message.error('请选择导出的截止日期')
+          return
+        }
+        if (new Date(this.parameter.endDate).getTime() < new Date(this.parameter.startDate).getTime()) {
+          this.$message.error('截止日期输入错误')
+          return
+        }
+        const {
+          data
+        } = await exportSaleTask({
+          startDate: this.parameter.startDate,
+          endDate: this.parameter.endDate
+        }, {}, {
+          responseType: 'blob'
+        }).toPromise()
+              downloadFile({
+                res: data,
+                fileName: `${this.date.year + (this.date.month ? `-${this.date.month}` : '')
+                  }导出销售出库任务`,
+                type: 'xls',
+              })
+      },
+      downloadFile(url, fileName){ 
+        //fileurl文件地址(一般是接口返回) filename文件下载后的名字
+        const x = new XMLHttpRequest()
+        x.open('GET', url, true)
+        x.responseType = 'blob'
+        x.onload = function() {
+          const url = window.URL.createObjectURL(x.response)
+          const a = document.createElement('a')
+          a.href = url
+          a.download = fileName
+          a.click()
+          document.body.removeChild(a);
+          // 然后移除
+        }
+        x.send()
+      },
       rectify(row){
         this.$confirm('确定矫正出库任务重量并结束任务?', {
             confirmButtonText: '确定',
@@ -365,6 +470,23 @@
           path: 'tranManagementWarehouseInOuttaskAdd'
         })
       },
+      //导出
+      outData(index) {
+          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()-1) + '-' + (pastdate.getMonth() + 1) + '-' + strDate
+          this.$set(this.parameter,'startDate',this.StartDate)
+          this.EndDate = '' + year + '-' + month + '-' + strDate
+          this.$set(this.parameter,'endDate',this.EndDate)
+        this.$forceUpdate();
+        this.isShowPrintType = true
+      },
       //查找
       lookUp() {
         this.currentPage = 1
@@ -763,4 +885,40 @@
     color: #5878e8;
     font-size: 14px;
   }
+    .print-type {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    margin: auto;
+    width: 340px;
+    height: 250px;
+    background: white;
+    border-radius: 10px;
+    z-index: 999;
+
+    .bottom-btn {
+      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%;
+    }
+  }
 </style>