Commit f513c076 by wusiyi

Merge branch 'wusiyi/debug' into dev

parents 33359940 ed9f76cb
......@@ -401,9 +401,10 @@ export function applyForReplenishmentApi(
data: {
id: number
productId: number
factorySubOrderNumber: string
factorySubOrderNumber: string | number
replenishmentNum: string
podJomallOrderUsStatus: string
replenishmentReason: string
}[],
) {
return axios.post<never, BaseRespData<never>>(
......
......@@ -93,7 +93,7 @@
v-model="searchForm.factorySubOrderNumber"
placeholder="生产单号"
clearable
style="width: 150px"
style="width: 400px"
/>
</ElFormItem>
<ElFormItem label="店铺单号">
......@@ -1278,6 +1278,23 @@
>排版
</el-button>
</div>
<div
v-if="status === 'WAIT_SHIPMENT'"
style="
display: flex;
flex-direction: column;
align-items: start;
"
>
<el-button
link
size="small"
type="success"
style="height: 23px"
@click="printProductionOrder(item)"
>打印生产单
</el-button>
</div>
</div>
</div>
</div>
......@@ -1579,6 +1596,9 @@
>
下载
</ElButton>
<el-icon v-if="row.downloadStatus" class="check-icon"
><CircleCheckFilled
/></el-icon>
</span>
<!-- <span class="operate-item">
<ElButton
......@@ -1598,6 +1618,9 @@
>
打印拣货单
</ElButton>
<el-icon v-if="row.printPickOrder" class="check-icon"
><CircleCheckFilled
/></el-icon>
</span>
<span class="operate-item">
<ElButton
......@@ -1607,6 +1630,9 @@
>
打印生产单
</ElButton>
<el-icon v-if="row.printProductOrder" class="check-icon"
><CircleCheckFilled
/></el-icon>
</span>
<span class="operate-item">
<ElButton
......@@ -2481,9 +2507,9 @@
>
<el-form :model="typesettingForm">
<el-form-item
v-if="typesettingType == 2"
label="自动排版 (烫画工艺推荐自动排版)"
prop="bool"
v-if="typesettingType == 2"
>
<el-switch
v-model="isAuto"
......@@ -2523,6 +2549,45 @@
<el-button type="primary" @click="submitTypesetting">确认</el-button>
</template>
</ElDialog>
<!-- 补胚数量输入对话框 -->
<ElDialog
v-model="replenishmentDialogVisible"
title="申请补胚"
width="400px"
@close="resetReplenishmentForm"
>
<ElForm
ref="replenishmentFormRef"
:model="replenishmentForm"
:rules="replenishmentRules"
label-width="80px"
>
<ElFormItem label="补胚数量" prop="replenishmentNum">
<ElInputNumber
v-model="replenishmentForm.replenishmentNum"
placeholder="请输入补胚数量"
style="width: 100%"
:step="1"
:precision="0"
:min="1"
clearable
/>
</ElFormItem>
<ElFormItem label="补胚原因" prop="replenishmentReason">
<ElInput
v-model="replenishmentForm.replenishmentReason"
placeholder="请输入补胚原因"
style="width: 100%"
clearable
/>
</ElFormItem>
</ElForm>
<template #footer>
<ElButton @click="replenishmentDialogVisible = false">取消</ElButton>
<ElButton type="primary" @click="confirmReplenishment">确定</ElButton>
</template>
</ElDialog>
</template>
<script setup lang="ts">
import { getUserMarkList } from '@/api/common'
......@@ -2624,7 +2689,11 @@ import {
import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue'
import { showConfirm } from '@/utils/ui'
import { DocumentCopy, EditPen } from '@element-plus/icons-vue'
import {
DocumentCopy,
EditPen,
CircleCheckFilled,
} from '@element-plus/icons-vue'
import { Column, ElFormItem } from 'element-plus'
import { computed, onMounted, ref, nextTick, reactive } from 'vue'
import FastProduction from './FastProduction.vue'
......@@ -2785,6 +2854,23 @@ const interceptionStatus = ref<{
production: {},
})
// 补胚对话框相关数据
const replenishmentDialogVisible = ref(false)
const replenishmentFormRef = ref()
const currentReplenishmentRow = ref<ProductList | null>(null)
const replenishmentForm = ref({
replenishmentNum: '1',
replenishmentReason: '',
})
const replenishmentRules = {
replenishmentNum: [
{ required: true, message: '请输入补胚数量', trigger: 'blur' },
],
replenishmentReason: [
{ required: true, message: '请输入补胚原因', trigger: 'blur' },
],
}
const detailData = ref({})
const [searchForm, resetSearchForm] = useValue<SearchForm>({
timeType: 1,
......@@ -3408,6 +3494,34 @@ const {
} = usePageList({
initPageSize: initPageSize.value,
query: (page, pageSize) => {
// 批量查询生产单号
const factorySubOrderNumber = (() => {
const originalValue = searchForm.value?.factorySubOrderNumber || ''
if (!originalValue) return ''
// 用中英文逗号或中英文分号分割
const values = originalValue.split(/[,,;;]/).filter((v) => v.trim())
// 处理每个值
const processedValues = values.map((value) => {
const trimmedValue = value.trim()
const underscoreCount = (trimmedValue.match(/_/g) || []).length
if (underscoreCount >= 3) {
// 如果有3个或更多下划线,取第三个下划线后的值
const parts = trimmedValue.split('_')
return parts[3]
} else {
// 如果没有3个下划线,取原值
return trimmedValue
}
})
// 用英文逗号连接
return processedValues.join(',')
})()
// 批量下载
if (status.value === 'BATCH_DOWNLOAD') {
return batchDownloadApi(page, pageSize).then((res) => {
......@@ -3421,6 +3535,7 @@ const {
) {
const params = {
...searchForm.value,
factorySubOrderNumber,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
......@@ -3447,6 +3562,7 @@ const {
} else {
const params = {
...searchForm.value,
factorySubOrderNumber,
startTime:
timeRange.value && timeRange.value.length > 0
? timeRange.value[0]
......@@ -4011,11 +4127,11 @@ const assignOrder = async () => {
// loading.close()
// }
// }
const printProductionOrder = async () => {
if (cardSelection.value.length === 0) {
const printProductionOrder = async (item?: PodUsOrderListData) => {
if (status.value !== 'WAIT_SHIPMENT' && cardSelection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
const orderIds = cardSelection.value.map((item) => item.id)
const orderIds = item ? [item.id] : cardSelection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
......@@ -4080,6 +4196,8 @@ const printPickingOrderItem = async (
if (res?.code !== 200) return
ElMessage.success('操作成功')
window.open(filePath + res?.message)
search()
loadTabData()
} catch (e) {
console.error(e)
} finally {
......@@ -5331,62 +5449,84 @@ const handleWaitTrackCommand = (command: number) => {
loadTabData()
}
// 重置补胚表单
const resetReplenishmentForm = () => {
replenishmentForm.value.replenishmentNum = '1'
replenishmentForm.value.replenishmentReason = ''
currentReplenishmentRow.value = null
replenishmentFormRef.value?.clearValidate()
}
// 确认补胚申请
const confirmReplenishment = async () => {
if (!replenishmentFormRef.value) return
try {
await replenishmentFormRef.value.validate()
const row = currentReplenishmentRow.value
let data = []
if (!row) {
data = cardSelection.value.map((item) => {
return {
id: item.podJomallOrderUsId,
productId: item.id,
factorySubOrderNumber: item.factorySubOrderNumber || '',
replenishmentNum: replenishmentForm.value.replenishmentNum,
podJomallOrderUsStatus: status.value,
replenishmentReason: replenishmentForm.value.replenishmentReason,
}
})
} else {
data = [
{
id: row.podJomallOrderUsId,
productId: row.id,
factorySubOrderNumber: row.factorySubOrderNumber || '',
replenishmentNum: replenishmentForm.value.replenishmentNum,
podJomallOrderUsStatus: status.value,
replenishmentReason: replenishmentForm.value.replenishmentReason,
},
]
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const result = await applyForReplenishmentApi(data)
if (result.code !== 200) return
ElMessage.success('操作成功')
cardSelection.value = []
search()
loadTabData()
replenishmentDialogVisible.value = false
} catch (e) {
console.error(e)
} finally {
loading.close()
}
} catch (error) {
console.error('表单验证失败:', error)
}
}
// 打开补胚弹窗
const applyForReplenishment = async (row: ProductList | undefined) => {
if (!row) {
if (cardSelection.value.length === 0) {
return ElMessage.warning('请至少选择一条数据')
}
}
ElMessageBox.prompt('请输入补胚数量', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /.+/,
inputValue: row ? String(row.replenishmentSumNum || '') : '',
inputErrorMessage: '请输入补胚数量',
inputPlaceholder: '补胚数量',
}).then(async (res) => {
if (res.value) {
let data = []
if (!row) {
data = cardSelection.value.map((item) => {
return {
id: item.podJomallOrderUsId,
productId: item.id,
factorySubOrderNumber: item.factorySubOrderNumber || '',
replenishmentNum: res.value,
podJomallOrderUsStatus: status.value,
}
})
} else {
data = [
{
id: row.podJomallOrderUsId,
productId: row.id,
factorySubOrderNumber: row.factorySubOrderNumber || '',
replenishmentNum: res.value,
podJomallOrderUsStatus: status.value,
},
]
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const result = await applyForReplenishmentApi(data)
if (result.code !== 200) return
ElMessage.success('操作成功')
cardSelection.value = []
search()
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
})
currentReplenishmentRow.value = row || null
// 显示对话框
replenishmentDialogVisible.value = true
}
/**
......@@ -6088,4 +6228,15 @@ useRouter().beforeEach((to, from, next) => {
top: -10px;
right: 0px;
}
.operate-item {
position: relative;
}
.check-icon {
color: var(--el-color-success);
position: absolute;
right: -9px;
top: 30%;
transform: translateY(-50%);
}
</style>
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