Commit ebf6424e by wusiyi

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

Co-authored-by: Cursor <cursoragent@cursor.com>
parent e46e5441
......@@ -337,7 +337,6 @@
pending-order-label="操作单号"
please-scan-tip="请扫码操作单号"
search-input-audio-tip="请录入操作单号"
:history-storage-key="fastHistoryStorageKey"
tracking-placeholder="扫描枪输入操作单号"
:query-api="getOperationByNo"
:complete-api="completeOperationById"
......@@ -536,11 +535,6 @@ const handleViewDetail = async (item: operateOrderListData) => {
const getOperationByNo = (operationNo: string) =>
getOperationInfoByNoApi(operationNo) as Promise<{ data?: unknown }>
const fastInboundType = ref(0)
const fastHistoryStorageKey = computed(() =>
fastInboundType.value === 1
? 'historyCancelOrderProcessProductionCompleteInStock'
: 'historyCancelOrderProcessEmbryoInStock',
)
const completeOperationById = (_: number[], detail: Record<string, unknown>) =>
completeDeliveryByCancelOrderProcessApi({
operationNo: detail.operationNo as string,
......
......@@ -424,10 +424,7 @@ import useLodop from '@/utils/hooks/useLodop'
import { print } from '@/components/print'
import { DocumentCopy } from '@element-plus/icons-vue'
import QualityFailDialog from '@/views/order/factoryOrderNew/component/QualityFailDialog.vue'
interface HistoryDataItem {
orderNumber: string
finished: boolean
}
const title = computed(() => {
switch (props.fastKey) {
case 'fastProduction':
......@@ -463,7 +460,6 @@ export type FastProductionDetail = PodOrderRes & {
status?: string | null
}
const trackingNumberRef = ref()
const historyData = ref<HistoryDataItem[]>([])
const placeholderText = ref('')
const sendNum = ref(0)
const isDownloadImage = ref(false)
......@@ -508,7 +504,6 @@ const props = withDefaults(
detailVisible?: boolean
detailData?: Record<string, unknown> | null
fastKey?: string
historyStorageKey?: string
trackingPlaceholder?: string
isNewOrder?: boolean
queryApi?: (orderNumber: string) => Promise<{ data?: unknown }>
......@@ -539,7 +534,6 @@ const props = withDefaults(
detailData: null,
fastKey: '',
isNewOrder: false,
historyStorageKey: 'historyCnData',
trackingPlaceholder:
'扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产',
defaultAutoSure: true,
......@@ -561,15 +555,6 @@ const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess'])
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 raw = detail.value as unknown as Record<string, unknown>
const v = raw.operationNo
......@@ -647,18 +632,6 @@ watch(
dialogVisible.value = newVal
detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] }
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
trackingNumberRef.value && trackingNumberRef.value.focus()
......@@ -722,64 +695,6 @@ watch(
},
{ 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 () => {
if (!detail.value || Object.keys(detail.value).length <= 1) {
......@@ -801,13 +716,10 @@ const changeStatus = async () => {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
setData(historyKeyFromDetail(detail.value))
setData()
})
}
const setData = async (
orderNumber: string,
trigger: 'manual' | 'auto' = 'manual',
) => {
const setData = async (trigger: 'manual' | 'auto' = 'manual') => {
if (!detail.value || detail.value?.id === -1) return
try {
const id = detail.value.id
......@@ -835,19 +747,6 @@ const setData = async (
>
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')
// if (trigger === 'auto') {
......@@ -880,9 +779,7 @@ const setData = async (
type: 'warning',
dangerouslyUseHTMLString: true,
},
).then(() => {
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
})
)
}
detail.value = {
......@@ -922,19 +819,6 @@ const handleQuality = (passed: boolean) => {
}
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()
TrackingNumber.value = ''
trackingNumberRef.value && trackingNumberRef.value.focus()
......@@ -1008,7 +892,7 @@ const trackCodeInput = async () => {
const orderNumber = TrackingNumber.value
if (isAutoSure.value) {
await setData(historyKeyFromDetail(detail.value), 'manual')
await setData('manual')
}
try {
......@@ -1036,7 +920,6 @@ const trackCodeInput = async () => {
['custom_normal', 'normal'].includes(detail.value.productMark)
) {
detail.value = { id: -1, podJomallOrderCnId: -1, imgList: [] }
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = ''
......@@ -1063,8 +946,6 @@ const trackCodeInput = async () => {
thirdSkuCode?: string
}>
if (err?.code === 301) {
historyData.value = []
localStorage.setItem(props.historyStorageKey, JSON.stringify([]))
detail.value = emptyDetail()
playAudio('weight_search_error', props.searchInputAudioTip)
trackingNumberRef.value && trackingNumberRef.value.focus()
......@@ -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) {
download()
}
......@@ -1110,7 +976,7 @@ const trackCodeInput = async () => {
}
if (props.fastKey === 'productionScan') {
await setData(detail.value.id.toString(), 'auto')
await setData('auto')
}
if (props.fastKey === 'qualityScan') {
emit('onSuccess', [{ id: detail.value.id, status: true }])
......
......@@ -1158,7 +1158,6 @@
pending-order-label="操作单号"
please-scan-tip="请扫码操作单号"
search-input-audio-tip="请录入操作单号"
:history-storage-key="fastHistoryStorageKey"
tracking-placeholder="扫描枪输入操作单号"
:query-api="getOperationByNo"
:complete-api="completeOperationById"
......@@ -2661,11 +2660,7 @@ const updateCustomsDialogVisible = ref(false)
const weightDialogRef = ref()
const detailVisible = ref(false)
const fastKey = ref('')
const fastHistoryStorageKey = computed(() =>
fastKey.value === 'qualityScan'
? 'historyFactoryOrderNewQualityData'
: 'historyFactoryOrderNewData',
)
const detailData = ref<Record<string, unknown>>({})
const { ensureSelection, executeBatchAction } = useOrderBatchActions({
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