Browse Source

完善库存界面信息导出功能

Zhangqy 3 days ago
parent
commit
e443271fe1
1 changed files with 102 additions and 4 deletions
  1. 102
    4
      src/view/ware/storechange.vue

+ 102
- 4
src/view/ware/storechange.vue View File

@@ -89,7 +89,7 @@
89 89
 				</el-table-column>
90 90
 				<el-table-column prop="customer.name" label="订单客户" width="300" show-overflow-tooltip header-align="center">
91 91
 				</el-table-column>
92
-				<el-table-column prop="fkComponyId" label="客户名称" width="300" show-overflow-tooltip header-align="center">
92
+				<el-table-column prop="customer.name" label="客户名称" width="300" show-overflow-tooltip header-align="center">
93 93
 				</el-table-column>
94 94
 				<el-table-column prop="receiveAddress" label="收货地址" width="300" show-overflow-tooltip header-align="center">
95 95
 				</el-table-column>
@@ -179,6 +179,7 @@
179 179
 	import PopupDistribution from '@/components/PopupDistribution.vue'
180 180
 	import PopupOut from '@/components/PopupOut.vue'
181 181
 	import PopupIn from '@/components/PopupIn.vue'
182
+	import Export2Excel from '../../excel/Export2Excel.js'
182 183
 	import {
183 184
 		mapState
184 185
 	} from 'vuex'
@@ -236,8 +237,8 @@
236 237
 
237 238
 				currentPage: 1,
238 239
 				totalRows: 0,
239
-				pageSizes: [50, 100, 200],
240
-				pageSize: 50,
240
+				pageSizes: [50, 100, 200,1000],
241
+				pageSize: 1000,
241 242
 				HideAndShow: 0,
242 243
 
243 244
 
@@ -675,7 +676,104 @@
675 676
 			},
676 677
 			selectAll(selection){
677 678
 				this.selectRows = selection;
678
-			}
679
+			},
680
+
681
+			handleExport() {
682
+				var imptData = [];
683
+				var url = 'WareStore/queryStore.do'
684
+				var param = {
685
+					page: this.currentPage,
686
+					rows: this.pageSize,
687
+					wareName: this.query.wareName,
688
+					stackName: this.query.stackName,
689
+					model: this.query.model,
690
+					materialName: this.query.materialName,
691
+					standard: this.query.standard,
692
+					customerName: this.query.customerName
693
+				}
694
+
695
+
696
+				axios.get(url, param).then(response => {
697
+
698
+					if (response.data.code == 0) {
699
+						var imptData = response.data.data.list;
700
+						if (imptData.length == 0) {
701
+							this.$alert('无法导出,没有库存', '提示', {
702
+								confirmButtonText: '确定',
703
+								callback: action => {}
704
+							});
705
+						} else {
706
+
707
+							this.exportExcel(imptData)
708
+						}
709
+					} else {
710
+						this.$message({
711
+							type: 'error',
712
+							message: '操作失败;' + response.data.msg,
713
+						});
714
+					}
715
+
716
+				});
717
+				
718
+			},
719
+			exportExcel(imptData) {
720
+				// alert(JSON.stringify(imptData))
721
+				const header = ["层数"
722
+								,"垛位"
723
+								,"货物品名"
724
+								,"材质"
725
+								,"钢板号"
726
+								,"规格型号"
727
+								,"数量"
728
+								,"重量"
729
+								,"订单号"
730
+								,"合约号"
731
+								,"订单客户"
732
+								,"客户名称"
733
+								,"收货地址"
734
+								,"产地"
735
+								,"备注"
736
+								,"入库时间"
737
+
738
+				] // 导出的表头名
739
+				const filterVal = ["layer"
740
+									,"stackName"
741
+									,"materialName"
742
+									,"materialStandard"
743
+									,"plateNo"
744
+									,"model"
745
+									,"count"
746
+									,"weight"
747
+									,"ordNo"
748
+									,"contractNo"
749
+									,"customerName"
750
+									,"customerName"
751
+									,"receiveAddress"
752
+									,"productionPlace"
753
+									,"remark"
754
+									,"addTime"
755
+				]
756
+				for(var i=0;i<imptData.length;i++){
757
+					imptData[i]["stackName"] 			= imptData[i].stack.name;
758
+					imptData[i]["materialName"]     	= imptData[i].material.name;
759
+					imptData[i]["materialStandard"]     = imptData[i].material.standard;
760
+					imptData[i]["customerName"]     	= imptData[i].customer.name;
761
+				}
762
+				const list = imptData
763
+				const data = this.formatJson(filterVal, list)
764
+
765
+				const filename = '库存信息' + (new Date()).toLocaleDateString();
766
+				Export2Excel.export_json_to_excel({
767
+					header,
768
+					data,
769
+					filename
770
+				})
771
+			},
772
+			formatJson(filterVal, jsonData) {
773
+				return jsonData.map(v => filterVal.map(j => {
774
+					return v[j]
775
+				}))
776
+			},
679 777
 
680 778
 			//showChangeAddress() {},
681 779
 			// handleAddressSave() {

Loading…
Cancel
Save