Commit b722b152 by linjinhong

添加排版弹窗

parent e3b054f9
......@@ -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>>(
`factory/podJomallOrderUs/composingDesignImages?type=${type}`,
`factory/podJomallOrderUs/composingDesignImages?type=${type}&templateWidth=${templateWidth}`,
data,
)
}
......@@ -445,10 +449,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>>(
`factory/podJomallOrderProductUs/arrangeFinish`,
ids,
params,
)
}
......@@ -491,7 +499,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>>(
`factory/podUsBatchDownload/reComposingDesignImages`,
{
......
......@@ -33,6 +33,7 @@ export interface SearchForm {
supplierProductNo?: string
batchArrangeNumber?: string
craftCode?: string
craftCodeArr?: string[]
thirdStockSku?: string
interceptStatus?: number | string
trackRegisterSelect?: string | number
......
......@@ -47,11 +47,14 @@
<ElFormItem label="工艺">
<ElSelect
v-model="searchForm.craftCode"
v-model="searchForm.craftCodeArr"
clearable
filterable
multiple
collapse-tags
collapse-tags-tooltip
placeholder="请输入工艺"
style="width: 150px"
style="width: 230px"
>
<el-option
v-for="item in craftList"
......@@ -262,7 +265,7 @@
<ElButton type="primary" @click="search">查询</ElButton>
</span>
</ElFormItem>
<!-- <ElFormItem
<ElFormItem
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
......@@ -277,19 +280,29 @@
<ElDropdownMenu>
<ElDropdownItem
:loading="tifDownloadLoading"
@click="downloadTif('png')"
>TIF排版</ElDropdownItem
@click="downloadTif('tiff', 40)"
>TIF(40cm)</ElDropdownItem
>
<ElDropdownItem
:loading="tifDownloadLoading"
@click="downloadTif('tiff', 60)"
>TIF(60cm)</ElDropdownItem
>
<ElDropdownItem
:loading="pngDownloadLoading"
@click="downloadTif('png')"
>PNG排版</ElDropdownItem
@click="downloadTif('png', 40)"
>PNG(40cm)</ElDropdownItem
>
<ElDropdownItem
:loading="pngDownloadLoading"
@click="downloadTif('png', 60)"
>PNG(60cm)</ElDropdownItem
>
</ElDropdownMenu></template
></ElDropdown
></ElFormItem
> -->
<ElFormItem
>
<!-- <ElFormItem
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
......@@ -322,7 +335,7 @@
PNG排版
</ElButton>
</span>
</ElFormItem>
</ElFormItem> -->
<ElFormItem v-if="status === 'TO_BE_CONFIRMED'">
<span class="item">
<ElButton type="success" @click="confirmProduct">
......@@ -544,7 +557,7 @@
</ElFormItem>
<ElFormItem v-if="status === 'TO_BE_ARRANGE'">
<span class="item">
<ElButton type="warning" @click="arrangeFinish">排单完成</ElButton>
<ElButton type="warning" @click="showArrange(2)">排单完成</ElButton>
</span>
</ElFormItem>
......@@ -1244,21 +1257,14 @@
@click="downloadMaterialItem(item)"
>下载素材
</el-button>
<el-button
link
size="small"
type="warning"
style="height: 23px; margin: 0"
@click="downloadTifItem('tiff', item.id)"
>TIF排版
</el-button>
<el-button
link
size="small"
type="warning"
style="height: 23px; margin: 0"
@click="downloadTifItem('png', item.id)"
>PNG排版
@click="showArrange(3, item)"
>排版
</el-button>
</div>
</div>
......@@ -1586,7 +1592,7 @@
link
type="warning"
:loading="reComposingLoadingMap[row.id]"
@click="handleReComposingDesign(row)"
@click="showArrange(1, row)"
>
重新排版
</ElButton>
......@@ -2418,6 +2424,53 @@
</el-timeline-item>
</el-timeline>
</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-select v-model="typesettingForm.type">
<el-option label="tiff排版" value="tiff"></el-option>
<el-option label="png排版" value="png"></el-option>
</el-select> -->
<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-select v-model="typesettingForm.templateWidth">
<el-option label="40cm" :value="40"></el-option>
<el-option label="60cm" :value="60"></el-option>
</el-select> -->
</el-form-item>
</el-form>
<template #footer>
<el-button @click="typesettingVisible = false">取消</el-button>
<el-button
type="primary"
@click="
() => {
console.log(999, typesettingType)
return typesettingType == 1
? handleReComposingDesign()
: typesettingType == 2
? arrangeFinish()
: downloadTifItem()
}
"
>确认</el-button
>
</template>
</ElDialog>
</template>
<script setup lang="ts">
import { getUserMarkList } from '@/api/common'
......@@ -2704,6 +2757,7 @@ const [searchForm, resetSearchForm] = useValue<SearchForm>({
supplierProductNo: '',
batchArrangeNumber: '',
craftCode: '',
craftCodeArr: [],
thirdStockSku: '',
})
const exceptionStatus = ref(1)
......@@ -2925,20 +2979,25 @@ const handleBatchDelete = async (type: string, id?: string) => {
}
}
// 批量下载 重新排版
const handleReComposingDesign = async (row: PodUsOrderListData) => {
try {
await showConfirm('确定重新排版吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const handleReComposingDesign = async () => {
const row = { ...(typesettingRow.value as PodUsOrderListData) }
// try {
// await showConfirm('确定重新排版吗?', {
// confirmButtonText: '确认',
// cancelButtonText: '取消',
// type: 'warning',
// })
// } catch {
// return
// }
reComposingLoadingMap[row.id] = true
typesettingVisible.value = false
try {
const res = await batchDownloadRecomposingApi({ id: row.id })
const res = await batchDownloadRecomposingApi({
id: row.id,
type: typesettingForm.value?.typeArr?.join(',') || '',
templateWidth: typesettingForm.value.templateWidth,
})
if (res.code !== 200) return
ElMessage.success(res.message)
search()
......@@ -2947,6 +3006,8 @@ const handleReComposingDesign = async (row: PodUsOrderListData) => {
console.error(e)
} finally {
reComposingLoadingMap[row.id] = false
typesettingRow.value = undefined
}
}
const tableColumns = computed(() => {
......@@ -3294,48 +3355,50 @@ const {
status.value !== 'TO_BE_REPLENISHMENT' &&
status.value !== 'TO_BE_ARRANGE'
) {
return getOrderList(
{
...searchForm.value,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
: null,
endTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
status: status.value === 'INTERCEPTED' ? '' : status.value,
exceptionHandling:
status.value === 'EXCEPTION_ORDER'
? exceptionStatus.value || undefined
: undefined,
interceptStatus:
status.value === 'INTERCEPTED' ? interceptStatus.value : '',
trackRegisterSelect:
status.value === 'WAIT_TRACK' ? waitTrackStatus.value : '',
},
page,
pageSize,
).then((res) => res.data) as never
const params = {
...searchForm.value,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
: null,
endTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
status: status.value === 'INTERCEPTED' ? '' : status.value,
exceptionHandling:
status.value === 'EXCEPTION_ORDER'
? exceptionStatus.value || undefined
: undefined,
interceptStatus:
status.value === 'INTERCEPTED' ? interceptStatus.value : '',
trackRegisterSelect:
status.value === 'WAIT_TRACK' ? waitTrackStatus.value : '',
craftCode: searchForm.value?.craftCodeArr?.join(',') || '',
}
params.craftCodeArr && delete params.craftCodeArr
return getOrderList(params, page, pageSize).then(
(res) => res.data,
) as never
} else {
return getCardOrderList(
{
...searchForm.value,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
: null,
endTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
status: status.value,
interceptStatus: '',
},
page,
pageSize,
).then((res) => res.data) as never
const params = {
...searchForm.value,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
: null,
endTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[1]
: null,
status: status.value,
interceptStatus: '',
craftCode: searchForm.value?.craftCodeArr?.join(',') || '',
}
params.craftCodeArr && delete params.craftCodeArr
return getCardOrderList(params, page, pageSize).then(
(res) => res.data,
) as never
}
},
})
......@@ -3542,7 +3605,7 @@ const productionClientVisible = ref(false)
// productionClientVisible.value = true
// }
const downloadTif = async (type: string) => {
const downloadTif = async (type: string, templateWidth: number) => {
if (!cardSelection.value.length) {
return ElMessage.warning('请选择数据')
}
......@@ -3551,10 +3614,16 @@ const downloadTif = async (type: string) => {
} else {
pngDownloadLoading.value = true
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await composingDesignImages(
cardSelection.value.map((el) => el.id),
type,
templateWidth,
)
const url =
type === 'tiff'
......@@ -3595,16 +3664,22 @@ const downloadTif = async (type: string) => {
} else {
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({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const type = (typesettingForm.value?.typeArr?.join(',') as string) || ''
const templateWidth = typesettingForm.value?.templateWidth as number
typesettingVisible.value = false
try {
const res = await composingDesignImages([id], type)
const res = await composingDesignImages([row.id], type, templateWidth)
const url =
type === 'tiff'
? `https://ps.jomalls.com/tiff/` + res.message
......@@ -3639,6 +3714,7 @@ const downloadTifItem = async (type: string, id: number) => {
} catch (e) {
console.log(e)
} finally {
typesettingRow.value = undefined
loading.close()
}
}
......@@ -4096,32 +4172,83 @@ const downloadMaterialItem = async (data: PodUsOrderListData) => {
}
// 排单完成
const arrangeFinish = async () => {
const selectedIds = cardSelection.value.map((item) => item.id)
if (selectedIds.length === 0) {
return ElMessage({
message: '请选择订单',
type: 'warning',
offset: window.innerHeight / 2,
})
const typesettingForm = ref<{
typeArr?: string[]
type?: string
templateWidth?: number
}>({})
const typesettingVisible = ref(false)
const typesettingType = ref<number>()
const typesettingRow = ref<PodUsOrderListData>()
const showArrange = async (type: number, data?: PodUsOrderListData) => {
typesettingType.value = type
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('确定排单完成吗?', '提示', {
cancelButtonText: '取消',
confirmButtonText: '确认',
type: 'warning',
})
} catch {
return
typesettingVisible.value = true
}
function hasDifferentCraftCodeWithSet(items: ProductList[]) {
if (items.length <= 1) return false
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({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const selectedIds = cardSelection.value.map((item) => item.id)
const params = {
productIdList: selectedIds,
templateWidth: typesettingForm.value.templateWidth,
type: typesettingForm.value?.typeArr?.join(',') || '',
}
console.log(4233, params)
typesettingVisible.value = false
try {
const res = await arrangeFinishApi(selectedIds)
const res = await arrangeFinishApi(params)
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
......
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