feat(mes): 迁移 wm 里的 return-* 系列(优化代码)
parent
2fd44246f8
commit
f5fbd85e26
|
|
@ -0,0 +1,52 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { getBatch } from '#/api/mes/wm/batch';
|
||||||
|
import { useDescription } from '#/components/description';
|
||||||
|
|
||||||
|
import { useDetailSchema } from '../data';
|
||||||
|
|
||||||
|
const detailData = ref<MesWmBatchApi.Batch>(); // 当前批次详情
|
||||||
|
|
||||||
|
const [Descriptions] = useDescription({
|
||||||
|
bordered: true,
|
||||||
|
column: 3,
|
||||||
|
schema: useDetailSchema(),
|
||||||
|
useCard: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
showCancelButton: false,
|
||||||
|
showConfirmButton: false,
|
||||||
|
async onOpenChange(isOpen) {
|
||||||
|
if (!isOpen) {
|
||||||
|
detailData.value = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = modalApi.getData<{ id?: number }>();
|
||||||
|
if (!data?.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
modalApi.lock();
|
||||||
|
try {
|
||||||
|
detailData.value = await getBatch(data.id);
|
||||||
|
} finally {
|
||||||
|
modalApi.unlock();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open: (id: number) => modalApi.setData({ id }).open(),
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal title="批次详情" class="w-3/5">
|
||||||
|
<Descriptions class="mx-4" :data="detailData" />
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
|
|
@ -37,25 +37,19 @@ const canSubmit = computed(() => // 是否可提交
|
||||||
formType.value === 'update' &&
|
formType.value === 'update' &&
|
||||||
formData.value?.status === MesWmReturnIssueStatusEnum.PREPARE,
|
formData.value?.status === MesWmReturnIssueStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
// TODO @AI:这种标题风格,需要调整对齐
|
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
switch (formType.value) {
|
if (formType.value === 'detail') {
|
||||||
case 'detail': {
|
|
||||||
return $t('ui.actionTitle.view', ['生产退料单']);
|
return $t('ui.actionTitle.view', ['生产退料单']);
|
||||||
}
|
}
|
||||||
case 'finish': {
|
if (formType.value === 'stock') {
|
||||||
return '执行退料';
|
|
||||||
}
|
|
||||||
case 'stock': {
|
|
||||||
return '入库上架';
|
return '入库上架';
|
||||||
}
|
}
|
||||||
case 'update': {
|
if (formType.value === 'finish') {
|
||||||
return $t('ui.actionTitle.edit', ['生产退料单']);
|
return '执行退料';
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return $t('ui.actionTitle.create', ['生产退料单']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return formType.value === 'update'
|
||||||
|
? $t('ui.actionTitle.edit', ['生产退料单'])
|
||||||
|
: $t('ui.actionTitle.create', ['生产退料单']);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
|
|
|
||||||
|
|
@ -38,23 +38,18 @@ const canSubmit = computed(() => // 是否可提交
|
||||||
formData.value?.status === MesWmReturnSalesStatusEnum.PREPARE,
|
formData.value?.status === MesWmReturnSalesStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
switch (formType.value) {
|
if (formType.value === 'detail') {
|
||||||
case 'detail': {
|
|
||||||
return $t('ui.actionTitle.view', ['销售退货单']);
|
return $t('ui.actionTitle.view', ['销售退货单']);
|
||||||
}
|
}
|
||||||
case 'finish': {
|
if (formType.value === 'stock') {
|
||||||
return '执行退货';
|
|
||||||
}
|
|
||||||
case 'stock': {
|
|
||||||
return '执行上架';
|
return '执行上架';
|
||||||
}
|
}
|
||||||
case 'update': {
|
if (formType.value === 'finish') {
|
||||||
return $t('ui.actionTitle.edit', ['销售退货单']);
|
return '执行退货';
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return $t('ui.actionTitle.create', ['销售退货单']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return formType.value === 'update'
|
||||||
|
? $t('ui.actionTitle.edit', ['销售退货单'])
|
||||||
|
: $t('ui.actionTitle.create', ['销售退货单']);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
|
|
|
||||||
|
|
@ -39,23 +39,18 @@ const canSubmit = computed(() => // 是否可提交
|
||||||
formData.value?.status === MesWmReturnVendorStatusEnum.PREPARE,
|
formData.value?.status === MesWmReturnVendorStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
switch (formType.value) {
|
if (formType.value === 'detail') {
|
||||||
case 'detail': {
|
|
||||||
return $t('ui.actionTitle.view', ['供应商退货单']);
|
return $t('ui.actionTitle.view', ['供应商退货单']);
|
||||||
}
|
}
|
||||||
case 'finish': {
|
if (formType.value === 'stock') {
|
||||||
return '完成退货';
|
|
||||||
}
|
|
||||||
case 'stock': {
|
|
||||||
return '执行拣货';
|
return '执行拣货';
|
||||||
}
|
}
|
||||||
case 'update': {
|
if (formType.value === 'finish') {
|
||||||
return $t('ui.actionTitle.edit', ['供应商退货单']);
|
return '完成退货';
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return $t('ui.actionTitle.create', ['供应商退货单']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return formType.value === 'update'
|
||||||
|
? $t('ui.actionTitle.edit', ['供应商退货单'])
|
||||||
|
: $t('ui.actionTitle.create', ['供应商退货单']);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { getBatch } from '#/api/mes/wm/batch';
|
||||||
|
import { useDescription } from '#/components/description';
|
||||||
|
|
||||||
|
import { useDetailSchema } from '../data';
|
||||||
|
|
||||||
|
const detailData = ref<MesWmBatchApi.Batch>(); // 当前批次详情
|
||||||
|
|
||||||
|
const [Descriptions] = useDescription({
|
||||||
|
border: true,
|
||||||
|
column: 3,
|
||||||
|
schema: useDetailSchema(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
showCancelButton: false,
|
||||||
|
showConfirmButton: false,
|
||||||
|
async onOpenChange(isOpen) {
|
||||||
|
if (!isOpen) {
|
||||||
|
detailData.value = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = modalApi.getData<{ id?: number }>();
|
||||||
|
if (!data?.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
modalApi.lock();
|
||||||
|
try {
|
||||||
|
detailData.value = await getBatch(data.id);
|
||||||
|
} finally {
|
||||||
|
modalApi.unlock();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open: (id: number) => modalApi.setData({ id }).open(),
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal title="批次详情" class="w-3/5">
|
||||||
|
<Descriptions class="mx-4" :data="detailData" />
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
|
|
@ -38,23 +38,18 @@ const canSubmit = computed(() => // 是否可提交
|
||||||
formData.value?.status === MesWmReturnIssueStatusEnum.PREPARE,
|
formData.value?.status === MesWmReturnIssueStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
switch (formType.value) {
|
if (formType.value === 'detail') {
|
||||||
case 'detail': {
|
|
||||||
return $t('ui.actionTitle.view', ['生产退料单']);
|
return $t('ui.actionTitle.view', ['生产退料单']);
|
||||||
}
|
}
|
||||||
case 'finish': {
|
if (formType.value === 'stock') {
|
||||||
return '执行退料';
|
|
||||||
}
|
|
||||||
case 'stock': {
|
|
||||||
return '入库上架';
|
return '入库上架';
|
||||||
}
|
}
|
||||||
case 'update': {
|
if (formType.value === 'finish') {
|
||||||
return $t('ui.actionTitle.edit', ['生产退料单']);
|
return '执行退料';
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return $t('ui.actionTitle.create', ['生产退料单']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return formType.value === 'update'
|
||||||
|
? $t('ui.actionTitle.edit', ['生产退料单'])
|
||||||
|
: $t('ui.actionTitle.create', ['生产退料单']);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
|
|
|
||||||
|
|
@ -38,23 +38,18 @@ const canSubmit = computed(() => // 是否可提交
|
||||||
formData.value?.status === MesWmReturnSalesStatusEnum.PREPARE,
|
formData.value?.status === MesWmReturnSalesStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
switch (formType.value) {
|
if (formType.value === 'detail') {
|
||||||
case 'detail': {
|
|
||||||
return $t('ui.actionTitle.view', ['销售退货单']);
|
return $t('ui.actionTitle.view', ['销售退货单']);
|
||||||
}
|
}
|
||||||
case 'finish': {
|
if (formType.value === 'stock') {
|
||||||
return '执行退货';
|
|
||||||
}
|
|
||||||
case 'stock': {
|
|
||||||
return '执行上架';
|
return '执行上架';
|
||||||
}
|
}
|
||||||
case 'update': {
|
if (formType.value === 'finish') {
|
||||||
return $t('ui.actionTitle.edit', ['销售退货单']);
|
return '执行退货';
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return $t('ui.actionTitle.create', ['销售退货单']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return formType.value === 'update'
|
||||||
|
? $t('ui.actionTitle.edit', ['销售退货单'])
|
||||||
|
: $t('ui.actionTitle.create', ['销售退货单']);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
|
|
|
||||||
|
|
@ -39,23 +39,18 @@ const canSubmit = computed(() => // 是否可提交
|
||||||
formData.value?.status === MesWmReturnVendorStatusEnum.PREPARE,
|
formData.value?.status === MesWmReturnVendorStatusEnum.PREPARE,
|
||||||
);
|
);
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
switch (formType.value) {
|
if (formType.value === 'detail') {
|
||||||
case 'detail': {
|
|
||||||
return $t('ui.actionTitle.view', ['供应商退货单']);
|
return $t('ui.actionTitle.view', ['供应商退货单']);
|
||||||
}
|
}
|
||||||
case 'finish': {
|
if (formType.value === 'stock') {
|
||||||
return '完成退货';
|
|
||||||
}
|
|
||||||
case 'stock': {
|
|
||||||
return '执行拣货';
|
return '执行拣货';
|
||||||
}
|
}
|
||||||
case 'update': {
|
if (formType.value === 'finish') {
|
||||||
return $t('ui.actionTitle.edit', ['供应商退货单']);
|
return '完成退货';
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return $t('ui.actionTitle.create', ['供应商退货单']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return formType.value === 'update'
|
||||||
|
? $t('ui.actionTitle.edit', ['供应商退货单'])
|
||||||
|
: $t('ui.actionTitle.create', ['供应商退货单']);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue