Browse Source

货位二维码功能调整

dev-warehouse
kilo 2 years ago
parent
commit
82aeba788b
  1. 22
      src/api/basicdata/basicdataGoodsAllocation.js
  2. 9
      src/main.js
  3. 66
      src/option/basicdata/basicdataGoodsAllocation.js
  4. 2
      src/router/views/index.js
  5. 285
      src/views/basic/printTemplate/basicPrintTemplate.vue
  6. 94
      src/views/basicdata/warehouse/goodsAllocation/BasicdataGoodsAllocation.vue
  7. 41
      src/views/basicdata/warehouse/goodsShelf/basicdataGoodsShelf.vue

22
src/api/basicdata/basicdataGoodsAllocation.js

@ -48,3 +48,25 @@ export const update = (row) => {
})
}
export const getTemplate = (row) => {
return request({
url: '/api/logpm-basicdata/goodsAllocation/getTemplate',
method: 'post',
responseType: 'blob',
data: row
})
}
export const getQRCode = (qrCode) => {
return request({
url: '/api/logpm-basicdata/goodsAllocation/QRCodeImg',
method: 'get',
responseType: 'blob',
params:{
qrCode
}
})
}

9
src/main.js

@ -27,6 +27,10 @@ import dayjs from 'dayjs';
import 'styles/common.scss';
// 业务组件
import tenantPackage from './views/system/tenantpackage.vue';
// import AvueMap from 'avue-plugin-map';
// main.js
// import htmlToPdf from './utils/htmlToPdf'
window.$crudCommon = crudCommon;
window.axios = axios;
@ -46,6 +50,9 @@ app.config.globalProperties.website = website;
app.config.globalProperties.getScreen = getScreen;
app.use(error);
app.use(i18n);
// app.use(AvueMap);
// app.use(htmlToPdf)
app.use(store);
app.use(router);
app.use(ElementPlus, {
@ -57,4 +64,4 @@ app.use(Avue, {
locale: messages[language],
});
app.use(NfDesignBase);
app.mount('#app');
app.mount('#app');

66
src/option/basicdata/basicdataGoodsAllocation.js

@ -144,6 +144,7 @@ export default {
editDisplay: false,
align:'center',
labelWidth:'100',
},
{
label: '货架',
@ -165,7 +166,6 @@ export default {
editDisplay: false,
viewDisplay: false,
hide: true,
showAllLevels:false
},
{
label: "货位名称",
@ -175,22 +175,34 @@ export default {
editDisplay: true,
align:'center',
labelWidth:'100',
rules: [{
required: true,
message: "请输入货位名称",
trigger: "blur"
}]
},
{
label: "列编码",
prop: "rowNum",
label: "所在列",
prop: "columnNum",
type: "input",
align:'center',
labelWidth:'100',
addDisplay: true,
editDisplay: true,
viewDisplay: true,
hide: false,
},
{
label: "层编码",
prop: "storeyNum",
label: "所在层",
prop: "layerNum",
type: "input",
align:'center',
labelWidth:'100',
addDisplay: true,
editDisplay: true,
viewDisplay: true,
hide: false,
},
{
label: "启用状态",
@ -228,25 +240,29 @@ export default {
type: "input",
align:'center',
labelWidth:'100',
viewDisplay: true,
addDisplay: false,
editDisplay: false,
hide:true,
},
{
label: "二维码图片",
prop: "qrCodeUrl",
type: "upload",
dataType: 'string',
listType: 'picture-img',
hide: true,
labelWidth:'100',
span:11,
multiple:false,
width:"200px",
align:'left',
action: '/blade-resource/oss/endpoint/put-file',
propsHttp: {
res: 'data',
url: 'link',
},
}
// {
// label: "二维码图片",
// prop: "qrCodeUrl",
// type: "upload",
// dataType: 'string',
// listType: 'picture-img',
// hide: true,
// labelWidth:'100',
// span:11,
// multiple:false,
// width:"200px",
// align:'left',
//
// viewDisplay: true,
// addDisplay: false,
// editDisplay: false,
// },
]
}

2
src/router/views/index.js

@ -295,7 +295,7 @@ export default [
children: [
{
path: '/basic/printTemplate/basicPrintTemplateFrom',
name: '模板查看',
name: 'name',
meta: {
data: 'data',
},

285
src/views/basic/printTemplate/basicPrintTemplate.vue

@ -0,0 +1,285 @@
<template>
<basic-container>
<avue-crud :option="option"
v-model:search="search"
v-model:page="page"
v-model="form"
:table-loading="loading"
:data="data"
:permission="permissionList"
:before-open="beforeOpen"
:upload-after="uploadAfter"
:upload-before="uploadBefore"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
:cell-class-name="addClass"
@cell-click="pageto"
>
<template #menu-left>
<el-button type="danger"
icon="el-icon-delete"
plain
v-if="permission.basicPrintTemplate_delete"
@click="handleDelete">
</el-button>
<el-button type="warning"
plain
icon="el-icon-download"
@click="handleExport">
</el-button>
</template>
<!-- <template #menu="{size,row,index}">-->
<!-- <el-button type="primary" text @click="dowloadTemplate(row)">下载模板</el-button>-->
<!-- <el-button type="primary" text @click="viewTemplate(row)">查看模板</el-button>-->
<!-- </template>-->
</avue-crud>
</basic-container>
</template>
<script>
import {getList, getDetail, add, update, remove} from "@/api/basic/basicPrintTemplate";
import option from "@/option/basic/basicPrintTemplate";
import {mapGetters} from "vuex";
import {exportBlob} from "@/api/common";
import {getToken} from '@/utils/auth';
import {downloadXls} from "@/utils/util";
import {dateNow} from "@/utils/date";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
export default {
data() {
return {
form: {},
query: {},
search: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0
},
selectionList: [],
option: option,
data: [],
fileName:'',
};
},
computed: {
...mapGetters(["permission"]),
permissionList() {
return {
addBtn: this.validData(this.permission.basicPrintTemplate_add, false),
viewBtn: this.validData(this.permission.basicPrintTemplate_view, false),
delBtn: this.validData(this.permission.basicPrintTemplate_delete, false),
editBtn: this.validData(this.permission.basicPrintTemplate_edit, false)
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
},
methods: {
rowSave(row, done, loading) {
console.log("row",row);
row.fileName = this.fileName;
add(row).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
done();
}, error => {
loading();
window.console.log(error);
});
},
rowUpdate(row, index, done, loading) {
console.log(row);
console.log(",<<<<<<<<<<<<",this.form);
update(row).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
done();
}, error => {
loading();
console.log(error);
});
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
});
},
handleExport() {
let downloadUrl = `/blade-basicPrintTemplate/basicPrintTemplate/export-basicPrintTemplate?${this.website.tokenHeader}=${getToken()}`;
const {
} = this.query;
let values = {
};
this.$confirm("是否导出数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
NProgress.start();
exportBlob(downloadUrl, values).then(res => {
downloadXls(res.data, `打印模板信息${dateNow()}.xlsx`);
NProgress.done();
})
});
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
});
}
done();
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage){
this.page.currentPage = currentPage;
},
sizeChange(pageSize){
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
//
dowloadTemplate(row){
window.open(row.templateUrl,'_blank')
},
viewTemplate(row){
console.log('查看模板');
// window.open(row.templateUrl,'_blank')
},
uploadBefore(file, done, loading,column){
console.log("上传之前file",file);
this.fileName = file.name;
done(file);
},
uploadAfter(res, done, loading,column){
console.log("上传之前之后",res);
done();
},
addClass({ row, column, rowIndex, columnIndex }){
if (columnIndex===5 && !!row.fileName){
return "cell-color";
}
},
pageto(row, column, cell, event){
console.log("点击文件名称");
if (column.label == "文件名称") {
// let path = this.$router.push({
// path: row.templateUrl,
// });
window.open(row.templateUrl)
}
},
onLoad(page, params = {}) {
this.loading = true;
const {
templateName,
templateType,
printType,
} = this.query;
let values = {
templateName:templateName,
templateType:templateType,
printType:printType
};
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
}
}
};
</script>
<style>
.cell-color {
color: #409eff !important;
cursor: pointer;
}
</style>

94
src/views/basicdata/warehouse/goodsAllocation/BasicdataGoodsAllocation.vue

@ -19,6 +19,7 @@
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad">
<template #menu-left>
<el-button type="danger"
icon="el-icon-delete"
@ -31,13 +32,43 @@
icon="el-icon-download"
@click="handleExport">
</el-button>
<el-button type="warning"
plain
icon="el-icon-download"
@click="handleqr">查看二维码
</el-button>
</template>
</avue-crud>
<el-dialog
title="提示"
:visible.sync="dialogVisible"
width="30%"
v-model="dialogVisible">
<div >
<div v-for="(item,index) in qrCodeObj" class="pdf-dom">
<el-divider></el-divider>
<el-row>
<el-col :span="24" >
<el-image width="10" height="10" w-full :key="index" :src="item " alt="Preview Image"/>
</el-col>
</el-row>
</div>
</div>
<span slot="footer" class="dialog-footer">
<!-- <el-button type="primary" @click="ddd"> </el-button>-->
<el-button type="primary" @click="ccc"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</basic-container>
</template>
<script>
import {getList, getDetail, add, update, remove} from "@/api/basicdata/basicdataGoodsAllocation";
import {getList, getDetail, add, update, remove,getTemplate,getQRCode} from "@/api/basicdata/basicdataGoodsAllocation";
import option from "@/option/basicdata/basicdataGoodsAllocation";
import {mapGetters} from "vuex";
import {exportBlob} from "@/api/common";
@ -61,7 +92,11 @@
},
selectionList: [],
option: option,
data: []
data: [],
imgUrl:'',
qrCodeObj:[],
dialogVisible:false,
};
},
computed: {
@ -84,11 +119,13 @@
},
methods: {
rowSave(row, done, loading) {
console.log(">>>>>>",this.form);
//
console.log(this.form);
if (this.form.nodeInfo.length===1){
row.warehouseId=this.form.nodeInfo[0];
row.nodeInfo=null;
this.$message({
type:'warning',
message:'请先为该仓库添加货区'
})
}
if (this.form.nodeInfo.length===2){
console.log(">>>>>>",this.form.nodeInfo);
@ -97,11 +134,17 @@
row.nodeInfo=null;
}
if (this.form.nodeInfo.length===3){
console.log(">>>>>>",this.form.nodeInfo);
row.warehouseId=this.form.nodeInfo[0];
row.goodsAreaId=this.form.nodeInfo[1];
row.goodsShelfId=this.form.nodeInfo[2];
row.nodeInfo=null;
}else {
done();
this.$message({
type:'warning',
message:'请先完善货架信息!!!'
})
return;
}
add(row).then(() => {
this.onLoad(this.page);
@ -152,6 +195,10 @@
}
});
},
handleEdit(row){
console.log(">>>>>>",row);
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
@ -173,6 +220,25 @@
});
this.$refs.crud.toggleSelection();
});
},
handleqr(){
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.dialogVisible = true;
this.qrCodeObj=[];
this.selectionList.forEach(item=>{
console.log(">>>>>>>>>>",item);
//
let params={}
getTemplate(Object.assign(params,item)).then(res=>{
let url = window.URL.createObjectURL(res.data); // data
this.qrCodeObj.push(url);
})
})
},
handleExport() {
let downloadUrl = `/blade-BasicdataGoodsAllocation/BasicdataGoodsAllocation/export-BasicdataGoodsAllocation?${this.website.tokenHeader}=${getToken()}`;
@ -192,9 +258,17 @@
})
});
},
beforeOpen(done, type) {
async beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
await getDetail(this.form.id).then(async res => {
//
await getQRCode(this.form.qrCode).then(res=>{
let url = window.URL.createObjectURL(res.data);
console.log("url>>>>>>>",url);
this.form.qrCodeUrl = url;
console.log(res);
})
console.log(this.form);
this.form = res.data.data;
});
}
@ -243,13 +317,13 @@
values.goodsAreaId=nodeInfo[1];
values.goodsShelfId=nodeInfo[2];
}
console.log(">>>>>>>",values);
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data;
const data = res.data.data
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
}
}

41
src/views/basicdata/warehouse/goodsShelf/basicdataGoodsShelf.vue

@ -254,15 +254,6 @@
<el-image width="10" height="10" w-full :key="index" :src="item " alt="Preview Image"/>
</el-col>
</el-row>
<!-- <center>-->
<!-- <span>-->
<!-- <strong>货架名称:{{qrCodeObj.goodsShelfName[index]}}</strong>-->
<!-- </span>-->
<!-- <br/>-->
<!-- <span>-->
<!-- <strong>货架二维码:{{qrCodeObj.qrCode[index]}}</strong>-->
<!-- </span>-->
<!-- </center>-->
</div>
</div>
<span slot="footer" class="dialog-footer">
@ -520,26 +511,34 @@ export default {
}
},
//
bbb(params = {}){
bbb(){
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.dialogVisible = true;
this.qrCodeObj=[];
let obj={};
let idInfo = this.ids.split(",");
this.selectionList.forEach((item,index)=>{
if (item.qrCode){
params.goodsshelfName = item.goodsShelfName;
params.qrCode = item.qrCode;
params.storeyNum = item.storeyNum;
params.rowNum = item.rowNum;
getTemplate(params).then(res=>{
let url = window.URL.createObjectURL(res.data); // data
this.qrCodeObj.push(url);
idInfo.forEach(async id=>{
if (id===item.id){
let params = {};
if (item.qrCode){
getTemplate(Object.assign(params,item)).then(res=>{
let url = window.URL.createObjectURL(res.data); // data
this.qrCodeObj.push(url);
console.log('>>>>>>>>>>>>'+index,this.qrCodeObj);
})
}else {
console.log("参数异常:"+item.qrCode);
this.$message({
type: "error",
message: "参数异常!"+item.qrCode
});
}
}
})
})
}
})

Loading…
Cancel
Save