Commit 02402c38 by wusiyi

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

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