Commit 8e1db597 by wuqian

pod优化完毕

parent c6122b30
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
LogListData, LogListData,
} from '@/types/api/podOrder' } from '@/types/api/podOrder'
import { OrderData, ShipmentForm } from '@/types/api/order' import { OrderData, ShipmentForm } from '@/types/api/order'
import { CardOrderData } from '@/types/api/podOrder' import { PodProductList } from '@/types/api/podOrder'
export function getOrderTabData() { export function getOrderTabData() {
return axios.get<never, BaseRespData<Tab[]>>( return axios.get<never, BaseRespData<Tab[]>>(
...@@ -17,7 +17,7 @@ export function getOrderTabData() { ...@@ -17,7 +17,7 @@ export function getOrderTabData() {
) )
} }
export function getOrderDetail(id: number) { export function getOrderDetail(id: number) {
return axios.get<never, BaseRespData<CardOrderData>>( return axios.get<never, BaseRespData<PodProductList>>(
'factory/podJomallOrderProduct/getSubOrderById', 'factory/podJomallOrderProduct/getSubOrderById',
{ {
params: { params: {
...@@ -27,7 +27,7 @@ export function getOrderDetail(id: number) { ...@@ -27,7 +27,7 @@ export function getOrderDetail(id: number) {
) )
} }
export function getSubOrderBySubOrderNumber(factorySubOrderNumber: string) { export function getSubOrderBySubOrderNumber(factorySubOrderNumber: string) {
return axios.get<never, BaseRespData<OrderData>>( return axios.get<never, BaseRespData<PodProductList>>(
'factory/podJomallOrderProduct/getSubOrderBySubOrderNumber', 'factory/podJomallOrderProduct/getSubOrderBySubOrderNumber',
{ {
params: { params: {
...@@ -54,7 +54,7 @@ export function getOrderList( ...@@ -54,7 +54,7 @@ export function getOrderList(
} }
// 快捷生产完成 // 快捷生产完成
export function productionQueryApi(id: number) { export function productionQueryApi(id: number) {
return axios.post<never, BasePaginationData<CardOrderData>>( return axios.post<never, BasePaginationData<never>>(
'factory/podJomallOrderProduct/completeDelivery', 'factory/podJomallOrderProduct/completeDelivery',
{ {
id, id,
...@@ -66,7 +66,7 @@ export function getCardOrderList( ...@@ -66,7 +66,7 @@ export function getCardOrderList(
currentPage: number, currentPage: number,
pageSize: number, pageSize: number,
) { ) {
return axios.post<never, BasePaginationData<CardOrderData>>( return axios.post<never, BasePaginationData<PodProductList>>(
'/factory/podJomallOrder/getSubListPage', '/factory/podJomallOrder/getSubListPage',
{ ...data, currentPage, pageSize }, { ...data, currentPage, pageSize },
) )
......
...@@ -196,7 +196,9 @@ ...@@ -196,7 +196,9 @@
v-if="cardItem?.factorySubOrderNumber" v-if="cardItem?.factorySubOrderNumber"
title="生产单号" title="生产单号"
class="base_sku" class="base_sku"
@click.stop="copy(String(cardItem?.factorySubOrderNumber || ''))" @click.stop="
copy(String(cardItem?.factorySubOrderNumber || ''))
"
> >
{{ cardItem?.factorySubOrderNumber }} {{ cardItem?.factorySubOrderNumber }}
</span> </span>
...@@ -204,7 +206,9 @@ ...@@ -204,7 +206,9 @@
<template #operations> <template #operations>
<Icon <Icon
name="caozuorizhi" name="caozuorizhi"
@click.stop="openLog(Number(cardItem.podOrderId) || undefined)" @click.stop="
openLog(Number(cardItem.podOrderId) || undefined)
"
> >
<template #title> <template #title>
<title>操作日志</title> <title>操作日志</title>
...@@ -233,7 +237,8 @@ ...@@ -233,7 +237,8 @@
: '' : ''
" "
:style=" :style="
currentImage === item?.image && currentId === cardItem.id currentImage === item?.image &&
currentId === cardItem.id
? 'border-color: red' ? 'border-color: red'
: '' : ''
" "
...@@ -252,7 +257,11 @@ ...@@ -252,7 +257,11 @@
: '#67C23A', : '#67C23A',
}" }"
> >
{{ (Number(cardItem.customizedQuantity) || 0) > 1 ? '多' : '单' }} {{
(Number(cardItem.customizedQuantity) || 0) > 1
? '多'
: '单'
}}
</b> </b>
</div> </div>
</template> </template>
...@@ -518,9 +527,7 @@ ...@@ -518,9 +527,7 @@
<div class="order-operate"> <div class="order-operate">
<div class="order-operate_info"> <div class="order-operate_info">
<div <div
v-if=" v-if="status === 'TO_BE_CONFIRMED'"
status === 'TO_BE_CONFIRMED'
"
class="order-list-expand_item_info_title" class="order-list-expand_item_info_title"
> >
<ElButton text type="danger" @click="cancelOrder(row.id)" <ElButton text type="danger" @click="cancelOrder(row.id)"
...@@ -744,9 +751,9 @@ import { ...@@ -744,9 +751,9 @@ import {
} from '@/api/podOrder' } from '@/api/podOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
// OrderData, ProductList,
// ProductList, LogisticsData,
LogisticsData, OrderData, OrderData,
ShipmentForm, ShipmentForm,
} from '@/types/api/order' } from '@/types/api/order'
import fastProduction from '../fastProduction.vue' import fastProduction from '../fastProduction.vue'
...@@ -935,7 +942,10 @@ const loadCardList = async () => { ...@@ -935,7 +942,10 @@ const loadCardList = async () => {
} }
const currentImage = ref('') const currentImage = ref('')
const currentId = ref(-1) const currentId = ref(-1)
const changeImages = (item: cardImages, data: PodProductList | CardOrderData) => { const changeImages = (
item: cardImages,
data: PodProductList | CardOrderData,
) => {
currentImage.value = item.image currentImage.value = item.image
// data.designId = item.designId // data.designId = item.designId
currentId.value = data.id currentId.value = data.id
...@@ -946,7 +956,10 @@ const changeImages = (item: cardImages, data: PodProductList | CardOrderData) => ...@@ -946,7 +956,10 @@ const changeImages = (item: cardImages, data: PodProductList | CardOrderData) =>
} }
// 包装函数,用于处理类型转换 // 包装函数,用于处理类型转换
const handleChangeImages = (item: any, data: PodProductList | CardOrderData) => { const handleChangeImages = (
item: any,
data: PodProductList | CardOrderData,
) => {
changeImages(item as cardImages, data) changeImages(item as cardImages, data)
} }
const fastTitle = ref('') const fastTitle = ref('')
...@@ -962,13 +975,17 @@ const fastToProduction = (title: string, type: number) => { ...@@ -962,13 +975,17 @@ const fastToProduction = (title: string, type: number) => {
const cardClick = (data: PodProductList | CardOrderData) => { const cardClick = (data: PodProductList | CardOrderData) => {
const status = isSelectStatused(data) const status = isSelectStatused(data)
if (status) { if (status) {
selection.value = selection.value.filter((item: CardOrderData | PodProductList) => item.id !== data.id) selection.value = selection.value.filter(
(item: CardOrderData | PodProductList) => item.id !== data.id,
)
} else { } else {
selection.value.push(data as any) selection.value.push(data as any)
} }
} }
const isSelectStatused = (data: PodProductList | CardOrderData) => { const isSelectStatused = (data: PodProductList | CardOrderData) => {
const index = selection.value.findIndex((item: CardOrderData | PodProductList) => item.id === data.id) const index = selection.value.findIndex(
(item: CardOrderData | PodProductList) => item.id === data.id,
)
return index !== -1 return index !== -1
} }
const changeTab = (item: Tab) => { const changeTab = (item: Tab) => {
...@@ -1071,7 +1088,9 @@ const { ...@@ -1071,7 +1088,9 @@ const {
// 动态选择接口 // 动态选择接口
const fetchData = const fetchData =
status.value === 'IN_PRODUCTION' ? getCardOrderList : getOrderList status.value === 'IN_PRODUCTION' ? getCardOrderList : getOrderList
return fetchData(commonParams, page, pageSize).then((res: { data: any }) => res.data) return fetchData(commonParams, page, pageSize).then(
(res: { data: any }) => res.data,
)
}, },
}) })
// 发货 // 发货
...@@ -1184,7 +1203,9 @@ const confirmProduce = async () => { ...@@ -1184,7 +1203,9 @@ const confirmProduce = async () => {
} catch { } catch {
return return
} }
const ids = selection.value.map((item: CardOrderData | PodProductList) => item.id) const ids = selection.value.map(
(item: CardOrderData | PodProductList) => item.id,
)
try { try {
const res = await confirmProductionOrder(ids) const res = await confirmProductionOrder(ids)
loadDiffList() loadDiffList()
...@@ -1205,11 +1226,15 @@ const downloadMaterial = async () => { ...@@ -1205,11 +1226,15 @@ const downloadMaterial = async () => {
} }
const ids = [] const ids = []
if (status.value === 'IN_PRODUCTION' || status.value === 'WAIT_SHIPMENT') { if (status.value === 'IN_PRODUCTION' || status.value === 'WAIT_SHIPMENT') {
ids.push(...selection.value.map((item: CardOrderData | PodProductList) => item.id)) ids.push(
...selection.value.map((item: CardOrderData | PodProductList) => item.id),
)
} else { } else {
ids.push( ids.push(
...selection.value.flatMap( ...selection.value.flatMap((item: CardOrderData | PodProductList) =>
(item: CardOrderData | PodProductList) => (Array.isArray(item.productList) ? item.productList.map((sub:PodProductList) => sub.id) : []), Array.isArray(item.productList)
? item.productList.map((sub: PodProductList) => sub.id)
: [],
), ),
) )
} }
...@@ -1246,7 +1271,7 @@ const copy = (text: string): void => { ...@@ -1246,7 +1271,7 @@ const copy = (text: string): void => {
} }
document.body.removeChild(oInput) document.body.removeChild(oInput)
} }
const onChangeCurrentRow = (item: OrderData) => { const onChangeCurrentRow = (item: ProductList) => {
currentRow.value = item currentRow.value = item
} }
const cancelOrder = async (id: number) => { const cancelOrder = async (id: number) => {
...@@ -1331,7 +1356,6 @@ const addInternalTag = async () => { ...@@ -1331,7 +1356,6 @@ const addInternalTag = async () => {
// }) // })
// } // }
const printManuscript = async () => { const printManuscript = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage({ return ElMessage({
message: '请选择订单', message: '请选择订单',
...@@ -1341,11 +1365,15 @@ const printManuscript = async () => { ...@@ -1341,11 +1365,15 @@ const printManuscript = async () => {
} }
const ids = [] const ids = []
if (status.value === 'IN_PRODUCTION' || status.value === 'WAIT_SHIPMENT') { if (status.value === 'IN_PRODUCTION' || status.value === 'WAIT_SHIPMENT') {
ids.push(...selection.value.map((item: CardOrderData | PodProductList) => item.id)) ids.push(
...selection.value.map((item: CardOrderData | PodProductList) => item.id),
)
} else { } else {
ids.push( ids.push(
...selection.value.flatMap( ...selection.value.flatMap((item: CardOrderData | PodProductList) =>
(item: CardOrderData | PodProductList) => (Array.isArray(item.productList) ? item.productList.map((sub:PodProductList) => sub.id) : []), Array.isArray(item.productList)
? item.productList.map((sub: PodProductList) => sub.id)
: [],
), ),
) )
} }
...@@ -1382,7 +1410,9 @@ const exportManuscript = async () => { ...@@ -1382,7 +1410,9 @@ const exportManuscript = async () => {
}) })
} }
const ids = selection.value.map((item: CardOrderData | PodProductList) => item.id) const ids = selection.value.map(
(item: CardOrderData | PodProductList) => item.id,
)
try { try {
await showConfirm('是否导出生产单', { await showConfirm('是否导出生产单', {
confirmButtonText: '确认', confirmButtonText: '确认',
...@@ -1411,7 +1441,7 @@ const logVisible = ref(false) ...@@ -1411,7 +1441,7 @@ const logVisible = ref(false)
const logList = ref<LogListData[]>([]) const logList = ref<LogListData[]>([])
// 操作日志 // 操作日志
const openLog = async (id?: number) => { const openLog = async (id?: number) => {
if(!id )return if (!id) return
try { try {
const res = await getLogList(id) const res = await getLogList(id)
logList.value = res.data logList.value = res.data
...@@ -1442,8 +1472,8 @@ const handleUpdateRemark = (payload: { id: number; remark: string }) => { ...@@ -1442,8 +1472,8 @@ const handleUpdateRemark = (payload: { id: number; remark: string }) => {
} }
// 添加一个函数来安全地获取图片列表 // 添加一个函数来安全地获取图片列表
const getSafeImages = (item: PodProductList | CardOrderData): cardImages[] => { const getSafeImages = (item: PodProductList | CardOrderData): cardImages[] => {
if (!item.images) return []; if (!item.images) return []
return item.images as cardImages[]; return item.images as cardImages[]
} }
onMounted(() => { onMounted(() => {
getLogisticsList() getLogisticsList()
......
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