Commit 34c97635 by qinjianhui

feat: 批次管理操作列修改

parent 43f9f19b
...@@ -43,7 +43,10 @@ export function getFactoryOrderNewListApi( ...@@ -43,7 +43,10 @@ export function getFactoryOrderNewListApi(
status?: string, status?: string,
subStatus?: number, subStatus?: number,
) { ) {
const body = normalizePodOrderQueryPayload({ ...data } as Record<string, unknown>) const body = normalizePodOrderQueryPayload({ ...data } as Record<
string,
unknown
>)
return axios.post<never, BasePaginationData<FactoryOrderNewListData>>( return axios.post<never, BasePaginationData<FactoryOrderNewListData>>(
'factory/podOrder/list_page', 'factory/podOrder/list_page',
{ {
...@@ -173,7 +176,7 @@ export function cancelSuspendApi(ids: (number | string)[]) { ...@@ -173,7 +176,7 @@ export function cancelSuspendApi(ids: (number | string)[]) {
}) })
} }
export function archiveOrderApi(ids: (number | string)) { export function archiveOrderApi(ids: number | string) {
return axios.get<never, BaseRespData<void>>('factory/podOrder/archiving', { return axios.get<never, BaseRespData<void>>('factory/podOrder/archiving', {
params: { ids }, params: { ids },
}) })
...@@ -194,10 +197,10 @@ export function applyReplenishApi(ids: (number | string)[]) { ...@@ -194,10 +197,10 @@ export function applyReplenishApi(ids: (number | string)[]) {
} }
export function batchDeleteApi(ids: (number | string)[]) { export function batchDeleteApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<void>>( return axios.get<never, BaseRespData<never>>(
'factory/podOrderBatchDownload/delete', 'factory/podOrderBatchDownload/delete',
{ {
ids: ids.join(','), params: { ids: ids.join(',') },
}, },
) )
} }
...@@ -276,7 +279,10 @@ export function getSuspendListApi( ...@@ -276,7 +279,10 @@ export function getSuspendListApi(
pageSize: number, pageSize: number,
pauseReason?: number, pauseReason?: number,
) { ) {
const body = normalizePodOrderQueryPayload({ ...data } as Record<string, unknown>) const body = normalizePodOrderQueryPayload({ ...data } as Record<
string,
unknown
>)
return axios.post<never, BasePaginationData<FactoryOrderNewListData>>( return axios.post<never, BasePaginationData<FactoryOrderNewListData>>(
'factory/podOrderPauseControl/list_page', 'factory/podOrderPauseControl/list_page',
{ ...body, currentPage, pageSize, pauseReason }, { ...body, currentPage, pageSize, pauseReason },
...@@ -289,7 +295,10 @@ export function getSuspendStatisticsApi( ...@@ -289,7 +295,10 @@ export function getSuspendStatisticsApi(
pageSize: number, pageSize: number,
pauseReason?: number, pauseReason?: number,
) { ) {
const body = normalizePodOrderQueryPayload({ ...data } as Record<string, unknown>) const body = normalizePodOrderQueryPayload({ ...data } as Record<
string,
unknown
>)
return axios.post<never, BaseRespData<Record<string, number>>>( return axios.post<never, BaseRespData<Record<string, number>>>(
'factory/podOrderPauseControl/suspendStatistics', 'factory/podOrderPauseControl/suspendStatistics',
{ ...body, currentPage, pageSize, pauseReason }, { ...body, currentPage, pageSize, pauseReason },
...@@ -352,19 +361,53 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) { ...@@ -352,19 +361,53 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) {
orderIds, orderIds,
) )
} }
export function arrangeFinishApi( export function arrangeFinishApi(params: {
url: string, productIdList: number[]
params: { templateWidth?: number
productIdList: number[] type?: string
templateWidth?: number }) {
type?: string return axios.post<never, BaseRespData<never>>(
}, 'factory/podOrderOperation/arrangeFinish',
) { {
return axios.post<never, BaseRespData<never>>(url, { operationIdList: params.productIdList,
operationIdList: params.productIdList, templateWidth: params.templateWidth,
templateWidth: params.templateWidth, type: params.type,
type: params.type, },
}) )
}
export function batchDownloadDesignImagesApi(params: {
id: number
templateWidth?: number
type?: string
}) {
return axios.get<never, BaseRespData<never>>(
'factory/podOrderBatchDownload/reComposingDesignImages',
{
params,
},
)
}
export function printPickPdfByBatchNumberApi(params: {
batchArrangeNumber: string
}) {
return axios.get<never, BaseRespData<never>>(
`factory/podOrderOperation/printPickPdfByBatchNumber`,
{
params,
},
)
}
// 打印生产单item
export function printProductionPdfByBatchNumberApi(params: {
batchArrangeNumber: string
}) {
return axios.get<never, BaseRespData<never>>(
`factory/podOrderOperation/printProductionPdfByBatchNumber`,
{
params,
},
)
} }
export function downloadMaterialApi(id: number[]) { export function downloadMaterialApi(id: number[]) {
...@@ -381,10 +424,10 @@ export function downloadOperationMaterialApi(id: number[]) { ...@@ -381,10 +424,10 @@ export function downloadOperationMaterialApi(id: number[]) {
) )
} }
export function downloadBatchMaterialApi(id: number | string) { export function downloadBatchMaterialApi(id: number | string, type?: string) {
return axios.post<never, BaseRespData<never>>( return axios.get<never, BaseRespData<never>>(
'factory/podOrderBatchDownload/download', 'factory/podOrderBatchDownload/download',
id, { params: { id, type } },
) )
} }
......
...@@ -189,6 +189,7 @@ export interface BatchManageData { ...@@ -189,6 +189,7 @@ export interface BatchManageData {
prnDownloadStatus?: string prnDownloadStatus?: string
enableArrange?: boolean enableArrange?: boolean
standardDesignImage?: number standardDesignImage?: number
type?: string
} }
export interface RestockData { export interface RestockData {
......
...@@ -33,9 +33,7 @@ ...@@ -33,9 +33,7 @@
<template #footer> <template #footer>
<div style="text-align: center"> <div style="text-align: center">
<ElButton @click="visible = false">取消</ElButton> <ElButton @click="visible = false">取消</ElButton>
<ElButton type="primary" :loading="submitting" @click="handleSubmit"> <ElButton type="primary" @click="handleSubmit"> 确定 </ElButton>
确定
</ElButton>
</div> </div>
</template> </template>
</ElDialog> </ElDialog>
...@@ -44,21 +42,26 @@ ...@@ -44,21 +42,26 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { arrangeFinishApi } from '@/api/factoryOrderNew' import { BaseRespData } from '@/types/api'
type OpenPayload = { type OpenPayload = {
productIdList: number[] productIdList?: number[]
title?: string title?: string
requestUrl: string
showAutoSwitch?: boolean showAutoSwitch?: boolean
id?: number
} }
const emit = defineEmits<{ const emit = defineEmits<{
success: [] success: []
}>() }>()
const props = defineProps<{
submitApi: (params: {
productIdList?: number[]
templateWidth?: number
type?: string
}) => Promise<BaseRespData<never>>
}>()
const visible = ref(false) const visible = ref(false)
const submitting = ref(false)
const payload = ref<OpenPayload | null>(null) const payload = ref<OpenPayload | null>(null)
const isAuto = ref(true) const isAuto = ref(true)
...@@ -89,21 +92,25 @@ const handleSubmit = async () => { ...@@ -89,21 +92,25 @@ const handleSubmit = async () => {
if (mustFill && !templateWidth) { if (mustFill && !templateWidth) {
return ElMessage.warning('请选择排版宽度') return ElMessage.warning('请选择排版宽度')
} }
const loading = ElLoading.service({
submitting.value = true fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
await arrangeFinishApi(payload.value.requestUrl, { const res = await props.submitApi({
productIdList: payload.value.productIdList, productIdList: payload.value.productIdList,
templateWidth: isAuto.value ? templateWidth : undefined, templateWidth: isAuto.value ? templateWidth : undefined,
type: isAuto.value ? 'png' : undefined, type: isAuto.value ? 'png' : undefined,
}) })
ElMessage.success('操作成功') if (res.code !== 200) return
ElMessage.success(res.message)
visible.value = false visible.value = false
emit('success') emit('success')
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally { } finally {
submitting.value = false loading.close()
} }
} }
......
...@@ -89,6 +89,9 @@ ...@@ -89,6 +89,9 @@
<div class="batch-manage-actions"> <div class="batch-manage-actions">
<span class="item"> <span class="item">
<ElButton type="primary" @click="refresh">查询</ElButton>
</span>
<span class="item">
<ElButton type="danger" @click="handleBatchDelete">批量删除</ElButton> <ElButton type="danger" @click="handleBatchDelete">批量删除</ElButton>
</span> </span>
</div> </div>
...@@ -109,7 +112,7 @@ ...@@ -109,7 +112,7 @@
{{ row.downloadStatus || '未下载' }} {{ row.downloadStatus || '未下载' }}
</el-tag> </el-tag>
</template> </template>
<template #operation="{ row }"> <template #operate="{ row }">
<ElButton <ElButton
type="primary" type="primary"
link link
...@@ -118,14 +121,19 @@ ...@@ -118,14 +121,19 @@
> >
下载 下载
</ElButton> </ElButton>
<ElButton type="primary" link size="small" @click="handlePrintPick()"> <ElButton
type="primary"
link
size="small"
@click="handlePrintPick(row)"
>
拣货单 拣货单
</ElButton> </ElButton>
<ElButton <ElButton
type="primary" type="primary"
link link
size="small" size="small"
@click="handlePrintProduction()" @click="handlePrintProduction(row)"
> >
生产单 生产单
</ElButton> </ElButton>
...@@ -137,14 +145,23 @@ ...@@ -137,14 +145,23 @@
> >
重排 重排
</ElButton> </ElButton>
<ElButton type="danger" link size="small" @click="handleDelete()"> <ElButton
type="danger"
link
size="small"
@click="handleBatchDelete(row)"
>
删除 删除
</ElButton> </ElButton>
</template> </template>
</TableView> </TableView>
</div> </div>
<ArrangeDialog ref="arrangeDialogRef" @success="refresh" /> <ArrangeDialog
ref="arrangeDialogRef"
:submit-api="submitBatchDownloadDesignImagesApi"
@success="refresh"
/>
<ElPagination <ElPagination
v-model:current-page="currentPage" v-model:current-page="currentPage"
...@@ -167,6 +184,8 @@ import { ...@@ -167,6 +184,8 @@ import {
getBatchManageListApi, getBatchManageListApi,
batchDeleteApi, batchDeleteApi,
downloadBatchMaterialApi, downloadBatchMaterialApi,
printPickPdfByBatchNumberApi,
printProductionPdfByBatchNumberApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { BatchManageData } from '@/types/api/factoryOrderNew' import type { BatchManageData } from '@/types/api/factoryOrderNew'
import type { PaginationData } from '@/types/api' import type { PaginationData } from '@/types/api'
...@@ -176,6 +195,7 @@ import { getEmployeeListApi } from '@/api/common' ...@@ -176,6 +195,7 @@ import { getEmployeeListApi } from '@/api/common'
import type { userData } from '@/types/api/user' import type { userData } from '@/types/api/user'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
import { batchDownloadDesignImagesApi } from '@/api/factoryOrderNew'
const selectedRows = ref<BatchManageData[]>([]) const selectedRows = ref<BatchManageData[]>([])
const employeeList = ref<userData[]>([]) const employeeList = ref<userData[]>([])
...@@ -218,7 +238,7 @@ const columns = [ ...@@ -218,7 +238,7 @@ const columns = [
{ {
label: '批次号', label: '批次号',
prop: 'batchArrangeNum', prop: 'batchArrangeNum',
width: 120, width: 180,
align: 'center', align: 'center',
}, },
{ {
...@@ -259,7 +279,7 @@ const columns = [ ...@@ -259,7 +279,7 @@ const columns = [
width: 150, width: 150,
prop: 'craftType', prop: 'craftType',
align: 'center', align: 'center',
render: ({ row }: { row: BatchManageData; index: number }) => { render: (row: BatchManageData) => {
if (row && !row.craftType) { if (row && !row.craftType) {
return ( return (
<div> <div>
...@@ -290,7 +310,7 @@ const columns = [ ...@@ -290,7 +310,7 @@ const columns = [
minWidth: 180, minWidth: 180,
prop: 'standardDesignImage', prop: 'standardDesignImage',
align: 'center', align: 'center',
render: ({ row }: { row: BatchManageData }) => { render: (row: BatchManageData) => {
return ( return (
<div> <div>
<span> <span>
...@@ -302,12 +322,12 @@ const columns = [ ...@@ -302,12 +322,12 @@ const columns = [
}, },
{ {
label: '失败原因', label: '失败原因',
minWidth: 250, minWidth: 300,
prop: 'failReason', prop: 'failReason',
align: 'left', align: 'left',
render: ({ row }: { row: BatchManageData; index: number }) => { render: (row: BatchManageData) => {
return ( return (
<div> <div style="white-space: pre-line">
<span v-html={row?.failReason}></span> <span v-html={row?.failReason}></span>
</div> </div>
) )
...@@ -330,7 +350,7 @@ const columns = [ ...@@ -330,7 +350,7 @@ const columns = [
width: 85, width: 85,
prop: 'automaticComposing', prop: 'automaticComposing',
align: 'center', align: 'center',
render: ({ row }: { row: BatchManageData; index: number }) => { render: (row: BatchManageData) => {
return ( return (
<div> <div>
<span>{row?.automaticComposing ? '是' : '否'}</span> <span>{row?.automaticComposing ? '是' : '否'}</span>
...@@ -342,10 +362,10 @@ const columns = [ ...@@ -342,10 +362,10 @@ const columns = [
label: '排版参数', label: '排版参数',
width: 140, width: 140,
prop: 'composingParam', prop: 'composingParam',
align: 'center', align: 'left',
render: ({ row }: { row: BatchManageData; index: number }) => { render: (row: BatchManageData) => {
return ( return (
<div> <div style="white-space: pre-line">
<span>{row?.composingParam?.split(';').join('\n')}</span> <span>{row?.composingParam?.split(';').join('\n')}</span>
</div> </div>
) )
...@@ -413,58 +433,119 @@ const handleSelectionChange = (rows: BatchManageData[]) => { ...@@ -413,58 +433,119 @@ const handleSelectionChange = (rows: BatchManageData[]) => {
selectedRows.value = rows selectedRows.value = rows
} }
const handleBatchDelete = async () => { const handleBatchDelete = async (row?: BatchManageData) => {
if (!selectedRows.value.length) { let ids
ElMessage.warning('请先选择数据') if (!row) {
if (!selectedRows.value.length) {
ElMessage.warning('请先选择数据')
return
}
ids = selectedRows.value.map((r) => r.id)
} else {
ids = [row.id]
}
try {
await ElMessageBox.confirm('确定删除选中的数据吗?', '提示', {
type: 'warning',
})
} catch {
return return
} }
await ElMessageBox.confirm('确定批量删除选中的批次吗?', '提示', { const loading = ElLoading.service({
type: 'warning', fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
await batchDeleteApi(selectedRows.value.map((r) => r.id)) const res = await batchDeleteApi(ids)
ElMessage.success('删除成功') if (res.code !== 200) return
ElMessage.success(res.message)
refresh() refresh()
} catch (e) { } catch (e) {
const err = e as Error & { message?: string } console.error(e)
ElMessage.error(err?.message || '删除失败') } finally {
loading.close()
} }
} }
const handleDownload = async (row: BatchManageData) => { const handleDownload = async (row: BatchManageData) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const type = row.url && row.tiffUrl ? 'tiff' : row.url ? 'png' : 'tiff'
try { try {
await ElMessageBox.confirm('确定下载选中的批次吗?', '提示', { const res = await downloadBatchMaterialApi(row.id, type)
type: 'warning',
})
} catch {
return
}
try {
const res = await downloadBatchMaterialApi(row.id)
if (res.code !== 200) return if (res.code !== 200) return
window.open(filePath + res.message) window.open(filePath + res.message, '_blank')
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
const handlePrintPick = () => { const submitBatchDownloadDesignImagesApi = (params: {
ElMessage.info('接口待提供') productIdList?: number[]
templateWidth?: number
type?: string
}) => {
return batchDownloadDesignImagesApi({
id: params.productIdList?.[0] as number,
templateWidth: params.templateWidth,
type: params.type,
})
} }
const handlePrintProduction = () => { const handlePrintPick = async (row: BatchManageData) => {
ElMessage.info('接口待提供') const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await printPickPdfByBatchNumberApi({
batchArrangeNumber: row.batchArrangeNum as string,
})
if (res?.code !== 200) return
ElMessage.success('操作成功')
window.open(filePath + res?.message)
} catch (e) {
console.error(e)
} finally {
loading.close()
}
} }
const handleDelete = () => { const handlePrintProduction = async (row: BatchManageData) => {
ElMessage.info('接口待提供') const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await printProductionPdfByBatchNumberApi({
batchArrangeNumber: row.batchArrangeNum as string,
})
if (res?.code !== 200) return
ElMessage.success('操作成功')
window.open(filePath + res?.message)
} catch (e) {
console.error(e)
} finally {
loading.close()
}
} }
const handleReArrange = (row: BatchManageData) => { const handleReArrange = (row: BatchManageData) => {
arrangeDialogRef.value?.open({ arrangeDialogRef.value?.open({
productIdList: [row.id], productIdList: [row.id],
title: '重排', title: '重排',
requestUrl: 'factory/podOrderBatchDownload/reComposingDesignImages',
showAutoSwitch: false, showAutoSwitch: false,
}) })
} }
......
...@@ -837,6 +837,7 @@ ...@@ -837,6 +837,7 @@
<ArrangeDialog <ArrangeDialog
ref="arrangeDialogRef" ref="arrangeDialogRef"
:submit-api="submitArrangeFinishApi"
@success="() => refreshCurrentView({ isRefreshTree: true })" @success="() => refreshCurrentView({ isRefreshTree: true })"
/> />
...@@ -922,6 +923,7 @@ import { ...@@ -922,6 +923,7 @@ import {
submitPodPrintOrderCompleteApi, submitPodPrintOrderCompleteApi,
getFactoryOrderNewOperateDetailApi, getFactoryOrderNewOperateDetailApi,
statusPushApi, statusPushApi,
arrangeFinishApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
...@@ -1611,10 +1613,21 @@ const handleArrange = async () => { ...@@ -1611,10 +1613,21 @@ const handleArrange = async () => {
.filter((n) => Number.isFinite(n)) as number[] .filter((n) => Number.isFinite(n)) as number[]
arrangeDialogRef.value?.open({ arrangeDialogRef.value?.open({
productIdList, productIdList,
requestUrl: 'factory/podOrderOperation/arrangeFinish',
showAutoSwitch: true, showAutoSwitch: true,
}) })
} }
const submitArrangeFinishApi = (params: {
productIdList?: number[]
templateWidth?: number
type?: string
}) =>
arrangeFinishApi({
productIdList: params.productIdList || [],
templateWidth: params.templateWidth,
type: params.type,
})
const handleSingleConfirmOrder = (row: FactoryOrderNewListData) => { const handleSingleConfirmOrder = (row: FactoryOrderNewListData) => {
confirmOrderDialogRef.value?.open([row.id]) confirmOrderDialogRef.value?.open([row.id])
} }
......
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