Commit ac2e1860 by qinjianhui

fix: 批次管理查询条件、操作单下载素材bug修改

parent 4cdbabf7
...@@ -248,6 +248,7 @@ export type FastProductionDetail = PodOrderRes & { ...@@ -248,6 +248,7 @@ export type FastProductionDetail = PodOrderRes & {
operationNo?: string | null operationNo?: string | null
quantity?: number | null quantity?: number | null
podOrderNo?: string | null podOrderNo?: string | null
podOrderProductId?: number | null
} }
const trackingNumberRef = ref() const trackingNumberRef = ref()
const historyData = ref<HistoryDataItem[]>([]) const historyData = ref<HistoryDataItem[]>([])
...@@ -293,6 +294,7 @@ const props = withDefaults( ...@@ -293,6 +294,7 @@ const props = withDefaults(
fastKey?: string fastKey?: string
historyStorageKey?: string historyStorageKey?: string
trackingPlaceholder?: string trackingPlaceholder?: string
isNewOrder?: boolean
queryApi?: (orderNumber: string) => Promise<{ data?: unknown }> queryApi?: (orderNumber: string) => Promise<{ data?: unknown }>
completeApi?: ( completeApi?: (
ids: number[], ids: number[],
...@@ -319,6 +321,7 @@ const props = withDefaults( ...@@ -319,6 +321,7 @@ const props = withDefaults(
detailVisible: false, detailVisible: false,
detailData: null, detailData: null,
fastKey: '', fastKey: '',
isNewOrder: false,
historyStorageKey: 'historyCnData', historyStorageKey: 'historyCnData',
trackingPlaceholder: trackingPlaceholder:
'扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产', '扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产',
...@@ -499,15 +502,17 @@ const setData = async (orderNumber: string) => { ...@@ -499,15 +502,17 @@ const setData = async (orderNumber: string) => {
if (!detail.value || detail.value?.id === -1) return if (!detail.value || detail.value?.id === -1) return
try { try {
const id = detail.value.id const id = detail.value.id
const res = await props.completeApi( const res = (await props.completeApi(
[id], [id],
detail.value as unknown as Record<string, unknown>, detail.value as unknown as Record<string, unknown>,
) as unknown as BaseRespData<{ )) as unknown as BaseRespData<
factoryOrderNumber?: number {
id:number factoryOrderNumber?: number
message?:string id: number
status?:boolean message?: string
}[]> status?: boolean
}[]
>
if (orderNumber) { if (orderNumber) {
const index = historyData.value.findIndex( const index = historyData.value.findIndex(
(el: HistoryDataItem) => el.orderNumber === orderNumber, (el: HistoryDataItem) => el.orderNumber === orderNumber,
...@@ -556,7 +561,9 @@ const handleDownload = () => { ...@@ -556,7 +561,9 @@ const handleDownload = () => {
const download = async () => { const download = async () => {
if (detail.value && detail.value?.id != -1) { if (detail.value && detail.value?.id != -1) {
try { try {
const id = detail.value.id const id = props.isNewOrder
? detail.value.podOrderProductId as number
: detail.value.id
if (id !== undefined) { if (id !== undefined) {
try { try {
const res = await props.downloadApi([id]) const res = await props.downloadApi([id])
......
...@@ -255,7 +255,7 @@ const columns = [ ...@@ -255,7 +255,7 @@ const columns = [
slot: 'downloadStatus', slot: 'downloadStatus',
width: 90, width: 90,
align: 'center', align: 'center',
render: ({ row }: { row: BatchManageData; index: number }) => { render: (row: BatchManageData) => {
return ( return (
<div> <div>
<el-tag type={row?.downloadStatus ? 'success' : 'danger'}> <el-tag type={row?.downloadStatus ? 'success' : 'danger'}>
......
...@@ -815,6 +815,7 @@ ...@@ -815,6 +815,7 @@
/> />
<FastProduction <FastProduction
v-model:detail-visible="detailVisible" v-model:detail-visible="detailVisible"
:is-new-order="true"
:detail-data="detailData" :detail-data="detailData"
:fast-key="fastKey" :fast-key="fastKey"
:default-auto-sure="true" :default-auto-sure="true"
......
...@@ -287,7 +287,7 @@ import { Check, Refresh } from '@element-plus/icons-vue' ...@@ -287,7 +287,7 @@ import { Check, Refresh } from '@element-plus/icons-vue'
import socket from '@/utils/websocket' import socket from '@/utils/websocket'
import { WarehouseListData } from '@/types/index' import { WarehouseListData } from '@/types/index'
import { filePath } from '@/api/axios.ts' import { filePath } from '@/api/axios.ts'
import { ElButton, ElIcon } from 'element-plus' import { ElButton, ElIcon, ElTag } from 'element-plus'
const { getCLodop } = useLodop() const { getCLodop } = useLodop()
...@@ -339,12 +339,48 @@ const operationStatusMap: Record<string, string> = { ...@@ -339,12 +339,48 @@ const operationStatusMap: Record<string, string> = {
CANCELLED: '已取消', CANCELLED: '已取消',
ARCHIVE: '已归档', ARCHIVE: '已归档',
} }
const formatOperationNo = (operationNoWithStatus: string) => { const operationStatusTagMap: Record<
string,
{
type?: 'success' | 'warning' | 'info' | 'danger' | 'primary'
style?: { backgroundColor: string; color: string; borderColor: string }
}
> = {
PENDING_PACKING: { type: 'warning' },
PENDING_SCHEDULE: { type: 'info' },
PENDING_REPLENISH: {
style: {
backgroundColor: '#E6A23C',
color: '#FFFFFF',
borderColor: '#E6A23C',
},
},
PENDING_PICK: {
style: {
backgroundColor: '#409EFF',
color: '#FFFFFF',
borderColor: '#409EFF',
},
},
IN_PRODUCTION: { type: 'primary' },
PACKING_COMPLETED: { type: 'success' },
COMPLETED: { type: 'success' },
CANCELLED: { type: 'danger' },
ARCHIVE: {
style: {
backgroundColor: '#909399',
color: '#FFFFFF',
borderColor: '#909399',
},
},
}
const parseOperationNo = (operationNoWithStatus: string) => {
const match = operationNoWithStatus.match(/^([^_]+)_(.+)$/) const match = operationNoWithStatus.match(/^([^_]+)_(.+)$/)
if (!match) return operationNoWithStatus if (!match)
return { operationNo: operationNoWithStatus, status: '', statusText: '' }
const [, operationNo, status] = match const [, operationNo, status] = match
const statusText = operationStatusMap[status] || status const statusText = operationStatusMap[status] || status
return statusText ? `${operationNo}(${statusText})` : operationNo return { operationNo, status, statusText }
} }
const podOrderDetailsColumns = computed(() => [ const podOrderDetailsColumns = computed(() => [
{ {
...@@ -357,14 +393,25 @@ const podOrderDetailsColumns = computed(() => [ ...@@ -357,14 +393,25 @@ const podOrderDetailsColumns = computed(() => [
{ {
label: props.isNewOrder ? '操作单号' : '生产单号', label: props.isNewOrder ? '操作单号' : '生产单号',
prop: props.isNewOrder ? 'operationNos' : 'podJomallUsNo', prop: props.isNewOrder ? 'operationNos' : 'podJomallUsNo',
width: 150, width: props.isNewOrder ? 180 : 150,
align: 'center', align: 'center',
render: (row: ProductList) => { render: (row: ProductList) => {
return ( return (
<div> <div>
{props.isNewOrder && {props.isNewOrder &&
row.operationNos?.split(',').map((item) => { row.operationNos?.split(',').map((item) => {
return <div>{formatOperationNo(item)}</div> const { operationNo, status, statusText } = parseOperationNo(item)
const { type, style } = operationStatusTagMap[status] || {}
return (
<div>
{operationNo}
{statusText && (
<ElTag size="small" type={type} style={{ marginLeft: '6px', ...style }}>
{statusText}
</ElTag>
)}
</div>
)
})} })}
{!props.isNewOrder && row.podJomallUsNo} {!props.isNewOrder && row.podJomallUsNo}
</div> </div>
......
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