|
@@ -723,36 +723,43 @@ export default {
|
723
|
723
|
r2 = Number(total.toString().replace('.', ''))
|
724
|
724
|
return r1 * r2 / Math.pow(10, m)
|
725
|
725
|
},
|
726
|
|
-
|
727
|
|
- exportList(){
|
728
|
|
- var obj = {index:"合计",total:0}
|
729
|
|
- obj.total = this.calTotalPrice()
|
730
|
|
- for(let i=0;i<this.tableList.length;i++){
|
731
|
|
- this.tableList[i].index = i+1
|
732
|
|
- this.tableList[i].min_unit = this.getUnit(this.tableList[i].good_unit)
|
733
|
|
- this.tableList[i].count = this.calCount(this.tableList[i])
|
734
|
|
- this.tableList[i].total = this.calTotal(this.tableList[i])
|
735
|
|
- this.tableList[i].price = this.tableList[i].query_warehousing_info[0].price
|
736
|
|
- this.tableList[i].remark = this.tableList[i].query_warehousing_info[0].remark
|
|
726
|
+ unique(arr) {
|
|
727
|
+ const res = new Map();
|
|
728
|
+ return arr.filter((arr) => !res.has(arr.specification_name) && res.set(arr.specification_name, 1));
|
|
729
|
+ },
|
|
730
|
+ exportList(){
|
|
731
|
+ var obj = {index:"合计",total:0}
|
|
732
|
+ obj.total = this.calTotalPrice()
|
|
733
|
+
|
|
734
|
+ for(let i=0;i<this.tableList.length;i++){
|
|
735
|
+ this.tableList[i].index = i+1
|
|
736
|
+ this.tableList[i].min_unit = this.getUnit(this.tableList[i].good_unit)
|
|
737
|
+ this.tableList[i].count = this.calCount(this.tableList[i])
|
|
738
|
+ this.tableList[i].total = this.calTotal(this.tableList[i])
|
|
739
|
+ this.tableList[i].price = this.tableList[i].query_warehousing_info[0].price
|
|
740
|
+ this.tableList[i].remark = this.tableList[i].query_warehousing_info[0].remark
|
737
|
741
|
|
738
|
|
- }
|
739
|
|
- this.tableList.push(obj)
|
740
|
|
- console.log("数据222222",this.tableList)
|
741
|
|
-
|
742
|
|
- import('@/vendor/Export2Excel').then(excel => {
|
743
|
|
- const tHeader = ['序号','耗材名称', '规格型号', '单位','数量','出货价','总价','备注']
|
744
|
|
- const filterVal = ['index','good_name', 'specification_name', 'min_unit','count','price','total','remark']
|
745
|
|
-
|
746
|
|
- const data = this.formatJson(filterVal, this.tableList)
|
747
|
|
-
|
748
|
|
- excel.export_json_to_excel({
|
749
|
|
- header: tHeader,
|
750
|
|
- data,
|
751
|
|
- filename: '耗材入库明细'
|
752
|
|
- })
|
753
|
|
- this.downloadLoading = false
|
754
|
|
- })
|
755
|
|
- },
|
|
742
|
+ }
|
|
743
|
+ var arr = this.unique(this.tableList)
|
|
744
|
+ console.log("arrrr",arr)
|
|
745
|
+ this.tableList = arr
|
|
746
|
+ this.tableList.push(obj)
|
|
747
|
+ console.log("数据222222",this.tableList)
|
|
748
|
+
|
|
749
|
+ import('@/vendor/Export2Excel').then(excel => {
|
|
750
|
+ const tHeader = ['序号','耗材名称', '规格型号', '单位','数量','出货价','总价','备注']
|
|
751
|
+ const filterVal = ['index','good_name', 'specification_name', 'min_unit','count','price','total','remark']
|
|
752
|
+
|
|
753
|
+ const data = this.formatJson(filterVal, this.tableList)
|
|
754
|
+
|
|
755
|
+ excel.export_json_to_excel({
|
|
756
|
+ header: tHeader,
|
|
757
|
+ data,
|
|
758
|
+ filename: '耗材入库明细'
|
|
759
|
+ })
|
|
760
|
+ this.downloadLoading = false
|
|
761
|
+ })
|
|
762
|
+ },
|
756
|
763
|
formatJson(filterVal, jsonData) {
|
757
|
764
|
return jsonData.map(v => filterVal.map(j => v[j]));
|
758
|
765
|
},
|