up
This commit is contained in:
@@ -50,14 +50,14 @@ type TabWarehouseItemFileBind struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TabWarehouseItemCommit struct {
|
type TabWarehouseItemCommit struct {
|
||||||
ID uint `gorm:"primaryKey"`
|
ID uint `gorm:"primaryKey" json:"ID"`
|
||||||
ItemID uint `gorm:"not null;index;comment:关联物品id"`
|
ItemID uint `gorm:"not null;index;comment:关联物品id" json:"ItemID"`
|
||||||
UserID uint `gorm:"not null;comment:操作人id"`
|
UserID uint `gorm:"not null;comment:操作人id" json:"UserID"`
|
||||||
OldContainer *uint `gorm:"index;comment:原容器id"`
|
OldContainer *uint `gorm:"index;comment:原容器id" json:"OldContainer"`
|
||||||
NewContainer *uint `gorm:"index;comment:新容器id"`
|
NewContainer *uint `gorm:"index;comment:新容器id" json:"NewContainer"`
|
||||||
Remark string `gorm:"type:text;comment:备注"`
|
Remark string `gorm:"type:text;comment:备注" json:"Remark"`
|
||||||
IP string `gorm:"size:50;comment:操作IP"`
|
IP string `gorm:"size:50;comment:操作IP" json:"IP"`
|
||||||
CreatedAt time.Time `gorm:"type:datetime;autoCreateTime"`
|
CreatedAt time.Time `gorm:"type:datetime;autoCreateTime" json:"CreatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TabWarehouseLog struct {
|
type TabWarehouseLog struct {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const notFound = ref(false)
|
|||||||
const containerNames = reactive({})
|
const containerNames = reactive({})
|
||||||
|
|
||||||
// ── Tab ──
|
// ── Tab ──
|
||||||
const activeTab = ref('history')
|
const activeTab = ref('work_orders')
|
||||||
|
|
||||||
// ── 编辑弹窗 ──
|
// ── 编辑弹窗 ──
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
@@ -105,6 +105,8 @@ function fmtTs(ts) {
|
|||||||
return d.toLocaleString()
|
return d.toLocaleString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ── 拉取物品详情 ──
|
// ── 拉取物品详情 ──
|
||||||
async function fetchItem() {
|
async function fetchItem() {
|
||||||
loadingDetail.value = true
|
loadingDetail.value = true
|
||||||
@@ -428,15 +430,6 @@ onMounted(() => {
|
|||||||
|
|
||||||
<!-- Tab 切换 -->
|
<!-- 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">
|
<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
|
<button
|
||||||
class="px-4 py-1.5 text-sm rounded-md font-medium transition-colors"
|
class="px-4 py-1.5 text-sm rounded-md font-medium transition-colors"
|
||||||
:class="activeTab === 'work_orders'
|
:class="activeTab === 'work_orders'
|
||||||
@@ -446,40 +439,15 @@ onMounted(() => {
|
|||||||
>
|
>
|
||||||
{{ t('warehouse.work_orders') }} ({{ workOrders.length }})
|
{{ t('warehouse.work_orders') }} ({{ workOrders.length }})
|
||||||
</button>
|
</button>
|
||||||
</div>
|
<button
|
||||||
|
class="px-4 py-1.5 text-sm rounded-md font-medium transition-colors"
|
||||||
<!-- 移动历史 -->
|
:class="activeTab === 'history'
|
||||||
<div v-if="activeTab === 'history'">
|
? 'bg-white text-gray-900 shadow-sm dark:bg-dk-card dark:text-white'
|
||||||
<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">
|
: 'text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200'"
|
||||||
{{ t('warehouse.no_move_history') }}
|
@click="activeTab = '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"
|
|
||||||
>
|
>
|
||||||
<!-- 操作人头像 -->
|
{{ t('warehouse.move_history') }} ({{ commits.length }})
|
||||||
<div class="flex-shrink-0">
|
</button>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 关联工单 -->
|
<!-- 关联工单 -->
|
||||||
@@ -508,6 +476,41 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</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>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user