|
|
@@ -185,8 +185,8 @@
|
|
|
<el-button
|
|
|
link
|
|
|
type="danger"
|
|
|
- :disabled="!isRecordToday(row)"
|
|
|
- :title="isRecordToday(row) ? '' : '仅支持删除当天的记录'"
|
|
|
+ :disabled="!canDeleteRecord(row)"
|
|
|
+ :title="canDeleteRecord(row) ? '' : '仅支持删除当天及之后日期的记录'"
|
|
|
@click="handleDelete(row)"
|
|
|
>
|
|
|
<el-icon><Delete /></el-icon>
|
|
|
@@ -371,13 +371,19 @@
|
|
|
>
|
|
|
<div v-if="captureRow" class="qrcode-dialog-body pound-slip-capture-inline">
|
|
|
<div class="capture-card">
|
|
|
- <div class="capture-title">出入库单信息(已锁定)</div>
|
|
|
+ <div class="capture-row capture-row-plate">
|
|
|
+ <div class="vehicle-plate">
|
|
|
+ <span class="vehicle-plate-dot vehicle-plate-dot-lt"></span>
|
|
|
+ <span class="vehicle-plate-dot vehicle-plate-dot-lb"></span>
|
|
|
+ <span class="vehicle-plate-text">{{ captureRow.vehicleNo }}</span>
|
|
|
+ <span class="vehicle-plate-dot vehicle-plate-dot-rt"></span>
|
|
|
+ <span class="vehicle-plate-dot vehicle-plate-dot-rb"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="capture-row"><span class="label">日期:</span><span class="value">{{ captureRow.date }}</span></div>
|
|
|
<div class="capture-row"><span class="label">往来单位:</span><span class="value">{{ captureRow.partnerCompany }}</span></div>
|
|
|
- <div class="capture-row"><span class="label">业务类型:</span><span class="value">{{ captureRow.businessType }}</span></div>
|
|
|
- <div class="capture-row"><span class="label">产品:</span><span class="value">{{ captureRow.product }}</span></div>
|
|
|
+ <div class="capture-row"><span class="label">物料名称:</span><span class="value">{{ captureRow.product }}</span></div>
|
|
|
<div class="capture-row"><span class="label">数量(吨):</span><span class="value">{{ captureRow.quantity }}</span></div>
|
|
|
- <div class="capture-row"><span class="label">车牌号:</span><span class="value vehicle-no">{{ captureRow.vehicleNo }}</span></div>
|
|
|
<div v-if="captureRow.remarks" class="capture-row"><span class="label">备注:</span><span class="value">{{ captureRow.remarks }}</span></div>
|
|
|
</div>
|
|
|
<div class="capture-card capture-qrcode">
|
|
|
@@ -416,14 +422,14 @@
|
|
|
const currentPage = ref(1)
|
|
|
const pageSize = ref(10)
|
|
|
const searchKeyword = ref('')
|
|
|
- const dateFilterType = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week'>('all')
|
|
|
+ const dateFilterType = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week'>('today')
|
|
|
const sortProp = ref<string>('date')
|
|
|
const sortOrder = ref<'ascending' | 'descending' | null>('descending')
|
|
|
|
|
|
- // 日期范围筛选
|
|
|
- const dateRange = ref<[string, string]>([
|
|
|
- dayjs().startOf('month').format('YYYY-MM-DD'),
|
|
|
- dayjs().endOf('month').format('YYYY-MM-DD')
|
|
|
+ // 日期范围筛选(默认今日)
|
|
|
+ const dateRange = ref<[string, string] | null>([
|
|
|
+ dayjs().format('YYYY-MM-DD'),
|
|
|
+ dayjs().format('YYYY-MM-DD')
|
|
|
])
|
|
|
|
|
|
const modalOpen = ref(false)
|
|
|
@@ -564,29 +570,6 @@
|
|
|
params.dateTo = dateRange.value[1]
|
|
|
}
|
|
|
|
|
|
- // 快捷日期筛选(按创建时间)
|
|
|
- const today = dayjs().format('YYYY-MM-DD')
|
|
|
- if (dateFilterType.value === 'today') {
|
|
|
- params.dateFrom = today
|
|
|
- params.dateTo = today
|
|
|
- } else if (dateFilterType.value === 'tomorrow') {
|
|
|
- const t = dayjs().add(1, 'day').format('YYYY-MM-DD')
|
|
|
- params.dateFrom = t
|
|
|
- params.dateTo = t
|
|
|
- } else if (dateFilterType.value === 'yesterday') {
|
|
|
- const y = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
|
|
|
- params.dateFrom = y
|
|
|
- params.dateTo = y
|
|
|
- } else if (dateFilterType.value === 'week') {
|
|
|
- // 本周:周一到周日
|
|
|
- const today = dayjs()
|
|
|
- const weekday = today.day() === 0 ? 7 : today.day()
|
|
|
- const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
|
|
|
- const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
|
|
|
- params.dateFrom = monday
|
|
|
- params.dateTo = sunday
|
|
|
- }
|
|
|
-
|
|
|
const records = await inventoryApi.list(params)
|
|
|
allRecords.value = records
|
|
|
applySortAndPage()
|
|
|
@@ -604,12 +587,35 @@
|
|
|
|
|
|
const setDateFilter = (type: 'all' | 'today' | 'tomorrow' | 'yesterday' | 'week') => {
|
|
|
dateFilterType.value = type
|
|
|
+
|
|
|
+ const today = dayjs()
|
|
|
+ if (type === 'all') {
|
|
|
+ // 全部:不限制日期
|
|
|
+ dateRange.value = null
|
|
|
+ } else if (type === 'today') {
|
|
|
+ const d = today.format('YYYY-MM-DD')
|
|
|
+ dateRange.value = [d, d]
|
|
|
+ } else if (type === 'tomorrow') {
|
|
|
+ const t = today.add(1, 'day').format('YYYY-MM-DD')
|
|
|
+ dateRange.value = [t, t]
|
|
|
+ } else if (type === 'yesterday') {
|
|
|
+ const y = today.subtract(1, 'day').format('YYYY-MM-DD')
|
|
|
+ dateRange.value = [y, y]
|
|
|
+ } else if (type === 'week') {
|
|
|
+ // 本周:周一到周日
|
|
|
+ const weekday = today.day() === 0 ? 7 : today.day()
|
|
|
+ const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
|
|
|
+ const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
|
|
|
+ dateRange.value = [monday, sunday]
|
|
|
+ }
|
|
|
+
|
|
|
currentPage.value = 1
|
|
|
loadData()
|
|
|
}
|
|
|
|
|
|
- // 日期范围变化处理
|
|
|
+ // 日期范围变化处理(手动调整日期时,取消快捷筛选高亮)
|
|
|
const handleDateRangeChange = () => {
|
|
|
+ dateFilterType.value = 'all'
|
|
|
currentPage.value = 1
|
|
|
loadData()
|
|
|
}
|
|
|
@@ -686,15 +692,18 @@
|
|
|
modalOpen.value = true
|
|
|
}
|
|
|
|
|
|
- /** 判断是否为当天记录(仅当天可删除) */
|
|
|
- const isRecordToday = (row: InventoryRecord) => {
|
|
|
+ /** 判断是否为当天及之后日期的记录(当天及之后可删除) */
|
|
|
+ const canDeleteRecord = (row: InventoryRecord) => {
|
|
|
const dateStr = row.date || ''
|
|
|
- return dateStr === dayjs().format('YYYY-MM-DD')
|
|
|
+ if (!dateStr) return false
|
|
|
+ const today = dayjs().format('YYYY-MM-DD')
|
|
|
+ // 日期字段为 YYYY-MM-DD,字符串比较等价于日期比较
|
|
|
+ return dateStr >= today
|
|
|
}
|
|
|
|
|
|
const handleDelete = (row: InventoryRecord) => {
|
|
|
- if (!isRecordToday(row)) {
|
|
|
- ElMessage.warning('仅支持删除当天的记录,历史数据不可删除')
|
|
|
+ if (!canDeleteRecord(row)) {
|
|
|
+ ElMessage.warning('仅支持删除当天及之后日期的记录,历史数据不可删除')
|
|
|
return
|
|
|
}
|
|
|
ElMessageBox.confirm('确定要删除这条记录吗?', '确认删除', {
|
|
|
@@ -869,29 +878,6 @@
|
|
|
params.dateTo = dateRange.value[1]
|
|
|
}
|
|
|
|
|
|
- // 快捷日期筛选(按创建时间)
|
|
|
- const today = dayjs().format('YYYY-MM-DD')
|
|
|
- if (dateFilterType.value === 'today') {
|
|
|
- params.dateFrom = today
|
|
|
- params.dateTo = today
|
|
|
- } else if (dateFilterType.value === 'tomorrow') {
|
|
|
- const t = dayjs().add(1, 'day').format('YYYY-MM-DD')
|
|
|
- params.dateFrom = t
|
|
|
- params.dateTo = t
|
|
|
- } else if (dateFilterType.value === 'yesterday') {
|
|
|
- const y = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
|
|
|
- params.dateFrom = y
|
|
|
- params.dateTo = y
|
|
|
- } else if (dateFilterType.value === 'week') {
|
|
|
- // 本周:周一到周日
|
|
|
- const today = dayjs()
|
|
|
- const weekday = today.day() === 0 ? 7 : today.day()
|
|
|
- const monday = today.subtract(weekday - 1, 'day').format('YYYY-MM-DD')
|
|
|
- const sunday = today.add(7 - weekday, 'day').format('YYYY-MM-DD')
|
|
|
- params.dateFrom = monday
|
|
|
- params.dateTo = sunday
|
|
|
- }
|
|
|
-
|
|
|
const records = await inventoryApi.list(params)
|
|
|
if (records.length === 0) {
|
|
|
ElMessage.warning('没有数据可导出')
|
|
|
@@ -1015,10 +1001,10 @@
|
|
|
color: var(--el-color-danger);
|
|
|
}
|
|
|
|
|
|
- /* 磅单二维码弹窗:顶部/底部/内容区上下边距缩小 */
|
|
|
+ /* 磅单二维码弹窗:标题栏高度缩小,内容区上下边距缩小 */
|
|
|
:deep(.qrcode-dialog.el-dialog) {
|
|
|
.el-dialog__header {
|
|
|
- padding: 8px 16px 6px;
|
|
|
+ padding: 4px 12px 2px;
|
|
|
}
|
|
|
.el-dialog__body {
|
|
|
padding: 6px 16px;
|
|
|
@@ -1071,6 +1057,7 @@
|
|
|
}
|
|
|
.pound-slip-capture-inline .capture-row {
|
|
|
display: flex;
|
|
|
+ justify-content: center;
|
|
|
align-items: center;
|
|
|
margin-bottom: 4px;
|
|
|
font-size: 13px;
|
|
|
@@ -1088,6 +1075,42 @@
|
|
|
color: #111827;
|
|
|
font-size: 15px;
|
|
|
}
|
|
|
+ /* 车牌号牌照样式:黄底、圆角、双白边、白字、四角圆点 */
|
|
|
+ .pound-slip-capture-inline .capture-row-plate {
|
|
|
+ width: 100%;
|
|
|
+ justify-content: stretch;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ }
|
|
|
+ .pound-slip-capture-inline .vehicle-plate {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 100%;
|
|
|
+ padding: 6px 28px;
|
|
|
+ background: #F5D000;
|
|
|
+ border: 3px solid #fff;
|
|
|
+ border-radius: 8px;
|
|
|
+ box-shadow: 0 0 0 2px #fff;
|
|
|
+ }
|
|
|
+ .pound-slip-capture-inline .vehicle-plate-text {
|
|
|
+ font-size: 28px;
|
|
|
+ font-weight: 700;
|
|
|
+ color: #000;
|
|
|
+ letter-spacing: 1px;
|
|
|
+ }
|
|
|
+ .pound-slip-capture-inline .vehicle-plate-dot {
|
|
|
+ position: absolute;
|
|
|
+ width: 8px;
|
|
|
+ height: 8px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+ .pound-slip-capture-inline .vehicle-plate-dot-lt { left: 6px; top: 8px; }
|
|
|
+ .pound-slip-capture-inline .vehicle-plate-dot-lb { left: 6px; bottom: 8px; }
|
|
|
+ .pound-slip-capture-inline .vehicle-plate-dot-rt { right: 6px; top: 8px; }
|
|
|
+ .pound-slip-capture-inline .vehicle-plate-dot-rb { right: 6px; bottom: 8px; }
|
|
|
.pound-slip-capture-inline .capture-qrcode {
|
|
|
text-align: center;
|
|
|
}
|