feat(home): 首页看板统计与通知栏改造
- 新增 dashboard.storeStats 看板接口(core/request/apis.js) - 首页顶部欢迎语改为按用户菜单动态展示看板统计 - 有「复核发货」菜单:今日订单、已复核 - 有「订单拣货」菜单:今日订单、未拣货 - 两者都有:今日订单、未拣货、已复核 - 点击通知区域弹出「看板统计」弹窗,展示项与通知栏一致(均按菜单控制) - 修复通知栏与仓库主体布局,仓库名不再被压缩,并调大两者间距
This commit is contained in:
parent
428f06ebd3
commit
c443f7ccae
@ -109,6 +109,15 @@ export default {
|
|||||||
isSystemApi: true
|
isSystemApi: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** 看板 ↓ **/
|
||||||
|
dashboard: {
|
||||||
|
storeStats: {
|
||||||
|
path: "dashboard.storeStats",
|
||||||
|
auth: true,
|
||||||
|
method: "POST",
|
||||||
|
isSystemApi: true
|
||||||
|
}
|
||||||
|
},
|
||||||
/** 仓库 ↓ **/
|
/** 仓库 ↓ **/
|
||||||
warehouse: {
|
warehouse: {
|
||||||
getSpaceInfo: {
|
getSpaceInfo: {
|
||||||
|
|||||||
@ -10,8 +10,8 @@
|
|||||||
<text class="org-id">{{ userInfo.employees_name || '---' }}</text>
|
<text class="org-id">{{ userInfo.employees_name || '---' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<u-icon @click="showStoreSelector" name="arrow-down" size="16" color="#666" v-if="userInfo.employees && userInfo.employees.length > 1"></u-icon>
|
<u-icon @click="showStoreSelector" name="arrow-down" size="16" color="#666" v-if="userInfo.employees && userInfo.employees.length > 1"></u-icon>
|
||||||
<view class="news-wrapper" @click="toNewsPage">
|
<view class="news-wrapper" @click="openNoticePopup">
|
||||||
<u-notice-bar :text="newsList[0]" mode="horizontal" bg-color="transparent" color="#666"
|
<u-notice-bar :text="noticeText" mode="horizontal" bg-color="transparent" color="#666"
|
||||||
:font-size="12" :padding="0" :radius="0" :volume-icon="false" :more-icon="false" :speed="60"
|
:font-size="12" :padding="0" :radius="0" :volume-icon="false" :more-icon="false" :speed="60"
|
||||||
:height="30" :autoplay="true"></u-notice-bar>
|
:height="30" :autoplay="true"></u-notice-bar>
|
||||||
</view>
|
</view>
|
||||||
@ -136,6 +136,23 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 看板统计弹窗 -->
|
||||||
|
<u-popup :show="showNoticePopup" mode="bottom" round="20" :closeable="true" :safeAreaInsetBottom="true" @close="closeNoticePopup">
|
||||||
|
<view class="notice-popup">
|
||||||
|
<view class="notice-popup__header">
|
||||||
|
<text class="notice-popup__title">看板统计</text>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y class="notice-popup__body">
|
||||||
|
<view class="notice-popup__grid">
|
||||||
|
<view v-for="item in noticeStatItems" :key="item.label" class="notice-popup__item">
|
||||||
|
<text class="notice-popup__value">{{ item.value }}</text>
|
||||||
|
<text class="notice-popup__label">{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -153,11 +170,10 @@
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
scrollTop: 0,
|
scrollTop: 0,
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
newsList: [
|
dashboardStats: null,
|
||||||
'欢迎使用PDA仓库管理系统',
|
hasReviewShippingMenu: false,
|
||||||
'请及时处理待办任务',
|
hasOrderPickingMenu: false,
|
||||||
'祝您工作愉快'
|
showNoticePopup: false,
|
||||||
],
|
|
||||||
unreadCount: 0,
|
unreadCount: 0,
|
||||||
quickActions: [],
|
quickActions: [],
|
||||||
pageSize: 12,
|
pageSize: 12,
|
||||||
@ -271,6 +287,41 @@
|
|||||||
left: `${this.dragState.previewX}px`,
|
left: `${this.dragState.previewX}px`,
|
||||||
top: `${this.dragState.previewY}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() {
|
async loadUserInfo() {
|
||||||
await this.refreshQuickActions();
|
await this.refreshQuickActions();
|
||||||
|
await this.loadDashboardStats();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 刷新快捷入口
|
// 刷新快捷入口
|
||||||
@ -471,6 +523,8 @@
|
|||||||
const latestUser = await this.getLatestUserInfo();
|
const latestUser = await this.getLatestUserInfo();
|
||||||
if (!latestUser) {
|
if (!latestUser) {
|
||||||
console.log('用户信息不可用,快捷入口置空');
|
console.log('用户信息不可用,快捷入口置空');
|
||||||
|
this.hasReviewShippingMenu = false;
|
||||||
|
this.hasOrderPickingMenu = false;
|
||||||
this.quickActions = [];
|
this.quickActions = [];
|
||||||
this.ensureCurrentPageInRange();
|
this.ensureCurrentPageInRange();
|
||||||
return;
|
return;
|
||||||
@ -480,6 +534,9 @@
|
|||||||
const userMenus = this.getUserMenus(latestUser);
|
const userMenus = this.getUserMenus(latestUser);
|
||||||
const latestActions = this.processMenus(userMenus, null);
|
const latestActions = this.processMenus(userMenus, null);
|
||||||
|
|
||||||
|
// 识别用户是否拥有复核发货 / 订单拣货功能菜单,用于展示看板统计
|
||||||
|
this.detectDashboardMenus(latestActions);
|
||||||
|
|
||||||
// 2. 从Vuex获取已固定的菜单
|
// 2. 从Vuex获取已固定的菜单
|
||||||
const savedFixedMenus = await this.$store.dispatch('setting/getValue', this.FIXED_MENU_KEY);
|
const savedFixedMenus = await this.$store.dispatch('setting/getValue', this.FIXED_MENU_KEY);
|
||||||
const hasSavedConfig = Array.isArray(savedFixedMenus);
|
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) {
|
prioritizeDefaultQuickActions(actions) {
|
||||||
const source = Array.isArray(actions) ? actions.filter(Boolean) : [];
|
const source = Array.isArray(actions) ? actions.filter(Boolean) : [];
|
||||||
if (!source.length) {
|
if (!source.length) {
|
||||||
@ -1261,6 +1364,14 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
openNoticePopup() {
|
||||||
|
this.showNoticePopup = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
closeNoticePopup() {
|
||||||
|
this.showNoticePopup = false;
|
||||||
|
},
|
||||||
|
|
||||||
toEditPage() {
|
toEditPage() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/home/edit-quick-actions'
|
url: '/pages/home/edit-quick-actions'
|
||||||
@ -1316,7 +1427,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.org-info {
|
.org-info {
|
||||||
flex: 1;
|
flex: 0 0 auto;
|
||||||
|
max-width: 40%;
|
||||||
|
min-width: 0;
|
||||||
|
margin-right: 40rpx;
|
||||||
|
|
||||||
.org-name {
|
.org-name {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
@ -1324,12 +1438,29 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.org-id {
|
.org-id {
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
display: block;
|
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;
|
align-items: center;
|
||||||
justify-content: space-between;
|
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 {
|
.message-bell {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 60rpx;
|
width: 60rpx;
|
||||||
@ -1757,4 +1877,55 @@
|
|||||||
color: #ccc;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -8,7 +8,7 @@
|
|||||||
<view class="search-input-wrap">
|
<view class="search-input-wrap">
|
||||||
<u-search
|
<u-search
|
||||||
v-model="keyword"
|
v-model="keyword"
|
||||||
placeholder="请输入/扫描商品条码、名称或操作人"
|
:placeholder="searchPlaceholder"
|
||||||
:bg-color="'#f5f5f5'"
|
:bg-color="'#f5f5f5'"
|
||||||
shape="round"
|
shape="round"
|
||||||
:show-action="false"
|
:show-action="false"
|
||||||
@ -25,18 +25,33 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="filter-row">
|
||||||
|
<view class="filter-group">
|
||||||
<!-- 移库类型筛选 -->
|
<view
|
||||||
<view class="type-filter">
|
v-for="opt in searchDimensionOptions"
|
||||||
<view
|
:key="opt.value"
|
||||||
v-for="opt in transferTypeOptions"
|
class="filter-group__item"
|
||||||
:key="opt.value"
|
:class="{ 'filter-group__item--active': searchDimension === opt.value }"
|
||||||
class="type-filter__item"
|
@click="handleDimensionChange(opt.value)"
|
||||||
:class="{ 'type-filter__item--active': transferType === opt.value }"
|
>
|
||||||
@click="handleTypeChange(opt.value)"
|
<text class="filter-group__item-text">{{ opt.label }}</text>
|
||||||
>
|
</view>
|
||||||
<text class="type-filter__item-text">{{ opt.label }}</text>
|
</view>
|
||||||
|
<view class="filter-divider"></view>
|
||||||
|
<view class="filter-group">
|
||||||
|
<view
|
||||||
|
v-for="opt in transferTypeOptions"
|
||||||
|
:key="opt.value"
|
||||||
|
class="filter-group__item"
|
||||||
|
:class="{
|
||||||
|
'filter-group__item--active': transferType === opt.value,
|
||||||
|
'filter-group__item--warning': transferType === opt.value && opt.value === 'TRANSFER_OUT'
|
||||||
|
}"
|
||||||
|
@click="handleTypeChange(opt.value)"
|
||||||
|
>
|
||||||
|
<text class="filter-group__item-text">{{ opt.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -49,33 +64,33 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-else class="record-list">
|
<view v-else class="record-list">
|
||||||
<view v-for="(item, index) in recordList" :key="item.id || index" class="record-card">
|
<view v-for="(item, index) in recordList" :key="item.id || index" class="record-card">
|
||||||
<view class="record-card__row">
|
|
||||||
<text class="record-card__label">商品编码</text>
|
|
||||||
<text class="record-card__value">{{ item.barcode || '--' }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="record-card__row">
|
<view class="record-card__row">
|
||||||
<text class="record-card__label">商品名称</text>
|
<text class="record-card__label">商品名称</text>
|
||||||
<text class="record-card__value">{{ item.name || '--' }}</text>
|
<text class="record-card__value">{{ item.name || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="record-card__row">
|
<view class="record-card__row">
|
||||||
<text class="record-card__label">操作时间</text>
|
<text class="record-card__label">商品编码</text>
|
||||||
<text class="record-card__value">{{ item.timeText || '--' }}</text>
|
<text class="record-card__value">{{ item.barcode || '--' }}</text>
|
||||||
</view>
|
|
||||||
<view class="record-card__row">
|
|
||||||
<text class="record-card__label">操作人</text>
|
|
||||||
<text class="record-card__value">{{ item.operator || '--' }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="record-card__row">
|
<view class="record-card__row">
|
||||||
<text class="record-card__label">数量</text>
|
<text class="record-card__label">数量</text>
|
||||||
<text class="record-card__value record-card__value--strong">{{ item.quantityText }}</text>
|
<text class="record-card__value record-card__value--strong">{{ item.quantityText }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="record-card__row">
|
<view class="record-card__row">
|
||||||
<text class="record-card__label">移出库位</text>
|
<text class="record-card__label">{{ item.transactionType === 'TRANSFER_OUT' ? '移出库位' : '移入库位' }}</text>
|
||||||
<text class="record-card__value">{{ item.fromSpace || '--' }}</text>
|
<text class="record-card__value">{{ item.transactionType === 'TRANSFER_OUT' ? (item.fromSpace || '--') : (item.toSpace || '--') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="record-card__row">
|
||||||
|
<text class="record-card__label">批次号</text>
|
||||||
|
<text class="record-card__value">{{ item.batchNo || '--' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="record-card__row">
|
||||||
|
<text class="record-card__label">操作人</text>
|
||||||
|
<text class="record-card__value">{{ item.operator || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="record-card__row record-card__row--last">
|
<view class="record-card__row record-card__row--last">
|
||||||
<text class="record-card__label">移入库位</text>
|
<text class="record-card__label">操作时间</text>
|
||||||
<text class="record-card__value">{{ item.toSpace || '--' }}</text>
|
<text class="record-card__value">{{ item.timeText || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -106,6 +121,11 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
keyword: '',
|
keyword: '',
|
||||||
|
searchDimension: 'PRODUCT',
|
||||||
|
searchDimensionOptions: [
|
||||||
|
{ label: '商品', value: 'PRODUCT' },
|
||||||
|
{ label: '操作人', value: 'OPERATOR' }
|
||||||
|
],
|
||||||
transferType: 'TRANSFER_IN',
|
transferType: 'TRANSFER_IN',
|
||||||
transferTypeOptions: [
|
transferTypeOptions: [
|
||||||
{ label: '移入', value: 'TRANSFER_IN' },
|
{ label: '移入', value: 'TRANSFER_IN' },
|
||||||
@ -118,6 +138,11 @@ export default {
|
|||||||
loading: false
|
loading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
searchPlaceholder() {
|
||||||
|
return this.searchDimension === 'OPERATOR' ? '请输入操作人名称' : '请输入/扫描商品条码或名称';
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad(options = {}) {
|
onLoad(options = {}) {
|
||||||
// 支持通过 ?keyword=xxx 预填关键字并自动查询
|
// 支持通过 ?keyword=xxx 预填关键字并自动查询
|
||||||
const preset = String(options.keyword || '').trim();
|
const preset = String(options.keyword || '').trim();
|
||||||
@ -133,11 +158,16 @@ export default {
|
|||||||
onShow() {
|
onShow() {
|
||||||
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
|
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
|
||||||
this.safeDispatchBroadcast('resume');
|
this.safeDispatchBroadcast('resume');
|
||||||
|
this.scheduleBroadcastSelfHeal();
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.safeDispatchBroadcast('pause');
|
this.safeDispatchBroadcast('pause');
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
if (this._broadcastHealTimer) {
|
||||||
|
clearTimeout(this._broadcastHealTimer);
|
||||||
|
this._broadcastHealTimer = null;
|
||||||
|
}
|
||||||
this.safeDispatchBroadcast('stop');
|
this.safeDispatchBroadcast('stop');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -152,6 +182,16 @@ export default {
|
|||||||
console.warn(`[inventoryTransfer] broadcast/${action} 调用异常:`, error);
|
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) {
|
normalizeScanResult(scanResult) {
|
||||||
if (!scanResult) return '';
|
if (!scanResult) return '';
|
||||||
if (typeof scanResult === 'string') return scanResult.trim();
|
if (typeof scanResult === 'string') return scanResult.trim();
|
||||||
@ -196,6 +236,11 @@ export default {
|
|||||||
this.transferType = value;
|
this.transferType = value;
|
||||||
this.loadRecordList(1);
|
this.loadRecordList(1);
|
||||||
},
|
},
|
||||||
|
handleDimensionChange(value) {
|
||||||
|
if (this.searchDimension === value) return;
|
||||||
|
this.searchDimension = value;
|
||||||
|
this.loadRecordList(1);
|
||||||
|
},
|
||||||
handlePageChange(page) {
|
handlePageChange(page) {
|
||||||
const targetPage = Math.max(1, Number(page || 1));
|
const targetPage = Math.max(1, Number(page || 1));
|
||||||
if (targetPage === this.currentPage) return;
|
if (targetPage === this.currentPage) return;
|
||||||
@ -203,25 +248,46 @@ export default {
|
|||||||
this.loadRecordList(targetPage);
|
this.loadRecordList(targetPage);
|
||||||
},
|
},
|
||||||
buildRecordParams(page = this.currentPage) {
|
buildRecordParams(page = this.currentPage) {
|
||||||
|
const targetPage = Math.max(1, Number(page || 1));
|
||||||
|
const pageSize = Math.max(1, Number(this.pageSize || 20));
|
||||||
const params = {
|
const params = {
|
||||||
|
group_by_batch: true,
|
||||||
pagination: {
|
pagination: {
|
||||||
page: Math.max(1, Number(page || 1)),
|
page: targetPage,
|
||||||
pageSize: Math.max(1, Number(this.pageSize || 20))
|
pageSize
|
||||||
|
},
|
||||||
|
sort: {
|
||||||
|
sortField: 'created_at',
|
||||||
|
sortOrder: 'DESC'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const where = {};
|
||||||
const keyword = String(this.keyword || '').trim();
|
const keyword = String(this.keyword || '').trim();
|
||||||
if (keyword) {
|
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) {
|
if (this.transferType) {
|
||||||
params.where = {
|
where.transaction_type = {
|
||||||
transaction_type: {
|
operator: 'eq',
|
||||||
operator: 'eq',
|
value: this.transferType,
|
||||||
value: this.transferType,
|
type: 'select'
|
||||||
type: 'select'
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (Object.keys(where).length) {
|
||||||
|
params.where = where;
|
||||||
|
}
|
||||||
return params;
|
return params;
|
||||||
},
|
},
|
||||||
extractRecordPayload(response) {
|
extractRecordPayload(response) {
|
||||||
@ -314,6 +380,9 @@ export default {
|
|||||||
'operator_name', 'operatorName', 'operator', 'operate_user', 'operateUser',
|
'operator_name', 'operatorName', 'operator', 'operate_user', 'operateUser',
|
||||||
'create_user', 'createUser', 'user_name', 'userName', 'scanner_name'
|
'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();
|
const transactionType = String(source.transaction_type || source.transactionType || '').trim();
|
||||||
// 单库位流水:库位可能是 space_code/space_name 或仅 space_id
|
// 单库位流水:库位可能是 space_code/space_name 或仅 space_id
|
||||||
const spaceId = this.firstValue(source, ['space_id', 'spaceId']);
|
const spaceId = this.firstValue(source, ['space_id', 'spaceId']);
|
||||||
@ -352,6 +421,7 @@ export default {
|
|||||||
barcode,
|
barcode,
|
||||||
name,
|
name,
|
||||||
operator,
|
operator,
|
||||||
|
batchNo,
|
||||||
fromSpace,
|
fromSpace,
|
||||||
toSpace,
|
toSpace,
|
||||||
spaceId,
|
spaceId,
|
||||||
@ -514,7 +584,7 @@ export default {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
&__text {
|
&__text {
|
||||||
font-size: 30rpx;
|
font-size: 34rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #2979ff;
|
color: #2979ff;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
@ -525,43 +595,67 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 移库类型筛选 */
|
/* 筛选条件行(商品/操作人 | 移入/移出) */
|
||||||
.type-filter {
|
.filter-row {
|
||||||
background: #ffffff;
|
margin-top: 16rpx;
|
||||||
border-bottom: 1rpx solid #f2f2f2;
|
|
||||||
padding: 8rpx 16rpx 20rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
align-items: center;
|
||||||
gap: 16rpx;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.type-filter__item {
|
.filter-group {
|
||||||
height: 60rpx;
|
flex: 1;
|
||||||
padding: 0 32rpx;
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-group__item {
|
||||||
|
flex: 1;
|
||||||
|
height: 56rpx;
|
||||||
|
padding: 0 12rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: #f5f7fa;
|
background: #f5f7fa;
|
||||||
border: 1rpx solid #ebeef5;
|
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;
|
background: #ecf3ff;
|
||||||
border-color: #2979ff;
|
border-color: #2979ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.type-filter__item-text {
|
.filter-group__item-text {
|
||||||
font-size: 28rpx;
|
font-size: 30rpx;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.type-filter__item--active .type-filter__item-text {
|
.filter-group__item--active .filter-group__item-text {
|
||||||
color: #2979ff;
|
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 {
|
.detail-scroll {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -581,13 +675,13 @@ export default {
|
|||||||
|
|
||||||
.empty-text {
|
.empty-text {
|
||||||
margin-top: 24rpx;
|
margin-top: 24rpx;
|
||||||
font-size: 32rpx;
|
font-size: 36rpx;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-hint {
|
.empty-hint {
|
||||||
margin-top: 12rpx;
|
margin-top: 12rpx;
|
||||||
font-size: 26rpx;
|
font-size: 30rpx;
|
||||||
color: #c0c4cc;
|
color: #c0c4cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,18 +694,18 @@ export default {
|
|||||||
|
|
||||||
.record-card {
|
.record-card {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border: 2rpx solid #ebeef5;
|
border: 2rpx solid #ebedf2;
|
||||||
border-radius: 16rpx;
|
border-radius: 20rpx;
|
||||||
padding: 8rpx 24rpx;
|
padding: 4rpx 28rpx;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 20rpx;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
box-shadow: 0 6rpx 20rpx rgba(31, 45, 61, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-card__row {
|
.record-card__row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
padding: 18rpx 0;
|
padding: 20rpx 0;
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
border-bottom: 1rpx solid #f0f2f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-card__row--last {
|
.record-card__row--last {
|
||||||
@ -621,15 +715,15 @@ export default {
|
|||||||
.record-card__label {
|
.record-card__label {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
font-size: 28rpx;
|
font-size: 36rpx;
|
||||||
color: #909399;
|
color: #8a9099;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-card__value {
|
.record-card__value {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
font-size: 30rpx;
|
font-size: 40rpx;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
@ -651,5 +745,10 @@ export default {
|
|||||||
border-top: 1rpx solid #f0f0f0;
|
border-top: 1rpx solid #f0f0f0;
|
||||||
padding: 0 24rpx env(safe-area-inset-bottom);
|
padding: 0 24rpx env(safe-area-inset-bottom);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
::v-deep .total-info {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
<text class="image-index-text">1/{{ getImageCount(item) }}</text>
|
<text class="image-index-text">1/{{ getImageCount(item) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item-info">
|
<view class="item-info" @click.stop="goTransferRecord(item)">
|
||||||
<view class="item-row">
|
<view class="item-row">
|
||||||
<text class="label">货主:</text>
|
<text class="label">货主:</text>
|
||||||
<text class="value">{{ getStoreOwnerText(item) }}</text>
|
<text class="value">{{ getStoreOwnerText(item) }}</text>
|
||||||
@ -2150,6 +2150,21 @@
|
|||||||
urls
|
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) {
|
async goProductDetail(item) {
|
||||||
if (!item || typeof item !== 'object') {
|
if (!item || typeof item !== 'object') {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user