Ver código fonte

出库花材

shish 3 anos atrás
pai
commit
1b464f906e

+ 2 - 0
ghsApp/src/admin/itemClass/list.vue

@@ -150,6 +150,7 @@ export default {
                     id:item.id,
 					name: item.name,
 					inTurn: item.inTurn,
+					print:item.print
 				}			
 		},
 		operateList(index){
@@ -160,6 +161,7 @@ export default {
                     id:this.operateData.id,
 					name: this.operateData.name,
 					inTurn: this.operateData.inTurn,
+					print:this.operateData.print
 				}
 			}else if(index === 1) {
 				this.delModal = true

+ 4 - 0
ghsApp/src/api/product/index.js

@@ -94,6 +94,10 @@ export const generatePriceTable = data => {
 	return https.get("/product/generate-price-table", data);
 };
 
+export const generateItemTable = data => {
+	return https.get("/product/generate-item-table", data);
+};
+
 //所有花材
 export const allProduct = async data => {
 	return https.get("/product/all", data);

+ 35 - 1
ghsApp/src/pagesStorehouse/allot/allotEx.vue

@@ -27,6 +27,9 @@
 		</scroll-view>
 
 		<view class="app-footer open_btn">
+			<view @click="getItem()" class="admin-button-com big default" style="margin-right:80upx;">
+			出库花材
+			</view>
 			<view @click="addEvent" class="admin-button-com big blue">新增出库</view>
 		</view>
 	</view>
@@ -35,7 +38,7 @@
 <script>
 import Tabs from "@/components/plugin/tabs";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
-
+import { generateItemTable } from '@/api/product'
 import { list } from "@/mixins";
 import { getStockOutListApi } from "@/api/storehouse/stock";
 import { OUT_STATUS } from "@/utils/declare";
@@ -86,6 +89,37 @@ export default {
 		}
 	},
 	methods: {
+		getItem(){
+			uni.showLoading({title:'下载中',mask:true})
+			generateItemTable().then(res => {
+				if(res.code == 1){
+					uni.hideLoading()
+					let file = res.data.file
+					let shortFile = res.data.shortFile
+					uni.downloadFile({
+						url: file,
+						header: {"Content-Type": 'application/vnd.ms-excel'},
+						filePath: `${wx.env.USER_DATA_PATH}/${shortFile}`,
+						success: (res) => {
+							if (res.statusCode === 200) {
+								wx.saveFileToDisk({
+									filePath: res.filePath,
+									success: function(res) {
+										console.log(res)
+									},
+									fail:function(res) {
+										console.log(res)
+									}
+								})
+							}
+						},
+						fail:()=>{
+							uni.showToast({title:'请用电脑打开小程序下载',mask:true,icon:'none'})
+						}
+					});
+				}					
+			})
+		},
 		async initData() {
 			this._list();
 		},