From d2dbf327d56fd6d931fff23a75f0e5a38f2aa316 Mon Sep 17 00:00:00 2001
From: chen.llin <1442464845@qq.comm>
Date: 星期六, 17 一月 2026 19:27:54 +0800
Subject: [PATCH] 增加清空缓存库位功能
---
pages/stock/locCacheLock.vue | 407 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 293 insertions(+), 114 deletions(-)
diff --git a/pages/stock/locCacheLock.vue b/pages/stock/locCacheLock.vue
index d9dc00a..2115891 100644
--- a/pages/stock/locCacheLock.vue
+++ b/pages/stock/locCacheLock.vue
@@ -7,10 +7,16 @@
<uni-icons type="scan" size="18" color="#667eea"></uni-icons>
<text class="label-text">缂撳瓨搴撲綅鍙�</text>
</view>
- <view class="form-input-wrap">
- <input class="form-input" type="text" placeholder="鎵爜 / 杈撳叆缂撳瓨搴撲綅鍙�" v-model="locNo"
- :focus="locNoFocus" @input="locNoInput()" @focus="onLocNoFocus()" @blur="onLocNoBlur()" />
- <uni-icons v-if="locNo" type="clear" size="18" color="#c0c4cc" @click="clearLocNo"></uni-icons>
+ <view class="form-input-row">
+ <view class="form-input-wrap">
+ <input class="form-input" type="text" placeholder="鎵爜 / 杈撳叆缂撳瓨搴撲綅鍙�" v-model="locNo"
+ :focus="locNoFocus" @input="locNoInput()" @focus="onLocNoFocus()" @blur="onLocNoBlur()" />
+ <uni-icons v-if="locNo" type="clear" size="18" color="#c0c4cc" @click="clearLocNo"></uni-icons>
+ </view>
+ <view class="btn-reset-inline" @click="reset()">
+ <uni-icons type="refresh" size="18" color="#909399"></uni-icons>
+ <text class="btn-text">閲嶇疆</text>
+ </view>
</view>
</view>
</view>
@@ -54,44 +60,25 @@
</view>
</view>
- <!-- 搴曢儴鎿嶄綔鎸夐挳 -->
+ <!-- 搴曢儴鎿嶄綔鎸夐挳锛堝鏄撴寜鐨勪綅缃級 -->
<view class="bottom-bar">
- <view class="btn-reset" @click="reset()">
- <uni-icons type="refresh" size="18" color="#909399"></uni-icons>
- <text class="btn-text">閲嶇疆</text>
- </view>
- <view class="btn-group">
- <view class="btn-unlock" :class="{'btn-disabled': !locCacheInfo || isSubmitting}" @click="unlockLoc()">
- <uni-icons type="unlocked" size="18" color="#ffffff"></uni-icons>
- <text class="btn-text">纭宸插彇璧板綋鍓嶅簱浣�</text>
+ <view class="btn-group-main">
+ <!-- 涓昏鎸夐挳锛堝乏渚э級 -->
+ <view class="btn-unlock-main" :class="{'btn-disabled': !locCacheInfo || isSubmitting}" @click="unlockLoc()">
+ <uni-icons type="unlocked" size="20" color="#ffffff"></uni-icons>
+ <text class="btn-text-main">纭宸插彇璧板綋鍓嶅簱浣�</text>
</view>
+ <!-- 鎺掓搷浣滄寜閽紙灏忎竴鐐癸紝鏀惧湪涓棿锛� -->
+ <view class="btn-row-small" v-if="locCacheInfo">
+ <view class="btn-unlock-row-small" :class="{'btn-disabled': isSubmitting}" @click="unlockRow()">
+ <uni-icons type="unlocked" size="14" color="#ffffff"></uni-icons>
+ <text class="btn-text-small">鍙栬蛋褰撳墠鎺�</text>
+ </view>
+ </view>
+ <!-- 鏍囪鍦ㄥ簱鎸夐挳锛堝彸渚э級 -->
<view class="btn-lock" :class="{'btn-disabled': !locCacheInfo || isSubmitting}" @click="lockLoc()">
<uni-icons type="locked" size="18" color="#ffffff"></uni-icons>
<text class="btn-text">鏍囪涓哄湪搴�</text>
- </view>
- </view>
- </view>
-
- <!-- 鍒楁搷浣滄寜閽� -->
- <view class="row-bar" v-if="locCacheInfo">
- <view class="btn-group-row">
- <view class="btn-unlock-row" :class="{'btn-disabled': isSubmitting}" @click="unlockBay()">
- <uni-icons type="unlocked" size="18" color="#ffffff"></uni-icons>
- <text class="btn-text">纭宸插彇璧板綋鍓嶅垪</text>
- </view>
- <view class="btn-lock-row" :class="{'btn-disabled': isSubmitting}" @click="lockBay()">
- <uni-icons type="locked" size="18" color="#ffffff"></uni-icons>
- <text class="btn-text">鏍囪褰撳墠鍒楀湪搴�</text>
- </view>
- </view>
- </view>
-
- <!-- 鎺掓搷浣滄寜閽� -->
- <view class="row-bar" v-if="locCacheInfo" style="margin-top: 10px;">
- <view class="btn-group-row">
- <view class="btn-unlock-row" :class="{'btn-disabled': isSubmitting}" @click="clearAllColumnsInRow()">
- <uni-icons type="trash" size="18" color="#ffffff"></uni-icons>
- <text class="btn-text">纭宸插彇璧板綋鍓嶆帓</text>
</view>
</view>
</view>
@@ -130,7 +117,7 @@
</view>
<view class="popup-footer">
<view class="popup-btn cancel" @click="closeFullPltDialog">鍙栨秷</view>
- <view class="popup-btn confirm" :class="{'disabled': selectedFullPlt === null}" @click="confirmFullPlt">纭</view>
+ <view class="popup-btn confirm" @click="confirmFullPlt">纭</view>
</view>
</view>
</uni-popup>
@@ -153,9 +140,9 @@
title: '',
content: '',
isSubmitting: false,
- actionType: '', // 'lock', 'unlock', 'lockBay', 'unlockBay'
+ actionType: '', // 'lock', 'unlock', 'lockRow', 'unlockRow'
actionLocNo: '',
- selectedFullPlt: null // true-婊℃墭, false-绌烘墭, null-鏈�夋嫨
+ selectedFullPlt: true // true-婊℃墭, false-绌烘墭锛岄粯璁ゆ弧鎵�
}
},
onLoad() {
@@ -248,7 +235,7 @@
if (!this.locCacheInfo || this.isSubmitting) return;
this.actionType = 'lock';
this.actionLocNo = this.locNo;
- this.selectedFullPlt = null;
+ this.selectedFullPlt = true; // 榛樿閫変腑婊℃墭
this.$refs.fullPltDialog.open();
},
// 纭宸插彇璧板綋鍓嶅簱浣�
@@ -260,56 +247,150 @@
this.content = '纭宸插彇璧板簱浣嶏細' + this.locNo + '锛�';
this.$refs.confirmDialog.open();
},
- // 鏍囪褰撳墠鍒楀湪搴�
- lockBay() {
+ // 纭宸插彇璧板綋鍓嶆帓锛堝彧澶勭悊1,2,3鍒楋級
+ unlockRow() {
if (!this.locCacheInfo || this.isSubmitting) return;
- this.actionType = 'lockBay';
+ this.actionType = 'unlockRow';
this.actionLocNo = this.locNo;
- this.selectedFullPlt = null;
+ this.title = '纭鎿嶄綔';
+ this.content = '纭宸插彇璧扮' + this.locCacheInfo.row1 + '鎺掔殑鎵�鏈夊簱浣嶏紙1銆�2銆�3鍒楋級锛�';
+ this.$refs.confirmDialog.open();
+ },
+ // 鏍囪褰撳墠鎺掑湪搴擄紙鍙鐞�1,2,3鍒楋級
+ lockRow() {
+ if (!this.locCacheInfo || this.isSubmitting) return;
+ this.actionType = 'lockRow';
+ this.actionLocNo = this.locNo;
+ this.selectedFullPlt = true; // 榛樿閫変腑婊℃墭
this.$refs.fullPltDialog.open();
- },
- // 纭宸插彇璧板綋鍓嶅垪
- unlockBay() {
- if (!this.locCacheInfo || this.isSubmitting) return;
- this.actionType = 'unlockBay';
- this.actionLocNo = this.locNo;
- this.title = '纭鎿嶄綔';
- this.content = '纭宸插彇璧扮' + this.locCacheInfo.bay1 + '鍒楃殑鎵�鏈夊簱浣嶏紵';
- this.$refs.confirmDialog.open();
- },
- // 纭宸插彇璧板綋鍓嶆帓
- clearAllColumnsInRow() {
- if (!this.locCacheInfo || this.isSubmitting) return;
- this.actionType = 'clearAllColumnsInRow';
- this.actionLocNo = this.locNo;
- this.title = '纭鎿嶄綔';
- this.content = '纭宸插彇璧扮' + this.locCacheInfo.row1 + '鎺掔殑鎵�鏈夊簱浣嶏紙鎵�鏈夊垪锛夛紵';
- this.$refs.confirmDialog.open();
},
// 閫夋嫨婊℃墭/绌烘墭
selectFullPlt(fullPlt) {
this.selectedFullPlt = fullPlt;
},
- // 纭婊℃墭/绌烘墭閫夋嫨
+ // 纭婊℃墭/绌烘墭閫夋嫨锛堢洿鎺ユ墽琛岋紝涓嶅啀寮瑰嚭浜屾纭锛�
confirmFullPlt() {
- if (this.selectedFullPlt === null) return;
+ // 榛樿閫変腑婊℃墭锛屾墍浠ヤ笉闇�瑕佹鏌ull
this.$refs.fullPltDialog.close();
- // 鏄剧ず纭瀵硅瘽妗�
- if (this.actionType === 'lock') {
- this.title = '纭鏍囪';
- this.content = '纭灏嗗簱浣嶏細' + this.actionLocNo + ' 鏍囪涓哄湪搴擄紙' + (this.selectedFullPlt ? '婊℃墭' : '绌烘墭') + '锛夛紵';
- } else if (this.actionType === 'lockBay') {
- this.title = '纭鏍囪';
- this.content = '纭灏嗙' + this.locCacheInfo.bay1 + '鍒楃殑鎵�鏈夊簱浣嶆爣璁颁负鍦ㄥ簱锛�' + (this.selectedFullPlt ? '婊℃墭' : '绌烘墭') + '锛夛紵';
- }
- this.$refs.confirmDialog.open();
+ // 鐩存帴鎵ц鎿嶄綔锛屼笉鍐嶅脊鍑虹‘璁ゅ璇濇
+ this.executeLockAction();
},
// 鍏抽棴婊℃墭/绌烘墭閫夋嫨寮圭獥
closeFullPltDialog() {
this.$refs.fullPltDialog.close();
- this.selectedFullPlt = null;
+ this.selectedFullPlt = true; // 閲嶇疆涓洪粯璁ゅ�硷紙婊℃墭锛�
},
- // 纭鎿嶄綔
+ // 鎵ц閿佸畾鎿嶄綔锛堜粠婊℃墭/绌烘墭閫夋嫨寮圭獥鐩存帴璋冪敤锛�
+ executeLockAction() {
+ if (this.isSubmitting) return;
+
+ this.isSubmitting = true;
+ let that = this;
+ let url = '';
+ let data = {};
+
+ if (this.actionType === 'lock') {
+ // 閿佸畾鍗曚釜搴撲綅
+ url = that.baseUrl + '/locCache/lockOrUnlock/auth';
+ // 纭繚 locNo 鏈夊�硷紝浼樺厛浣跨敤 actionLocNo锛屽鏋滄病鏈夊垯浣跨敤 locNo
+ var locNoValue = that.actionLocNo || that.locNo;
+ if (!locNoValue) {
+ that.messageText = "搴撲綅鍙蜂笉鑳戒负绌�";
+ that.msgType = 'error';
+ that.$refs.message.open();
+ that.isSubmitting = false;
+ return;
+ }
+ data = {
+ locNo: locNoValue,
+ lock: true,
+ fullPlt: that.selectedFullPlt
+ };
+ } else if (this.actionType === 'lockRow') {
+ // 閿佸畾褰撳墠鎺掞紙鍙鐞�1,2,3鍒楋級
+ url = that.baseUrl + '/locCache/lockOrUnlockRow/auth';
+ // 纭繚 locNo 鏈夊�硷紝浼樺厛浣跨敤 actionLocNo锛屽鏋滄病鏈夊垯浣跨敤 locNo
+ var locNoValue = that.actionLocNo || that.locNo;
+ if (!locNoValue) {
+ that.messageText = "搴撲綅鍙蜂笉鑳戒负绌�";
+ that.msgType = 'error';
+ that.$refs.message.open();
+ that.isSubmitting = false;
+ return;
+ }
+ data = {
+ locNo: locNoValue,
+ lock: true,
+ fullPlt: that.selectedFullPlt
+ };
+ } else {
+ that.isSubmitting = false;
+ return;
+ }
+
+ // 灏嗘暟鎹浆鎹负琛ㄥ崟鏍煎紡锛圲RL缂栫爜锛�
+ let formData = '';
+ for (let key in data) {
+ if (data.hasOwnProperty(key)) {
+ if (formData !== '') formData += '&';
+ formData += encodeURIComponent(key) + '=' + encodeURIComponent(data[key]);
+ }
+ }
+
+ uni.request({
+ url: url,
+ method: 'POST',
+ data: formData,
+ header: {
+ 'token': uni.getStorageSync('token'),
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ },
+ success(result) {
+ var res = result.data;
+ if (res.code === 200) {
+ let actionDesc = '';
+ if (that.actionType === 'lock') {
+ actionDesc = '鏍囪涓哄湪搴擄紙' + (that.selectedFullPlt ? '婊℃墭' : '绌烘墭') + '锛�';
+ } else if (that.actionType === 'lockRow') {
+ actionDesc = '鏍囪褰撳墠鎺掑湪搴擄紙' + (that.selectedFullPlt ? '婊℃墭' : '绌烘墭') + '锛�';
+ }
+ that.messageText = actionDesc + '鎴愬姛';
+ that.msgType = 'success';
+ that.$refs.message.open();
+ // 鎿嶄綔鎴愬姛鍚庯紝娓呯┖鏂囨湰妗嗗拰搴撲綅淇℃伅锛屾柟渚跨敤鎴疯緭鍏ユ柊鐨勫簱浣嶅彿
+ that.locNo = '';
+ that.locCacheInfo = null;
+ that.selectedFullPlt = true; // 閲嶇疆涓洪粯璁ゅ�硷紙婊℃墭锛�
+ // 鑱氱劍鍒拌緭鍏ユ
+ setTimeout(() => {
+ that.locNoFocus = true;
+ }, 100);
+ } else if (res.code == 403) {
+ that.messageText = res.msg;
+ that.msgType = 'error';
+ that.$refs.message.open();
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../login/login'
+ });
+ }, 1000);
+ } else {
+ that.messageText = res.msg || "鎿嶄綔澶辫触";
+ that.msgType = 'error';
+ that.$refs.message.open();
+ }
+ },
+ fail: () => {
+ that.messageText = "缃戠粶璇锋眰瓒呮椂";
+ that.msgType = 'error';
+ that.$refs.message.open();
+ },
+ complete: () => {
+ that.isSubmitting = false;
+ }
+ });
+ },
+ // 纭鎿嶄綔锛堢敤浜庤В閿佹搷浣滐級
confirmAction() {
if (this.isSubmitting) return;
@@ -318,68 +399,79 @@
let url = '';
let data = {};
- if (this.actionType === 'lock' || this.actionType === 'unlock') {
- // 閿佸畾/瑙i攣鍗曚釜搴撲綅
+ if (this.actionType === 'unlock') {
+ // 瑙i攣鍗曚釜搴撲綅
url = that.baseUrl + '/locCache/lockOrUnlock/auth';
- data = {
- locNo: that.actionLocNo,
- lock: that.actionType === 'lock'
- };
- // 濡傛灉鏄攣瀹氭搷浣滐紝闇�瑕佷紶閫抐ullPlt鍙傛暟
- if (that.actionType === 'lock') {
- data.fullPlt = that.selectedFullPlt;
+ // 纭繚 locNo 鏈夊�硷紝浼樺厛浣跨敤 actionLocNo锛屽鏋滄病鏈夊垯浣跨敤 locNo
+ var locNoValue = that.actionLocNo || that.locNo;
+ if (!locNoValue) {
+ that.messageText = "搴撲綅鍙蜂笉鑳戒负绌�";
+ that.msgType = 'error';
+ that.$refs.message.open();
+ that.isSubmitting = false;
+ return;
}
- } else if (this.actionType === 'lockBay' || this.actionType === 'unlockBay') {
- // 閿佸畾/瑙i攣褰撳墠鍒�
- url = that.baseUrl + '/locCache/lockOrUnlockBay/auth';
data = {
- locNo: that.actionLocNo,
- lock: that.actionType === 'lockBay'
+ locNo: locNoValue,
+ lock: false
};
- // 濡傛灉鏄攣瀹氭搷浣滐紝闇�瑕佷紶閫抐ullPlt鍙傛暟
- if (that.actionType === 'lockBay') {
- data.fullPlt = that.selectedFullPlt;
+ } else if (this.actionType === 'unlockRow') {
+ // 瑙i攣褰撳墠鎺掞紙鍙鐞�1,2,3鍒楋級
+ url = that.baseUrl + '/locCache/lockOrUnlockRow/auth';
+ // 纭繚 locNo 鏈夊�硷紝浼樺厛浣跨敤 actionLocNo锛屽鏋滄病鏈夊垯浣跨敤 locNo
+ var locNoValue = that.actionLocNo || that.locNo;
+ if (!locNoValue) {
+ that.messageText = "搴撲綅鍙蜂笉鑳戒负绌�";
+ that.msgType = 'error';
+ that.$refs.message.open();
+ that.isSubmitting = false;
+ return;
}
- } else if (this.actionType === 'clearAllColumnsInRow') {
- // 娓呯┖鏁存帓锛堟墍鏈夊垪锛�
- url = that.baseUrl + '/locCache/clearAllColumnsInRow/auth';
data = {
- locNo: that.actionLocNo,
- lock: false // 娓呯┖鎿嶄綔锛宭ock=false
+ locNo: locNoValue,
+ lock: false
};
+ } else {
+ that.isSubmitting = false;
+ return;
+ }
+
+ // 灏嗘暟鎹浆鎹负琛ㄥ崟鏍煎紡锛圲RL缂栫爜锛�
+ let formData = '';
+ for (let key in data) {
+ if (data.hasOwnProperty(key)) {
+ if (formData !== '') formData += '&';
+ formData += encodeURIComponent(key) + '=' + encodeURIComponent(data[key]);
+ }
}
uni.request({
url: url,
method: 'POST',
- data: data,
+ data: formData,
header: {
- 'token': uni.getStorageSync('token')
+ 'token': uni.getStorageSync('token'),
+ 'Content-Type': 'application/x-www-form-urlencoded'
},
success(result) {
var res = result.data;
if (res.code === 200) {
let actionDesc = '';
- if (that.actionType === 'lock') {
- actionDesc = '鏍囪涓哄湪搴擄紙' + (that.selectedFullPlt ? '婊℃墭' : '绌烘墭') + '锛�';
- } else if (that.actionType === 'unlock') {
+ if (that.actionType === 'unlock') {
actionDesc = '纭宸插彇璧板綋鍓嶅簱浣�';
- } else if (that.actionType === 'lockBay') {
- actionDesc = '鏍囪褰撳墠鍒楀湪搴擄紙' + (that.selectedFullPlt ? '婊℃墭' : '绌烘墭') + '锛�';
- } else if (that.actionType === 'unlockBay') {
- actionDesc = '纭宸插彇璧板綋鍓嶅垪';
- } else if (that.actionType === 'clearAllColumnsInRow') {
+ } else if (that.actionType === 'unlockRow') {
actionDesc = '纭宸插彇璧板綋鍓嶆帓';
}
that.messageText = actionDesc + '鎴愬姛';
that.msgType = 'success';
that.$refs.message.open();
- // 閲嶆柊鏌ヨ搴撲綅淇℃伅
+ // 鎿嶄綔鎴愬姛鍚庯紝娓呯┖鏂囨湰妗嗗拰搴撲綅淇℃伅锛屾柟渚跨敤鎴疯緭鍏ユ柊鐨勫簱浣嶅彿
+ that.locNo = '';
+ that.locCacheInfo = null;
+ // 鑱氱劍鍒拌緭鍏ユ
setTimeout(() => {
- that.queryLocCache();
- }, 500);
- // 閲嶇疆閫夋嫨
- that.selectedFullPlt = null;
+ that.locNoFocus = true;
+ }, 100);
} else if (res.code == 403) {
that.messageText = res.msg;
that.msgType = 'error';
@@ -414,7 +506,7 @@
reset() {
this.locNo = '';
this.locCacheInfo = null;
- this.selectedFullPlt = null;
+ this.selectedFullPlt = true; // 閲嶇疆涓洪粯璁ゅ�硷紙婊℃墭锛�
this.locNoFocus = false;
setTimeout(() => {
this.locNoFocus = true;
@@ -444,6 +536,36 @@
/* 寮曞叆鍏叡鏍峰紡 */
@import url('../../static/css/common.css');
@import url('../../static/css/wms.css/wms.css');
+
+ /* 琛ㄥ崟杈撳叆琛屾牱寮� */
+ .form-input-row {
+ display: flex;
+ align-items: center;
+ gap: 12rpx;
+ }
+
+ .form-input-wrap {
+ flex: 1;
+ }
+
+ /* 鍐呰仈閲嶇疆鎸夐挳鏍峰紡 */
+ .btn-reset-inline {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6rpx;
+ padding: 0 20rpx;
+ height: 72rpx;
+ background: #f5f7fa;
+ border-radius: 8rpx;
+ border: 1rpx solid #e4e7ed;
+ flex-shrink: 0;
+ }
+
+ .btn-reset-inline .btn-text {
+ font-size: 26rpx;
+ color: #909399;
+ }
.info-section {
padding: 20rpx;
@@ -516,6 +638,63 @@
gap: 20rpx;
}
+ .btn-group-main {
+ display: flex;
+ flex: 1;
+ align-items: center;
+ gap: 12rpx;
+ justify-content: space-between;
+ }
+
+ .btn-row-small {
+ display: flex;
+ align-items: center;
+ flex-shrink: 0;
+ order: 2; /* 鏀惧湪涓棿浣嶇疆 */
+ }
+
+ .btn-unlock-main {
+ order: 1; /* 宸︿晶 */
+ }
+
+ .btn-lock {
+ order: 3; /* 鍙充晶 */
+ }
+
+ .btn-unlock-row-small {
+ height: 64rpx;
+ padding: 0 20rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 8rpx;
+ gap: 8rpx;
+ background: linear-gradient(135deg, #67c23a 0%, #85ce61 100%);
+ }
+
+ .btn-text-small {
+ font-size: 24rpx;
+ color: #ffffff;
+ font-weight: 500;
+ }
+
+ .btn-unlock-main {
+ flex: 1;
+ height: 88rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 12rpx;
+ gap: 12rpx;
+ background: linear-gradient(135deg, #67c23a 0%, #85ce61 100%);
+ }
+
+ .btn-text-main {
+ font-size: 32rpx;
+ color: #ffffff;
+ font-weight: 600;
+ }
+
.btn-unlock, .btn-lock {
flex: 1;
height: 88rpx;
--
Gitblit v1.9.1