Commit 8fcd26b4 by linjinhong

Merge branch 'dev_pod_cn_process' of…

Merge branch 'dev_pod_cn_process' of http://47.122.114.111:9999/qinjianhui/factory_front into dev_pod_cn_process
parents 45a7a329 71920388
......@@ -483,12 +483,13 @@ export function refreshProductInformationApi(data: {
}
// 设计图排版
export function composingDesignImages(
url: string,
data: number[],
type?: string,
templateWidth?: number,
) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderCn/composingDesignImages?type=${type}&templateWidth=${templateWidth}`,
`${url}?type=${type}&templateWidth=${templateWidth}`,
data,
)
}
......
......@@ -397,12 +397,13 @@ export function updateSelfLogistics(params: {
// 更改物流
export function composingDesignImages(
url: string,
data: number[],
type?: string,
templateWidth?: number,
) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/composingDesignImages?type=${type}&templateWidth=${templateWidth}`,
`${url}?type=${type}&templateWidth=${templateWidth}`,
data,
)
}
......
......@@ -612,38 +612,6 @@
</ElDropdown>
</ElFormItem>
<ElFormItem>
<!-- <span
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
status === 'IN_PRODUCTION'
"
class="item"
>
<ElButton
:loading="tifDownloadLoading"
type="warning"
@click="downloadTif('tiff')"
>
TIF排版
</ElButton>
</span>
<span
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
status === 'IN_PRODUCTION'
"
class="item"
>
<ElButton
:loading="pngDownloadLoading"
type="warning"
@click="downloadTif('png')"
>
PNG排版
</ElButton>
</span> -->
<span v-if="status === 'TO_BE_CONFIRMED'" class="item">
<ElButton type="success" @click="confirmProduct">
确认生产
......@@ -4313,13 +4281,18 @@ const downloadTif = async (type: string, templateWidth: number) => {
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const url =
status.value === 'TO_BE_REPLENISHMENT'
? 'factory/podJomallOrderCn/replenishmentComposingDesignImages'
: 'factory/podJomallOrderCn/composingDesignImages'
try {
const res = await composingDesignImages(
url,
cardSelection.value.map((el) => el.id),
type,
templateWidth,
)
const url =
const filePathUrl =
type === 'tiff'
? res.message?.startsWith('/temp')
? `https://factory.jomalls.com/upload/factory` + res.message
......@@ -4327,10 +4300,10 @@ const downloadTif = async (type: string, templateWidth: number) => {
: filePath + res.message
if (type === 'tiff') {
window.open(url, '_blank')
window.open(filePathUrl, '_blank')
tifDownloadLoading.value = false
} else {
fetch(url)
fetch(filePathUrl)
.then((response) => {
// 确保响应是 OK
if (!response.ok) {
......@@ -4406,9 +4379,13 @@ const downloadSingleType = async (
templateWidth?: number,
) => {
try {
const res = await composingDesignImages([id], type, templateWidth)
const url =
status.value === 'TO_BE_REPLENISHMENT'
? 'factory/podJomallOrderCn/replenishmentComposingDesignImages'
: 'factory/podJomallOrderCn/composingDesignImages'
const res = await composingDesignImages(url, [id], type, templateWidth)
const isTiff = type === 'tiff'
const url = isTiff
const filePathUrl = isTiff
? res.message?.startsWith('/temp')
? `https://factory.jomalls.com/upload/factory` + res.message
: `https://ps.jomalls.com/tiff/` + res.message
......@@ -4416,10 +4393,10 @@ const downloadSingleType = async (
if (isTiff) {
// 对于tiff类型,直接在新窗口打开
window.open(url, '_blank')
window.open(filePathUrl, '_blank')
} else {
// 对于其他类型,使用下载方式
await downloadFile(url, res.message as string)
await downloadFile(filePathUrl, res.message as string)
}
} catch (error) {
console.error(`下载类型 ${type} 时出错:`, error)
......
......@@ -577,40 +577,6 @@
</template>
</ElDropdown>
</ElFormItem>
<!-- <ElFormItem
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
status === 'IN_PRODUCTION'
"
>
<span class="item">
<ElButton
:loading="tifDownloadLoading"
type="warning"
@click="downloadTif('tiff')"
>
TIF排版
</ElButton>
</span>
</ElFormItem>
<ElFormItem
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
status === 'IN_PRODUCTION'
"
>
<span class="item">
<ElButton
:loading="pngDownloadLoading"
type="warning"
@click="downloadTif('png')"
>
PNG排版
</ElButton>
</span>
</ElFormItem> -->
<ElFormItem v-if="status === 'TO_BE_CONFIRMED'">
<span class="item">
<ElButton type="success" @click="confirmProduct">
......@@ -2017,7 +1983,7 @@
class="operate-box-vertical"
>
<el-link
:disabled="row.isUpload"
:disabled="row.isUpload || row.enableArrange === false"
underline="never"
type="success"
@click="uploadFile(row)"
......@@ -2031,7 +1997,7 @@
<Loading />
</el-icon>
<el-link
:disabled="!row.prnUrl"
:disabled="!row.prnUrl || row.enableArrange === false"
style="margin-left: 8px"
underline="never"
:title="fileName(row)"
......@@ -2085,7 +2051,9 @@
</span>
<span class="operate-item">
<ElButton
:disabled="!row.url && !row.tiffUrl"
:disabled="
(!row.url && !row.tiffUrl) || row.enableArrange === false
"
link
type="primary"
@click="handleDownload(row)"
......@@ -2098,7 +2066,7 @@
</span>
<span class="operate-item">
<ElButton
:disabled="row.productNum > 50"
:disabled="row.productNum > 50 || row.enableArrange === false"
link
title="重新排版"
type="warning"
......@@ -3298,7 +3266,7 @@ import {
CircleCheckFilled,
} from '@element-plus/icons-vue'
import { Column, ElFormItem, ElMessage } from 'element-plus'
import { computed, onMounted, ref, nextTick, reactive } from 'vue'
import { computed, onMounted, ref, nextTick, reactive, h } from 'vue'
import FastProduction from './FastProduction.vue'
import { filePath } from '@/api/axios'
import PodMakeOrder from './PodMakeOrder.vue'
......@@ -4600,23 +4568,28 @@ const downloadTif = async (type: string, templateWidth: number) => {
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const url =
status.value === 'TO_BE_REPLENISHMENT'
? 'factory/podJomallOrderUs/replenishmentComposingDesignImages'
: 'factory/podJomallOrderUs/composingDesignImages'
try {
const res = await composingDesignImages(
url,
cardSelection.value.map((el) => el.id),
type,
templateWidth,
)
const url =
const filePathUrl =
type === 'tiff'
? res.message?.startsWith('/temp')
? `https://factory.jomalls.com/upload/factory` + res.message
: `https://ps.jomalls.com/tiff/` + res.message
: filePath + res.message
if (type === 'tiff') {
window.open(url, '_blank')
window.open(filePathUrl, '_blank')
tifDownloadLoading.value = false
} else {
fetch(url)
fetch(filePathUrl)
.then((response) => {
// 确保响应是 OK
if (!response.ok) {
......@@ -4691,9 +4664,13 @@ const downloadSingleType = async (
templateWidth?: number,
) => {
try {
const res = await composingDesignImages([id], type, templateWidth)
const url =
status.value === 'TO_BE_REPLENISHMENT'
? 'factory/podJomallOrderUs/replenishmentComposingDesignImages'
: 'factory/podJomallOrderUS/composingDesignImages'
const res = await composingDesignImages(url, [id], type, templateWidth)
const isTiff = type === 'tiff'
const url = isTiff
const filePathUrl = isTiff
? res.message?.startsWith('/temp')
? `https://factory.jomalls.com/upload/factory` + res.message
: `https://ps.jomalls.com/tiff/` + res.message
......@@ -4701,10 +4678,10 @@ const downloadSingleType = async (
if (isTiff) {
// 对于tiff类型,直接在新窗口打开
window.open(url, '_blank')
window.open(filePathUrl, '_blank')
} else {
// 对于其他类型,使用下载方式
await downloadFile(url, res.message as string)
await downloadFile(filePathUrl, res.message as string)
}
} catch (error) {
console.error(`下载类型 ${type} 时出错:`, error)
......@@ -4778,95 +4755,6 @@ const handleMultiRadioGroupClick = (event: Event) => {
}
}
}
// 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 () => {
try {
const res = await getProductionClientApi()
......@@ -5431,44 +5319,68 @@ const showArrange = async (type: number, data?: PodUsOrderListData) => {
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)
}
}
}
typesettingVisible.value = true
}
// 是否全是cb和g类
const allCBOrG = cardSelection.value.every(
(item) =>
item.productMark === 'custom_normal' || item.productMark === 'normal',
)
function hasDifferentCraftCodeWithSet(items: ProductList[]) {
if (items.length <= 1) return false
// 是否全是cp类
const allCP = cardSelection.value.every(
(item) =>
item.productMark !== 'custom_normal' && item.productMark !== 'normal',
)
const seen = new Set()
for (const item of items) {
if (seen.has(item.craftType)) {
if (seen.size > 1) return true
// cb和g类排单
if (allCBOrG) {
ElMessageBox.confirm('确认对所选择生产单进行排单?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
isAuto.value = false
submitTypesetting()
})
} else if (allCP) {
typesettingVisible.value = true
} else {
seen.add(item.craftType)
if (seen.size > 1) return true
// 不支持混排
await ElMessageBox.alert(
h('p', null, [
h('span', null, '无法排单。'),
h('br'),
h(
'span',
null,
'原因:你选择的生产单包含多种商品类型,排单不支持多种商品类型混排,请选择同一类型的商品对应的生产单后再试!',
),
]),
'提示',
{
confirmButtonText: '确定',
},
)
return
}
}
return false
}
// function hasDifferentCraftCodeWithSet(items: ProductList[]) {
// if (items.length <= 1) return false
// const seen = new Set()
// for (const item of items) {
// if (seen.has(item.craftType)) {
// if (seen.size > 1) return true
// } else {
// seen.add(item.craftType)
// if (seen.size > 1) return true
// }
// }
// return false
// }
const arrangeFinish = async () => {
const loading = ElLoading.service({
fullscreen: true,
......
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