Commit e90edaec by zhuzhequan

Merge remote-tracking branch 'origin/dev' into dev

parents 2c0cf812 01458b31
...@@ -370,9 +370,13 @@ export function updateSelfLogistics(params: { ...@@ -370,9 +370,13 @@ export function updateSelfLogistics(params: {
} }
// 更改物流 // 更改物流
export function composingDesignImages(data: number[], type: string) { export function composingDesignImages(
data: number[],
type?: string,
templateWidth?: number,
) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/composingDesignImages?type=${type}`, `factory/podJomallOrderUs/composingDesignImages?type=${type}&templateWidth=${templateWidth}`,
data, data,
) )
} }
...@@ -436,10 +440,14 @@ export function toOutOfStockApi(ids: number[]) { ...@@ -436,10 +440,14 @@ export function toOutOfStockApi(ids: number[]) {
} }
// 排单完成 // 排单完成
export function arrangeFinishApi(ids: number[]) { export function arrangeFinishApi(params: {
productIdList: number[]
templateWidth?: number
type?: string
}) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderProductUs/arrangeFinish`, `factory/podJomallOrderProductUs/arrangeFinish`,
ids, params,
) )
} }
...@@ -482,7 +490,11 @@ export function batchDownloadDeleteApi(params: { ids?: string }) { ...@@ -482,7 +490,11 @@ export function batchDownloadDeleteApi(params: { ids?: string }) {
} }
// 批量下载 重新排版 // 批量下载 重新排版
export function batchDownloadRecomposingApi(params: { id: number }) { export function batchDownloadRecomposingApi(params: {
id: number
type?: string
templateWidth?: number
}) {
return axios.get<never, BaseRespData<never>>( return axios.get<never, BaseRespData<never>>(
`factory/podBatchDownload/reComposingDesignImages`, `factory/podBatchDownload/reComposingDesignImages`,
{ {
......
...@@ -15,7 +15,8 @@ export interface ExportParams extends SearchForm { ...@@ -15,7 +15,8 @@ export interface ExportParams extends SearchForm {
export interface SearchForm { export interface SearchForm {
timeType?: number | null timeType?: number | null
shopNumber?: string shopNumber?: string
shipmentType?: string shipmentType?: string | number
replaceShipment?: string | number
userMark?: string userMark?: string
processNumber?: string processNumber?: string
trackingNumber?: string trackingNumber?: string
......
...@@ -33,6 +33,7 @@ export interface SearchForm { ...@@ -33,6 +33,7 @@ export interface SearchForm {
supplierProductNo?: string supplierProductNo?: string
batchArrangeNumber?: string batchArrangeNumber?: string
craftCode?: string craftCode?: string
craftCodeArr?: string[]
thirdStockSku?: string thirdStockSku?: string
interceptStatus?: number | string interceptStatus?: number | string
trackRegisterSelect?: string | number trackRegisterSelect?: string | number
......
...@@ -493,7 +493,17 @@ const getOrderListFn = async () => { ...@@ -493,7 +493,17 @@ const getOrderListFn = async () => {
const { currentPage, pageSize } = pagination.value const { currentPage, pageSize } = pagination.value
try { try {
const { data } = await getOrderList( const { data } = await getOrderList(
{ ...searchForm.value }, {
...searchForm.value,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
: null,
endTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
},
currentPage, currentPage,
pageSize, pageSize,
) )
......
...@@ -221,7 +221,46 @@ ...@@ -221,7 +221,46 @@
style="width: 150px" style="width: 150px"
></ElInput> ></ElInput>
</ElFormItem> </ElFormItem>
<ElFormItem label="物流类型"> <ElFormItem label="是否代发">
<ElSelect
v-model="searchForm.replaceShipment"
placeholder="是否代发"
clearable
:teleported="false"
style="width: 150px"
@change="changeReplaceShipment"
>
<ElOption
v-for="(item, index) in ['不代发', '代发']"
:key="index"
:value="index"
:label="item"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem
v-if="searchForm.replaceShipment === 0"
label="物流类型"
>
<ElSelect
v-model="searchForm.shipmentType"
placeholder="物流类型"
clearable
:teleported="false"
style="width: 150px"
>
<ElOption
v-for="(item, index) in ['自提', '快递']"
:key="index"
:value="index"
:label="item"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem
v-if="searchForm.replaceShipment === 1"
label="物流类型"
>
<ElSelect <ElSelect
v-model="searchForm.shipmentType" v-model="searchForm.shipmentType"
placeholder="物流类型" placeholder="物流类型"
...@@ -2299,6 +2338,7 @@ const detailData = ref({}) ...@@ -2299,6 +2338,7 @@ const detailData = ref({})
const [searchForm, resetSearchForm] = useValue<SearchForm>({ const [searchForm, resetSearchForm] = useValue<SearchForm>({
timeType: 1, timeType: 1,
shopNumber: '', shopNumber: '',
replaceShipment: '',
shipmentType: '', shipmentType: '',
userMark: '', userMark: '',
processNumber: '', processNumber: '',
...@@ -2579,6 +2619,9 @@ const updateOrder = async () => { ...@@ -2579,6 +2619,9 @@ const updateOrder = async () => {
loading.close() loading.close()
} }
} }
const changeReplaceShipment = () => {
searchForm.value.shipmentType = ''
}
const assignOrder = async () => { const assignOrder = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
......
...@@ -47,11 +47,14 @@ ...@@ -47,11 +47,14 @@
<ElFormItem label="工艺"> <ElFormItem label="工艺">
<ElSelect <ElSelect
v-model="searchForm.craftCode" v-model="searchForm.craftCodeArr"
clearable clearable
filterable filterable
multiple
collapse-tags
collapse-tags-tooltip
placeholder="请输入工艺" placeholder="请输入工艺"
style="width: 150px" style="width: 230px"
> >
<el-option <el-option
v-for="item in craftList" v-for="item in craftList"
...@@ -262,7 +265,7 @@ ...@@ -262,7 +265,7 @@
<ElButton type="primary" @click="search">查询</ElButton> <ElButton type="primary" @click="search">查询</ElButton>
</span> </span>
</ElFormItem> </ElFormItem>
<!-- <ElFormItem <ElFormItem
v-if=" v-if="
status === 'PICKING' || status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' || status === 'TO_BE_REPLENISHMENT' ||
...@@ -277,19 +280,29 @@ ...@@ -277,19 +280,29 @@
<ElDropdownMenu> <ElDropdownMenu>
<ElDropdownItem <ElDropdownItem
:loading="tifDownloadLoading" :loading="tifDownloadLoading"
@click="downloadTif('png')" @click="downloadTif('tiff', 40)"
>TIF排版</ElDropdownItem >TIF(40cm)</ElDropdownItem
>
<ElDropdownItem
:loading="tifDownloadLoading"
@click="downloadTif('tiff', 60)"
>TIF(60cm)</ElDropdownItem
> >
<ElDropdownItem <ElDropdownItem
:loading="pngDownloadLoading" :loading="pngDownloadLoading"
@click="downloadTif('png')" @click="downloadTif('png', 40)"
>PNG排版</ElDropdownItem >PNG(40cm)</ElDropdownItem
>
<ElDropdownItem
:loading="pngDownloadLoading"
@click="downloadTif('png', 60)"
>PNG(60cm)</ElDropdownItem
> >
</ElDropdownMenu></template </ElDropdownMenu></template
></ElDropdown ></ElDropdown
></ElFormItem ></ElFormItem
> --> >
<ElFormItem <!-- <ElFormItem
v-if=" v-if="
status === 'PICKING' || status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' || status === 'TO_BE_REPLENISHMENT' ||
...@@ -322,7 +335,7 @@ ...@@ -322,7 +335,7 @@
PNG排版 PNG排版
</ElButton> </ElButton>
</span> </span>
</ElFormItem> </ElFormItem> -->
<ElFormItem v-if="status === 'TO_BE_CONFIRMED'"> <ElFormItem v-if="status === 'TO_BE_CONFIRMED'">
<span class="item"> <span class="item">
<ElButton type="success" @click="confirmProduct"> <ElButton type="success" @click="confirmProduct">
...@@ -544,7 +557,7 @@ ...@@ -544,7 +557,7 @@
</ElFormItem> </ElFormItem>
<ElFormItem v-if="status === 'TO_BE_ARRANGE'"> <ElFormItem v-if="status === 'TO_BE_ARRANGE'">
<span class="item"> <span class="item">
<ElButton type="warning" @click="arrangeFinish">排单完成</ElButton> <ElButton type="warning" @click="showArrange(2)">排单完成</ElButton>
</span> </span>
</ElFormItem> </ElFormItem>
<ElFormItem <ElFormItem
...@@ -1243,21 +1256,14 @@ ...@@ -1243,21 +1256,14 @@
@click="downloadMaterialItem(item)" @click="downloadMaterialItem(item)"
>下载素材 >下载素材
</el-button> </el-button>
<el-button <el-button
link link
size="small" size="small"
type="warning" type="warning"
style="height: 23px; margin: 0" style="height: 23px; margin: 0"
@click="downloadTifItem('tiff', item.id)" @click="showArrange(3, item)"
>TIF排版 >排版
</el-button>
<el-button
link
size="small"
type="warning"
style="height: 23px; margin: 0"
@click="downloadTifItem('png', item.id)"
>PNG排版
</el-button> </el-button>
</div> </div>
</div> </div>
...@@ -1554,7 +1560,7 @@ ...@@ -1554,7 +1560,7 @@
</span> </span>
<span class="operate-item"> <span class="operate-item">
<ElButton <ElButton
disabled :disabled="!row.tiffUrl"
link link
type="primary" type="primary"
@click="handleDownload(row, 'tiff')" @click="handleDownload(row, 'tiff')"
...@@ -1585,7 +1591,7 @@ ...@@ -1585,7 +1591,7 @@
link link
type="warning" type="warning"
:loading="reComposingLoadingMap[row.id]" :loading="reComposingLoadingMap[row.id]"
@click="handleReComposingDesign(row)" @click="showArrange(1, row)"
> >
重新排版 重新排版
</ElButton> </ElButton>
...@@ -2417,6 +2423,31 @@ ...@@ -2417,6 +2423,31 @@
</el-timeline-item> </el-timeline-item>
</el-timeline> </el-timeline>
</el-dialog> </el-dialog>
<ElDialog
v-model="typesettingVisible"
title="选择排版类型和宽度"
width="500px"
:close-on-click-modal="false"
>
<el-form :model="typesettingForm" label-width="100px">
<el-form-item label="排版类型:" prop="type">
<el-checkbox-group v-model="typesettingForm.typeArr">
<el-checkbox label="tiff">tiff排版</el-checkbox>
<el-checkbox label="png">png排版</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="排版宽度:" prop="type">
<el-radio-group v-model="typesettingForm.templateWidth">
<el-radio :value="40">40cm</el-radio>
<el-radio :value="60">60cm</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="typesettingVisible = false">取消</el-button>
<el-button type="primary" @click="submitTypesetting">确认</el-button>
</template>
</ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getUserMarkList } from '@/api/common' import { getUserMarkList } from '@/api/common'
...@@ -2703,6 +2734,7 @@ const [searchForm, resetSearchForm] = useValue<SearchForm>({ ...@@ -2703,6 +2734,7 @@ const [searchForm, resetSearchForm] = useValue<SearchForm>({
supplierProductNo: '', supplierProductNo: '',
batchArrangeNumber: '', batchArrangeNumber: '',
craftCode: '', craftCode: '',
craftCodeArr: [],
thirdStockSku: '', thirdStockSku: '',
}) })
const exceptionStatus = ref(1) const exceptionStatus = ref(1)
...@@ -2924,20 +2956,26 @@ const handleBatchDelete = async (type: string, id?: string) => { ...@@ -2924,20 +2956,26 @@ const handleBatchDelete = async (type: string, id?: string) => {
} }
} }
// 批量下载 重新排版 // 批量下载 重新排版
const handleReComposingDesign = async (row: PodUsOrderListData) => { const handleReComposingDesign = async () => {
try { const row = { ...(typesettingRow.value as PodUsOrderListData) }
await showConfirm('确定重新排版吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
reComposingLoadingMap[row.id] = true reComposingLoadingMap[row.id] = true
typesettingVisible.value = false
const params: {
id: number
templateWidth?: number
type?: string
} = {
id: row.id,
}
const { templateWidth, typeArr } = typesettingForm.value
if (templateWidth && typeArr?.length) {
params.templateWidth = templateWidth
params.type = typeArr.join(',')
}
try { try {
const res = await batchDownloadRecomposingApi({ id: row.id }) const res = await batchDownloadRecomposingApi(params)
if (res.code !== 200) return if (res.code !== 200) return
ElMessage.success(res.message) ElMessage.success(res.message)
search() search()
...@@ -2946,6 +2984,8 @@ const handleReComposingDesign = async (row: PodUsOrderListData) => { ...@@ -2946,6 +2984,8 @@ const handleReComposingDesign = async (row: PodUsOrderListData) => {
console.error(e) console.error(e)
} finally { } finally {
reComposingLoadingMap[row.id] = false reComposingLoadingMap[row.id] = false
typesettingRow.value = undefined
} }
} }
const tableColumns = computed(() => { const tableColumns = computed(() => {
...@@ -3293,48 +3333,50 @@ const { ...@@ -3293,48 +3333,50 @@ const {
status.value !== 'TO_BE_REPLENISHMENT' && status.value !== 'TO_BE_REPLENISHMENT' &&
status.value !== 'TO_BE_ARRANGE' status.value !== 'TO_BE_ARRANGE'
) { ) {
return getOrderList( const params = {
{ ...searchForm.value,
...searchForm.value, startTime:
startTime: timeRange.value && timeRange.value.length > 0
timeRange.value && timeRange.value.length > 0 ? timeRange.value[0]
? timeRange.value[0] : null,
: null, endTime:
endTime: timeRange.value && timeRange.value.length > 0
timeRange.value && timeRange.value.length > 0 ? timeRange.value[1]
? timeRange.value[1] : null,
: null, status: status.value === 'INTERCEPTED' ? '' : status.value,
status: status.value === 'INTERCEPTED' ? '' : status.value, exceptionHandling:
exceptionHandling: status.value === 'EXCEPTION_ORDER'
status.value === 'EXCEPTION_ORDER' ? exceptionStatus.value || undefined
? exceptionStatus.value || undefined : undefined,
: undefined, interceptStatus:
interceptStatus: status.value === 'INTERCEPTED' ? interceptStatus.value : '',
status.value === 'INTERCEPTED' ? interceptStatus.value : '', trackRegisterSelect:
trackRegisterSelect: status.value === 'WAIT_TRACK' ? waitTrackStatus.value : '',
status.value === 'WAIT_TRACK' ? waitTrackStatus.value : '', craftCode: searchForm.value?.craftCodeArr?.join(',') || '',
}, }
page, params.craftCodeArr && delete params.craftCodeArr
pageSize, return getOrderList(params, page, pageSize).then(
).then((res) => res.data) as never (res) => res.data,
) as never
} else { } else {
return getCardOrderList( const params = {
{ ...searchForm.value,
...searchForm.value, startTime:
startTime: timeRange.value && timeRange.value.length > 0
timeRange.value && timeRange.value.length > 0 ? timeRange.value[0]
? timeRange.value[0] : null,
: null, endTime:
endTime: timeRange.value && timeRange.value.length > 0
timeRange.value && timeRange.value.length > 0 ? timeRange.value[1]
? timeRange.value[1] : null,
: null, status: status.value,
status: status.value, interceptStatus: '',
interceptStatus: '', craftCode: searchForm.value?.craftCodeArr?.join(',') || '',
}, }
page, params.craftCodeArr && delete params.craftCodeArr
pageSize, return getCardOrderList(params, page, pageSize).then(
).then((res) => res.data) as never (res) => res.data,
) as never
} }
}, },
}) })
...@@ -3541,7 +3583,7 @@ const productionClientVisible = ref(false) ...@@ -3541,7 +3583,7 @@ const productionClientVisible = ref(false)
// productionClientVisible.value = true // productionClientVisible.value = true
// } // }
const downloadTif = async (type: string) => { const downloadTif = async (type: string, templateWidth: number) => {
if (!cardSelection.value.length) { if (!cardSelection.value.length) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
} }
...@@ -3550,10 +3592,16 @@ const downloadTif = async (type: string) => { ...@@ -3550,10 +3592,16 @@ const downloadTif = async (type: string) => {
} else { } else {
pngDownloadLoading.value = true pngDownloadLoading.value = true
} }
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await composingDesignImages( const res = await composingDesignImages(
cardSelection.value.map((el) => el.id), cardSelection.value.map((el) => el.id),
type, type,
templateWidth,
) )
const url = const url =
type === 'tiff' type === 'tiff'
...@@ -3594,53 +3642,188 @@ const downloadTif = async (type: string) => { ...@@ -3594,53 +3642,188 @@ const downloadTif = async (type: string) => {
} else { } else {
pngDownloadLoading.value = false pngDownloadLoading.value = false
} }
} finally {
loading.close()
} }
} }
const downloadTifItem = async (type: string, id: number) => { const downloadTifItem = async () => {
const row = { ...(typesettingRow.value as PodUsOrderListData) }
const loading = ElLoading.service({ const loading = ElLoading.service({
fullscreen: true, fullscreen: true,
text: '操作中...', text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)', background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
const res = await composingDesignImages([id], type) const { templateWidth, typeArr } = typesettingForm.value
const url = const type = typeArr?.join(',') || ''
type === 'tiff'
? `https://ps.jomalls.com/tiff/` + res.message typesettingVisible.value = false
: filePath + res.message
if (type === 'tiff') { // 处理下载逻辑
window.open(url, '_blank') if ((typeArr as string[]).length > 1) {
// 并行处理多个类型
await Promise.allSettled(
(typeArr as string[]).map((el) =>
downloadSingleType(row.id, el, templateWidth),
),
)
} else { } else {
fetch(url) // 处理单个类型
.then((response) => { await downloadSingleType(row.id, type, templateWidth)
// 确保响应是 OK
if (!response.ok) {
throw new Error('网络响应错误')
}
// 返回图片的二进制数据(Blob)
return response.blob()
})
.then((blob) => {
const a = document.createElement('a')
a.href = window.URL.createObjectURL(blob)
a.target = '_blank'
a.download = (res.message as string).split('/')[
(res.message as string).split('/').length - 1
]
a.click()
pngDownloadLoading.value = false
})
.catch((error) => {
console.error('下载图片时出错:', error)
pngDownloadLoading.value = false
})
} }
} catch (e) { } catch (error) {
console.log(e) console.error('下载过程中出错:', error)
} finally { } finally {
typesettingRow.value = undefined
loading.close() loading.close()
} }
} }
// 提取下载单个类型的逻辑为独立函数
const downloadSingleType = async (
id: number,
type: string,
templateWidth?: number,
) => {
try {
const res = await composingDesignImages([id], type, templateWidth)
const isTiff = type === 'tiff'
const url = isTiff
? `https://ps.jomalls.com/tiff/${res.message}`
: `${filePath}${res.message}`
if (isTiff) {
// 对于tiff类型,直接在新窗口打开
window.open(url, '_blank')
} else {
// 对于其他类型,使用下载方式
await downloadFile(url, res.message as string)
}
} catch (error) {
console.error(`下载类型 ${type} 时出错:`, error)
throw error // 重新抛出错误以便外部捕获
}
}
// 提取文件下载逻辑为独立函数
const downloadFile = async (url: string, message: string) => {
try {
const response = await fetch(url)
const blob = await response.blob()
const filename = message.split('/').pop() || 'download'
// 创建下载链接
const a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = filename
a.target = '_blank'
// 模拟点击下载
document.body.appendChild(a)
a.click()
// 清理
setTimeout(() => {
document.body.removeChild(a)
URL.revokeObjectURL(a.href)
}, 100)
} catch (error) {
console.error('下载文件时出错:', error)
throw error // 重新抛出错误
} finally {
pngDownloadLoading.value = false
}
}
// const downloadTifItem = async () => {
// const row = { ...(typesettingRow.value as PodUsOrderListData) }
// const loading = ElLoading.service({
// fullscreen: true,
// text: '操作中...',
// background: 'rgba(0, 0, 0, 0.3)',
// })
// const { templateWidth, typeArr } = typesettingForm.value
// const type = (typeArr?.join(',') as string) || ''
// typesettingVisible.value = false
// try {
// if ((typeArr as string[]).length > 1) {
// typeArr?.forEach(async (el) => {
// const res = await composingDesignImages([row.id], el, templateWidth)
// const url =
// type === 'tiff'
// ? `https://ps.jomalls.com/tiff/` + res.message
// : filePath + res.message
// if (el === 'tiff') {
// window.open(url, '_blank')
// } else {
// fetch(url)
// .then((response) => {
// // 确保响应是 OK
// if (!response.ok) {
// throw new Error('网络响应错误')
// }
// // 返回图片的二进制数据(Blob)
// return response.blob()
// })
// .then((blob) => {
// const a = document.createElement('a')
// a.href = window.URL.createObjectURL(blob)
// a.target = '_blank'
// a.download = (res.message as string).split('/')[
// (res.message as string).split('/').length - 1
// ]
// a.click()
// pngDownloadLoading.value = false
// })
// .catch((error) => {
// console.error('下载图片时出错:', error)
// pngDownloadLoading.value = false
// })
// }
// })
// } else {
// const res = await composingDesignImages([row.id], type, templateWidth)
// const url =
// type === 'tiff'
// ? `https://ps.jomalls.com/tiff/` + res.message
// : filePath + res.message
// if (type === 'tiff') {
// window.open(url, '_blank')
// } else {
// fetch(url)
// .then((response) => {
// // 确保响应是 OK
// if (!response.ok) {
// throw new Error('网络响应错误')
// }
// // 返回图片的二进制数据(Blob)
// return response.blob()
// })
// .then((blob) => {
// const a = document.createElement('a')
// a.href = window.URL.createObjectURL(blob)
// a.target = '_blank'
// a.download = (res.message as string).split('/')[
// (res.message as string).split('/').length - 1
// ]
// a.click()
// pngDownloadLoading.value = false
// })
// .catch((error) => {
// console.error('下载图片时出错:', error)
// pngDownloadLoading.value = false
// })
// }
// }
// } catch (e) {
// console.log(e)
// } finally {
// typesettingRow.value = undefined
// loading.close()
// }
// }
const loadProductionClient = async () => { const loadProductionClient = async () => {
try { try {
const res = await getProductionClientApi() const res = await getProductionClientApi()
...@@ -4095,32 +4278,93 @@ const downloadMaterialItem = async (data: PodUsOrderListData) => { ...@@ -4095,32 +4278,93 @@ const downloadMaterialItem = async (data: PodUsOrderListData) => {
} }
// 排单完成 // 排单完成
const arrangeFinish = async () => {
const selectedIds = cardSelection.value.map((item) => item.id)
if (selectedIds.length === 0) { const typesettingForm = ref<{
return ElMessage({ typeArr?: string[]
message: '请选择订单', type?: string
type: 'warning', templateWidth?: number
offset: window.innerHeight / 2, }>({})
}) const typesettingVisible = ref(false)
const typesettingType = ref<number>()
const typesettingRow = ref<PodUsOrderListData>()
const showArrange = async (type: number, data?: PodUsOrderListData) => {
typesettingType.value = type
typesettingForm.value = {}
if (type === 1 || type === 3) {
typesettingRow.value = data
} else if (type === 2) {
const selectedIds = cardSelection.value.map((item) => item.id)
if (selectedIds.length === 0) {
return ElMessage({
message: '请选择订单',
type: 'warning',
offset: window.innerHeight / 2,
})
}
const bool = hasDifferentCraftCodeWithSet(cardSelection.value)
if (bool) {
try {
await ElMessageBox.confirm(
'选中排单的生产单存在多个工艺, 是否继续排单?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
typesettingVisible.value = true
} catch (error) {
return (typesettingVisible.value = false)
}
}
} }
try {
await ElMessageBox.confirm('确定排单完成吗?', '提示', { typesettingVisible.value = true
cancelButtonText: '取消', }
confirmButtonText: '确认',
type: 'warning', function hasDifferentCraftCodeWithSet(items: ProductList[]) {
}) if (items.length <= 1) return false
} catch {
return const seen = new Set()
for (const item of items) {
if (seen.has(item.craftCode)) {
if (seen.size > 1) return true
} else {
seen.add(item.craftCode)
if (seen.size > 1) return true
}
} }
return false
}
const arrangeFinish = async () => {
const loading = ElLoading.service({ const loading = ElLoading.service({
fullscreen: true, fullscreen: true,
text: '操作中...', text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)', background: 'rgba(0, 0, 0, 0.3)',
}) })
const selectedIds = cardSelection.value.map((item) => item.id)
const params: {
productIdList: number[]
templateWidth?: number
type?: string
} = {
productIdList: selectedIds,
}
const { templateWidth, typeArr } = typesettingForm.value
if (templateWidth && typeArr?.length) {
params.templateWidth = templateWidth
params.type = typeArr.join(',')
}
console.log(4233, params)
typesettingVisible.value = false
try { try {
const res = await arrangeFinishApi(selectedIds) const res = await arrangeFinishApi(params)
if (res.code !== 200) return if (res.code !== 200) return
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() search()
...@@ -4132,6 +4376,26 @@ const arrangeFinish = async () => { ...@@ -4132,6 +4376,26 @@ const arrangeFinish = async () => {
} }
} }
const submitTypesetting = () => {
const { templateWidth, typeArr } = typesettingForm.value
if (templateWidth && !typeArr?.length) {
return ElMessage.warning('请选择排版类型')
} else if (!templateWidth && typeArr?.length) {
return ElMessage.warning('请选择排版宽度')
}
if (typesettingType.value == 3) {
if (!templateWidth && !typeArr?.length) {
return ElMessage.warning('排版类型和排版宽度为必选项')
}
}
return typesettingType.value == 1
? handleReComposingDesign()
: typesettingType.value == 2
? arrangeFinish()
: downloadTifItem()
}
interface timeLineType { interface timeLineType {
time_iso?: string time_iso?: string
time_utc?: string time_utc?: string
......
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