feat(iot):md 模块,支持生成

pull/345/head
YunaiV 2026-05-21 18:48:57 +08:00
parent 66843f2392
commit e7361a60ec
13 changed files with 48 additions and 32 deletions

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdClientApi } from '#/api/mes/md/client';
@ -14,7 +14,7 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改客户的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemApi } from '#/api/mes/md/item';
import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom';
@ -17,7 +17,7 @@ import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改物料产品的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
@ -19,7 +19,7 @@ import {
} from '#/views/mes/utils/constants';
/** 新增/修改物料分类的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdVendorApi } from '#/api/mes/md/vendor';
@ -14,7 +14,7 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改供应商的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkstationApi } from '#/api/mes/md/workstation';
@ -20,7 +20,7 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
import { MdWorkshopSelect } from './components';
/** 新增/修改工作站的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',
@ -37,6 +37,12 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
componentProps: {
placeholder: '请输入工作站编码',
},
dependencies: {
triggerFields: ['id'],
componentProps: (values) => ({
disabled: !!values.id,
}),
},
rules: 'required',
suffix: () =>
h(
@ -205,6 +211,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所在车间',
component: markRaw(MdWorkshopSelect),
componentProps: {
allowClear: true,
placeholder: '请选择车间',
},
},
@ -213,6 +220,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所属工序',
component: markRaw(ProProcessSelect),
componentProps: {
allowClear: true,
placeholder: '请选择工序',
},
},

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkshopApi } from '#/api/mes/md/workstation/workshop';
@ -15,7 +15,7 @@ import { getSimpleUserList } from '#/api/system/user';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改车间的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',
@ -55,7 +55,7 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
}
},
},
{ default: () => '自动生成' },
{ default: () => '生成' },
),
},
{

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdClientApi } from '#/api/mes/md/client';
@ -14,7 +14,7 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改客户的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemApi } from '#/api/mes/md/item';
import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom';
@ -17,7 +17,7 @@ import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改物料产品的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
@ -19,7 +19,7 @@ import {
} from '#/views/mes/utils/constants';
/** 新增/修改物料分类的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdVendorApi } from '#/api/mes/md/vendor';
@ -14,7 +14,7 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改供应商的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',

View File

@ -24,12 +24,12 @@ const formData = ref<MesMdVendorApi.Vendor>();
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 $t('ui.actionTitle.view', ['供应商']);
}
return formMode.value === 'update'
? $t('ui.actionTitle.edit', ['供应商'])
: $t('ui.actionTitle.create', ['供应商']);
});
const [Form, formApi] = useVbenForm({

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkstationApi } from '#/api/mes/md/workstation';
@ -20,7 +20,7 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
import { MdWorkshopSelect } from './components';
/** 新增/修改工作站的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',
@ -37,6 +37,12 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
componentProps: {
placeholder: '请输入工作站编码',
},
dependencies: {
triggerFields: ['id'],
componentProps: (values) => ({
disabled: !!values.id,
}),
},
rules: 'required',
suffix: () =>
h(
@ -202,6 +208,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所在车间',
component: markRaw(MdWorkshopSelect),
componentProps: {
clearable: true,
placeholder: '请选择车间',
},
},
@ -210,6 +217,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所属工序',
component: markRaw(ProProcessSelect),
componentProps: {
clearable: true,
placeholder: '请选择工序',
},
},

View File

@ -1,4 +1,4 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkshopApi } from '#/api/mes/md/workstation/workshop';
@ -15,7 +15,7 @@ import { getSimpleUserList } from '#/api/system/user';
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改车间的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] {
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [
{
fieldName: 'id',
@ -54,7 +54,7 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
}
},
},
{ default: () => '自动生成' },
{ default: () => '生成' },
),
},
{