Commit ed638dda by qinjianhui

fix: 问题修改

parent 0a232b26
......@@ -47,6 +47,14 @@ export function confirmOrderApi(data: number[]) {
data,
)
}
export function updateExceptionOrderApi(data: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/updateExceptionOrders',
{
orderIds: data,
},
)
}
export function changeExceptionOrderApi(ids: number[], value: string) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/exceptionOrders',
......
......@@ -466,7 +466,7 @@ const changeStatus = async () => {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
setData(TrackingNumber.value)
setData(detail.value.factorySubOrderNumber || '')
})
}
const setData = async (orderNumber: string) => {
......
......@@ -5,6 +5,7 @@
top="140px"
:fullscreen="true"
:close-on-click-modal="false"
@opened="onOpened"
@close="emit('close')"
>
<div class="detail-div">
......@@ -50,9 +51,9 @@
:placeholder="placeholderText"
style="width: 660px; margin-right: 10px"
clearable
@keydown.enter="trackcodeInput()"
@keydown.enter="trackCodeInput()"
></el-input>
<el-button type="primary" @click="trackcodeInput()">
<el-button type="primary" @click="trackCodeInput()">
查询
</el-button>
</div>
......@@ -194,14 +195,12 @@ import {
import { cardImages, PodOrderRes } from '@/types/api/podUsOrder'
import { showConfirm } from '@/utils/ui'
import { filePath } from '@/api/axios'
import { ref, watch, defineProps, nextTick, defineEmits } from 'vue'
import { ref, watch, defineProps, defineEmits } from 'vue'
interface HistoryDataItem {
orderNumber: string
finished: boolean
}
const trackingNumberRef = ref(null)
// const shipForm = ref({ shipmentType: '1' })
// const logistics = ref([])
const trackingNumberRef = ref()
const historyData = ref<HistoryDataItem[]>([])
const placeholderText = ref('')
const sendNum = ref(0)
......@@ -230,7 +229,6 @@ const audios = {
import.meta.url,
).href,
}
const productInfo = ref({})
const TrackingNumber = ref('')
const props = defineProps({
title: {
......@@ -261,20 +259,14 @@ watch(
if (len.length > 0) {
confirmQuery(len, 0)
}
TrackingNumber.value = ''
isAutoSure.value = false
placeholderText.value =
'扫描枪输入生产单号,录入下一单本单自动生产完成,最后一单扫两次完成生产'
sendNum.value = 0
trackingNumberRef.value && trackingNumberRef.value.focus()
nextTick(() => {
if (trackingNumberRef.value) {
;(trackingNumberRef.value as HTMLInputElement).focus()
}
})
TrackingNumber.value = ''
isAutoSure.value = false
sendNum.value = 0
}
},
)
......@@ -288,7 +280,7 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => {
})
.then(async () => {
TrackingNumber.value = el.orderNumber
await trackcodeInput()
await trackCodeInput()
await setData(el.orderNumber)
ElMessage.success('生产完成')
if (len[i + 1]) {
......@@ -306,6 +298,7 @@ const confirmQuery = (len: HistoryDataItem[], i: number) => {
if (len[i + 1]) {
confirmQuery(len, i + 1)
}
trackingNumberRef.value && trackingNumberRef.value.focus()
})
}
......@@ -318,45 +311,46 @@ const changeStatus = async () => {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
setData(TrackingNumber.value)
setData(detail.value.factorySubOrderNumber || '')
})
}
const setData = async (orderNumber: string) => {
if (detail.value && detail.value?.id != -1) {
try {
const id = detail.value.id
const podJomallOrderUsId = detail.value.podJomallOrderUsId
await productionQueryApi(id, podJomallOrderUsId)
if (orderNumber) {
const index = historyData.value.findIndex(
(el: HistoryDataItem) => el.orderNumber === orderNumber,
)
if (index >= 0) {
// 扫单完成删除
historyData.value.splice(index, 1)
localStorage.setItem(
'historyUsData',
JSON.stringify(historyData.value),
)
}
}
emit('onSuccess')
playAudio('weight_success')
detail.value = {
id: -1,
podJomallOrderUsId: -1,
imgList: [] as cardImages[],
}
} catch (e) {
console.error(e)
detail.value = {
id: -1,
podJomallOrderUsId: -1,
imgList: [] as cardImages[],
if (!detail.value || detail.value?.id === -1) return
try {
const id = detail.value.id
const podJomallOrderUsId = detail.value.podJomallOrderUsId
await productionQueryApi(id, podJomallOrderUsId)
if (orderNumber) {
const index = historyData.value.findIndex(
(el: HistoryDataItem) => el.orderNumber === orderNumber,
)
if (index >= 0) {
// 扫单完成删除
historyData.value.splice(index, 1)
localStorage.setItem('historyUsData', JSON.stringify(historyData.value))
}
playAudio('weight_search_error')
}
emit('onSuccess')
playAudio('weight_success')
detail.value = {
id: -1,
podJomallOrderUsId: -1,
imgList: [] as cardImages[],
}
TrackingNumber.value = ''
isAutoSure.value = false
isDownloadImage.value = false
trackingNumberRef.value && trackingNumberRef.value.focus()
} catch (e) {
console.error(e)
detail.value = {
id: -1,
podJomallOrderUsId: -1,
imgList: [] as cardImages[],
}
trackingNumberRef.value && trackingNumberRef.value.focus()
playAudio('weight_search_error')
}
}
......@@ -419,10 +413,11 @@ const playAudio = (key: AudioKey, message?: string) => {
}
}
const trackcodeInput = async () => {
const trackCodeInput = async () => {
if (!TrackingNumber.value) {
// ElMessage.warning('请扫描生产单号')
playAudio('weight_search_error')
trackingNumberRef.value && trackingNumberRef.value.focus()
return
}
const item = historyData.value.find(
......@@ -438,10 +433,11 @@ const trackcodeInput = async () => {
}
const orderNumber = TrackingNumber.value
TrackingNumber.value = ''
if (isAutoSure.value) {
await setData(orderNumber)
await setData(
historyData.value[historyData.value.length - 1].orderNumber || '',
)
}
try {
......@@ -467,37 +463,20 @@ const trackcodeInput = async () => {
download()
}
playAudio('weight_search_success')
nextTick(() => {
if (trackingNumberRef.value) {
;(trackingNumberRef.value as HTMLInputElement).focus()
}
})
trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = ''
} catch (e) {
console.error(e)
productInfo.value = {}
nextTick(() => {
if (trackingNumberRef.value) {
;(trackingNumberRef.value as HTMLInputElement).focus()
}
})
trackingNumberRef.value && trackingNumberRef.value.focus()
TrackingNumber.value = ''
}
}
const onOpened = () => {
trackingNumberRef.value && trackingNumberRef.value.focus()
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
box-sizing: border-box;
flex: 1;
flex-shrink: 0;
overflow: hidden;
}
::v-deep .el-dialog {
display: flex;
height: calc(100% - 50px);
margin-top: 50px;
flex-direction: column;
}
.sure-btn {
position: absolute;
right: 62px;
......@@ -569,10 +548,6 @@ const trackcodeInput = async () => {
.detail-content {
display: flex;
width: 100%;
flex: 1;
margin-bottom: 10px;
flex-shrink: 0;
justify-content: space-between;
}
.right {
......@@ -708,28 +683,24 @@ const trackcodeInput = async () => {
}
}
::v-deep .el-carousel__container {
height: 100%;
}
::v-deep .el-form-item__label {
font-weight: bold;
color: white;
}
::v-deep .el-dialog__title {
font-weight: bold;
font-size: 37px;
color: black;
position: relative;
left: 47%;
top: 13px;
.left-images {
:deep(.el-carousel__container) {
height: 100%;
}
:deep(.el-dialog__title) {
font-weight: bold;
font-size: 37px;
color: black;
position: relative;
left: 47%;
top: 13px;
}
}
.btn {
position: relative;
::v-deep .el-button {
:deep(.el-button) {
span {
position: relative;
left: -30px;
......@@ -737,18 +708,18 @@ const trackcodeInput = async () => {
}
.check {
::v-deep .el-checkbox__inner {
:deep(.el-checkbox__inner) {
background-color: transparent !important;
border-color: white !important;
width: 12px;
height: 12px;
}
::v-deep .el-checkbox__inner::after {
:deep(.el-checkbox__inner::after) {
left: 3px;
}
::v-deep .el-checkbox__label {
:deep(.el-checkbox__label) {
padding-left: 5px;
font-size: 12px;
color: white !important;
......
......@@ -88,12 +88,12 @@
</div>
<div class="order-content flex-1 flex-column overflow-hidden mt-10">
<div class="operation-box mb-10">
<span
v-if="status === 'EXCEPTION' || status === 'TO_BE_CONFIRMED'"
class="item"
>
<span v-if="status === 'TO_BE_CONFIRMED'" class="item">
<ElButton type="success" @click="confirmOrder"> 确认 </ElButton>
</span>
<span v-if="status === 'EXCEPTION'" class="item">
<ElButton type="success" @click="updateOrder"> 更新 </ElButton>
</span>
<span v-if="status === 'TO_BE_CONFIRMED'" class="item">
<ElButton type="warning" @click="changeExceptionOrder">
转为异常单
......@@ -511,6 +511,7 @@ import {
cancelOrderApi,
getOperationLogApi,
downloadMaterialApi,
updateExceptionOrderApi,
} from '@/api/podUsOrder'
import TableView from '@/components/TableView.vue'
import {
......@@ -698,6 +699,30 @@ const confirmOrder = async () => {
console.error(e)
}
}
const updateOrder = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await showConfirm('确定更新吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const ids = selection.value.map((item) => item.id)
try {
const res = await updateExceptionOrderApi(ids)
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
console.error(e)
}
}
const changeExceptionOrder = async () => {
if (selection.value.length === 0) {
......@@ -789,7 +814,9 @@ const onFastProduction = () => {
const downloadMaterial = async () => {
let selectedIds = []
if (status.value === 'IN_PRODUCTION') {
selectedIds = cardSelection.value.map((item: ProductList) => item.podJomallOrderUsId)
selectedIds = cardSelection.value.map(
(item: ProductList) => item.podJomallOrderUsId,
)
} else {
selectedIds = selection.value.map((item: PodUsOrderListData) => item.id)
}
......@@ -912,6 +939,7 @@ onMounted(() => {
.card-list {
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-template-rows: max-content;
gap: 10px;
height: 100%;
overflow-y: auto;
......
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