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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdClientApi } from '#/api/mes/md/client'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改客户的表单 */ /** 新增/修改客户的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemApi } from '#/api/mes/md/item'; import type { MesMdItemApi } from '#/api/mes/md/item';
import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改物料产品的表单 */ /** 新增/修改物料产品的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemTypeApi } from '#/api/mes/md/item/type'; import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
@ -19,7 +19,7 @@ import {
} from '#/views/mes/utils/constants'; } from '#/views/mes/utils/constants';
/** 新增/修改物料分类的表单 */ /** 新增/修改物料分类的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdVendorApi } from '#/api/mes/md/vendor'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改供应商的表单 */ /** 新增/修改供应商的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkstationApi } from '#/api/mes/md/workstation'; import type { MesMdWorkstationApi } from '#/api/mes/md/workstation';
@ -20,7 +20,7 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
import { MdWorkshopSelect } from './components'; import { MdWorkshopSelect } from './components';
/** 新增/修改工作站的表单 */ /** 新增/修改工作站的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', fieldName: 'id',
@ -37,6 +37,12 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请输入工作站编码', placeholder: '请输入工作站编码',
}, },
dependencies: {
triggerFields: ['id'],
componentProps: (values) => ({
disabled: !!values.id,
}),
},
rules: 'required', rules: 'required',
suffix: () => suffix: () =>
h( h(
@ -205,6 +211,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所在车间', label: '所在车间',
component: markRaw(MdWorkshopSelect), component: markRaw(MdWorkshopSelect),
componentProps: { componentProps: {
allowClear: true,
placeholder: '请选择车间', placeholder: '请选择车间',
}, },
}, },
@ -213,6 +220,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所属工序', label: '所属工序',
component: markRaw(ProProcessSelect), component: markRaw(ProProcessSelect),
componentProps: { componentProps: {
allowClear: true,
placeholder: '请选择工序', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkshopApi } from '#/api/mes/md/workstation/workshop'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改车间的表单 */ /** 新增/修改车间的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdClientApi } from '#/api/mes/md/client'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改客户的表单 */ /** 新增/修改客户的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemApi } from '#/api/mes/md/item'; import type { MesMdItemApi } from '#/api/mes/md/item';
import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改物料产品的表单 */ /** 新增/修改物料产品的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdItemTypeApi } from '#/api/mes/md/item/type'; import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
@ -19,7 +19,7 @@ import {
} from '#/views/mes/utils/constants'; } from '#/views/mes/utils/constants';
/** 新增/修改物料分类的表单 */ /** 新增/修改物料分类的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdVendorApi } from '#/api/mes/md/vendor'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改供应商的表单 */ /** 新增/修改供应商的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', fieldName: 'id',

View File

@ -24,12 +24,12 @@ const formData = ref<MesMdVendorApi.Vendor>();
const isDetail = computed(() => formMode.value === 'detail'); // const isDetail = computed(() => formMode.value === 'detail'); //
const getTitle = computed(() => { const getTitle = computed(() => {
const titles: Record<FormMode, string> = { if (formMode.value === 'detail') {
create: '新增供应商', return $t('ui.actionTitle.view', ['供应商']);
update: '修改供应商', }
detail: '查看供应商', return formMode.value === 'update'
}; ? $t('ui.actionTitle.edit', ['供应商'])
return titles[formMode.value]; : $t('ui.actionTitle.create', ['供应商']);
}); });
const [Form, formApi] = useVbenForm({ 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkstationApi } from '#/api/mes/md/workstation'; import type { MesMdWorkstationApi } from '#/api/mes/md/workstation';
@ -20,7 +20,7 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
import { MdWorkshopSelect } from './components'; import { MdWorkshopSelect } from './components';
/** 新增/修改工作站的表单 */ /** 新增/修改工作站的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', fieldName: 'id',
@ -37,6 +37,12 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请输入工作站编码', placeholder: '请输入工作站编码',
}, },
dependencies: {
triggerFields: ['id'],
componentProps: (values) => ({
disabled: !!values.id,
}),
},
rules: 'required', rules: 'required',
suffix: () => suffix: () =>
h( h(
@ -202,6 +208,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所在车间', label: '所在车间',
component: markRaw(MdWorkshopSelect), component: markRaw(MdWorkshopSelect),
componentProps: { componentProps: {
clearable: true,
placeholder: '请选择车间', placeholder: '请选择车间',
}, },
}, },
@ -210,6 +217,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '所属工序', label: '所属工序',
component: markRaw(ProProcessSelect), component: markRaw(ProProcessSelect),
componentProps: { componentProps: {
clearable: true,
placeholder: '请选择工序', 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 { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesMdWorkshopApi } from '#/api/mes/md/workstation/workshop'; 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'; import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
/** 新增/修改车间的表单 */ /** 新增/修改车间的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'id', fieldName: 'id',
@ -54,7 +54,7 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
} }
}, },
}, },
{ default: () => '自动生成' }, { default: () => '生成' },
), ),
}, },
{ {