Commit 3478e042 by yucheng.jiang

储位信息维护

parent c9dee765
<template>
<div>
<div class="divborder leftDiv">
<Tree class="treeDiv" :data="data1" ref="tree" @on-select-change="getTypeid()"></Tree>
</div>
<div class="rightDiv">
<div class="divborder newSearchDiv">
<div class="filter">
<label>{{ $t(8070) }}</label>
<Select v-model="whid" label-in-value clearable filterable filter-by-label class="searchSelect">
<Option
v-for="(item,index) in whdata"
:value="item.id"
:key="index"
:label="item.name"
>{{ item.name }}</Option
>
</Select>
</div>
<div class="searchBtn">
<Button
type="success"
class="twoWord"
icon="md-add-circle"
@click="add()"
>{{$t('1002')}}</Button>
<Button
type="warning"
class="twoWord"
icon="ios-create-outline"
@click="edit()"
>{{$t('1003')}}</Button>
<Button
type="primary"
class="twoWord intervalRight"
icon="ios-cloud-download"
@click="print()"
>打印</Button>
<Button
type="primary"
class="fourWord"
icon="md-download"
@click="loadexcel()"
>{{$t('1005')}}</Button>
<Button type="primary" class="twoWord" icon="ios-search" @click="tosearch()">{{ $t(1001) }}</Button>
<Button type="success" class="twoWord" icon="md-add-circle" @click="add()">{{$t('1002')}}</Button>
<Button type="warning" class="twoWord" icon="ios-create-outline" @click="edit()">{{$t('1003')}}</Button>
<Button type="error" class="twoWord intervalRight" icon="md-close-circle" @click="dele()">{{ $t(1004) }}</Button>
<!-- <Button type="primary" class="twoWord intervalRight" icon="ios-cloud-download" @click="print()">打印</Button> -->
<Button type="primary" class="fourWord" icon="md-download" @click="loadexcel()">{{$t('1005')}}</Button>
<Upload
style="display:inline-block"
ref="upload"
......@@ -48,12 +38,7 @@
icon="md-cloud-upload"
>{{$t('1006')}}</Button>
</Upload>
<Button
type="primary"
class="fourWord"
icon="ios-cloud-download"
@click="Export()"
>{{$t('1007')}}</Button>
<Button type="primary" class="fourWord" icon="ios-cloud-download" @click="Export()">{{$t('1007')}}</Button>
</div>
</div>
<div class="divborder newTableDiv">
......@@ -79,71 +64,40 @@
</div>
</div>
</div>
<Modal class="newModalClass" v-model="modal" :styles="{width:'500px'}">
<Modal class="newModalClass" v-model="modal" :styles="{width:'400px'}">
<p slot="header">
<span v-show="type==1">添加储位信息</span>
<span v-show="type==2">修改储位信息</span>
<span v-show="type==1">{{$t('1002')}}</span>
<span v-show="type==2">{{$t('1003')}}</span>
</p>
<div>
<div style="max-height:250px;overflow: auto;">
<div class="filter">
<label>
<i>*</i>当前储位名称:
</label>
<Input type="text" class="searchInput" v-model="name1" />
</div>
<div class="filter row" v-show="type==2">
<label>是否停用:</label>
<Checkbox v-model="isdel" style="width:25px"></Checkbox>
<label><i>*</i>ID:</label>
<InputNumber type="number" class="searchInput" v-model="stid" :min="1" />
</div>
</div>
<div slot="footer">
<Button type="text" size="large" @click="closeadd()">{{$t('1033')}}</Button>
<Button type="primary" size="large" @click="adddata()">{{$t('1011')}}</Button>
</div>
</Modal>
</div>
<!-- 打印设备二维码 -->
<Modal
class="newModalClass"
:title="$t('5500098')"
v-model="downloadexe"
:styles="{width:'700px'}"
>
<div class="modal_body" style="width:700px!important;padding:0 20px;">
<div style="width:660px;padding-left:5px;">
<div>
<div class="filter">
<a
href="/static/lodop/CLodop_Setup_for_Win32NT.exe"
>{{$t('5500099')}}:CLodop_Setup_for_Win32NT.exe</a>
<br />
<a
href="/static/lodop/install_lodop32.exe"
>{{$t('5500099')}}:install_lodop32.exe</a>
<br />
<a
href="/static/lodop/install_lodop64.exe"
>{{$t('5500099')}}:install_lodop64.exe</a>
</div>
<label><i>*</i>{{ $t(8070) }}</label>
<Select v-model="whid1" label-in-value clearable filterable filter-by-label class="searchSelect">
<Option
v-for="(item,index) in whdata1"
:value="item.id"
:key="index"
:label="item.name"
>{{ item.name }}</Option
>
</Select>
</div>
<div class="filter" v-for="(item,index) in sTypes" :key="index">
<label><i>*</i>{{item.name}}</label>
<Input type="text" class="searchInput" v-model="item.val" />
</div>
<div class="filter row" v-show="type==2">
<label>是否停用:</label>
<Checkbox v-model="isdel" style="width:25px"></Checkbox>
</div>
</Modal>
<Modal
class="newModalClass"
:title="$t('100077')"
v-model="printModal"
:styles="{width:'300px'}"
>
<div id="print1">
<div id="printHtml" style="width:50px;"></div>
<div id="code" style="font-size:12px"></div>
</div>
<div slot="footer">
<Button type="text" size="large" @click="printModal = false">{{$t('1033')}}</Button>
<!-- <Button type="primary" size="large" v-print="'print1'">{{$t('1011')}}</Button> -->
<Button type="primary" size="large" @click="CreateOne()">{{$t('1011')}}</Button>
<Button type="text" size="large" @click="this.modal=false">{{$t('1033')}}</Button>
<Button type="primary" size="large" @click="addPost()">{{$t('1011')}}</Button>
</div>
</Modal>
</div>
......@@ -152,10 +106,7 @@
<script>
import axios from "@/libs/api.request";
import { getLodop } from "../../../static/Clodop/LodopFuncs";
// import { getLodop } from "@/assets/js/LodopFuncs";
import QRCode from "qrcodejs2";
export default {
data() {
return {
......@@ -166,8 +117,8 @@ export default {
nonce: localStorage.getItem("nonce"),
sign: localStorage.getItem("sign"),
},
data1: [],
name: "",
whdata:[],//仓库列表
whid:[],//选中仓库id
tableData1: [],
total: 0,
page: 1,
......@@ -184,31 +135,16 @@ export default {
);
},
},
{
title: "仓库",
key: "storageName",
},
{
title: "区域",
key: "area",
},
{
title: "货架",
key: "shelf",
},
{
title: "层号",
key: "floor",
},
{
title: "位置",
key: "location",
},
{
title: "是否停用",
key: "state",
},
],
storeTypes:[],//储位类别
sTypes:[],//储位类别
whid1:'',//添加仓库
whdata1:[],//仓库列表
stid:1,//储位id
data1: [],
name: "",
detailobj: {},
modal: false,
type: 1,
......@@ -228,71 +164,95 @@ export default {
};
},
created() {
this.getCategory();
this.search(1, 10);
this.initTableTitle();//获取列表标题
this.initStorage();
this.tosearch();
this.tableColumns1 = this.$time.initTableTitle(this.tableColumns1);
},
methods: {
getCategory() {
this.request("/wms/Location/GetLocationTypeTree", "", "get").then(
//仓库下拉框
initStorage(){
let data = {
page: 1,
pageSize: 1000000,
typeid: 0, // 产线层级id
name: '',
};
this.request("/wms/WaveHouse/GetWaveHouseList", data, "get").then(
(res) => {
// console.log(res.data);
if (res.data.ret == 1) {
this.data1 = res.data.data.children;
let arr = res.data.data.children;
this.contentTree(this.data1);
this.whdata = [];
this.whdata1 = [];
let data = res.data.data;
if (res.data.ret == 1&&Array.isArray(data)&&data.length) {
this.whdata = res.data.data;
this.whdata1 = res.data.data;
}
}
);
},
contentTree(arr) {
arr.forEach((ele) => {
ele.disabled = false;
// ele.value = ele.id;
// ele.label = ele.name;
ele.title = ele.name;
if (
ele.children.length != 0 &&
ele.children != undefined &&
ele.children != null
) {
this.contentTree(ele.children);
//获取列表标题
initTableTitle(){
let data = {
page: 1,
pageSize: 1000000
};
this.request('/wms/Location/GetLocationTypeList', data, 'get').then(
res => {
this.tableColumns1 = [
{
type: "index2",
title: this.$t("1008"),
key: "xuhao",
render: (h, params) => {
return h(
"span",
params.index + (this.page - 1) * this.pagesize + 1
);
},
},
{
key:'storageName',
title:this.$t('8070')
}
];
let data = res.data.data;
this.storeTypes = res.data.data;
if (res.data.ret == 1 && Array.isArray(data)&&data.length) {
data.forEach((item,key)=>{
this.tableColumns1.push({
key:'sm_'+key,
title:item.name
});
},
getTypeid() {
this.detailobj = {};
let node = this.$refs.tree.getSelectedNodes();
this.node = node;
// console.log(node)
if (node.length > 0) {
this.typeid = node[0].id;
this.typelevel = node[0].level == 0 ? 1 : 0;
this.search(1, 10);
} else {
this.typeid = 0;
this.typelevel = 0;
this.search(1, 10);
})
this.tableColumns1.push({
key:'state',
title:this.$t('920152')
})
}
}
);
},
search(page, pagesize) {
//查询储位
tosearch(){
this.page = 1;
this.pagesize = 10;
this.search();
},
search() {
let data = {
page: page,
pageSize: pagesize,
page: this.page,
pageSize: this.pagesize,
id: this.typeid, // 产线层级id
isWavehouse: this.typelevel,
};
this.page = page;
this.pagesize = pagesize;
this.detailobj = {};
this.request("/wms/Location/GetLocationList", data, "get").then(
(res) => {
this.total = 0;
this.tableData1 = [];
if (res.data.ret == 1) {
this.total = res.data.total;
this.renderTable(res.data.data);
} else {
// this.$Message.error(this.$t(res.data.msg));
this.tableData1 = [];
}
}
);
......@@ -306,107 +266,92 @@ export default {
pid: item.pid,
serialNumber: item.serialNumber,
storageName: item.storageName,
serial_number: item.serial_number,
area: item.field[0],
shelf: item.field[1],
floor: item.field[2],
location: item.field[3],
sm_0: item.field[0],
sm_1: item.field[1],
sm_2: item.field[2],
sm_3: item.field[3],
state: item.state == 1 ? "否" : "是",
});
});
}
this.tableData1 = data;
},
//添加弹窗
add() {
if (this.typeid == "") {
this.$Message.error("请先选择左边树形菜单");
//判断储位类别存不存在
if(!this.storeTypes || !this.storeTypes.length){
this.$Message.error("请先创建储位类别");
return false;
}
this.name1 = "";
this.type = 1;
this.sTypes = [];
this.storeTypes.forEach((item)=>{
this.sTypes.push({
id:item.id,
name:item.name,
val:''
})
})
this.whid1 = "";
this.stid = 1;
this.type = 1;//添加
this.modal = true;
},
adddata() {
let url = "",
msg = "";
// console.log(this.typelevel);
this.name1 = this.name1.trim();
if (this.name1 == "") {
this.$Message.error("请输入储位名称");
//添加提交
addPost(){
let code = 0;
if(!this.stid){
code = 1;
}
this.sTypes.forEach((item)=>{
if(item===""){
code = 1;
}
})
//编辑,不能修改仓库
if(this.type===1 && !this.whid1){
code = 1;
}
if(code === 1){
this.$Message.error(this.$t('9000136'));
return false;
}
let data = {
parentid: this.typeid,
name: this.name1,
status: 1,
type: this.typelevel == 1 ? 0 : 1,
};
if (this.type == 1) {
data.status = 1;
url = "/wms/Location/AddLocation";
msg = "添加成功";
} else {
data.id = this.detailobj.id
? this.detailobj.id
: this.node[0].id;
data.parentid = this.detailobj.pid
? this.detailobj.pid
: this.node[0].pid;
data.status = this.isdel == false ? 1 : 0;
data.type = 0;
url = "/wms/Location/UpdateLocation";
msg = "修改成功";
let url = '';
if(this.type===1){
url = '/wms/Location/AddLocation';
}else{
url = '/wms/Location/UpdateLocation';
}
this.request(url, data, "post").then((res) => {
if (res.data.ret == 1) {
this.$Message.success(msg);
this.search(1, 10);
this.getCategory();
this.detailobj = {};
this.modal = false;
if(this.type===1){
this.tosearch();
this.$Message.success(this.$t('1055'));
}
else{
this.$Message.success(this.$t('1060'));
this.search();
}
} else {
this.$Message.error(this.$t(res.data.msg));
setTimeout(() => {
this.modal = false;
}, 1000);
this.search(1, 10);
this.$Message.error(this.$t(res.data.msg+''));
}
});
},
edit() {
if (this.typelevel == 1) {
this.$Message.error("不能选择第一级仓库");
return false;
}
if (!this.detailobj.id && this.typeid == 0) {
this.$Message.error("请选择数据");
if (!this.detailobj || !this.detailobj.id ) {
this.$Message.error(this.$t('1017'));
return false;
}
if (this.detailobj.id) {
this.name1 = this.detailobj.location;
this.isdel = this.detailobj.isdel == "是";
}
if (this.typeid != 0) {
this.name1 = this.node[0].title;
this.isdel = this.detailobj.isdel == "是";
}
this.type = 2;
this.type = 2;//修改
this.modal = true;
},
closeadd() {
this.modal = false;
this.detailobj = {};
},
handleRowChange(currentRow, oldCurrentRow) {
this.detailobj = currentRow;
// console.log(this.detailobj);
},
handlePageSize(value) {
this.page = 1;
this.pagesize = value;
this.tableData1 = this.search(this.page, this.pagesize);
},
......@@ -414,147 +359,6 @@ export default {
this.page = value;
this.tableData1 = this.search(this.page, this.pagesize);
},
downexe() {
window.location.href =
"http://61.177.28.246:8102/Resources/tool/Lodop/CLodop_Setup_for_Win32NT.exe";
},
print() {
if (this.typeid == 0) {
this.$Message.error("请先选择左边树形菜单");
return false;
}
if (this.typelevel == 1) {
this.$Message.error("不能选择第一级仓库");
return false;
}
var data = {
id: this.typeid,
};
this.request("/wms/Print/GetLocation", data, "get").then((res) => {
if (res.data.ret == 1 && res.data.data.length > 0) {
let code = "", text = "",
arr = [];
arr = res.data.data[0];
code = arr[arr.length - 1].sn;
text = arr[arr.length - 1].v;
// console.log(code);
// return
document.getElementById("printHtml").innerHTML = "";
document.getElementById("code").innerHTML = "";
var qrcode = new QRCode(
document.getElementById("printHtml"),
{
text: code,
width: 40, // 生成的二维码的宽度
height: 40, // 生成的二维码的高度
colorDark: "#000000", // 生成的二维码的深色部分
colorLight: "#ffffff", // 生成二维码的浅色部分
correctLevel: QRCode.CorrectLevel.H,
}
);
document.getElementById("code").innerHTML = text;
this.printModal = true;
// this.getQrcode(code, "printHtml");
// var data = [];
// $.each(res.data.data, function (i, ele) {
// var arr = {};
// var sn = ""; // 编号
// var arr1 = [];
// $.each(ele, function (key, value) {
// sn = value.sn;
// var text = value.k + ":" + value.v;
// arr1.push(text);
// });
// arr.serinum = sn;
// arr.columns = arr1;
// data.push(arr);
// });
// var dataArray = {
// type: 1, // 二维码打印
// data: data,
// };
// console.log(dataArray);
// this.LaunchApp(JSON.stringify(dataArray));
// this.LaunchApp(dataArray);
} else {
alert(this.$t(res.msg));
}
});
},
CreateOne() {
LODOP = getLodop();
let list = document.getElementById("print1");
// console.log(list[i].innerHTML);
var html = "";
html = "<body>" + list.innerHTML;
("</body>");
LODOP.PRINT_INIT(""); // 打印初始化
// LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT", "60%");
LODOP.ADD_PRINT_HTM(20, 50, 400, 300, html);
// LODOP.PREVIEW(); // 打印预览
LODOP.PRINT();
},
LaunchApp(data) {
let LODOP = getLodop();
if (LODOP === undefined) {
this.downloadexe = true;
} else {
if (data) {
if (data.data.length > 0) {
data.data.forEach((item, index) => {
this.CreateOneFormPage(item);
});
}
}
}
// try {
// var ret = confirm('调用打印机?');
// if (ret == true) {
// window.location = 'myapp://' + data;
// }
// } catch (ex) {
// let errMsg = '启动 myapp 报错.\n\n';
// alert(errMsg);
// }
},
CreateOneFormPage(data) {
// 组装数据
var sn = data.serinum;
LODOP = getLodop(document.getElementById("LODOP1"));
LODOP.PRINT_INIT("储位打印");
LODOP.SET_PRINT_STYLE("FontSize", 14);
LODOP.SET_PRINT_STYLE("Bold", 1);
// LODOP.SET_PRINT_COPIES(2);//打印份数
// LODOP.SET_PRINT_PAGESIZE(1,700,500,"");//设定纸张大小及打印方式
LODOP.ADD_PRINT_BARCODE(30, 5, 130, 130, "QRCode", sn); // 二维码打印
data.columns.forEach((ele, index) => {
var num = 30 + index * 30;
var text = ele;
LODOP.ADD_PRINT_TEXT(num, 120, 300, 30, text);
});
LODOP.ADD_PRINT_TEXT(
30 + data.columns.length * 30,
120,
300,
30,
"编号:" + sn
);
// LODOP.ADD_PRINT_TEXT(30,120,300,30,"仓库:一仓");
// LODOP.ADD_PRINT_TEXT(60,120,300,30,"区域:原材区001");
// LODOP.ADD_PRINT_TEXT(90,120,300,30,"货架:货架001");
// LODOP.ADD_PRINT_TEXT(120,120,300,30,"组号:组号001");
// LODOP.ADD_PRINT_TEXT(150,120,300,30,"层号:层号001");
// LODOP.ADD_PRINT_TEXT(180,120,300,30,"编号:C1_H1_Z1_C1_001");
},
handleFormatError(file) {
this.$Message.error(
......@@ -604,28 +408,6 @@ export default {
}
);
},
// unloadexcel() {
// let file = this.readyFiles[0];
// const data = new FormData();
// data.append("file", file);
// data.append("type", 2);
// axios
// .request({
// url: "/tlm/Upload/Submit?templateName=TechToolList",
// data,
// method: "post"
// })
// .then(res => {
// if (res.ret === 1) {
// this.$Message.success(this.$t("100378"));
// } else {
// alert(res.data.msg);
// }
// })
// .catch(err => {
// alert(err.msg);
// });
// },
request(url, data, type) {
if (type == "get") {
return this.axios
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment