✨ feat(mes): 添加生产退料单及明细相关功能
parent
0b29aaadaf
commit
333c8a1154
|
|
@ -0,0 +1,155 @@
|
||||||
|
<!-- MES 生产退料上架明细表单弹窗 -->
|
||||||
|
<template>
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="110px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="物料" prop="itemId">
|
||||||
|
<MdItemSelect v-model="formData.itemId" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="入库仓库" prop="warehouseId">
|
||||||
|
<WmWarehouseSelect v-model="formData.warehouseId" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="库区" prop="locationId" v-if="formData.warehouseId">
|
||||||
|
<WmWarehouseLocationSelect
|
||||||
|
v-model="formData.locationId"
|
||||||
|
:warehouse-id="formData.warehouseId"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="库位" prop="areaId" v-if="formData.locationId">
|
||||||
|
<WmWarehouseAreaSelect v-model="formData.areaId" :location-id="formData.locationId" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="批次号" prop="batchCode">
|
||||||
|
<el-input v-model="formData.batchCode" placeholder="请输入批次号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数量" prop="quantity">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.quantity"
|
||||||
|
:precision="2"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
WmReturnIssueDetailApi,
|
||||||
|
WmReturnIssueDetailVO
|
||||||
|
} from '@/api/mes/wm/returnissue/detail'
|
||||||
|
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||||
|
import WmWarehouseSelect from '@/views/mes/wm/warehouse/components/WmWarehouseSelect.vue'
|
||||||
|
import WmWarehouseLocationSelect from '@/views/mes/wm/warehouse/components/WmWarehouseLocationSelect.vue'
|
||||||
|
import WmWarehouseAreaSelect from '@/views/mes/wm/warehouse/components/WmWarehouseAreaSelect.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ReturnIssueDetailForm' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
issueId: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['success'])
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const formType = ref('') // 表单的类型:create / update
|
||||||
|
const currentLineId = ref<number>() // 当前操作的行 ID
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined as number | undefined,
|
||||||
|
lineId: undefined as number | undefined,
|
||||||
|
issueId: undefined as number | undefined,
|
||||||
|
itemId: undefined as number | undefined,
|
||||||
|
quantity: undefined as number | undefined,
|
||||||
|
batchCode: undefined as string | undefined,
|
||||||
|
warehouseId: undefined as number | undefined,
|
||||||
|
locationId: undefined as number | undefined,
|
||||||
|
areaId: undefined as number | undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||||
|
warehouseId: [{ required: true, message: '入库仓库不能为空', trigger: 'change' }],
|
||||||
|
locationId: [{ required: true, message: '库区不能为空', trigger: 'change' }],
|
||||||
|
areaId: [{ required: true, message: '库位不能为空', trigger: 'change' }],
|
||||||
|
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, lineId: number, itemId?: number, detailId?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = type === 'create' ? '添加上架明细' : '编辑上架明细'
|
||||||
|
formType.value = type
|
||||||
|
currentLineId.value = lineId
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (detailId) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await WmReturnIssueDetailApi.getReturnIssueDetail(detailId)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
} else if (itemId) {
|
||||||
|
formData.value.itemId = itemId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
await formRef.value.validate()
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = {
|
||||||
|
...formData.value,
|
||||||
|
issueId: props.issueId,
|
||||||
|
lineId: currentLineId.value
|
||||||
|
} as unknown as WmReturnIssueDetailVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await WmReturnIssueDetailApi.createReturnIssueDetail(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await WmReturnIssueDetailApi.updateReturnIssueDetail(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success', currentLineId.value)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
lineId: undefined,
|
||||||
|
issueId: undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
quantity: undefined,
|
||||||
|
batchCode: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
locationId: undefined,
|
||||||
|
areaId: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
<!-- MES 生产退料上架明细列表(展开行内嵌子组件) -->
|
||||||
|
<template>
|
||||||
|
<div class="pl-60px pr-20px py-10px">
|
||||||
|
<el-table v-loading="loading" :data="list" border size="small">
|
||||||
|
<el-table-column label="批次号" align="center" prop="batchCode" min-width="120" />
|
||||||
|
<el-table-column label="仓库名称" align="center" prop="warehouseName" min-width="100" />
|
||||||
|
<el-table-column label="库区名称" align="center" prop="locationName" min-width="100" />
|
||||||
|
<el-table-column label="库位名称" align="center" prop="areaName" min-width="100" />
|
||||||
|
<el-table-column label="数量" align="center" prop="quantity" width="100" />
|
||||||
|
<el-table-column
|
||||||
|
v-if="props.formType === 'stock'"
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="120"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" @click="emit('edit-detail', scope.row.id)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
WmReturnIssueDetailApi,
|
||||||
|
WmReturnIssueDetailVO
|
||||||
|
} from '@/api/mes/wm/returnissue/detail'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ReturnIssueDetailList' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
issueId: number
|
||||||
|
lineId: number
|
||||||
|
itemId: number
|
||||||
|
formType: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['edit-detail'])
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const loading = ref(false) // 列表的加载中
|
||||||
|
const list = ref<WmReturnIssueDetailVO[]>([]) // 明细列表
|
||||||
|
|
||||||
|
/** 查询明细列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
list.value = await WmReturnIssueDetailApi.getReturnIssueDetailListByLineId(props.lineId)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ getList })
|
||||||
|
|
||||||
|
/** 删除上架明细 */
|
||||||
|
const handleDelete = async (detailId: number) => {
|
||||||
|
try {
|
||||||
|
await message.delConfirm()
|
||||||
|
await WmReturnIssueDetailApi.deleteReturnIssueDetail(detailId)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化:延迟加载,展开时才触发 */
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,231 @@
|
||||||
|
<template>
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="110px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="退料单编号" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.code"
|
||||||
|
placeholder="请输入退料单编号"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="generateCode" :disabled="formType !== 'create'">
|
||||||
|
生成
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- TODO @AI:必填;前后端都是;name -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="退料单名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.name"
|
||||||
|
placeholder="请输入退料单名称"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- TODO @AI:必填;前后端都是;returnType -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="退料类型" prop="returnType">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.returnType"
|
||||||
|
placeholder="请选择退料类型"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
class="!w-full"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.MES_WM_RETURN_ISSUE_TYPE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="退料日期" prop="returnDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formData.returnDate"
|
||||||
|
type="datetime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
placeholder="选择退料日期"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
class="!w-full"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- TODO @AI:必填;前后端都是;workOrderId -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="生产工单" prop="workOrderId">
|
||||||
|
<ProWorkOrderSelect v-model="formData.workOrderId" :disabled="isHeaderReadonly" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- TODO @芋艿:貌似前端不用选择;关注下; -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="工作站" prop="workstationId">
|
||||||
|
<MdWorkstationSelect v-model="formData.workstationId" :disabled="isHeaderReadonly" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.remark"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<!-- 非新建模式展示行项目信息(退料物料) -->
|
||||||
|
<template v-if="formData.id">
|
||||||
|
<el-divider content-position="center">物料信息</el-divider>
|
||||||
|
<ReturnIssueLineList :issue-id="formData.id" :form-type="formType" />
|
||||||
|
</template>
|
||||||
|
<template #footer>
|
||||||
|
<el-button v-if="isUpdate" @click="submitForm" type="primary" :disabled="formLoading">
|
||||||
|
确 定
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="isStock" @click="handleStock" type="primary" :disabled="formLoading">
|
||||||
|
入库上架
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
||||||
|
import { generateRandomStr } from '@/utils'
|
||||||
|
import { WmReturnIssueApi, WmReturnIssueVO } from '@/api/mes/wm/returnissue'
|
||||||
|
import ProWorkOrderSelect from '@/views/mes/pro/workorder/components/ProWorkOrderSelect.vue'
|
||||||
|
import MdWorkstationSelect from '@/views/mes/md/workstation/components/MdWorkstationSelect.vue'
|
||||||
|
import ReturnIssueLineList from './ReturnIssueLineList.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ReturnIssueForm' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const formType = ref<string>('create') // 表单的类型:create / update / stock / detail
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined as number | undefined,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
workOrderId: undefined,
|
||||||
|
workstationId: undefined,
|
||||||
|
returnType: undefined,
|
||||||
|
returnDate: undefined,
|
||||||
|
remark: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
code: [{ required: true, message: '退料单编号不能为空', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '退料单名称不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
const isUpdate = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
||||||
|
const isStock = computed(() => formType.value === 'stock') // 是否为入库上架模式
|
||||||
|
const isHeaderReadonly = computed(() => ['stock', 'detail'].includes(formType.value)) // 是否只读
|
||||||
|
const dialogTitle = computed(() => {
|
||||||
|
const titles = {
|
||||||
|
create: '新增生产退料单',
|
||||||
|
update: '编辑生产退料单',
|
||||||
|
stock: '入库上架',
|
||||||
|
detail: '生产退料单详情'
|
||||||
|
}
|
||||||
|
return titles[formType.value] || formType.value
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 生成退料单编号 */
|
||||||
|
const generateCode = () => {
|
||||||
|
formData.value.code = 'RI' + generateRandomStr(10)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改/入库上架/详情时,加载数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await WmReturnIssueApi.getReturnIssue(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
/** 提交表单(create/update 模式) */
|
||||||
|
const emit = defineEmits(['success'])
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
await formRef.value.validate()
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as WmReturnIssueVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
const res = await WmReturnIssueApi.createReturnIssue(data)
|
||||||
|
message.success('新增成功')
|
||||||
|
formData.value.id = res
|
||||||
|
formType.value = 'update'
|
||||||
|
} else {
|
||||||
|
await WmReturnIssueApi.updateReturnIssue(data)
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 入库上架 */
|
||||||
|
const handleStock = async () => {
|
||||||
|
try {
|
||||||
|
formLoading.value = true
|
||||||
|
// 校验退料数量与明细数量是否一致
|
||||||
|
const quantityMatch = await WmReturnIssueApi.checkReturnIssueQuantity(formData.value.id!)
|
||||||
|
if (!quantityMatch) {
|
||||||
|
await message.confirm('退料数量与明细数量不一致,确认执行入库上架?')
|
||||||
|
}
|
||||||
|
await WmReturnIssueApi.stockReturnIssue(formData.value.id!)
|
||||||
|
message.success('入库上架成功')
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('success')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
workOrderId: undefined,
|
||||||
|
workstationId: undefined,
|
||||||
|
returnType: undefined,
|
||||||
|
returnDate: undefined,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,290 @@
|
||||||
|
<!-- MES 生产退料单行列表子组件 -->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-button v-if="isUpdate" type="primary" plain @click="openForm('create')" class="mb-10px">
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 添加物料
|
||||||
|
</el-button>
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
:stripe="true"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
border
|
||||||
|
:row-key="(row: any) => row.id"
|
||||||
|
>
|
||||||
|
<el-table-column type="expand">
|
||||||
|
<template #default="scope">
|
||||||
|
<ReturnIssueDetailList
|
||||||
|
:ref="(el: any) => setDetailListRef(scope.row.id, el)"
|
||||||
|
:issue-id="props.issueId"
|
||||||
|
:line-id="scope.row.id"
|
||||||
|
:item-id="scope.row.itemId"
|
||||||
|
:form-type="props.formType"
|
||||||
|
@edit-detail="
|
||||||
|
(detailId: number) =>
|
||||||
|
openDetailForm('update', scope.row.id, scope.row.itemId, detailId)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="物料编码" align="center" prop="itemCode" min-width="120" />
|
||||||
|
<el-table-column label="物料名称" align="center" prop="itemName" min-width="140" />
|
||||||
|
<el-table-column label="规格型号" align="center" prop="specification" min-width="120" />
|
||||||
|
<el-table-column label="单位" align="center" prop="unitMeasureName" width="80" />
|
||||||
|
<el-table-column label="退料数量" align="center" prop="quantity" width="100" />
|
||||||
|
<!-- TODO @AI:批次号;增加下; -->
|
||||||
|
<!-- TODO @AI:是否检测,增加下; -->
|
||||||
|
<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
|
||||||
|
v-if="isUpdate || isStock"
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="160"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button v-if="isUpdate" link type="primary" @click="openForm('update', scope.row.id)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="isUpdate" link type="danger" @click="handleDelete(scope.row.id)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<el-button v-if="isStock" link type="success" @click="handlePicking(scope.row.id)">
|
||||||
|
上架
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加/编辑行弹窗 -->
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="110px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="产品物料" prop="itemId">
|
||||||
|
<MdItemSelect
|
||||||
|
v-model="formData.itemId"
|
||||||
|
placeholder="请选择产品物料"
|
||||||
|
class="!w-1/1"
|
||||||
|
@change="handleItemChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="退料数量" prop="quantity">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.quantity"
|
||||||
|
:precision="2"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="需要质检" prop="qcFlag">
|
||||||
|
<el-switch v-model="formData.qcFlag" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<!-- 上架明细添加/编辑弹窗 -->
|
||||||
|
<ReturnIssueDetailForm
|
||||||
|
ref="detailFormRef"
|
||||||
|
:issue-id="props.issueId"
|
||||||
|
@success="onDetailFormSuccess"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
|
import { WmReturnIssueLineApi, WmReturnIssueLineVO } from '@/api/mes/wm/returnissue/line'
|
||||||
|
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||||
|
import ReturnIssueDetailList from './ReturnIssueDetailList.vue'
|
||||||
|
import ReturnIssueDetailForm from './ReturnIssueDetailForm.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ReturnIssueLineList' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
issueId: number
|
||||||
|
formType: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const isUpdate = computed(() => ['create', 'update'].includes(props.formType)) // 是否为编辑模式
|
||||||
|
const isStock = computed(() => props.formType === 'stock') // 是否为入库上架模式
|
||||||
|
|
||||||
|
// ==================== 列表 ====================
|
||||||
|
const loading = ref(false) // 列表的加载中
|
||||||
|
const list = ref<WmReturnIssueLineVO[]>([]) // 行列表
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
issueId: undefined as number | undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 查询行列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
queryParams.issueId = props.issueId
|
||||||
|
const data = await WmReturnIssueLineApi.getReturnIssueLinePage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.delConfirm()
|
||||||
|
await WmReturnIssueLineApi.deleteReturnIssueLine(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 添加/编辑表单 ====================
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const lineFormType = ref('') // 行表单的类型
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
issueId: undefined as number | undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
quantity: undefined,
|
||||||
|
qcFlag: false,
|
||||||
|
remark: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||||
|
quantity: [{ required: true, message: '退料数量不能为空', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 物料变化时,自动填充信息 */
|
||||||
|
const handleItemChange = (item: any) => {
|
||||||
|
if (item) {
|
||||||
|
formData.value.itemId = item.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开表单弹窗 */
|
||||||
|
const openForm = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = type === 'create' ? '添加生产退料单行' : '修改生产退料单行'
|
||||||
|
lineFormType.value = type
|
||||||
|
resetForm()
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await WmReturnIssueLineApi.getReturnIssueLine(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const submitForm = async () => {
|
||||||
|
await formRef.value.validate()
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = { ...formData.value, issueId: props.issueId } as unknown as WmReturnIssueLineVO
|
||||||
|
if (lineFormType.value === 'create') {
|
||||||
|
await WmReturnIssueLineApi.createReturnIssueLine(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await WmReturnIssueLineApi.updateReturnIssueLine(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
await getList()
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
issueId: undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
quantity: undefined,
|
||||||
|
qcFlag: false, // TODO @AI:前端需要有填写的地方么?
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 展开行:上架明细 ====================
|
||||||
|
const detailListRefs = ref<Record<number, InstanceType<typeof ReturnIssueDetailList>>>({})
|
||||||
|
|
||||||
|
/** 缓存子组件 ref */
|
||||||
|
const setDetailListRef = (lineId: number, el: any) => {
|
||||||
|
if (el) {
|
||||||
|
detailListRefs.value[lineId] = el
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 上架明细表单(LineList 层级持有) ====================
|
||||||
|
const detailFormRef = ref()
|
||||||
|
|
||||||
|
/** 上架:直接打开明细创建表单 */
|
||||||
|
const handlePicking = (lineId: number) => {
|
||||||
|
const row = list.value.find((r) => r.id === lineId)
|
||||||
|
openDetailForm('create', lineId, row?.itemId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开上架明细表单 */
|
||||||
|
const openDetailForm = (type: string, lineId: number, itemId?: number, detailId?: number) => {
|
||||||
|
detailFormRef.value.open(type, lineId, itemId, detailId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 明细表单提交成功后,刷新已展开行的 DetailList */
|
||||||
|
const onDetailFormSuccess = (lineId: number) => {
|
||||||
|
detailListRefs.value[lineId]?.getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(async () => {
|
||||||
|
await getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,319 @@
|
||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="退料单编号" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.code"
|
||||||
|
placeholder="请输入退料单编号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="退料单名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入退料单名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- TODO @AI:增加 生产工单 的 select -->
|
||||||
|
<!-- TODO @AI:需要生成下,字典插入 sql -->
|
||||||
|
<el-form-item label="退料类型" prop="returnType">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.returnType"
|
||||||
|
placeholder="请选择退料类型"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.MES_WM_RETURN_ISSUE_TYPE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="退料日期" prop="returnDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.returnDate"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单据状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.status"
|
||||||
|
placeholder="请选择单据状态"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_RETURN_ISSUE_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="openForm('create')"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:create']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||||
|
<el-table-column label="退料单编号" align="center" prop="code" min-width="160">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
|
||||||
|
{{ scope.row.code }}
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="退料单名称" align="center" prop="name" min-width="150" />
|
||||||
|
<el-table-column label="生产工单" align="center" prop="workOrderCode" min-width="140" />
|
||||||
|
<el-table-column label="工作站" align="center" prop="workstationName" min-width="120" />
|
||||||
|
<el-table-column label="退料类型" align="center" prop="returnType" min-width="110">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.MES_WM_RETURN_ISSUE_TYPE" :value="scope.row.returnType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="退料日期"
|
||||||
|
align="center"
|
||||||
|
prop="returnDate"
|
||||||
|
:formatter="dateFormatter2"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
|
<el-table-column label="单据状态" align="center" prop="status" min-width="110">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.MES_WM_RETURN_ISSUE_STATUS" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="240" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<!-- 草稿:编辑、提交、删除 -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:update']"
|
||||||
|
v-if="scope.row.status === MesWmReturnIssueStatusEnum.PREPARE"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="warning"
|
||||||
|
@click="handleSubmit(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:update']"
|
||||||
|
v-if="scope.row.status === MesWmReturnIssueStatusEnum.PREPARE"
|
||||||
|
>
|
||||||
|
提交
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:delete']"
|
||||||
|
v-if="scope.row.status === MesWmReturnIssueStatusEnum.PREPARE"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<!-- TODO @芋艿:UNEXECUTE、UNSTOCK; -->
|
||||||
|
<!-- 待入库:入库上架 -->
|
||||||
|
<!-- TODO @AI:名字改成:“执行上架” -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="success"
|
||||||
|
@click="openForm('stock', scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:update']"
|
||||||
|
v-if="scope.row.status === MesWmReturnIssueStatusEnum.APPROVING"
|
||||||
|
>
|
||||||
|
入库上架
|
||||||
|
</el-button>
|
||||||
|
<!-- 已入库:完成 -->
|
||||||
|
<!-- TODO @AI:名字换成:“执行退料” -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="success"
|
||||||
|
@click="handleFinish(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:execute']"
|
||||||
|
v-if="scope.row.status === MesWmReturnIssueStatusEnum.APPROVED"
|
||||||
|
>
|
||||||
|
完成
|
||||||
|
</el-button>
|
||||||
|
<!-- 待入库、已入库:取消 -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleCancel(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-return-issue:update']"
|
||||||
|
v-if="
|
||||||
|
[MesWmReturnIssueStatusEnum.APPROVING, MesWmReturnIssueStatusEnum.APPROVED].includes(
|
||||||
|
scope.row.status
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<ReturnIssueForm ref="formRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
|
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
import { WmReturnIssueApi, WmReturnIssueVO } from '@/api/mes/wm/returnissue'
|
||||||
|
import ReturnIssueForm from './ReturnIssueForm.vue'
|
||||||
|
import { MesWmReturnIssueStatusEnum } from '@/views/mes/utils/constants'
|
||||||
|
|
||||||
|
defineOptions({ name: 'MesWmReturnIssue' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref<WmReturnIssueVO[]>([]) // 列表的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
returnType: undefined,
|
||||||
|
status: undefined,
|
||||||
|
returnDate: undefined
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const formRef = ref() // 表单弹窗
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await WmReturnIssueApi.getReturnIssuePage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const openForm = (type: string, id?: number) => {
|
||||||
|
formRef.value.open(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮操作 */
|
||||||
|
const handleSubmit = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.confirm('确认提交该退料单吗?')
|
||||||
|
await WmReturnIssueApi.submitReturnIssue(id)
|
||||||
|
message.success('提交成功')
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.delConfirm()
|
||||||
|
await WmReturnIssueApi.deleteReturnIssue(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消按钮操作 */
|
||||||
|
const handleCancel = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.confirm('确认取消该生产退料单?取消后不可恢复。')
|
||||||
|
await WmReturnIssueApi.cancelReturnIssue(id)
|
||||||
|
message.success('取消成功')
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 完成按钮操作 */
|
||||||
|
const handleFinish = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.confirm('确认完成该退料单并执行入库吗?')
|
||||||
|
await WmReturnIssueApi.finishReturnIssue(id)
|
||||||
|
message.success('完成成功')
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
await message.exportConfirm()
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await WmReturnIssueApi.exportReturnIssue(queryParams)
|
||||||
|
download.excel(data, '生产退料单.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue