up
This commit is contained in:
@@ -50,14 +50,14 @@ type TabWarehouseItemFileBind struct {
|
||||
}
|
||||
|
||||
type TabWarehouseItemCommit struct {
|
||||
ID uint `gorm:"primaryKey"`
|
||||
ItemID uint `gorm:"not null;index;comment:关联物品id"`
|
||||
UserID uint `gorm:"not null;comment:操作人id"`
|
||||
OldContainer *uint `gorm:"index;comment:原容器id"`
|
||||
NewContainer *uint `gorm:"index;comment:新容器id"`
|
||||
Remark string `gorm:"type:text;comment:备注"`
|
||||
IP string `gorm:"size:50;comment:操作IP"`
|
||||
CreatedAt time.Time `gorm:"type:datetime;autoCreateTime"`
|
||||
ID uint `gorm:"primaryKey" json:"ID"`
|
||||
ItemID uint `gorm:"not null;index;comment:关联物品id" json:"ItemID"`
|
||||
UserID uint `gorm:"not null;comment:操作人id" json:"UserID"`
|
||||
OldContainer *uint `gorm:"index;comment:原容器id" json:"OldContainer"`
|
||||
NewContainer *uint `gorm:"index;comment:新容器id" json:"NewContainer"`
|
||||
Remark string `gorm:"type:text;comment:备注" json:"Remark"`
|
||||
IP string `gorm:"size:50;comment:操作IP" json:"IP"`
|
||||
CreatedAt time.Time `gorm:"type:datetime;autoCreateTime" json:"CreatedAt"`
|
||||
}
|
||||
|
||||
type TabWarehouseLog struct {
|
||||
|
||||
@@ -38,7 +38,7 @@ const notFound = ref(false)
|
||||
const containerNames = reactive({})
|
||||
|
||||
// ── Tab ──
|
||||
const activeTab = ref('history')
|
||||
const activeTab = ref('work_orders')
|
||||
|
||||
// ── 编辑弹窗 ──
|
||||
const showEdit = ref(false)
|
||||
@@ -105,6 +105,8 @@ function fmtTs(ts) {
|
||||
return d.toLocaleString()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ── 拉取物品详情 ──
|
||||
async function fetchItem() {
|
||||
loadingDetail.value = true
|
||||
@@ -428,15 +430,6 @@ onMounted(() => {
|
||||
|
||||
<!-- Tab 切换 -->
|
||||
<div class="flex gap-1 rounded-lg border border-gray-200 bg-gray-50 p-1 dark:border-dk-muted dark:bg-dk-base w-fit">
|
||||
<button
|
||||
class="px-4 py-1.5 text-sm rounded-md font-medium transition-colors"
|
||||
:class="activeTab === 'history'
|
||||
? 'bg-white text-gray-900 shadow-sm dark:bg-dk-card dark:text-white'
|
||||
: 'text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200'"
|
||||
@click="activeTab = 'history'"
|
||||
>
|
||||
{{ t('warehouse.move_history') }} ({{ commits.length }})
|
||||
</button>
|
||||
<button
|
||||
class="px-4 py-1.5 text-sm rounded-md font-medium transition-colors"
|
||||
:class="activeTab === 'work_orders'
|
||||
@@ -446,40 +439,15 @@ onMounted(() => {
|
||||
>
|
||||
{{ t('warehouse.work_orders') }} ({{ workOrders.length }})
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 移动历史 -->
|
||||
<div v-if="activeTab === 'history'">
|
||||
<div v-if="commits.length === 0" class="rounded-xl border border-gray-200 bg-white px-5 py-8 text-center text-sm text-gray-400 dark:border-dk-muted dark:bg-dk-card">
|
||||
{{ t('warehouse.no_move_history') }}
|
||||
</div>
|
||||
<div v-else class="space-y-2">
|
||||
<div
|
||||
v-for="commit in commits"
|
||||
:key="commit.ID"
|
||||
class="rounded-xl border border-gray-200 bg-white px-4 py-3 flex items-center gap-3 dark:border-dk-muted dark:bg-dk-card"
|
||||
>
|
||||
<!-- 操作人头像 -->
|
||||
<div class="flex-shrink-0">
|
||||
<div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center text-xs font-medium text-blue-700 dark:bg-blue-900/40 dark:text-blue-400">
|
||||
{{ usersStore.getUsernameFromUserID(commit.UserID)?.slice(0, 1) || '?' }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 路径 -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-2 flex-wrap text-xs text-gray-400">
|
||||
<span>{{ usersStore.getUsernameFromUserID(commit.UserID) }}</span>
|
||||
<span>{{ fmtTs(commit.CreatedAt) }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5 mt-0.5 flex-wrap text-sm font-medium text-gray-700 dark:text-gray-200">
|
||||
<span>{{ getContainerName(commit.OldContainer) }}</span>
|
||||
<IconArrowRight :size="13" class="text-blue-500 flex-shrink-0" />
|
||||
<span>{{ getContainerName(commit.NewContainer) }}</span>
|
||||
</div>
|
||||
<p v-if="commit.Remark" class="text-xs text-gray-400 mt-0.5">{{ commit.Remark }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
class="px-4 py-1.5 text-sm rounded-md font-medium transition-colors"
|
||||
:class="activeTab === 'history'
|
||||
? 'bg-white text-gray-900 shadow-sm dark:bg-dk-card dark:text-white'
|
||||
: 'text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200'"
|
||||
@click="activeTab = 'history'"
|
||||
>
|
||||
{{ t('warehouse.move_history') }} ({{ commits.length }})
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 关联工单 -->
|
||||
@@ -508,6 +476,41 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 移动历史 -->
|
||||
<div v-if="activeTab === 'history'">
|
||||
<div v-if="commits.length === 0" class="rounded-xl border border-gray-200 bg-white px-5 py-8 text-center text-sm text-gray-400 dark:border-dk-muted dark:bg-dk-card">
|
||||
{{ t('warehouse.no_move_history') }}
|
||||
</div>
|
||||
<div v-else class="space-y-2">
|
||||
<div
|
||||
v-for="commit in commits"
|
||||
:key="commit.ID"
|
||||
class="rounded-xl border border-gray-200 bg-white px-4 py-3 flex items-center gap-3 dark:border-dk-muted dark:bg-dk-card"
|
||||
>
|
||||
<!-- 操作人头像 -->
|
||||
<div class="flex-shrink-0">
|
||||
<img
|
||||
:src="usersStore.getAvatarUrlFromUserID(commit.UserID)"
|
||||
class="w-8 h-8 rounded-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
<!-- 路径 -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-2 flex-wrap text-xs text-gray-400">
|
||||
<span>{{ usersStore.getUsernameFromUserID(commit.UserID) || `User#${commit.UserID}` }}</span>
|
||||
<span>{{ fmtTs(commit.CreatedAt) }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5 mt-0.5 flex-wrap text-sm font-medium text-gray-700 dark:text-gray-200">
|
||||
<span>{{ getContainerName(commit.OldContainer) }}</span>
|
||||
<IconArrowRight :size="13" class="text-blue-500 flex-shrink-0" />
|
||||
<span>{{ getContainerName(commit.NewContainer) }}</span>
|
||||
</div>
|
||||
<p v-if="commit.Remark" class="text-xs text-gray-400 mt-0.5">{{ commit.Remark }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user