Commit ac2e1860 by qinjianhui

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

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