feat:代码初始化
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace LmsPdmRawFoilWorkOrderApi {
|
||||
/** 生箔工序工单信息 */
|
||||
export interface PdmRawFoilWorkOrder {
|
||||
containerName?: string; // 母卷号
|
||||
resourceName?: string; // 机台编码
|
||||
mfgOrderName?: string; // 生产工单
|
||||
productCode?: string; // 产品编码
|
||||
description?: string; // 产品名称
|
||||
theoryHeight?: number; // 理论长度
|
||||
eqpVelocity?: number; // 设备生产速度
|
||||
upCoilerDate?: string; // 上卷开始时间
|
||||
isReloadSend?: string; // 是否重新更新
|
||||
productinQty: number; // 重量
|
||||
realstartTime: string; // 开始时间
|
||||
realendTime: string; // 结束时间
|
||||
status?: string; // 状态
|
||||
finishType: string; // 完成方式
|
||||
agvno: string; // 车号
|
||||
remark: string; // 备注
|
||||
productArea: string; // 生产区域
|
||||
pointCode: string; // 点位编码
|
||||
isBaking: string; // 请求烘烤
|
||||
isInstor: string; // 请求入半成品库
|
||||
windRoll: string; // 收卷辊
|
||||
orderType: string; // 类型
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询生箔工序工单分页 */
|
||||
export function getPdmRawFoilWorkOrderPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder>>(
|
||||
'/lms/pdm-raw-foil-work-order/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询生箔工序工单详情 */
|
||||
export function getPdmRawFoilWorkOrder(id: number) {
|
||||
return requestClient.get<LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder>(
|
||||
`/lms/pdm-raw-foil-work-order/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增生箔工序工单 */
|
||||
export function createPdmRawFoilWorkOrder(data: LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder) {
|
||||
return requestClient.post('/lms/pdm-raw-foil-work-order/create', data);
|
||||
}
|
||||
|
||||
/** 修改生箔工序工单 */
|
||||
export function updatePdmRawFoilWorkOrder(data: LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder) {
|
||||
return requestClient.put('/lms/pdm-raw-foil-work-order/update', data);
|
||||
}
|
||||
|
||||
/** 删除生箔工序工单 */
|
||||
export function deletePdmRawFoilWorkOrder(id: number) {
|
||||
return requestClient.delete(`/lms/pdm-raw-foil-work-order/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除生箔工序工单 */
|
||||
export function deletePdmRawFoilWorkOrderList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/lms/pdm-raw-foil-work-order/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出生箔工序工单 */
|
||||
export function exportPdmRawFoilWorkOrder(params: any) {
|
||||
return requestClient.download('/lms/pdm-raw-foil-work-order/export-excel', { params });
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,560 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { LmsPdmRawFoilWorkOrderApi } from '#/api/lms/pdmrawfoilworkorder';
|
||||
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'containerName',
|
||||
label: '母卷号',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入母卷号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'resourceName',
|
||||
label: '机台编码',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入机台编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'mfgOrderName',
|
||||
label: '生产工单',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入生产工单',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productCode',
|
||||
label: '产品编码',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入产品编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'description',
|
||||
label: '产品名称',
|
||||
rules: 'required',
|
||||
component: 'RichTextarea',
|
||||
},
|
||||
{
|
||||
fieldName: 'theoryHeight',
|
||||
label: '理论长度',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入理论长度',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'eqpVelocity',
|
||||
label: '设备生产速度',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入设备生产速度',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'upCoilerDate',
|
||||
label: '上卷开始时间',
|
||||
rules: 'required',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isReloadSend',
|
||||
label: '是否重新更新',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入是否重新更新',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productinQty',
|
||||
label: '重量',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入重量',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'realstartTime',
|
||||
label: '开始时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'realendTime',
|
||||
label: '结束时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
rules: 'required',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [],
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'finishType',
|
||||
label: '完成方式',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择完成方式',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'agvno',
|
||||
label: '车号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入车号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productArea',
|
||||
label: '生产区域',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入生产区域',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'pointCode',
|
||||
label: '点位编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入点位编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isBaking',
|
||||
label: '请求烘烤',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入请求烘烤',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isInstor',
|
||||
label: '请求入半成品库',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入请求入半成品库',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'windRoll',
|
||||
label: '收卷辊',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入收卷辊',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'orderType',
|
||||
label: '类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择类型',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'containerName',
|
||||
label: '母卷号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入母卷号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'resourceName',
|
||||
label: '机台编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入机台编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'mfgOrderName',
|
||||
label: '生产工单',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入生产工单',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productCode',
|
||||
label: '产品编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入产品编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'description',
|
||||
label: '产品名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入产品名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'theoryHeight',
|
||||
label: '理论长度',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入理论长度',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'eqpVelocity',
|
||||
label: '设备生产速度',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入设备生产速度',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'upCoilerDate',
|
||||
label: '上卷开始时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isReloadSend',
|
||||
label: '是否重新更新',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入是否重新更新',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productinQty',
|
||||
label: '重量',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入重量',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'realstartTime',
|
||||
label: '开始时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'realendTime',
|
||||
label: '结束时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'finishType',
|
||||
label: '完成方式',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择完成方式',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'agvno',
|
||||
label: '车号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入车号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '创建时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productArea',
|
||||
label: '生产区域',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入生产区域',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'pointCode',
|
||||
label: '点位编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入点位编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isBaking',
|
||||
label: '请求烘烤',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入请求烘烤',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isInstor',
|
||||
label: '请求入半成品库',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入请求入半成品库',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'windRoll',
|
||||
label: '收卷辊',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入收卷辊',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'orderType',
|
||||
label: '类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择类型',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions<LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder>['columns'] {
|
||||
return [
|
||||
{ type: 'checkbox', width: 40 },
|
||||
{
|
||||
field: 'containerName',
|
||||
title: '母卷号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'resourceName',
|
||||
title: '机台编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'mfgOrderName',
|
||||
title: '生产工单',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'productCode',
|
||||
title: '产品编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: '产品名称',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'theoryHeight',
|
||||
title: '理论长度',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'eqpVelocity',
|
||||
title: '设备生产速度',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'upCoilerDate',
|
||||
title: '上卷开始时间',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isReloadSend',
|
||||
title: '是否重新更新',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'productinQty',
|
||||
title: '重量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'realstartTime',
|
||||
title: '开始时间',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'realendTime',
|
||||
title: '结束时间',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'finishType',
|
||||
title: '完成方式',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'agvno',
|
||||
title: '车号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 120,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'productArea',
|
||||
title: '生产区域',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'pointCode',
|
||||
title: '点位编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isBaking',
|
||||
title: '请求烘烤',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isInstor',
|
||||
title: '请求入半成品库',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'windRoll',
|
||||
title: '收卷辊',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'orderType',
|
||||
title: '类型',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { LmsPdmRawFoilWorkOrderApi } from '#/api/lms/pdmrawfoilworkorder';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { confirm, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
||||
|
||||
import { message } from 'antdv-next';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deletePdmRawFoilWorkOrder,
|
||||
deletePdmRawFoilWorkOrderList,
|
||||
exportPdmRawFoilWorkOrder,
|
||||
getPdmRawFoilWorkOrderPage,
|
||||
} from '#/api/lms/pdmrawfoilworkorder';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 创建生箔工序工单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑生箔工序工单 */
|
||||
function handleEdit(row: LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除生箔工序工单 */
|
||||
async function handleDelete(row: LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deletePdmRawFoilWorkOrder(row.id!);
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
/** 批量删除生箔工序工单 */
|
||||
async function handleDeleteBatch() {
|
||||
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deletingBatch'),
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deletePdmRawFoilWorkOrderList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
const checkedIds = ref<number[]>([]);
|
||||
function handleRowCheckboxChange({
|
||||
records,
|
||||
}: {
|
||||
records: LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportPdmRawFoilWorkOrder(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '生箔工序工单.xls', source: data });
|
||||
}
|
||||
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getPdmRawFoilWorkOrderPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder>,
|
||||
gridEvents: {
|
||||
checkboxAll: handleRowCheckboxChange,
|
||||
checkboxChange: handleRowCheckboxChange,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="生箔工序工单列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['生箔工序工单']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['lms:pdm-raw-foil-work-order:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['lms:pdm-raw-foil-work-order:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.deleteBatch'),
|
||||
type: 'primary',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['lms:pdm-raw-foil-work-order:delete'],
|
||||
disabled: isEmpty(checkedIds),
|
||||
onClick: handleDeleteBatch,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['lms:pdm-raw-foil-work-order:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['lms:pdm-raw-foil-work-order:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.id]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
@@ -0,0 +1,82 @@
|
||||
<script lang="ts" setup>
|
||||
import type { LmsPdmRawFoilWorkOrderApi } from '#/api/lms/pdmrawfoilworkorder';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'antdv-next';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { createPdmRawFoilWorkOrder, getPdmRawFoilWorkOrder, updatePdmRawFoilWorkOrder } from '#/api/lms/pdmrawfoilworkorder';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['生箔工序工单'])
|
||||
: $t('ui.actionTitle.create', ['生箔工序工单']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 80,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder;
|
||||
try {
|
||||
await (formData.value?.id ? updatePdmRawFoilWorkOrder(data) : createPdmRawFoilWorkOrder(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<LmsPdmRawFoilWorkOrderApi.PdmRawFoilWorkOrder>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getPdmRawFoilWorkOrder(data.id);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user