Commit df3ce930 by qinjianhui

feat: 拣胚失败表格字段

parent 54e79062
<template> <template>
<ElDialog <ElDialog
v-model="visible" v-model="visible"
title="拣胚失败" :title="dialogTitle"
width="1400px" width="1400px"
:close-on-click-modal="false" :close-on-click-modal="false"
@close="handleClose" @close="handleClose"
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</ElDialog> </ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="tsx">
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { import {
...@@ -75,7 +75,7 @@ import { ...@@ -75,7 +75,7 @@ import {
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { operateOrderListData } from '@/types/api/factoryOrderNew' import type { operateOrderListData } from '@/types/api/factoryOrderNew'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import type { CustomColumn } from '@/types/table' import _ from 'lodash'
const emit = defineEmits<{ const emit = defineEmits<{
success: [] success: []
...@@ -85,8 +85,8 @@ const visible = ref(false) ...@@ -85,8 +85,8 @@ const visible = ref(false)
const submitLoading = ref(false) const submitLoading = ref(false)
const tableData = ref<operateOrderListData[]>([]) const tableData = ref<operateOrderListData[]>([])
const orderIds = ref<(number | string)[]>([]) const orderIds = ref<(number | string)[]>([])
const dialogTitle = ref('拣胚失败')
const columns: CustomColumn<operateOrderListData>[] = [ const columns = [
{ {
key: 'warehouseName', key: 'warehouseName',
prop: 'warehouseName', prop: 'warehouseName',
...@@ -151,16 +151,26 @@ const columns: CustomColumn<operateOrderListData>[] = [ ...@@ -151,16 +151,26 @@ const columns: CustomColumn<operateOrderListData>[] = [
minWidth: 120, minWidth: 120,
align: 'right', align: 'right',
slot: 'suggestOutQuantity', slot: 'suggestOutQuantity',
render: (row: operateOrderListData) => {
return (
<span style="color: #f56c6c; font-weight: bold">
{_.subtract(
Number(row.inventory ?? 0),
Number(row.producingQuantity ?? 0),
)}
</span>
)
},
}, },
{ {
prop: 'afterOutStock', prop: 'producingQuantity',
label: '出库后库存数量', label: '出库后库存数量',
minWidth: 130, minWidth: 130,
align: 'center', align: 'center',
slot: 'right', slot: 'right',
}, },
{ {
prop: 'afterOutOccupied', prop: 'inventory',
label: '出库后占用数量', label: '出库后占用数量',
minWidth: 130, minWidth: 130,
align: 'right', align: 'right',
...@@ -170,12 +180,33 @@ const columns: CustomColumn<operateOrderListData>[] = [ ...@@ -170,12 +180,33 @@ const columns: CustomColumn<operateOrderListData>[] = [
label: '出库后可用库存', label: '出库后可用库存',
minWidth: 130, minWidth: 130,
align: 'right', align: 'right',
render: (row: operateOrderListData) => {
return (
<span style="color: #f56c6c; font-weight: bold">
{_.subtract(
_.subtract(
Number(row.producingQuantity ?? 0),
Number(row.inventory ?? 0),
),
Number(row.freezeInventory ?? 0),
)}
</span>
)
},
}, },
] ]
const open = async (ids: (number | string)[]) => { const open = async (
ids: (number | string)[],
options?: { title?: string; submitType?: string },
) => {
dialogTitle.value = options?.title || '拣胚失败'
orderIds.value = ids orderIds.value = ids
visible.value = true visible.value = true
const loading = ElLoading.service({
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await applyForReplenishByIdApi( const res = await applyForReplenishByIdApi(
ids, ids,
...@@ -184,6 +215,8 @@ const open = async (ids: (number | string)[]) => { ...@@ -184,6 +215,8 @@ const open = async (ids: (number | string)[]) => {
tableData.value = res.data || [] tableData.value = res.data || []
} catch (_e) { } catch (_e) {
tableData.value = [] tableData.value = []
} finally {
loading.close()
} }
} }
......
...@@ -819,7 +819,9 @@ ...@@ -819,7 +819,9 @@
ref="weightDialogRef" ref="weightDialogRef"
:list-by-no-api="listByNoPodOrderApi" :list-by-no-api="listByNoPodOrderApi"
:order-weighing-api="orderWeighingPodOrderApi" :order-weighing-api="orderWeighingPodOrderApi"
:build-order-weighing-payload="(rows) => ({ podOrderWeighingParams: rows })" :build-order-weighing-payload="
(rows) => ({ podOrderWeighingParams: rows })
"
@update-list="() => refreshCurrentView({ isRefreshTree: true })" @update-list="() => refreshCurrentView({ isRefreshTree: true })"
/> />
<FastProduction <FastProduction
...@@ -1657,7 +1659,10 @@ const handlePickComplete = () => { ...@@ -1657,7 +1659,10 @@ const handlePickComplete = () => {
} }
const handlePickFail = () => { const handlePickFail = () => {
if (!ensureSelection()) return if (!ensureSelection()) return
pickFailDialogRef.value?.open(getSelectedIds()) pickFailDialogRef.value?.open(getSelectedIds(), {
title: '拣胚失败',
submitType: 'pick',
})
} }
const handleApplyReplenish = async () => { const handleApplyReplenish = async () => {
await executeBatchAction({ await executeBatchAction({
...@@ -1725,7 +1730,10 @@ const handleReplenishComplete = () => { ...@@ -1725,7 +1730,10 @@ const handleReplenishComplete = () => {
} }
const handleReplenishFail = () => { const handleReplenishFail = () => {
if (!ensureSelection()) return if (!ensureSelection()) return
ElMessage.info('补胚失败功能待集成') pickFailDialogRef.value?.open(getSelectedIds(), {
title: '补胚失败',
submitType: 'replenish',
})
} }
const getOperationByNo = (operationNo: string) => const getOperationByNo = (operationNo: string) =>
getByOperationNoLogApi(operationNo) as Promise<{ data?: unknown }> getByOperationNoLogApi(operationNo) as Promise<{ data?: unknown }>
......
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