Commit b722b152 by linjinhong

添加排版弹窗

parent e3b054f9
...@@ -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,
) )
} }
...@@ -445,10 +449,14 @@ export function toOutOfStockApi(ids: number[]) { ...@@ -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>>( return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderProductUs/arrangeFinish`, `factory/podJomallOrderProductUs/arrangeFinish`,
ids, params,
) )
} }
...@@ -491,7 +499,11 @@ export function batchDownloadDeleteApi(params: { ids?: string }) { ...@@ -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>>( return axios.get<never, BaseRespData<never>>(
`factory/podUsBatchDownload/reComposingDesignImages`, `factory/podUsBatchDownload/reComposingDesignImages`,
{ {
......
...@@ -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
......
...@@ -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>
...@@ -1244,21 +1257,14 @@ ...@@ -1244,21 +1257,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>
...@@ -1586,7 +1592,7 @@ ...@@ -1586,7 +1592,7 @@
link link
type="warning" type="warning"
:loading="reComposingLoadingMap[row.id]" :loading="reComposingLoadingMap[row.id]"
@click="handleReComposingDesign(row)" @click="showArrange(1, row)"
> >
重新排版 重新排版
</ElButton> </ElButton>
...@@ -2418,6 +2424,53 @@ ...@@ -2418,6 +2424,53 @@
</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-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> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getUserMarkList } from '@/api/common' import { getUserMarkList } from '@/api/common'
...@@ -2704,6 +2757,7 @@ const [searchForm, resetSearchForm] = useValue<SearchForm>({ ...@@ -2704,6 +2757,7 @@ const [searchForm, resetSearchForm] = useValue<SearchForm>({
supplierProductNo: '', supplierProductNo: '',
batchArrangeNumber: '', batchArrangeNumber: '',
craftCode: '', craftCode: '',
craftCodeArr: [],
thirdStockSku: '', thirdStockSku: '',
}) })
const exceptionStatus = ref(1) const exceptionStatus = ref(1)
...@@ -2925,20 +2979,25 @@ const handleBatchDelete = async (type: string, id?: string) => { ...@@ -2925,20 +2979,25 @@ const handleBatchDelete = async (type: string, id?: string) => {
} }
} }
// 批量下载 重新排版 // 批量下载 重新排版
const handleReComposingDesign = async (row: PodUsOrderListData) => { const handleReComposingDesign = async () => {
try { const row = { ...(typesettingRow.value as PodUsOrderListData) }
await showConfirm('确定重新排版吗?', { // try {
confirmButtonText: '确认', // await showConfirm('确定重新排版吗?', {
cancelButtonText: '取消', // confirmButtonText: '确认',
type: 'warning', // cancelButtonText: '取消',
}) // type: 'warning',
} catch { // })
return // } catch {
} // return
// }
reComposingLoadingMap[row.id] = true reComposingLoadingMap[row.id] = true
typesettingVisible.value = false
try { 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 if (res.code !== 200) return
ElMessage.success(res.message) ElMessage.success(res.message)
search() search()
...@@ -2947,6 +3006,8 @@ const handleReComposingDesign = async (row: PodUsOrderListData) => { ...@@ -2947,6 +3006,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(() => {
...@@ -3294,48 +3355,50 @@ const { ...@@ -3294,48 +3355,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
} }
}, },
}) })
...@@ -3542,7 +3605,7 @@ const productionClientVisible = ref(false) ...@@ -3542,7 +3605,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('请选择数据')
} }
...@@ -3551,10 +3614,16 @@ const downloadTif = async (type: string) => { ...@@ -3551,10 +3614,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'
...@@ -3595,16 +3664,22 @@ const downloadTif = async (type: string) => { ...@@ -3595,16 +3664,22 @@ 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)',
}) })
const type = (typesettingForm.value?.typeArr?.join(',') as string) || ''
const templateWidth = typesettingForm.value?.templateWidth as number
typesettingVisible.value = false
try { try {
const res = await composingDesignImages([id], type) const res = await composingDesignImages([row.id], type, templateWidth)
const url = const url =
type === 'tiff' type === 'tiff'
? `https://ps.jomalls.com/tiff/` + res.message ? `https://ps.jomalls.com/tiff/` + res.message
...@@ -3639,6 +3714,7 @@ const downloadTifItem = async (type: string, id: number) => { ...@@ -3639,6 +3714,7 @@ const downloadTifItem = async (type: string, id: number) => {
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} finally { } finally {
typesettingRow.value = undefined
loading.close() loading.close()
} }
} }
...@@ -4096,32 +4172,83 @@ const downloadMaterialItem = async (data: PodUsOrderListData) => { ...@@ -4096,32 +4172,83 @@ 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
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: selectedIds,
templateWidth: typesettingForm.value.templateWidth,
type: typesettingForm.value?.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()
......
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