fix(@vben/web-antdv-next): 适配 MES 组件 antdv-next 类型约束

pull/365/head
XuZhiqiang 2026-06-19 10:55:21 +08:00
parent 860a12a7e7
commit 15e274f812
7 changed files with 29 additions and 25 deletions

View File

@ -51,7 +51,7 @@ function handleToday() {
</div>
</div>
</template>
<template #dateFullCellRender="{ current: date }">
<template #fullCellRender="{ date }">
<div class="h-[110px] text-left">
<CalendarDateCell
v-if="date.isSame(currentDate, 'month')"

View File

@ -53,16 +53,17 @@ async function getList() {
}
/** 点击日期:打开假期设置弹窗 */
function handleDayClick(date: Dayjs) {
function handleDayClick(date: unknown) {
const current = dayjs(date as Dayjs);
//
if (!date.isSame(currentDate.value, 'month')) {
if (!current.isSame(currentDate.value, 'month')) {
return;
}
if (!hasAccessByCodes(['mes:cal-holiday:create'])) {
message.warning('没有假期设置权限');
return;
}
holidayFormModalApi.setData({ day: date.format('YYYY-MM-DD') }).open();
holidayFormModalApi.setData({ day: current.format('YYYY-MM-DD') }).open();
}
/** 切换到上月 */
@ -161,7 +162,7 @@ onMounted(getList);
</div>
</div>
</template>
<template #dateFullCellRender="{ current: date }">
<template #fullCellRender="{ date }">
<div
class="hover:bg-muted/50 h-[84px] cursor-pointer p-2 text-left transition"
@click.stop="handleDayClick(date)"

View File

@ -105,7 +105,7 @@ const processId = computed(() => formData.value?.id);
<Form class="mx-4" />
<!-- 编辑/详情模式下展示工序操作步骤子表新增模式下隐藏 -->
<template v-if="processId">
<Divider class="!my-3" orientation="left">操作步骤</Divider>
<Divider class="!my-3" title-placement="start">操作步骤</Divider>
<div class="mx-4">
<ContentList :form-type="formType" :process-id="processId" />
</div>

View File

@ -27,7 +27,7 @@ const props = defineProps<{
}>();
const processList = ref<MesProRouteProcessApi.RouteProcess[]>([]); // Tab
const activeProcessId = ref<number>(); // Tab
const activeProcessId = ref<string>(); // Tab
const list = ref<MesProRouteProductBomApi.RouteProductBom[]>([]); // BOM
const [BomFormModal, bomFormModalApi] = useVbenModal({
@ -53,7 +53,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
async function loadProcessList() {
processList.value = (await getRouteProcessListByRoute(props.routeId)) || [];
if (processList.value.length > 0) {
activeProcessId.value = processList.value[0]!.processId;
activeProcessId.value = String(processList.value[0]!.processId);
await getList();
} else {
activeProcessId.value = undefined;
@ -64,13 +64,14 @@ async function loadProcessList() {
/** 加载当前工序下的 BOM 列表 */
async function getList() {
if (!activeProcessId.value) {
const processId = Number(activeProcessId.value);
if (!processId) {
return;
}
gridApi.setLoading(true);
try {
list.value = await getRouteProductBomList({
processId: activeProcessId.value,
processId,
productId: props.productId,
routeId: props.routeId,
});
@ -86,9 +87,10 @@ function handleCreate() {
message.warning('请先选择工序');
return;
}
const processId = Number(activeProcessId.value);
bomFormModalApi
.setData({
processId: activeProcessId.value,
processId,
productId: props.productId,
routeId: props.routeId,
})
@ -100,7 +102,7 @@ function handleEdit(row: MesProRouteProductBomApi.RouteProductBom) {
bomFormModalApi
.setData({
id: row.id,
processId: activeProcessId.value!,
processId: Number(activeProcessId.value),
productId: props.productId,
routeId: props.routeId,
})
@ -130,7 +132,7 @@ watch(
<Tabs v-model:active-key="activeProcessId" @change="getList">
<TabPane
v-for="item in processList"
:key="item.processId"
:key="String(item.processId)"
:tab="item.processName"
/>
</Tabs>

View File

@ -112,7 +112,7 @@ const [Modal, modalApi] = useVbenModal({
<Form class="mx-4" />
<!-- 编辑模式下展示产品 BOM 子表新增模式下隐藏 -->
<template v-if="formData?.id && formData?.itemId">
<Divider class="!my-3" orientation="left">产品 BOM 配置</Divider>
<Divider class="!my-3" title-placement="start">产品 BOM 配置</Divider>
<div class="mx-4">
<ProductBomList
:route-id="formData.routeId!"

View File

@ -26,6 +26,11 @@ const isReadonly = computed(() => formType.value === 'detail'); // 详情态只
const getTitle = computed(() =>
formType.value === 'detail' ? '工单详情' : '生产排产',
);
const routeProcessStepItems = computed(() =>
routeProcessList.value.map((item) => ({
title: item.processName,
})),
);
const [Form, formApi] = useVbenForm({
commonConfig: {
@ -111,15 +116,10 @@ const [Modal, modalApi] = useVbenModal({
<Steps
v-model:current="activeProcessStep"
class="my-4 px-4"
:items="routeProcessStepItems"
size="small"
type="navigation"
>
<Steps.Step
v-for="rp in routeProcessList"
:key="rp.processId"
:title="rp.processName"
/>
</Steps>
/>
<Card
v-for="(rp, index) in routeProcessList"
v-show="activeProcessStep === index"

View File

@ -77,7 +77,7 @@ function handleQualityStatusChange(value?: number) {
emit('update:modelValue', undefined);
emit('valueChange', {
valueId: undefined,
valueCode: value === null ? '' : String(value),
valueCode: value === undefined || value === null ? '' : String(value),
valueName: selected?.label || '',
});
}
@ -109,14 +109,15 @@ async function loadCascadeData() {
: undefined;
return;
}
if (props.modelValue === null) {
const valueId = props.modelValue;
if (valueId === undefined || valueId === null) {
return;
}
if (props.type === MesWmStockTakingParamTypeEnum.LOCATION) {
const location = await getWarehouseLocation(props.modelValue);
const location = await getWarehouseLocation(valueId);
locationWarehouseId.value = location?.warehouseId;
} else if (props.type === MesWmStockTakingParamTypeEnum.AREA) {
const area = await getWarehouseArea(props.modelValue);
const area = await getWarehouseArea(valueId);
areaWarehouseId.value = area?.warehouseId;
areaLocationId.value = area?.locationId;
}