fix(@vben/web-antdv-next): 适配 MES 组件 antdv-next 类型约束
parent
860a12a7e7
commit
15e274f812
|
|
@ -51,7 +51,7 @@ function handleToday() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #dateFullCellRender="{ current: date }">
|
<template #fullCellRender="{ date }">
|
||||||
<div class="h-[110px] text-left">
|
<div class="h-[110px] text-left">
|
||||||
<CalendarDateCell
|
<CalendarDateCell
|
||||||
v-if="date.isSame(currentDate, 'month')"
|
v-if="date.isSame(currentDate, 'month')"
|
||||||
|
|
|
||||||
|
|
@ -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;
|
return;
|
||||||
}
|
}
|
||||||
if (!hasAccessByCodes(['mes:cal-holiday:create'])) {
|
if (!hasAccessByCodes(['mes:cal-holiday:create'])) {
|
||||||
message.warning('没有假期设置权限');
|
message.warning('没有假期设置权限');
|
||||||
return;
|
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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #dateFullCellRender="{ current: date }">
|
<template #fullCellRender="{ date }">
|
||||||
<div
|
<div
|
||||||
class="hover:bg-muted/50 h-[84px] cursor-pointer p-2 text-left transition"
|
class="hover:bg-muted/50 h-[84px] cursor-pointer p-2 text-left transition"
|
||||||
@click.stop="handleDayClick(date)"
|
@click.stop="handleDayClick(date)"
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ const processId = computed(() => formData.value?.id);
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
<!-- 编辑/详情模式下展示工序操作步骤子表,新增模式下隐藏 -->
|
<!-- 编辑/详情模式下展示工序操作步骤子表,新增模式下隐藏 -->
|
||||||
<template v-if="processId">
|
<template v-if="processId">
|
||||||
<Divider class="!my-3" orientation="left">操作步骤</Divider>
|
<Divider class="!my-3" title-placement="start">操作步骤</Divider>
|
||||||
<div class="mx-4">
|
<div class="mx-4">
|
||||||
<ContentList :form-type="formType" :process-id="processId" />
|
<ContentList :form-type="formType" :process-id="processId" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const processList = ref<MesProRouteProcessApi.RouteProcess[]>([]); // 工序列表(用于 Tab)
|
const processList = ref<MesProRouteProcessApi.RouteProcess[]>([]); // 工序列表(用于 Tab)
|
||||||
const activeProcessId = ref<number>(); // 当前选中的工序 Tab
|
const activeProcessId = ref<string>(); // 当前选中的工序 Tab
|
||||||
const list = ref<MesProRouteProductBomApi.RouteProductBom[]>([]); // 当前工序下的 BOM 列表
|
const list = ref<MesProRouteProductBomApi.RouteProductBom[]>([]); // 当前工序下的 BOM 列表
|
||||||
|
|
||||||
const [BomFormModal, bomFormModalApi] = useVbenModal({
|
const [BomFormModal, bomFormModalApi] = useVbenModal({
|
||||||
|
|
@ -53,7 +53,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
async function loadProcessList() {
|
async function loadProcessList() {
|
||||||
processList.value = (await getRouteProcessListByRoute(props.routeId)) || [];
|
processList.value = (await getRouteProcessListByRoute(props.routeId)) || [];
|
||||||
if (processList.value.length > 0) {
|
if (processList.value.length > 0) {
|
||||||
activeProcessId.value = processList.value[0]!.processId;
|
activeProcessId.value = String(processList.value[0]!.processId);
|
||||||
await getList();
|
await getList();
|
||||||
} else {
|
} else {
|
||||||
activeProcessId.value = undefined;
|
activeProcessId.value = undefined;
|
||||||
|
|
@ -64,13 +64,14 @@ async function loadProcessList() {
|
||||||
|
|
||||||
/** 加载当前工序下的 BOM 列表 */
|
/** 加载当前工序下的 BOM 列表 */
|
||||||
async function getList() {
|
async function getList() {
|
||||||
if (!activeProcessId.value) {
|
const processId = Number(activeProcessId.value);
|
||||||
|
if (!processId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gridApi.setLoading(true);
|
gridApi.setLoading(true);
|
||||||
try {
|
try {
|
||||||
list.value = await getRouteProductBomList({
|
list.value = await getRouteProductBomList({
|
||||||
processId: activeProcessId.value,
|
processId,
|
||||||
productId: props.productId,
|
productId: props.productId,
|
||||||
routeId: props.routeId,
|
routeId: props.routeId,
|
||||||
});
|
});
|
||||||
|
|
@ -86,9 +87,10 @@ function handleCreate() {
|
||||||
message.warning('请先选择工序');
|
message.warning('请先选择工序');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const processId = Number(activeProcessId.value);
|
||||||
bomFormModalApi
|
bomFormModalApi
|
||||||
.setData({
|
.setData({
|
||||||
processId: activeProcessId.value,
|
processId,
|
||||||
productId: props.productId,
|
productId: props.productId,
|
||||||
routeId: props.routeId,
|
routeId: props.routeId,
|
||||||
})
|
})
|
||||||
|
|
@ -100,7 +102,7 @@ function handleEdit(row: MesProRouteProductBomApi.RouteProductBom) {
|
||||||
bomFormModalApi
|
bomFormModalApi
|
||||||
.setData({
|
.setData({
|
||||||
id: row.id,
|
id: row.id,
|
||||||
processId: activeProcessId.value!,
|
processId: Number(activeProcessId.value),
|
||||||
productId: props.productId,
|
productId: props.productId,
|
||||||
routeId: props.routeId,
|
routeId: props.routeId,
|
||||||
})
|
})
|
||||||
|
|
@ -130,7 +132,7 @@ watch(
|
||||||
<Tabs v-model:active-key="activeProcessId" @change="getList">
|
<Tabs v-model:active-key="activeProcessId" @change="getList">
|
||||||
<TabPane
|
<TabPane
|
||||||
v-for="item in processList"
|
v-for="item in processList"
|
||||||
:key="item.processId"
|
:key="String(item.processId)"
|
||||||
:tab="item.processName"
|
:tab="item.processName"
|
||||||
/>
|
/>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
<!-- 编辑模式下展示产品 BOM 子表,新增模式下隐藏 -->
|
<!-- 编辑模式下展示产品 BOM 子表,新增模式下隐藏 -->
|
||||||
<template v-if="formData?.id && formData?.itemId">
|
<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">
|
<div class="mx-4">
|
||||||
<ProductBomList
|
<ProductBomList
|
||||||
:route-id="formData.routeId!"
|
:route-id="formData.routeId!"
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@ const isReadonly = computed(() => formType.value === 'detail'); // 详情态只
|
||||||
const getTitle = computed(() =>
|
const getTitle = computed(() =>
|
||||||
formType.value === 'detail' ? '工单详情' : '生产排产',
|
formType.value === 'detail' ? '工单详情' : '生产排产',
|
||||||
);
|
);
|
||||||
|
const routeProcessStepItems = computed(() =>
|
||||||
|
routeProcessList.value.map((item) => ({
|
||||||
|
title: item.processName,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
|
|
@ -111,15 +116,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
<Steps
|
<Steps
|
||||||
v-model:current="activeProcessStep"
|
v-model:current="activeProcessStep"
|
||||||
class="my-4 px-4"
|
class="my-4 px-4"
|
||||||
|
:items="routeProcessStepItems"
|
||||||
size="small"
|
size="small"
|
||||||
type="navigation"
|
type="navigation"
|
||||||
>
|
/>
|
||||||
<Steps.Step
|
|
||||||
v-for="rp in routeProcessList"
|
|
||||||
:key="rp.processId"
|
|
||||||
:title="rp.processName"
|
|
||||||
/>
|
|
||||||
</Steps>
|
|
||||||
<Card
|
<Card
|
||||||
v-for="(rp, index) in routeProcessList"
|
v-for="(rp, index) in routeProcessList"
|
||||||
v-show="activeProcessStep === index"
|
v-show="activeProcessStep === index"
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ function handleQualityStatusChange(value?: number) {
|
||||||
emit('update:modelValue', undefined);
|
emit('update:modelValue', undefined);
|
||||||
emit('valueChange', {
|
emit('valueChange', {
|
||||||
valueId: undefined,
|
valueId: undefined,
|
||||||
valueCode: value === null ? '' : String(value),
|
valueCode: value === undefined || value === null ? '' : String(value),
|
||||||
valueName: selected?.label || '',
|
valueName: selected?.label || '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -109,14 +109,15 @@ async function loadCascadeData() {
|
||||||
: undefined;
|
: undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (props.modelValue === null) {
|
const valueId = props.modelValue;
|
||||||
|
if (valueId === undefined || valueId === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (props.type === MesWmStockTakingParamTypeEnum.LOCATION) {
|
if (props.type === MesWmStockTakingParamTypeEnum.LOCATION) {
|
||||||
const location = await getWarehouseLocation(props.modelValue);
|
const location = await getWarehouseLocation(valueId);
|
||||||
locationWarehouseId.value = location?.warehouseId;
|
locationWarehouseId.value = location?.warehouseId;
|
||||||
} else if (props.type === MesWmStockTakingParamTypeEnum.AREA) {
|
} else if (props.type === MesWmStockTakingParamTypeEnum.AREA) {
|
||||||
const area = await getWarehouseArea(props.modelValue);
|
const area = await getWarehouseArea(valueId);
|
||||||
areaWarehouseId.value = area?.warehouseId;
|
areaWarehouseId.value = area?.warehouseId;
|
||||||
areaLocationId.value = area?.locationId;
|
areaLocationId.value = area?.locationId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue