Commit 02402c38 by wusiyi

feat: 打印操作单报错提示优化 #1012634

parent 9bf605b9
......@@ -3,6 +3,7 @@ import type { BasePaginationData, BaseRespData } from '@/types/api'
import type {
BatchManageData,
FactoryOrderNewListData,
PrintProductionPdfResult,
LogListData,
operateOrderListData,
OrderInventoryData,
......@@ -439,7 +440,7 @@ export function printPickPdfByBatchNumberApi(params: {
export function printProductionPdfByBatchNumberApi(params: {
batchArrangeNumber: string
}) {
return axios.get<never, BaseRespData<never>>(
return axios.get<never, BaseRespData<PrintProductionPdfResult>>(
`factory/podOrderOperation/printProductionPdfByBatchNumber`,
{
params,
......
......@@ -211,6 +211,20 @@ export interface BatchManageData {
type?: string
}
export interface BatchReturnVOItem {
id: number
status: boolean
number?: string
message?: string
}
export interface PrintProductionPdfResult {
id: number
status: boolean
number?: string
message?: string
batchReturnVOList: BatchReturnVOItem[] | null
}
export interface RestockData {
id: number
factoryId: number
......
<template>
<el-dialog
title="处理结果"
v-model="resultDialog"
title="处理结果"
width="60%"
:close-on-click-modal="false"
@closed="closedFn"
>
<div style="display: flex">
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAll"
:indeterminate="isIndeterminate"
style="margin-right: 20px"
@change="checkAllChange"
>
{{ '全选' }}
</el-checkbox>
<el-button
v-if="config.isShowButtons"
type="success"
style="margin-left: 20px"
@click="resultfilter(true)"
>
{{ '选择正常' }}
</el-button>
<el-button type="danger" @click="resultfilter(false)">
<el-button
v-if="config.isShowButtons"
type="danger"
@click="resultfilter(false)"
>
{{ '选择异常' }}
</el-button>
<el-button type="success" @click="copyAllCode()">
<el-button v-if="isCopyResult" type="success" @click="copyAllCode()">
{{ '复制结果' }}
</el-button>
<el-button v-if="isCopyNumber" type="success" @click="copyNumberCode()">
{{ '复制' + config.numberTitle }}
</el-button>
</div>
<div style="height: 50vh; overflow: auto">
<div style="margin: 15px 0"></div>
<el-checkbox-group v-model="selectedList" @change="checkChange">
<div v-for="(item, index) in list" :key="index" style="display: block">
<el-checkbox :value="item" style="user-select: text;">
{{ '工厂订单号:' + item.factoryOrderNumber + ' ' + item.message }}
<el-checkbox :value="item" style="user-select: text">
{{
`${config.numberTitle}:` +
item[config.factoryOrderNumber] +
' ' +
item.message
}}
</el-checkbox>
</div>
</el-checkbox-group>
......@@ -53,14 +66,28 @@
import { ref, watch } from 'vue'
import { copyText } from '@/utils/index'
import { ResultInfoDataItem } from '@/types/api/order/common';
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
}
}>(),
{
list: () => [],
isCopyResult: true,
isCopyNumber: false,
config: () => ({
factoryOrderNumber: 'factoryOrderNumber',
numberTitle: '工厂订单号',
isShowButtons: true,
}),
},
)
// 响应式数据
......@@ -114,7 +141,7 @@ const formatCopyText = (item: ResultInfoDataItem) => {
}
return (
'工厂订单号:' +
item.factoryOrderNumber +
item[props.config.factoryOrderNumber] +
',' +
'处理结果:' +
item.message
......@@ -131,6 +158,17 @@ const copyAllCode = () => {
copyText(str)
}
// 复制单号
const copyNumberCode = () => {
if (!selectedList.value.length) {
return ElMessage.warning('请先选择数据')
}
const str = selectedList.value
.map((item) => item[props.config.factoryOrderNumber])
.join(',')
copyText(str)
}
function closedFn() {
if (key === 'stockOut') return
emits('confirm', selectedList.value)
......
......@@ -92,7 +92,9 @@
<ElButton type="primary" @click="refresh">查询</ElButton>
</span>
<span class="item">
<ElButton type="danger" @click="() => handleBatchDelete()">批量删除</ElButton>
<ElButton type="danger" @click="() => handleBatchDelete()">
批量删除
</ElButton>
</span>
</div>
......@@ -183,6 +185,17 @@
@current-change="onCurrentPageChange"
/>
</div>
<ResultInfo
ref="resultInfoRef"
:list="resultInfoList"
:is-copy-result="false"
:is-copy-number="true"
:config="{
factoryOrderNumber: 'factoryOrderNumber',
numberTitle: '操作单号',
isShowButtons: false,
}"
/>
</div>
</template>
......@@ -196,7 +209,10 @@ import {
printPickPdfByBatchNumberApi,
printProductionPdfByBatchNumberApi,
} from '@/api/factoryOrderNew'
import type { BatchManageData } from '@/types/api/factoryOrderNew'
import type {
BatchManageData,
BatchReturnVOItem,
} from '@/types/api/factoryOrderNew'
import type { PaginationData } from '@/types/api'
import TableView from '@/components/TableView.vue'
import ArrangeDialog from './ArrangeDialog.vue'
......@@ -205,10 +221,14 @@ import type { userData } from '@/types/api/user'
import usePageList from '@/utils/hooks/usePageList'
import { filePath } from '@/api/axios'
import { batchDownloadDesignImagesApi } from '@/api/factoryOrderNew'
import ResultInfo from '@/views/order/components/ResultInfo.vue'
import type { ResultInfoDataItem } from '@/types/api/order/common'
const selectedRows = ref<BatchManageData[]>([])
const employeeList = ref<userData[]>([])
const arrangeDialogRef = ref<InstanceType<typeof ArrangeDialog>>()
const resultInfoRef = ref<InstanceType<typeof ResultInfo>>()
const resultInfoList = ref<ResultInfoDataItem[]>([])
interface ProcessTypeData {
label: string
value: string
......@@ -551,8 +571,19 @@ const handlePrintProduction = async (row: BatchManageData) => {
})
if (res?.code !== 200) return
if (res?.data?.status === false) {
resultInfoList.value =
res.data.batchReturnVOList?.map((item: BatchReturnVOItem) => ({
id: item.id,
status: item.status,
factoryOrderNumber: item.number,
message: item.message,
})) || []
resultInfoRef.value?.showDialog()
} else {
ElMessage.success('操作成功')
window.open(filePath + res?.message)
window.open(filePath + res?.data?.message)
}
} catch (e) {
console.error(e)
} finally {
......
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