add:开发
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace LmsSlittingproductionplanApi {
|
||||
/** 分切生产计划信息 */
|
||||
export interface Slittingproductionplan {
|
||||
orderType?: string; // 分切订单类型
|
||||
productName?: string; // 产品编码
|
||||
description: string; // 产品描述
|
||||
parentContainerName: string; // 来源母卷号
|
||||
packageBoxSn: string; // 子卷立库木箱号
|
||||
wareHouse: string; // 来源卷位置
|
||||
splitGroup?: string; // 分切组
|
||||
manufactureSort?: string; // 生产顺序
|
||||
mfgOrderName?: string; // 生产订单
|
||||
manufactureDate?: string; // 生产日期
|
||||
paperTubeOrFrp?: string; // 管件类型
|
||||
paperTubeMaterial: string; // 纸筒物料编码
|
||||
paperTubeDescription: string; // 纸筒物料描述
|
||||
paperTubeModel: string; // 纸筒规格
|
||||
frpMaterial: string; // FRP管物料编码
|
||||
frpDescription: string; // FRP管物料描述
|
||||
frpModel: string; // FRP管规格
|
||||
splitBreadth?: number; // 子卷幅宽
|
||||
splitHeight?: number; // 子卷理论长度
|
||||
splitWeight?: number; // 子卷理论重量
|
||||
startTime: string | Dayjs; // 开始时间
|
||||
endTime: string | Dayjs; // 结束时间
|
||||
status?: string; // 状态
|
||||
isParentOk?: string; // 上料完成
|
||||
isChildTzOk?: string; // 子卷套轴完成
|
||||
isChildPsOk?: string; // 子卷配送完成
|
||||
qzzno: string; // 气涨轴编码
|
||||
updateOptid: number; // 修改人
|
||||
sysdeptid: number; // 部门ID
|
||||
syscompanyid: number; // 公司ID
|
||||
saleOrderName?: string; // 销售订单及行号
|
||||
isCall?: string; // 是否呼叫
|
||||
callTime: string; // 呼叫时间
|
||||
isPaperOk: string; // 是否呼叫纸管
|
||||
qzzSize: string; // 气涨轴规格
|
||||
upOrDown: string; // 上下
|
||||
level: string; // 子卷等级
|
||||
weight: string; // 重量
|
||||
paperWeight: string; // 纸管重量
|
||||
productArea: string; // 生产区域
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询分切生产计划分页 */
|
||||
export function getSlittingproductionplanPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<LmsSlittingproductionplanApi.Slittingproductionplan>>(
|
||||
'/lms/slittingproductionplan/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询分切生产计划详情 */
|
||||
export function getSlittingproductionplan(id: number) {
|
||||
return requestClient.get<LmsSlittingproductionplanApi.Slittingproductionplan>(
|
||||
`/lms/slittingproductionplan/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增分切生产计划 */
|
||||
export function createSlittingproductionplan(data: LmsSlittingproductionplanApi.Slittingproductionplan) {
|
||||
return requestClient.post('/lms/slittingproductionplan/create', data);
|
||||
}
|
||||
|
||||
/** 修改分切生产计划 */
|
||||
export function updateSlittingproductionplan(data: LmsSlittingproductionplanApi.Slittingproductionplan) {
|
||||
return requestClient.put('/lms/slittingproductionplan/update', data);
|
||||
}
|
||||
|
||||
/** 删除分切生产计划 */
|
||||
export function deleteSlittingproductionplan(id: number) {
|
||||
return requestClient.delete(`/lms/slittingproductionplan/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量删除分切生产计划 */
|
||||
export function deleteSlittingproductionplanList(ids: number[]) {
|
||||
return requestClient.delete(
|
||||
`/lms/slittingproductionplan/delete-list?ids=${ids.join(',')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出分切生产计划 */
|
||||
export function exportSlittingproductionplan(params: any) {
|
||||
return requestClient.download('/lms/slittingproductionplan/export-excel', { params });
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,652 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { LmsSlittingproductionplanApi } from '#/api/lms/slittingproductionplan';
|
||||
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'orderType',
|
||||
label: '分切订单类型',
|
||||
rules: 'required',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [],
|
||||
placeholder: '请选择分切订单类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productName',
|
||||
label: '产品编码',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入产品编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'description',
|
||||
label: '产品描述',
|
||||
component: 'RichTextarea',
|
||||
},
|
||||
{
|
||||
fieldName: 'parentContainerName',
|
||||
label: '来源母卷号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入来源母卷号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'packageBoxSn',
|
||||
label: '子卷立库木箱号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入子卷立库木箱号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'wareHouse',
|
||||
label: '来源卷位置',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入来源卷位置',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'splitGroup',
|
||||
label: '分切组',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入分切组',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'manufactureSort',
|
||||
label: '生产顺序',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入生产顺序',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'mfgOrderName',
|
||||
label: '生产订单',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入生产订单',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'manufactureDate',
|
||||
label: '生产日期',
|
||||
rules: 'required',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paperTubeOrFrp',
|
||||
label: '管件类型',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入管件类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paperTubeMaterial',
|
||||
label: '纸筒物料编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入纸筒物料编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paperTubeDescription',
|
||||
label: '纸筒物料描述',
|
||||
component: 'RichTextarea',
|
||||
},
|
||||
{
|
||||
fieldName: 'paperTubeModel',
|
||||
label: '纸筒规格',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入纸筒规格',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'frpMaterial',
|
||||
label: 'FRP管物料编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入FRP管物料编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'frpDescription',
|
||||
label: 'FRP管物料描述',
|
||||
component: 'RichTextarea',
|
||||
},
|
||||
{
|
||||
fieldName: 'frpModel',
|
||||
label: 'FRP管规格',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入FRP管规格',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'splitBreadth',
|
||||
label: '子卷幅宽',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入子卷幅宽',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'splitHeight',
|
||||
label: '子卷理论长度',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入子卷理论长度',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'splitWeight',
|
||||
label: '子卷理论重量',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入子卷理论重量',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'startTime',
|
||||
label: '开始时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'endTime',
|
||||
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: 'isParentOk',
|
||||
label: '上料完成',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入上料完成',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isChildTzOk',
|
||||
label: '子卷套轴完成',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入子卷套轴完成',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isChildPsOk',
|
||||
label: '子卷配送完成',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入子卷配送完成',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'qzzno',
|
||||
label: '气涨轴编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入气涨轴编码',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'updateOptid',
|
||||
label: '修改人',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入修改人',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'sysdeptid',
|
||||
label: '部门ID',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入部门ID',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'syscompanyid',
|
||||
label: '公司ID',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入公司ID',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'saleOrderName',
|
||||
label: '销售订单及行号',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入销售订单及行号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isCall',
|
||||
label: '是否呼叫',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入是否呼叫',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'callTime',
|
||||
label: '呼叫时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'isPaperOk',
|
||||
label: '是否呼叫纸管',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入是否呼叫纸管',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'qzzSize',
|
||||
label: '气涨轴规格',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入气涨轴规格',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'upOrDown',
|
||||
label: '上下',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入上下',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'level',
|
||||
label: '子卷等级',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入子卷等级',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'weight',
|
||||
label: '重量',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入重量',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paperWeight',
|
||||
label: '纸管重量',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入纸管重量',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'productArea',
|
||||
label: '生产区域',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入生产区域',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'orderType',
|
||||
label: '分切订单类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择分切订单类型',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'parentContainerName',
|
||||
label: '来源母卷号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入来源母卷号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'manufactureDate',
|
||||
label: '生产日期',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'startTime',
|
||||
label: '开始时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'endTime',
|
||||
label: '结束时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'qzzSize',
|
||||
label: '气涨轴规格',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入气涨轴规格',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions<LmsSlittingproductionplanApi.Slittingproductionplan>['columns'] {
|
||||
return [
|
||||
{ type: 'checkbox', width: 40 },
|
||||
{
|
||||
field: 'orderType',
|
||||
title: '分切订单类型',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'productName',
|
||||
title: '产品编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: '产品描述',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'parentContainerName',
|
||||
title: '来源母卷号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'packageBoxSn',
|
||||
title: '子卷立库木箱号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'wareHouse',
|
||||
title: '来源卷位置',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'splitGroup',
|
||||
title: '分切组',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'manufactureSort',
|
||||
title: '生产顺序',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'mfgOrderName',
|
||||
title: '生产订单',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'manufactureDate',
|
||||
title: '生产日期',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paperTubeOrFrp',
|
||||
title: '管件类型',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paperTubeMaterial',
|
||||
title: '纸筒物料编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paperTubeDescription',
|
||||
title: '纸筒物料描述',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paperTubeModel',
|
||||
title: '纸筒规格',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'frpMaterial',
|
||||
title: 'FRP管物料编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'frpDescription',
|
||||
title: 'FRP管物料描述',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'frpModel',
|
||||
title: 'FRP管规格',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'splitBreadth',
|
||||
title: '子卷幅宽',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'splitHeight',
|
||||
title: '子卷理论长度',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'splitWeight',
|
||||
title: '子卷理论重量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '开始时间',
|
||||
minWidth: 120,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'endTime',
|
||||
title: '结束时间',
|
||||
minWidth: 120,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isParentOk',
|
||||
title: '上料完成',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isChildTzOk',
|
||||
title: '子卷套轴完成',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isChildPsOk',
|
||||
title: '子卷配送完成',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'qzzno',
|
||||
title: '气涨轴编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'updateOptid',
|
||||
title: '修改人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'sysdeptid',
|
||||
title: '部门ID',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'syscompanyid',
|
||||
title: '公司ID',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'saleOrderName',
|
||||
title: '销售订单及行号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isCall',
|
||||
title: '是否呼叫',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'callTime',
|
||||
title: '呼叫时间',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'isPaperOk',
|
||||
title: '是否呼叫纸管',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'qzzSize',
|
||||
title: '气涨轴规格',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'upOrDown',
|
||||
title: '上下',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'level',
|
||||
title: '子卷等级',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'weight',
|
||||
title: '重量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paperWeight',
|
||||
title: '纸管重量',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'productArea',
|
||||
title: '生产区域',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 120,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
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 { LmsSlittingproductionplanApi } from '#/api/lms/slittingproductionplan';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { confirm, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteSlittingproductionplan,
|
||||
deleteSlittingproductionplanList,
|
||||
exportSlittingproductionplan,
|
||||
getSlittingproductionplanPage,
|
||||
} from '#/api/lms/slittingproductionplan';
|
||||
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: LmsSlittingproductionplanApi.Slittingproductionplan) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除分切生产计划 */
|
||||
async function handleDelete(row: LmsSlittingproductionplanApi.Slittingproductionplan) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||
duration: 0,
|
||||
});
|
||||
try {
|
||||
await deleteSlittingproductionplan(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 deleteSlittingproductionplanList(checkedIds.value);
|
||||
checkedIds.value = [];
|
||||
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
const checkedIds = ref<number[]>([]);
|
||||
function handleRowCheckboxChange({
|
||||
records,
|
||||
}: {
|
||||
records: LmsSlittingproductionplanApi.Slittingproductionplan[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportSlittingproductionplan(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 getSlittingproductionplanPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<LmsSlittingproductionplanApi.Slittingproductionplan>,
|
||||
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:slittingproductionplan:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['lms:slittingproductionplan:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.deleteBatch'),
|
||||
type: 'primary',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['lms:slittingproductionplan:delete'],
|
||||
disabled: isEmpty(checkedIds),
|
||||
onClick: handleDeleteBatch,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['lms:slittingproductionplan:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['lms:slittingproductionplan: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 { LmsSlittingproductionplanApi } from '#/api/lms/slittingproductionplan';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { createSlittingproductionplan, getSlittingproductionplan, updateSlittingproductionplan } from '#/api/lms/slittingproductionplan';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<LmsSlittingproductionplanApi.Slittingproductionplan>();
|
||||
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 LmsSlittingproductionplanApi.Slittingproductionplan;
|
||||
try {
|
||||
await (formData.value?.id ? updateSlittingproductionplan(data) : createSlittingproductionplan(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<LmsSlittingproductionplanApi.Slittingproductionplan>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getSlittingproductionplan(data.id);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
Reference in New Issue
Block a user