feat(mes):统一 dv、cal、md 的代码规范
parent
8ab0c53011
commit
3c592887b9
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesCalPlanApi } from '#/api/mes/cal/plan';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -89,6 +89,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【排班】排班计划、排班日历"
|
||||
url="https://doc.iocoder.cn/mes/cal/calendar/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="排班计划列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesCalTeamApi } from '#/api/mes/cal/team';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -93,6 +93,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【排班】班组设置、节假日设置"
|
||||
url="https://doc.iocoder.cn/mes/cal/team/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="班组列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|||
import type { MesDvCheckPlanApi } from '#/api/mes/dv/checkplan';
|
||||
import type { ActionItem } from '#/components/table-action/typing';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -156,6 +156,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检保养项目、点检保养方案"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-plan/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="点检保养方案列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ const formMode = ref<FormMode>('create');
|
|||
const subTabsName = ref('machinery');
|
||||
const formData = ref<MesDvCheckPlanApi.CheckPlan>();
|
||||
const isDetail = computed(() => formMode.value === 'detail');
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增点检保养方案', update: '修改点检保养方案', detail: '查看点检保养方案' })[
|
||||
formMode.value
|
||||
],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看点检保养方案';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检保养方案' : '新增点检保养方案';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -43,6 +43,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi) });
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvCheckRecordApi } from '#/api/mes/dv/checkrecord';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -92,6 +92,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检记录、保养记录、维修单"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-record/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="点检记录列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -29,10 +29,12 @@ const isDetail = computed(() => formMode.value === 'detail');
|
|||
const canSubmit = computed(
|
||||
() => formMode.value === 'update' && formData.value?.status === MesDvCheckRecordStatusEnum.DRAFT,
|
||||
);
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增点检记录', update: '修改点检记录', detail: '查看点检记录' })[formMode.value],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看点检记录';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检记录' : '新增点检记录';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import type { MesDvMachineryTypeApi } from '#/api/mes/dv/machinery/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -115,6 +115,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】设备类型、设备台账"
|
||||
url="https://doc.iocoder.cn/mes/dv/device/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<ImportModal @success="handleRefresh" />
|
||||
<div class="flex h-full w-full">
|
||||
|
|
|
|||
|
|
@ -26,9 +26,12 @@ const subTabsName = ref('check'); // 当前资源页签
|
|||
const formData = ref<MesDvMachineryApi.Machinery>();
|
||||
const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详情弹窗
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(
|
||||
() => ({ create: '新增设备', update: '修改设备', detail: '查看设备' })[formMode.value],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看设备';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改设备' : '新增设备';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -43,6 +46,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi, formMode) });
|
||||
|
||||
/** 查看设备条码 */
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { MesDvMachineryTypeApi } from '#/api/mes/dv/machinery/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
|
@ -35,13 +35,18 @@ function handleRefresh() {
|
|||
}
|
||||
|
||||
/** 创建设备类型 */
|
||||
function handleCreate(parentId = 0) {
|
||||
formModalApi.setData({ parentId, type: 'create' }).open();
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 添加下级设备类型 */
|
||||
function handleAppend(row: MesDvMachineryTypeApi.MachineryType) {
|
||||
formModalApi.setData({ parentId: row.id }).open();
|
||||
}
|
||||
|
||||
/** 编辑设备类型 */
|
||||
function handleEdit(row: MesDvMachineryTypeApi.MachineryType) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除设备类型 */
|
||||
|
|
@ -94,6 +99,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】设备类型、设备台账"
|
||||
url="https://doc.iocoder.cn/mes/dv/device/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="设备类型列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
@ -104,7 +115,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['mes:dv-machinery-type:create'],
|
||||
onClick: handleCreate.bind(null, 0),
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: isExpanded ? '收缩' : '展开',
|
||||
|
|
@ -122,7 +133,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
type: 'link',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['mes:dv-machinery-type:create'],
|
||||
onClick: handleCreate.bind(null, row.id),
|
||||
onClick: handleAppend.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
|
|
|
|||
|
|
@ -17,10 +17,13 @@ import { $t } from '#/locales';
|
|||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<'create' | 'update'>('create'); // 表单模式
|
||||
const getTitle = computed(() => (formMode.value === 'create' ? '新增设备类型' : '修改设备类型'));
|
||||
const formData = ref<MesDvMachineryTypeApi.MachineryType>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['设备类型'])
|
||||
: $t('ui.actionTitle.create', ['设备类型']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -48,7 +51,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MesDvMachineryTypeApi.MachineryType;
|
||||
try {
|
||||
await (data.id ? updateMachineryType(data) : createMachineryType(data));
|
||||
await (formData.value?.id
|
||||
? updateMachineryType(data)
|
||||
: createMachineryType(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
|
|
@ -58,18 +64,25 @@ const [Modal, modalApi] = useVbenModal({
|
|||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
await formApi.resetForm();
|
||||
const data = modalApi.getData<{ id?: number; parentId?: number; type?: 'create' | 'update' }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
if (!data?.id) {
|
||||
await formApi.setValues({ parentId: data?.parentId ?? 0 });
|
||||
// 加载数据
|
||||
const data = modalApi.getData<MesDvMachineryTypeApi.MachineryType>();
|
||||
if (!data || !data.id) {
|
||||
formData.value = data || undefined;
|
||||
if (data) {
|
||||
// 设置上级类型
|
||||
await formApi.setValues(data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
await formApi.setValues(await getMachineryType(data.id));
|
||||
formData.value = await getMachineryType(data.id);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvMaintenRecordApi } from '#/api/mes/dv/maintenrecord';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -96,6 +96,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检记录、保养记录、维修单"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-record/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="保养记录列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -32,10 +32,12 @@ const canSubmit = computed(
|
|||
() =>
|
||||
formMode.value === 'update' && formData.value?.status === MesDvMaintenRecordStatusEnum.PREPARE,
|
||||
);
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增保养记录', update: '修改保养记录', detail: '查看保养记录' })[formMode.value],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看保养记录';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改保养记录' : '新增保养记录';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvRepairApi } from '#/api/mes/dv/repair';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -98,6 +98,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检记录、保养记录、维修单"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-record/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="维修工单列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi) });
|
||||
|
||||
/** 提交维修工单 */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvSubjectApi } from '#/api/mes/dv/subject';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
|
@ -92,6 +92,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检保养项目、点检保养方案"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-plan/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="点检保养项目列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ type FormMode = 'create' | 'detail' | 'update';
|
|||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<FormMode>('create'); // 表单模式
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增点检保养项目', update: '修改点检保养项目', detail: '查看点检保养项目' })[
|
||||
formMode.value
|
||||
],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看点检保养项目';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检保养项目' : '新增点检保养项目';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -38,6 +38,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi) });
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
|
|
|
|||
|
|
@ -24,12 +24,10 @@ const formData = ref<MesMdClientApi.Client>();
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增客户',
|
||||
update: '修改客户',
|
||||
detail: '查看客户',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看客户';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改客户' : '新增客户';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
|
|||
|
|
@ -29,12 +29,10 @@ const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增物料/产品',
|
||||
update: '修改物料/产品',
|
||||
detail: '查看物料/产品',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看物料/产品';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改物料/产品' : '新增物料/产品';
|
||||
});
|
||||
const currentItemOrProduct = computed(
|
||||
() => formData.value?.itemOrProduct || '',
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
|
|
@ -102,6 +102,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【基础】物料产品、分类、计量单位"
|
||||
url="https://doc.iocoder.cn/mes/md/product/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="物料分类列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -32,12 +32,10 @@ const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增工作站',
|
||||
update: '修改工作站',
|
||||
detail: '查看工作站',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看工作站';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改工作站' : '新增工作站';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
|
|||
|
|
@ -28,12 +28,10 @@ const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增车间',
|
||||
update: '修改车间',
|
||||
detail: '查看车间',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看车间';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改车间' : '新增车间';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@ export namespace MesDvMachineryApi {
|
|||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
|
||||
/** 设备导入结果 */
|
||||
export interface MachineryImportRespVO {
|
||||
createCodes?: string[]; // 新增成功的设备编码
|
||||
failureCodes?: Record<string, string>; // 导入失败的设备编码及原因
|
||||
updateCodes?: string[]; // 更新成功的设备编码
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询设备分页 */
|
||||
|
|
@ -43,3 +50,36 @@ export function getMachinery(id: number) {
|
|||
`/mes/dv/machinery/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增设备 */
|
||||
export function createMachinery(data: MesDvMachineryApi.Machinery) {
|
||||
return requestClient.post('/mes/dv/machinery/create', data);
|
||||
}
|
||||
|
||||
/** 修改设备 */
|
||||
export function updateMachinery(data: MesDvMachineryApi.Machinery) {
|
||||
return requestClient.put('/mes/dv/machinery/update', data);
|
||||
}
|
||||
|
||||
/** 删除设备 */
|
||||
export function deleteMachinery(id: number) {
|
||||
return requestClient.delete(`/mes/dv/machinery/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出设备 */
|
||||
export function exportMachinery(params: any) {
|
||||
return requestClient.download('/mes/dv/machinery/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 下载设备导入模板 */
|
||||
export function importMachineryTemplate() {
|
||||
return requestClient.download('/mes/dv/machinery/get-import-template');
|
||||
}
|
||||
|
||||
/** 导入设备 */
|
||||
export function importMachinery(file: File, updateSupport: boolean) {
|
||||
return requestClient.upload<MesDvMachineryApi.MachineryImportRespVO>(
|
||||
`/mes/dv/machinery/import?updateSupport=${updateSupport}`,
|
||||
{ file },
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
<script lang="ts" setup>
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import type { CalendarDateType } from 'element-plus';
|
||||
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
|
|
@ -26,6 +24,14 @@ const holidaySet = ref(new Set<string>()); // 节假日日期集合
|
|||
const lastFetchedMonth = ref(''); // 上次加载月份
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
/** ElCalendar v-model 桥接:内部用 Dayjs,组件需要 Date */
|
||||
const calendarValue = computed({
|
||||
get: () => currentDate.value.toDate(),
|
||||
set: (val: Date) => {
|
||||
currentDate.value = dayjs(val);
|
||||
},
|
||||
});
|
||||
|
||||
const [HolidayFormModal, holidayFormModalApi] = useVbenModal({
|
||||
connectedComponent: HolidayForm,
|
||||
destroyOnClose: true,
|
||||
|
|
@ -55,7 +61,7 @@ async function getList() {
|
|||
}
|
||||
|
||||
/** 点击日期:打开假期设置弹窗 */
|
||||
function handleDayClick(data: { day: string; type: CalendarDateType }) {
|
||||
function handleDayClick(data: { date: Date; day: string; type: string }) {
|
||||
// 非当前月日期,不处理(避免切换月份)
|
||||
if (data.type !== 'current-month') {
|
||||
return;
|
||||
|
|
@ -130,7 +136,7 @@ onMounted(getList);
|
|||
</template>
|
||||
<HolidayFormModal @success="getList" />
|
||||
<div class="bg-card overflow-hidden rounded-md">
|
||||
<ElCalendar v-model="currentDate" class="mes-holiday-calendar">
|
||||
<ElCalendar v-model="calendarValue" class="mes-holiday-calendar">
|
||||
<template #date-cell="{ data }">
|
||||
<div
|
||||
class="hover:bg-muted/50 h-full cursor-pointer p-1 text-left transition"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesCalPlanApi } from '#/api/mes/cal/plan';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -86,6 +86,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【排班】排班计划、排班日历"
|
||||
url="https://doc.iocoder.cn/mes/cal/calendar/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="排班计划列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesCalTeamApi } from '#/api/mes/cal/team';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -90,6 +90,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【排班】班组设置、节假日设置"
|
||||
url="https://doc.iocoder.cn/mes/cal/team/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="班组列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|||
import type { MesDvCheckPlanApi } from '#/api/mes/dv/checkplan';
|
||||
import type { ActionItem } from '#/components/table-action/typing';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -156,6 +156,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检保养项目、点检保养方案"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-plan/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="点检保养方案列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ const formMode = ref<FormMode>('create');
|
|||
const subTabsName = ref('machinery');
|
||||
const formData = ref<MesDvCheckPlanApi.CheckPlan>();
|
||||
const isDetail = computed(() => formMode.value === 'detail');
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增点检保养方案', update: '修改点检保养方案', detail: '查看点检保养方案' })[
|
||||
formMode.value
|
||||
],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看点检保养方案';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检保养方案' : '新增点检保养方案';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -43,6 +43,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi) });
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvCheckRecordApi } from '#/api/mes/dv/checkrecord';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -91,6 +91,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检记录、保养记录、维修单"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-record/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="点检记录列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -29,10 +29,12 @@ const isDetail = computed(() => formMode.value === 'detail');
|
|||
const canSubmit = computed(
|
||||
() => formMode.value === 'update' && formData.value?.status === MesDvCheckRecordStatusEnum.DRAFT,
|
||||
);
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增点检记录', update: '修改点检记录', detail: '查看点检记录' })[formMode.value],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看点检记录';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检记录' : '新增点检记录';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import type { MesDvMachineryTypeApi } from '#/api/mes/dv/machinery/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -112,6 +112,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】设备类型、设备台账"
|
||||
url="https://doc.iocoder.cn/mes/dv/device/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<ImportModal @success="handleRefresh" />
|
||||
<div class="flex h-full w-full">
|
||||
|
|
|
|||
|
|
@ -26,9 +26,12 @@ const subTabsName = ref('check'); // 当前资源页签
|
|||
const formData = ref<MesDvMachineryApi.Machinery>();
|
||||
const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详情弹窗
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(
|
||||
() => ({ create: '新增设备', update: '修改设备', detail: '查看设备' })[formMode.value],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看设备';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改设备' : '新增设备';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -43,6 +46,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi, formMode) });
|
||||
|
||||
/** 查看设备条码 */
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { MesDvMachineryTypeApi } from '#/api/mes/dv/machinery/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -35,13 +35,18 @@ function handleRefresh() {
|
|||
}
|
||||
|
||||
/** 创建设备类型 */
|
||||
function handleCreate(parentId = 0) {
|
||||
formModalApi.setData({ parentId, type: 'create' }).open();
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 添加下级设备类型 */
|
||||
function handleAppend(row: MesDvMachineryTypeApi.MachineryType) {
|
||||
formModalApi.setData({ parentId: row.id }).open();
|
||||
}
|
||||
|
||||
/** 编辑设备类型 */
|
||||
function handleEdit(row: MesDvMachineryTypeApi.MachineryType) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除设备类型 */
|
||||
|
|
@ -93,6 +98,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】设备类型、设备台账"
|
||||
url="https://doc.iocoder.cn/mes/dv/device/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="设备类型列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
@ -103,7 +114,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['mes:dv-machinery-type:create'],
|
||||
onClick: handleCreate.bind(null, 0),
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: isExpanded ? '收缩' : '展开',
|
||||
|
|
@ -122,7 +133,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
link: true,
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['mes:dv-machinery-type:create'],
|
||||
onClick: handleCreate.bind(null, row.id),
|
||||
onClick: handleAppend.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
|
|
|
|||
|
|
@ -17,10 +17,13 @@ import { $t } from '#/locales';
|
|||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<'create' | 'update'>('create'); // 表单模式
|
||||
const getTitle = computed(() => (formMode.value === 'create' ? '新增设备类型' : '修改设备类型'));
|
||||
const formData = ref<MesDvMachineryTypeApi.MachineryType>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['设备类型'])
|
||||
: $t('ui.actionTitle.create', ['设备类型']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -48,7 +51,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MesDvMachineryTypeApi.MachineryType;
|
||||
try {
|
||||
await (data.id ? updateMachineryType(data) : createMachineryType(data));
|
||||
await (formData.value?.id
|
||||
? updateMachineryType(data)
|
||||
: createMachineryType(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
|
|
@ -58,18 +64,25 @@ const [Modal, modalApi] = useVbenModal({
|
|||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
await formApi.resetForm();
|
||||
const data = modalApi.getData<{ id?: number; parentId?: number; type?: 'create' | 'update' }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
if (!data?.id) {
|
||||
await formApi.setValues({ parentId: data?.parentId ?? 0 });
|
||||
// 加载数据
|
||||
const data = modalApi.getData<MesDvMachineryTypeApi.MachineryType>();
|
||||
if (!data || !data.id) {
|
||||
formData.value = data || undefined;
|
||||
if (data) {
|
||||
// 设置上级类型
|
||||
await formApi.setValues(data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
await formApi.setValues(await getMachineryType(data.id));
|
||||
formData.value = await getMachineryType(data.id);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvMaintenRecordApi } from '#/api/mes/dv/maintenrecord';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -95,6 +95,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检记录、保养记录、维修单"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-record/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="保养记录列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -32,10 +32,12 @@ const canSubmit = computed(
|
|||
() =>
|
||||
formMode.value === 'update' && formData.value?.status === MesDvMaintenRecordStatusEnum.PREPARE,
|
||||
);
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增保养记录', update: '修改保养记录', detail: '查看保养记录' })[formMode.value],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看保养记录';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改保养记录' : '新增保养记录';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvRepairApi } from '#/api/mes/dv/repair';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -95,6 +95,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
</script>
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检记录、保养记录、维修单"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-record/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="维修工单列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi) });
|
||||
|
||||
/** 提交维修工单 */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvSubjectApi } from '#/api/mes/dv/subject';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
|
@ -89,6 +89,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【设备】点检保养项目、点检保养方案"
|
||||
url="https://doc.iocoder.cn/mes/dv/check-plan/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="点检保养项目列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ type FormMode = 'create' | 'detail' | 'update';
|
|||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<FormMode>('create'); // 表单模式
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(
|
||||
() =>
|
||||
({ create: '新增点检保养项目', update: '修改点检保养项目', detail: '查看点检保养项目' })[
|
||||
formMode.value
|
||||
],
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看点检保养项目';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检保养项目' : '新增点检保养项目';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
|
|
@ -38,6 +38,8 @@ const [Form, formApi] = useVbenForm({
|
|||
schema: [],
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi) });
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
|
|
|
|||
|
|
@ -24,12 +24,10 @@ const formData = ref<MesMdClientApi.Client>();
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增客户',
|
||||
update: '修改客户',
|
||||
detail: '查看客户',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看客户';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改客户' : '新增客户';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
|
|||
|
|
@ -29,12 +29,10 @@ const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增物料/产品',
|
||||
update: '修改物料/产品',
|
||||
detail: '查看物料/产品',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看物料/产品';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改物料/产品' : '新增物料/产品';
|
||||
});
|
||||
const currentItemOrProduct = computed(
|
||||
() => formData.value?.itemOrProduct || '',
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
|
|||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElLoading, ElMessage } from 'element-plus';
|
||||
|
||||
|
|
@ -101,6 +101,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【基础】物料产品、分类、计量单位"
|
||||
url="https://doc.iocoder.cn/mes/md/product/"
|
||||
/>
|
||||
</template>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="物料分类列表">
|
||||
<template #toolbar-tools>
|
||||
|
|
|
|||
|
|
@ -32,12 +32,10 @@ const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增工作站',
|
||||
update: '修改工作站',
|
||||
detail: '查看工作站',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看工作站';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改工作站' : '新增工作站';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
|
|||
|
|
@ -28,12 +28,10 @@ const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详
|
|||
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
const titles: Record<FormMode, string> = {
|
||||
create: '新增车间',
|
||||
update: '修改车间',
|
||||
detail: '查看车间',
|
||||
};
|
||||
return titles[formMode.value];
|
||||
if (formMode.value === 'detail') {
|
||||
return '查看车间';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改车间' : '新增车间';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
|
|||
Loading…
Reference in New Issue