parent
0ff490499e
commit
696069e212
|
|
@ -324,6 +324,7 @@ export const MesWmReturnVendorStatusEnum = {
|
||||||
/** MES 销售退货单状态枚举 */
|
/** MES 销售退货单状态枚举 */
|
||||||
export const MesWmReturnSalesStatusEnum = {
|
export const MesWmReturnSalesStatusEnum = {
|
||||||
PREPARE: MesOrderStatusConstants.DRAFT,
|
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||||
|
CONFIRMED: MesOrderStatusConstants.CONFIRMED,
|
||||||
APPROVING: MesOrderStatusConstants.APPROVING,
|
APPROVING: MesOrderStatusConstants.APPROVING,
|
||||||
APPROVED: MesOrderStatusConstants.APPROVED,
|
APPROVED: MesOrderStatusConstants.APPROVED,
|
||||||
FINISHED: MesOrderStatusConstants.FINISHED,
|
FINISHED: MesOrderStatusConstants.FINISHED,
|
||||||
|
|
@ -423,6 +424,7 @@ export const MesAutoCodeRuleCode = {
|
||||||
WM_RETURN_VENDOR_CODE: 'WM_RETURN_VENDOR_CODE', // 采购退货单编码
|
WM_RETURN_VENDOR_CODE: 'WM_RETURN_VENDOR_CODE', // 采购退货单编码
|
||||||
WM_PRODUCT_ISSUE_CODE: 'WM_PRODUCT_ISSUE_CODE', // 生产领料出库单编码
|
WM_PRODUCT_ISSUE_CODE: 'WM_PRODUCT_ISSUE_CODE', // 生产领料出库单编码
|
||||||
WM_RETURN_ISSUE_CODE: 'WM_RETURN_ISSUE_CODE', // 生产退料单编码
|
WM_RETURN_ISSUE_CODE: 'WM_RETURN_ISSUE_CODE', // 生产退料单编码
|
||||||
|
WM_RETURN_SALES_CODE: 'WM_RETURN_SALES_CODE', // 销售退货单编码
|
||||||
PRODUCTRECPT_CODE: 'PRODUCTRECPT_CODE', // 产品入库单编码
|
PRODUCTRECPT_CODE: 'PRODUCTRECPT_CODE', // 产品入库单编码
|
||||||
WM_SALES_NOTICE_CODE: 'WM_SALES_NOTICE_CODE', // 发货通知单编码
|
WM_SALES_NOTICE_CODE: 'WM_SALES_NOTICE_CODE', // 发货通知单编码
|
||||||
WM_SN_CODE: 'WM_SN_CODE', // SN 码
|
WM_SN_CODE: 'WM_SN_CODE', // SN 码
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@
|
||||||
<el-form-item label="退货日期" prop="returnDate">
|
<el-form-item label="退货日期" prop="returnDate">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formData.returnDate"
|
v-model="formData.returnDate"
|
||||||
type="datetime"
|
type="date"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="x"
|
||||||
placeholder="选择退货日期"
|
placeholder="选择退货日期"
|
||||||
:disabled="isHeaderReadonly"
|
:disabled="isHeaderReadonly"
|
||||||
class="!w-full"
|
class="!w-full"
|
||||||
|
|
@ -92,50 +92,41 @@
|
||||||
<ReturnSalesLineList :return-id="formData.id" :form-type="formType" />
|
<ReturnSalesLineList :return-id="formData.id" :form-type="formType" />
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button v-if="isUpdate" @click="submitForm" type="primary" :disabled="formLoading">
|
<el-button v-if="isEditable" @click="submitForm" type="primary" :disabled="formLoading">
|
||||||
确 定
|
保 存
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="isEditable && formData.status === MesWmReturnSalesStatusEnum.PREPARE"
|
||||||
|
@click="handleSubmit"
|
||||||
|
type="warning"
|
||||||
|
:disabled="formLoading"
|
||||||
|
>
|
||||||
|
提 交
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="isStock" @click="handleStock" type="primary" :disabled="formLoading">
|
<el-button v-if="isStock" @click="handleStock" type="primary" :disabled="formLoading">
|
||||||
执行上架
|
执行上架
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button @click="dialogVisible = false">关 闭</el-button>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { generateRandomStr } from '@/utils'
|
|
||||||
import { WmReturnSalesApi, WmReturnSalesVO } from '@/api/mes/wm/returnsales'
|
import { WmReturnSalesApi, WmReturnSalesVO } from '@/api/mes/wm/returnsales'
|
||||||
|
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
|
||||||
|
import { MesAutoCodeRuleCode, MesWmReturnSalesStatusEnum } from '@/views/mes/utils/constants'
|
||||||
import MdClientSelect from '@/views/mes/md/client/components/MdClientSelect.vue'
|
import MdClientSelect from '@/views/mes/md/client/components/MdClientSelect.vue'
|
||||||
import ReturnSalesLineList from './ReturnSalesLineList.vue'
|
import ReturnSalesLineList from './ReturnSalesLineList.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'ReturnSalesForm' })
|
defineOptions({ name: 'ReturnSalesForm' })
|
||||||
|
const emit = defineEmits(['success'])
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const formLoading = ref(false) // 表单的加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formType = ref<string>('create') // 表单的类型:create / update / stock / detail
|
const formType = ref<string>('create') // 表单的类型:create / update / stock / detail
|
||||||
const formData = ref({
|
const isEditable = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
||||||
id: undefined as number | undefined,
|
|
||||||
code: undefined,
|
|
||||||
name: undefined,
|
|
||||||
salesOrderCode: undefined,
|
|
||||||
clientId: undefined,
|
|
||||||
returnDate: undefined,
|
|
||||||
returnReason: undefined,
|
|
||||||
remark: undefined
|
|
||||||
})
|
|
||||||
const formRules = reactive({
|
|
||||||
code: [{ required: true, message: '退货单编号不能为空', trigger: 'blur' }],
|
|
||||||
name: [{ required: true, message: '退货单名称不能为空', trigger: 'blur' }],
|
|
||||||
clientId: [{ required: true, message: '客户不能为空', trigger: 'change' }],
|
|
||||||
returnDate: [{ required: true, message: '退货日期不能为空', trigger: 'change' }],
|
|
||||||
returnReason: [{ required: true, message: '退货原因不能为空', trigger: 'blur' }]
|
|
||||||
})
|
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
|
||||||
const isUpdate = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
|
||||||
const isStock = computed(() => formType.value === 'stock') // 是否为上架模式
|
const isStock = computed(() => formType.value === 'stock') // 是否为上架模式
|
||||||
const isHeaderReadonly = computed(() => ['stock', 'detail'].includes(formType.value)) // 是否只读
|
const isHeaderReadonly = computed(() => ['stock', 'detail'].includes(formType.value)) // 是否只读
|
||||||
const dialogTitle = computed(() => {
|
const dialogTitle = computed(() => {
|
||||||
|
|
@ -147,10 +138,32 @@ const dialogTitle = computed(() => {
|
||||||
}
|
}
|
||||||
return titles[formType.value] || formType.value
|
return titles[formType.value] || formType.value
|
||||||
})
|
})
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined as number | undefined,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
salesOrderCode: undefined,
|
||||||
|
clientId: undefined,
|
||||||
|
returnDate: undefined,
|
||||||
|
returnReason: undefined,
|
||||||
|
status: undefined as number | undefined,
|
||||||
|
remark: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
code: [{ required: true, message: '退货单编号不能为空', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '退货单名称不能为空', trigger: 'blur' }],
|
||||||
|
clientId: [{ required: true, message: '客户不能为空', trigger: 'change' }],
|
||||||
|
returnDate: [{ required: true, message: '退货日期不能为空', trigger: 'change' }],
|
||||||
|
returnReason: [{ required: true, message: '退货原因不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const originalFormData = ref<string>('') // 原始表单数据快照,用于脏检查
|
||||||
|
|
||||||
/** 生成退货单编号 */
|
/** 生成退货单编号 */
|
||||||
const generateCode = () => {
|
const generateCode = async () => {
|
||||||
formData.value.code = 'RS' + generateRandomStr(10)
|
formData.value.code = await AutoCodeRecordApi.generateAutoCode(
|
||||||
|
MesAutoCodeRuleCode.WM_RETURN_SALES_CODE
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
|
|
@ -167,11 +180,12 @@ const open = async (type: string, id?: number) => {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 保存原始数据快照
|
||||||
|
originalFormData.value = JSON.stringify(formData.value)
|
||||||
}
|
}
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
|
||||||
/** 提交表单(create/update 模式) */
|
/** 保存表单(create/update 模式的保存按钮) */
|
||||||
const emit = defineEmits(['success'])
|
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
// 校验表单
|
// 校验表单
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
|
|
@ -182,12 +196,16 @@ const submitForm = async () => {
|
||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
const res = await WmReturnSalesApi.createReturnSales(data)
|
const res = await WmReturnSalesApi.createReturnSales(data)
|
||||||
message.success('新增成功')
|
message.success('新增成功')
|
||||||
|
// 创建成功后,更新表单数据和状态为编辑模式
|
||||||
formData.value.id = res
|
formData.value.id = res
|
||||||
|
formData.value.status = MesWmReturnSalesStatusEnum.PREPARE
|
||||||
formType.value = 'update'
|
formType.value = 'update'
|
||||||
} else {
|
} else {
|
||||||
await WmReturnSalesApi.updateReturnSales(data)
|
await WmReturnSalesApi.updateReturnSales(data)
|
||||||
message.success('修改成功')
|
message.success('修改成功')
|
||||||
}
|
}
|
||||||
|
// 更新快照
|
||||||
|
originalFormData.value = JSON.stringify(formData.value)
|
||||||
// 发送操作成功的事件
|
// 发送操作成功的事件
|
||||||
emit('success')
|
emit('success')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -195,6 +213,29 @@ const submitForm = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 提交操作:表单修改过则先保存,再提交 */
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
// 校验表单
|
||||||
|
await formRef.value.validate()
|
||||||
|
try {
|
||||||
|
await message.confirm('确认提交该销售退货单?【提交后将不能修改】')
|
||||||
|
formLoading.value = true
|
||||||
|
// 1. 表单有修改时,先保存
|
||||||
|
if (JSON.stringify(formData.value) !== originalFormData.value) {
|
||||||
|
const data = formData.value as unknown as WmReturnSalesVO
|
||||||
|
await WmReturnSalesApi.updateReturnSales(data)
|
||||||
|
}
|
||||||
|
// 2. 提交退货单
|
||||||
|
await WmReturnSalesApi.submitReturnSales(formData.value.id!)
|
||||||
|
message.success('提交成功')
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('success')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 执行上架 */
|
/** 执行上架 */
|
||||||
const handleStock = async () => {
|
const handleStock = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -220,6 +261,7 @@ const resetForm = () => {
|
||||||
clientId: undefined,
|
clientId: undefined,
|
||||||
returnDate: undefined,
|
returnDate: undefined,
|
||||||
returnReason: undefined,
|
returnReason: undefined,
|
||||||
|
status: undefined,
|
||||||
remark: undefined
|
remark: undefined
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@
|
||||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.rqcCheckFlag" />
|
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.rqcCheckFlag" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="质量状态" align="center" prop="qualityStatus" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.MES_WM_QUALITY_STATUS" :value="scope.row.qualityStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-if="isUpdate || isStock"
|
v-if="isUpdate || isStock"
|
||||||
label="操作"
|
label="操作"
|
||||||
|
|
@ -98,8 +103,13 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="批次编码" prop="batchCode">
|
<el-form-item label="批次" prop="batchId">
|
||||||
<el-input v-model="formData.batchCode" placeholder="请输入批次编码" />
|
<WmBatchSelect
|
||||||
|
v-model="formData.batchId"
|
||||||
|
:item-id="formData.itemId"
|
||||||
|
placeholder="请选择批次"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -134,6 +144,7 @@
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
import { WmReturnSalesLineApi, WmReturnSalesLineVO } from '@/api/mes/wm/returnsales/line'
|
import { WmReturnSalesLineApi, WmReturnSalesLineVO } from '@/api/mes/wm/returnsales/line'
|
||||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||||
|
import WmBatchSelect from '@/views/mes/wm/batch/components/WmBatchSelect.vue'
|
||||||
import ReturnSalesDetailList from './ReturnSalesDetailList.vue'
|
import ReturnSalesDetailList from './ReturnSalesDetailList.vue'
|
||||||
import ReturnSalesDetailForm from './ReturnSalesDetailForm.vue'
|
import ReturnSalesDetailForm from './ReturnSalesDetailForm.vue'
|
||||||
|
|
||||||
|
|
@ -193,7 +204,7 @@ const formData = ref({
|
||||||
returnId: undefined as number | undefined,
|
returnId: undefined as number | undefined,
|
||||||
itemId: undefined,
|
itemId: undefined,
|
||||||
quantity: undefined,
|
quantity: undefined,
|
||||||
batchCode: undefined,
|
batchId: undefined as number | undefined,
|
||||||
rqcCheckFlag: true,
|
rqcCheckFlag: true,
|
||||||
remark: undefined
|
remark: undefined
|
||||||
})
|
})
|
||||||
|
|
@ -250,7 +261,7 @@ const resetForm = () => {
|
||||||
returnId: undefined,
|
returnId: undefined,
|
||||||
itemId: undefined,
|
itemId: undefined,
|
||||||
quantity: undefined,
|
quantity: undefined,
|
||||||
batchCode: undefined,
|
batchId: undefined,
|
||||||
rqcCheckFlag: false,
|
rqcCheckFlag: false,
|
||||||
remark: undefined
|
remark: undefined
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="240" fixed="right">
|
<el-table-column label="操作" align="center" width="240" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<!-- 草稿:编辑、删除 -->
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -99,15 +100,6 @@
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="warning"
|
|
||||||
@click="handleSubmit(scope.row.id)"
|
|
||||||
v-hasPermi="['mes:wm-return-sales:submit']"
|
|
||||||
v-if="scope.row.status === MesWmReturnSalesStatusEnum.PREPARE"
|
|
||||||
>
|
|
||||||
提交
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="danger"
|
type="danger"
|
||||||
|
|
@ -117,6 +109,15 @@
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- 待检验:执行质检(提示去质检模块操作) -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="warning"
|
||||||
|
v-if="scope.row.status === MesWmReturnSalesStatusEnum.CONFIRMED"
|
||||||
|
@click="message.alert('请前往【质量管理 - 退货检验(RQC)】中进行退货检验操作')"
|
||||||
|
>
|
||||||
|
执行质检
|
||||||
|
</el-button>
|
||||||
<!-- 待执行:执行退货 -->
|
<!-- 待执行:执行退货 -->
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
|
|
@ -137,16 +138,18 @@
|
||||||
>
|
>
|
||||||
执行上架
|
执行上架
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- 待执行、待上架:取消 -->
|
<!-- 待检验、待执行、待上架:取消 -->
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleCancel(scope.row.id)"
|
@click="handleCancel(scope.row.id)"
|
||||||
v-hasPermi="['mes:wm-return-sales:cancel']"
|
v-hasPermi="['mes:wm-return-sales:cancel']"
|
||||||
v-if="
|
v-if="
|
||||||
[MesWmReturnSalesStatusEnum.APPROVING, MesWmReturnSalesStatusEnum.APPROVED].includes(
|
[
|
||||||
scope.row.status
|
MesWmReturnSalesStatusEnum.CONFIRMED,
|
||||||
)
|
MesWmReturnSalesStatusEnum.APPROVING,
|
||||||
|
MesWmReturnSalesStatusEnum.APPROVED
|
||||||
|
].includes(scope.row.status)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
取消
|
取消
|
||||||
|
|
@ -223,16 +226,6 @@ const openForm = (type: string, id?: number) => {
|
||||||
formRef.value.open(type, id)
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提交按钮操作 */
|
|
||||||
const handleSubmit = async (id: number) => {
|
|
||||||
try {
|
|
||||||
await message.confirm('确认提交该销售退货单?')
|
|
||||||
await WmReturnSalesApi.submitReturnSales(id)
|
|
||||||
message.success('提交成功')
|
|
||||||
await getList()
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 执行退货 */
|
/** 执行退货 */
|
||||||
const handleFinish = async (id: number) => {
|
const handleFinish = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue