@@ -449,9 +449,108 @@ func ApiWarehouse(r *gin.RouterGroup) {
|
|||||||
canModifyContainers[i] = canModifyWarehouse(user.ID, c.CreatorID)
|
canModifyContainers[i] = canModifyWarehouse(user.ID, c.CreatorID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 收集所有容器ID
|
||||||
|
containerIDs := make([]uint, len(containers))
|
||||||
|
for i, c := range containers {
|
||||||
|
containerIDs[i] = c.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量查询容器下的物品(只查直接子物品,不递归)
|
||||||
|
type ItemInfo struct {
|
||||||
|
ID uint
|
||||||
|
ContainerID uint
|
||||||
|
}
|
||||||
|
var allItems []ItemInfo
|
||||||
|
models.DB.Table("tab_warehouse_item").Select("id, container_id").Where("container_id IN ?", containerIDs).Scan(&allItems)
|
||||||
|
|
||||||
|
// 构建容器ID → 物品ID列表的映射
|
||||||
|
containerItems := make(map[uint][]uint)
|
||||||
|
allItemIDs := make([]uint, 0)
|
||||||
|
for _, item := range allItems {
|
||||||
|
containerItems[item.ContainerID] = append(containerItems[item.ContainerID], item.ID)
|
||||||
|
allItemIDs = append(allItemIDs, item.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量查询工单绑定数量
|
||||||
|
itemWorkOrderCount := make(map[uint]int)
|
||||||
|
if len(allItemIDs) > 0 {
|
||||||
|
var woBinds []TabWarehouseItemWorkOrderBind
|
||||||
|
models.DB.Where("item_id IN ?", allItemIDs).Find(&woBinds)
|
||||||
|
for _, bind := range woBinds {
|
||||||
|
itemWorkOrderCount[bind.ItemID]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量查询客户关联
|
||||||
|
type CustomerInfo struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
FirstName string `json:"first_name"`
|
||||||
|
LastName string `json:"last_name"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
itemCustomers := make(map[uint][]CustomerInfo)
|
||||||
|
if len(allItemIDs) > 0 {
|
||||||
|
var customerBinds []TabWarehouseItemCustomerBind
|
||||||
|
models.DB.Where("item_id IN ?", allItemIDs).Find(&customerBinds)
|
||||||
|
customerIDSet := make(map[uint]bool)
|
||||||
|
for _, bind := range customerBinds {
|
||||||
|
customerIDSet[bind.CustomerID] = true
|
||||||
|
}
|
||||||
|
customerIDs := make([]uint, 0)
|
||||||
|
for id := range customerIDSet {
|
||||||
|
customerIDs = append(customerIDs, id)
|
||||||
|
}
|
||||||
|
customerMap := make(map[uint]TabCustomer)
|
||||||
|
if len(customerIDs) > 0 {
|
||||||
|
var customers []TabCustomer
|
||||||
|
models.DB.Where("id IN ?", customerIDs).Find(&customers)
|
||||||
|
for _, c := range customers {
|
||||||
|
customerMap[c.ID] = c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, bind := range customerBinds {
|
||||||
|
if c, ok := customerMap[bind.CustomerID]; ok {
|
||||||
|
itemCustomers[bind.ItemID] = append(itemCustomers[bind.ItemID], CustomerInfo{
|
||||||
|
ID: c.ID,
|
||||||
|
FirstName: c.FirstName,
|
||||||
|
LastName: c.LastName,
|
||||||
|
Title: c.Title,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建容器统计
|
||||||
|
type ContainerWithStats struct {
|
||||||
|
TabWarehouseContainer
|
||||||
|
WorkOrderCount int `json:"WorkOrderCount"`
|
||||||
|
Customers []CustomerInfo `json:"Customers"`
|
||||||
|
}
|
||||||
|
containersWithStats := make([]ContainerWithStats, len(containers))
|
||||||
|
for i, c := range containers {
|
||||||
|
// 计算该容器下所有物品的工单总数
|
||||||
|
workOrderCount := 0
|
||||||
|
customersMap := make(map[uint]CustomerInfo)
|
||||||
|
for _, itemID := range containerItems[c.ID] {
|
||||||
|
workOrderCount += itemWorkOrderCount[itemID]
|
||||||
|
for _, ci := range itemCustomers[itemID] {
|
||||||
|
customersMap[ci.ID] = ci
|
||||||
|
}
|
||||||
|
}
|
||||||
|
customers := make([]CustomerInfo, 0, len(customersMap))
|
||||||
|
for _, ci := range customersMap {
|
||||||
|
customers = append(customers, ci)
|
||||||
|
}
|
||||||
|
containersWithStats[i] = ContainerWithStats{
|
||||||
|
TabWarehouseContainer: c,
|
||||||
|
WorkOrderCount: workOrderCount,
|
||||||
|
Customers: customers,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ReturnJson(ctx, "apiOK", gin.H{
|
ReturnJson(ctx, "apiOK", gin.H{
|
||||||
"all_count": count,
|
"all_count": count,
|
||||||
"containers": containers,
|
"containers": containersWithStats,
|
||||||
"canModifyContainers": canModifyContainers,
|
"canModifyContainers": canModifyContainers,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ops_vue_js",
|
"name": "ops_vue_js",
|
||||||
"version": "1.3.2",
|
"version": "1.3.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ onMounted(async () => {
|
|||||||
<RouterLink
|
<RouterLink
|
||||||
v-for="customer in item.Customers.slice(0, 3)"
|
v-for="customer in item.Customers.slice(0, 3)"
|
||||||
:key="customer.id"
|
:key="customer.id"
|
||||||
:to="`/customer/${customer.id}`"
|
:to="`/customer/detail/${customer.id}`"
|
||||||
class="inline-flex items-center gap-1 rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-400 dark:hover:bg-blue-900/60"
|
class="inline-flex items-center gap-1 rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-400 dark:hover:bg-blue-900/60"
|
||||||
@click.stop
|
@click.stop
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, computed, onMounted } from 'vue'
|
import { ref, reactive, computed, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter, RouterLink } from 'vue-router'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useToastStore } from '@/stores/toast'
|
import { useToastStore } from '@/stores/toast'
|
||||||
import { usePageTitle } from '@/composables/usePageTitle'
|
import { usePageTitle } from '@/composables/usePageTitle'
|
||||||
@@ -16,6 +16,8 @@ import {
|
|||||||
IconSearch,
|
IconSearch,
|
||||||
IconTrash,
|
IconTrash,
|
||||||
IconEdit,
|
IconEdit,
|
||||||
|
IconTool,
|
||||||
|
IconUser,
|
||||||
} from '@tabler/icons-vue'
|
} from '@tabler/icons-vue'
|
||||||
|
|
||||||
usePageTitle('warehouse.container_list')
|
usePageTitle('warehouse.container_list')
|
||||||
@@ -223,7 +225,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mx-auto max-w-6xl px-6 py-6">
|
<div class="mx-auto max-w-7xl px-6 py-6">
|
||||||
|
|
||||||
<!-- 统计卡片 -->
|
<!-- 统计卡片 -->
|
||||||
<div class="mb-6 grid grid-cols-3 gap-4">
|
<div class="mb-6 grid grid-cols-3 gap-4">
|
||||||
@@ -295,6 +297,8 @@ onMounted(() => {
|
|||||||
<th class="px-6 py-3 font-medium">{{ t('warehouse.remark') }}</th>
|
<th class="px-6 py-3 font-medium">{{ t('warehouse.remark') }}</th>
|
||||||
<th class="px-6 py-3 font-medium w-24 text-center">{{ t('warehouse.child_containers') }}</th>
|
<th class="px-6 py-3 font-medium w-24 text-center">{{ t('warehouse.child_containers') }}</th>
|
||||||
<th class="px-6 py-3 font-medium w-24 text-center">{{ t('warehouse.items') }}</th>
|
<th class="px-6 py-3 font-medium w-24 text-center">{{ t('warehouse.items') }}</th>
|
||||||
|
<th class="px-6 py-3 font-medium w-24 text-center">{{ t('work_order.work_order_count') }}</th>
|
||||||
|
<th class="px-6 py-3 font-medium">{{ t('customer.related_customers') }}</th>
|
||||||
<th class="px-6 py-3 font-medium whitespace-nowrap w-44">{{ t('warehouse.created_at') }}</th>
|
<th class="px-6 py-3 font-medium whitespace-nowrap w-44">{{ t('warehouse.created_at') }}</th>
|
||||||
<th class="px-6 py-3 font-medium w-28 text-right">{{ t('warehouse.actions') }}</th>
|
<th class="px-6 py-3 font-medium w-28 text-right">{{ t('warehouse.actions') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -302,7 +306,7 @@ onMounted(() => {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<!-- 加载中 -->
|
<!-- 加载中 -->
|
||||||
<tr v-if="loading">
|
<tr v-if="loading">
|
||||||
<td colspan="7" class="px-6 py-8 text-center text-gray-400">
|
<td colspan="9" class="px-6 py-8 text-center text-gray-400">
|
||||||
<svg class="mx-auto mb-2 h-5 w-5 animate-spin text-gray-400" viewBox="0 0 24 24" fill="none">
|
<svg class="mx-auto mb-2 h-5 w-5 animate-spin text-gray-400" viewBox="0 0 24 24" fill="none">
|
||||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
||||||
@@ -312,7 +316,7 @@ onMounted(() => {
|
|||||||
</tr>
|
</tr>
|
||||||
<!-- 空状态 -->
|
<!-- 空状态 -->
|
||||||
<tr v-else-if="containers.length === 0">
|
<tr v-else-if="containers.length === 0">
|
||||||
<td colspan="7" class="px-6 py-8 text-center text-gray-400 dark:text-gray-500">
|
<td colspan="9" class="px-6 py-8 text-center text-gray-400 dark:text-gray-500">
|
||||||
{{ t('warehouse.no_containers') }}
|
{{ t('warehouse.no_containers') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -348,6 +352,30 @@ onMounted(() => {
|
|||||||
{{ c.ItemCount }}
|
{{ c.ItemCount }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="px-6 py-3 text-center">
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center gap-1 rounded-full bg-orange-100 px-2 py-0.5 text-xs font-medium text-orange-700 dark:bg-orange-900/40 dark:text-orange-400"
|
||||||
|
>
|
||||||
|
<IconTool :size="12" />
|
||||||
|
{{ c.WorkOrderCount }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="px-6 py-3">
|
||||||
|
<div v-if="c.Customers && c.Customers.length > 0" class="flex flex-wrap gap-1">
|
||||||
|
<RouterLink
|
||||||
|
v-for="customer in c.Customers.slice(0, 3)"
|
||||||
|
:key="customer.id"
|
||||||
|
:to="`/customer/detail/${customer.id}`"
|
||||||
|
class="inline-flex items-center gap-1 rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-400 dark:hover:bg-blue-900/60"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
<IconUser :size="10" />
|
||||||
|
{{ customer.first_name }} {{ customer.last_name }}
|
||||||
|
</RouterLink>
|
||||||
|
<span v-if="c.Customers.length > 3" class="text-xs text-gray-400">+{{ c.Customers.length - 3 }}</span>
|
||||||
|
</div>
|
||||||
|
<span v-else class="text-gray-400">—</span>
|
||||||
|
</td>
|
||||||
<td class="px-6 py-3 whitespace-nowrap text-gray-500 dark:text-gray-400">{{ formatDate(c.CreatedAt) }}</td>
|
<td class="px-6 py-3 whitespace-nowrap text-gray-500 dark:text-gray-400">{{ formatDate(c.CreatedAt) }}</td>
|
||||||
<td class="px-6 py-3 text-right" @click.stop>
|
<td class="px-6 py-3 text-right" @click.stop>
|
||||||
<div class="flex items-center justify-end gap-1">
|
<div class="flex items-center justify-end gap-1">
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ const pageSize = ref(10)
|
|||||||
const currentPage = ref(1)
|
const currentPage = ref(1)
|
||||||
const search = ref('')
|
const search = ref('')
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const stats = reactive({
|
||||||
|
total: 0,
|
||||||
|
inContainer: 0,
|
||||||
|
unstored: 0,
|
||||||
|
})
|
||||||
|
|
||||||
// ── 权限判断 ──
|
// ── 权限判断 ──
|
||||||
function canModifyItem(idx) {
|
function canModifyItem(idx) {
|
||||||
@@ -90,6 +95,9 @@ function goPage(p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const totalPages = computed(() => Math.ceil(totalCount.value / pageSize.value) || 1)
|
||||||
|
const isEn = computed(() => locale.value === 'en')
|
||||||
|
|
||||||
const pageNumbers = computed(() => {
|
const pageNumbers = computed(() => {
|
||||||
const total = totalPages.value
|
const total = totalPages.value
|
||||||
const cur = currentPage.value
|
const cur = currentPage.value
|
||||||
@@ -155,7 +163,7 @@ onMounted(fetchItems)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="p-4 max-w-6xl mx-auto space-y-4">
|
<div class="p-4 max-w-7xl mx-auto space-y-4">
|
||||||
|
|
||||||
<!-- 统计卡片 -->
|
<!-- 统计卡片 -->
|
||||||
<div class="grid grid-cols-3 gap-3">
|
<div class="grid grid-cols-3 gap-3">
|
||||||
@@ -246,7 +254,7 @@ onMounted(fetchItems)
|
|||||||
<RouterLink
|
<RouterLink
|
||||||
v-for="customer in item.Customers.slice(0, 3)"
|
v-for="customer in item.Customers.slice(0, 3)"
|
||||||
:key="customer.id"
|
:key="customer.id"
|
||||||
:to="`/customer/${customer.id}`"
|
:to="`/customer/detail/${customer.id}`"
|
||||||
class="inline-flex items-center gap-1 rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-400 dark:hover:bg-blue-900/60"
|
class="inline-flex items-center gap-1 rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-400 dark:hover:bg-blue-900/60"
|
||||||
@click.stop
|
@click.stop
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, computed, onMounted } from 'vue'
|
import { ref, reactive, computed, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter, RouterLink } from 'vue-router'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useToastStore } from '@/stores/toast'
|
import { useToastStore } from '@/stores/toast'
|
||||||
import { useUsersStore } from '@/stores/users'
|
import { useUsersStore } from '@/stores/users'
|
||||||
@@ -18,6 +18,8 @@ import {
|
|||||||
IconTrash,
|
IconTrash,
|
||||||
IconEdit,
|
IconEdit,
|
||||||
IconArrowRight,
|
IconArrowRight,
|
||||||
|
IconTool,
|
||||||
|
IconUser,
|
||||||
} from '@tabler/icons-vue'
|
} from '@tabler/icons-vue'
|
||||||
|
|
||||||
usePageTitle('warehouse.overview')
|
usePageTitle('warehouse.overview')
|
||||||
@@ -338,7 +340,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mx-auto max-w-6xl px-6 py-6 space-y-4">
|
<div class="mx-auto max-w-7xl px-6 py-6 space-y-4">
|
||||||
|
|
||||||
<!-- 统计卡片 -->
|
<!-- 统计卡片 -->
|
||||||
<div class="grid grid-cols-3 gap-4">
|
<div class="grid grid-cols-3 gap-4">
|
||||||
@@ -532,19 +534,21 @@ onMounted(() => {
|
|||||||
<table class="w-full text-left text-sm text-gray-900 dark:text-white">
|
<table class="w-full text-left text-sm text-gray-900 dark:text-white">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="border-b border-gray-200 bg-gray-50 text-gray-500 dark:border-dk-muted dark:bg-dk-base dark:text-gray-400">
|
<tr class="border-b border-gray-200 bg-gray-50 text-gray-500 dark:border-dk-muted dark:bg-dk-base dark:text-gray-400">
|
||||||
<th class="px-6 py-3 font-medium">{{ t('warehouse.item_name') }}</th>
|
<th class="px-5 py-3 font-medium">{{ t('warehouse.item_name') }}</th>
|
||||||
<th class="px-6 py-3 font-medium">{{ t('warehouse.serial_number') }}</th>
|
<th class="px-5 py-3 font-medium">{{ t('warehouse.serial_number') }}</th>
|
||||||
<th class="px-6 py-3 font-medium">{{ t('warehouse.remark') }}</th>
|
<th class="px-5 py-3 font-medium">{{ t('warehouse.remark') }}</th>
|
||||||
<th class="px-6 py-3 font-medium w-20 text-center">{{ t('warehouse.quantity') }}</th>
|
<th class="px-5 py-3 font-medium w-20 text-center">{{ t('warehouse.quantity') }}</th>
|
||||||
<th class="px-6 py-3 font-medium">{{ t('warehouse.location') }}</th>
|
<th class="px-5 py-3 font-medium w-24 text-center">{{ t('work_order.work_order_count') }}</th>
|
||||||
<th class="px-6 py-3 font-medium whitespace-nowrap">{{ t('warehouse.created_at') }}</th>
|
<th class="px-5 py-3 font-medium">{{ t('customer.related_customers') }}</th>
|
||||||
<th class="px-6 py-3 font-medium whitespace-nowrap">{{ t('warehouse.updated_at') }}</th>
|
<th class="px-5 py-3 font-medium whitespace-nowrap">{{ t('warehouse.created_at') }}</th>
|
||||||
<th class="px-6 py-3 font-medium">{{ t('warehouse.created_by') }}</th>
|
<th class="px-5 py-3 font-medium whitespace-nowrap">{{ t('warehouse.updated_at') }}</th>
|
||||||
|
<th class="px-5 py-3 font-medium">{{ t('warehouse.created_by') }}</th>
|
||||||
|
<th class="px-5 py-3 font-medium w-20 text-right">{{ t('warehouse.actions') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-if="itemLoading">
|
<tr v-if="itemLoading">
|
||||||
<td colspan="8" class="px-6 py-8 text-center text-gray-400">
|
<td colspan="10" class="px-6 py-8 text-center text-gray-400">
|
||||||
<svg class="mx-auto mb-2 h-5 w-5 animate-spin text-gray-400" viewBox="0 0 24 24" fill="none">
|
<svg class="mx-auto mb-2 h-5 w-5 animate-spin text-gray-400" viewBox="0 0 24 24" fill="none">
|
||||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
||||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z" />
|
||||||
@@ -553,7 +557,7 @@ onMounted(() => {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-else-if="items.length === 0">
|
<tr v-else-if="items.length === 0">
|
||||||
<td colspan="8" class="px-6 py-8 text-center text-gray-400 dark:text-gray-500">
|
<td colspan="10" class="px-6 py-8 text-center text-gray-400 dark:text-gray-500">
|
||||||
{{ t('warehouse.no_items') }}
|
{{ t('warehouse.no_items') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -563,22 +567,36 @@ onMounted(() => {
|
|||||||
class="cursor-pointer border-b border-gray-100 transition-colors hover:bg-gray-50 dark:border-dk-muted dark:hover:bg-dk-base"
|
class="cursor-pointer border-b border-gray-100 transition-colors hover:bg-gray-50 dark:border-dk-muted dark:hover:bg-dk-base"
|
||||||
@click="goToItemDetail(item)"
|
@click="goToItemDetail(item)"
|
||||||
>
|
>
|
||||||
<td class="px-6 py-3 font-medium max-w-[200px] truncate">{{ item.Name }}</td>
|
<td class="px-5 py-3 font-medium max-w-xs truncate">{{ item.Name }}</td>
|
||||||
<td class="px-6 py-3 max-w-[160px] truncate text-xs text-gray-500 dark:text-gray-400">{{ item.SerialNumber || '—' }}</td>
|
<td class="px-5 py-3 text-xs text-gray-500 dark:text-gray-400 max-w-[140px] truncate">{{ item.SerialNumber || '—' }}</td>
|
||||||
<td class="px-6 py-3 max-w-[200px] truncate text-xs text-gray-500 dark:text-gray-400">{{ item.Remark || '—' }}</td>
|
<td class="px-5 py-3 text-xs text-gray-500 dark:text-gray-400 max-w-[200px] truncate">{{ item.Remark || '—' }}</td>
|
||||||
<td class="px-6 py-3 text-center text-sm">{{ item.Quantity }}</td>
|
<td class="px-5 py-3 text-center text-sm">{{ item.Quantity }}</td>
|
||||||
<td class="px-6 py-3">
|
<td class="px-5 py-3 text-center">
|
||||||
<span v-if="item.ContainerBreadcrumb" class="inline-flex items-center gap-1 text-sm text-blue-600">
|
<span v-if="item.WorkOrderCount > 0" class="inline-flex items-center gap-1 rounded-full bg-orange-100 px-2 py-0.5 text-xs font-medium text-orange-700 dark:bg-orange-900/40 dark:text-orange-400">
|
||||||
<IconArrowRight :size="13" />
|
<IconTool :size="12" />
|
||||||
<span class="max-w-[200px] truncate">{{ item.ContainerBreadcrumb }}</span>
|
{{ item.WorkOrderCount }}
|
||||||
</span>
|
|
||||||
<span v-else class="inline-flex items-center gap-1 text-xs text-orange-500">
|
|
||||||
{{ t('warehouse.unstored_items') }}
|
|
||||||
</span>
|
</span>
|
||||||
|
<span v-else class="text-gray-400">—</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-3 whitespace-nowrap text-xs text-gray-400 dark:text-gray-500">{{ formatDate(item.CreatedAt) }}</td>
|
<td class="px-5 py-3">
|
||||||
<td class="px-6 py-3 whitespace-nowrap text-xs text-gray-400 dark:text-gray-500">{{ formatDate(item.UpdatedAt) }}</td>
|
<div v-if="item.Customers && item.Customers.length > 0" class="flex flex-wrap gap-1">
|
||||||
<td class="px-6 py-3">
|
<RouterLink
|
||||||
|
v-for="customer in item.Customers.slice(0, 3)"
|
||||||
|
:key="customer.id"
|
||||||
|
:to="`/customer/detail/${customer.id}`"
|
||||||
|
class="inline-flex items-center gap-1 rounded-full bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-400 dark:hover:bg-blue-900/60"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
<IconUser :size="10" />
|
||||||
|
{{ customer.first_name }} {{ customer.last_name }}
|
||||||
|
</RouterLink>
|
||||||
|
<span v-if="item.Customers.length > 3" class="text-xs text-gray-400">+{{ item.Customers.length - 3 }}</span>
|
||||||
|
</div>
|
||||||
|
<span v-else class="text-gray-400">—</span>
|
||||||
|
</td>
|
||||||
|
<td class="px-5 py-3 text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap">{{ formatDate(item.CreatedAt) }}</td>
|
||||||
|
<td class="px-5 py-3 text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap">{{ formatDate(item.UpdatedAt) }}</td>
|
||||||
|
<td class="px-5 py-3">
|
||||||
<div class="flex items-center gap-1.5">
|
<div class="flex items-center gap-1.5">
|
||||||
<img
|
<img
|
||||||
:src="usersStore.getAvatarUrlFromUserID(item.CreatorID)"
|
:src="usersStore.getAvatarUrlFromUserID(item.CreatorID)"
|
||||||
@@ -587,6 +605,14 @@ onMounted(() => {
|
|||||||
<span class="truncate text-gray-600 dark:text-gray-400">{{ usersStore.getUsernameFromUserID(item.CreatorID) }}</span>
|
<span class="truncate text-gray-600 dark:text-gray-400">{{ usersStore.getUsernameFromUserID(item.CreatorID) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="px-5 py-3 text-right">
|
||||||
|
<button
|
||||||
|
class="text-xs text-blue-500 hover:underline"
|
||||||
|
@click.stop="goToItemDetail(item)"
|
||||||
|
>
|
||||||
|
{{ t('warehouse.view_items') }}
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user