✨ feat(mes): 添加杂项出库单及行相关功能
新增杂项出库单及行的请求和响应对象,更新相关的接口和枚举,支持杂项出库单的创建、修改、删除和查询功能。优化了相关的业务逻辑和数据结构,以提升系统的可维护性和扩展性。pull/871/MERGE
parent
32ad593fae
commit
efa794d2ab
|
|
@ -0,0 +1,61 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// MES 杂项出库明细 VO
|
||||||
|
export interface WmMiscIssueDetailVO {
|
||||||
|
id: number
|
||||||
|
lineId: number
|
||||||
|
issueId: number
|
||||||
|
materialStockId: number
|
||||||
|
itemId: number
|
||||||
|
itemCode: string
|
||||||
|
itemName: string
|
||||||
|
specification: string
|
||||||
|
unitMeasure: string
|
||||||
|
unitMeasureName: string
|
||||||
|
quantity: number
|
||||||
|
batchId: number
|
||||||
|
batchCode: string
|
||||||
|
warehouseId: number
|
||||||
|
warehouseCode: string
|
||||||
|
warehouseName: string
|
||||||
|
locationId: number
|
||||||
|
locationCode: string
|
||||||
|
locationName: string
|
||||||
|
areaId: number
|
||||||
|
areaCode: string
|
||||||
|
areaName: string
|
||||||
|
remark: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// MES 杂项出库明细 API
|
||||||
|
export const WmMiscIssueDetailApi = {
|
||||||
|
// 查询杂项出库明细分页
|
||||||
|
getMiscIssueDetailPage: async (params: any) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue-detail/page', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 根据行ID查询杂项出库明细列表
|
||||||
|
getMiscIssueDetailListByLineId: async (lineId: number) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue-detail/list-by-line-id?lineId=' + lineId })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询杂项出库明细详情
|
||||||
|
getMiscIssueDetail: async (id: number) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue-detail/get?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增杂项出库明细
|
||||||
|
createMiscIssueDetail: async (data: WmMiscIssueDetailVO) => {
|
||||||
|
return await request.post({ url: '/mes/wm/misc-issue-detail/create', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改杂项出库明细
|
||||||
|
updateMiscIssueDetail: async (data: WmMiscIssueDetailVO) => {
|
||||||
|
return await request.put({ url: '/mes/wm/misc-issue-detail/update', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除杂项出库明细
|
||||||
|
deleteMiscIssueDetail: async (id: number) => {
|
||||||
|
return await request.delete({ url: '/mes/wm/misc-issue-detail/delete?id=' + id })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// MES 杂项出库单 VO
|
||||||
|
export interface WmMiscIssueVO {
|
||||||
|
id: number
|
||||||
|
code: string
|
||||||
|
name: string
|
||||||
|
type: string
|
||||||
|
sourceDocId: number
|
||||||
|
sourceDocCode: string
|
||||||
|
sourceDocType: string
|
||||||
|
issueDate: string
|
||||||
|
status: number
|
||||||
|
remark: string
|
||||||
|
createTime: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// MES 杂项出库单 API
|
||||||
|
export const WmMiscIssueApi = {
|
||||||
|
// 查询杂项出库单分页
|
||||||
|
getMiscIssuePage: async (params: any) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue/page', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询杂项出库单详情
|
||||||
|
getMiscIssue: async (id: number) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue/get?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增杂项出库单
|
||||||
|
createMiscIssue: async (data: WmMiscIssueVO) => {
|
||||||
|
return await request.post({ url: '/mes/wm/misc-issue/create', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改杂项出库单
|
||||||
|
updateMiscIssue: async (data: WmMiscIssueVO) => {
|
||||||
|
return await request.put({ url: '/mes/wm/misc-issue/update', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除杂项出库单
|
||||||
|
deleteMiscIssue: async (id: number) => {
|
||||||
|
return await request.delete({ url: '/mes/wm/misc-issue/delete?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 提交杂项出库单
|
||||||
|
submitMiscIssue: async (id: number) => {
|
||||||
|
return await request.put({ url: '/mes/wm/misc-issue/submit?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 执行出库
|
||||||
|
finishMiscIssue: async (id: number) => {
|
||||||
|
return await request.put({ url: '/mes/wm/misc-issue/finish?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 取消杂项出库单
|
||||||
|
cancelMiscIssue: async (id: number) => {
|
||||||
|
return await request.put({ url: '/mes/wm/misc-issue/cancel?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出杂项出库单 Excel
|
||||||
|
exportMiscIssue: async (params: any) => {
|
||||||
|
return await request.download({ url: '/mes/wm/misc-issue/export-excel', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 校验杂项出库单数量
|
||||||
|
checkMiscIssueQuantity: async (id: number) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue/check-quantity?id=' + id })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// MES 杂项出库单行 VO
|
||||||
|
export interface WmMiscIssueLineVO {
|
||||||
|
id: number
|
||||||
|
issueId: number
|
||||||
|
sourceDocLineId: number
|
||||||
|
materialStockId: number
|
||||||
|
itemId: number
|
||||||
|
itemCode: string
|
||||||
|
itemName: string
|
||||||
|
specification: string
|
||||||
|
unitMeasure: string
|
||||||
|
unitMeasureName: string
|
||||||
|
quantity: number
|
||||||
|
batchId: number
|
||||||
|
batchCode: string
|
||||||
|
warehouseId: number
|
||||||
|
warehouseCode: string
|
||||||
|
warehouseName: string
|
||||||
|
locationId: number
|
||||||
|
locationCode: string
|
||||||
|
locationName: string
|
||||||
|
areaId: number
|
||||||
|
areaCode: string
|
||||||
|
areaName: string
|
||||||
|
remark: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// MES 杂项出库单行 API
|
||||||
|
export const WmMiscIssueLineApi = {
|
||||||
|
// 查询杂项出库单行分页
|
||||||
|
getMiscIssueLinePage: async (params: any) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue-line/page', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 根据出库单ID查询杂项出库单行列表
|
||||||
|
getMiscIssueLineListByIssueId: async (issueId: number) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue-line/list-by-issue-id?issueId=' + issueId })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询杂项出库单行详情
|
||||||
|
getMiscIssueLine: async (id: number) => {
|
||||||
|
return await request.get({ url: '/mes/wm/misc-issue-line/get?id=' + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增杂项出库单行
|
||||||
|
createMiscIssueLine: async (data: WmMiscIssueLineVO) => {
|
||||||
|
return await request.post({ url: '/mes/wm/misc-issue-line/create', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改杂项出库单行
|
||||||
|
updateMiscIssueLine: async (data: WmMiscIssueLineVO) => {
|
||||||
|
return await request.put({ url: '/mes/wm/misc-issue-line/update', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除杂项出库单行
|
||||||
|
deleteMiscIssueLine: async (id: number) => {
|
||||||
|
return await request.delete({ url: '/mes/wm/misc-issue-line/delete?id=' + id })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -294,6 +294,7 @@ export enum DICT_TYPE {
|
||||||
MES_RQC_TYPE = 'mes_rqc_type', // MES 退货检验类型
|
MES_RQC_TYPE = 'mes_rqc_type', // MES 退货检验类型
|
||||||
MES_WM_ARRIVAL_NOTICE_STATUS = 'mes_wm_arrival_notice_status', // MES 到货通知单状态
|
MES_WM_ARRIVAL_NOTICE_STATUS = 'mes_wm_arrival_notice_status', // MES 到货通知单状态
|
||||||
MES_WM_ITEM_RECEIPT_STATUS = 'mes_wm_item_receipt_status', // MES 物料接收单状态
|
MES_WM_ITEM_RECEIPT_STATUS = 'mes_wm_item_receipt_status', // MES 物料接收单状态
|
||||||
|
MES_WM_OUTSOURCE_RECPT_STATUS = 'mes_wm_outsource_recpt_status', // MES 外协入库单状态
|
||||||
MES_WM_PRODUCTION_ISSUE_STATUS = 'mes_wm_production_issue_status', // MES 领料出库单状态
|
MES_WM_PRODUCTION_ISSUE_STATUS = 'mes_wm_production_issue_status', // MES 领料出库单状态
|
||||||
MES_PRODUCT_PRODUCE_STATUS = 'mes_product_produce_status', // MES 生产入库单状态
|
MES_PRODUCT_PRODUCE_STATUS = 'mes_product_produce_status', // MES 生产入库单状态
|
||||||
MES_RETURN_VENDOR_STATUS = 'mes_return_vendor_status', // MES 供应商退货单状态
|
MES_RETURN_VENDOR_STATUS = 'mes_return_vendor_status', // MES 供应商退货单状态
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,24 @@ export const MesWmItemReceiptStatusEnum = {
|
||||||
CANCELED: MesOrderStatusConstants.CANCELLED
|
CANCELED: MesOrderStatusConstants.CANCELLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** MES 委外收货单状态枚举 */
|
||||||
|
export const MesWmOutsourceReceiptStatusEnum = {
|
||||||
|
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||||
|
APPROVING: MesOrderStatusConstants.APPROVING,
|
||||||
|
APPROVED: MesOrderStatusConstants.APPROVED,
|
||||||
|
FINISHED: MesOrderStatusConstants.FINISHED,
|
||||||
|
CANCELED: MesOrderStatusConstants.CANCELLED
|
||||||
|
}
|
||||||
|
|
||||||
|
/** MES 外协入库单状态枚举 */
|
||||||
|
export const MesWmOutsourceRecptStatusEnum = {
|
||||||
|
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||||
|
APPROVING: MesOrderStatusConstants.APPROVING,
|
||||||
|
APPROVED: MesOrderStatusConstants.APPROVED,
|
||||||
|
FINISHED: MesOrderStatusConstants.FINISHED,
|
||||||
|
CANCELED: MesOrderStatusConstants.CANCELLED
|
||||||
|
}
|
||||||
|
|
||||||
/** MES 生产领料出库单状态枚举 */
|
/** MES 生产领料出库单状态枚举 */
|
||||||
export const MesWmProductionIssueStatusEnum = {
|
export const MesWmProductionIssueStatusEnum = {
|
||||||
PREPARE: MesOrderStatusConstants.DRAFT,
|
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||||
|
|
@ -279,6 +297,20 @@ export const MesWmSalesNoticeStatusEnum = {
|
||||||
FINISHED: MesOrderStatusConstants.FINISHED
|
FINISHED: MesOrderStatusConstants.FINISHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** MES 杂项出库单状态枚举 */
|
||||||
|
export const MesWmMiscIssueStatusEnum = {
|
||||||
|
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||||
|
APPROVED: MesOrderStatusConstants.APPROVED,
|
||||||
|
FINISHED: MesOrderStatusConstants.FINISHED,
|
||||||
|
CANCELED: MesOrderStatusConstants.CANCELLED
|
||||||
|
}
|
||||||
|
|
||||||
|
/** MES 外协发料单状态枚举 */
|
||||||
|
export const MesWmOutsourceIssueStatusEnum = {
|
||||||
|
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||||
|
FINISHED: MesOrderStatusConstants.FINISHED
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取物料/产品标识的标签 */
|
/** 获取物料/产品标识的标签 */
|
||||||
export const getItemOrProductLabel = (value: string): string => {
|
export const getItemOrProductLabel = (value: string): string => {
|
||||||
for (const item of Object.values(MesItemOrProductEnum)) {
|
for (const item of Object.values(MesItemOrProductEnum)) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,220 @@
|
||||||
|
<!-- MES 杂项出库明细列表(展开行内嵌子组件) -->
|
||||||
|
<!-- TODO @AI:删除掉; -->
|
||||||
|
<template>
|
||||||
|
<div class="pl-60px pr-20px py-10px">
|
||||||
|
<el-button
|
||||||
|
v-if="isUpdate"
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
size="small"
|
||||||
|
@click="openForm('create')"
|
||||||
|
class="mb-10px"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 添加明细
|
||||||
|
</el-button>
|
||||||
|
<el-table v-loading="loading" :data="list" border size="small">
|
||||||
|
<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="isUpdate" label="操作" align="center" width="120" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" @click="openForm('update', scope.row.id)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加/编辑明细弹窗 -->
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="仓库" prop="warehouseId">
|
||||||
|
<WmWarehouseSelect
|
||||||
|
v-model="formData.warehouseId"
|
||||||
|
@change="handleWarehouseChange"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="库区" prop="locationId">
|
||||||
|
<WmWarehouseLocationSelect
|
||||||
|
v-model="formData.locationId"
|
||||||
|
:warehouse-id="formData.warehouseId"
|
||||||
|
@change="handleLocationChange"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="库位" prop="areaId">
|
||||||
|
<WmWarehouseAreaSelect
|
||||||
|
v-model="formData.areaId"
|
||||||
|
:location-id="formData.locationId"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数量" prop="quantity">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.quantity"
|
||||||
|
:precision="2"
|
||||||
|
:min="0.01"
|
||||||
|
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 { WmMiscIssueDetailApi, WmMiscIssueDetailVO } from '@/api/mes/wm/miscissue/detail'
|
||||||
|
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: 'MiscIssueDetailList' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
issueId: number
|
||||||
|
lineId: number
|
||||||
|
itemId: number
|
||||||
|
formType: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const isUpdate = computed(() => ['create', 'update'].includes(props.formType)) // 是否为编辑模式
|
||||||
|
|
||||||
|
const loading = ref(false) // 列表的加载中
|
||||||
|
const list = ref<WmMiscIssueDetailVO[]>([]) // 明细列表
|
||||||
|
|
||||||
|
/** 查询明细列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
list.value = await WmMiscIssueDetailApi.getMiscIssueDetailListByLineId(props.lineId)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ getList })
|
||||||
|
|
||||||
|
/** 删除出库明细 */
|
||||||
|
const handleDelete = async (detailId: number) => {
|
||||||
|
try {
|
||||||
|
await message.delConfirm()
|
||||||
|
await WmMiscIssueDetailApi.deleteMiscIssueDetail(detailId)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 添加/编辑表单 ====================
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const detailFormType = ref('') // 明细表单的类型
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
lineId: undefined as number | undefined,
|
||||||
|
issueId: undefined as number | undefined,
|
||||||
|
itemId: undefined as number | undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
locationId: undefined,
|
||||||
|
areaId: undefined,
|
||||||
|
quantity: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'change' }],
|
||||||
|
locationId: [{ required: true, message: '库区不能为空', trigger: 'change' }],
|
||||||
|
areaId: [{ required: true, message: '库位不能为空', trigger: 'change' }],
|
||||||
|
quantity: [
|
||||||
|
{ required: true, message: '数量不能为空', trigger: 'blur' },
|
||||||
|
{ type: 'number', min: 0.01, message: '数量必须大于等于0.01', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 仓库变化时,清空库区和库位 */
|
||||||
|
const handleWarehouseChange = () => {
|
||||||
|
formData.value.locationId = undefined
|
||||||
|
formData.value.areaId = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 库区变化时,清空库位 */
|
||||||
|
const handleLocationChange = () => {
|
||||||
|
formData.value.areaId = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开表单弹窗 */
|
||||||
|
const openForm = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = type === 'create' ? '添加出库明细' : '修改出库明细'
|
||||||
|
detailFormType.value = type
|
||||||
|
resetForm()
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await WmMiscIssueDetailApi.getMiscIssueDetail(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const submitForm = async () => {
|
||||||
|
await formRef.value.validate()
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = {
|
||||||
|
...formData.value,
|
||||||
|
lineId: props.lineId,
|
||||||
|
issueId: props.issueId,
|
||||||
|
itemId: props.itemId
|
||||||
|
} as unknown as WmMiscIssueDetailVO
|
||||||
|
if (detailFormType.value === 'create') {
|
||||||
|
await WmMiscIssueDetailApi.createMiscIssueDetail(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await WmMiscIssueDetailApi.updateMiscIssueDetail(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
await getList()
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
lineId: undefined,
|
||||||
|
issueId: undefined,
|
||||||
|
itemId: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
locationId: undefined,
|
||||||
|
areaId: undefined,
|
||||||
|
quantity: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化:延迟加载,展开时才触发 */
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,218 @@
|
||||||
|
<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>
|
||||||
|
<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:参考 index.vue 界面的要求; -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="杂项类型" prop="type">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.type"
|
||||||
|
placeholder="请选择杂项类型"
|
||||||
|
class="!w-1/1"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.MES_MISC_ISSUE_TYPE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="出库日期" prop="issueDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="formData.issueDate"
|
||||||
|
type="date"
|
||||||
|
value-format="x"
|
||||||
|
placeholder="请选择出库日期"
|
||||||
|
class="!w-1/1"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- TODO @芋艿:后续这块怎么处理; -->
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="来源单据编号" prop="sourceDocCode">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.sourceDocCode"
|
||||||
|
placeholder="请输入来源单据编号"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="来源单据类型" prop="sourceDocType">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.sourceDocType"
|
||||||
|
placeholder="请输入来源单据类型"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
/>
|
||||||
|
</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="请输入备注"
|
||||||
|
:disabled="isHeaderReadonly"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<!-- 非新建模式展示物料信息 -->
|
||||||
|
<template v-if="formData.id">
|
||||||
|
<el-divider content-position="center">物料信息</el-divider>
|
||||||
|
<MiscIssueLineList :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 @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { generateRandomStr } from '@/utils'
|
||||||
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
||||||
|
import { WmMiscIssueApi, WmMiscIssueVO } from '@/api/mes/wm/miscissue'
|
||||||
|
import MiscIssueLineList from './MiscIssueLineList.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'MiscIssueForm' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const formLoading = ref(false) // 表单的加载中
|
||||||
|
const formType = ref<string>('create') // 表单的类型:create / update / detail
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined as number | undefined,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
type: undefined,
|
||||||
|
issueDate: undefined,
|
||||||
|
sourceDocCode: undefined,
|
||||||
|
sourceDocType: undefined,
|
||||||
|
remark: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
code: [{ required: true, message: '出库单编号不能为空', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '出库单名称不能为空', trigger: 'blur' }],
|
||||||
|
// TODO @AI:type、issueDate 都是选填;
|
||||||
|
type: [{ required: true, message: '杂项类型不能为空', trigger: 'change' }],
|
||||||
|
issueDate: [{ required: true, message: '出库日期不能为空', trigger: 'change' }]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
const isUpdate = computed(() => ['create', 'update'].includes(formType.value)) // 是否为编辑模式
|
||||||
|
const isHeaderReadonly = computed(() => formType.value === 'detail') // 是否只读
|
||||||
|
const dialogTitle = computed(() => {
|
||||||
|
const titles = {
|
||||||
|
create: '新增杂项出库单',
|
||||||
|
update: '编辑杂项出库单',
|
||||||
|
detail: '杂项出库单详情'
|
||||||
|
}
|
||||||
|
return titles[formType.value] || formType.value
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 生成出库单编号 */
|
||||||
|
const generateCode = () => {
|
||||||
|
formData.value.code = 'MI' + 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 WmMiscIssueApi.getMiscIssue(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 WmMiscIssueVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
const res = await WmMiscIssueApi.createMiscIssue(data)
|
||||||
|
message.success('新增成功')
|
||||||
|
formData.value.id = res
|
||||||
|
formType.value = 'update'
|
||||||
|
} else {
|
||||||
|
await WmMiscIssueApi.updateMiscIssue(data)
|
||||||
|
message.success('修改成功')
|
||||||
|
}
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
type: undefined,
|
||||||
|
issueDate: undefined,
|
||||||
|
sourceDocCode: undefined,
|
||||||
|
sourceDocType: undefined,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,293 @@
|
||||||
|
<!-- 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">
|
||||||
|
<MiscIssueDetailList
|
||||||
|
: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"
|
||||||
|
/>
|
||||||
|
</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" />
|
||||||
|
<el-table-column label="批次编码" align="center" prop="batchCode" min-width="120" />
|
||||||
|
<el-table-column label="仓库" align="center" prop="warehouseName" min-width="120" />
|
||||||
|
<el-table-column label="库区" align="center" prop="locationName" min-width="120" />
|
||||||
|
<el-table-column label="库位" align="center" prop="areaName" min-width="120" />
|
||||||
|
<el-table-column
|
||||||
|
v-if="isUpdate"
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="120"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" @click="openForm('update', scope.row.id)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(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"
|
||||||
|
/>
|
||||||
|
</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.01"
|
||||||
|
controls-position="right"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="批次编码" prop="batchCode">
|
||||||
|
<el-input v-model="formData.batchCode" placeholder="请输入批次编码" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="仓库" prop="warehouseId">
|
||||||
|
<WmWarehouseSelect
|
||||||
|
v-model="formData.warehouseId"
|
||||||
|
@change="handleWarehouseChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="库区" prop="locationId">
|
||||||
|
<WmWarehouseLocationSelect
|
||||||
|
v-model="formData.locationId"
|
||||||
|
:warehouse-id="formData.warehouseId"
|
||||||
|
@change="handleLocationChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="库位" prop="areaId">
|
||||||
|
<WmWarehouseAreaSelect
|
||||||
|
v-model="formData.areaId"
|
||||||
|
:location-id="formData.locationId"
|
||||||
|
/>
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { WmMiscIssueLineApi, WmMiscIssueLineVO } from '@/api/mes/wm/miscissue/line'
|
||||||
|
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'
|
||||||
|
import MiscIssueDetailList from './MiscIssueDetailList.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'MiscIssueLineList' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
issueId: number
|
||||||
|
formType: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const isUpdate = computed(() => ['create', 'update'].includes(props.formType)) // 是否为编辑模式
|
||||||
|
|
||||||
|
// ==================== 列表 ====================
|
||||||
|
const loading = ref(false) // 列表的加载中
|
||||||
|
const list = ref<WmMiscIssueLineVO[]>([]) // 行列表
|
||||||
|
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 WmMiscIssueLineApi.getMiscIssueLinePage(queryParams)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.delConfirm()
|
||||||
|
await WmMiscIssueLineApi.deleteMiscIssueLine(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,
|
||||||
|
batchCode: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
locationId: undefined,
|
||||||
|
areaId: undefined,
|
||||||
|
remark: undefined
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||||
|
quantity: [
|
||||||
|
{ required: true, message: '出库数量不能为空', trigger: 'blur' },
|
||||||
|
{ type: 'number', min: 0.01, message: '出库数量必须大于等于0.01', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 仓库变化时,清空库区和库位 */
|
||||||
|
const handleWarehouseChange = () => {
|
||||||
|
formData.value.locationId = undefined
|
||||||
|
formData.value.areaId = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 库区变化时,清空库位 */
|
||||||
|
const handleLocationChange = () => {
|
||||||
|
formData.value.areaId = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开表单弹窗 */
|
||||||
|
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 WmMiscIssueLineApi.getMiscIssueLine(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 WmMiscIssueLineVO
|
||||||
|
if (lineFormType.value === 'create') {
|
||||||
|
await WmMiscIssueLineApi.createMiscIssueLine(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await WmMiscIssueLineApi.updateMiscIssueLine(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,
|
||||||
|
batchCode: undefined,
|
||||||
|
warehouseId: undefined,
|
||||||
|
locationId: undefined,
|
||||||
|
areaId: undefined,
|
||||||
|
remark: undefined
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 展开行:出库明细 ====================
|
||||||
|
const detailListRefs = ref<Record<number, InstanceType<typeof MiscIssueDetailList>>>({})
|
||||||
|
|
||||||
|
/** 缓存子组件 ref */
|
||||||
|
const setDetailListRef = (lineId: number, el: any) => {
|
||||||
|
if (el) {
|
||||||
|
detailListRefs.value[lineId] = el
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(async () => {
|
||||||
|
await getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,303 @@
|
||||||
|
<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:杂项类型,改成“业务类型”; -->
|
||||||
|
<el-form-item label="杂项类型" prop="type">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择杂项类型"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<!-- TODO @AI:字典枚举;MES_WM_MISC_ISSUE_TYPE:库存调整、报销出库 -->
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.MES_MISC_ISSUE_TYPE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- TODO @芋艿:【来源单据编号】【来源单据类型】;不用改 -->
|
||||||
|
<el-form-item label="出库日期" prop="issueDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.issueDate"
|
||||||
|
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"
|
||||||
|
>
|
||||||
|
<!-- TODO @AI:字典枚举;MES_WM_MISC_ISSUE_STATUS:草稿、待执行出库、已完成、已取消; -->
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.MES_MISC_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-misc-issue:create']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['mes:wm-misc-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-link type="primary" @click="openForm('detail', scope.row.id)">
|
||||||
|
{{ scope.row.code }}
|
||||||
|
</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="出库单名称" align="center" prop="name" min-width="150" />
|
||||||
|
<el-table-column label="业务类型" align="center" prop="type" min-width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.MES_MISC_ISSUE_TYPE" :value="scope.row.type" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- TODO @芋艿:【来源单据编号】【来源单据类型】;不用改 -->
|
||||||
|
<el-table-column
|
||||||
|
label="出库日期"
|
||||||
|
align="center"
|
||||||
|
prop="issueDate"
|
||||||
|
:formatter="dateFormatter2"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
|
<el-table-column label="单据状态" align="center" prop="status" min-width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.MES_MISC_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-misc-issue:update']"
|
||||||
|
v-if="scope.row.status === MesWmMiscIssueStatusEnum.PREPARE"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="warning"
|
||||||
|
@click="handleSubmit(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-misc-issue:update']"
|
||||||
|
v-if="scope.row.status === MesWmMiscIssueStatusEnum.PREPARE"
|
||||||
|
>
|
||||||
|
提交
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-misc-issue:delete']"
|
||||||
|
v-if="scope.row.status === MesWmMiscIssueStatusEnum.PREPARE"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<!-- 待执行出库:执行出库、取消 -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="success"
|
||||||
|
@click="handleFinish(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-misc-issue:finish']"
|
||||||
|
v-if="scope.row.status === MesWmMiscIssueStatusEnum.APPROVED"
|
||||||
|
>
|
||||||
|
执行出库
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleCancel(scope.row.id)"
|
||||||
|
v-hasPermi="['mes:wm-misc-issue:update']"
|
||||||
|
v-if="scope.row.status === MesWmMiscIssueStatusEnum.APPROVED"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<MiscIssueForm 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 { WmMiscIssueApi, WmMiscIssueVO } from '@/api/mes/wm/miscissue'
|
||||||
|
import MiscIssueForm from './MiscIssueForm.vue'
|
||||||
|
import { MesWmMiscIssueStatusEnum } from '@/views/mes/utils/constants'
|
||||||
|
|
||||||
|
defineOptions({ name: 'MesWmMiscIssue' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref<WmMiscIssueVO[]>([]) // 列表的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
type: undefined,
|
||||||
|
issueDate: undefined,
|
||||||
|
status: undefined
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await WmMiscIssueApi.getMiscIssuePage(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 formRef = ref() // 表单弹窗
|
||||||
|
const openForm = (type: string, id?: number) => {
|
||||||
|
formRef.value.open(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交 */
|
||||||
|
const handleSubmit = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.confirm('确认提交该杂项出库单?')
|
||||||
|
await WmMiscIssueApi.submitMiscIssue(id)
|
||||||
|
message.success('提交成功')
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 执行出库 */
|
||||||
|
const handleFinish = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.confirm('确认执行出库?执行后将更新库存台账。')
|
||||||
|
await WmMiscIssueApi.finishMiscIssue(id)
|
||||||
|
message.success('出库成功')
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消 */
|
||||||
|
const handleCancel = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.confirm('确认取消该杂项出库单?取消后不可恢复。')
|
||||||
|
await WmMiscIssueApi.cancelMiscIssue(id)
|
||||||
|
message.success('取消成功')
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
await message.delConfirm()
|
||||||
|
await WmMiscIssueApi.deleteMiscIssue(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
await message.exportConfirm()
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await WmMiscIssueApi.exportMiscIssue(queryParams)
|
||||||
|
download.excel(data, '杂项出库单.xls')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -187,7 +187,7 @@ import { WmProductionIssueApi, WmProductionIssueVO } from '@/api/mes/wm/producti
|
||||||
import ProductionIssueForm from './ProductionIssueForm.vue'
|
import ProductionIssueForm from './ProductionIssueForm.vue'
|
||||||
import { MesWmProductionIssueStatusEnum } from '@/views/mes/utils/constants'
|
import { MesWmProductionIssueStatusEnum } from '@/views/mes/utils/constants'
|
||||||
|
|
||||||
defineOptions({ name: 'MesWmIssue' })
|
defineOptions({ name: 'MesWmProductionIssue' })
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue