优化绑定查询功能

This commit is contained in:
hehaibing-1996
2025-02-13 10:02:49 +08:00
parent b23d568bb1
commit f3d825333c
6 changed files with 162 additions and 82 deletions

View File

@ -16,17 +16,13 @@
<text>数量:</text>
<text>{{item.matQty}}</text>
</view>
<view class="content-item" style="font-weight: 600;">
<text>盘点数量:</text>
<text>{{item.stocktakingQty}}</text>
</view>
<view class="content-combined">
<view class="content-item" style="font-weight: 600;color: firebrick;">
<view class="content-item" style="font-weight: 400;color: firebrick;">
<text>库位:</text>
<text>{{item.locationCode}}</text>
</view>
<view class="content-item" style="font-weight: 600;color: firebrick;">
<text>货架编码:</text>
<view class="content-item" style="font-weight: 400;color: firebrick;">
<text>货架:</text>
<text>{{item.shelfCode}}</text>
</view>
</view>

View File

@ -27,7 +27,7 @@
<text>{{item.locationCode}}</text>
</view>
<view class="content-item" style="font-weight: 600;color: firebrick;">
<text>货架编码:</text>
<text>货架:</text>
<text>{{item.shelfCode}}</text>
</view>
</view>

View File

@ -62,6 +62,34 @@
</view>
<view style="flex: 1;"></view>
</view>
<view style="display: flex;flex-direction: row;margin-bottom: 10rpx;margin-top: 30rpx;">
<view style="flex: 1;"></view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../bind/bind" hover-class="navigator-hover">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/shelfLocation.png" />
</view>
<view class="function-text">货架位置</view>
</navigator>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<!-- <navigator url="../stockTaking/stockTaking" hover-class="navigator-hover">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/stockTaking.png" />
</view>
<view class="function-text">库存盘点</view>
</navigator> -->
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<!-- <view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/task.png" />
</view>
<view class="function-text">任务管理</view> -->
</view>
<view style="flex: 1;"></view>
</view>
</view>
</template>

View File

@ -69,7 +69,8 @@
<view class="diy-flex-column" style="margin-top: 5rpx;">
<scroll-view class="scroll-view" scroll-y="true">
<view v-for="(item, index) in cardData" :key="index" @longpress="longpress(item)">
<view v-for="(item, index) in cardData" :key="index" @touchstart="cardTouchStart"
@touchmove="cardTouchMove" @longpress="longpress(item)">
<Card :item="item" :currentIndex="index" :cardData="cardData" />
</view>
</scroll-view>
@ -108,6 +109,9 @@
nextTick
} from 'vue';
import uniPopup from '@/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup';
import {
getCurrentInstance
} from 'vue';
export default {
components: {
@ -115,6 +119,9 @@
Card
},
setup() {
const {
proxy
} = getCurrentInstance();
// 不能修改的信息
const fixedInfo = {
infoId: 0,
@ -136,9 +143,6 @@
inputValue.value = info.matQty;
popup.value.open();
// nextTick(() => {
// inputRef.value.focus();
// });
};
const hidePopup = () => {
@ -175,7 +179,8 @@
//调用接口进行数量的修改
uni.request({
url: 'http://' + serverIPAndPort +'/matDetailCurrenInfo/updateMatDetailCurrentInfoById', // 请求的接口地址
url: 'http://' + serverIPAndPort +
'/matDetailCurrenInfo/updateMatDetailCurrentInfoById', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST
data: {
"matQty": inputValue.value,
@ -191,13 +196,14 @@
if (res.statusCode === 200) {
//接口返回数据为200 表示获取成功!
if (res.data.code == 200) {
hidePopup();
uni.showToast({
title: '修改成功!',
icon: 'none',
duration: 1200
duration: 2000
});
hidePopup();
proxy.queryMatList();
} else {
uni.showToast({
title: '修改失败:' + res.data.message,
@ -257,6 +263,11 @@
placeholderText: '请先扫描货架码',
matCodeCondition: '', //物料编码搜索条件
cardData: null,
//监控滑动的位置
touchStartX: 0,
touchStartY: 0,
isMove: false, //滑动标识 是否滑动
}
},
onShow: function() {
@ -274,21 +285,21 @@
analysisScanCode: function(encodedString) {
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
// 分割字符串并转换为字节数组
let byteStrings = encodedString.split(',');
let byteArray = [];
for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数
}
// 将字节数组转换为UTF-8字符串
// 注意这里使用了一个简单的循环来构建字符串因为String.fromCharCode.apply可能在大数据上性能不佳
let originalString = '';
for (let i = 0; i < byteArray.length; i++) {
// 对于每个字节使用fromCharCode转换为对应的字符
// 注意这里假设你的字节数组已经是正确的UTF-8编码并且不需要额外的处理来组合多字节字符
originalString += String.fromCharCode(byteArray[i]);
}
this.shelfCode = originalString;
// // 分割字符串并转换为字节数组
// let byteStrings = encodedString.split(',');
// let byteArray = [];
// for (let byteString of byteStrings) {
// byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数
// }
// // 将字节数组转换为UTF-8字符串
// // 注意这里使用了一个简单的循环来构建字符串因为String.fromCharCode.apply可能在大数据上性能不佳
// let originalString = '';
// for (let i = 0; i < byteArray.length; i++) {
// // 对于每个字节使用fromCharCode转换为对应的字符
// // 注意这里假设你的字节数组已经是正确的UTF-8编码并且不需要额外的处理来组合多字节字符
// originalString += String.fromCharCode(byteArray[i]);
// }
this.shelfCode = encodedString;
//调用接口获取当前工位信息 当前工位是否有货架
var serverIPAndPort = getServerIPAndPort();
uni.request({
@ -301,7 +312,7 @@
"userName": this.userName,
"deviceType": "PDA",
"pageNumber": 1,
"pageSize": 100
"pageSize": 300,
},
header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
@ -375,8 +386,6 @@
});
return;
}
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: 'http://' + serverIPAndPort +
@ -388,7 +397,7 @@
"userName": this.userName,
"deviceType": "PDA",
"pageNumber": 1,
"pageSize": 100
"pageSize": 300
},
header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
@ -459,18 +468,24 @@
this.cardData = null;
this.recordCount = 0;
},
//解决长按和滑动冲突的问题
cardTouchStart(e) {
this.isMove = false;
this.touchStartX = e.touches[0].clientX;
this.touchStartY = e.touches[0].clientY;
},
cardTouchMove(e) {
var deltaX = e.changedTouches[0].clientX - this.touchStartX;
var deltaY = e.changedTouches[0].clientY - this.touchStartY;
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
this.isMove = true;
}
},
//长按
longpress(item) {
// uni.showToast({
// title: '您长按了' + item.matCode,
// icon: 'none',
// duration: 1500
// });
if (this.isMove == false) {
this.showPopup(item);
//this.$refs.popup.open();
}
},
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -381,6 +381,7 @@ if (uni.restoreGlobal) {
const _imports_4 = "/static/callOut.png";
const _imports_5 = "/static/stockTaking.png";
const _imports_6 = "/static/task.png";
const _imports_7 = "/static/shelfLocation.png";
const _sfc_main$a = {
data() {
return {};
@ -520,6 +521,42 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { class: "function-text" }, "任务管理")
]),
vue.createElementVNode("view", { style: { "flex": "1" } })
]),
vue.createElementVNode("view", { style: { "display": "flex", "flex-direction": "row", "margin-bottom": "10rpx", "margin-top": "30rpx" } }, [
vue.createElementVNode("view", { style: { "flex": "1" } }),
vue.createElementVNode("view", {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../bind/bind",
"hover-class": "navigator-hover"
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
style: { "-webkit-justify-content": "center", "justify-content": "center" }
}, [
vue.createElementVNode("image", {
class: "function-image",
src: _imports_7
})
]),
vue.createElementVNode("view", { class: "function-text" }, "货架位置")
])
]),
vue.createElementVNode("view", {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createCommentVNode(' <navigator url="../stockTaking/stockTaking" hover-class="navigator-hover">\r\n <view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">\r\n <image class="function-image" src="/static/stockTaking.png" />\r\n </view>\r\n <view class="function-text">库存盘点</view>\r\n </navigator> ')
]),
vue.createElementVNode("view", {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createCommentVNode(' <view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">\r\n <image class="function-image" src="/static/task.png" />\r\n </view>\r\n <view class="function-text">任务管理</view> ')
]),
vue.createElementVNode("view", { style: { "flex": "1" } })
])
]);
}
@ -1877,23 +1914,10 @@ if (uni.restoreGlobal) {
/* TEXT */
)
]),
vue.createElementVNode("view", {
class: "content-item",
style: { "font-weight": "600" }
}, [
vue.createElementVNode("text", null, "盘点数量:"),
vue.createElementVNode(
"text",
null,
vue.toDisplayString($props.item.stocktakingQty),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "content-combined" }, [
vue.createElementVNode("view", {
class: "content-item",
style: { "font-weight": "600", "color": "firebrick" }
style: { "font-weight": "400", "color": "firebrick" }
}, [
vue.createElementVNode("text", null, "库位:"),
vue.createElementVNode(
@ -1906,9 +1930,9 @@ if (uni.restoreGlobal) {
]),
vue.createElementVNode("view", {
class: "content-item",
style: { "font-weight": "600", "color": "firebrick" }
style: { "font-weight": "400", "color": "firebrick" }
}, [
vue.createElementVNode("text", null, "货架编码:"),
vue.createElementVNode("text", null, "货架:"),
vue.createElementVNode(
"text",
null,
@ -2367,6 +2391,9 @@ if (uni.restoreGlobal) {
Card
},
setup() {
const {
proxy
} = vue.getCurrentInstance();
const fixedInfo = {
infoId: 0,
matCode: "示例名称",
@ -2433,12 +2460,13 @@ if (uni.restoreGlobal) {
success: (res) => {
if (res.statusCode === 200) {
if (res.data.code == 200) {
hidePopup();
uni.showToast({
title: "修改成功!",
icon: "none",
duration: 1200
duration: 2e3
});
hidePopup();
proxy.queryMatList();
} else {
uni.showToast({
title: "修改失败:" + res.data.message,
@ -2487,32 +2515,28 @@ if (uni.restoreGlobal) {
placeholderText: "请先扫描货架码",
matCodeCondition: "",
//物料编码搜索条件
cardData: null
cardData: null,
//监控滑动的位置
touchStartX: 0,
touchStartY: 0,
isMove: false
//滑动标识 是否滑动
};
},
onShow: function() {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:267", "Success:" + res.data);
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:278", "Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:270", "Error:", JSON.stringify(err));
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:281", "Error:", JSON.stringify(err));
});
},
methods: {
analysisScanCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
let byteStrings = encodedString.split(",");
let byteArray = [];
for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10));
}
let originalString = "";
for (let i = 0; i < byteArray.length; i++) {
originalString += String.fromCharCode(byteArray[i]);
}
this.shelfCode = originalString;
this.shelfCode = encodedString;
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/matDetailCurrenInfo/getMatDetailCurrentInfos",
@ -2525,7 +2549,7 @@ if (uni.restoreGlobal) {
"userName": this.userName,
"deviceType": "PDA",
"pageNumber": 1,
"pageSize": 100
"pageSize": 300
},
header: {
"Content-Type": "application/json"
@ -2575,7 +2599,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:362", "请求完成", event);
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:373", "请求完成", event);
}
});
},
@ -2600,7 +2624,7 @@ if (uni.restoreGlobal) {
"userName": this.userName,
"deviceType": "PDA",
"pageNumber": 1,
"pageSize": 100
"pageSize": 300
},
header: {
"Content-Type": "application/json"
@ -2650,7 +2674,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:449", "请求完成", event);
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:458", "请求完成", event);
}
});
},
@ -2660,11 +2684,26 @@ if (uni.restoreGlobal) {
this.cardData = null;
this.recordCount = 0;
},
//解决长按和滑动冲突的问题
cardTouchStart(e) {
this.isMove = false;
this.touchStartX = e.touches[0].clientX;
this.touchStartY = e.touches[0].clientY;
},
cardTouchMove(e) {
var deltaX = e.changedTouches[0].clientX - this.touchStartX;
var deltaY = e.changedTouches[0].clientY - this.touchStartY;
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
this.isMove = true;
}
},
//长按
longpress(item) {
if (this.isMove == false) {
this.showPopup(item);
}
}
}
};
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_0);
@ -2829,6 +2868,8 @@ if (uni.restoreGlobal) {
vue.renderList($data.cardData, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index,
onTouchstart: _cache[6] || (_cache[6] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[7] || (_cache[7] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onLongpress: ($event) => $options.longpress(item)
}, [
vue.createVNode(_component_Card, {
@ -2946,7 +2987,7 @@ if (uni.restoreGlobal) {
class: "content-item",
style: { "font-weight": "600", "color": "firebrick" }
}, [
vue.createElementVNode("text", null, "货架编码:"),
vue.createElementVNode("text", null, "货架:"),
vue.createElementVNode(
"text",
null,