✨ feat(mes): 新增发货通知单及相关行功能
添加发货通知单及其行的相关数据结构和逻辑,包括创建、更新、删除和查询功能。此功能将提升销售出库管理的效率,并支持更灵活的发货通知处理。pull/871/MERGE
parent
10d5510885
commit
1f442fb7fd
|
|
@ -0,0 +1,55 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// MES 发货通知单 VO
|
||||
export interface WmSalesNoticeVO {
|
||||
id: number
|
||||
noticeCode: string
|
||||
noticeName: string
|
||||
salesOrderCode: string
|
||||
clientId: number
|
||||
salesDate: string
|
||||
recipientName: string
|
||||
recipientTelephone: string
|
||||
recipientAddress: string
|
||||
status: number
|
||||
remark: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
// MES 发货通知单 API
|
||||
export const WmSalesNoticeApi = {
|
||||
// 查询发货通知单分页
|
||||
getSalesNoticePage: async (params: any) => {
|
||||
return await request.get({ url: '/mes/wm/sales-notice/page', params })
|
||||
},
|
||||
|
||||
// 查询发货通知单详情
|
||||
getSalesNotice: async (id: number) => {
|
||||
return await request.get({ url: '/mes/wm/sales-notice/get?id=' + id })
|
||||
},
|
||||
|
||||
// 新增发货通知单
|
||||
createSalesNotice: async (data: WmSalesNoticeVO) => {
|
||||
return await request.post({ url: '/mes/wm/sales-notice/create', data })
|
||||
},
|
||||
|
||||
// 修改发货通知单
|
||||
updateSalesNotice: async (data: WmSalesNoticeVO) => {
|
||||
return await request.put({ url: '/mes/wm/sales-notice/update', data })
|
||||
},
|
||||
|
||||
// 删除发货通知单
|
||||
deleteSalesNotice: async (id: number) => {
|
||||
return await request.delete({ url: '/mes/wm/sales-notice/delete?id=' + id })
|
||||
},
|
||||
|
||||
// 提交发货通知单
|
||||
submitSalesNotice: async (id: number) => {
|
||||
return await request.put({ url: '/mes/wm/sales-notice/submit?id=' + id })
|
||||
},
|
||||
|
||||
// 导出发货通知单 Excel
|
||||
exportSalesNotice: async (params: any) => {
|
||||
return await request.download({ url: '/mes/wm/sales-notice/export-excel', params })
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// MES 发货通知单行 VO
|
||||
export interface WmSalesNoticeLineVO {
|
||||
id: number
|
||||
noticeId: number
|
||||
itemId: number
|
||||
itemCode: string
|
||||
itemName: string
|
||||
specification: string
|
||||
unitMeasureName: string
|
||||
batchId: number
|
||||
batchCode: string
|
||||
quantity: number
|
||||
oqcCheck: boolean
|
||||
remark: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
// MES 发货通知单行 API
|
||||
export const WmSalesNoticeLineApi = {
|
||||
// 查询发货通知单行分页
|
||||
getSalesNoticeLinePage: async (params: any) => {
|
||||
return await request.get({ url: '/mes/wm/sales-notice-line/page', params })
|
||||
},
|
||||
|
||||
// 查询发货通知单行详情
|
||||
getSalesNoticeLine: async (id: number) => {
|
||||
return await request.get({ url: '/mes/wm/sales-notice-line/get?id=' + id })
|
||||
},
|
||||
|
||||
// 新增发货通知单行
|
||||
createSalesNoticeLine: async (data: WmSalesNoticeLineVO) => {
|
||||
return await request.post({ url: '/mes/wm/sales-notice-line/create', data })
|
||||
},
|
||||
|
||||
// 修改发货通知单行
|
||||
updateSalesNoticeLine: async (data: WmSalesNoticeLineVO) => {
|
||||
return await request.put({ url: '/mes/wm/sales-notice-line/update', data })
|
||||
},
|
||||
|
||||
// 删除发货通知单行
|
||||
deleteSalesNoticeLine: async (id: number) => {
|
||||
return await request.delete({ url: '/mes/wm/sales-notice-line/delete?id=' + id })
|
||||
}
|
||||
}
|
||||
|
|
@ -303,4 +303,5 @@ export enum DICT_TYPE {
|
|||
MES_WM_PRODUCT_RECPT_STATUS = 'mes_wm_product_receipt_status', // MES 成品入库单状态
|
||||
MES_WM_RETURN_SALES_STATUS = 'mes_wm_return_sales_status', // MES 销售退货单状态
|
||||
MES_WM_PRODUCT_SALES_STATUS = 'mes_wm_product_sales_status', // MES 销售出库单状态
|
||||
MES_SALES_NOTICE_STATUS = 'mes_sales_notice_status', // MES 发货通知单状态
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,6 +271,12 @@ export const MesWmProductSalesStatusEnum = {
|
|||
CANCELED: MesOrderStatusConstants.CANCELLED
|
||||
}
|
||||
|
||||
/** MES 发货通知单状态枚举 */
|
||||
export const MesWmSalesNoticeStatusEnum = {
|
||||
PREPARE: MesOrderStatusConstants.DRAFT,
|
||||
APPROVED: MesOrderStatusConstants.CONFIRMED
|
||||
}
|
||||
|
||||
/** 获取物料/产品标识的标签 */
|
||||
export const getItemOrProductLabel = (value: string): string => {
|
||||
for (const item of Object.values(MesItemOrProductEnum)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,194 @@
|
|||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="960px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
v-loading="formLoading"
|
||||
:disabled="isDetail"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="通知单编号" prop="noticeCode">
|
||||
<el-input v-model="formData.noticeCode" placeholder="请输入通知单编号">
|
||||
<template #append>
|
||||
<el-button @click="generateCode" :disabled="formType === 'update'">
|
||||
生成
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="通知单名称" prop="noticeName">
|
||||
<el-input v-model="formData.noticeName" placeholder="请输入通知单名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="销售订单编号" prop="salesOrderCode">
|
||||
<el-input v-model="formData.salesOrderCode" placeholder="请输入销售订单编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户" prop="clientId">
|
||||
<MdClientSelect v-model="formData.clientId" :disabled="isDetail" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="发货日期" prop="salesDate">
|
||||
<el-date-picker
|
||||
v-model="formData.salesDate"
|
||||
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="recipientName">
|
||||
<el-input v-model="formData.recipientName" placeholder="请输入收货人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系方式" prop="recipientTelephone">
|
||||
<el-input v-model="formData.recipientTelephone" placeholder="请输入联系方式" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="收货地址" prop="recipientAddress">
|
||||
<el-input v-model="formData.recipientAddress" 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>
|
||||
<!-- 编辑时展示物料信息 -->
|
||||
<template v-if="formType === 'update' && formData.id">
|
||||
<el-divider content-position="center">物料信息</el-divider>
|
||||
<SalesNoticeLineList :notice-id="formData.id" />
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!isDetail">
|
||||
确 定
|
||||
</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { generateRandomStr } from '@/utils'
|
||||
import { WmSalesNoticeApi, WmSalesNoticeVO } from '@/api/mes/wm/salesnotice'
|
||||
import SalesNoticeLineList from './SalesNoticeLineList.vue'
|
||||
import MdClientSelect from '@/views/mes/md/client/components/MdClientSelect.vue'
|
||||
|
||||
defineOptions({ name: 'SalesNoticeForm' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const formLoading = ref(false)
|
||||
const formType = ref('')
|
||||
const isDetail = computed(() => formType.value === 'detail')
|
||||
const dialogTitle = computed(() => {
|
||||
const titles = {
|
||||
create: '新增发货通知单',
|
||||
update: '修改发货通知单',
|
||||
detail: '查看发货通知单'
|
||||
}
|
||||
return titles[formType.value] || t('action.' + formType.value)
|
||||
})
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
noticeCode: undefined,
|
||||
noticeName: undefined,
|
||||
salesOrderCode: undefined,
|
||||
clientId: undefined,
|
||||
salesDate: undefined,
|
||||
recipientName: undefined,
|
||||
recipientTelephone: undefined,
|
||||
recipientAddress: undefined,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
noticeCode: [{ required: true, message: '通知单编号不能为空', trigger: 'blur' }],
|
||||
noticeName: [{ required: true, message: '通知单名称不能为空', trigger: 'blur' }],
|
||||
clientId: [{ required: true, message: '请选择客户', trigger: 'change' }],
|
||||
salesDate: [{ required: true, message: '请选择发货日期', trigger: 'change' }]
|
||||
})
|
||||
const formRef = ref()
|
||||
|
||||
/** 生成通知单编号 */
|
||||
const generateCode = () => {
|
||||
formData.value.noticeCode = 'SN' + 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 WmSalesNoticeApi.getSalesNotice(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 WmSalesNoticeVO
|
||||
if (formType.value === 'create') {
|
||||
const res = await WmSalesNoticeApi.createSalesNotice(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
formData.value.id = res
|
||||
formType.value = 'update'
|
||||
} else {
|
||||
await WmSalesNoticeApi.updateSalesNotice(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
}
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
noticeCode: undefined,
|
||||
noticeName: undefined,
|
||||
salesOrderCode: undefined,
|
||||
clientId: undefined,
|
||||
salesDate: undefined,
|
||||
recipientName: undefined,
|
||||
recipientTelephone: undefined,
|
||||
recipientAddress: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
<!-- MES 发货通知单行列表子组件 -->
|
||||
<template>
|
||||
<div>
|
||||
<el-button 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>
|
||||
<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="batchCode" min-width="120" />
|
||||
<el-table-column label="发货数量" align="center" prop="quantity" width="100" />
|
||||
<el-table-column label="是否检验" align="center" prop="oqcCheck" width="90">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.oqcCheck" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="120" />
|
||||
<el-table-column label="操作" align="center" width="120">
|
||||
<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="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">
|
||||
<MdItemSelect v-model="formData.itemId" placeholder="请选择物料" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<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="12">
|
||||
<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="12">
|
||||
<el-form-item label="是否检验" prop="oqcCheck">
|
||||
<el-switch v-model="formData.oqcCheck" />
|
||||
</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 { DICT_TYPE } from '@/utils/dict'
|
||||
import { WmSalesNoticeLineApi, WmSalesNoticeLineVO } from '@/api/mes/wm/salesnotice/line'
|
||||
import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue'
|
||||
|
||||
defineOptions({ name: 'SalesNoticeLineList' })
|
||||
|
||||
const props = defineProps<{
|
||||
noticeId: number
|
||||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
// ==================== 列表 ====================
|
||||
const loading = ref(false)
|
||||
const list = ref<WmSalesNoticeLineVO[]>([])
|
||||
const total = ref(0)
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
noticeId: undefined as number | undefined
|
||||
})
|
||||
|
||||
/** 查询行列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
queryParams.noticeId = props.noticeId
|
||||
const data = await WmSalesNoticeLineApi.getSalesNoticeLinePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmSalesNoticeLineApi.deleteSalesNoticeLine(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// ==================== 添加/编辑表单 ====================
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formLoading = ref(false)
|
||||
const formType = ref('')
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
noticeId: undefined as number | undefined,
|
||||
itemId: undefined,
|
||||
batchCode: undefined,
|
||||
quantity: undefined,
|
||||
oqcCheck: true,
|
||||
remark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
itemId: [{ required: true, message: '物料不能为空', trigger: 'change' }],
|
||||
quantity: [
|
||||
{ required: true, message: '发货数量不能为空', trigger: 'blur' },
|
||||
{ type: 'number', min: 0.01, message: '发货数量必须大于0', trigger: 'blur' }
|
||||
],
|
||||
oqcCheck: [{ required: true, message: '是否检验不能为空', trigger: 'change' }]
|
||||
})
|
||||
const formRef = ref()
|
||||
|
||||
/** 打开表单弹窗 */
|
||||
const openForm = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await WmSalesNoticeLineApi.getSalesNoticeLine(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
await formRef.value.validate()
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = { ...formData.value, noticeId: props.noticeId } as unknown as WmSalesNoticeLineVO
|
||||
if (formType.value === 'create') {
|
||||
await WmSalesNoticeLineApi.createSalesNoticeLine(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await WmSalesNoticeLineApi.updateSalesNoticeLine(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
noticeId: undefined,
|
||||
itemId: undefined,
|
||||
batchCode: undefined,
|
||||
quantity: undefined,
|
||||
oqcCheck: true,
|
||||
remark: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="通知单编号" prop="noticeCode">
|
||||
<el-input
|
||||
v-model="queryParams.noticeCode"
|
||||
placeholder="请输入通知单编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="通知单名称" prop="noticeName">
|
||||
<el-input
|
||||
v-model="queryParams.noticeName"
|
||||
placeholder="请输入通知单名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售订单编号" prop="salesOrderCode">
|
||||
<el-input
|
||||
v-model="queryParams.salesOrderCode"
|
||||
placeholder="请输入销售订单编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户" prop="clientId">
|
||||
<el-select
|
||||
v-model="queryParams.clientId"
|
||||
placeholder="请选择客户"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="client in clientList"
|
||||
:key="client.id"
|
||||
:label="client.name"
|
||||
:value="client.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- TODO @AI:前后端的筛选项去掉 salesDate、status -->
|
||||
<el-form-item label="发货日期" prop="salesDate">
|
||||
<el-date-picker
|
||||
v-model="queryParams.salesDate"
|
||||
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_SALES_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-sales-notice:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['mes:wm-sales-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="noticeCode" min-width="160">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="openForm('detail', scope.row.id)">
|
||||
{{ scope.row.noticeCode }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="通知单名称" align="center" prop="noticeName" min-width="150" />
|
||||
<el-table-column label="销售订单编号" align="center" prop="salesOrderCode" min-width="140" />
|
||||
<el-table-column label="客户名称" align="center" prop="clientName" min-width="120" />
|
||||
<el-table-column
|
||||
label="发货日期"
|
||||
align="center"
|
||||
prop="salesDate"
|
||||
:formatter="dateFormatter2"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="收货人" align="center" prop="recipientName" min-width="100" />
|
||||
<el-table-column label="联系方式" align="center" prop="recipientTelephone" min-width="120" />
|
||||
<!-- TODO @AI:收货地址 -->
|
||||
<el-table-column label="单据状态" align="center" prop="status" min-width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.MES_SALES_NOTICE_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="220" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['mes:wm-sales-notice:update']"
|
||||
v-if="scope.row.status === MesWmSalesNoticeStatusEnum.PREPARE"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@click="handleSubmit(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-sales-notice:update']"
|
||||
v-if="scope.row.status === MesWmSalesNoticeStatusEnum.PREPARE"
|
||||
>
|
||||
提交
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['mes:wm-sales-notice:delete']"
|
||||
v-if="scope.row.status === MesWmSalesNoticeStatusEnum.PREPARE"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<SalesNoticeForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter2 } from '@/utils/formatTime'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import download from '@/utils/download'
|
||||
import { WmSalesNoticeApi, WmSalesNoticeVO } from '@/api/mes/wm/salesnotice'
|
||||
import { MdClientApi } from '@/api/mes/md/client'
|
||||
import SalesNoticeForm from './SalesNoticeForm.vue'
|
||||
import { MesWmSalesNoticeStatusEnum } from '@/views/mes/utils/constants'
|
||||
|
||||
defineOptions({ name: 'MesWmSalesNotice' })
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(true)
|
||||
const list = ref<WmSalesNoticeVO[]>([])
|
||||
const total = ref(0)
|
||||
const exportLoading = ref(false)
|
||||
const clientList = ref<any[]>([])
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
noticeCode: undefined,
|
||||
noticeName: undefined,
|
||||
salesOrderCode: undefined,
|
||||
clientId: undefined,
|
||||
salesDate: undefined,
|
||||
status: undefined
|
||||
})
|
||||
const queryFormRef = ref()
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await WmSalesNoticeApi.getSalesNoticePage(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 WmSalesNoticeApi.submitSalesNotice(id)
|
||||
message.success('提交成功')
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await WmSalesNoticeApi.deleteSalesNotice(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportLoading.value = true
|
||||
const data = await WmSalesNoticeApi.exportSalesNotice(queryParams)
|
||||
download.excel(data, '发货通知单.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
clientList.value = await MdClientApi.getClientSimpleList()
|
||||
await getList()
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue