feat(mes): 优化 generateAutoCode 的调用,减少 try catch
parent
f79dffcf2e
commit
b4e7573d10
|
|
@ -55,12 +55,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,8 @@ export function useFormSchema(formType: FormType, formApi?: VbenFormApi): VbenFo
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -45,14 +45,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -53,14 +53,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.PRO_PROCESS_CODE,
|
MesAutoCodeRuleCode.PRO_PROCESS_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.PRO_ROUTE_CODE,
|
MesAutoCodeRuleCode.PRO_ROUTE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
// TODO @AI:是不是可以使用 description 组件?
|
|
||||||
import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
@ -14,8 +13,6 @@ const detailData = ref<MesWmBatchApi.Batch>(); // 当前批次详情
|
||||||
const subTabsName = ref<'backward' | 'forward'>('forward'); // 当前激活的追溯方向
|
const subTabsName = ref<'backward' | 'forward'>('forward'); // 当前激活的追溯方向
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
const [Modal, modalApi] = useVbenModal({
|
||||||
showCancelButton: false,
|
|
||||||
showConfirmButton: false,
|
|
||||||
onOpenChange(isOpen) {
|
onOpenChange(isOpen) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
detailData.value = undefined;
|
detailData.value = undefined;
|
||||||
|
|
@ -28,7 +25,12 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal title="批次追溯" class="w-4/5">
|
<Modal
|
||||||
|
title="批次追溯"
|
||||||
|
class="w-4/5"
|
||||||
|
:show-cancel-button="false"
|
||||||
|
:show-confirm-button="false"
|
||||||
|
>
|
||||||
<div class="mx-4 mt-2">
|
<div class="mx-4 mt-2">
|
||||||
<Descriptions :column="3" bordered size="small">
|
<Descriptions :column="3" bordered size="small">
|
||||||
<Descriptions.Item label="批次编号">
|
<Descriptions.Item label="批次编号">
|
||||||
|
|
@ -75,7 +77,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
<Tabs
|
<Tabs
|
||||||
v-if="detailData?.code"
|
v-if="detailData?.code"
|
||||||
v-model:active-key="subTabsName"
|
v-model:active-key="subTabsName"
|
||||||
class="mx-4 mt-4"
|
class="mx-4! mt-4!"
|
||||||
type="card"
|
type="card"
|
||||||
>
|
>
|
||||||
<Tabs.TabPane key="forward" tab="向前追溯">
|
<Tabs.TabPane key="forward" tab="向前追溯">
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
||||||
|
|
||||||
import { ref, watch } from 'vue';
|
import { watch } from 'vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
|
|
@ -17,13 +17,9 @@ const props = defineProps<{
|
||||||
direction: 'backward' | 'forward'; // 追溯方向:forward=向前,backward=向后
|
direction: 'backward' | 'forward'; // 追溯方向:forward=向前,backward=向后
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const list = ref<MesWmBatchApi.Batch[]>([]); // 追溯结果列表
|
|
||||||
|
|
||||||
// TODO @AI:代码风格;
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useTraceGridColumns(),
|
columns: useTraceGridColumns(),
|
||||||
data: list.value,
|
|
||||||
minHeight: 240,
|
minHeight: 240,
|
||||||
pagerConfig: { enabled: false },
|
pagerConfig: { enabled: false },
|
||||||
rowConfig: { isHover: true, keyField: 'id' },
|
rowConfig: { isHover: true, keyField: 'id' },
|
||||||
|
|
@ -33,20 +29,18 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 加载追溯列表 */
|
/** 加载追溯列表 */
|
||||||
// TODO @AI:是不是可以在 useVbenVxeGrid 里面实现加载?
|
|
||||||
async function getList() {
|
async function getList() {
|
||||||
if (!props.batchCode) {
|
if (!props.batchCode) {
|
||||||
list.value = [];
|
await gridApi.grid?.loadData([]);
|
||||||
gridApi.setGridOptions({ data: list.value });
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gridApi.setLoading(true);
|
gridApi.setLoading(true);
|
||||||
try {
|
try {
|
||||||
list.value =
|
const list =
|
||||||
props.direction === 'forward'
|
props.direction === 'forward'
|
||||||
? await getForwardBatchList(props.batchCode)
|
? await getForwardBatchList(props.batchCode)
|
||||||
: await getBackwardBatchList(props.batchCode);
|
: await getBackwardBatchList(props.batchCode);
|
||||||
gridApi.setGridOptions({ data: list.value });
|
await gridApi.grid?.loadData(list);
|
||||||
} finally {
|
} finally {
|
||||||
gridApi.setLoading(false);
|
gridApi.setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_DEFECT_CODE,
|
MesAutoCodeRuleCode.QC_DEFECT_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_INDICATOR_CODE,
|
MesAutoCodeRuleCode.QC_INDICATOR_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,10 @@ export function useQcIndicatorResultFormSchema(
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_INDICATOR_RESULT_CODE,
|
MesAutoCodeRuleCode.QC_INDICATOR_RESULT_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,10 @@ function syncUnqualified(formApi?: VbenFormApi) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -87,16 +90,13 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
Button,
|
Button,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_IPQC_CODE,
|
MesAutoCodeRuleCode.QC_IPQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -160,6 +159,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcIpqcApi.Ipqc;
|
prefill?: MesQcIpqcApi.Ipqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
|
||||||
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',
|
||||||
|
|
@ -67,16 +70,13 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
Button,
|
Button,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_IQC_CODE,
|
MesAutoCodeRuleCode.QC_IQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -165,6 +164,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcIqcApi.Iqc;
|
prefill?: MesQcIqcApi.Iqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
|
||||||
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',
|
||||||
|
|
@ -66,16 +69,13 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
Button,
|
Button,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_OQC_CODE,
|
MesAutoCodeRuleCode.QC_OQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -159,6 +158,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcOqcApi.Oqc;
|
prefill?: MesQcOqcApi.Oqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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,7 +33,10 @@ function getRqcSourceDocTypeOptions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -79,16 +82,13 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
Button,
|
Button,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_RQC_CODE,
|
MesAutoCodeRuleCode.QC_RQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -159,6 +158,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcRqcApi.Rqc;
|
prefill?: MesQcRqcApi.Rqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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) {
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_TEMPLATE_CODE,
|
MesAutoCodeRuleCode.QC_TEMPLATE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -80,14 +80,10 @@ export function useFormSchema(
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.WM_AREA_CODE,
|
MesAutoCodeRuleCode.WM_AREA_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,10 @@ export function useFormSchema(
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.WM_WAREHOUSE_CODE,
|
MesAutoCodeRuleCode.WM_WAREHOUSE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,10 @@ export function useFormSchema(
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.WM_LOCATION_CODE,
|
MesAutoCodeRuleCode.WM_LOCATION_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_PLAN_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.CAL_TEAM_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_CHECK_PLAN_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,8 @@ export function useFormSchema(formType: FormType, formApi?: VbenFormApi): VbenFo
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_MACHINERY_TYPE_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_REPAIR_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,8 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
const code = await generateAutoCode(MesAutoCodeRuleCode.DV_SUBJECT_CODE);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
MesAutoCodeRuleCode.MD_CLIENT_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -45,14 +45,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
MesAutoCodeRuleCode.MD_ITEM_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
MesAutoCodeRuleCode.MD_ITEM_TYPE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
MesAutoCodeRuleCode.MD_VENDOR_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
MesAutoCodeRuleCode.MD_WORKSTATION_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
MesAutoCodeRuleCode.MD_WORKSHOP_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.PRO_PROCESS_CODE,
|
MesAutoCodeRuleCode.PRO_PROCESS_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
{
|
{
|
||||||
type: 'default',
|
type: 'default',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.PRO_ROUTE_CODE,
|
MesAutoCodeRuleCode.PRO_ROUTE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_DEFECT_CODE,
|
MesAutoCodeRuleCode.QC_DEFECT_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -41,14 +41,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_INDICATOR_CODE,
|
MesAutoCodeRuleCode.QC_INDICATOR_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,10 @@ export function useQcIndicatorResultFormSchema(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_INDICATOR_RESULT_CODE,
|
MesAutoCodeRuleCode.QC_INDICATOR_RESULT_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,10 @@ function syncUnqualified(formApi?: VbenFormApi) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -87,15 +90,12 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_IPQC_CODE,
|
MesAutoCodeRuleCode.QC_IPQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -166,6 +165,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcIpqcApi.Ipqc;
|
prefill?: MesQcIpqcApi.Ipqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
|
||||||
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',
|
||||||
|
|
@ -67,15 +70,12 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_IQC_CODE,
|
MesAutoCodeRuleCode.QC_IQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -167,6 +166,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcIqcApi.Iqc;
|
prefill?: MesQcIqcApi.Iqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
|
||||||
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',
|
||||||
|
|
@ -66,15 +69,12 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_OQC_CODE,
|
MesAutoCodeRuleCode.QC_OQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -166,6 +165,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcOqcApi.Oqc;
|
prefill?: MesQcOqcApi.Oqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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,7 +33,10 @@ function getRqcSourceDocTypeOptions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
export function useFormSchema(
|
||||||
|
formType: FormType,
|
||||||
|
formApi?: VbenFormApi,
|
||||||
|
): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
|
@ -79,15 +82,12 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
h(
|
h(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
|
disabled: formType === 'detail',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_RQC_CODE,
|
MesAutoCodeRuleCode.QC_RQC_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '生成' },
|
{ default: () => '生成' },
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
originalSnapshot.value = '';
|
originalSnapshot.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formApi.setState({ schema: useFormSchema(formApi) });
|
|
||||||
subTabsName.value = 'line';
|
subTabsName.value = 'line';
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
|
|
@ -166,6 +165,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
prefill?: MesQcRqcApi.Rqc;
|
prefill?: MesQcRqcApi.Rqc;
|
||||||
}>();
|
}>();
|
||||||
formType.value = data.formType;
|
formType.value = data.formType;
|
||||||
|
formApi.setState({ schema: useFormSchema(formType.value, 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) {
|
||||||
|
|
|
||||||
|
|
@ -45,14 +45,10 @@ export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.QC_TEMPLATE_CODE,
|
MesAutoCodeRuleCode.QC_TEMPLATE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -82,14 +82,10 @@ export function useFormSchema(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.WM_AREA_CODE,
|
MesAutoCodeRuleCode.WM_AREA_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,10 @@ export function useFormSchema(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.WM_WAREHOUSE_CODE,
|
MesAutoCodeRuleCode.WM_WAREHOUSE_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,10 @@ export function useFormSchema(
|
||||||
ElButton,
|
ElButton,
|
||||||
{
|
{
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
try {
|
|
||||||
const code = await generateAutoCode(
|
const code = await generateAutoCode(
|
||||||
MesAutoCodeRuleCode.WM_LOCATION_CODE,
|
MesAutoCodeRuleCode.WM_LOCATION_CODE,
|
||||||
);
|
);
|
||||||
await formApi?.setFieldValue('code', code);
|
await formApi?.setFieldValue('code', code);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ default: () => '自动生成' },
|
{ default: () => '自动生成' },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue