From c443f7ccae577890728c05b9749852784c9448fd Mon Sep 17 00:00:00 2001
From: zm2000 <18386612143@163.com>
Date: Mon, 28 Sep 2026 20:09:43 +0800
Subject: [PATCH] =?UTF-8?q?feat(home):=20=E9=A6=96=E9=A1=B5=E7=9C=8B?=
=?UTF-8?q?=E6=9D=BF=E7=BB=9F=E8=AE=A1=E4=B8=8E=E9=80=9A=E7=9F=A5=E6=A0=8F?=
=?UTF-8?q?=E6=94=B9=E9=80=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 dashboard.storeStats 看板接口(core/request/apis.js)
- 首页顶部欢迎语改为按用户菜单动态展示看板统计
- 有「复核发货」菜单:今日订单、已复核
- 有「订单拣货」菜单:今日订单、未拣货
- 两者都有:今日订单、未拣货、已复核
- 点击通知区域弹出「看板统计」弹窗,展示项与通知栏一致(均按菜单控制)
- 修复通知栏与仓库主体布局,仓库名不再被压缩,并调大两者间距
---
core/request/apis.js | 9 +
pages/index/index.vue | 209 ++++++++++++++++++++---
pages/warehouse/inventoryTransfer.vue | 231 ++++++++++++++++++--------
pages/work/product/query.vue | 17 +-
4 files changed, 380 insertions(+), 86 deletions(-)
diff --git a/core/request/apis.js b/core/request/apis.js
index 7157a52..9c0e441 100644
--- a/core/request/apis.js
+++ b/core/request/apis.js
@@ -109,6 +109,15 @@ export default {
isSystemApi: true
}
},
+ /** 看板 ↓ **/
+ dashboard: {
+ storeStats: {
+ path: "dashboard.storeStats",
+ auth: true,
+ method: "POST",
+ isSystemApi: true
+ }
+ },
/** 仓库 ↓ **/
warehouse: {
getSpaceInfo: {
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 408e375..9b16c21 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -10,8 +10,8 @@
{{ userInfo.employees_name || '---' }}
-
-
+
@@ -136,6 +136,23 @@
+
+
+
+
+
@@ -153,11 +170,10 @@
currentPage: 1,
scrollTop: 0,
userInfo: {},
- newsList: [
- '欢迎使用PDA仓库管理系统',
- '请及时处理待办任务',
- '祝您工作愉快'
- ],
+ dashboardStats: null,
+ hasReviewShippingMenu: false,
+ hasOrderPickingMenu: false,
+ showNoticePopup: false,
unreadCount: 0,
quickActions: [],
pageSize: 12,
@@ -271,6 +287,41 @@
left: `${this.dragState.previewX}px`,
top: `${this.dragState.previewY}px`
};
+ },
+
+ noticeText() {
+ const stats = this.dashboardStats || null;
+ if (!stats || (!this.hasReviewShippingMenu && !this.hasOrderPickingMenu)) {
+ return '欢迎使用PDA仓库管理系统';
+ }
+
+ const parts = [];
+ parts.push(`今日订单 ${this.formatStatNumber(stats.todayOrders)}`);
+ if (this.hasOrderPickingMenu) {
+ parts.push(`未拣货 ${this.formatStatNumber(stats.unpickedOrders)}`);
+ }
+ if (this.hasReviewShippingMenu) {
+ parts.push(`已复核 ${this.formatStatNumber(stats.recheckedOrders)}`);
+ }
+ return parts.join(',');
+ },
+
+ noticeStatItems() {
+ const stats = this.dashboardStats || null;
+ if (!stats || (!this.hasReviewShippingMenu && !this.hasOrderPickingMenu)) {
+ return [];
+ }
+
+ const f = this.formatStatNumber;
+ const items = [];
+ items.push({ label: '今日订单', value: f(stats.todayOrders) });
+ if (this.hasOrderPickingMenu) {
+ items.push({ label: '未拣货', value: f(stats.unpickedOrders) });
+ }
+ if (this.hasReviewShippingMenu) {
+ items.push({ label: '已复核', value: f(stats.recheckedOrders) });
+ }
+ return items;
}
},
@@ -461,6 +512,7 @@
async loadUserInfo() {
await this.refreshQuickActions();
+ await this.loadDashboardStats();
},
// 刷新快捷入口
@@ -471,6 +523,8 @@
const latestUser = await this.getLatestUserInfo();
if (!latestUser) {
console.log('用户信息不可用,快捷入口置空');
+ this.hasReviewShippingMenu = false;
+ this.hasOrderPickingMenu = false;
this.quickActions = [];
this.ensureCurrentPageInRange();
return;
@@ -480,6 +534,9 @@
const userMenus = this.getUserMenus(latestUser);
const latestActions = this.processMenus(userMenus, null);
+ // 识别用户是否拥有复核发货 / 订单拣货功能菜单,用于展示看板统计
+ this.detectDashboardMenus(latestActions);
+
// 2. 从Vuex获取已固定的菜单
const savedFixedMenus = await this.$store.dispatch('setting/getValue', this.FIXED_MENU_KEY);
const hasSavedConfig = Array.isArray(savedFixedMenus);
@@ -516,6 +573,52 @@
}
},
+ // 根据用户菜单识别看板相关功能(复核发货 / 订单拣货)
+ detectDashboardMenus(actions) {
+ const list = Array.isArray(actions) ? actions.filter(Boolean) : [];
+ this.hasReviewShippingMenu = list.some(item => {
+ const name = this.sanitizeText(item?.name);
+ return name === '散单复核发货' ||
+ name === '订单复核' ||
+ (name.includes('复核') && name.includes('发货'));
+ });
+ this.hasOrderPickingMenu = list.some(item => {
+ const name = this.sanitizeText(item?.name);
+ return name === '订单拣货' || (name.includes('订单') && name.includes('拣货'));
+ });
+ },
+
+ // 加载仓库/货主看板统计
+ async loadDashboardStats() {
+ if (!this.hasReviewShippingMenu && !this.hasOrderPickingMenu) {
+ this.dashboardStats = null;
+ return;
+ }
+
+ try {
+ const response = await this.$http('dashboard.storeStats', {}, '', false);
+ if (response && response.flag === 'success' && response.data) {
+ this.dashboardStats = response.data;
+ } else {
+ this.dashboardStats = null;
+ }
+ } catch (error) {
+ console.warn('[index] 看板统计加载失败:', error);
+ this.dashboardStats = null;
+ }
+ },
+
+ formatStatNumber(value) {
+ const num = Number(value);
+ return Number.isFinite(num) ? num : '--';
+ },
+
+ formatPercent(value) {
+ const num = Number(value);
+ if (!Number.isFinite(num)) return '--';
+ return `${num}%`;
+ },
+
prioritizeDefaultQuickActions(actions) {
const source = Array.isArray(actions) ? actions.filter(Boolean) : [];
if (!source.length) {
@@ -1261,6 +1364,14 @@
});
},
+ openNoticePopup() {
+ this.showNoticePopup = true;
+ },
+
+ closeNoticePopup() {
+ this.showNoticePopup = false;
+ },
+
toEditPage() {
uni.navigateTo({
url: '/pages/home/edit-quick-actions'
@@ -1316,7 +1427,10 @@
}
.org-info {
- flex: 1;
+ flex: 0 0 auto;
+ max-width: 40%;
+ min-width: 0;
+ margin-right: 40rpx;
.org-name {
font-size: 28rpx;
@@ -1324,12 +1438,29 @@
color: #333;
display: block;
line-height: 1.4;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
}
.org-id {
font-size: 22rpx;
color: #909399;
display: block;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ }
+
+ .news-wrapper {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+
+ ::v-deep .u-notice-bar {
+ height: 30rpx !important;
+ line-height: 30rpx !important;
}
}
}
@@ -1339,17 +1470,6 @@
align-items: center;
justify-content: space-between;
- .news-wrapper {
- flex: 1;
- margin-right: 20rpx;
- overflow: hidden;
-
- ::v-deep .u-notice-bar {
- height: 30rpx !important;
- line-height: 30rpx !important;
- }
- }
-
.message-bell {
position: relative;
width: 60rpx;
@@ -1757,4 +1877,55 @@
color: #ccc;
}
}
+
+ // 看板统计弹窗
+ .notice-popup {
+ padding: 32rpx 30rpx 40rpx;
+
+ &__header {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 30rpx;
+ }
+
+ &__title {
+ font-size: 32rpx;
+ font-weight: 600;
+ color: #333;
+ }
+
+ &__body {
+ max-height: 60vh;
+ }
+
+ &__grid {
+ display: flex;
+ flex-wrap: wrap;
+ margin: -12rpx;
+ }
+
+ &__item {
+ width: calc(33.333% - 24rpx);
+ margin: 12rpx;
+ background: #f5f6f8;
+ border-radius: 12rpx;
+ padding: 24rpx 12rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ }
+
+ &__value {
+ font-size: 34rpx;
+ font-weight: 600;
+ color: #2979ff;
+ margin-bottom: 8rpx;
+ }
+
+ &__label {
+ font-size: 22rpx;
+ color: #909399;
+ }
+ }
\ No newline at end of file
diff --git a/pages/warehouse/inventoryTransfer.vue b/pages/warehouse/inventoryTransfer.vue
index f2978c3..ce7ae5f 100644
--- a/pages/warehouse/inventoryTransfer.vue
+++ b/pages/warehouse/inventoryTransfer.vue
@@ -8,7 +8,7 @@
-
-
-
-
-
- {{ opt.label }}
+
+
+
+ {{ opt.label }}
+
+
+
+
+
+ {{ opt.label }}
+
+
@@ -49,33 +64,33 @@
-
- 商品编码
- {{ item.barcode || '--' }}
-
商品名称
{{ item.name || '--' }}
- 操作时间
- {{ item.timeText || '--' }}
-
-
- 操作人
- {{ item.operator || '--' }}
+ 商品编码
+ {{ item.barcode || '--' }}
数量
{{ item.quantityText }}
- 移出库位
- {{ item.fromSpace || '--' }}
+ {{ item.transactionType === 'TRANSFER_OUT' ? '移出库位' : '移入库位' }}
+ {{ item.transactionType === 'TRANSFER_OUT' ? (item.fromSpace || '--') : (item.toSpace || '--') }}
+
+
+ 批次号
+ {{ item.batchNo || '--' }}
+
+
+ 操作人
+ {{ item.operator || '--' }}
- 移入库位
- {{ item.toSpace || '--' }}
+ 操作时间
+ {{ item.timeText || '--' }}
@@ -106,6 +121,11 @@ export default {
data() {
return {
keyword: '',
+ searchDimension: 'PRODUCT',
+ searchDimensionOptions: [
+ { label: '商品', value: 'PRODUCT' },
+ { label: '操作人', value: 'OPERATOR' }
+ ],
transferType: 'TRANSFER_IN',
transferTypeOptions: [
{ label: '移入', value: 'TRANSFER_IN' },
@@ -118,6 +138,11 @@ export default {
loading: false
}
},
+ computed: {
+ searchPlaceholder() {
+ return this.searchDimension === 'OPERATOR' ? '请输入操作人名称' : '请输入/扫描商品条码或名称';
+ }
+ },
onLoad(options = {}) {
// 支持通过 ?keyword=xxx 预填关键字并自动查询
const preset = String(options.keyword || '').trim();
@@ -133,11 +158,16 @@ export default {
onShow() {
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
this.safeDispatchBroadcast('resume');
+ this.scheduleBroadcastSelfHeal();
},
onHide() {
this.safeDispatchBroadcast('pause');
},
onUnload() {
+ if (this._broadcastHealTimer) {
+ clearTimeout(this._broadcastHealTimer);
+ this._broadcastHealTimer = null;
+ }
this.safeDispatchBroadcast('stop');
},
methods: {
@@ -152,6 +182,16 @@ export default {
console.warn(`[inventoryTransfer] broadcast/${action} 调用异常:`, error);
}
},
+ scheduleBroadcastSelfHeal() {
+ if (this._broadcastHealTimer) {
+ clearTimeout(this._broadcastHealTimer);
+ }
+ this._broadcastHealTimer = setTimeout(() => {
+ // 兼容跳转时序竞态:旧页 onHide 的 pause(=stop) 可能晚于本页 onShow 执行,导致广播被误停
+ this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
+ this.safeDispatchBroadcast('start');
+ }, 1200);
+ },
normalizeScanResult(scanResult) {
if (!scanResult) return '';
if (typeof scanResult === 'string') return scanResult.trim();
@@ -196,6 +236,11 @@ export default {
this.transferType = value;
this.loadRecordList(1);
},
+ handleDimensionChange(value) {
+ if (this.searchDimension === value) return;
+ this.searchDimension = value;
+ this.loadRecordList(1);
+ },
handlePageChange(page) {
const targetPage = Math.max(1, Number(page || 1));
if (targetPage === this.currentPage) return;
@@ -203,25 +248,46 @@ export default {
this.loadRecordList(targetPage);
},
buildRecordParams(page = this.currentPage) {
+ const targetPage = Math.max(1, Number(page || 1));
+ const pageSize = Math.max(1, Number(this.pageSize || 20));
const params = {
+ group_by_batch: true,
pagination: {
- page: Math.max(1, Number(page || 1)),
- pageSize: Math.max(1, Number(this.pageSize || 20))
+ page: targetPage,
+ pageSize
+ },
+ sort: {
+ sortField: 'created_at',
+ sortOrder: 'DESC'
}
};
+ const where = {};
const keyword = String(this.keyword || '').trim();
if (keyword) {
- params.keyword = keyword;
+ if (this.searchDimension === 'OPERATOR') {
+ where.operator_name = {
+ operator: 'like',
+ value: keyword,
+ type: 'text'
+ };
+ } else {
+ where.keyword = {
+ operator: 'contains',
+ value: [keyword],
+ type: 'text'
+ };
+ }
}
if (this.transferType) {
- params.where = {
- transaction_type: {
- operator: 'eq',
- value: this.transferType,
- type: 'select'
- }
+ where.transaction_type = {
+ operator: 'eq',
+ value: this.transferType,
+ type: 'select'
};
}
+ if (Object.keys(where).length) {
+ params.where = where;
+ }
return params;
},
extractRecordPayload(response) {
@@ -314,6 +380,9 @@ export default {
'operator_name', 'operatorName', 'operator', 'operate_user', 'operateUser',
'create_user', 'createUser', 'user_name', 'userName', 'scanner_name'
]);
+ const batchNo = this.firstValue(merged, [
+ 'batch_no', 'batchNo', 'batch_number', 'batchNumber'
+ ]);
const transactionType = String(source.transaction_type || source.transactionType || '').trim();
// 单库位流水:库位可能是 space_code/space_name 或仅 space_id
const spaceId = this.firstValue(source, ['space_id', 'spaceId']);
@@ -352,6 +421,7 @@ export default {
barcode,
name,
operator,
+ batchNo,
fromSpace,
toSpace,
spaceId,
@@ -514,7 +584,7 @@ export default {
flex-shrink: 0;
&__text {
- font-size: 30rpx;
+ font-size: 34rpx;
font-weight: 500;
color: #2979ff;
line-height: 1;
@@ -525,43 +595,67 @@ export default {
}
}
-/* 移库类型筛选 */
-.type-filter {
- background: #ffffff;
- border-bottom: 1rpx solid #f2f2f2;
- padding: 8rpx 16rpx 20rpx;
- box-sizing: border-box;
+/* 筛选条件行(商品/操作人 | 移入/移出) */
+.filter-row {
+ margin-top: 16rpx;
display: flex;
- flex-wrap: wrap;
- gap: 16rpx;
- flex-shrink: 0;
+ align-items: center;
}
-.type-filter__item {
- height: 60rpx;
- padding: 0 32rpx;
+.filter-group {
+ flex: 1;
+ display: flex;
+}
+
+.filter-group__item {
+ flex: 1;
+ height: 56rpx;
+ padding: 0 12rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f7fa;
border: 1rpx solid #ebeef5;
- border-radius: 30rpx;
+ border-radius: 28rpx;
}
-.type-filter__item--active {
+.filter-group__item + .filter-group__item {
+ margin-left: 16rpx;
+}
+
+.filter-group__item--active {
background: #ecf3ff;
border-color: #2979ff;
}
-.type-filter__item-text {
- font-size: 28rpx;
+.filter-group__item-text {
+ font-size: 30rpx;
color: #303133;
+ white-space: nowrap;
}
-.type-filter__item--active .type-filter__item-text {
+.filter-group__item--active .filter-group__item-text {
color: #2979ff;
}
+/* 移出(橙色警示) */
+.filter-group__item--warning {
+ background: #fff7e6;
+ border-color: #ff9800;
+}
+
+.filter-group__item--warning .filter-group__item-text {
+ color: #ff9800;
+}
+
+.filter-divider {
+ width: 1rpx;
+ height: 36rpx;
+ margin: 0 16rpx;
+ background: #dcdfe6;
+ flex-shrink: 0;
+}
+
/* 列表区 */
.detail-scroll {
flex: 1;
@@ -581,13 +675,13 @@ export default {
.empty-text {
margin-top: 24rpx;
- font-size: 32rpx;
+ font-size: 36rpx;
color: #909399;
}
.empty-hint {
margin-top: 12rpx;
- font-size: 26rpx;
+ font-size: 30rpx;
color: #c0c4cc;
}
@@ -600,18 +694,18 @@ export default {
.record-card {
background: #ffffff;
- border: 2rpx solid #ebeef5;
- border-radius: 16rpx;
- padding: 8rpx 24rpx;
- margin-bottom: 16rpx;
- box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
+ border: 2rpx solid #ebedf2;
+ border-radius: 20rpx;
+ padding: 4rpx 28rpx;
+ margin-bottom: 20rpx;
+ box-shadow: 0 6rpx 20rpx rgba(31, 45, 61, 0.06);
}
.record-card__row {
display: flex;
align-items: flex-start;
- padding: 18rpx 0;
- border-bottom: 1rpx solid #f5f5f5;
+ padding: 20rpx 0;
+ border-bottom: 1rpx solid #f0f2f5;
}
.record-card__row--last {
@@ -621,15 +715,15 @@ export default {
.record-card__label {
flex-shrink: 0;
width: 160rpx;
- font-size: 28rpx;
- color: #909399;
+ font-size: 36rpx;
+ color: #8a9099;
line-height: 1.5;
}
.record-card__value {
flex: 1;
min-width: 0;
- font-size: 30rpx;
+ font-size: 40rpx;
color: #303133;
line-height: 1.5;
word-break: break-all;
@@ -651,5 +745,10 @@ export default {
border-top: 1rpx solid #f0f0f0;
padding: 0 24rpx env(safe-area-inset-bottom);
flex-shrink: 0;
+
+ ::v-deep .total-info {
+ font-size: 32rpx;
+ color: #606266;
+ }
}
diff --git a/pages/work/product/query.vue b/pages/work/product/query.vue
index ac4aab6..87d80ac 100644
--- a/pages/work/product/query.vue
+++ b/pages/work/product/query.vue
@@ -100,7 +100,7 @@
1/{{ getImageCount(item) }}
-
+
货主:
{{ getStoreOwnerText(item) }}
@@ -2150,6 +2150,21 @@
urls
});
},
+ goTransferRecord(item) {
+ if (!item || typeof item !== 'object') {
+ return;
+ }
+
+ // 预填条码/编码优先,其次名称,跳转到移库记录页并自动查询
+ const keyword = String(
+ item.item_code || item.goods_code || item.barcode || item.bar_code
+ || item.item_name || item.product_name || item.name || ''
+ ).trim();
+ const query = keyword ? `?keyword=${encodeURIComponent(keyword)}` : '';
+ uni.navigateTo({
+ url: `/pages/warehouse/inventoryTransfer${query}`
+ });
+ },
async goProductDetail(item) {
if (!item || typeof item !== 'object') {
return;