Commit d6c927e4 by wusiyi

fix:适配打印生产单按钮的报错提示

parent 02402c38
...@@ -481,7 +481,7 @@ export function composingNewPodOrderDesignImages( ...@@ -481,7 +481,7 @@ export function composingNewPodOrderDesignImages(
} }
export function printNewPodOrderProductionOrderApi(ids: number[]) { export function printNewPodOrderProductionOrderApi(ids: number[]) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<PrintProductionPdfResult>>(
'factory/podOrderOperation/printProducePdf', 'factory/podOrderOperation/printProducePdf',
ids, ids,
) )
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
> >
{{ '选择异常' }} {{ '选择异常' }}
</el-button> </el-button>
<el-button v-if="isCopyResult" type="success" @click="copyAllCode()"> <el-button v-if="config.isCopyResult" type="success" @click="copyAllCode()">
{{ '复制结果' }} {{ '复制结果' }}
</el-button> </el-button>
<el-button v-if="isCopyNumber" type="success" @click="copyNumberCode()"> <el-button v-if="config.isCopyNumber" type="success" @click="copyNumberCode()">
{{ '复制' + config.numberTitle }} {{ '复制' + config.numberTitle }}
</el-button> </el-button>
</div> </div>
...@@ -71,22 +71,22 @@ import { ResultInfoDataItem } from '@/types/api/order/common' ...@@ -71,22 +71,22 @@ import { ResultInfoDataItem } from '@/types/api/order/common'
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
list: ResultInfoDataItem[] list: ResultInfoDataItem[]
isCopyResult?: boolean
isCopyNumber?: boolean
config?: { config?: {
factoryOrderNumber: keyof ResultInfoDataItem factoryOrderNumber: keyof ResultInfoDataItem
numberTitle: string numberTitle: string
isShowButtons: boolean isShowButtons: boolean
isCopyResult?: boolean
isCopyNumber?: boolean
} }
}>(), }>(),
{ {
list: () => [], list: () => [],
isCopyResult: true,
isCopyNumber: false,
config: () => ({ config: () => ({
factoryOrderNumber: 'factoryOrderNumber', factoryOrderNumber: 'factoryOrderNumber',
numberTitle: '工厂订单号', numberTitle: '工厂订单号',
isShowButtons: true, isShowButtons: true,
isCopyResult: true,
isCopyNumber: false,
}), }),
}, },
) )
......
...@@ -188,12 +188,12 @@ ...@@ -188,12 +188,12 @@
<ResultInfo <ResultInfo
ref="resultInfoRef" ref="resultInfoRef"
:list="resultInfoList" :list="resultInfoList"
:is-copy-result="false"
:is-copy-number="true"
:config="{ :config="{
factoryOrderNumber: 'factoryOrderNumber', factoryOrderNumber: 'factoryOrderNumber',
numberTitle: '操作单号', numberTitle: '操作单号',
isShowButtons: false, isShowButtons: false,
isCopyResult: false,
isCopyNumber: true,
}" }"
/> />
</div> </div>
......
...@@ -1142,6 +1142,17 @@ ...@@ -1142,6 +1142,17 @@
<ResultInfo <ResultInfo
ref="resultRefs" ref="resultRefs"
:list="resultInfo" :list="resultInfo"
:config="
isPrintProduction
? {
factoryOrderNumber: 'factoryOrderNumber',
numberTitle: '操作单号',
isShowButtons: false,
isCopyResult: false,
isCopyNumber: true,
}
: undefined
"
@confirm="() => refreshCurrentView({ isRefreshTree: true })" @confirm="() => refreshCurrentView({ isRefreshTree: true })"
></ResultInfo> ></ResultInfo>
<UpdateAddress <UpdateAddress
...@@ -1354,7 +1365,10 @@ import ChangeWayDialog from '@/views/order/podCN/components/ChangeWayDialog.vue' ...@@ -1354,7 +1365,10 @@ import ChangeWayDialog from '@/views/order/podCN/components/ChangeWayDialog.vue'
import { ResultInfoDataItem } from '@/types/api/order/common' import { ResultInfoDataItem } from '@/types/api/order/common'
import type { FactoryOrderSearchQueryVisibilityContext } from '@/types/api/factoryOrderNew/searchQueryVisibility' import type { FactoryOrderSearchQueryVisibilityContext } from '@/types/api/factoryOrderNew/searchQueryVisibility'
import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew' import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew'
import type { StatusListNode } from '@/types/api/factoryOrderNew' import type {
BatchReturnVOItem,
StatusListNode,
} from '@/types/api/factoryOrderNew'
import { useOrderDictionaries } from './hooks/useOrderDictionaries' import { useOrderDictionaries } from './hooks/useOrderDictionaries'
import { useOrderSearchForm } from './hooks/useOrderSearchForm' import { useOrderSearchForm } from './hooks/useOrderSearchForm'
import { useOrderStatusTree } from './hooks/useOrderStatusTree' import { useOrderStatusTree } from './hooks/useOrderStatusTree'
...@@ -1370,6 +1384,7 @@ import { getPodOrderCraftApi } from '@/api/podCnOrder.ts' ...@@ -1370,6 +1384,7 @@ import { getPodOrderCraftApi } from '@/api/podCnOrder.ts'
const resultInfo = ref<ResultInfoDataItem[]>([]) const resultInfo = ref<ResultInfoDataItem[]>([])
const resultRefs = ref() const resultRefs = ref()
const isPrintProduction = ref(false)
const podCraftList = ref<CraftData[]>([]) const podCraftList = ref<CraftData[]>([])
const statusSidebarCollapsed = ref(false) const statusSidebarCollapsed = ref(false)
const toggleStatusSidebar = () => { const toggleStatusSidebar = () => {
...@@ -1524,9 +1539,9 @@ const getListQueryPayload = () => { ...@@ -1524,9 +1539,9 @@ const getListQueryPayload = () => {
} }
const getCraft = async () => { const getCraft = async () => {
const res = await getPodOrderCraftApi() const res = await getPodOrderCraftApi()
const data: CraftListData[] = res.data const data: CraftListData[] = res.data
podCraftList.value = data.map((item:CraftListData) => ({ podCraftList.value = data.map((item: CraftListData) => ({
id: item.craftCode, id: item.craftCode,
name: item.craftName, name: item.craftName,
warehouseName: processTypeMap[item.craftType] ?? '其他', warehouseName: processTypeMap[item.craftType] ?? '其他',
...@@ -1930,19 +1945,19 @@ const mainColumns = computed(() => [ ...@@ -1930,19 +1945,19 @@ const mainColumns = computed(() => [
}, },
{ {
prop: 'statusName', prop: 'statusName',
label:'挂起前状态', label: '挂起前状态',
minWidth: 120, minWidth: 120,
hidden:status.value !== 'SUSPEND', hidden: status.value !== 'SUSPEND',
align: 'center' align: 'center',
}, },
{ {
prop: 'statusName', prop: 'statusName',
hidden:status.value === 'SUSPEND', hidden: status.value === 'SUSPEND',
label: '订单状态', label: '订单状态',
minWidth: 120, minWidth: 120,
align: 'center', align: 'center',
render: (row: FactoryOrderNewListData) => { render: (row: FactoryOrderNewListData) => {
return <span>{ row.pause ? '挂起' : row.statusName}</span> return <span>{row.pause ? '挂起' : row.statusName}</span>
}, },
}, },
{ {
...@@ -2601,6 +2616,7 @@ const openResultInfoDialog = (data: ResultInfoDataItem[]) => { ...@@ -2601,6 +2616,7 @@ const openResultInfoDialog = (data: ResultInfoDataItem[]) => {
nextTick(() => { nextTick(() => {
const isSuccess = data.every((item) => item.status) const isSuccess = data.every((item) => item.status)
if (!isSuccess) { if (!isSuccess) {
isPrintProduction.value = false
resultInfo.value = data.filter((item) => !item.status) resultInfo.value = data.filter((item) => !item.status)
resultRefs.value?.showDialog() resultRefs.value?.showDialog()
} else { } else {
...@@ -2687,6 +2703,7 @@ const handleLogisticsCommand = async (command: string) => { ...@@ -2687,6 +2703,7 @@ const handleLogisticsCommand = async (command: string) => {
if (Array.isArray(res.data)) { if (Array.isArray(res.data)) {
const isSuccess = res.data.every((item) => item.status) const isSuccess = res.data.every((item) => item.status)
if (!isSuccess) { if (!isSuccess) {
isPrintProduction.value = false
resultInfo.value = res.data.filter((item) => !item.status) resultInfo.value = res.data.filter((item) => !item.status)
resultRefs.value?.showDialog() resultRefs.value?.showDialog()
...@@ -2774,6 +2791,7 @@ const handleTransferToArrange = async () => { ...@@ -2774,6 +2791,7 @@ const handleTransferToArrange = async () => {
(item: { status?: boolean }) => item.status, (item: { status?: boolean }) => item.status,
) )
if (!isSuccess) { if (!isSuccess) {
isPrintProduction.value = false
resultInfo.value = res.data.filter( resultInfo.value = res.data.filter(
(item: { status?: boolean }) => !item.status, (item: { status?: boolean }) => !item.status,
) )
...@@ -2927,10 +2945,7 @@ const handleSeedingWall = (type: 'print' | 'sort') => { ...@@ -2927,10 +2945,7 @@ const handleSeedingWall = (type: 'print' | 'sort') => {
/** LODOP 单例不可并发,打印串行 */ /** LODOP 单例不可并发,打印串行 */
let printOrderChain: Promise<void> = Promise.resolve() let printOrderChain: Promise<void> = Promise.resolve()
const printOrder = ( const printOrder = (data: OrderData, callback: (status: boolean) => void) => {
data: OrderData,
callback: (status: boolean) => void,
) => {
const run = async () => { const run = async () => {
const lodop = getCLodop(null, null) const lodop = getCLodop(null, null)
if (!lodop) { if (!lodop) {
...@@ -3212,8 +3227,20 @@ const handlePrintProductionOrder = async () => { ...@@ -3212,8 +3227,20 @@ const handlePrintProductionOrder = async () => {
}) })
try { try {
const res = await printNewPodOrderProductionOrderApi(ids as number[]) const res = await printNewPodOrderProductionOrderApi(ids as number[])
if (res.message) { if (res?.code !== 200) return
window.open(filePath + res.message, '_blank') if (res?.data?.status === false) {
isPrintProduction.value = true
resultInfo.value =
res.data.batchReturnVOList?.map((item: BatchReturnVOItem) => ({
id: item.id,
status: item.status,
factoryOrderNumber: item.number,
message: item.message,
})) || []
resultRefs.value?.showDialog()
} else {
ElMessage.success('操作成功')
window.open(filePath + res?.data?.message)
} }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
...@@ -3433,6 +3460,7 @@ const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => { ...@@ -3433,6 +3460,7 @@ const handleFastProductionSuccess = (data: ResultInfoDataItem[]) => {
const createLogisticsSuccess = (data: ResultInfoDataItem[]) => { const createLogisticsSuccess = (data: ResultInfoDataItem[]) => {
const isSuccess = data.every((item) => item.status) const isSuccess = data.every((item) => item.status)
if (!isSuccess) { if (!isSuccess) {
isPrintProduction.value = false
resultInfo.value = data.filter((item) => !item.status) resultInfo.value = data.filter((item) => !item.status)
resultRefs.value?.showDialog() resultRefs.value?.showDialog()
} else { } else {
......
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