新增拣货记录页面
This commit is contained in:
parent
522cca5259
commit
3054caf08c
@ -400,6 +400,12 @@ export default {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
isSystemApi: true
|
isSystemApi: true
|
||||||
},
|
},
|
||||||
|
wavePickTaskList: {
|
||||||
|
path: "order.wave.wavePickTaskList",
|
||||||
|
auth: true,
|
||||||
|
method: "POST",
|
||||||
|
isSystemApi: true
|
||||||
|
},
|
||||||
waveStrategyList: {
|
waveStrategyList: {
|
||||||
path: "order.wave.waveStrategyList",
|
path: "order.wave.waveStrategyList",
|
||||||
auth: true,
|
auth: true,
|
||||||
|
|||||||
@ -251,6 +251,13 @@
|
|||||||
"titleNView": false
|
"titleNView": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/work/order/pickingRecord",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"titleNView": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/packing/labelReprint",
|
"path" : "pages/packing/labelReprint",
|
||||||
"style" :
|
"style" :
|
||||||
|
|||||||
@ -320,6 +320,7 @@
|
|||||||
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
||||||
const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打'));
|
const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打'));
|
||||||
const isBlockRegistration = menuName === '拦截登记';
|
const isBlockRegistration = menuName === '拦截登记';
|
||||||
|
const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录'));
|
||||||
const rawPath = item?.component || item?.path || '';
|
const rawPath = item?.component || item?.path || '';
|
||||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||||
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
||||||
@ -350,7 +351,9 @@
|
|||||||
? '/pages/work/order/groupon-picking-detail'
|
? '/pages/work/order/groupon-picking-detail'
|
||||||
: (isLabelReprint
|
: (isLabelReprint
|
||||||
? '/pages/packing/labelReprint'
|
? '/pages/packing/labelReprint'
|
||||||
: (isBlockRegistration ? '/pages/work/order/interceptionLog' : normalizedPath)))))));
|
: (isBlockRegistration
|
||||||
|
? '/pages/work/order/interceptionLog'
|
||||||
|
: (isPickingRecord ? '/pages/work/order/pickingRecord' : normalizedPath))))))));
|
||||||
|
|
||||||
if (!targetPath) {
|
if (!targetPath) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@ -1190,6 +1190,7 @@
|
|||||||
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
||||||
const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打'));
|
const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打'));
|
||||||
const isBlockRegistration = menuName === '拦截登记';
|
const isBlockRegistration = menuName === '拦截登记';
|
||||||
|
const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录'));
|
||||||
const rawPath = item?.component || item?.path || '';
|
const rawPath = item?.component || item?.path || '';
|
||||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||||
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
||||||
@ -1222,7 +1223,9 @@
|
|||||||
? '/pages/work/order/groupon-picking-detail'
|
? '/pages/work/order/groupon-picking-detail'
|
||||||
: (isLabelReprint
|
: (isLabelReprint
|
||||||
? '/pages/packing/labelReprint'
|
? '/pages/packing/labelReprint'
|
||||||
: (isBlockRegistration ? '/pages/work/order/interceptionLog' : normalizedPath))))))));
|
: (isBlockRegistration
|
||||||
|
? '/pages/work/order/interceptionLog'
|
||||||
|
: (isPickingRecord ? '/pages/work/order/pickingRecord' : normalizedPath)))))))));
|
||||||
|
|
||||||
if (!targetPath) {
|
if (!targetPath) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
793
pages/work/order/pickingRecord.vue
Normal file
793
pages/work/order/pickingRecord.vue
Normal file
@ -0,0 +1,793 @@
|
|||||||
|
<template>
|
||||||
|
<view class="picking-record-page">
|
||||||
|
<view class="normar_container">
|
||||||
|
<page-nav :title="title">
|
||||||
|
<template #right>
|
||||||
|
<view class="nav-right-action" :class="{ 'nav-right-action--active': hasActiveFilter }" @click="openFilterPopup">
|
||||||
|
<text class="nav-right-action__text">筛选</text>
|
||||||
|
<view v-if="hasActiveFilter" class="nav-right-action__dot"></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</page-nav>
|
||||||
|
|
||||||
|
<scroll-view class="detail-scroll" scroll-y>
|
||||||
|
<view v-if="displayOrderList.length === 0" class="empty-state">
|
||||||
|
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
|
||||||
|
<text class="empty-text">暂无拣货记录</text>
|
||||||
|
</view>
|
||||||
|
<view v-else class="record-list">
|
||||||
|
<view v-for="item in displayOrderList" :key="item.id" class="record-item">
|
||||||
|
<view class="record-single-line">
|
||||||
|
<text class="record-single-line__value">{{ item.waveNo || '--' }}</text>
|
||||||
|
<text class="record-single-line__dot"></text>
|
||||||
|
<text class="record-single-line__value">{{ item.pickUserName || '--' }}</text>
|
||||||
|
<text class="record-single-line__dot"></text>
|
||||||
|
<text class="record-single-line__value">{{ item.cartName || '--' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="safe-area-bottom"></view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<view class="pagination-wrap">
|
||||||
|
<pagination
|
||||||
|
:pageNum.sync="currentPage"
|
||||||
|
:pageSize="pageSize"
|
||||||
|
:total="paginationTotal"
|
||||||
|
:showTotal="true"
|
||||||
|
:prevText="'上一页'"
|
||||||
|
:nextText="'下一页'"
|
||||||
|
:showFirstLast="true"
|
||||||
|
:firstText="'首页'"
|
||||||
|
:lastText="'末页'"
|
||||||
|
@change="handlePageChange"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<u-calendar
|
||||||
|
:show="showDateRangePicker"
|
||||||
|
mode="range"
|
||||||
|
:minDate="calendarMinDate"
|
||||||
|
:maxDate="calendarMaxDate"
|
||||||
|
:monthNum="calendarMonthNum"
|
||||||
|
@confirm="handleDateRangeConfirm"
|
||||||
|
@close="handleDateRangeClose"
|
||||||
|
></u-calendar>
|
||||||
|
|
||||||
|
<u-popup :show="showFilterPopup" mode="bottom" :closeable="true" border-radius="20" @close="showFilterPopup = false">
|
||||||
|
<view class="filter-popup">
|
||||||
|
<view class="filter-popup__header">
|
||||||
|
<text class="filter-popup__title">筛选条件</text>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y class="filter-popup__scroll">
|
||||||
|
<!-- 时间范围:开始时间 ~ 结束时间 一行展示 -->
|
||||||
|
<view class="filter-row">
|
||||||
|
<text class="filter-row__label">时间范围</text>
|
||||||
|
<view class="filter-row__control filter-row__control--range" @click="openDateRangePicker">
|
||||||
|
<text class="filter-row__value" :class="{ 'filter-row__value--placeholder': !hasDateRange }">{{ dateRangeText }}</text>
|
||||||
|
<u-icon name="arrow-right" size="24rpx" color="#909399"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-for="item in filterConfig" :key="item.key" class="filter-row">
|
||||||
|
<text class="filter-row__label">{{ item.label }}</text>
|
||||||
|
<view class="filter-options">
|
||||||
|
<view
|
||||||
|
v-for="opt in item.options"
|
||||||
|
:key="opt.value"
|
||||||
|
class="filter-option"
|
||||||
|
:class="{ 'filter-option--active': filterDraft[item.key] === opt.value }"
|
||||||
|
@click="toggleFilterOption(item.key, opt.value)"
|
||||||
|
>
|
||||||
|
<text class="filter-option__text">{{ opt.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="filter-popup__actions">
|
||||||
|
<view class="filter-popup__btn filter-popup__btn--reset" @click="handleResetFilter">
|
||||||
|
<text class="filter-popup__btn-text">重置</text>
|
||||||
|
</view>
|
||||||
|
<view class="filter-popup__btn filter-popup__btn--confirm" @click="handleApplyFilter">
|
||||||
|
<text class="filter-popup__btn-text">确定</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '拣货记录',
|
||||||
|
pageSize: 20,
|
||||||
|
currentPage: 1,
|
||||||
|
paginationTotal: 0,
|
||||||
|
orderList: [],
|
||||||
|
// ===== 筛选条件 =====
|
||||||
|
filter: {
|
||||||
|
startDate: '',
|
||||||
|
endDate: '',
|
||||||
|
taskStatus: '',
|
||||||
|
reviewStatus: '',
|
||||||
|
pickMode: '',
|
||||||
|
source: ''
|
||||||
|
},
|
||||||
|
filterConfig: [
|
||||||
|
{
|
||||||
|
key: 'taskStatus',
|
||||||
|
label: '任务状态',
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{ label: '待开始', value: 0 },
|
||||||
|
{ label: '拣货中', value: 1 },
|
||||||
|
{ label: '拣货完成', value: 2 },
|
||||||
|
{ label: '已完成', value: 3 },
|
||||||
|
{ label: '已取消', value: 9 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'reviewStatus',
|
||||||
|
label: '复核状态',
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{ label: '未就绪', value: 0 },
|
||||||
|
{ label: '待复核', value: 1 },
|
||||||
|
{ label: '复核中', value: 2 },
|
||||||
|
{ label: '复核通过', value: 3 },
|
||||||
|
{ label: '复核异常', value: 4 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'pickMode',
|
||||||
|
label: '拣货模式',
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{ label: '小团购', value: 1 },
|
||||||
|
{ label: '单品单件', value: 2 },
|
||||||
|
{ label: '先拣后分', value: 3 },
|
||||||
|
{ label: '边拣边分', value: 4 },
|
||||||
|
{ label: '大团购', value: 5 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'source',
|
||||||
|
label: '来源',
|
||||||
|
type: 'select',
|
||||||
|
options: [
|
||||||
|
{ label: '默认', value: 0 },
|
||||||
|
{ label: 'PDA', value: 1 },
|
||||||
|
{ label: '后台', value: 2 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 时间范围日历
|
||||||
|
showDateRangePicker: false,
|
||||||
|
|
||||||
|
// 筛选抽屉
|
||||||
|
showFilterPopup: false,
|
||||||
|
filterDraft: {
|
||||||
|
startDate: '',
|
||||||
|
endDate: '',
|
||||||
|
taskStatus: '',
|
||||||
|
reviewStatus: '',
|
||||||
|
pickMode: '',
|
||||||
|
source: ''
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
displayOrderList() {
|
||||||
|
return Array.isArray(this.orderList) ? this.orderList : [];
|
||||||
|
},
|
||||||
|
hasActiveFilter() {
|
||||||
|
const filter = this.filter || {};
|
||||||
|
const isSet = value => value !== '' && value !== undefined && value !== null;
|
||||||
|
return isSet(filter.startDate) || isSet(filter.endDate) || isSet(filter.taskStatus) || isSet(filter.reviewStatus) || isSet(filter.pickMode) || isSet(filter.source);
|
||||||
|
},
|
||||||
|
calendarMinDate() {
|
||||||
|
return this.formatDate(new Date(new Date().setFullYear(new Date().getFullYear() - 1)));
|
||||||
|
},
|
||||||
|
calendarMaxDate() {
|
||||||
|
return this.formatDate(new Date());
|
||||||
|
},
|
||||||
|
calendarMonthNum() {
|
||||||
|
const min = new Date(this.calendarMinDate);
|
||||||
|
const max = new Date(this.calendarMaxDate);
|
||||||
|
return (max.getFullYear() - min.getFullYear()) * 12 + (max.getMonth() - min.getMonth()) + 1;
|
||||||
|
},
|
||||||
|
hasDateRange() {
|
||||||
|
const draft = this.filterDraft || {};
|
||||||
|
return !!(draft.startDate || draft.endDate);
|
||||||
|
},
|
||||||
|
dateRangeText() {
|
||||||
|
const draft = this.filterDraft || {};
|
||||||
|
const start = draft.startDate || '';
|
||||||
|
const end = draft.endDate || '';
|
||||||
|
if (!start && !end) {
|
||||||
|
return '请选择时间范围';
|
||||||
|
}
|
||||||
|
return `${start || '不限'} ~ ${end || '不限'}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.loadTaskList(1);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
buildTaskListParams(page = this.currentPage) {
|
||||||
|
const params = {
|
||||||
|
warehouse_id: this.resolveWarehouseId(),
|
||||||
|
page_no: Math.max(1, Number(page || 1)),
|
||||||
|
page_size: Math.max(1, Number(this.pageSize || 20))
|
||||||
|
};
|
||||||
|
const filter = this.filter || {};
|
||||||
|
const isSet = value => value !== '' && value !== undefined && value !== null;
|
||||||
|
// 时间范围(ISO 字符串)
|
||||||
|
if (isSet(filter.startDate)) {
|
||||||
|
params.start_time_start = `${String(filter.startDate).trim()} 00:00:00`;
|
||||||
|
}
|
||||||
|
if (isSet(filter.endDate)) {
|
||||||
|
params.start_time_end = `${String(filter.endDate).trim()} 23:59:59`;
|
||||||
|
}
|
||||||
|
// 任务状态(顶层 status,数组,number)
|
||||||
|
if (isSet(filter.taskStatus)) {
|
||||||
|
params.status = [Number(filter.taskStatus)];
|
||||||
|
}
|
||||||
|
// 复核状态(number)
|
||||||
|
if (isSet(filter.reviewStatus)) {
|
||||||
|
params.review_status = Number(filter.reviewStatus);
|
||||||
|
}
|
||||||
|
// 拣货模式(number)
|
||||||
|
if (isSet(filter.pickMode)) {
|
||||||
|
params.pick_mode = Number(filter.pickMode);
|
||||||
|
}
|
||||||
|
// 来源(number)
|
||||||
|
if (isSet(filter.source)) {
|
||||||
|
params.source = Number(filter.source);
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
},
|
||||||
|
resolveWarehouseId() {
|
||||||
|
const user = this.$store?.getters?.user || {};
|
||||||
|
const userInfo = this.$store?.getters?.userInfo || {};
|
||||||
|
const candidates = [
|
||||||
|
user?.warehouse_id,
|
||||||
|
user?.warehouseId,
|
||||||
|
user?.store_id,
|
||||||
|
user?.storeId,
|
||||||
|
userInfo?.warehouse_id,
|
||||||
|
userInfo?.warehouseId,
|
||||||
|
userInfo?.store_id,
|
||||||
|
userInfo?.storeId,
|
||||||
|
uni.getStorageSync('warehouse_id'),
|
||||||
|
uni.getStorageSync('warehouseId'),
|
||||||
|
uni.getStorageSync('store_id'),
|
||||||
|
uni.getStorageSync('storeId')
|
||||||
|
];
|
||||||
|
for (let i = 0; i < candidates.length; i += 1) {
|
||||||
|
const value = Number(candidates[i]);
|
||||||
|
if (Number.isFinite(value) && value > 0) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
extractTaskListPayload(response) {
|
||||||
|
const candidates = [
|
||||||
|
response?.data?.data,
|
||||||
|
response?.data,
|
||||||
|
response?.result,
|
||||||
|
response
|
||||||
|
];
|
||||||
|
for (let i = 0; i < candidates.length; i += 1) {
|
||||||
|
const current = candidates[i];
|
||||||
|
if (current && typeof current === 'object' && !Array.isArray(current)) {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
extractTaskList(payload, response) {
|
||||||
|
const candidates = [
|
||||||
|
payload?.list,
|
||||||
|
payload?.rows,
|
||||||
|
payload?.items,
|
||||||
|
payload?.data?.list,
|
||||||
|
response?.data?.list,
|
||||||
|
response?.data?.data?.list,
|
||||||
|
response?.list
|
||||||
|
];
|
||||||
|
for (let i = 0; i < candidates.length; i += 1) {
|
||||||
|
if (Array.isArray(candidates[i])) {
|
||||||
|
return candidates[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
normalizeTaskList(list) {
|
||||||
|
if (!Array.isArray(list)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
.map((item, index) => {
|
||||||
|
const source = item && typeof item === 'object' ? item : {};
|
||||||
|
const cartName = String(source.current_cart_code_snapshot || source.cart_code_snapshot || source.cart_name || source.cartName || '').trim();
|
||||||
|
const pickUserName = String(source.pick_user_name || source.pickUserName || source.operator_name || source.operatorName || '').trim();
|
||||||
|
const waveList = Array.isArray(source.wave_list) ? source.wave_list : [];
|
||||||
|
const firstWave = waveList[0] && typeof waveList[0] === 'object' ? waveList[0] : {};
|
||||||
|
const waveNo = String(firstWave.wave_no || source.wave_no || source.waveNo || '').trim() || String(source.batch_no || source.batchNo || '').trim();
|
||||||
|
const id = source.id ?? source.task_id ?? source.taskId ?? waveNo ?? `record-${this.currentPage}-${index + 1}`;
|
||||||
|
return {
|
||||||
|
id: String(id || `record-${this.currentPage}-${index + 1}`),
|
||||||
|
cartName,
|
||||||
|
pickUserName,
|
||||||
|
waveNo
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter(item => !!(item.waveNo || item.cartName || item.pickUserName));
|
||||||
|
},
|
||||||
|
resolveTaskListTotal(payload, response, list) {
|
||||||
|
const candidates = [
|
||||||
|
payload?.total,
|
||||||
|
payload?.count,
|
||||||
|
payload?.totalCount,
|
||||||
|
response?.data?.total,
|
||||||
|
response?.total,
|
||||||
|
Array.isArray(list) ? list.length : 0
|
||||||
|
];
|
||||||
|
for (let i = 0; i < candidates.length; i += 1) {
|
||||||
|
const value = Number(candidates[i]);
|
||||||
|
if (Number.isFinite(value) && value >= 0) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
async loadTaskList(page = this.currentPage) {
|
||||||
|
const targetPage = Math.max(1, Number(page || 1));
|
||||||
|
if (!this.resolveWarehouseId()) {
|
||||||
|
this.orderList = [];
|
||||||
|
this.paginationTotal = 0;
|
||||||
|
uni.showToast({
|
||||||
|
title: '缺少仓库ID',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const response = await this.$http('order.wave.wavePickTaskList', this.buildTaskListParams(targetPage));
|
||||||
|
const payload = this.extractTaskListPayload(response);
|
||||||
|
const list = this.extractTaskList(payload, response);
|
||||||
|
const taskList = this.normalizeTaskList(list);
|
||||||
|
this.orderList = taskList;
|
||||||
|
this.paginationTotal = this.resolveTaskListTotal(payload, response, list);
|
||||||
|
const page = Number(payload?.page ?? payload?.page_no ?? targetPage);
|
||||||
|
this.currentPage = Number.isFinite(page) && page > 0 ? page : targetPage;
|
||||||
|
const pageSize = Number(payload?.page_size ?? payload?.pageSize ?? this.pageSize);
|
||||||
|
this.pageSize = Number.isFinite(pageSize) && pageSize > 0 ? pageSize : this.pageSize;
|
||||||
|
} catch (error) {
|
||||||
|
this.orderList = [];
|
||||||
|
this.paginationTotal = 0;
|
||||||
|
uni.showToast({
|
||||||
|
title: '拣货任务列表加载失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openFilterPopup() {
|
||||||
|
this.filterDraft = { ...this.filter };
|
||||||
|
this.showFilterPopup = true;
|
||||||
|
},
|
||||||
|
openDateRangePicker() {
|
||||||
|
// 先关闭筛选抽屉,避免两个底部弹窗同层级导致日历内容被遮挡看不到日期
|
||||||
|
this.showFilterPopup = false;
|
||||||
|
this.showDateRangePicker = true;
|
||||||
|
},
|
||||||
|
handleDateRangeClose() {
|
||||||
|
this.showDateRangePicker = false;
|
||||||
|
// 取消选择后重新打开筛选抽屉,保留草稿状态
|
||||||
|
this.showFilterPopup = true;
|
||||||
|
},
|
||||||
|
toggleFilterOption(key, value) {
|
||||||
|
if (!this.filterDraft) {
|
||||||
|
this.filterDraft = { ...this.filter };
|
||||||
|
}
|
||||||
|
if (this.filterDraft[key] === value) {
|
||||||
|
this.filterDraft[key] = '';
|
||||||
|
} else {
|
||||||
|
this.filterDraft[key] = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDateRangeConfirm(data) {
|
||||||
|
const { startDate, endDate } = this.parseCalendarRange(data);
|
||||||
|
if (!this.filterDraft) {
|
||||||
|
this.filterDraft = { ...this.filter };
|
||||||
|
}
|
||||||
|
if (startDate) {
|
||||||
|
this.filterDraft.startDate = startDate;
|
||||||
|
}
|
||||||
|
if (endDate) {
|
||||||
|
this.filterDraft.endDate = endDate;
|
||||||
|
}
|
||||||
|
this.showDateRangePicker = false;
|
||||||
|
// 选择完成后重新打开筛选抽屉,展示所选时间范围
|
||||||
|
this.showFilterPopup = true;
|
||||||
|
},
|
||||||
|
formatDate(date) {
|
||||||
|
const d = new Date(date);
|
||||||
|
const year = d.getFullYear();
|
||||||
|
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(d.getDate()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
},
|
||||||
|
normalizeCalendarDate(value) {
|
||||||
|
if (value === null || value === undefined || value === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (typeof value === 'number') {
|
||||||
|
return this.formatDate(new Date(value));
|
||||||
|
}
|
||||||
|
const text = String(value).trim();
|
||||||
|
if (!text) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (/^\d{4}-\d{2}-\d{2}$/.test(text)) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
const date = new Date(text);
|
||||||
|
if (!Number.isNaN(date.getTime())) {
|
||||||
|
return this.formatDate(date);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
extractCalendarDatesFromPayload(payload) {
|
||||||
|
let text = '';
|
||||||
|
if (typeof payload === 'string') {
|
||||||
|
text = payload;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
text = JSON.stringify(payload || '');
|
||||||
|
} catch (error) {
|
||||||
|
text = String(payload || '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const matched = String(text || '').match(/\d{4}-\d{2}-\d{2}/g) || [];
|
||||||
|
const normalized = matched
|
||||||
|
.map(item => this.normalizeCalendarDate(item))
|
||||||
|
.filter(Boolean);
|
||||||
|
return Array.from(new Set(normalized)).sort();
|
||||||
|
},
|
||||||
|
extractCalendarDateTokens(value) {
|
||||||
|
const text = String(value || '').trim();
|
||||||
|
if (!text) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const matched = text.match(/\d{4}-\d{2}-\d{2}/g);
|
||||||
|
if (matched && matched.length) {
|
||||||
|
return matched;
|
||||||
|
}
|
||||||
|
return text.split(/[~至]/).map(item => String(item || '').trim()).filter(Boolean);
|
||||||
|
},
|
||||||
|
parseCalendarRange(data) {
|
||||||
|
let startDate = '';
|
||||||
|
let endDate = '';
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
startDate = data[0];
|
||||||
|
endDate = data[1];
|
||||||
|
} else if (data && typeof data === 'object') {
|
||||||
|
startDate = data.startDate || data.start || data.beginDate || '';
|
||||||
|
endDate = data.endDate || data.end || '';
|
||||||
|
if ((!startDate || !endDate) && Array.isArray(data.result)) {
|
||||||
|
startDate = startDate || data.result[0];
|
||||||
|
endDate = endDate || data.result[1];
|
||||||
|
}
|
||||||
|
if ((!startDate || !endDate) && typeof data.result === 'string') {
|
||||||
|
const parts = this.extractCalendarDateTokens(data.result);
|
||||||
|
startDate = startDate || parts[0] || '';
|
||||||
|
endDate = endDate || parts[1] || '';
|
||||||
|
}
|
||||||
|
} else if (typeof data === 'string') {
|
||||||
|
const parts = this.extractCalendarDateTokens(data);
|
||||||
|
startDate = parts[0] || '';
|
||||||
|
endDate = parts[1] || '';
|
||||||
|
}
|
||||||
|
const extractedDates = this.extractCalendarDatesFromPayload(data);
|
||||||
|
if (extractedDates.length >= 2) {
|
||||||
|
startDate = extractedDates[0];
|
||||||
|
endDate = extractedDates[extractedDates.length - 1];
|
||||||
|
}
|
||||||
|
startDate = this.normalizeCalendarDate(startDate);
|
||||||
|
endDate = this.normalizeCalendarDate(endDate);
|
||||||
|
if (startDate && !endDate) {
|
||||||
|
endDate = startDate;
|
||||||
|
}
|
||||||
|
if (!startDate && endDate) {
|
||||||
|
startDate = endDate;
|
||||||
|
}
|
||||||
|
return { startDate, endDate };
|
||||||
|
},
|
||||||
|
handleResetFilter() {
|
||||||
|
this.filterDraft = {
|
||||||
|
startDate: '',
|
||||||
|
endDate: '',
|
||||||
|
taskStatus: '',
|
||||||
|
reviewStatus: '',
|
||||||
|
pickMode: '',
|
||||||
|
source: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
handleApplyFilter() {
|
||||||
|
this.filter = { ...this.filterDraft };
|
||||||
|
this.showFilterPopup = false;
|
||||||
|
this.applyFilter();
|
||||||
|
},
|
||||||
|
applyFilter() {
|
||||||
|
this.currentPage = 1;
|
||||||
|
this.loadTaskList(1);
|
||||||
|
},
|
||||||
|
handlePageChange(page) {
|
||||||
|
const targetPage = Math.max(1, Number(page || 1));
|
||||||
|
if (targetPage === this.currentPage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.currentPage = targetPage;
|
||||||
|
this.loadTaskList(targetPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.picking-record-page {
|
||||||
|
height: 100vh;
|
||||||
|
background: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normar_container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .nav-title .right {
|
||||||
|
width: auto;
|
||||||
|
min-width: 136rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right-action {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
padding: 8rpx 18rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
background: #2979ff;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right-action--active {
|
||||||
|
background: #1f67e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right-action__text {
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right-action__dot {
|
||||||
|
position: absolute;
|
||||||
|
top: 2rpx;
|
||||||
|
right: 2rpx;
|
||||||
|
width: 16rpx;
|
||||||
|
height: 16rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #ff4d4f;
|
||||||
|
border: 2rpx solid #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup {
|
||||||
|
height: 70vh;
|
||||||
|
background: #ffffff;
|
||||||
|
border-top-left-radius: 20rpx;
|
||||||
|
border-top-right-radius: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__header {
|
||||||
|
padding: 30rpx 32rpx 20rpx;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__scroll {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 8rpx 32rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-row {
|
||||||
|
padding: 24rpx 0;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-row__label {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #909399;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-row__control {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 72rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-row__value {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-row__value--placeholder {
|
||||||
|
color: #b0b3ba;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-options {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-option {
|
||||||
|
height: 60rpx;
|
||||||
|
padding: 0 26rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #f5f7fa;
|
||||||
|
border: 1rpx solid #ebeef5;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-option--active {
|
||||||
|
background: #ecf3ff;
|
||||||
|
border-color: #2979ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-option__text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-option--active .filter-option__text {
|
||||||
|
color: #2979ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 24rpx;
|
||||||
|
padding: 20rpx 32rpx calc(20rpx + env(safe-area-inset-bottom));
|
||||||
|
border-top: 1rpx solid #f0f0f0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 80rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__btn--reset {
|
||||||
|
background: #f5f7fa;
|
||||||
|
border: 1rpx solid #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__btn--confirm {
|
||||||
|
background: #2979ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__btn-text {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-popup__btn--confirm .filter-popup__btn-text {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-scroll {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
height: auto;
|
||||||
|
padding: 20rpx 0 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-wrap {
|
||||||
|
background: #ffffff;
|
||||||
|
border-top: 1rpx solid #f0f0f0;
|
||||||
|
padding: 0 24rpx env(safe-area-inset-bottom);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-item {
|
||||||
|
background: #ffffff;
|
||||||
|
padding: 18rpx 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-item:nth-child(odd) {
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-item:nth-child(even) {
|
||||||
|
background: #f2f4f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-single-line {
|
||||||
|
font-size: 36rpx;
|
||||||
|
line-height: 52rpx;
|
||||||
|
color: #303133;
|
||||||
|
word-break: break-all;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-single-line__value {
|
||||||
|
display: inline;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-single-line__dot {
|
||||||
|
display: inline-block;
|
||||||
|
width: 8rpx;
|
||||||
|
height: 8rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #dcdfe6;
|
||||||
|
margin: 0 12rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
margin-top: 18rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.safe-area-bottom {
|
||||||
|
height: calc(30rpx + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user