✨ feat(mes): 添加入库日期和状态筛选功能
在 MES 采购入库单请求中新增入库日期字段,并在数据查询中支持根据入库日期进行筛选。此功能提升了用户在管理入库单时的灵活性和准确性。pull/871/MERGE
parent
b32770d77e
commit
6e56876c3c
|
|
@ -34,13 +34,83 @@
|
|||
/>
|
||||
</div>
|
||||
|
||||
<ArrivalNoticeLineForm ref="formRef" @success="getList" :noticeId="noticeId" />
|
||||
<!-- 添加/编辑行弹窗 -->
|
||||
<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 { DICT_TYPE } from '@/utils/dict'
|
||||
import { WmArrivalNoticeLineApi, WmArrivalNoticeLineVO } from '@/api/mes/wm/arrivalnotice/line'
|
||||
import ArrivalNoticeLineForm from './line/ArrivalNoticeLineForm.vue'
|
||||
import { MdItemApi } from '@/api/mes/md/item'
|
||||
|
||||
defineOptions({ name: 'ArrivalNoticeLineList' })
|
||||
|
||||
|
|
@ -51,6 +121,7 @@ const props = defineProps<{
|
|||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
// ==================== 列表 ====================
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const list = ref<WmArrivalNoticeLineVO[]>([]) // 行列表
|
||||
const total = ref(0) // 列表的总页数
|
||||
|
|
@ -73,12 +144,6 @@ const getList = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
/** 新增/修改 */
|
||||
const formRef = ref() // 表单弹窗
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
|
|
@ -89,6 +154,78 @@ const handleDelete = async (id: number) => {
|
|||
} catch {}
|
||||
}
|
||||
|
||||
// ==================== 添加/编辑表单 ====================
|
||||
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() // 表单 Ref
|
||||
|
||||
/** 打开表单弹窗 */
|
||||
const openForm = 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
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
|
||||
await getList()
|
||||
} 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()
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
|
|
|
|||
|
|
@ -1,157 +0,0 @@
|
|||
<!-- 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>
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
<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="iqcCheckFlag" min-width="90">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.iqcCheckFlag" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合格数量" align="center" prop="qualifiedQuantity" min-width="100" />
|
||||
<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 { DICT_TYPE } from '@/utils/dict'
|
||||
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>
|
||||
Loading…
Reference in New Issue