fix: 优化追溯码批量操作与出库界面
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<n-modal v-model:show="visible" preset="card" :title="title" class="batch-job-modal">
|
||||
<n-modal
|
||||
v-model:show="visible"
|
||||
preset="card"
|
||||
:title="title"
|
||||
style="width: 720px; max-width: 94vw"
|
||||
>
|
||||
<n-space v-if="job" align="center" wrap class="job-summary">
|
||||
<n-statistic :label="t('pages.operations.total')" :value="jobTotal" />
|
||||
<n-statistic :label="t('pages.operations.success')" :value="successCount" />
|
||||
@@ -232,9 +237,6 @@ onUnmounted(stopPolling);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.batch-job-modal {
|
||||
width: min(900px, calc(100vw - 32px));
|
||||
}
|
||||
.job-summary {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<n-modal v-model:show="visible" preset="card" :title="t('pages.blockchain.title')" class="proof-modal">
|
||||
<n-modal
|
||||
v-model:show="visible"
|
||||
preset="card"
|
||||
:title="t('pages.blockchain.title')"
|
||||
style="width: 680px; max-width: 94vw"
|
||||
>
|
||||
<n-descriptions :column="1" label-placement="left" bordered size="small">
|
||||
<n-descriptions-item :label="t('pages.traceCode.shortCode')">
|
||||
{{ traceCode?.shortCode || '-' }}
|
||||
@@ -232,9 +237,6 @@ watch(
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.proof-modal {
|
||||
width: min(680px, calc(100vw - 32px));
|
||||
}
|
||||
.proof-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,66 +1,71 @@
|
||||
<template>
|
||||
<div class="outbound-images">
|
||||
<div class="images-toolbar">
|
||||
<n-text depth="3">{{ t('pages.outbound.imageCount', { n: total }) }}</n-text>
|
||||
<div class="spacer" />
|
||||
<n-upload
|
||||
:show-file-list="false"
|
||||
accept=".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp"
|
||||
:custom-request="upload"
|
||||
:disabled="disabled || uploading"
|
||||
>
|
||||
<n-button size="small" :loading="uploading" :disabled="disabled">
|
||||
<template #icon><n-icon :component="CloudUploadOutline" /></template>
|
||||
{{ t('pages.outbound.addImage') }}
|
||||
</n-button>
|
||||
</n-upload>
|
||||
</div>
|
||||
|
||||
<n-spin :show="loading">
|
||||
<n-empty v-if="!items.length" :description="t('common.msg.noData')" class="empty-images" />
|
||||
<div v-else class="image-grid">
|
||||
<div v-if="items.length || !disabled" :class="['image-grid', { empty: !items.length }]">
|
||||
<div v-for="(item, index) in items" :key="imageId(item)" class="image-tile">
|
||||
<button class="image-preview" type="button" @click="preview(index)">
|
||||
<button
|
||||
class="image-preview"
|
||||
type="button"
|
||||
:title="item.name || item.key"
|
||||
@click="preview(index)"
|
||||
>
|
||||
<img :src="imageUrl(item)" :alt="item.name || t('pages.outbound.outImage')" loading="lazy" />
|
||||
</button>
|
||||
<div class="image-meta">
|
||||
<span class="image-name" :title="item.name || item.key">{{ item.name || item.key || '-' }}</span>
|
||||
<span class="image-order">{{ globalIndex(index) + 1 }}</span>
|
||||
<template v-if="!disabled">
|
||||
<button
|
||||
class="image-delete"
|
||||
type="button"
|
||||
:title="t('common.action.delete')"
|
||||
@click="remove(item)"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
<div class="image-actions">
|
||||
<n-button
|
||||
class="image-move-button"
|
||||
quaternary
|
||||
circle
|
||||
size="tiny"
|
||||
:disabled="disabled || globalIndex(index) === 0"
|
||||
:disabled="globalIndex(index) === 0"
|
||||
:title="t('pages.outbound.moveImageUp')"
|
||||
@click="move(item, index, 'UP')"
|
||||
>
|
||||
<template #icon><n-icon :component="ArrowUpOutline" /></template>
|
||||
</n-button>
|
||||
<n-button
|
||||
class="image-move-button"
|
||||
quaternary
|
||||
circle
|
||||
size="tiny"
|
||||
:disabled="disabled || globalIndex(index) === total - 1"
|
||||
:disabled="globalIndex(index) === total - 1"
|
||||
:title="t('pages.outbound.moveImageDown')"
|
||||
@click="move(item, index, 'DOWN')"
|
||||
>
|
||||
<template #icon><n-icon :component="ArrowDownOutline" /></template>
|
||||
</n-button>
|
||||
<n-button
|
||||
quaternary
|
||||
circle
|
||||
size="tiny"
|
||||
type="error"
|
||||
:disabled="disabled"
|
||||
:title="t('common.action.delete')"
|
||||
@click="remove(item)"
|
||||
>
|
||||
<template #icon><n-icon :component="TrashOutline" /></template>
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<n-upload
|
||||
v-if="!disabled"
|
||||
:show-file-list="false"
|
||||
accept=".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp"
|
||||
:custom-request="upload"
|
||||
:disabled="uploading"
|
||||
style="width: auto"
|
||||
>
|
||||
<div :class="['upload-tile', { uploading }]">
|
||||
<n-spin v-if="uploading" size="small" />
|
||||
<template v-else>
|
||||
<n-icon :component="AddOutline" :size="22" />
|
||||
<span>{{ t(recorded ? 'pages.outbound.addImage' : 'pages.outbound.recordImage') }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</n-upload>
|
||||
</div>
|
||||
<n-empty v-else :description="t('common.msg.noData')" class="empty-images" />
|
||||
</n-spin>
|
||||
|
||||
<div v-if="total > pageSize" class="images-pagination">
|
||||
@@ -80,7 +85,7 @@ import { onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { UploadCustomRequestOptions } from 'naive-ui';
|
||||
import { NIcon } from 'naive-ui';
|
||||
import { ArrowDownOutline, ArrowUpOutline, CloudUploadOutline, TrashOutline } from '@vicons/ionicons5';
|
||||
import { AddOutline, ArrowDownOutline, ArrowUpOutline } from '@vicons/ionicons5';
|
||||
import { outboundApi } from '@/api';
|
||||
import { dialog, message } from '@/utils/feedback';
|
||||
import { resolveMediaUrl } from '@/utils/mediaUrl';
|
||||
@@ -89,8 +94,11 @@ import { openMediaViewer } from '@/composables/openMediaViewer';
|
||||
const props = withDefaults(defineProps<{
|
||||
traceCodeId: string;
|
||||
disabled?: boolean;
|
||||
recorded?: boolean;
|
||||
beforeUpload?: () => Promise<void>;
|
||||
}>(), {
|
||||
disabled: false,
|
||||
recorded: false,
|
||||
});
|
||||
const emit = defineEmits<{ (event: 'changed'): void }>();
|
||||
|
||||
@@ -148,6 +156,7 @@ async function upload({ file, onFinish, onError }: UploadCustomRequestOptions) {
|
||||
}
|
||||
uploading.value = true;
|
||||
try {
|
||||
await props.beforeUpload?.();
|
||||
const data = new FormData();
|
||||
data.append('file', raw);
|
||||
await outboundApi.uploadImage(props.traceCodeId, data);
|
||||
@@ -219,37 +228,35 @@ defineExpose({ reload: load });
|
||||
.outbound-images {
|
||||
min-width: 0;
|
||||
}
|
||||
.images-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.empty-images {
|
||||
padding: 28px 0;
|
||||
}
|
||||
.image-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
|
||||
gap: 12px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
min-height: 96px;
|
||||
}
|
||||
.image-tile {
|
||||
min-width: 0;
|
||||
border: 1px solid var(--n-border-color);
|
||||
border-radius: 6px;
|
||||
.image-grid.empty {
|
||||
justify-content: center;
|
||||
}
|
||||
.image-tile,
|
||||
.upload-tile {
|
||||
position: relative;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
background: var(--n-color);
|
||||
border: 1px solid var(--n-border-color, #e0e0e6);
|
||||
background: #f4f7fc;
|
||||
}
|
||||
.image-preview {
|
||||
display: block;
|
||||
width: 100%;
|
||||
aspect-ratio: 4 / 3;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: #f4f7f8;
|
||||
background: transparent;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
.image-preview img {
|
||||
@@ -258,24 +265,70 @@ defineExpose({ reload: load });
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.image-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 38px;
|
||||
padding: 4px 6px 4px 8px;
|
||||
.image-order {
|
||||
position: absolute;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 9px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
pointer-events: none;
|
||||
}
|
||||
.image-name {
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.image-delete:hover {
|
||||
background: #d03050;
|
||||
}
|
||||
.image-actions {
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
bottom: 3px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1px;
|
||||
padding: 1px;
|
||||
border-radius: 12px;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
:deep(.image-move-button) {
|
||||
color: #fff;
|
||||
}
|
||||
:deep(.image-move-button.n-button--disabled) {
|
||||
color: rgba(255, 255, 255, 0.42);
|
||||
}
|
||||
.upload-tile {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
border-style: dashed;
|
||||
background: #fafcff;
|
||||
color: #6b7280;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.upload-tile.uploading {
|
||||
cursor: default;
|
||||
}
|
||||
.images-pagination {
|
||||
display: flex;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<n-modal v-model:show="visible" preset="card" :title="modalTitle" class="outbound-record-modal">
|
||||
<n-modal
|
||||
v-model:show="visible"
|
||||
preset="card"
|
||||
:title="modalTitle"
|
||||
style="width: 720px; max-width: 94vw"
|
||||
>
|
||||
<n-spin :show="loading">
|
||||
<n-descriptions :column="2" label-placement="top" size="small" bordered class="trace-summary">
|
||||
<n-descriptions-item :label="t('pages.traceCode.shortCode')">
|
||||
@@ -46,7 +51,9 @@
|
||||
v-if="traceCodeId"
|
||||
ref="imageManager"
|
||||
:trace-code-id="traceCodeId"
|
||||
:disabled="!auth.canWrite || !hasRecord"
|
||||
:disabled="!auth.canWrite || saving"
|
||||
:recorded="hasRecord"
|
||||
:before-upload="ensureRecordForUpload"
|
||||
@changed="emit('changed')"
|
||||
/>
|
||||
</n-spin>
|
||||
@@ -110,6 +117,7 @@ function formatDate(value?: string | Date | null) {
|
||||
async function load() {
|
||||
if (!traceCodeId.value) return;
|
||||
const version = ++loadVersion;
|
||||
record.value = null;
|
||||
loading.value = true;
|
||||
try {
|
||||
let next: any = null;
|
||||
@@ -129,10 +137,10 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
async function saveRecord() {
|
||||
async function persistRecord(notify: boolean) {
|
||||
if (!traceCodeId.value || !form.outTime) {
|
||||
message.warning(t('pages.outbound.outTimeRequired'));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
saving.value = true;
|
||||
try {
|
||||
@@ -147,14 +155,24 @@ async function saveRecord() {
|
||||
outTime,
|
||||
remark: form.remark.trim() || null,
|
||||
};
|
||||
message.success(t('common.msg.saved'));
|
||||
if (notify) message.success(t('common.msg.saved'));
|
||||
emit('changed');
|
||||
await imageManager.value?.reload();
|
||||
return true;
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function saveRecord() {
|
||||
await persistRecord(true);
|
||||
}
|
||||
|
||||
async function ensureRecordForUpload() {
|
||||
if (hasRecord.value) return;
|
||||
const saved = await persistRecord(false);
|
||||
if (!saved) throw new Error('Outbound record is required before uploading images.');
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.show, traceCodeId.value] as const,
|
||||
([show]) => {
|
||||
@@ -169,9 +187,6 @@ watch(
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.outbound-record-modal {
|
||||
width: min(780px, calc(100vw - 32px));
|
||||
}
|
||||
.trace-summary {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,12 @@
|
||||
<n-pagination v-bind="pagination" :disabled="loading" />
|
||||
</div>
|
||||
|
||||
<n-modal v-model:show="matchVisible" preset="card" :title="t('pages.operations.matchCodes')" class="match-modal">
|
||||
<n-modal
|
||||
v-model:show="matchVisible"
|
||||
preset="card"
|
||||
:title="t('pages.operations.matchCodes')"
|
||||
style="width: 920px; max-width: 94vw"
|
||||
>
|
||||
<n-input
|
||||
v-model:value="matchText"
|
||||
type="textarea"
|
||||
@@ -191,7 +196,7 @@
|
||||
v-model:show="outboundBatchVisible"
|
||||
preset="card"
|
||||
:title="t('pages.operations.batchOutbound')"
|
||||
class="outbound-batch-modal"
|
||||
style="width: 520px; max-width: 94vw"
|
||||
>
|
||||
<n-form :model="outboundForm" label-placement="top">
|
||||
<n-form-item :label="t('pages.outbound.outTime')" required>
|
||||
@@ -903,9 +908,10 @@ function runSingleOnchain(row: any) {
|
||||
}
|
||||
|
||||
async function submitSingleOnchain(row: any) {
|
||||
const result: any = await onchainApi.createJob({ mode: 'IDS', ids: [String(row.id)] });
|
||||
await onchainApi.createJob({ mode: 'IDS', ids: [String(row.id)] });
|
||||
proofVisible.value = false;
|
||||
openJob(extractJobId(result));
|
||||
message.success(t('pages.operations.jobSubmitted'));
|
||||
void load();
|
||||
}
|
||||
|
||||
function openOutboundRecord(row: any) {
|
||||
@@ -980,12 +986,6 @@ onUnmounted(() => {
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.match-modal {
|
||||
width: min(920px, calc(100vw - 32px));
|
||||
}
|
||||
.outbound-batch-modal {
|
||||
width: min(520px, calc(100vw - 32px));
|
||||
}
|
||||
.match-actions,
|
||||
.match-summary {
|
||||
margin-top: 12px;
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
<n-card v-if="auth.canWrite && checkedKeys.length" size="small" class="batch-bar" :bordered="false">
|
||||
<n-space align="center">
|
||||
<span>{{ t('pages.traceCode.selected', { n: checkedKeys.length }) }}</span>
|
||||
<n-button size="small" type="primary" :disabled="batchSubmitting" @click="openBatchOutbound">
|
||||
<template #icon><n-icon :component="CubeOutline" /></template>
|
||||
{{ t('pages.operations.batchOutboundWithCount', { n: checkedKeys.length }) }}
|
||||
</n-button>
|
||||
<n-button size="small" :disabled="batchSubmitting" @click="confirmBatchOnchain">
|
||||
<template #icon><n-icon :component="ShieldCheckmarkOutline" /></template>
|
||||
{{ t('pages.operations.batchOnchain', { n: checkedKeys.length }) }}
|
||||
</n-button>
|
||||
<n-dropdown trigger="click" :options="groupAssignOptions" @select="batchAssignGroup">
|
||||
<n-button size="small">
|
||||
<template #icon><n-icon :component="FolderOutline" /></template>
|
||||
@@ -144,6 +152,47 @@
|
||||
</template>
|
||||
</n-modal>
|
||||
|
||||
<n-modal
|
||||
v-model:show="batchOutboundVisible"
|
||||
preset="card"
|
||||
:title="t('pages.operations.batchOutbound')"
|
||||
style="width: 520px; max-width: 94vw"
|
||||
>
|
||||
<n-form :model="batchOutboundForm" label-placement="top">
|
||||
<n-form-item :label="t('pages.outbound.outTime')" required>
|
||||
<n-date-picker
|
||||
v-model:formatted-value="batchOutboundForm.outTime"
|
||||
value-format="yyyy-MM-dd HH:mm"
|
||||
type="datetime"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('common.label.remark')">
|
||||
<n-input
|
||||
v-model:value="batchOutboundForm.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
:maxlength="191"
|
||||
show-count
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<div class="modal-actions">
|
||||
<n-button @click="batchOutboundVisible = false">{{ t('common.action.cancel') }}</n-button>
|
||||
<n-button
|
||||
type="primary"
|
||||
:loading="batchSubmitting"
|
||||
:disabled="!batchOutboundForm.outTime"
|
||||
@click="submitBatchOutbound"
|
||||
>
|
||||
{{ t('pages.operations.confirmBatch', { n: checkedKeys.length }) }}
|
||||
</n-button>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
|
||||
<outbound-record-modal
|
||||
v-model:show="outboundRecordVisible"
|
||||
:trace-code="operationTarget"
|
||||
@@ -158,7 +207,7 @@
|
||||
<batch-job-modal
|
||||
v-model:show="jobVisible"
|
||||
:job-id="jobId"
|
||||
:title="t('pages.operations.onchainProgress')"
|
||||
:title="batchJobTitle"
|
||||
@completed="reloadAfterOperation"
|
||||
/>
|
||||
</div>
|
||||
@@ -168,10 +217,11 @@
|
||||
import { computed, h, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NDropdown, NIcon, NTag, NText, type DataTableColumns, type DropdownOption } from 'naive-ui';
|
||||
import { SearchOutline, AddOutline, DownloadOutline, QrCodeOutline, FolderOutline, OpenOutline, EllipsisHorizontalOutline, FilterOutline } from '@vicons/ionicons5';
|
||||
import { SearchOutline, AddOutline, DownloadOutline, QrCodeOutline, FolderOutline, OpenOutline, EllipsisHorizontalOutline, FilterOutline, CubeOutline, ShieldCheckmarkOutline } from '@vicons/ionicons5';
|
||||
import { TraceCodeStatus } from '@artveris/shared';
|
||||
import { traceCodeApi, jobApi, artworkApi, onchainApi } from '@/api';
|
||||
import { traceCodeApi, jobApi, artworkApi, onchainApi, outboundApi } from '@/api';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { message, dialog } from '@/utils/feedback';
|
||||
import { fmt, statusType } from '@/utils/format';
|
||||
@@ -266,11 +316,20 @@ const editingGroup = ref<number | null>(null);
|
||||
const batchModal = ref(false);
|
||||
const batchTarget = ref<any | null>(null);
|
||||
const batchForm = reactive<{ batchValue: number | string | null }>({ batchValue: null });
|
||||
const batchOutboundVisible = ref(false);
|
||||
const batchOutboundForm = reactive({ outTime: '', remark: '' });
|
||||
const batchSubmitting = ref(false);
|
||||
const batchJobType = ref<'ONCHAIN' | 'OUTBOUND'>('ONCHAIN');
|
||||
const outboundRecordVisible = ref(false);
|
||||
const proofVisible = ref(false);
|
||||
const operationTarget = ref<any | null>(null);
|
||||
const jobVisible = ref(false);
|
||||
const jobId = ref('');
|
||||
const batchJobTitle = computed(() =>
|
||||
batchJobType.value === 'ONCHAIN'
|
||||
? t('pages.operations.onchainProgress')
|
||||
: t('pages.operations.outboundProgress'),
|
||||
);
|
||||
|
||||
function rowIsOutbound(row: any) {
|
||||
if (!row) return false;
|
||||
@@ -747,6 +806,65 @@ async function batchStatus(disabled: boolean) {
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
function openBatchOutbound() {
|
||||
if (!checkedKeys.value.length) return;
|
||||
batchOutboundForm.outTime = dayjs().format('YYYY-MM-DD HH:mm');
|
||||
batchOutboundForm.remark = '';
|
||||
batchOutboundVisible.value = true;
|
||||
}
|
||||
|
||||
function confirmBatchOnchain() {
|
||||
if (!checkedKeys.value.length) return;
|
||||
dialog.warning({
|
||||
title: t('pages.operations.batchOnchainTitle'),
|
||||
content: t('pages.operations.batchOnchainConfirm', { n: checkedKeys.value.length }),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: submitBatchOnchain,
|
||||
});
|
||||
}
|
||||
|
||||
function openSubmittedBatch(result: any, type: 'ONCHAIN' | 'OUTBOUND') {
|
||||
const id = String(result?.jobId || result?.id || result?.job?.id || '');
|
||||
batchJobType.value = type;
|
||||
checkedKeys.value = [];
|
||||
if (id) {
|
||||
jobId.value = id;
|
||||
jobVisible.value = true;
|
||||
} else {
|
||||
message.success(t('pages.operations.jobSubmitted'));
|
||||
}
|
||||
void load();
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
async function submitBatchOnchain() {
|
||||
if (!checkedKeys.value.length || batchSubmitting.value) return;
|
||||
batchSubmitting.value = true;
|
||||
try {
|
||||
const result = await onchainApi.createJob({ mode: 'IDS', ids: checkedKeys.value.map(String) });
|
||||
openSubmittedBatch(result, 'ONCHAIN');
|
||||
} finally {
|
||||
batchSubmitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function submitBatchOutbound() {
|
||||
if (!checkedKeys.value.length || !batchOutboundForm.outTime || batchSubmitting.value) return;
|
||||
batchSubmitting.value = true;
|
||||
try {
|
||||
const result = await outboundApi.createJob(
|
||||
{ mode: 'IDS', ids: checkedKeys.value.map(String) },
|
||||
dayjs(batchOutboundForm.outTime).toISOString(),
|
||||
batchOutboundForm.remark.trim() || undefined,
|
||||
);
|
||||
batchOutboundVisible.value = false;
|
||||
openSubmittedBatch(result, 'OUTBOUND');
|
||||
} finally {
|
||||
batchSubmitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function batchDelete() {
|
||||
if (!checkedKeys.value.length) return;
|
||||
dialog.warning({
|
||||
@@ -945,16 +1063,10 @@ function runOnchainRow(row: any) {
|
||||
}
|
||||
|
||||
async function submitOnchainRow(row: any) {
|
||||
const result: any = await onchainApi.createJob({ mode: 'IDS', ids: [String(row.id)] });
|
||||
await onchainApi.createJob({ mode: 'IDS', ids: [String(row.id)] });
|
||||
proofVisible.value = false;
|
||||
const id = String(result?.jobId || result?.id || result?.job?.id || '');
|
||||
if (id) {
|
||||
jobId.value = id;
|
||||
jobVisible.value = true;
|
||||
} else {
|
||||
message.success(t('pages.operations.jobSubmitted'));
|
||||
}
|
||||
await load();
|
||||
message.success(t('pages.operations.jobSubmitted'));
|
||||
void load();
|
||||
}
|
||||
|
||||
async function reloadAfterOperation() {
|
||||
@@ -1071,6 +1183,11 @@ onUnmounted(() => {
|
||||
.batch-bar {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
.group-toolbar {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
@@ -447,8 +447,8 @@
|
||||
"saveRecord": "Save Record",
|
||||
"registerRecord": "Register Outbound",
|
||||
"editRecord": "Edit Outbound Record",
|
||||
"addImage": "Add Outbound Photo",
|
||||
"imageCount": "{n} photo(s)",
|
||||
"recordImage": "Add Outbound Photo",
|
||||
"addImage": "Add Another Outbound Photo",
|
||||
"moveImageUp": "Move earlier",
|
||||
"moveImageDown": "Move later",
|
||||
"imageFormatTip": "Only JPG, JPEG, PNG, and WebP images are supported",
|
||||
|
||||
@@ -447,8 +447,8 @@
|
||||
"saveRecord": "保存登记",
|
||||
"registerRecord": "登记出库",
|
||||
"editRecord": "编辑出库记录",
|
||||
"recordImage": "录入实况图",
|
||||
"addImage": "补录实况图",
|
||||
"imageCount": "共 {n} 张",
|
||||
"moveImageUp": "前移",
|
||||
"moveImageDown": "后移",
|
||||
"imageFormatTip": "仅支持 JPG、JPEG、PNG、WebP 图片",
|
||||
|
||||
@@ -34,12 +34,16 @@ const activeTab = ref<'records' | 'zip'>('records');
|
||||
.operation-tabs :deep(.n-tabs-nav) {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.operation-tabs :deep(.n-tabs-pane-wrapper),
|
||||
.operation-tabs :deep(.n-tab-pane) {
|
||||
.operation-tabs :deep(.n-tabs-pane-wrapper) {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.operation-tabs :deep(.n-tab-pane) {
|
||||
flex: 1 1 0;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-top: 12px;
|
||||
|
||||
Reference in New Issue
Block a user