Commit 2e37c7e2 by qinjianhui

feat: 拣胚完成功能开发

parent 5ac50c9e
......@@ -4,6 +4,7 @@ import type {
BatchManageData,
FactoryOrderNewListData,
LogListData,
operateOrderListData,
PickCompleteData,
PickFailData,
ProductListData,
......@@ -206,7 +207,6 @@ export function pickCompleteByIdsDataApi(ids: (number | string)[]) {
>('factory/podOrderOperation/getPickingSituation', ids)
}
export function pickCompleteApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<void>>(
'factory/podOrderOperation/pickingComplete',
......@@ -375,9 +375,6 @@ export function updateRemarkApi(id: number | string, remark: string) {
)
}
export function applyForReplenishByIdApi(id: number | string) {
return axios.post<never, BaseRespData<unknown>>(
'factory/podOrder/applyForReplenish',
{ id },
)
export function applyForReplenishByIdApi(ids: (number | string)[], url: string) {
return axios.post<never, BaseRespData<operateOrderListData[]>>(url, ids)
}
......@@ -93,9 +93,8 @@ export interface ProductListData {
baseSku?: string
variantSku?: string
variantImage?: string
// 后端字段名兼容(部分接口返回 snake_case)
variant_image?: string
productMark?: 'custom_part'
productMark?: string
diyId?: string
templateType?: number
customTemplateItemId?: number
......@@ -219,7 +218,7 @@ export interface PickCompleteData {
occupyInventory?: number
pickingStatus?: string
availableOrderIds?: number[]
allOrderIds?: number[]
allOrderIds: number[]
}
export interface PickFailData {
......
<template>
<ElDialog
v-model="visible"
title="申请补胚"
width="900px"
:close-on-click-modal="false"
>
<div class="replenish-tip">请选择具体的操作单,申请补胚</div>
<div v-loading="loading" class="replenish-card-grid">
<div
v-for="item in cardList"
:key="item.id"
class="replenish-card-item"
@click="toggleSelect(item)"
>
<CommonCard
:card-item="item"
:active="isSelected(item)"
:show-sku="false"
:show-product-info="false"
:image-field="'variantImage'"
>
<template #bottom_left>
<span
v-if="item.factorySubOrderNumber"
class="operation-number"
:title="`操作单号:${item.factorySubOrderNumber}`"
>
{{ item.factorySubOrderNumber }}
</span>
</template>
<template #info>
<div class="card-info-grid">
<div class="card-info-row full">
<span
class="info-value ellipsis"
:title="(item.productName as string) || ''"
>
{{ item.productName }}
</span>
</div>
<div class="card-info-row">
<span class="info-label">工艺:</span>
<span class="info-value">{{ item.craftName }}</span>
</div>
<div class="card-info-row">
<span class="info-label">店铺单号:</span>
<span class="info-value">{{ item.shopNumber }}</span>
</div>
<div class="card-info-row">
<span class="info-label">客户号:</span>
<span class="info-value">{{ item.userMark }}</span>
</div>
<div class="card-info-row">
<span class="info-label">变体SKU</span>
<span class="info-value ellipsis" :title="(item.variantSku as string) || ''">
{{ item.variantSku }}
</span>
</div>
<div class="card-info-row">
<span class="info-label">库存SKU</span>
<span class="info-value ellipsis" :title="(item.thirdSkuCode as string) || ''">
{{ item.thirdSkuCode }}
</span>
</div>
<div class="card-info-row">
<span class="info-label">款号:</span>
<span class="info-value">{{ item.supplierProductNo }}</span>
</div>
<div v-if="item.batchArrangeNumber" class="card-info-row">
<span class="info-label">批次号:</span>
<span class="info-value">{{ item.batchArrangeNumber }}</span>
</div>
<div class="card-info-row">
<span class="info-label">状态:</span>
<span class="info-value">{{ item.statusName }}</span>
</div>
</div>
</template>
</CommonCard>
</div>
<div v-if="!loading && cardList.length === 0" class="replenish-empty">
暂无数据
</div>
</div>
<template #footer>
<div style="text-align: center">
<ElButton @click="visible = false">取消</ElButton>
<ElButton type="primary" :loading="submitting" @click="handleConfirm">
确定
</ElButton>
</div>
</template>
</ElDialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import CommonCard from '@/components/CommonCard.vue'
import { applyForReplenishByIdApi } from '@/api/factoryOrderNew'
interface CardItem {
id: number | string
[key: string]: unknown
}
const emit = defineEmits<{
success: []
}>()
const visible = ref(false)
const loading = ref(false)
const submitting = ref(false)
const cardList = ref<CardItem[]>([])
const selectedItems = ref<CardItem[]>([])
const productId = ref<number | string>()
const isSelected = (item: CardItem) =>
selectedItems.value.some((s) => s.id === item.id)
const toggleSelect = (item: CardItem) => {
const idx = selectedItems.value.findIndex((s) => s.id === item.id)
if (idx >= 0) {
selectedItems.value.splice(idx, 1)
} else {
selectedItems.value.push(item)
}
}
const open = async (id: number | string) => {
productId.value = id
selectedItems.value = []
cardList.value = []
visible.value = true
loading.value = true
try {
const res = await applyForReplenishByIdApi(id)
cardList.value = Array.isArray(res.data) ? res.data : []
} catch (e) {
console.error(e)
} finally {
loading.value = false
}
}
const handleConfirm = async () => {
if (!selectedItems.value.length) {
return ElMessage.warning('请选择操作单')
}
submitting.value = true
try {
await applyForReplenishByIdApi(productId.value!)
ElMessage.success('申请补胚成功')
visible.value = false
emit('success')
} catch (e) {
console.error(e)
} finally {
submitting.value = false
}
}
defineExpose({ open })
</script>
<style scoped lang="scss">
.replenish-tip {
font-size: 14px;
color: #606266;
margin-bottom: 12px;
}
.replenish-card-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
max-height: 500px;
overflow-y: auto;
min-height: 200px;
}
.replenish-card-item {
cursor: pointer;
}
.replenish-empty {
grid-column: 1 / -1;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
font-size: 14px;
min-height: 200px;
}
.operation-number {
font-size: 12px;
color: #409eff;
}
.card-info-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 4px;
font-size: 12px;
margin-top: 6px;
.full {
grid-column: 1 / -1;
}
}
.card-info-row {
display: flex;
overflow: hidden;
}
.info-label {
flex-shrink: 0;
color: #909399;
}
.info-value {
flex: 1;
min-width: 0;
&.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style>
......@@ -364,7 +364,7 @@ defineExpose({ clearSelection, getSelectedIds, refresh })
.card-info-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-columns: 1fr 150px;
gap: 4px;
font-size: 12px;
margin-top: 6px;
......
......@@ -49,7 +49,12 @@
✕ 无法拣胚
</span>
<span v-else-if="row.pickingStatus === 'partial'" class="item">
<ElButton type="warning" size="small">调整拣胚顺序</ElButton>
<ElButton
type="warning"
size="small"
@click="handleAdjustPickOrder(row)"
>调整拣胚顺序</ElButton
>
</span>
<span
v-else-if="row.pickingStatus === 'success'"
......@@ -73,6 +78,12 @@
</div>
</template>
</ElDialog>
<OperateDetailsDialog
ref="operateDetailsDialogRef"
title="调整拣胚顺序"
:pickable="true"
@adjust-pick-order-success="open"
/>
</template>
<script setup lang="ts">
......@@ -85,6 +96,7 @@ import {
import type { PickCompleteData } from '@/types/api/factoryOrderNew'
import TableView from '@/components/TableView.vue'
import Icon from '@/components/Icon.vue'
import OperateDetailsDialog from './OperateDetailsDialog.vue'
interface PickData {
overallMessage?: string
pickingSituationList?: PickCompleteData[]
......@@ -201,10 +213,17 @@ const handleClose = () => {
const handleCreateInbound = () => {
ElMessage.info('创建入库单功能待实现')
}
const operateDetailsDialogRef = ref()
const handleSelectionChange = (selection: PickCompleteData[]) => {
selections.value = selection
}
const handleAdjustPickOrder = async (row: PickCompleteData) => {
operateDetailsDialogRef.value?.open({
row,
ids: row.allOrderIds as (number | string)[],
url: 'factory/podOrderOperation/listByIds',
})
}
const handleSubmit = async () => {
const loading = ElLoading.service({
......
......@@ -823,8 +823,9 @@
@success="() => refreshCurrentView({ isRefreshTree: true })"
/>
<ApplyReplenishDialog
ref="applyReplenishDialogRef"
<OperateDetailsDialog
ref="operateDetailsDialogRef"
title="申请补胚"
@success="() => refreshCurrentView({ isRefreshTree: true })"
/>
......@@ -920,7 +921,7 @@ import CardLayout from './component/CardLayout.vue'
import BatchManageTable from './component/BatchManageTable.vue'
import WaitingRestockTable from './component/WaitingRestockTable.vue'
import ArrangeDialog from './component/ArrangeDialog.vue'
import ApplyReplenishDialog from './component/ApplyReplenishDialog.vue'
import OperateDetailsDialog from './component/OperateDetailsDialog.vue'
import CreateLogisticDialog from '@/views/order/podCN/components/CreateLogisticDialog.vue'
import UpdateCustomDeclarationInfoDialog from '@/views/order/podCN/components/UpdateCustomDeclarationInfoDialog.vue'
......@@ -1485,11 +1486,11 @@ const cancelOrderDialogRef = ref<InstanceType<typeof CancelOrderDialog>>()
const suspendDialogRef = ref<InstanceType<typeof SuspendDialog>>()
const pickCompleteDialogRef = ref<InstanceType<typeof PickCompleteDialog>>()
const pickFailDialogRef = ref<InstanceType<typeof PickFailDialog>>()
const operateDetailsDialogRef = ref()
const cardLayoutRef = ref<InstanceType<typeof CardLayout>>()
const batchManageRef = ref<InstanceType<typeof BatchManageTable>>()
const waitingRestockRef = ref<InstanceType<typeof WaitingRestockTable>>()
const arrangeDialogRef = ref<InstanceType<typeof ArrangeDialog>>()
const applyReplenishDialogRef = ref<InstanceType<typeof ApplyReplenishDialog>>()
const createLogisticDialogRef = ref()
const updateCustomsDialogVisible = ref(false)
const weightDialogRef = ref()
......@@ -1596,7 +1597,7 @@ const getOrderDetailsById = async (tabName?: 'product' | 'log') => {
}
} catch (e) {
console.error(e)
} finally{
} finally {
subLoading.value = false
}
}
......@@ -1647,7 +1648,7 @@ const handleEditRemark = async (row: ProductListData) => {
}
const handleSubApplyReplenish = (row: ProductListData) => {
applyReplenishDialogRef.value?.open(row.id)
operateDetailsDialogRef.value?.open({ ids: [row.id], url: '' })
}
const handleConfirmOrder = () => {
......@@ -1934,15 +1935,16 @@ const downloadPDF = (url: string) => {
}
const handleDownloadMaterial = async () => {
if (!ensureSelection()) return
const usePodOrderDownloadStatuses = [
'PENDING_DELIVERY',
'SUSPEND',
]
const usePodOrderDownloadStatuses = ['PENDING_DELIVERY', 'SUSPEND']
const usePodOrderDownload = usePodOrderDownloadStatuses.includes(status.value)
const ids = usePodOrderDownload
? selectedRows.value.map((row) => row.id)
: cardSelectList.value.map((row) => row.podOrderProductId)
console.log(usePodOrderDownload,ids,cardSelectList.value.map((row) => row.podOrderProductId))
console.log(
usePodOrderDownload,
ids,
cardSelectList.value.map((row) => row.podOrderProductId),
)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
......@@ -2193,7 +2195,10 @@ const getPendingReceiveCounts = async () => {
getListPageAcceptedSubStatus(),
)
if (res.code !== 200) return
pendingAcceptCounts.value = res.data || { pendingCount: 0, acceptedOutOfStockCount: 0 }
pendingAcceptCounts.value = res.data || {
pendingCount: 0,
acceptedOutOfStockCount: 0,
}
} catch (e) {
console.error(e)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment