Commit ebf6424e by wusiyi

fix: 删除快捷生产组件缓存提示功能 #1002069

Co-authored-by: Cursor <cursoragent@cursor.com>
parent e46e5441
...@@ -337,7 +337,6 @@ ...@@ -337,7 +337,6 @@
pending-order-label="操作单号" pending-order-label="操作单号"
please-scan-tip="请扫码操作单号" please-scan-tip="请扫码操作单号"
search-input-audio-tip="请录入操作单号" search-input-audio-tip="请录入操作单号"
:history-storage-key="fastHistoryStorageKey"
tracking-placeholder="扫描枪输入操作单号" tracking-placeholder="扫描枪输入操作单号"
:query-api="getOperationByNo" :query-api="getOperationByNo"
:complete-api="completeOperationById" :complete-api="completeOperationById"
...@@ -536,11 +535,6 @@ const handleViewDetail = async (item: operateOrderListData) => { ...@@ -536,11 +535,6 @@ const handleViewDetail = async (item: operateOrderListData) => {
const getOperationByNo = (operationNo: string) => const getOperationByNo = (operationNo: string) =>
getOperationInfoByNoApi(operationNo) as Promise<{ data?: unknown }> getOperationInfoByNoApi(operationNo) as Promise<{ data?: unknown }>
const fastInboundType = ref(0) const fastInboundType = ref(0)
const fastHistoryStorageKey = computed(() =>
fastInboundType.value === 1
? 'historyCancelOrderProcessProductionCompleteInStock'
: 'historyCancelOrderProcessEmbryoInStock',
)
const completeOperationById = (_: number[], detail: Record<string, unknown>) => const completeOperationById = (_: number[], detail: Record<string, unknown>) =>
completeDeliveryByCancelOrderProcessApi({ completeDeliveryByCancelOrderProcessApi({
operationNo: detail.operationNo as string, operationNo: detail.operationNo as string,
......
...@@ -424,10 +424,7 @@ import useLodop from '@/utils/hooks/useLodop' ...@@ -424,10 +424,7 @@ import useLodop from '@/utils/hooks/useLodop'
import { print } from '@/components/print' import { print } from '@/components/print'
import { DocumentCopy } from '@element-plus/icons-vue' import { DocumentCopy } from '@element-plus/icons-vue'
import QualityFailDialog from '@/views/order/factoryOrderNew/component/QualityFailDialog.vue' import QualityFailDialog from '@/views/order/factoryOrderNew/component/QualityFailDialog.vue'
interface HistoryDataItem {
orderNumber: string
finished: boolean
}
const title = computed(() => { const title = computed(() => {
switch (props.fastKey) { switch (props.fastKey) {
case 'fastProduction': case 'fastProduction':
...@@ -463,7 +460,6 @@ export type FastProductionDetail = PodOrderRes & { ...@@ -463,7 +460,6 @@ export type FastProductionDetail = PodOrderRes & {
status?: string | null status?: string | null
} }
const trackingNumberRef = ref() const trackingNumberRef = ref()
const historyData = ref<HistoryDataItem[]>([])
const placeholderText = ref('') const placeholderText = ref('')
const sendNum = ref(0) const sendNum = ref(0)
const isDownloadImage = ref(false) const isDownloadImage = ref(false)
...@@ -508,7 +504,6 @@ const props = withDefaults( ...@@ -508,7 +504,6 @@ const props = withDefaults(
detailVisible?: boolean detailVisible?: boolean
detailData?: Record<string, unknown> | null detailData?: Record<string, unknown> | null
fastKey?: string fastKey?: string
historyStorageKey?: string
trackingPlaceholder?: string trackingPlaceholder?: string
isNewOrder?: boolean isNewOrder?: boolean
queryApi?: (orderNumber: string) => Promise<{ data?: unknown }> queryApi?: (orderNumber: string) => Promise<{ data?: unknown }>
...@@ -539,7 +534,6 @@ const props = withDefaults( ...@@ -539,7 +534,6 @@ const props = withDefaults(
detailData: null, detailData: null,
fastKey: '', fastKey: '',
isNewOrder: false, isNewOrder: false,
historyStorageKey: 'historyCnData',
trackingPlaceholder: trackingPlaceholder:
'扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产', '扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产',
defaultAutoSure: true, defaultAutoSure: true,
...@@ -561,15 +555,6 @@ const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess']) ...@@ -561,15 +555,6 @@ const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess'])
const qualityFailDialogRef = ref<InstanceType<typeof QualityFailDialog>>() const qualityFailDialogRef = ref<InstanceType<typeof QualityFailDialog>>()
const historyKeyFromDetail = (d: FastProductionDetail): string => {
const raw = d as unknown as Record<string, unknown>
const op = raw.operationNo
if (op !== undefined && op !== null && String(op).trim() !== '') {
return String(op)
}
return String(d.factorySubOrderNumber ?? '')
}
const operationNoDisplay = computed(() => { const operationNoDisplay = computed(() => {
const raw = detail.value as unknown as Record<string, unknown> const raw = detail.value as unknown as Record<string, unknown>
const v = raw.operationNo const v = raw.operationNo
...@@ -647,18 +632,6 @@ watch( ...@@ -647,18 +632,6 @@ watch(
dialogVisible.value = newVal dialogVisible.value = newVal
detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] } detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] }
if (newVal) { if (newVal) {
const history = localStorage.getItem(props.historyStorageKey)
historyData.value = history ? JSON.parse(history) : []
// 防止消息提示数量不全
const historyList = [...historyData.value]
if (
historyList.length > 0 &&
['fastProduction', 'fastReceipt', 'productionScan'].includes(
props.fastKey,
)
) {
confirmQuery(historyList, 0)
}
placeholderText.value = props.trackingPlaceholder placeholderText.value = props.trackingPlaceholder
trackingNumberRef.value && trackingNumberRef.value.focus() trackingNumberRef.value && trackingNumberRef.value.focus()
...@@ -722,64 +695,6 @@ watch( ...@@ -722,64 +695,6 @@ watch(
}, },
{ deep: true }, { deep: true },
) )
const confirmQuery = (len: HistoryDataItem[], i: number) => {
const el = len[i]
const pendingText = (() => {
switch (props.fastKey) {
case 'fastProduction':
case 'productionScan':
return '未生产'
case 'qualityScan':
return '未质检'
default:
return '未入库'
}
})()
const successText = (() => {
switch (props.fastKey) {
case 'fastProduction':
case 'productionScan':
return '生产完成'
case 'qualityScan':
return '质检通过'
default:
return '入库完成'
}
})()
showConfirm(
`${props.pendingOrderLabel} ${el.orderNumber} ${pendingText}完成,取消则不提醒?`,
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
.then(async () => {
TrackingNumber.value = el.orderNumber
await trackCodeInput()
await setData(el.orderNumber)
ElMessage.success(successText)
if (len[i + 1]) {
confirmQuery(len, i + 1)
}
})
.catch(() => {
const index = historyData.value.findIndex(
(item: HistoryDataItem) => item.orderNumber === el.orderNumber,
)
if (index >= 0) {
historyData.value.splice(index, 1)
localStorage.setItem(
props.historyStorageKey,
JSON.stringify(historyData.value),
)
}
if (len[i + 1]) {
confirmQuery(len, i + 1)
}
trackingNumberRef.value && trackingNumberRef.value.focus()
})
}
const changeStatus = async () => { const changeStatus = async () => {
if (!detail.value || Object.keys(detail.value).length <= 1) { if (!detail.value || Object.keys(detail.value).length <= 1) {
...@@ -801,13 +716,10 @@ const changeStatus = async () => { ...@@ -801,13 +716,10 @@ const changeStatus = async () => {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}).then(() => { }).then(() => {
setData(historyKeyFromDetail(detail.value)) setData()
}) })
} }
const setData = async ( const setData = async (trigger: 'manual' | 'auto' = 'manual') => {
orderNumber: string,
trigger: 'manual' | 'auto' = 'manual',
) => {
if (!detail.value || detail.value?.id === -1) return if (!detail.value || detail.value?.id === -1) return
try { try {
const id = detail.value.id const id = detail.value.id
...@@ -835,19 +747,6 @@ const setData = async ( ...@@ -835,19 +747,6 @@ const setData = async (
> >
emit('onSuccess', res.data) emit('onSuccess', res.data)
} }
if (orderNumber) {
const index = historyData.value.findIndex(
(el: HistoryDataItem) => el.orderNumber === orderNumber,
)
if (index >= 0) {
// 扫单完成删除
historyData.value.splice(index, 1)
localStorage.setItem(
props.historyStorageKey,
JSON.stringify(historyData.value),
)
}
}
playAudio('weight_success') playAudio('weight_success')
// if (trigger === 'auto') { // if (trigger === 'auto') {
...@@ -880,9 +779,7 @@ const setData = async ( ...@@ -880,9 +779,7 @@ const setData = async (
type: 'warning', type: 'warning',
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
}, },
).then(() => { )
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
})
} }
detail.value = { detail.value = {
...@@ -922,19 +819,6 @@ const handleQuality = (passed: boolean) => { ...@@ -922,19 +819,6 @@ const handleQuality = (passed: boolean) => {
} }
const handleQualitySuccess = () => { const handleQualitySuccess = () => {
const orderNumber = historyKeyFromDetail(detail.value)
if (orderNumber) {
const index = historyData.value.findIndex(
(el: HistoryDataItem) => el.orderNumber === orderNumber,
)
if (index >= 0) {
historyData.value.splice(index, 1)
localStorage.setItem(
props.historyStorageKey,
JSON.stringify(historyData.value),
)
}
}
detail.value = emptyDetail() detail.value = emptyDetail()
TrackingNumber.value = '' TrackingNumber.value = ''
trackingNumberRef.value && trackingNumberRef.value.focus() trackingNumberRef.value && trackingNumberRef.value.focus()
...@@ -1008,7 +892,7 @@ const trackCodeInput = async () => { ...@@ -1008,7 +892,7 @@ const trackCodeInput = async () => {
const orderNumber = TrackingNumber.value const orderNumber = TrackingNumber.value
if (isAutoSure.value) { if (isAutoSure.value) {
await setData(historyKeyFromDetail(detail.value), 'manual') await setData('manual')
} }
try { try {
...@@ -1036,7 +920,6 @@ const trackCodeInput = async () => { ...@@ -1036,7 +920,6 @@ const trackCodeInput = async () => {
['custom_normal', 'normal'].includes(detail.value.productMark) ['custom_normal', 'normal'].includes(detail.value.productMark)
) { ) {
detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] } detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] }
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
trackingNumberRef.value && trackingNumberRef.value.focus() trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = '' TrackingNumber.value = ''
...@@ -1063,8 +946,6 @@ const trackCodeInput = async () => { ...@@ -1063,8 +946,6 @@ const trackCodeInput = async () => {
thirdSkuCode?: string thirdSkuCode?: string
}> }>
if (err?.code === 301) { if (err?.code === 301) {
historyData.value = []
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
detail.value = emptyDetail() detail.value = emptyDetail()
playAudio('weight_search_error', props.searchInputAudioTip) playAudio('weight_search_error', props.searchInputAudioTip)
trackingNumberRef.value && trackingNumberRef.value.focus() trackingNumberRef.value && trackingNumberRef.value.focus()
...@@ -1086,21 +967,6 @@ const trackCodeInput = async () => { ...@@ -1086,21 +967,6 @@ const trackCodeInput = async () => {
} }
} }
// 查询成功后再写入缓存
const item = historyData.value.find(
(el: HistoryDataItem) => el.orderNumber === orderNumber,
)
if (!item) {
historyData.value.push({
orderNumber,
finished: false,
})
localStorage.setItem(
props.historyStorageKey,
JSON.stringify(historyData.value),
)
}
if (isDownloadImage.value) { if (isDownloadImage.value) {
download() download()
} }
...@@ -1110,7 +976,7 @@ const trackCodeInput = async () => { ...@@ -1110,7 +976,7 @@ const trackCodeInput = async () => {
} }
if (props.fastKey === 'productionScan') { if (props.fastKey === 'productionScan') {
await setData(detail.value.id.toString(), 'auto') await setData('auto')
} }
if (props.fastKey === 'qualityScan') { if (props.fastKey === 'qualityScan') {
emit('onSuccess', [{ id: detail.value.id, status: true }]) emit('onSuccess', [{ id: detail.value.id, status: true }])
......
...@@ -1158,7 +1158,6 @@ ...@@ -1158,7 +1158,6 @@
pending-order-label="操作单号" pending-order-label="操作单号"
please-scan-tip="请扫码操作单号" please-scan-tip="请扫码操作单号"
search-input-audio-tip="请录入操作单号" search-input-audio-tip="请录入操作单号"
:history-storage-key="fastHistoryStorageKey"
tracking-placeholder="扫描枪输入操作单号" tracking-placeholder="扫描枪输入操作单号"
:query-api="getOperationByNo" :query-api="getOperationByNo"
:complete-api="completeOperationById" :complete-api="completeOperationById"
...@@ -2661,11 +2660,7 @@ const updateCustomsDialogVisible = ref(false) ...@@ -2661,11 +2660,7 @@ const updateCustomsDialogVisible = ref(false)
const weightDialogRef = ref() const weightDialogRef = ref()
const detailVisible = ref(false) const detailVisible = ref(false)
const fastKey = ref('') const fastKey = ref('')
const fastHistoryStorageKey = computed(() =>
fastKey.value === 'qualityScan'
? 'historyFactoryOrderNewQualityData'
: 'historyFactoryOrderNewData',
)
const detailData = ref<Record<string, unknown>>({}) const detailData = ref<Record<string, unknown>>({})
const { ensureSelection, executeBatchAction } = useOrderBatchActions({ const { ensureSelection, executeBatchAction } = useOrderBatchActions({
getIds: getSelectedIds, getIds: getSelectedIds,
......
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