diff --git a/src/api/distribution/distributionStockArticle.js b/src/api/distribution/distributionStockArticle.js index 22b0c7e8..1fef8ccf 100644 --- a/src/api/distribution/distributionStockArticle.js +++ b/src/api/distribution/distributionStockArticle.js @@ -66,6 +66,16 @@ export const getQueryQRCode = (params) => { }) } +export const getStockTemplate = (params) => { + return request({ + url: '/api/logpm-distribution/distributionStockArticle/getPrintTemplate', + method: 'get', + params:{ + ...params + } + }) +} + export const remove = (ids) => { return request({ url: '/api/logpm-distribution/distributionStockArticle/remove', diff --git a/src/views/distribution/inventory/distributionStockArticleDetails.vue b/src/views/distribution/inventory/distributionStockArticleDetails.vue index 7086d249..7ae88547 100644 --- a/src/views/distribution/inventory/distributionStockArticleDetails.vue +++ b/src/views/distribution/inventory/distributionStockArticleDetails.vue @@ -247,7 +247,7 @@ - + 打 印 确 定 取 消 @@ -274,6 +274,8 @@ import option from "@/option/distribution/distributionStockArticle"; import { mapGetters } from "vuex"; import { getDictionaryBiz } from '@/api/system/dict'; import { getListMaterial } from '@/api/basic/basicMaterial'; +import { getLodop } from '@/utils/LodopFuncs'; +import { getStockTemplate } from '@/api/distribution/distributionStockArticle'; export default { data () { @@ -310,6 +312,7 @@ export default { formCall: {},// 通知 formService: {}, // 服务 formCustomer: {}, // 客户 + materialQRCode: {}, // 客户 // 选择行 selectionList: [], // 表单配置 @@ -365,7 +368,28 @@ export default { } }, methods: { - + printTemplate(){ + let lodop = getLodop(); + // console.log("this.ids>>>>>",this.ids); + // console.log("this.ids>>>>>",this.selectionList); + // if (this.selectionList.length === 0){ + // this.$message.warning("请选择至少一条数据"); + // return; + // } + getStockTemplate({id: this.materialQRCode.id }).then(res=>{ + console.log("返回的数据",res.data.data); + let templateData = res.data.data; + // let templateData = "res.data.data"; + // console.log(templateData); + LODOP.PRINT_INITA(1,1,770,660,"测试预览功能"); + LODOP.SET_PRINT_MODE("WINDOW_DEFPRINTER","Godex G500"); + // // 设置打印后自动关闭 + LODOP.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW", 1); + // // data就是一段html文本 + LODOP.ADD_PRINT_HTM("0%","0%","100%","100%",templateData); + LODOP.PREVIEW(); //预览(预览打印无脚标) + }) + }, //提交物品数据 handleSubmitMethod(){ // console.log(">>>",this.formMaterial); @@ -696,6 +720,7 @@ export default { // this.title = '查看' // this.view = true; // this.box = true; + this.materialQRCode = row; this.dialogVisible = true; let qr ={ id : row.id, diff --git a/src/views/distribution/inventory/distributionStockList.vue b/src/views/distribution/inventory/distributionStockList.vue index d3fa42de..6dd547cc 100644 --- a/src/views/distribution/inventory/distributionStockList.vue +++ b/src/views/distribution/inventory/distributionStockList.vue @@ -112,7 +112,26 @@ - + + + + + + + + + + + @@ -560,6 +585,7 @@ export default { option: option, // 表单列表 data: [], + optionsName: [], excelOption: { submitBtn: false, emptyBtn: false, @@ -706,6 +732,56 @@ export default { } }, methods: { + selectBlur(e){ + // console.log(">>>>>><<<<<<<",e); + let value = e.target.value; // 输入框值 + if(value) { // 只有输入才有这个值,下拉框选择的话 这个值为空 + // this.form.produce = value; + // console.log("获取的值",value); + this.formInline.materialIdName = value; + } + }, + /** + * 查询 + * */ + async remoteMethodName (query){ + if (query) { + this.loading = true; + //查询物料数据 + let asd = await getListMaterial(this.page.currentPage,this.page.pageSize,{ name: query,pid: this.stockList.materialId }).then(); + console.log("物料信息",asd.data.data); + if(!!asd.data.data){ + this.optionsName =asd.data.data.records; + } + this.loading = false; + } else { + this.optionsName = []; + } + }, + /** + * 物料选择赋值 + * */ + getMethodName(row,num){ + console.log("名称选择事件",row); + switch (num) { + case '1': + let a = this.optionsName.find( i => i.id == row); + console.log("aaaa>>",a); + if(!!a){ + this.formInline.materialCode = a.productCode; + this.formInline.cargoUnit = a.logpmUnit; + this.formInline.cargoNorms = a.packingSpecification; + this.formInline.cargoNumber = a.productCode; + this.formInline.packageNum = a.packageNum; + this.formInline.descriptionGoods = a.descriptionGoods; + this.formInline.sku = a.sku; + } + break; + case '2': + + break; + } + }, showdrawer(value){ this.drawerShow=value @@ -820,8 +896,6 @@ export default { }); }); - - this.onLoad(this.page); }, @@ -851,20 +925,15 @@ export default { // return ; // } if (!this.form.id) { + /* const regex = /^\d+$/; + if (regex.test(this.formInline.materialId)) { + // console.log("全是数字"); + asm.materialId = this.formInline.materialId + } else { + // console.log("包含非数字字符"); + asm.materialId = this.formInline.materialCode; + }*/ - // if(this.selectionListDismantle.length > 0){ - // console.log(this.selectionListDismantle); - // let shi = []; - // this.selectionListDismantle.forEach( i =>{ - // let a = { - // parcelsId : i.id, - // unpackingQuantity : i.need - // } - // shi.push(a); - // }) - // this.form.parcels = shi; - // } - // console.log("提交了"); if(parseInt(this.formInline.unpackingQuantity) >parseInt(this.getQuery.quantityStock)){ this.$message.warning("拆包数量大于在库数量!!!") return ; @@ -875,12 +944,11 @@ export default { this.formInline.storeNum = parseInt(numbers[0]) * parseInt(this.formInline.unpackingQuantity); } - this.formInline.id =this.stockList.id; + // this.formInline.id =this.stockList.id; this.formInline.materialId =this.stockList.materialId; this.formInline.marketId =this.stockList.marketId; this.formInline.storeId =!!this.stockList.storeId && this.stockList.storeId != '-1' ? this.stockList.storeId : null ; - console.log("提交的值",this.formInline); addParcels(this.formInline).then(() => { this.box = false; @@ -924,10 +992,12 @@ export default { }); }, handleViewDetails (row) { + console.log("row>>>>",row.row); this.$router.push({ path: '/distribution/inventory/distributionStockListDetails', query:{ - id: row.row.id, + marketId: row.row.marketId, + materialId: row.row.materialId, name: row.row.descriptionGoods+" — 明细" } }); @@ -952,7 +1022,7 @@ export default { console.log("adfadsfvasd",aa.data.data); this.getQuery = aa.data.data.records[0]; this.getQuery.quantityStock = row.row.quantityStock; - this.formInline.descriptionGoods = this.getQuery.name; + // this.formInline.descriptionGoods = this.getQuery.name; let q = this.distributionUnit.find( i => i.dictKey == this.getQuery.logpmUnit); this.getQuery.logpmUnitName = q.dictValue; // getListParcelDetails(this.pageDetails.currentPage,this.pageDetails.pageSize,par).then(res => { @@ -1043,7 +1113,9 @@ export default { this.data = data.records; this.data.forEach( i =>{ let a = this.distributionType.find( d =>d.dictKey == i.serviceType); - i.serviceTypeName = a.dictValue; + if(!!a){ + i.serviceTypeName = a.dictValue; + } if(i.unpack == false){ i.unpack = '否' }else{ diff --git a/src/views/distribution/inventory/distributionStockListDetails.vue b/src/views/distribution/inventory/distributionStockListDetails.vue index d88de0f0..3434b697 100644 --- a/src/views/distribution/inventory/distributionStockListDetails.vue +++ b/src/views/distribution/inventory/distributionStockListDetails.vue @@ -39,7 +39,7 @@ - {{!!queryOwn.storeName ? queryOwn.storeName : '无' }} + {{!queryOwn.storeName ? '无' : queryOwn.storeName }} @@ -483,7 +483,8 @@ export default { //查询出记录 async getOnChu(page, params = {}){ this.query={}; - this.query.stockListId = this.$route.query.id; + this.query.marketId = this.$route.query.marketId; + this.query.materialId = this.$route.query.materialId; let b =await getListStock(page.currentPage, page.pageSize, Object.assign(params, this.query)); this.data1 = b.data.data.records; this.data1.forEach( i =>{ @@ -510,7 +511,7 @@ export default { this.query.serviceType = this.queryOwn.serviceType; this.query.materialId = this.queryOwn.materialId; this.query.warehouseId = this.queryOwn.warehouseId; - this.query.storeId = !!this.queryOwn.storeId ? this.queryOwn.storeId : null; + this.query.storeId = !!this.queryOwn.storeId && this.queryOwn.storeId != '-1' ? this.queryOwn.storeId : null; if(this.queryOwn.pid != '-1' ){ this.query.pid = this.queryOwn.pid } @@ -526,7 +527,7 @@ export default { this.query.serviceType = this.queryOwn.serviceType; this.query.materialId = this.queryOwn.materialId; this.query.warehouseId = this.queryOwn.warehouseId; - this.query.storeId = !!this.queryOwn.storeId ? this.queryOwn.storeId : null; + this.query.storeId = !!this.queryOwn.storeId && this.queryOwn.storeId != '-1' ? this.queryOwn.storeId : null; let b =await getList(page.currentPage, page.pageSize, Object.assign(params, this.query)); this.data = b.data.data.records; console.log("库存品信息",this.data); @@ -535,7 +536,9 @@ export default { }, async onLoad (page, params = {}) { this.loading = true; - this.query.id = this.$route.query.id; + this.query.marketId = this.$route.query.marketId; + this.query.materialId = this.$route.query.materialId; + // getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { // const data = res.data.data; // this.page.total = data.total; @@ -546,11 +549,13 @@ export default { let a =await getList(page.currentPage, page.pageSize, Object.assign(params, this.query)); console.log("aaaa",a.data.data.records); this.queryOwn = a.data.data.records[0]; - if(this.queryOwn.pid == '-1' ){ + if(this.queryOwn.pid == '-1' || !this.queryOwn.pid ){ + console.log("11111111111"); //查全部 await this.getOnKu(page, params = {}); }else{ //查对应的数据 + console.log("2222222222"); await this.getOnKu(page, params = { pid: this.queryOwn.pid }); }