Commit d6c927e4 by wusiyi

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

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