Commit c6122b30 by zhuzhequan

ts 报错

parent aeb4f4a5
...@@ -7,8 +7,11 @@ export {} ...@@ -7,8 +7,11 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
CardPods: typeof import('./src/components/CardPods.vue')['default']
CardWrapper: typeof import('./src/components/CardWrapper.vue')['default'] CardWrapper: typeof import('./src/components/CardWrapper.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElCarousel: typeof import('element-plus/es')['ElCarousel']
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCol: typeof import('element-plus/es')['ElCol'] ElCol: typeof import('element-plus/es')['ElCol']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
...@@ -49,7 +52,6 @@ declare module 'vue' { ...@@ -49,7 +52,6 @@ declare module 'vue' {
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
ShipmentOrderDetail: typeof import('./src/components/ShipmentOrderDetail.vue')['default'] ShipmentOrderDetail: typeof import('./src/components/ShipmentOrderDetail.vue')['default']
SplitDiv: typeof import('./src/components/splitDiv/splitDiv.vue')['default'] SplitDiv: typeof import('./src/components/splitDiv/splitDiv.vue')['default']
TableColumn: typeof import('./src/components/TableColumn.vue')['default']
TableView: typeof import('./src/components/TableView.vue')['default'] TableView: typeof import('./src/components/TableView.vue')['default']
UploadImage: typeof import('./src/components/UploadImage.vue')['default'] UploadImage: typeof import('./src/components/UploadImage.vue')['default']
WangEditor: typeof import('./src/components/WangEditor.vue')['default'] WangEditor: typeof import('./src/components/WangEditor.vue')['default']
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="commodity-card-image"> <div class="commodity-card-image">
<div class="before"></div> <div class="before"></div>
<div class="image"> <div class="image">
<img :src="cardItem.variantImage" /> <img :src="typeof cardItem.variantImage === 'string' ? cardItem.variantImage : ''" />
</div> </div>
<div class="img_top_left"> <div class="img_top_left">
<span class="select-icon"></span> <span class="select-icon"></span>
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType } from 'vue' import { PropType } from 'vue'
import { PodProductList } from '@/types/api/podOrder' import { PodProductList, CardOrderData } from '@/types/api/podOrder'
defineProps({ defineProps({
cardItem: { cardItem: {
type: Object as PropType<PodProductList>, type: Object as PropType<PodProductList | CardOrderData>,
required: true, required: true,
}, },
}) })
......
...@@ -47,11 +47,11 @@ export interface CardOrderData { ...@@ -47,11 +47,11 @@ export interface CardOrderData {
lanshouPost: string | null lanshouPost: string | null
manuscriptUrl: string | null manuscriptUrl: string | null
manuscriptStatus: number | null manuscriptStatus: number | null
createTime: string | null createTime: string | undefined
updateTime: string | null updateTime: string | undefined
remark: string | null remark: string | null
userMark: string | null userMark: string | null
namespace: string | null namespace: string | undefined
productList: PodProductList[] productList: PodProductList[]
internalMemoList: string | null internalMemoList: string | null
[propName: string]: string | number | boolean | undefined | unknown [propName: string]: string | number | boolean | undefined | unknown
...@@ -68,31 +68,31 @@ export interface imageAryInter { ...@@ -68,31 +68,31 @@ export interface imageAryInter {
} }
export interface PodProductList { export interface PodProductList {
id: number id: number
podOrderId: number podOrderId?: number
thirdSubOrderNumber?: string thirdSubOrderNumber?: string
factorySubOrderNumber?: string factorySubOrderNumber?: string
factoryOrderNumber?: string | null factoryOrderNumber?: string | undefined
shopNumber?: string shopNumber?: string
supplierItemNo?: string | null supplierItemNo?: string | null
baseSku?: string baseSku?: string
productName?: string productName?: string
variantSku?: string variantSku?: string
variantImage?: string variantImage?: string
imageAry?: string | imageAryInter[] | null imageAry?: string | imageAryInter[] | undefined
images?: cardImages[] | null images?: cardImages[] | undefined
designImages?: string | null designImages?: string | undefined
process?: string | null process?: string | undefined
podProcessName?: string | null podProcessName?: string | undefined
productionFileId?: string | null productionFileId?: string | undefined
customizedQuantity?: number customizedQuantity?: number
num?: number | string num?: number | string
shipmentNu?: number shipmentNu?: number
costPrice?: number costPrice?: number
price?: number price?: number
processPrice?: number processPrice?: number
weight?: number | null weight?: number | undefined
version?: number | null version?: number | undefined
remark?: string | null remark?: string | undefined
createTime?: string createTime?: string
updateTime?: string updateTime?: string
[propName: string]: string | number | boolean | undefined | unknown [propName: string]: string | number | boolean | undefined | unknown
......
...@@ -163,9 +163,12 @@ ...@@ -163,9 +163,12 @@
</div> </div>
<div class="order-list-expand_item_info_title"> <div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">未发数:</span> <span class="order-list-expand_item_label">未发数:</span>
<span class="order-list-expand_item_value">{{ <span v-if="!isPod" class="order-list-expand_item_value">{{
(item.num || 0) - ((item.shipmentNum || 0) - (item.notPassNum || 0)) (item.num || 0) - ((item.shipmentNum || 0) - (item.notPassNum || 0))
}}</span> }}</span>
<span v-else class="order-list-expand_item_value">{{
(item.num || 0) - (item.shipmentNum || 0)
}}</span>
</div> </div>
<div class="order-list-expand_item_info_title"> <div class="order-list-expand_item_info_title">
<span class="order-list-expand_item_label">工艺:</span> <span class="order-list-expand_item_label">工艺:</span>
......
...@@ -291,6 +291,7 @@ ...@@ -291,6 +291,7 @@
> >
<ProductInfo <ProductInfo
:row="row" :row="row"
:is-pod="false"
:status="statusCode" :status="statusCode"
@update-remark="handleUpdateRemark" @update-remark="handleUpdateRemark"
@again-generated="handleAgainGenerated" @again-generated="handleAgainGenerated"
......
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
v-if="cardItem?.factorySubOrderNumber" v-if="cardItem?.factorySubOrderNumber"
title="生产单号" title="生产单号"
class="base_sku" class="base_sku"
@click.stop="copy(cardItem?.factorySubOrderNumber)" @click.stop="copy(String(cardItem?.factorySubOrderNumber || ''))"
> >
{{ cardItem?.factorySubOrderNumber }} {{ cardItem?.factorySubOrderNumber }}
</span> </span>
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
<template #operations> <template #operations>
<Icon <Icon
name="caozuorizhi" name="caozuorizhi"
@click.stop="openLog(cardItem.podOrderId)" @click.stop="openLog(Number(cardItem.podOrderId) || undefined)"
> >
<template #title> <template #title>
<title>操作日志</title> <title>操作日志</title>
...@@ -223,36 +223,36 @@ ...@@ -223,36 +223,36 @@
<div class="flex-between"> <div class="flex-between">
<div class="images-position"> <div class="images-position">
<div <div
v-for="(item, index) in cardItem.images" v-for="(item, index) in getSafeImages(cardItem)"
:key="index" :key="index"
:title=" :title="
item.ename item?.ename
? item.ename === 'front' ? item.ename === 'front'
? '正面图片' ? '正面图片'
: '反面图片' : '反面图片'
: '' : ''
" "
:style=" :style="
currentImage === item.image && currentId === cardItem.id currentImage === item?.image && currentId === cardItem.id
? 'border-color: red' ? 'border-color: red'
: '' : ''
" "
class="item-image" class="item-image"
@click="changeImages(item, cardItem)" @click="handleChangeImages(item, cardItem)"
> >
<img :src="item.image" height="28" /> <img :src="item?.image" height="28" />
</div> </div>
</div> </div>
<b <b
v-if="cardItem" v-if="cardItem"
:style="{ :style="{
color: color:
(cardItem.customizedQuantity || 0) > 1 (Number(cardItem.customizedQuantity) || 0) > 1
? 'red' ? 'red'
: '#67C23A', : '#67C23A',
}" }"
> >
{{ (cardItem.customizedQuantity || 0) > 1 ? '多' : '单' }} {{ (Number(cardItem.customizedQuantity) || 0) > 1 ? '多' : '单' }}
</b> </b>
</div> </div>
</template> </template>
...@@ -519,7 +519,7 @@ ...@@ -519,7 +519,7 @@
<div class="order-operate_info"> <div class="order-operate_info">
<div <div
v-if=" v-if="
status === 'IN_PRODUCTION' || status === 'PART_SHIPPING' status === 'TO_BE_CONFIRMED'
" "
class="order-list-expand_item_info_title" class="order-list-expand_item_info_title"
> >
...@@ -746,7 +746,7 @@ import TableView from '@/components/TableView.vue' ...@@ -746,7 +746,7 @@ import TableView from '@/components/TableView.vue'
import { import {
// OrderData, // OrderData,
// ProductList, // ProductList,
LogisticsData, LogisticsData, OrderData,
ShipmentForm, ShipmentForm,
} from '@/types/api/order' } from '@/types/api/order'
import fastProduction from '../fastProduction.vue' import fastProduction from '../fastProduction.vue'
...@@ -874,7 +874,7 @@ const openDetail = async (id: number) => { ...@@ -874,7 +874,7 @@ const openDetail = async (id: number) => {
//showError(e) //showError(e)
} }
} }
const CardOrderList = ref<PodProductList[]>([]) const CardOrderList = ref<(PodProductList | CardOrderData)[]>([])
const loadCardList = async () => { const loadCardList = async () => {
try { try {
const res = await getCardOrderList( const res = await getCardOrderList(
...@@ -894,7 +894,7 @@ const loadCardList = async () => { ...@@ -894,7 +894,7 @@ const loadCardList = async () => {
currentPage.value, currentPage.value,
pageSize.value, pageSize.value,
) )
CardOrderList.value = res.data.records.map((item) => { CardOrderList.value = res.data.records.map((item: any) => {
if (!item.imageAry) { if (!item.imageAry) {
const images = [] const images = []
if (typeof item.variantImage === 'string') { if (typeof item.variantImage === 'string') {
...@@ -935,7 +935,7 @@ const loadCardList = async () => { ...@@ -935,7 +935,7 @@ const loadCardList = async () => {
} }
const currentImage = ref('') const currentImage = ref('')
const currentId = ref(-1) const currentId = ref(-1)
const changeImages = (item: cardImages, data: PodProductList) => { 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
...@@ -944,6 +944,11 @@ const changeImages = (item: cardImages, data: PodProductList) => { ...@@ -944,6 +944,11 @@ const changeImages = (item: cardImages, data: PodProductList) => {
// data.productList[0].variantImage = item.image // data.productList[0].variantImage = item.image
// } // }
} }
// 包装函数,用于处理类型转换
const handleChangeImages = (item: any, data: PodProductList | CardOrderData) => {
changeImages(item as cardImages, data)
}
const fastTitle = ref('') const fastTitle = ref('')
const detailData = ref({}) const detailData = ref({})
const detailVisible = ref(false) const detailVisible = ref(false)
...@@ -954,16 +959,16 @@ const fastToProduction = (title: string, type: number) => { ...@@ -954,16 +959,16 @@ const fastToProduction = (title: string, type: number) => {
fastTitle.value = title fastTitle.value = title
fastType.value = type fastType.value = type
} }
const cardClick = (data: PodProductList) => { const cardClick = (data: PodProductList | CardOrderData) => {
const status = isSelectStatused(data) const status = isSelectStatused(data)
if (status) { if (status) {
selection.value = selection.value.filter((item) => item.id !== data.id) selection.value = selection.value.filter((item: CardOrderData | PodProductList) => item.id !== data.id)
} else { } else {
selection.value.push(data) selection.value.push(data as any)
} }
} }
const isSelectStatused = (data: PodProductList) => { const isSelectStatused = (data: PodProductList | CardOrderData) => {
const index = selection.value.findIndex((item) => 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) => {
...@@ -1048,7 +1053,7 @@ const { ...@@ -1048,7 +1053,7 @@ const {
refresh: search, refresh: search,
onCurrentPageChange: handleCurrentChange, onCurrentPageChange: handleCurrentChange,
onPageSizeChange: handleSizeChange, onPageSizeChange: handleSizeChange,
} = usePageList({ } = usePageList<OrderData | CardOrderData>({
query: (page, pageSize) => { query: (page, pageSize) => {
const commonParams = { const commonParams = {
...searchForm.value, ...searchForm.value,
...@@ -1066,46 +1071,7 @@ const { ...@@ -1066,46 +1071,7 @@ const {
// 动态选择接口 // 动态选择接口
const fetchData = const fetchData =
status.value === 'IN_PRODUCTION' ? getCardOrderList : getOrderList status.value === 'IN_PRODUCTION' ? getCardOrderList : getOrderList
return fetchData(commonParams, page, pageSize).then((res) => { return fetchData(commonParams, page, pageSize).then((res: { data: any }) => res.data)
// if (status.value === 'IN_PRODUCTION') {
// const cardList = res.data.records.map((item: PodProductList) => {
// if (!item.imageAry) {
// const images = []
// if (item.variantImage) {
// images.push({
// ename: 'front',
// cname: '正面',
// image: item.variantImage,
// })
// }
// if (item.negativeImage) {
// images.push({
// ename: 'back',
// cname: '反面',
// image: item.negativeImage,
// })
// }
// item.images = images
// } else {
// if (item.imageAry) {
// const images = JSON.parse(item.imageAry)
// item.images = images.map((e) => {
// return {
// ename: '',
// cname: '',
// image: e.url,
// }
// })
// }
// }
// return item
// })
// res.data.records = cardList
// return res.data
// } else {
return res.data
// }
})
}, },
}) })
// 发货 // 发货
...@@ -1196,7 +1162,7 @@ const openAll = (row: CardOrderData) => { ...@@ -1196,7 +1162,7 @@ const openAll = (row: CardOrderData) => {
row.moreable = !row.moreable row.moreable = !row.moreable
} }
// 表格和卡片的选中值:有两种约束 // 表格和卡片的选中值:有两种约束
const selection = ref<CardOrderData[] | PodProductList[]>([]) const selection = ref<(CardOrderData | PodProductList)[]>([])
const handleSelectionChange = (s: CardOrderData[]) => { const handleSelectionChange = (s: CardOrderData[]) => {
selection.value = s selection.value = s
} }
...@@ -1218,7 +1184,7 @@ const confirmProduce = async () => { ...@@ -1218,7 +1184,7 @@ const confirmProduce = async () => {
} catch { } catch {
return return
} }
const ids = selection.value.map((item) => 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()
...@@ -1239,11 +1205,11 @@ const downloadMaterial = async () => { ...@@ -1239,11 +1205,11 @@ 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) => 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) => item.productList?.map((sub:PodProductList) => sub.id) || [], (item: CardOrderData | PodProductList) => (Array.isArray(item.productList) ? item.productList.map((sub:PodProductList) => sub.id) : []),
), ),
) )
} }
...@@ -1280,7 +1246,7 @@ const copy = (text: string): void => { ...@@ -1280,7 +1246,7 @@ const copy = (text: string): void => {
} }
document.body.removeChild(oInput) document.body.removeChild(oInput)
} }
const onChangeCurrentRow = (item) => { const onChangeCurrentRow = (item: OrderData) => {
currentRow.value = item currentRow.value = item
} }
const cancelOrder = async (id: number) => { const cancelOrder = async (id: number) => {
...@@ -1322,10 +1288,10 @@ const addInternalTag = async () => { ...@@ -1322,10 +1288,10 @@ const addInternalTag = async () => {
inputPlaceholder: '请输入内部便签', inputPlaceholder: '请输入内部便签',
inputPattern: /.+/, inputPattern: /.+/,
inputErrorMessage: '内部便签不能为空', inputErrorMessage: '内部便签不能为空',
}).then(async ({ value }) => { }).then(async ({ value }: { value: string }) => {
try { try {
const res = await addInternalTagApi( const res = await addInternalTagApi(
selection.value.map((item) => item.id), selection.value.map((item: CardOrderData | PodProductList) => item.id),
value, value,
) )
ElMessage.success(res.message) ElMessage.success(res.message)
...@@ -1365,6 +1331,7 @@ const addInternalTag = async () => { ...@@ -1365,6 +1331,7 @@ 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: '请选择订单',
...@@ -1374,11 +1341,11 @@ const printManuscript = async () => { ...@@ -1374,11 +1341,11 @@ 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) => 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) => item.productList?.map((sub:PodProductList) => sub.id) || [], (item: CardOrderData | PodProductList) => (Array.isArray(item.productList) ? item.productList.map((sub:PodProductList) => sub.id) : []),
), ),
) )
} }
...@@ -1415,7 +1382,7 @@ const exportManuscript = async () => { ...@@ -1415,7 +1382,7 @@ const exportManuscript = async () => {
}) })
} }
const ids = selection.value.map((item) => item.id) const ids = selection.value.map((item: CardOrderData | PodProductList) => item.id)
try { try {
await showConfirm('是否导出生产单', { await showConfirm('是否导出生产单', {
confirmButtonText: '确认', confirmButtonText: '确认',
...@@ -1443,7 +1410,8 @@ const exportManuscript = async () => { ...@@ -1443,7 +1410,8 @@ const exportManuscript = async () => {
const logVisible = ref(false) 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
try { try {
const res = await getLogList(id) const res = await getLogList(id)
logList.value = res.data logList.value = res.data
...@@ -1472,6 +1440,11 @@ const handleUpdateRemark = (payload: { id: number; remark: string }) => { ...@@ -1472,6 +1440,11 @@ const handleUpdateRemark = (payload: { id: number; remark: string }) => {
} }
}) })
} }
// 添加一个函数来安全地获取图片列表
const getSafeImages = (item: PodProductList | CardOrderData): cardImages[] => {
if (!item.images) return [];
return item.images as cardImages[];
}
onMounted(() => { onMounted(() => {
getLogisticsList() getLogisticsList()
loadTabData() loadTabData()
......
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