fix(mes): 修复 MES 迁移 review 发现的问题(B001-B032)
系统性修复 MES migration review(INDEX.md,MES-R001~R042)发现的迁移问题, 覆盖 web-antd 与 web-ele 两端,按严重级别从 P0 到 P3。 P0 - B001: DICT_TYPE/BarcodeBizTypeEnum 等常量从 'vue' 误导入致 TS2305/运行时崩溃, 改从 @vben/constants 导入(20 个文件)。 P1 - B002 itemreceipt 入库单名称误必填;B003 条码工单选择补 CONFIRMED 过滤; B004 库存台账冻结开关补更新权限禁用;B005 returnsales 上架明细批次号误必填; B006 checkrecord/maintenrecord 计划/执行人误必填;B007 returnsales 退货行 rqcCheckFlag 默认改回 false;B019 OQC 预填 checkQuantity 缺省取 outQuantity; B024 repair 完成维修态放开 finishDate 录入;B025 tool 编码管理类型库存数量锁定为 1; B027 详情态自动编码按钮隐藏/禁用(md/cal/dv/tm 13 模块)。 P2 - B008 IPQC 废品数量补 0 默认值;B009 共享选择器去掉 catch+console.error 吞错; B011 route 自定义 SFC 改 markRaw;B012 ele 自动编码按钮去 type:'default'; B014 md 编辑态编码字段误禁用;B015 dv/subject 选择器仅展示启用项(保留历史回显); B016 盘点结果回填 batchId;B017 源 vue3 miscissue 业务类型字典误用 getStrDictOptions; B018 stocktaking/plan 盘点条件表单 schema 化;B020 清理 TODO @AI; B026 repair 验收信息字段按状态门控只读。 P3 - B010 QcIndicatorSelect 去吞错;B013/B019/B030/B031 componentProps、列对象多行化等 code style;B021 自动编码循环方式列条件展示;B022 盘点结果选中清单行后字段禁用; B023 质检指标 resultSpecification 抽 ResultSpecificationInput 消除重复 fieldName; B032 barcode/batch/sn API 字段补注释。 风格统一 - getTitle 统一为「特殊态 if 提前 return + create/update 三元」(pro/card、 stocktaking/task、repair);headerReadonly 抽 isHeaderReadonly 辅助函数对齐 pro/workorder/transfer 写法;computed 解释注释移入 computed 内部。 验证: - 两端 pnpm exec eslint 改动文件通过 - 两端 pnpm -F @vben/web-antd / @vben/web-ele exec vue-tsc 过滤 src/views/mes、 api/mes 无报错 - git diff --check 通过 备注:R037(defectrecord 命名漂移)经复核为原 finding 前提有误(两端本就一致), 已 rejected,未占 MES-B 编号。R008/R009 为 disputed 待裁决。 本提交仅含 src/views/mes 与 src/api/mes 下文件,排除 .env.development、vite.config.ts、 infra/codegen、docs changelog 等无关旁支改动。pull/351/MERGE
parent
4dff39ddc5
commit
61172b9a68
|
|
@ -5,17 +5,17 @@ import { requestClient } from '#/api/request';
|
||||||
export namespace MesWmBarcodeApi {
|
export namespace MesWmBarcodeApi {
|
||||||
/** MES 条码清单 */
|
/** MES 条码清单 */
|
||||||
export interface Barcode {
|
export interface Barcode {
|
||||||
id?: number;
|
id?: number; // 条码编号
|
||||||
configId?: number;
|
configId?: number; // 条码配置编号
|
||||||
format?: number;
|
format?: number; // 条码格式
|
||||||
bizType?: number;
|
bizType?: number; // 业务类型
|
||||||
content?: string;
|
content?: string; // 条码内容
|
||||||
bizId?: number;
|
bizId?: number; // 业务对象编号
|
||||||
bizCode?: string;
|
bizCode?: string; // 业务对象编码
|
||||||
bizName?: string;
|
bizName?: string; // 业务对象名称
|
||||||
status?: number;
|
status?: number; // 状态
|
||||||
remark?: string;
|
remark?: string; // 备注
|
||||||
createTime?: Date;
|
createTime?: Date; // 创建时间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,22 +39,22 @@ export namespace MesWmBatchApi {
|
||||||
|
|
||||||
/** MES 批次分页查询参数 */
|
/** MES 批次分页查询参数 */
|
||||||
export interface PageParams extends PageParam {
|
export interface PageParams extends PageParam {
|
||||||
code?: string;
|
code?: string; // 批次号
|
||||||
itemId?: number;
|
itemId?: number; // 物料编号
|
||||||
vendorId?: number;
|
vendorId?: number; // 供应商编号
|
||||||
clientId?: number;
|
clientId?: number; // 客户编号
|
||||||
workOrderId?: number;
|
workOrderId?: number; // 工单编号
|
||||||
taskId?: number;
|
taskId?: number; // 生产任务编号
|
||||||
workstationId?: number;
|
workstationId?: number; // 工作站编号
|
||||||
toolId?: number;
|
toolId?: number; // 工具编号
|
||||||
moldId?: number;
|
moldId?: number; // 模具编号
|
||||||
salesOrderCode?: string;
|
salesOrderCode?: string; // 销售订单号
|
||||||
purchaseOrderCode?: string;
|
purchaseOrderCode?: string; // 采购订单号
|
||||||
lotNumber?: string;
|
lotNumber?: string; // 批号
|
||||||
qualityStatus?: number;
|
qualityStatus?: number; // 质量状态
|
||||||
produceDate?: string[];
|
produceDate?: string[]; // 生产日期
|
||||||
expireDate?: string[];
|
expireDate?: string[]; // 过期日期
|
||||||
receiptDate?: string[];
|
receiptDate?: string[]; // 入库日期
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@ export namespace MesWmSnApi {
|
||||||
|
|
||||||
/** MES SN 码分组分页查询参数 */
|
/** MES SN 码分组分页查询参数 */
|
||||||
export interface PageParams extends PageParam {
|
export interface PageParams extends PageParam {
|
||||||
uuid?: string;
|
uuid?: string; // 分组 UUID
|
||||||
code?: string;
|
code?: string; // SN 码
|
||||||
itemId?: number;
|
itemId?: number; // 物料编号
|
||||||
batchCode?: string;
|
batchCode?: string; // 批次号
|
||||||
createTime?: string[];
|
createTime?: string[]; // 创建时间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { getRangePickerDefaultProps } from '#/utils';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改排班计划的表单 */
|
/** 新增/修改排班计划的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -43,18 +46,21 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入计划编码',
|
placeholder: '请输入计划编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'shift';
|
subTabsName.value = 'shift';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改班组的表单 */
|
/** 新增/修改班组的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -35,18 +38,21 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入班组编码',
|
placeholder: '请输入班组编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '班组编码不能为空').max(64),
|
rules: z.string().min(1, '班组编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'member';
|
subTabsName.value = 'member';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ import { getRangePickerDefaultProps } from '#/utils';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改点检保养方案的表单 */
|
/** 新增/修改点检保养方案的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -44,18 +47,21 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入方案编码',
|
placeholder: '请输入方案编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'machinery';
|
subTabsName.value = 'machinery';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -41,18 +41,21 @@ export function useFormSchema(formType: FormType, formApi?: VbenFormApi): VbenFo
|
||||||
componentProps: (values) => ({ disabled: !!values.id }),
|
componentProps: (values) => ({ disabled: !!values.id }),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,14 @@ import { z } from '#/adapter/form';
|
||||||
import { getMachineryTypeList } from '#/api/mes/dv/machinery/type';
|
import { getMachineryTypeList } from '#/api/mes/dv/machinery/type';
|
||||||
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
|
|
||||||
|
/** 表单类型 */
|
||||||
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改设备类型的表单 */
|
/** 新增/修改设备类型的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -52,18 +58,23 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入类型编码',
|
placeholder: '请输入类型编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '类型编码不能为空').max(64),
|
rules: z.string().min(1, '类型编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(
|
||||||
{ default: () => '生成' },
|
MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE,
|
||||||
),
|
);
|
||||||
|
await formApi?.setFieldValue('code', code);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<MesDvMachineryTypeApi.MachineryType>();
|
const data = modalApi.getData<MesDvMachineryTypeApi.MachineryType>();
|
||||||
|
formApi.setState({
|
||||||
|
schema: useFormSchema(data?.id ? 'update' : 'create', formApi),
|
||||||
|
});
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
formData.value = data || undefined;
|
formData.value = data || undefined;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,17 @@ import { DvMachinerySelect } from '#/views/mes/dv/machinery/components';
|
||||||
/** 表单类型 */
|
/** 表单类型 */
|
||||||
export type FormType = 'confirm' | 'create' | 'detail' | 'finish' | 'update';
|
export type FormType = 'confirm' | 'create' | 'detail' | 'finish' | 'update';
|
||||||
|
|
||||||
|
/** 表头是否只读(完成维修、验收、详情态;finishDate 在 confirm 单独放开) */
|
||||||
|
function isHeaderReadonly(formType: FormType): boolean {
|
||||||
|
return ['confirm', 'detail', 'finish'].includes(formType);
|
||||||
|
}
|
||||||
|
|
||||||
/** 新增/修改维修工单的表单 */
|
/** 新增/修改维修工单的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
|
const headerReadonly = isHeaderReadonly(formType);
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -45,27 +54,30 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
},
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['id'],
|
triggerFields: ['id'],
|
||||||
componentProps: (values) => ({ disabled: !!values.id }),
|
componentProps: (values) => ({ disabled: headerReadonly || !!values.id }),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix: headerReadonly
|
||||||
h(
|
? undefined
|
||||||
Button,
|
: () =>
|
||||||
{
|
h(
|
||||||
type: 'default',
|
Button,
|
||||||
onClick: async () => {
|
{
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
type: 'default',
|
||||||
await formApi?.setFieldValue('code', code);
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
||||||
},
|
await formApi?.setFieldValue('code', code);
|
||||||
{ default: () => '生成' },
|
},
|
||||||
),
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
label: '维修单名称',
|
label: '维修单名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: headerReadonly,
|
||||||
placeholder: '请输入维修单名称',
|
placeholder: '请输入维修单名称',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
|
|
@ -75,6 +87,7 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
label: '设备',
|
label: '设备',
|
||||||
component: markRaw(DvMachinerySelect),
|
component: markRaw(DvMachinerySelect),
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: headerReadonly,
|
||||||
placeholder: '请选择设备',
|
placeholder: '请选择设备',
|
||||||
},
|
},
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
|
|
@ -84,6 +97,7 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
label: '报修日期',
|
label: '报修日期',
|
||||||
component: 'DatePicker',
|
component: 'DatePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: headerReadonly,
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
placeholder: '请选择报修日期',
|
placeholder: '请选择报修日期',
|
||||||
showTime: true,
|
showTime: true,
|
||||||
|
|
@ -98,10 +112,18 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
api: getSimpleUserList,
|
api: getSimpleUserList,
|
||||||
|
disabled: true,
|
||||||
labelField: 'nickname',
|
labelField: 'nickname',
|
||||||
placeholder: '请选择维修人',
|
placeholder: '请选择维修人',
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
},
|
},
|
||||||
|
// 维修人为待验收(≥APPROVING)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.APPROVING,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'finishDate',
|
fieldName: 'finishDate',
|
||||||
|
|
@ -113,6 +135,15 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
showTime: true,
|
showTime: true,
|
||||||
valueFormat: 'x',
|
valueFormat: 'x',
|
||||||
},
|
},
|
||||||
|
// 维修中(≥CONFIRMED)态展示;仅"完成维修"弹窗可编辑并必填,其余态只读回显
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.CONFIRMED,
|
||||||
|
disabled: formType !== 'confirm',
|
||||||
|
rules: () => (formType === 'confirm' ? 'required' : null),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'confirmUserId',
|
fieldName: 'confirmUserId',
|
||||||
|
|
@ -121,21 +152,37 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
api: getSimpleUserList,
|
api: getSimpleUserList,
|
||||||
|
disabled: true,
|
||||||
labelField: 'nickname',
|
labelField: 'nickname',
|
||||||
placeholder: '请选择验收人',
|
placeholder: '请选择验收人',
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
},
|
},
|
||||||
|
// 验收信息为已确认(≥FINISHED)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.FINISHED,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'confirmDate',
|
fieldName: 'confirmDate',
|
||||||
label: '验收日期',
|
label: '验收日期',
|
||||||
component: 'DatePicker',
|
component: 'DatePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
placeholder: '请选择验收日期',
|
placeholder: '请选择验收日期',
|
||||||
showTime: true,
|
showTime: true,
|
||||||
valueFormat: 'x',
|
valueFormat: 'x',
|
||||||
},
|
},
|
||||||
|
// 验收信息为已确认(≥FINISHED)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.FINISHED,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'result',
|
fieldName: 'result',
|
||||||
|
|
@ -143,9 +190,17 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
component: 'RadioGroup',
|
component: 'RadioGroup',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
buttonStyle: 'solid',
|
buttonStyle: 'solid',
|
||||||
|
disabled: true,
|
||||||
optionType: 'button',
|
optionType: 'button',
|
||||||
options: getDictOptions(DICT_TYPE.MES_DV_REPAIR_RESULT, 'number'),
|
options: getDictOptions(DICT_TYPE.MES_DV_REPAIR_RESULT, 'number'),
|
||||||
},
|
},
|
||||||
|
// 验收信息为已确认(≥FINISHED)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.FINISHED,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
|
|
@ -153,6 +208,7 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
formItemClass: 'col-span-3',
|
formItemClass: 'col-span-3',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: headerReadonly,
|
||||||
placeholder: '请输入备注',
|
placeholder: '请输入备注',
|
||||||
rows: 3,
|
rows: 3,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -28,20 +28,29 @@ const emit = defineEmits(['success']);
|
||||||
const formType = ref<FormType>('create');
|
const formType = ref<FormType>('create');
|
||||||
const formData = ref<MesDvRepairApi.Repair>();
|
const formData = ref<MesDvRepairApi.Repair>();
|
||||||
const isDetail = computed(() => formType.value === 'detail');
|
const isDetail = computed(() => formType.value === 'detail');
|
||||||
const isReadonly = computed(() => ['confirm', 'detail', 'finish'].includes(formType.value));
|
const isLineReadonly = computed(() =>
|
||||||
|
// 明细只读:完成维修/验收/详情态明细均不可编辑
|
||||||
|
['confirm', 'detail', 'finish'].includes(formType.value),
|
||||||
|
);
|
||||||
|
const isFormDisabled = computed(() =>
|
||||||
|
// 整表禁用:仅详情/验收态;完成维修态需放开 finishDate,故单头只读改由 schema 逐字段控制
|
||||||
|
['detail', 'finish'].includes(formType.value),
|
||||||
|
);
|
||||||
const canSubmit = computed(
|
const canSubmit = computed(
|
||||||
() => formType.value === 'update' && formData.value?.status === MesDvRepairStatusEnum.PREPARE,
|
() => formType.value === 'update' && formData.value?.status === MesDvRepairStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
const getTitle = computed(
|
const getTitle = computed(() => {
|
||||||
() =>
|
if (formType.value === 'detail') {
|
||||||
({
|
return '查看维修工单';
|
||||||
create: '新增维修工单',
|
}
|
||||||
update: '修改维修工单',
|
if (formType.value === 'confirm') {
|
||||||
confirm: '完成维修',
|
return '完成维修';
|
||||||
finish: '验收维修',
|
}
|
||||||
detail: '查看维修工单',
|
if (formType.value === 'finish') {
|
||||||
})[formType.value],
|
return '验收维修';
|
||||||
);
|
}
|
||||||
|
return formType.value === 'update' ? '修改维修工单' : '新增维修工单';
|
||||||
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
|
|
@ -161,11 +170,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
formApi.setDisabled(isReadonly.value);
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
|
formApi.setDisabled(isFormDisabled.value);
|
||||||
modalApi.setState({ showConfirmButton: ['create', 'update'].includes(formType.value) });
|
modalApi.setState({ showConfirmButton: ['create', 'update'].includes(formType.value) });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -184,7 +193,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
<template>
|
<template>
|
||||||
<Modal :title="getTitle" class="w-4/5">
|
<Modal :title="getTitle" class="w-4/5">
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
<LineList v-if="formData?.id" :disabled="isReadonly" :repair-id="formData.id" />
|
<LineList v-if="formData?.id" :disabled="isLineReadonly" :repair-id="formData.id" />
|
||||||
<template #prepend-footer>
|
<template #prepend-footer>
|
||||||
<div class="flex flex-auto items-center gap-2">
|
<div class="flex flex-auto items-center gap-2">
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改点检保养项目的表单 */
|
/** 新增/修改点检保养项目的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -39,18 +42,21 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入项目编码',
|
placeholder: '请输入项目编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改客户的表单 */
|
/** 新增/修改客户的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -34,20 +37,23 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入客户编码',
|
placeholder: '请输入客户编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(
|
{
|
||||||
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
type: 'default',
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '自动生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '自动生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'productSalesLine';
|
subTabsName.value = 'productSalesLine';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,31 @@ const [Grid] = useVbenVxeGrid({
|
||||||
width: 140,
|
width: 140,
|
||||||
slots: { default: 'itemCode' },
|
slots: { default: 'itemCode' },
|
||||||
},
|
},
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
{
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
field: 'itemName',
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
title: '物料名称',
|
||||||
{ field: 'quantity', title: '出库数量', width: 120 },
|
minWidth: 150,
|
||||||
{ field: 'batchCode', title: '批次号', minWidth: 140 },
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '出库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'batchCode',
|
||||||
|
title: '批次号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 320,
|
height: 320,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,21 @@ const props = defineProps<{
|
||||||
const [Grid] = useVbenVxeGrid({
|
const [Grid] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'code', title: '出库单编号', minWidth: 160 },
|
{
|
||||||
{ field: 'name', title: '出库单名称', minWidth: 150 },
|
field: 'code',
|
||||||
{ field: 'salesOrderCode', title: '销售订单编号', minWidth: 140 },
|
title: '出库单编号',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
title: '出库单名称',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'salesOrderCode',
|
||||||
|
title: '销售订单编号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'salesDate',
|
field: 'salesDate',
|
||||||
title: '出库日期',
|
title: '出库日期',
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改物料产品的表单 */
|
/** 新增/修改物料产品的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -38,20 +41,23 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入物料编码',
|
placeholder: '请输入物料编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '物料编码不能为空').max(64),
|
rules: z.string().min(1, '物料编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(
|
{
|
||||||
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
type: 'default',
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'bom';
|
subTabsName.value = 'bom';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -68,38 +68,54 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'bomItemCode',
|
fieldName: 'bomItemCode',
|
||||||
label: 'BOM 物料编码',
|
label: 'BOM 物料编码',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'bomItemName',
|
fieldName: 'bomItemName',
|
||||||
label: 'BOM 物料名称',
|
label: 'BOM 物料名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'bomItemSpecification',
|
fieldName: 'bomItemSpecification',
|
||||||
label: '规格型号',
|
label: '规格型号',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'unitMeasureName',
|
fieldName: 'unitMeasureName',
|
||||||
label: '单位',
|
label: '单位',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'quantity',
|
fieldName: 'quantity',
|
||||||
label: '用量比例',
|
label: '用量比例',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 0, precision: 4, step: 0.1 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 0,
|
||||||
|
precision: 4,
|
||||||
|
step: 0.1,
|
||||||
|
},
|
||||||
rules: z.number().default(1),
|
rules: z.number().default(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
|
||||||
|
|
@ -79,21 +79,30 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'title',
|
fieldName: 'title',
|
||||||
label: '标题',
|
label: '标题',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { placeholder: '请输入标题' },
|
componentProps: {
|
||||||
|
placeholder: '请输入标题',
|
||||||
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'sort',
|
fieldName: 'sort',
|
||||||
label: '展示顺序',
|
label: '展示顺序',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 0, precision: 0 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 0,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
rules: z.number().default(0),
|
rules: z.number().default(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'description',
|
fieldName: 'description',
|
||||||
label: '内容说明',
|
label: '内容说明',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入详细描述', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入详细描述',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'processId',
|
fieldName: 'processId',
|
||||||
|
|
@ -104,13 +113,19 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'url',
|
fieldName: 'url',
|
||||||
label: '图片',
|
label: '图片',
|
||||||
component: markRaw(ImageUpload),
|
component: markRaw(ImageUpload),
|
||||||
componentProps: { maxNumber: 1, showDescription: false },
|
componentProps: {
|
||||||
|
maxNumber: 1,
|
||||||
|
showDescription: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,14 @@ import { z } from '#/adapter/form';
|
||||||
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
import { getItemTypeList } from '#/api/mes/md/item/type';
|
import { getItemTypeList } from '#/api/mes/md/item/type';
|
||||||
|
|
||||||
|
/** 表单类型 */
|
||||||
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改物料分类的表单 */
|
/** 新增/修改物料分类的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -64,20 +70,23 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入分类编码',
|
placeholder: '请输入分类编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '分类编码不能为空').max(64),
|
rules: z.string().min(1, '分类编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(
|
{
|
||||||
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
type: 'default',
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '自动生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '自动生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<MesMdItemTypeApi.ItemType>();
|
const data = modalApi.getData<MesMdItemTypeApi.ItemType>();
|
||||||
|
formApi.setState({
|
||||||
|
schema: useFormSchema(data?.id ? 'update' : 'create', formApi),
|
||||||
|
});
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
formData.value = data || undefined;
|
formData.value = data || undefined;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改供应商的表单 */
|
/** 新增/修改供应商的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -34,20 +37,23 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入供应商编码',
|
placeholder: '请输入供应商编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(
|
{
|
||||||
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
type: 'default',
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '自动生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '自动生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'itemReceiptLine';
|
subTabsName.value = 'itemReceiptLine';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,36 @@ function formatDate(value: Date | number | string | undefined) {
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'itemCode', title: '物料编码', width: 140 },
|
{
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
field: 'itemCode',
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
title: '物料编码',
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
width: 140,
|
||||||
{ field: 'receivedQuantity', title: '入库数量', width: 120 },
|
},
|
||||||
{ field: 'batchCode', title: '批次号', minWidth: 140 },
|
{
|
||||||
|
field: 'itemName',
|
||||||
|
title: '物料名称',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receivedQuantity',
|
||||||
|
title: '入库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'batchCode',
|
||||||
|
title: '批次号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 280,
|
height: 280,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,31 @@ const [Grid] = useVbenVxeGrid({
|
||||||
width: 140,
|
width: 140,
|
||||||
slots: { default: 'itemCode' },
|
slots: { default: 'itemCode' },
|
||||||
},
|
},
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
{
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
field: 'itemName',
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
title: '物料名称',
|
||||||
{ field: 'receivedQuantity', title: '入库数量', width: 120 },
|
minWidth: 150,
|
||||||
{ field: 'batchCode', title: '批次号', minWidth: 140 },
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receivedQuantity',
|
||||||
|
title: '入库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'batchCode',
|
||||||
|
title: '批次号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 320,
|
height: 320,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,36 @@ const [Grid] = useVbenVxeGrid({
|
||||||
minWidth: 160,
|
minWidth: 160,
|
||||||
slots: { default: 'receiptCode' },
|
slots: { default: 'receiptCode' },
|
||||||
},
|
},
|
||||||
{ field: 'purchaseOrderCode', title: '采购订单号', minWidth: 150 },
|
{
|
||||||
{ field: 'itemCode', title: '物料编码', width: 140 },
|
field: 'purchaseOrderCode',
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
title: '采购订单号',
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
minWidth: 150,
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
},
|
||||||
{ field: 'receivedQuantity', title: '入库数量', width: 120 },
|
{
|
||||||
|
field: 'itemCode',
|
||||||
|
title: '物料编码',
|
||||||
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'itemName',
|
||||||
|
title: '物料名称',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receivedQuantity',
|
||||||
|
title: '入库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 320,
|
height: 320,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@ import { MdWorkshopSelect } from './components';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改工作站的表单 */
|
/** 新增/修改工作站的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -40,20 +43,23 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入工作站编码',
|
placeholder: '请输入工作站编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(
|
{
|
||||||
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
type: 'default',
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'machine';
|
subTabsName.value = 'machine';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -89,10 +92,26 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
border: true,
|
border: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'machineryCode', title: '设备编码', width: 140 },
|
{
|
||||||
{ field: 'machineryName', title: '设备名称', minWidth: 160 },
|
field: 'machineryCode',
|
||||||
{ field: 'quantity', title: '数量', width: 100 },
|
title: '设备编码',
|
||||||
{ field: 'remark', title: '备注', minWidth: 160 },
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'machineryName',
|
||||||
|
title: '设备名称',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '数量',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 90,
|
width: 90,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -100,10 +103,26 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
border: true,
|
border: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'toolTypeId', title: '工具类型编号', width: 140 },
|
{
|
||||||
{ field: 'toolTypeName', title: '工具类型名称', minWidth: 160 },
|
field: 'toolTypeId',
|
||||||
{ field: 'quantity', title: '数量', width: 100 },
|
title: '工具类型编号',
|
||||||
{ field: 'remark', title: '备注', minWidth: 160 },
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'toolTypeName',
|
||||||
|
title: '工具类型名称',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '数量',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 130,
|
width: 130,
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -96,10 +99,26 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
border: true,
|
border: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'postId', title: '岗位编号', width: 140 },
|
{
|
||||||
{ field: 'postName', title: '岗位名称', minWidth: 160 },
|
field: 'postId',
|
||||||
{ field: 'quantity', title: '数量', width: 100 },
|
title: '岗位编号',
|
||||||
{ field: 'remark', title: '备注', minWidth: 160 },
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'postName',
|
||||||
|
title: '岗位名称',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '数量',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 130,
|
width: 130,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ import { getSimpleUserList } from '#/api/system/user';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改车间的表单 */
|
/** 新增/修改车间的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -41,20 +44,23 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(
|
{
|
||||||
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
type: 'default',
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,9 @@ export function useFormSchema(
|
||||||
fieldName: 'itemCode',
|
fieldName: 'itemCode',
|
||||||
label: '产品编码',
|
label: '产品编码',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
@ -337,7 +339,9 @@ export function useFormSchema(
|
||||||
fieldName: 'itemName',
|
fieldName: 'itemName',
|
||||||
label: '产品名称',
|
label: '产品名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
@ -347,7 +351,9 @@ export function useFormSchema(
|
||||||
fieldName: 'unitMeasureName',
|
fieldName: 'unitMeasureName',
|
||||||
label: '单位',
|
label: '单位',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
@ -357,7 +363,9 @@ export function useFormSchema(
|
||||||
fieldName: 'itemSpecification',
|
fieldName: 'itemSpecification',
|
||||||
label: '规格',
|
label: '规格',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
@ -367,7 +375,11 @@ export function useFormSchema(
|
||||||
fieldName: 'feedbackQuantity',
|
fieldName: 'feedbackQuantity',
|
||||||
label: '报工数量',
|
label: '报工数量',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: 'w-full', min: 0, precision: 2 },
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
min: 0,
|
||||||
|
precision: 2,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['checkFlag'],
|
triggerFields: ['checkFlag'],
|
||||||
// 非质检工序时,报工数量 = 合格 + 不良,禁用直接编辑
|
// 非质检工序时,报工数量 = 合格 + 不良,禁用直接编辑
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import type { MesProRouteProcessApi } from '#/api/mes/pro/route/process';
|
||||||
import type { MesProRouteProductApi } from '#/api/mes/pro/route/product';
|
import type { MesProRouteProductApi } from '#/api/mes/pro/route/product';
|
||||||
import type { MesProRouteProductBomApi } from '#/api/mes/pro/route/productbom';
|
import type { MesProRouteProductBomApi } from '#/api/mes/pro/route/productbom';
|
||||||
|
|
||||||
import { h } from 'vue';
|
import { h, markRaw } from 'vue';
|
||||||
|
|
||||||
import { CommonStatusEnum, DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants';
|
import { CommonStatusEnum, DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants';
|
||||||
import { getDictOptions } from '@vben/hooks';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
@ -98,13 +98,19 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
fieldName: 'code',
|
fieldName: 'code',
|
||||||
label: '路线编码',
|
label: '路线编码',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { allowClear: true, placeholder: '请输入路线编码' },
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: '请输入路线编码',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
label: '路线名称',
|
label: '路线名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { allowClear: true, placeholder: '请输入路线名称' },
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: '请输入路线名称',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
|
|
@ -186,7 +192,11 @@ export function useRouteProcessFormSchema(
|
||||||
fieldName: 'sort',
|
fieldName: 'sort',
|
||||||
label: '序号',
|
label: '序号',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 1, precision: 0 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 1,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
rules: z.number().default(1),
|
rules: z.number().default(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -221,28 +231,42 @@ export function useRouteProcessFormSchema(
|
||||||
fieldName: 'keyFlag',
|
fieldName: 'keyFlag',
|
||||||
label: '是否关键工序',
|
label: '是否关键工序',
|
||||||
component: 'Switch',
|
component: 'Switch',
|
||||||
componentProps: { checkedChildren: '是', unCheckedChildren: '否' },
|
componentProps: {
|
||||||
|
checkedChildren: '是',
|
||||||
|
unCheckedChildren: '否',
|
||||||
|
},
|
||||||
rules: z.boolean().default(false),
|
rules: z.boolean().default(false),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'checkFlag',
|
fieldName: 'checkFlag',
|
||||||
label: '是否质检确认',
|
label: '是否质检确认',
|
||||||
component: 'Switch',
|
component: 'Switch',
|
||||||
componentProps: { checkedChildren: '是', unCheckedChildren: '否' },
|
componentProps: {
|
||||||
|
checkedChildren: '是',
|
||||||
|
unCheckedChildren: '否',
|
||||||
|
},
|
||||||
rules: z.boolean().default(false),
|
rules: z.boolean().default(false),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'prepareTime',
|
fieldName: 'prepareTime',
|
||||||
label: '准备时间(分)',
|
label: '准备时间(分)',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 0, precision: 0 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 0,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
rules: z.number().default(0),
|
rules: z.number().default(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'waitTime',
|
fieldName: 'waitTime',
|
||||||
label: '等待时间(分)',
|
label: '等待时间(分)',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 0, precision: 0 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 0,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
rules: z.number().default(0),
|
rules: z.number().default(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -250,7 +274,11 @@ export function useRouteProcessFormSchema(
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
componentProps: { maxLength: 250, placeholder: '请输入备注', rows: 2 },
|
componentProps: {
|
||||||
|
maxLength: 250,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -369,7 +397,7 @@ export function useRouteProductFormSchema(
|
||||||
{
|
{
|
||||||
fieldName: 'itemId',
|
fieldName: 'itemId',
|
||||||
label: '产品',
|
label: '产品',
|
||||||
component: MdItemSelect as any,
|
component: markRaw(MdItemSelect),
|
||||||
componentProps: {
|
componentProps: {
|
||||||
onChange: onItemChange,
|
onChange: onItemChange,
|
||||||
},
|
},
|
||||||
|
|
@ -380,14 +408,22 @@ export function useRouteProductFormSchema(
|
||||||
fieldName: 'quantity',
|
fieldName: 'quantity',
|
||||||
label: '生产数量',
|
label: '生产数量',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 1, precision: 0 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 1,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
rules: z.number().default(1),
|
rules: z.number().default(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'productionTime',
|
fieldName: 'productionTime',
|
||||||
label: '生产用时',
|
label: '生产用时',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 0, precision: 2 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 0,
|
||||||
|
precision: 2,
|
||||||
|
},
|
||||||
rules: z.number().default(1),
|
rules: z.number().default(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -406,7 +442,11 @@ export function useRouteProductFormSchema(
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
componentProps: { maxLength: 250, placeholder: '请输入备注', rows: 2 },
|
componentProps: {
|
||||||
|
maxLength: 250,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -441,7 +481,7 @@ export function useRouteProductBomFormSchema(
|
||||||
{
|
{
|
||||||
fieldName: 'itemId',
|
fieldName: 'itemId',
|
||||||
label: 'BOM 物料',
|
label: 'BOM 物料',
|
||||||
component: MdProductBomSelect as any,
|
component: markRaw(MdProductBomSelect),
|
||||||
componentProps: () => ({
|
componentProps: () => ({
|
||||||
itemId: itemId(),
|
itemId: itemId(),
|
||||||
onChange: onBomChange,
|
onChange: onBomChange,
|
||||||
|
|
@ -453,14 +493,22 @@ export function useRouteProductBomFormSchema(
|
||||||
fieldName: 'quantity',
|
fieldName: 'quantity',
|
||||||
label: '用料比例',
|
label: '用料比例',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: { class: '!w-full', min: 0, precision: 2 },
|
componentProps: {
|
||||||
|
class: '!w-full',
|
||||||
|
min: 0,
|
||||||
|
precision: 2,
|
||||||
|
},
|
||||||
rules: z.number().default(1),
|
rules: z.number().default(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { maxLength: 250, placeholder: '请输入备注', rows: 2 },
|
componentProps: {
|
||||||
|
maxLength: 250,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ import { TmToolTypeSelect } from './type/components';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改工具的表单 */
|
/** 新增/修改工具的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -29,6 +32,15 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
show: () => false,
|
show: () => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// 选中工具类型是否「编码管理」,用于锁定库存数量为 1(隐藏字段)
|
||||||
|
fieldName: 'codeFlag',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: [''],
|
||||||
|
show: () => false,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'code',
|
fieldName: 'code',
|
||||||
label: '工具编码',
|
label: '工具编码',
|
||||||
|
|
@ -41,18 +53,21 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: (values) => ({ disabled: !!values.id }),
|
componentProps: (values) => ({ disabled: !!values.id }),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
@ -70,7 +85,9 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择工具类型',
|
placeholder: '请选择工具类型',
|
||||||
onChange: async (row: any) => {
|
onChange: async (row: any) => {
|
||||||
if (row?.codeFlag) {
|
// 记录是否编码管理;编码管理类型库存数量锁定为 1
|
||||||
|
await formApi?.setFieldValue('codeFlag', row?.codeFlag === true);
|
||||||
|
if (row?.codeFlag === true) {
|
||||||
await formApi?.setFieldValue('quantity', 1);
|
await formApi?.setFieldValue('quantity', 1);
|
||||||
await formApi?.setFieldValue('availableQuantity', 1);
|
await formApi?.setFieldValue('availableQuantity', 1);
|
||||||
}
|
}
|
||||||
|
|
@ -110,6 +127,13 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
precision: 0,
|
precision: 0,
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
|
// 编码管理类型库存数量锁定为 1,禁止修改
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['codeFlag'],
|
||||||
|
componentProps: (values) => ({
|
||||||
|
disabled: values.codeFlag === true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'availableQuantity',
|
fieldName: 'availableQuantity',
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改工具类型的表单 */
|
/** 新增/修改工具类型的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -34,18 +37,21 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入类型编码',
|
placeholder: '请输入类型编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
Button,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
type: 'default',
|
h(
|
||||||
onClick: async () => {
|
Button,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_TYPE_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
type: 'default',
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_TYPE_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@ import { requestClient } from '#/api/request';
|
||||||
export namespace MesWmBarcodeApi {
|
export namespace MesWmBarcodeApi {
|
||||||
/** MES 条码清单 */
|
/** MES 条码清单 */
|
||||||
export interface Barcode {
|
export interface Barcode {
|
||||||
id?: number;
|
id?: number; // 条码编号
|
||||||
configId?: number;
|
configId?: number; // 条码配置编号
|
||||||
format?: number;
|
format?: number; // 条码格式
|
||||||
bizType?: number;
|
bizType?: number; // 业务类型
|
||||||
content?: string;
|
content?: string; // 条码内容
|
||||||
bizId?: number;
|
bizId?: number; // 业务对象编号
|
||||||
bizCode?: string;
|
bizCode?: string; // 业务对象编码
|
||||||
bizName?: string;
|
bizName?: string; // 业务对象名称
|
||||||
status?: number;
|
status?: number; // 状态
|
||||||
remark?: string;
|
remark?: string; // 备注
|
||||||
createTime?: Date;
|
createTime?: Date; // 创建时间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,22 +39,22 @@ export namespace MesWmBatchApi {
|
||||||
|
|
||||||
/** MES 批次分页查询参数 */
|
/** MES 批次分页查询参数 */
|
||||||
export interface PageParams extends PageParam {
|
export interface PageParams extends PageParam {
|
||||||
code?: string;
|
code?: string; // 批次号
|
||||||
itemId?: number;
|
itemId?: number; // 物料编号
|
||||||
vendorId?: number;
|
vendorId?: number; // 供应商编号
|
||||||
clientId?: number;
|
clientId?: number; // 客户编号
|
||||||
workOrderId?: number;
|
workOrderId?: number; // 工单编号
|
||||||
taskId?: number;
|
taskId?: number; // 生产任务编号
|
||||||
workstationId?: number;
|
workstationId?: number; // 工作站编号
|
||||||
toolId?: number;
|
toolId?: number; // 工具编号
|
||||||
moldId?: number;
|
moldId?: number; // 模具编号
|
||||||
salesOrderCode?: string;
|
salesOrderCode?: string; // 销售订单号
|
||||||
purchaseOrderCode?: string;
|
purchaseOrderCode?: string; // 采购订单号
|
||||||
lotNumber?: string;
|
lotNumber?: string; // 批号
|
||||||
qualityStatus?: number;
|
qualityStatus?: number; // 质量状态
|
||||||
produceDate?: string[];
|
produceDate?: string[]; // 生产日期
|
||||||
expireDate?: string[];
|
expireDate?: string[]; // 过期日期
|
||||||
receiptDate?: string[];
|
receiptDate?: string[]; // 入库日期
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@ export namespace MesWmSnApi {
|
||||||
|
|
||||||
/** MES SN 码分组分页查询参数 */
|
/** MES SN 码分组分页查询参数 */
|
||||||
export interface PageParams extends PageParam {
|
export interface PageParams extends PageParam {
|
||||||
uuid?: string;
|
uuid?: string; // 分组 UUID
|
||||||
code?: string;
|
code?: string; // SN 码
|
||||||
itemId?: number;
|
itemId?: number; // 物料编号
|
||||||
batchCode?: string;
|
batchCode?: string; // 批次号
|
||||||
createTime?: string[];
|
createTime?: string[]; // 创建时间
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { getRangePickerDefaultProps } from '#/utils';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改排班计划的表单 */
|
/** 新增/修改排班计划的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -43,17 +46,20 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入计划编码',
|
placeholder: '请输入计划编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -104,11 +104,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'shift';
|
subTabsName.value = 'shift';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改班组的表单 */
|
/** 新增/修改班组的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -35,17 +38,20 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入班组编码',
|
placeholder: '请输入班组编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '班组编码不能为空').max(64),
|
rules: z.string().min(1, '班组编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'member';
|
subTabsName.value = 'member';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ import { getRangePickerDefaultProps } from '#/utils';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改点检保养方案的表单 */
|
/** 新增/修改点检保养方案的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -44,17 +47,20 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入方案编码',
|
placeholder: '请输入方案编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'machinery';
|
subTabsName.value = 'machinery';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,20 @@ export function useFormSchema(formType: FormType, formApi?: VbenFormApi): VbenFo
|
||||||
componentProps: (values) => ({ disabled: !!values.id }),
|
componentProps: (values) => ({ disabled: !!values.id }),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,14 @@ import { z } from '#/adapter/form';
|
||||||
import { getMachineryTypeList } from '#/api/mes/dv/machinery/type';
|
import { getMachineryTypeList } from '#/api/mes/dv/machinery/type';
|
||||||
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
|
|
||||||
|
/** 表单类型 */
|
||||||
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改设备类型的表单 */
|
/** 新增/修改设备类型的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -51,17 +57,22 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入类型编码',
|
placeholder: '请输入类型编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '类型编码不能为空').max(64),
|
rules: z.string().min(1, '类型编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(
|
||||||
{ default: () => '生成' },
|
MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE,
|
||||||
),
|
);
|
||||||
|
await formApi?.setFieldValue('code', code);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<MesDvMachineryTypeApi.MachineryType>();
|
const data = modalApi.getData<MesDvMachineryTypeApi.MachineryType>();
|
||||||
|
formApi.setState({
|
||||||
|
schema: useFormSchema(data?.id ? 'update' : 'create', formApi),
|
||||||
|
});
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
formData.value = data || undefined;
|
formData.value = data || undefined;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,17 @@ import { DvMachinerySelect } from '#/views/mes/dv/machinery/components';
|
||||||
/** 表单类型 */
|
/** 表单类型 */
|
||||||
export type FormType = 'confirm' | 'create' | 'detail' | 'finish' | 'update';
|
export type FormType = 'confirm' | 'create' | 'detail' | 'finish' | 'update';
|
||||||
|
|
||||||
|
/** 表头是否只读(完成维修、验收、详情态;finishDate 在 confirm 单独放开) */
|
||||||
|
function isHeaderReadonly(formType: FormType): boolean {
|
||||||
|
return ['confirm', 'detail', 'finish'].includes(formType);
|
||||||
|
}
|
||||||
|
|
||||||
/** 新增/修改维修工单的表单 */
|
/** 新增/修改维修工单的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
|
const headerReadonly = isHeaderReadonly(formType);
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -45,26 +54,29 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
},
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['id'],
|
triggerFields: ['id'],
|
||||||
componentProps: (values) => ({ disabled: !!values.id }),
|
componentProps: (values) => ({ disabled: headerReadonly || !!values.id }),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix: headerReadonly
|
||||||
h(
|
? undefined
|
||||||
ElButton,
|
: () =>
|
||||||
{
|
h(
|
||||||
onClick: async () => {
|
ElButton,
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
{
|
||||||
await formApi?.setFieldValue('code', code);
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
||||||
},
|
await formApi?.setFieldValue('code', code);
|
||||||
{ default: () => '生成' },
|
},
|
||||||
),
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
label: '维修单名称',
|
label: '维修单名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: headerReadonly,
|
||||||
placeholder: '请输入维修单名称',
|
placeholder: '请输入维修单名称',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
|
|
@ -74,6 +86,7 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
label: '设备',
|
label: '设备',
|
||||||
component: markRaw(DvMachinerySelect),
|
component: markRaw(DvMachinerySelect),
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: headerReadonly,
|
||||||
placeholder: '请选择设备',
|
placeholder: '请选择设备',
|
||||||
},
|
},
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
|
|
@ -84,6 +97,7 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
component: 'DatePicker',
|
component: 'DatePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: '!w-full',
|
class: '!w-full',
|
||||||
|
disabled: headerReadonly,
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
placeholder: '请选择报修日期',
|
placeholder: '请选择报修日期',
|
||||||
showTime: true,
|
showTime: true,
|
||||||
|
|
@ -98,10 +112,18 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
clearable: true,
|
||||||
api: getSimpleUserList,
|
api: getSimpleUserList,
|
||||||
|
disabled: true,
|
||||||
labelField: 'nickname',
|
labelField: 'nickname',
|
||||||
placeholder: '请选择维修人',
|
placeholder: '请选择维修人',
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
},
|
},
|
||||||
|
// 维修人为待验收(≥APPROVING)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.APPROVING,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'finishDate',
|
fieldName: 'finishDate',
|
||||||
|
|
@ -114,6 +136,15 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
showTime: true,
|
showTime: true,
|
||||||
valueFormat: 'x',
|
valueFormat: 'x',
|
||||||
},
|
},
|
||||||
|
// 维修中(≥CONFIRMED)态展示;仅"完成维修"弹窗可编辑并必填,其余态只读回显
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.CONFIRMED,
|
||||||
|
disabled: formType !== 'confirm',
|
||||||
|
rules: () => (formType === 'confirm' ? 'required' : null),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'confirmUserId',
|
fieldName: 'confirmUserId',
|
||||||
|
|
@ -122,10 +153,18 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
clearable: true,
|
clearable: true,
|
||||||
api: getSimpleUserList,
|
api: getSimpleUserList,
|
||||||
|
disabled: true,
|
||||||
labelField: 'nickname',
|
labelField: 'nickname',
|
||||||
placeholder: '请选择验收人',
|
placeholder: '请选择验收人',
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
},
|
},
|
||||||
|
// 验收信息为已确认(≥FINISHED)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.FINISHED,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'confirmDate',
|
fieldName: 'confirmDate',
|
||||||
|
|
@ -133,19 +172,35 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
component: 'DatePicker',
|
component: 'DatePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: '!w-full',
|
class: '!w-full',
|
||||||
|
disabled: true,
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
placeholder: '请选择验收日期',
|
placeholder: '请选择验收日期',
|
||||||
showTime: true,
|
showTime: true,
|
||||||
valueFormat: 'x',
|
valueFormat: 'x',
|
||||||
},
|
},
|
||||||
|
// 验收信息为已确认(≥FINISHED)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.FINISHED,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'result',
|
fieldName: 'result',
|
||||||
label: '维修结果',
|
label: '维修结果',
|
||||||
component: 'RadioGroup',
|
component: 'RadioGroup',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
options: getDictOptions(DICT_TYPE.MES_DV_REPAIR_RESULT, 'number'),
|
options: getDictOptions(DICT_TYPE.MES_DV_REPAIR_RESULT, 'number'),
|
||||||
},
|
},
|
||||||
|
// 验收信息为已确认(≥FINISHED)态自动产生的只读回显字段
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['status'],
|
||||||
|
if: (values) =>
|
||||||
|
values.status != null &&
|
||||||
|
values.status >= MesDvRepairStatusEnum.FINISHED,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
|
|
@ -153,6 +208,7 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
formItemClass: 'col-span-3',
|
formItemClass: 'col-span-3',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
disabled: headerReadonly,
|
||||||
placeholder: '请输入备注',
|
placeholder: '请输入备注',
|
||||||
rows: 3,
|
rows: 3,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -28,20 +28,29 @@ const emit = defineEmits(['success']);
|
||||||
const formType = ref<FormType>('create');
|
const formType = ref<FormType>('create');
|
||||||
const formData = ref<MesDvRepairApi.Repair>();
|
const formData = ref<MesDvRepairApi.Repair>();
|
||||||
const isDetail = computed(() => formType.value === 'detail');
|
const isDetail = computed(() => formType.value === 'detail');
|
||||||
const isReadonly = computed(() => ['confirm', 'detail', 'finish'].includes(formType.value));
|
const isLineReadonly = computed(() =>
|
||||||
|
// 明细只读:完成维修/验收/详情态明细均不可编辑
|
||||||
|
['confirm', 'detail', 'finish'].includes(formType.value),
|
||||||
|
);
|
||||||
|
const isFormDisabled = computed(() =>
|
||||||
|
// 整表禁用:仅详情/验收态;完成维修态需放开 finishDate,故单头只读改由 schema 逐字段控制
|
||||||
|
['detail', 'finish'].includes(formType.value),
|
||||||
|
);
|
||||||
const canSubmit = computed(
|
const canSubmit = computed(
|
||||||
() => formType.value === 'update' && formData.value?.status === MesDvRepairStatusEnum.PREPARE,
|
() => formType.value === 'update' && formData.value?.status === MesDvRepairStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
const getTitle = computed(
|
const getTitle = computed(() => {
|
||||||
() =>
|
if (formType.value === 'detail') {
|
||||||
({
|
return '查看维修工单';
|
||||||
create: '新增维修工单',
|
}
|
||||||
update: '修改维修工单',
|
if (formType.value === 'confirm') {
|
||||||
confirm: '完成维修',
|
return '完成维修';
|
||||||
finish: '验收维修',
|
}
|
||||||
detail: '查看维修工单',
|
if (formType.value === 'finish') {
|
||||||
})[formType.value],
|
return '验收维修';
|
||||||
);
|
}
|
||||||
|
return formType.value === 'update' ? '修改维修工单' : '新增维修工单';
|
||||||
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
|
|
@ -161,11 +170,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
formApi.setDisabled(isReadonly.value);
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
|
formApi.setDisabled(isFormDisabled.value);
|
||||||
modalApi.setState({ showConfirmButton: ['create', 'update'].includes(formType.value) });
|
modalApi.setState({ showConfirmButton: ['create', 'update'].includes(formType.value) });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -184,7 +193,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
<template>
|
<template>
|
||||||
<Modal :title="getTitle" class="w-4/5">
|
<Modal :title="getTitle" class="w-4/5">
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
<LineList v-if="formData?.id" :disabled="isReadonly" :repair-id="formData.id" />
|
<LineList v-if="formData?.id" :disabled="isLineReadonly" :repair-id="formData.id" />
|
||||||
<template #prepend-footer>
|
<template #prepend-footer>
|
||||||
<div class="flex flex-auto items-center gap-2">
|
<div class="flex flex-auto items-center gap-2">
|
||||||
<ElPopconfirm
|
<ElPopconfirm
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改点检保养项目的表单 */
|
/** 新增/修改点检保养项目的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -39,17 +42,20 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入项目编码',
|
placeholder: '请输入项目编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改客户的表单 */
|
/** 新增/修改客户的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -34,19 +37,22 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入客户编码',
|
placeholder: '请输入客户编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(
|
ElButton,
|
||||||
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
{
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '自动生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '自动生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'productSalesLine';
|
subTabsName.value = 'productSalesLine';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,31 @@ const [Grid] = useVbenVxeGrid({
|
||||||
width: 140,
|
width: 140,
|
||||||
slots: { default: 'itemCode' },
|
slots: { default: 'itemCode' },
|
||||||
},
|
},
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
{
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
field: 'itemName',
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
title: '物料名称',
|
||||||
{ field: 'quantity', title: '出库数量', width: 120 },
|
minWidth: 150,
|
||||||
{ field: 'batchCode', title: '批次号', minWidth: 140 },
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '出库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'batchCode',
|
||||||
|
title: '批次号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 320,
|
height: 320,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,21 @@ const props = defineProps<{
|
||||||
const [Grid] = useVbenVxeGrid({
|
const [Grid] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'code', title: '出库单编号', minWidth: 160 },
|
{
|
||||||
{ field: 'name', title: '出库单名称', minWidth: 150 },
|
field: 'code',
|
||||||
{ field: 'salesOrderCode', title: '销售订单编号', minWidth: 140 },
|
title: '出库单编号',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
title: '出库单名称',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'salesOrderCode',
|
||||||
|
title: '销售订单编号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'salesDate',
|
field: 'salesDate',
|
||||||
title: '出库日期',
|
title: '出库日期',
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改物料产品的表单 */
|
/** 新增/修改物料产品的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -38,19 +41,22 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入物料编码',
|
placeholder: '请输入物料编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '物料编码不能为空').max(64),
|
rules: z.string().min(1, '物料编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(
|
ElButton,
|
||||||
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
{
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'bom';
|
subTabsName.value = 'bom';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -68,25 +68,33 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'bomItemCode',
|
fieldName: 'bomItemCode',
|
||||||
label: 'BOM 物料编码',
|
label: 'BOM 物料编码',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'bomItemName',
|
fieldName: 'bomItemName',
|
||||||
label: 'BOM 物料名称',
|
label: 'BOM 物料名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'bomItemSpecification',
|
fieldName: 'bomItemSpecification',
|
||||||
label: '规格型号',
|
label: '规格型号',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'unitMeasureName',
|
fieldName: 'unitMeasureName',
|
||||||
label: '单位',
|
label: '单位',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'quantity',
|
fieldName: 'quantity',
|
||||||
|
|
@ -105,7 +113,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,9 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'title',
|
fieldName: 'title',
|
||||||
label: '标题',
|
label: '标题',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { placeholder: '请输入标题' },
|
componentProps: {
|
||||||
|
placeholder: '请输入标题',
|
||||||
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -97,7 +99,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'description',
|
fieldName: 'description',
|
||||||
label: '内容说明',
|
label: '内容说明',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入详细描述', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入详细描述',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'processId',
|
fieldName: 'processId',
|
||||||
|
|
@ -108,13 +113,19 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'url',
|
fieldName: 'url',
|
||||||
label: '图片',
|
label: '图片',
|
||||||
component: markRaw(ImageUpload),
|
component: markRaw(ImageUpload),
|
||||||
componentProps: { maxNumber: 1, showDescription: false },
|
componentProps: {
|
||||||
|
maxNumber: 1,
|
||||||
|
showDescription: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,14 @@ import { z } from '#/adapter/form';
|
||||||
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
import { getItemTypeList } from '#/api/mes/md/item/type';
|
import { getItemTypeList } from '#/api/mes/md/item/type';
|
||||||
|
|
||||||
|
/** 表单类型 */
|
||||||
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改物料分类的表单 */
|
/** 新增/修改物料分类的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -64,19 +70,22 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入分类编码',
|
placeholder: '请输入分类编码',
|
||||||
},
|
},
|
||||||
rules: z.string().min(1, '分类编码不能为空').max(64),
|
rules: z.string().min(1, '分类编码不能为空').max(64),
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(
|
ElButton,
|
||||||
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
{
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '自动生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '自动生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<MesMdItemTypeApi.ItemType>();
|
const data = modalApi.getData<MesMdItemTypeApi.ItemType>();
|
||||||
|
formApi.setState({
|
||||||
|
schema: useFormSchema(data?.id ? 'update' : 'create', formApi),
|
||||||
|
});
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
formData.value = data || undefined;
|
formData.value = data || undefined;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改供应商的表单 */
|
/** 新增/修改供应商的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -34,19 +37,22 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入供应商编码',
|
placeholder: '请输入供应商编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(
|
ElButton,
|
||||||
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
{
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '自动生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '自动生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'itemReceiptLine';
|
subTabsName.value = 'itemReceiptLine';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,36 @@ function formatDate(value: Date | number | string | undefined) {
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'itemCode', title: '物料编码', width: 140 },
|
{
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
field: 'itemCode',
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
title: '物料编码',
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
width: 140,
|
||||||
{ field: 'receivedQuantity', title: '入库数量', width: 120 },
|
},
|
||||||
{ field: 'batchCode', title: '批次号', minWidth: 140 },
|
{
|
||||||
|
field: 'itemName',
|
||||||
|
title: '物料名称',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receivedQuantity',
|
||||||
|
title: '入库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'batchCode',
|
||||||
|
title: '批次号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 280,
|
height: 280,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,31 @@ const [Grid] = useVbenVxeGrid({
|
||||||
width: 140,
|
width: 140,
|
||||||
slots: { default: 'itemCode' },
|
slots: { default: 'itemCode' },
|
||||||
},
|
},
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
{
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
field: 'itemName',
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
title: '物料名称',
|
||||||
{ field: 'receivedQuantity', title: '入库数量', width: 120 },
|
minWidth: 150,
|
||||||
{ field: 'batchCode', title: '批次号', minWidth: 140 },
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receivedQuantity',
|
||||||
|
title: '入库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'batchCode',
|
||||||
|
title: '批次号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 320,
|
height: 320,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,36 @@ const [Grid] = useVbenVxeGrid({
|
||||||
minWidth: 160,
|
minWidth: 160,
|
||||||
slots: { default: 'receiptCode' },
|
slots: { default: 'receiptCode' },
|
||||||
},
|
},
|
||||||
{ field: 'purchaseOrderCode', title: '采购订单号', minWidth: 150 },
|
{
|
||||||
{ field: 'itemCode', title: '物料编码', width: 140 },
|
field: 'purchaseOrderCode',
|
||||||
{ field: 'itemName', title: '物料名称', minWidth: 150 },
|
title: '采购订单号',
|
||||||
{ field: 'specification', title: '规格型号', minWidth: 140 },
|
minWidth: 150,
|
||||||
{ field: 'unitMeasureName', title: '单位', width: 100 },
|
},
|
||||||
{ field: 'receivedQuantity', title: '入库数量', width: 120 },
|
{
|
||||||
|
field: 'itemCode',
|
||||||
|
title: '物料编码',
|
||||||
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'itemName',
|
||||||
|
title: '物料名称',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'specification',
|
||||||
|
title: '规格型号',
|
||||||
|
minWidth: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'unitMeasureName',
|
||||||
|
title: '单位',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'receivedQuantity',
|
||||||
|
title: '入库数量',
|
||||||
|
width: 120,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
height: 320,
|
height: 320,
|
||||||
keepSource: true,
|
keepSource: true,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@ import { MdWorkshopSelect } from './components';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改工作站的表单 */
|
/** 新增/修改工作站的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -40,19 +43,22 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入工作站编码',
|
placeholder: '请输入工作站编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(
|
ElButton,
|
||||||
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
{
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'machine';
|
subTabsName.value = 'machine';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -90,10 +93,26 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
border: true,
|
border: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'machineryCode', title: '设备编码', width: 140 },
|
{
|
||||||
{ field: 'machineryName', title: '设备名称', minWidth: 160 },
|
field: 'machineryCode',
|
||||||
{ field: 'quantity', title: '数量', width: 100 },
|
title: '设备编码',
|
||||||
{ field: 'remark', title: '备注', minWidth: 160 },
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'machineryName',
|
||||||
|
title: '设备名称',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '数量',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 90,
|
width: 90,
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -101,10 +104,26 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
border: true,
|
border: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'toolTypeId', title: '工具类型编号', width: 140 },
|
{
|
||||||
{ field: 'toolTypeName', title: '工具类型名称', minWidth: 160 },
|
field: 'toolTypeId',
|
||||||
{ field: 'quantity', title: '数量', width: 100 },
|
title: '工具类型编号',
|
||||||
{ field: 'remark', title: '备注', minWidth: 160 },
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'toolTypeName',
|
||||||
|
title: '工具类型名称',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '数量',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 130,
|
width: 130,
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,10 @@ const [Form, formApi] = useVbenForm({
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { placeholder: '请输入备注', rows: 3 },
|
componentProps: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
|
|
@ -97,10 +100,26 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
border: true,
|
border: true,
|
||||||
columns: [
|
columns: [
|
||||||
{ field: 'postId', title: '岗位编号', width: 140 },
|
{
|
||||||
{ field: 'postName', title: '岗位名称', minWidth: 160 },
|
field: 'postId',
|
||||||
{ field: 'quantity', title: '数量', width: 100 },
|
title: '岗位编号',
|
||||||
{ field: 'remark', title: '备注', minWidth: 160 },
|
width: 140,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'postName',
|
||||||
|
title: '岗位名称',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: '数量',
|
||||||
|
width: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 160,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 130,
|
width: 130,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ import { getSimpleUserList } from '#/api/system/user';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改车间的表单 */
|
/** 新增/修改车间的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -41,19 +44,22 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(
|
ElButton,
|
||||||
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
{
|
||||||
);
|
onClick: async () => {
|
||||||
await formApi?.setFieldValue('code', code);
|
const code = await generateAutoCode(
|
||||||
},
|
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
||||||
},
|
);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,9 @@ export function useFormSchema(
|
||||||
fieldName: 'itemCode',
|
fieldName: 'itemCode',
|
||||||
label: '产品编码',
|
label: '产品编码',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
@ -336,7 +338,9 @@ export function useFormSchema(
|
||||||
fieldName: 'itemName',
|
fieldName: 'itemName',
|
||||||
label: '产品名称',
|
label: '产品名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
@ -346,7 +350,9 @@ export function useFormSchema(
|
||||||
fieldName: 'unitMeasureName',
|
fieldName: 'unitMeasureName',
|
||||||
label: '单位',
|
label: '单位',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
@ -356,7 +362,9 @@ export function useFormSchema(
|
||||||
fieldName: 'itemSpecification',
|
fieldName: 'itemSpecification',
|
||||||
label: '规格',
|
label: '规格',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { disabled: true },
|
componentProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['itemCode'],
|
triggerFields: ['itemCode'],
|
||||||
show: (values) => !!values.itemCode,
|
show: (values) => !!values.itemCode,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import type { MesProRouteProcessApi } from '#/api/mes/pro/route/process';
|
||||||
import type { MesProRouteProductApi } from '#/api/mes/pro/route/product';
|
import type { MesProRouteProductApi } from '#/api/mes/pro/route/product';
|
||||||
import type { MesProRouteProductBomApi } from '#/api/mes/pro/route/productbom';
|
import type { MesProRouteProductBomApi } from '#/api/mes/pro/route/productbom';
|
||||||
|
|
||||||
import { h } from 'vue';
|
import { h, markRaw } from 'vue';
|
||||||
|
|
||||||
import { CommonStatusEnum, DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants';
|
import { CommonStatusEnum, DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants';
|
||||||
import { getDictOptions } from '@vben/hooks';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
@ -97,13 +97,19 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
fieldName: 'code',
|
fieldName: 'code',
|
||||||
label: '路线编码',
|
label: '路线编码',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { clearable: true, placeholder: '请输入路线编码' },
|
componentProps: {
|
||||||
|
clearable: true,
|
||||||
|
placeholder: '请输入路线编码',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
label: '路线名称',
|
label: '路线名称',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: { clearable: true, placeholder: '请输入路线名称' },
|
componentProps: {
|
||||||
|
clearable: true,
|
||||||
|
placeholder: '请输入路线名称',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
|
|
@ -225,14 +231,20 @@ export function useRouteProcessFormSchema(
|
||||||
fieldName: 'keyFlag',
|
fieldName: 'keyFlag',
|
||||||
label: '是否关键工序',
|
label: '是否关键工序',
|
||||||
component: 'Switch',
|
component: 'Switch',
|
||||||
componentProps: { activeText: '是', inactiveText: '否' },
|
componentProps: {
|
||||||
|
activeText: '是',
|
||||||
|
inactiveText: '否',
|
||||||
|
},
|
||||||
rules: z.boolean().default(false),
|
rules: z.boolean().default(false),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'checkFlag',
|
fieldName: 'checkFlag',
|
||||||
label: '是否质检确认',
|
label: '是否质检确认',
|
||||||
component: 'Switch',
|
component: 'Switch',
|
||||||
componentProps: { activeText: '是', inactiveText: '否' },
|
componentProps: {
|
||||||
|
activeText: '是',
|
||||||
|
inactiveText: '否',
|
||||||
|
},
|
||||||
rules: z.boolean().default(false),
|
rules: z.boolean().default(false),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -264,7 +276,11 @@ export function useRouteProcessFormSchema(
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
componentProps: { maxLength: 250, placeholder: '请输入备注', rows: 2 },
|
componentProps: {
|
||||||
|
maxLength: 250,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +399,7 @@ export function useRouteProductFormSchema(
|
||||||
{
|
{
|
||||||
fieldName: 'itemId',
|
fieldName: 'itemId',
|
||||||
label: '产品',
|
label: '产品',
|
||||||
component: MdItemSelect as any,
|
component: markRaw(MdItemSelect),
|
||||||
componentProps: {
|
componentProps: {
|
||||||
onChange: onItemChange,
|
onChange: onItemChange,
|
||||||
},
|
},
|
||||||
|
|
@ -430,7 +446,11 @@ export function useRouteProductFormSchema(
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-2',
|
||||||
componentProps: { maxLength: 250, placeholder: '请输入备注', rows: 2 },
|
componentProps: {
|
||||||
|
maxLength: 250,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -465,7 +485,7 @@ export function useRouteProductBomFormSchema(
|
||||||
{
|
{
|
||||||
fieldName: 'itemId',
|
fieldName: 'itemId',
|
||||||
label: 'BOM 物料',
|
label: 'BOM 物料',
|
||||||
component: MdProductBomSelect as any,
|
component: markRaw(MdProductBomSelect),
|
||||||
componentProps: () => ({
|
componentProps: () => ({
|
||||||
itemId: itemId(),
|
itemId: itemId(),
|
||||||
onChange: onBomChange,
|
onChange: onBomChange,
|
||||||
|
|
@ -489,7 +509,11 @@ export function useRouteProductBomFormSchema(
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: { maxLength: 250, placeholder: '请输入备注', rows: 2 },
|
componentProps: {
|
||||||
|
maxLength: 250,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
rows: 2,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ import { TmToolTypeSelect } from './type/components';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改工具的表单 */
|
/** 新增/修改工具的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -29,6 +32,15 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
show: () => false,
|
show: () => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// 选中工具类型是否「编码管理」,用于锁定库存数量为 1(隐藏字段)
|
||||||
|
fieldName: 'codeFlag',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: [''],
|
||||||
|
show: () => false,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'code',
|
fieldName: 'code',
|
||||||
label: '工具编码',
|
label: '工具编码',
|
||||||
|
|
@ -41,17 +53,20 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: (values) => ({ disabled: !!values.id }),
|
componentProps: (values) => ({ disabled: !!values.id }),
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
@ -69,7 +84,9 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择工具类型',
|
placeholder: '请选择工具类型',
|
||||||
onChange: async (row: any) => {
|
onChange: async (row: any) => {
|
||||||
if (row?.codeFlag) {
|
// 记录是否编码管理;编码管理类型库存数量锁定为 1
|
||||||
|
await formApi?.setFieldValue('codeFlag', row?.codeFlag === true);
|
||||||
|
if (row?.codeFlag === true) {
|
||||||
await formApi?.setFieldValue('quantity', 1);
|
await formApi?.setFieldValue('quantity', 1);
|
||||||
await formApi?.setFieldValue('availableQuantity', 1);
|
await formApi?.setFieldValue('availableQuantity', 1);
|
||||||
}
|
}
|
||||||
|
|
@ -110,6 +127,13 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
precision: 0,
|
precision: 0,
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
|
// 编码管理类型库存数量锁定为 1,禁止修改
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['codeFlag'],
|
||||||
|
componentProps: (values) => ({
|
||||||
|
disabled: values.codeFlag === true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'availableQuantity',
|
fieldName: 'availableQuantity',
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||||
export type FormType = 'create' | 'detail' | 'update';
|
export type FormType = 'create' | 'detail' | 'update';
|
||||||
|
|
||||||
/** 新增/修改工具类型的表单 */
|
/** 新增/修改工具类型的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -34,17 +37,20 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
placeholder: '请输入类型编码',
|
placeholder: '请输入类型编码',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
suffix: () =>
|
suffix:
|
||||||
h(
|
formType === 'detail'
|
||||||
ElButton,
|
? undefined
|
||||||
{
|
: () =>
|
||||||
onClick: async () => {
|
h(
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_TYPE_CODE);
|
ElButton,
|
||||||
await formApi?.setFieldValue('code', code);
|
{
|
||||||
},
|
onClick: async () => {
|
||||||
},
|
const code = await generateAutoCode(MesAutoCodeRuleCode.TM_TOOL_TYPE_CODE);
|
||||||
{ default: () => '生成' },
|
await formApi?.setFieldValue('code', code);
|
||||||
),
|
},
|
||||||
|
},
|
||||||
|
{ default: () => '生成' },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
formData.value = undefined;
|
formData.value = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(data.formType, formApi) });
|
||||||
formApi.setDisabled(formType.value === 'detail');
|
formApi.setDisabled(formType.value === 'detail');
|
||||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||||
if (!data?.id) {
|
if (!data?.id) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue