+
+
{{ random.row[0] + random.row[1] - rowIndex - 1 +"层"}}
-
-
+
+
-
+ :id="`${direction}-${side}-${random.row[0] + random.row[1] - rowIndex - 1}-${column}`"
+ >
- {{column}}
-
+ {{column}}
+
@@ -47,23 +56,62 @@
-
+
-
- {{ getRandom(index, latticeColumn, nums.column, total.column) }}
-
-
-
-
-
+
+ {{ getRandom(index, latticeColumn, nums.column, total.column) }}
+
+
+
+
+
+
+
+
+ 人工核对正确
+
+
+
+ 退出
+
+
+ 上位标签:{{ wmsTrayCode }}
+ 扫码标签:{{ trayCode }}
+
@@ -78,76 +126,78 @@ export default {
default: () => {
return {
row: 1,
- column: 1
- }
- }
+ column: 1,
+ };
+ },
},
// 总共数据
- total:{
+ total: {
type: Object,
- default:()=>{
- return {}
- }
+ default: () => {
+ return {};
+ },
},
nums: {
type: Object,
default: () => {
return {
row: 20,
- column: 71
- }
- }
+ column: 71,
+ };
+ },
},
direction: {
type: Number,
default: () => {
- return {}
- }
+ return {};
+ },
},
side: {
type: Number,
default: () => {
- return {}
- }
+ return {};
+ },
},
-
+
streetId: {
type: Number,
default: () => {
- return {}
- }
+ return {};
+ },
},
streetName: {
type: String,
default: () => {
- return {}
- }
+ return {};
+ },
},
-
-
},
computed: {
// 应有的格子数
latticeRow() {
- return parseInt(this.total.row / this.nums.row) + (this.total.row % this.nums.row > 0 ? 1 : 0);
+ return (
+ parseInt(this.total.row / this.nums.row) +
+ (this.total.row % this.nums.row > 0 ? 1 : 0)
+ );
},
latticeColumn() {
- return parseInt(this.total.column / this.nums.column) + (this.total.column % this.nums.column > 0 ? 1 : 0);
+ return (
+ parseInt(this.total.column / this.nums.column) +
+ (this.total.column % this.nums.column > 0 ? 1 : 0)
+ );
},
random() {
-
return {
-
row: this.getRandomRow(this.select.row),
column: this.getRandomColumn(this.select.column),
- }
+ };
},
- watchDirection(){
+ watchDirection() {
return this.direction;
- },
- watchSide(){
+ },
+ watchSide() {
return this.side;
- },
+ },
},
watch: {
watchDirection() {
@@ -157,185 +207,304 @@ export default {
this.getStatus();
},
immediate: true,
-
},
data() {
return {
status: {
row: {},
- column: {}
+ column: {},
},
timer: null,
- }
+ trayCode: "",
+ wmsTrayCode: "",
+ visible: false,
+ confirmLoading: false,
+ id: "",
+ };
},
mounted() {
this.$nextTick(() => {
this.getStatus();
- })
- this.$on('hook:activated', () => {
+ });
+ this.$on("hook:activated", () => {
this.timer = window.setInterval(this.getStatus, 3000);
- })
+ });
this.timer = window.setInterval(this.getStatus, 3000);
- this.$on('hook:deactivated', () => {
- clearInterval(this.timer)
- this.timer = null
- })
+ this.$on("hook:deactivated", () => {
+ clearInterval(this.timer);
+ this.timer = null;
+ });
},
-
+
beforeDestroy() {
- console.log("beforeDestroy")
- window.clearInterval(this.timer);
+ console.log("beforeDestroy");
+ window.clearInterval(this.timer);
this.timer = null;
},
created() {
- var nameEQC = "s"+this.streetId+"d"+this.direction+"e"+this.side + "c" + "=";
- var nameEQR = "s"+this.streetId+"d"+this.direction+"e"+this.side + "r" + "=";
- var ca = document.cookie.split(';');
-
- for(var i=0;i < ca.length;i++) {
+ var nameEQC =
+ "s" +
+ this.streetId +
+ "d" +
+ this.direction +
+ "e" +
+ this.side +
+ "c" +
+ "=";
+ var nameEQR =
+ "s" +
+ this.streetId +
+ "d" +
+ this.direction +
+ "e" +
+ this.side +
+ "r" +
+ "=";
+ var ca = document.cookie.split(";");
+
+ for (var i = 0; i < ca.length; i++) {
var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
+ while (c.charAt(0) == " ") c = c.substring(1, c.length);
if (c.indexOf(nameEQC) == 0) {
- this.select.column = Number(c.substring(nameEQC.length,c.length));
+ this.select.column = Number(
+ c.substring(nameEQC.length, c.length)
+ );
}
if (c.indexOf(nameEQR) == 0) {
- this.select.row = Number(c.substring(nameEQR.length,c.length));
+ this.select.row = Number(c.substring(nameEQR.length, c.length));
}
-
}
},
destroyed() {
- window.clearInterval(this.timer);
+ window.clearInterval(this.timer);
this.timer = null;
},
-
- methods: {
- getTrayCode(row,column,direction){
- console.log(row,column,direction);
+ methods: {
+ showModal(trayCode, wmsTrayCode, id) {
+ this.trayCode = trayCode;
+ this.wmsTrayCode = wmsTrayCode;
+ this.id = id;
+ this.visible = true;
+ },
+ // 人工核对
+ handleOk(e) {
+ if (this.id != "") {
+ this.$api.httpApi
+ .stockCheckCorrect({
+ data: {
+ id: this.id,
+ ok: 1,
+ },
+ })
+ .then((res) => {
+ if (res.code == 200) {
+ this.$message.success("操作成功");
+ this.getStockInfo(this.row, this.column);
+ }
+ });
+ }
+ this.visible = false;
+ },
+ handleCancel(e) {
+ console.log("Clicked cancel button");
+ this.visible = false;
},
- changeTab(value){
- document.cookie = "s"+this.streetId+"d"+this.direction+"e"+this.side + "c"+ "=" +value;
+ getTrayCode(row, column, direction) {
+ console.log(row, column, direction);
+ },
+ changeTab(value) {
+ document.cookie =
+ "s" +
+ this.streetId +
+ "d" +
+ this.direction +
+ "e" +
+ this.side +
+ "c" +
+ "=" +
+ value;
- this.select.column = value
- this.getStatus()
+ this.select.column = value;
+ this.getStatus();
},
- changeTabLeft(value){
-
- document.cookie = "s"+this.streetId+"d"+this.direction+"e"+this.side + "r" + "=" +value;
-
- this.select.row = value
- this.getStatus()
+ changeTabLeft(value) {
+ document.cookie =
+ "s" +
+ this.streetId +
+ "d" +
+ this.direction +
+ "e" +
+ this.side +
+ "r" +
+ "=" +
+ value;
+ this.select.row = value;
+ this.getStatus();
},
// 获取行或列的范围字符串
getRandom(index, lattice, num, total) {
- if(index !== lattice) {
+ if (index !== lattice) {
return `${(index - 1) * num + 1} - ${index * num}`;
- }else {
+ } else {
return `${(index - 1) * num + 1} - ${total}`;
}
},
// 获取行和列的范围数组
getRandomRow(val) {
- console.log(" "+this.latticeRow);
- console.log(this.latticeRow + 1 - val, this.latticeRow, this.nums.row, this.total.row)
- return this.getRandom(this.latticeRow + 1 - val, this.latticeRow, this.nums.row, this.total.row).split(' - ').map(item => Number(item));
+ console.log(" " + this.latticeRow);
+ console.log(
+ this.latticeRow + 1 - val,
+ this.latticeRow,
+ this.nums.row,
+ this.total.row
+ );
+ return this.getRandom(
+ this.latticeRow + 1 - val,
+ this.latticeRow,
+ this.nums.row,
+ this.total.row
+ )
+ .split(" - ")
+ .map((item) => Number(item));
},
getRandomColumn(val) {
- return this.getRandom(val, this.latticeColumn, this.nums.column, this.total.column).split(' - ').map(item => Number(item));
+ return this.getRandom(
+ val,
+ this.latticeColumn,
+ this.nums.column,
+ this.total.column
+ )
+ .split(" - ")
+ .map((item) => Number(item));
},
-
- getStatusBg(row,column,status,trayCode) {
- var dom = document.getElementById(this.direction+"-"+this.side+"-"+row+'-'+column);
+
+ getStatusBg(row, column, status, trayCode, wmsTrayCode, id) {
+ var dom = document.getElementById(
+ this.direction + "-" + this.side + "-" + row + "-" + column
+ );
var color;
- if(status == -1){
- color = '#f2ed48'
- }else if(status == 2){
- color = '#1afa29'
- }else if( status == 3){
- color = '#4c71d8'
- }else if(status == 1){
- color = '#d81e06'
- }else if(status == 4){
- color = '#bc55cf'
- }else{
- color = '#bfbfbf'
+ if (status == -1) {
+ color = "#f2ed48";
+ } else if (status == 2) {
+ color = "#1afa29";
+ } else if (status == 3) {
+ color = "#4c71d8";
+ } else if (status == 1) {
+ color = "#d81e06";
+ } else if (status == 4) {
+ color = "#bc55cf";
+ } else {
+ color = "#bfbfbf";
}
- dom.style.background = color
- console.log(trayCode);
+ dom.style.background = color;
+ // console.log(trayCode);
if (trayCode != null && trayCode !== "") {
- dom.title ="rfid扫描结果:"+ trayCode
+ dom.title = "rfid扫描结果:" + trayCode;
+ dom.addEventListener("click", () => {
+ this.showModal(trayCode, wmsTrayCode, id); // 调用 showModal 方法,传递行列参数
+ });
}
-
},
- getStatus(){
-
- var columnTab = []
- for(let c = 1; c <= this.latticeColumn ;c++){
- let tab = this.getRandom(c,this.latticeColumn,this.nums.column,this.total.column)
- columnTab.push(tab)
+ getStatus() {
+ var columnTab = [];
+ for (let c = 1; c <= this.latticeColumn; c++) {
+ let tab = this.getRandom(
+ c,
+ this.latticeColumn,
+ this.nums.column,
+ this.total.column
+ );
+ columnTab.push(tab);
}
- var rowTab = []
- for(let r = 1; r <= this.latticeRow ;r++){
- let tab = this.getRandom(r,this.latticeRow,this.nums.row,this.total.row)
- rowTab.push(tab)
+ var rowTab = [];
+ for (let r = 1; r <= this.latticeRow; r++) {
+ let tab = this.getRandom(
+ r,
+ this.latticeRow,
+ this.nums.row,
+ this.total.row
+ );
+ rowTab.push(tab);
}
- this.$api.httpApi.getStatusByRowColumn({
- data: {
- columnStart: this.random.column[0],
- columnEnd: this.random.column[1],
- rowStart: this.random.row[0],
- rowEnd: this.random.row[1],
- streetId: this.streetId,
- direction: this.direction,
- side: this.side,
- rowTabs: rowTab,
- columnTabs: columnTab
- }
- }).then(res => {
- if(res.code == 200){
- if(res.data.stocks){
- for(let a of res.data.stocks){
- this.getStatusBg(a.row,a.column,a.status,a.trayCode)
+ this.$api.httpApi
+ .getStatusByRowColumn({
+ data: {
+ columnStart: this.random.column[0],
+ columnEnd: this.random.column[1],
+ rowStart: this.random.row[0],
+ rowEnd: this.random.row[1],
+ streetId: this.streetId,
+ direction: this.direction,
+ side: this.side,
+ rowTabs: rowTab,
+ columnTabs: columnTab,
+ },
+ })
+ .then((res) => {
+ if (res.code == 200) {
+ if (res.data.stocks) {
+ for (let a of res.data.stocks) {
+ this.getStatusBg(
+ a.row,
+ a.column,
+ a.status,
+ a.trayCode,
+ a.wmsTrayCode,
+ a.id
+ );
+ }
}
- }
-
- var i = 1;
- for(let a in res.data.columnTabStatus){
- this.$set(this.status.column, i, res.data.columnTabStatus[a]);
-
- i++;
- }
-
-
- var j = 0;
- for(let a in res.data.rowTabStatus){
- j++;
- }
- for(let a in res.data.rowTabStatus){
- this.$set(this.status.row, j, res.data.rowTabStatus[a]);
-
- j--;
- }
- }
- }).catch(err => {
- });
+ var i = 1;
+ for (let a in res.data.columnTabStatus) {
+ this.$set(
+ this.status.column,
+ i,
+ res.data.columnTabStatus[a]
+ );
+
+ i++;
+ }
+
+ var j = 0;
+ for (let a in res.data.rowTabStatus) {
+ j++;
+ }
+ for (let a in res.data.rowTabStatus) {
+ this.$set(
+ this.status.row,
+ j,
+ res.data.rowTabStatus[a]
+ );
+
+ j--;
+ }
+ }
+ })
+ .catch((err) => {});
},
- tocheckPage(row,column){
+ tocheckPage(row, column) {
this.$router.push({
- name: 'checkOperation',
- query: {row: row, column: column, direction: this.direction,side:this.side, streetId: this.streetId, name:this.streetName}
- })
- }
- }
-}
+ name: "checkOperation",
+ query: {
+ row: row,
+ column: column,
+ direction: this.direction,
+ side: this.side,
+ streetId: this.streetId,
+ name: this.streetName,
+ },
+ });
+ },
+ },
+};