feat(mes): 新增到货通知单和到货通知单行的表单组件

pull/871/MERGE
YunaiV 2026-02-22 17:28:11 +08:00
parent 6fd1806c4c
commit 39187b441e
4 changed files with 792 additions and 0 deletions

View File

@ -0,0 +1,172 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="860px">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="110px"
v-loading="formLoading"
>
<el-row>
<el-col :span="8">
<!-- TODO @AI生成功能参考别的模块 -->
<el-form-item label="通知单编号" prop="code">
<el-input v-model="formData.code" placeholder="请输入通知单编号" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="通知单名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入通知单名称" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="采购订单编号" prop="purchaseOrderCode">
<el-input v-model="formData.purchaseOrderCode" placeholder="请输入采购订单编号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="供应商" prop="vendorId">
<el-select
v-model="formData.vendorId"
placeholder="请选择供应商"
clearable
class="!w-1/1"
>
<el-option
v-for="vendor in vendorList"
:key="vendor.id"
:label="vendor.name"
:value="vendor.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="到货日期" prop="arrivalDate">
<el-date-picker
v-model="formData.arrivalDate"
type="date"
value-format="x"
placeholder="请选择到货日期"
class="!w-1/1"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="联系人" prop="contactName">
<el-input v-model="formData.contactName" placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="联系方式" prop="contactTelephone">
<el-input v-model="formData.contactTelephone" placeholder="请输入联系方式" />
</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>
<!-- TODO @AI这里缺少了物料信息 -->
<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 { WmArrivalNoticeApi, WmArrivalNoticeVO } from '@/api/mes/wm/arrivalnotice'
import { MdVendorApi } from '@/api/mes/md/vendor'
defineOptions({ name: 'ArrivalNoticeForm' })
const { t } = useI18n()
const message = useMessage()
const dialogVisible = ref(false)
const dialogTitle = ref('')
const formLoading = ref(false)
const formType = ref('')
const vendorList = ref<any[]>([])
const formData = ref({
id: undefined,
code: undefined,
name: undefined,
purchaseOrderCode: undefined,
vendorId: undefined,
arrivalDate: undefined,
contactName: undefined,
contactTelephone: undefined,
remark: undefined
})
const formRules = reactive({
code: [{ required: true, message: '通知单编号不能为空', trigger: 'blur' }],
vendorId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
arrivalDate: [{ required: true, message: '请选择到货日期', trigger: 'change' }]
})
const formRef = ref()
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
vendorList.value = await MdVendorApi.getVendorSimpleList()
if (id) {
formLoading.value = true
try {
formData.value = await WmArrivalNoticeApi.getArrivalNotice(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open })
/** 提交表单 */
const emit = defineEmits(['success'])
const submitForm = async () => {
await formRef.value.validate()
formLoading.value = true
try {
const data = formData.value as unknown as WmArrivalNoticeVO
if (formType.value === 'create') {
await WmArrivalNoticeApi.createArrivalNotice(data)
message.success(t('common.createSuccess'))
} else {
await WmArrivalNoticeApi.updateArrivalNotice(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
code: undefined,
name: undefined,
purchaseOrderCode: undefined,
vendorId: undefined,
arrivalDate: undefined,
contactName: undefined,
contactTelephone: undefined,
remark: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,304 @@
<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>
<el-form-item label="采购订单编号" prop="purchaseOrderCode">
<el-input
v-model="queryParams.purchaseOrderCode"
placeholder="请输入采购订单编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="供应商" prop="vendorId">
<el-select
v-model="queryParams.vendorId"
placeholder="请选择供应商"
clearable
class="!w-240px"
>
<el-option
v-for="vendor in vendorList"
:key="vendor.id"
:label="vendor.name"
:value="vendor.id"
/>
</el-select>
</el-form-item>
<!-- TODO @AI到货时间 -->
<el-form-item label="单据状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择单据状态"
clearable
class="!w-240px"
>
<!-- TODO @AIMES_WM_ARRIVAL_NOTICE_STATUS 枚举下 -->
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_ARRIVAL_NOTICE_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-arrival-notice:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['mes:wm-arrival-notice: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="openLine(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="purchaseOrderCode"
min-width="140"
/>
<el-table-column label="供应商名称" align="center" prop="vendorName" min-width="120" />
<el-table-column
label="到货日期"
align="center"
prop="arrivalDate"
:formatter="dateFormatter2"
width="180px"
/>
<el-table-column label="联系人" align="center" prop="contactName" min-width="100" />
<el-table-column label="联系方式" align="center" prop="contactTelephone" min-width="120" />
<el-table-column label="单据状态" align="center" prop="status" min-width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.MES_WM_ARRIVAL_NOTICE_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<!-- TODO @AI到货时间看看怎么没了 -->
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<!-- TODO @AI:fixed -->
<el-table-column label="操作" align="center" width="220">
<!-- TODO @AI需要在 mes constants -->
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:update']"
v-if="scope.row.status === 0"
>
编辑
</el-button>
<el-button
link
type="warning"
@click="handleSubmit(scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:update']"
v-if="scope.row.status === 0"
>
提交
</el-button>
<el-button
link
type="success"
@click="handleApprove(scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:update']"
v-if="scope.row.status === 1"
>
审批
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:delete']"
v-if="scope.row.status === 0"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<ArrivalNoticeForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import download from '@/utils/download'
import { WmArrivalNoticeApi, WmArrivalNoticeVO } from '@/api/mes/wm/arrivalnotice'
import { MdVendorApi } from '@/api/mes/md/vendor'
import ArrivalNoticeForm from './ArrivalNoticeForm.vue'
// TODO @AI/Users/yunai/Java/yudao-all-in-one/yudao-ui-admin-vue3/src/views/system/user/index.vue
defineOptions({ name: 'MesWmArrivalNotice' })
const message = useMessage()
const { t } = useI18n()
const router = useRouter()
const loading = ref(true)
const list = ref<WmArrivalNoticeVO[]>([])
const total = ref(0)
const exportLoading = ref(false)
const vendorList = ref<any[]>([])
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
code: undefined,
name: undefined,
purchaseOrderCode: undefined,
vendorId: undefined,
status: undefined
})
const queryFormRef = ref()
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await WmArrivalNoticeApi.getArrivalNoticePage(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 openLine = (noticeId: number) => {
router.push({
name: 'MesWmArrivalNoticeLine',
query: { noticeId: String(noticeId) }
})
}
/** 提交 */
const handleSubmit = async (id: number) => {
try {
await message.confirm('确认提交该到货通知单?')
await WmArrivalNoticeApi.submitArrivalNotice(id)
message.success('提交成功')
await getList()
} catch {}
}
/** 审批 */
const handleApprove = async (id: number) => {
try {
await message.confirm('确认审批通过该到货通知单?')
await WmArrivalNoticeApi.approveArrivalNotice(id)
message.success('审批成功')
await getList()
} catch {}
}
/** 删除 */
const handleDelete = async (id: number) => {
try {
await message.delConfirm()
await WmArrivalNoticeApi.deleteArrivalNotice(id)
message.success(t('common.delSuccess'))
await getList()
} catch {}
}
/** 导出 */
const handleExport = async () => {
try {
await message.exportConfirm()
exportLoading.value = true
const data = await WmArrivalNoticeApi.exportArrivalNotice(queryParams)
download.excel(data, '到货通知单.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 */
onMounted(async () => {
vendorList.value = await MdVendorApi.getVendorSimpleList()
await getList()
})
</script>

View File

@ -0,0 +1,157 @@
<!-- TODO @AI参考别的模块/Users/yunai/Java/yudao-all-in-one/yudao-ui-admin-vue3/src/views/mes/qc/ipqc/IpqcLineList.vue -->
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="700px">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="110px"
v-loading="formLoading"
>
<el-row>
<el-col :span="12">
<el-form-item label="物料" prop="itemId">
<el-select
v-model="formData.itemId"
placeholder="请选择物料"
filterable
clearable
class="!w-1/1"
>
<el-option
v-for="item in itemList"
:key="item.id"
:label="`${item.code} - ${item.name}`"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="到货数量" prop="arrivalQuantity">
<el-input-number
v-model="formData.arrivalQuantity"
:precision="2"
:min="0"
controls-position="right"
class="!w-1/1"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="合格数量" prop="qualifiedQuantity">
<el-input-number
v-model="formData.qualifiedQuantity"
:precision="2"
:min="0"
controls-position="right"
class="!w-1/1"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="来料检验" prop="iqcCheckFlag">
<el-switch v-model="formData.iqcCheckFlag" />
</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 { WmArrivalNoticeLineApi, WmArrivalNoticeLineVO } from '@/api/mes/wm/arrivalnotice/line'
import { MdItemApi } from '@/api/mes/md/item'
defineOptions({ name: 'ArrivalNoticeLineForm' })
const props = defineProps<{ noticeId: number }>()
const { t } = useI18n()
const message = useMessage()
const dialogVisible = ref(false)
const dialogTitle = ref('')
const formLoading = ref(false)
const formType = ref('')
const itemList = ref<any[]>([])
const formData = ref({
id: undefined,
noticeId: undefined as number | undefined,
itemId: undefined,
arrivalQuantity: undefined,
qualifiedQuantity: undefined,
iqcCheckFlag: false,
remark: undefined
})
const formRules = reactive({
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
arrivalQuantity: [{ required: true, message: '到货数量不能为空', trigger: 'blur' }]
})
const formRef = ref()
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
itemList.value = await MdItemApi.getItemSimpleList()
if (id) {
formLoading.value = true
try {
formData.value = await WmArrivalNoticeLineApi.getArrivalNoticeLine(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open })
/** 提交表单 */
const emit = defineEmits(['success'])
const submitForm = async () => {
await formRef.value.validate()
formLoading.value = true
try {
const data = { ...formData.value, noticeId: props.noticeId } as unknown as WmArrivalNoticeLineVO
if (formType.value === 'create') {
await WmArrivalNoticeLineApi.createArrivalNoticeLine(data)
message.success(t('common.createSuccess'))
} else {
await WmArrivalNoticeLineApi.updateArrivalNoticeLine(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
noticeId: undefined,
itemId: undefined,
arrivalQuantity: undefined,
qualifiedQuantity: undefined,
iqcCheckFlag: false,
remark: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,159 @@
<template>
<ContentWrap>
<el-button @click="goBack" class="mb-10px">
<Icon icon="ep:arrow-left" class="mr-5px" /> 返回通知单列表
</el-button>
</ContentWrap>
<ContentWrap>
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<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-arrival-notice:create']"
>
<Icon icon="ep:plus" 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="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" min-width="80" />
<el-table-column label="到货数量" align="center" prop="arrivalQuantity" min-width="100" />
<el-table-column label="合格数量" align="center" prop="qualifiedQuantity" min-width="100" />
<el-table-column label="来料检验" align="center" prop="iqcCheckFlag" min-width="90">
<template #default="scope">
<el-tag :type="scope.row.iqcCheckFlag ? 'warning' : 'info'" size="small">
{{ scope.row.iqcCheckFlag ? '需检验' : '免检' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="检验单号" align="center" prop="iqcCode" min-width="140" />
<el-table-column label="备注" align="center" prop="remark" min-width="150" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center" width="160">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['mes:wm-arrival-notice:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<ArrivalNoticeLineForm ref="formRef" @success="getList" :noticeId="noticeId" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { WmArrivalNoticeLineApi, WmArrivalNoticeLineVO } from '@/api/mes/wm/arrivalnotice/line'
import ArrivalNoticeLineForm from './ArrivalNoticeLineForm.vue'
defineOptions({ name: 'MesWmArrivalNoticeLine' })
const message = useMessage()
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
const noticeId = Number(route.query.noticeId)
const loading = ref(true)
const list = ref<WmArrivalNoticeLineVO[]>([])
const total = ref(0)
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
noticeId
})
const queryFormRef = ref()
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await WmArrivalNoticeLineApi.getArrivalNoticeLinePage(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 handleDelete = async (id: number) => {
try {
await message.delConfirm()
await WmArrivalNoticeLineApi.deleteArrivalNoticeLine(id)
message.success(t('common.delSuccess'))
await getList()
} catch {}
}
/** 返回 */
const goBack = () => {
router.push({ name: 'MesWmArrivalNotice' })
}
/** 初始化 */
onMounted(async () => {
await getList()
})
</script>