commit
08dad4ef5d
|
|
@ -0,0 +1,54 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProAndonConfigApi {
|
||||
/** MES 安灯配置 */
|
||||
export interface AndonConfig {
|
||||
id?: number; // 编号
|
||||
reason?: string; // 呼叫原因
|
||||
level?: number; // 级别
|
||||
handlerRoleId?: number; // 处置角色编号
|
||||
handlerRoleName?: string; // 处置角色名称
|
||||
handlerUserId?: number; // 处置人编号
|
||||
handlerUserNickname?: string; // 处置人昵称
|
||||
remark?: string; // 备注
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询安灯配置分页 */
|
||||
export function getAndonConfigPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesProAndonConfigApi.AndonConfig>>(
|
||||
'/mes/pro/andon-config/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询安灯配置列表 */
|
||||
export function getAndonConfigList() {
|
||||
return requestClient.get<MesProAndonConfigApi.AndonConfig[]>(
|
||||
'/mes/pro/andon-config/list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询安灯配置详情 */
|
||||
export function getAndonConfig(id: number) {
|
||||
return requestClient.get<MesProAndonConfigApi.AndonConfig>(
|
||||
`/mes/pro/andon-config/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增安灯配置 */
|
||||
export function createAndonConfig(data: MesProAndonConfigApi.AndonConfig) {
|
||||
return requestClient.post('/mes/pro/andon-config/create', data);
|
||||
}
|
||||
|
||||
/** 修改安灯配置 */
|
||||
export function updateAndonConfig(data: MesProAndonConfigApi.AndonConfig) {
|
||||
return requestClient.put('/mes/pro/andon-config/update', data);
|
||||
}
|
||||
|
||||
/** 删除安灯配置 */
|
||||
export function deleteAndonConfig(id: number) {
|
||||
return requestClient.delete(`/mes/pro/andon-config/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProAndonRecordApi {
|
||||
/** MES 安灯记录 */
|
||||
export interface AndonRecord {
|
||||
id?: number;
|
||||
configId?: number; // 安灯配置编号
|
||||
workstationId?: number; // 工作站编号
|
||||
workstationCode?: string; // 工作站编码
|
||||
workstationName?: string; // 工作站名称
|
||||
workOrderId?: number; // 生产工单编号
|
||||
workOrderCode?: string; // 工单编码
|
||||
processId?: number; // 工序编号
|
||||
processName?: string; // 工序名称
|
||||
userId?: number; // 发起用户编号
|
||||
userNickname?: string; // 发起人昵称
|
||||
reason?: string; // 呼叫原因
|
||||
level?: number; // 级别
|
||||
status?: number; // 处置状态
|
||||
handleTime?: number; // 处置时间(毫秒时间戳)
|
||||
handlerUserId?: number; // 处置人编号
|
||||
handlerUserNickname?: string; // 处置人昵称
|
||||
remark?: string; // 备注
|
||||
createTime?: number; // 发起时间
|
||||
}
|
||||
|
||||
/** MES 安灯记录分页查询参数 */
|
||||
export interface PageParams extends PageParam {
|
||||
workstationId?: number; // 工作站编号
|
||||
userId?: number; // 发起用户编号
|
||||
handlerUserId?: number; // 处置人编号
|
||||
status?: number; // 处置状态
|
||||
createTime?: string[]; // 发起时间区间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询安灯记录分页 */
|
||||
export function getAndonRecordPage(params: MesProAndonRecordApi.PageParams) {
|
||||
return requestClient.get<PageResult<MesProAndonRecordApi.AndonRecord>>(
|
||||
'/mes/pro/andon-record/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询安灯记录详情 */
|
||||
export function getAndonRecord(id: number) {
|
||||
return requestClient.get<MesProAndonRecordApi.AndonRecord>(
|
||||
`/mes/pro/andon-record/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增安灯记录 */
|
||||
export function createAndonRecord(data: MesProAndonRecordApi.AndonRecord) {
|
||||
return requestClient.post('/mes/pro/andon-record/create', data);
|
||||
}
|
||||
|
||||
/** 删除安灯记录 */
|
||||
export function deleteAndonRecord(id: number) {
|
||||
return requestClient.delete(`/mes/pro/andon-record/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 更新安灯记录(保存/已处置) */
|
||||
export function updateAndonRecord(data: MesProAndonRecordApi.AndonRecord) {
|
||||
return requestClient.put('/mes/pro/andon-record/update', data);
|
||||
}
|
||||
|
||||
/** 导出安灯记录 Excel */
|
||||
export function exportAndonRecord(
|
||||
params: Partial<MesProAndonRecordApi.PageParams>,
|
||||
) {
|
||||
return requestClient.download('/mes/pro/andon-record/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProFeedbackApi {
|
||||
/** MES 生产报工 */
|
||||
export interface Feedback {
|
||||
id?: number;
|
||||
code?: string; // 报工单编号
|
||||
type?: number; // 报工类型
|
||||
channel?: string; // 报工途径
|
||||
feedbackTime?: number; // 报工时间
|
||||
workstationId?: number; // 工作站编号
|
||||
workstationCode?: string; // 工作站编码
|
||||
workstationName?: string; // 工作站名称
|
||||
routeId?: number; // 工艺路线编号
|
||||
routeCode?: string; // 工艺路线编码
|
||||
processId?: number; // 工序编号
|
||||
processCode?: string; // 工序编码
|
||||
processName?: string; // 工序名称
|
||||
checkFlag?: boolean; // 是否需要检验
|
||||
workOrderId?: number; // 生产工单编号
|
||||
workOrderCode?: string; // 工单编码
|
||||
workOrderName?: string; // 工单名称
|
||||
taskId?: number; // 生产任务编号
|
||||
taskCode?: string; // 任务编码
|
||||
itemId?: number; // 产品物料编号
|
||||
itemCode?: string; // 物料编码
|
||||
itemName?: string; // 物料名称
|
||||
itemSpecification?: string; // 规格型号
|
||||
unitMeasureId?: number; // 单位编号
|
||||
unitMeasureName?: string; // 单位名称
|
||||
expireDate?: number; // 过期日期
|
||||
scheduledQuantity?: number; // 排产数量
|
||||
feedbackQuantity?: number; // 本次报工数量
|
||||
qualifiedQuantity?: number; // 合格品数量
|
||||
unqualifiedQuantity?: number; // 不良品数量
|
||||
uncheckQuantity?: number; // 待检测数量
|
||||
laborScrapQuantity?: number; // 工废数量
|
||||
materialScrapQuantity?: number; // 料废数量
|
||||
otherScrapQuantity?: number; // 其他废品数量
|
||||
feedbackUserId?: number; // 报工用户编号
|
||||
feedbackUserNickname?: string; // 报工人昵称
|
||||
approveUserId?: number; // 审核用户编号
|
||||
approveUserNickname?: string; // 审核人昵称
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
creator?: string; // 创建人
|
||||
createTime?: number; // 创建时间
|
||||
}
|
||||
|
||||
/** MES 生产报工分页查询参数 */
|
||||
export interface PageParams extends PageParam {
|
||||
code?: string;
|
||||
type?: number;
|
||||
workOrderId?: number;
|
||||
itemId?: number;
|
||||
feedbackUserId?: number;
|
||||
creator?: string;
|
||||
status?: number;
|
||||
feedbackTime?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询生产报工分页 */
|
||||
export function getFeedbackPage(params: MesProFeedbackApi.PageParams) {
|
||||
return requestClient.get<PageResult<MesProFeedbackApi.Feedback>>(
|
||||
'/mes/pro/feedback/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询生产报工详情 */
|
||||
export function getFeedback(id: number) {
|
||||
return requestClient.get<MesProFeedbackApi.Feedback>(
|
||||
`/mes/pro/feedback/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增生产报工 */
|
||||
export function createFeedback(data: MesProFeedbackApi.Feedback) {
|
||||
return requestClient.post<number>('/mes/pro/feedback/create', data);
|
||||
}
|
||||
|
||||
/** 修改生产报工 */
|
||||
export function updateFeedback(data: MesProFeedbackApi.Feedback) {
|
||||
return requestClient.put('/mes/pro/feedback/update', data);
|
||||
}
|
||||
|
||||
/** 删除生产报工 */
|
||||
export function deleteFeedback(id: number) {
|
||||
return requestClient.delete(`/mes/pro/feedback/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出生产报工 Excel */
|
||||
export function exportFeedback(params: Partial<MesProFeedbackApi.PageParams>) {
|
||||
return requestClient.download('/mes/pro/feedback/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 提交生产报工 */
|
||||
export function submitFeedback(id: number) {
|
||||
return requestClient.put(`/mes/pro/feedback/submit?id=${id}`);
|
||||
}
|
||||
|
||||
/** 驳回生产报工 */
|
||||
export function rejectFeedback(id: number) {
|
||||
return requestClient.put(`/mes/pro/feedback/reject?id=${id}`);
|
||||
}
|
||||
|
||||
/** 审批生产报工(返回是否已审批完成) */
|
||||
export function approveFeedback(id: number) {
|
||||
return requestClient.put<boolean>(`/mes/pro/feedback/approve?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProProcessContentApi {
|
||||
/** MES 生产工序内容(操作步骤) */
|
||||
export interface ProcessContent {
|
||||
id?: number;
|
||||
processId?: number;
|
||||
sort?: number;
|
||||
content?: string;
|
||||
device?: string;
|
||||
material?: string;
|
||||
docUrl?: string;
|
||||
remark?: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 按工序编号查询工序内容列表 */
|
||||
export function getProcessContentListByProcessId(processId: number) {
|
||||
return requestClient.get<MesProProcessContentApi.ProcessContent[]>(
|
||||
`/mes/pro/process-content/list-by-process?processId=${processId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工序内容详情 */
|
||||
export function getProcessContent(id: number) {
|
||||
return requestClient.get<MesProProcessContentApi.ProcessContent>(
|
||||
`/mes/pro/process-content/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增工序内容 */
|
||||
export function createProcessContent(
|
||||
data: MesProProcessContentApi.ProcessContent,
|
||||
) {
|
||||
return requestClient.post('/mes/pro/process-content/create', data);
|
||||
}
|
||||
|
||||
/** 修改工序内容 */
|
||||
export function updateProcessContent(
|
||||
data: MesProProcessContentApi.ProcessContent,
|
||||
) {
|
||||
return requestClient.put('/mes/pro/process-content/update', data);
|
||||
}
|
||||
|
||||
/** 删除工序内容 */
|
||||
export function deleteProcessContent(id: number) {
|
||||
return requestClient.delete(`/mes/pro/process-content/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProRouteApi {
|
||||
/** MES 工艺路线 */
|
||||
export interface Route {
|
||||
id?: number;
|
||||
code?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
status?: number;
|
||||
remark?: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询工艺路线分页 */
|
||||
export function getRoutePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesProRouteApi.Route>>(
|
||||
'/mes/pro/route/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工艺路线精简列表 */
|
||||
export function getRouteSimpleList() {
|
||||
return requestClient.get<MesProRouteApi.Route[]>(
|
||||
'/mes/pro/route/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工艺路线详情 */
|
||||
export function getRoute(id: number) {
|
||||
return requestClient.get<MesProRouteApi.Route>(
|
||||
`/mes/pro/route/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增工艺路线 */
|
||||
export function createRoute(data: MesProRouteApi.Route) {
|
||||
return requestClient.post<number>('/mes/pro/route/create', data);
|
||||
}
|
||||
|
||||
/** 修改工艺路线 */
|
||||
export function updateRoute(data: MesProRouteApi.Route) {
|
||||
return requestClient.put('/mes/pro/route/update', data);
|
||||
}
|
||||
|
||||
/** 修改工艺路线状态 */
|
||||
export function updateRouteStatus(id: number, status: number) {
|
||||
return requestClient.put(
|
||||
`/mes/pro/route/update-status?id=${id}&status=${status}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 删除工艺路线 */
|
||||
export function deleteRoute(id: number) {
|
||||
return requestClient.delete(`/mes/pro/route/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出工艺路线 Excel */
|
||||
export function exportRoute(params: any) {
|
||||
return requestClient.download('/mes/pro/route/export-excel', { params });
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProRouteProcessApi {
|
||||
/** MES 工艺路线工序 */
|
||||
export interface RouteProcess {
|
||||
id?: number;
|
||||
routeId?: number;
|
||||
processId?: number;
|
||||
processCode?: string;
|
||||
processName?: string;
|
||||
sort?: number;
|
||||
nextProcessId?: number;
|
||||
nextProcessName?: string;
|
||||
linkType?: number;
|
||||
prepareTime?: number;
|
||||
waitTime?: number;
|
||||
colorCode?: string;
|
||||
keyFlag?: boolean;
|
||||
checkFlag?: boolean;
|
||||
remark?: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 按工艺路线查询工序列表 */
|
||||
export function getRouteProcessListByRoute(routeId: number) {
|
||||
return requestClient.get<MesProRouteProcessApi.RouteProcess[]>(
|
||||
`/mes/pro/route-process/list-by-route?routeId=${routeId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 按产品查询工序列表(自动查找关联的工艺路线) */
|
||||
export function getRouteProcessListByProduct(productId: number) {
|
||||
return requestClient.get<MesProRouteProcessApi.RouteProcess[]>(
|
||||
`/mes/pro/route-process/list-by-product?productId=${productId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工艺路线工序详情 */
|
||||
export function getRouteProcess(id: number) {
|
||||
return requestClient.get<MesProRouteProcessApi.RouteProcess>(
|
||||
`/mes/pro/route-process/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 按工艺路线 + 工序精确查询工序配置 */
|
||||
export function getRouteProcessByRouteAndProcess(
|
||||
routeId: number,
|
||||
processId: number,
|
||||
) {
|
||||
return requestClient.get<MesProRouteProcessApi.RouteProcess>(
|
||||
'/mes/pro/route-process/get-by-route-and-process',
|
||||
{ params: { processId, routeId } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增工艺路线工序 */
|
||||
export function createRouteProcess(data: MesProRouteProcessApi.RouteProcess) {
|
||||
return requestClient.post('/mes/pro/route-process/create', data);
|
||||
}
|
||||
|
||||
/** 修改工艺路线工序 */
|
||||
export function updateRouteProcess(data: MesProRouteProcessApi.RouteProcess) {
|
||||
return requestClient.put('/mes/pro/route-process/update', data);
|
||||
}
|
||||
|
||||
/** 删除工艺路线工序 */
|
||||
export function deleteRouteProcess(id: number) {
|
||||
return requestClient.delete(`/mes/pro/route-process/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProRouteProductApi {
|
||||
/** MES 工艺路线产品 */
|
||||
export interface RouteProduct {
|
||||
id?: number;
|
||||
routeId?: number;
|
||||
itemId?: number;
|
||||
itemCode?: string;
|
||||
itemName?: string;
|
||||
specification?: string;
|
||||
unitName?: string;
|
||||
quantity?: number;
|
||||
productionTime?: number;
|
||||
timeUnitType?: string;
|
||||
remark?: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 按工艺路线查询产品列表 */
|
||||
export function getRouteProductListByRoute(routeId: number) {
|
||||
return requestClient.get<MesProRouteProductApi.RouteProduct[]>(
|
||||
`/mes/pro/route-product/list-by-route?routeId=${routeId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工艺路线产品详情 */
|
||||
export function getRouteProduct(id: number) {
|
||||
return requestClient.get<MesProRouteProductApi.RouteProduct>(
|
||||
`/mes/pro/route-product/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增工艺路线产品 */
|
||||
export function createRouteProduct(data: MesProRouteProductApi.RouteProduct) {
|
||||
return requestClient.post<number>('/mes/pro/route-product/create', data);
|
||||
}
|
||||
|
||||
/** 修改工艺路线产品 */
|
||||
export function updateRouteProduct(data: MesProRouteProductApi.RouteProduct) {
|
||||
return requestClient.put('/mes/pro/route-product/update', data);
|
||||
}
|
||||
|
||||
/** 删除工艺路线产品 */
|
||||
export function deleteRouteProduct(id: number) {
|
||||
return requestClient.delete(`/mes/pro/route-product/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProRouteProductBomApi {
|
||||
/** MES 工艺路线产品 BOM */
|
||||
export interface RouteProductBom {
|
||||
id?: number;
|
||||
routeId?: number;
|
||||
processId?: number;
|
||||
productId?: number;
|
||||
itemId?: number;
|
||||
itemCode?: string;
|
||||
itemName?: string;
|
||||
specification?: string;
|
||||
unitName?: string;
|
||||
quantity?: number;
|
||||
remark?: string;
|
||||
createTime?: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询工艺路线产品 BOM 列表 */
|
||||
export function getRouteProductBomList(params: {
|
||||
processId?: number;
|
||||
productId?: number;
|
||||
routeId: number;
|
||||
}) {
|
||||
return requestClient.get<MesProRouteProductBomApi.RouteProductBom[]>(
|
||||
'/mes/pro/route-product-bom/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工艺路线产品 BOM 详情 */
|
||||
export function getRouteProductBom(id: number) {
|
||||
return requestClient.get<MesProRouteProductBomApi.RouteProductBom>(
|
||||
`/mes/pro/route-product-bom/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增工艺路线产品 BOM */
|
||||
export function createRouteProductBom(
|
||||
data: MesProRouteProductBomApi.RouteProductBom,
|
||||
) {
|
||||
return requestClient.post('/mes/pro/route-product-bom/create', data);
|
||||
}
|
||||
|
||||
/** 修改工艺路线产品 BOM */
|
||||
export function updateRouteProductBom(
|
||||
data: MesProRouteProductBomApi.RouteProductBom,
|
||||
) {
|
||||
return requestClient.put('/mes/pro/route-product-bom/update', data);
|
||||
}
|
||||
|
||||
/** 删除工艺路线产品 BOM */
|
||||
export function deleteRouteProductBom(id: number) {
|
||||
return requestClient.delete(`/mes/pro/route-product-bom/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProTaskApi {
|
||||
/** MES 生产任务 */
|
||||
export interface Task {
|
||||
id?: number;
|
||||
code?: string; // 任务编码
|
||||
name?: string; // 任务名称
|
||||
workOrderId?: number; // 生产工单编号
|
||||
workOrderCode?: string; // 工单编码
|
||||
workOrderName?: string; // 工单名称
|
||||
workstationId?: number; // 工作站编号
|
||||
workstationCode?: string; // 工作站编码
|
||||
workstationName?: string; // 工作站名称
|
||||
routeId?: number; // 工艺路线编号
|
||||
processId?: number; // 工序编号
|
||||
processName?: string; // 工序名称
|
||||
itemId?: number; // 产品物料编号
|
||||
itemCode?: string; // 产品编码
|
||||
itemName?: string; // 产品名称
|
||||
itemSpecification?: string; // 规格型号
|
||||
unitMeasureId?: number; // 单位编号
|
||||
unitMeasureName?: string; // 单位名称
|
||||
quantity?: number; // 排产数量
|
||||
producedQuantity?: number; // 已生产数量
|
||||
qualifyQuantity?: number; // 合格品数量
|
||||
unqualifyQuantity?: number; // 不良品数量
|
||||
changedQuantity?: number; // 调整数量
|
||||
clientId?: number; // 客户编号
|
||||
clientName?: string; // 客户名称
|
||||
startTime?: number; // 开始生产时间
|
||||
endTime?: number; // 结束生产时间
|
||||
duration?: number; // 生产时长(工作日,1=8小时)
|
||||
requestDate?: number; // 需求日期(从工单查)
|
||||
finishDate?: number; // 完成日期
|
||||
cancelDate?: number; // 取消日期
|
||||
colorCode?: string; // 甘特图显示颜色
|
||||
status?: number; // 任务状态
|
||||
checkFlag?: boolean; // 是否质检(派生自工艺路线工序)
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** MES 生产任务分页查询参数 */
|
||||
export interface PageParams extends PageParam {
|
||||
code?: string;
|
||||
name?: string;
|
||||
workOrderId?: number;
|
||||
workstationId?: number;
|
||||
itemId?: number;
|
||||
statuses?: number[];
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询生产任务分页 */
|
||||
export function getTaskPage(params: MesProTaskApi.PageParams) {
|
||||
return requestClient.get<PageResult<MesProTaskApi.Task>>(
|
||||
'/mes/pro/task/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询生产任务详情 */
|
||||
export function getTask(id: number) {
|
||||
return requestClient.get<MesProTaskApi.Task>(`/mes/pro/task/get?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProWorkOrderApi {
|
||||
/** MES 生产工单 */
|
||||
export interface WorkOrder {
|
||||
id?: number;
|
||||
code?: string; // 工单编码
|
||||
name?: string; // 工单名称
|
||||
type?: number; // 工单类型
|
||||
status?: number; // 工单状态
|
||||
sourceType?: number;
|
||||
productId?: number; // 产品物料编号
|
||||
productCode?: string;
|
||||
productName?: string;
|
||||
productSpecification?: string;
|
||||
quantity?: number;
|
||||
unitName?: string;
|
||||
routeId?: number;
|
||||
routeName?: string;
|
||||
clientId?: number;
|
||||
clientName?: string;
|
||||
planStartTime?: number | string;
|
||||
planEndTime?: number | string;
|
||||
actualStartTime?: number | string;
|
||||
actualEndTime?: number | string;
|
||||
remark?: string;
|
||||
createTime?: number | string;
|
||||
}
|
||||
|
||||
export interface PageParams extends PageParam {
|
||||
code?: string;
|
||||
name?: string;
|
||||
status?: number;
|
||||
type?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询生产工单分页 */
|
||||
export function getWorkOrderPage(params: MesProWorkOrderApi.PageParams) {
|
||||
return requestClient.get<PageResult<MesProWorkOrderApi.WorkOrder>>(
|
||||
'/mes/pro/work-order/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询生产工单详情 */
|
||||
export function getWorkOrder(id: number) {
|
||||
return requestClient.get<MesProWorkOrderApi.WorkOrder>(
|
||||
`/mes/pro/work-order/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesProWorkRecordApi {
|
||||
/** MES 工作记录流水 */
|
||||
export interface WorkRecordLog {
|
||||
id?: number; // 编号
|
||||
userId?: number; // 用户编号
|
||||
userNickname?: string; // 用户昵称
|
||||
workstationId?: number; // 工作站编号
|
||||
workstationCode?: string; // 工作站编码
|
||||
workstationName?: string; // 工作站名称
|
||||
type?: number; // 1=上工 2=下工
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
|
||||
/** MES 当前用户工作站绑定状态 */
|
||||
export interface MyWorkRecord {
|
||||
userId?: number; // 用户编号
|
||||
userNickname?: string; // 用户昵称
|
||||
workstationId?: number; // 工作站编号
|
||||
workstationCode?: string; // 工作站编码
|
||||
workstationName?: string; // 工作站名称
|
||||
type?: number; // 1=上工 2=下工
|
||||
clockInTime?: Date; // 上工时间
|
||||
clockOutTime?: Date; // 下工时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询工作记录分页 */
|
||||
export function getWorkRecordLogPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesProWorkRecordApi.WorkRecordLog>>(
|
||||
'/mes/pro/workrecord/log/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询工作记录详情 */
|
||||
export function getWorkRecordLog(id: number) {
|
||||
return requestClient.get<MesProWorkRecordApi.WorkRecordLog>(
|
||||
`/mes/pro/workrecord/log/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 导出工作记录 */
|
||||
export function exportWorkRecordLog(params: any) {
|
||||
return requestClient.download('/mes/pro/workrecord/log/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 上工(绑定工作站) */
|
||||
export function clockInWorkRecord(workstationId: number) {
|
||||
return requestClient.put('/mes/pro/workrecord/clock-in', null, {
|
||||
params: { workstationId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 下工(解绑工作站) */
|
||||
export function clockOutWorkRecord() {
|
||||
return requestClient.put('/mes/pro/workrecord/clock-out');
|
||||
}
|
||||
|
||||
/** 查询当前用户绑定的工作站 */
|
||||
export function getMyWorkRecord() {
|
||||
return requestClient.get<MesProWorkRecordApi.MyWorkRecord>(
|
||||
'/mes/pro/workrecord/get-my',
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcDefectApi {
|
||||
/** MES 缺陷类型 */
|
||||
export interface Defect {
|
||||
id?: number; // 编号
|
||||
code?: string; // 缺陷编码
|
||||
name?: string; // 缺陷描述
|
||||
type?: number; // 检测项类型
|
||||
level?: number; // 缺陷等级
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询缺陷类型分页 */
|
||||
export function getDefectPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesQcDefectApi.Defect>>(
|
||||
'/mes/qc/defect/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询缺陷类型精简列表 */
|
||||
export function getDefectSimpleList() {
|
||||
return requestClient.get<MesQcDefectApi.Defect[]>('/mes/qc/defect/simple-list');
|
||||
}
|
||||
|
||||
/** 查询缺陷类型详情 */
|
||||
export function getDefect(id: number) {
|
||||
return requestClient.get<MesQcDefectApi.Defect>(`/mes/qc/defect/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增缺陷类型 */
|
||||
export function createDefect(data: MesQcDefectApi.Defect) {
|
||||
return requestClient.post('/mes/qc/defect/create', data);
|
||||
}
|
||||
|
||||
/** 修改缺陷类型 */
|
||||
export function updateDefect(data: MesQcDefectApi.Defect) {
|
||||
return requestClient.put('/mes/qc/defect/update', data);
|
||||
}
|
||||
|
||||
/** 删除缺陷类型 */
|
||||
export function deleteDefect(id: number) {
|
||||
return requestClient.delete(`/mes/qc/defect/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出缺陷类型 */
|
||||
export function exportDefect(params: any) {
|
||||
return requestClient.download('/mes/qc/defect/export-excel', { params });
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcIndicatorApi {
|
||||
/** MES 质检指标 */
|
||||
export interface Indicator {
|
||||
id?: number; // 编号
|
||||
code?: string; // 检测项编码
|
||||
name?: string; // 检测项名称
|
||||
type?: number; // 检测项类型
|
||||
tool?: string; // 检测工具
|
||||
resultType?: number; // 结果值类型
|
||||
resultSpecification?: string; // 结果值属性
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询质检指标分页 */
|
||||
export function getIndicatorPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesQcIndicatorApi.Indicator>>(
|
||||
'/mes/qc/indicator/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询质检指标详情 */
|
||||
export function getIndicator(id: number) {
|
||||
return requestClient.get<MesQcIndicatorApi.Indicator>(
|
||||
`/mes/qc/indicator/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增质检指标 */
|
||||
export function createIndicator(data: MesQcIndicatorApi.Indicator) {
|
||||
return requestClient.post('/mes/qc/indicator/create', data);
|
||||
}
|
||||
|
||||
/** 修改质检指标 */
|
||||
export function updateIndicator(data: MesQcIndicatorApi.Indicator) {
|
||||
return requestClient.put('/mes/qc/indicator/update', data);
|
||||
}
|
||||
|
||||
/** 删除质检指标 */
|
||||
export function deleteIndicator(id: number) {
|
||||
return requestClient.delete(`/mes/qc/indicator/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出质检指标 */
|
||||
export function exportIndicator(params: any) {
|
||||
return requestClient.download('/mes/qc/indicator/export-excel', { params });
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcTemplateApi {
|
||||
/** MES 质检方案 */
|
||||
export interface Template {
|
||||
id?: number; // 编号
|
||||
code?: string; // 方案编号
|
||||
name?: string; // 方案名称
|
||||
types?: number[]; // 检测种类
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询质检方案分页 */
|
||||
export function getTemplatePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesQcTemplateApi.Template>>(
|
||||
'/mes/qc/template/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询质检方案详情 */
|
||||
export function getTemplate(id: number) {
|
||||
return requestClient.get<MesQcTemplateApi.Template>(
|
||||
`/mes/qc/template/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增质检方案 */
|
||||
export function createTemplate(data: MesQcTemplateApi.Template) {
|
||||
return requestClient.post('/mes/qc/template/create', data);
|
||||
}
|
||||
|
||||
/** 修改质检方案 */
|
||||
export function updateTemplate(data: MesQcTemplateApi.Template) {
|
||||
return requestClient.put('/mes/qc/template/update', data);
|
||||
}
|
||||
|
||||
/** 删除质检方案 */
|
||||
export function deleteTemplate(id: number) {
|
||||
return requestClient.delete(`/mes/qc/template/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出质检方案 */
|
||||
export function exportTemplate(params: any) {
|
||||
return requestClient.download('/mes/qc/template/export-excel', { params });
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcTemplateIndicatorApi {
|
||||
/** MES 质检方案-检测指标项 */
|
||||
export interface TemplateIndicator {
|
||||
id?: number; // 编号
|
||||
templateId?: number; // 质检方案ID
|
||||
indicatorId?: number; // 质检指标ID
|
||||
checkMethod?: string; // 检测方法
|
||||
standardValue?: number; // 标准值
|
||||
unitMeasureId?: number; // 计量单位ID
|
||||
thresholdMax?: number; // 误差上限
|
||||
thresholdMin?: number; // 误差下限
|
||||
docUrl?: string; // 说明图URL
|
||||
remark?: string; // 备注
|
||||
indicatorCode?: string; // 检测项编码(JOIN)
|
||||
indicatorName?: string; // 检测项名称(JOIN)
|
||||
indicatorType?: number; // 检测项类型(JOIN)
|
||||
indicatorTool?: string; // 检测工具(JOIN)
|
||||
unitMeasureName?: string; // 计量单位名称(JOIN)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询检测指标项分页 */
|
||||
export function getTemplateIndicatorPage(params: PageParam & { templateId?: number }) {
|
||||
return requestClient.get<
|
||||
PageResult<MesQcTemplateIndicatorApi.TemplateIndicator>
|
||||
>('/mes/qc/template/indicator/page', { params });
|
||||
}
|
||||
|
||||
/** 查询检测指标项详情 */
|
||||
export function getTemplateIndicator(id: number) {
|
||||
return requestClient.get<MesQcTemplateIndicatorApi.TemplateIndicator>(
|
||||
`/mes/qc/template/indicator/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增检测指标项 */
|
||||
export function createTemplateIndicator(
|
||||
data: MesQcTemplateIndicatorApi.TemplateIndicator,
|
||||
) {
|
||||
return requestClient.post('/mes/qc/template/indicator/create', data);
|
||||
}
|
||||
|
||||
/** 修改检测指标项 */
|
||||
export function updateTemplateIndicator(
|
||||
data: MesQcTemplateIndicatorApi.TemplateIndicator,
|
||||
) {
|
||||
return requestClient.put('/mes/qc/template/indicator/update', data);
|
||||
}
|
||||
|
||||
/** 删除检测指标项 */
|
||||
export function deleteTemplateIndicator(id: number) {
|
||||
return requestClient.delete(`/mes/qc/template/indicator/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesQcTemplateItemApi {
|
||||
/** MES 质检方案-产品关联 */
|
||||
export interface TemplateItem {
|
||||
id?: number; // 编号
|
||||
templateId?: number; // 质检方案ID
|
||||
itemId?: number; // 产品物料ID
|
||||
quantityCheck?: number; // 最低检测数
|
||||
quantityUnqualified?: number; // 最大不合格数
|
||||
criticalRate?: number; // 最大致命缺陷率(%)
|
||||
majorRate?: number; // 最大严重缺陷率(%)
|
||||
minorRate?: number; // 最大轻微缺陷率(%)
|
||||
remark?: string; // 备注
|
||||
itemCode?: string; // 物料编码(JOIN)
|
||||
itemName?: string; // 物料名称(JOIN)
|
||||
specification?: string; // 规格型号(JOIN)
|
||||
unitMeasureName?: string; // 计量单位名称(JOIN)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品关联分页 */
|
||||
export function getTemplateItemPage(params: PageParam & { templateId?: number }) {
|
||||
return requestClient.get<PageResult<MesQcTemplateItemApi.TemplateItem>>(
|
||||
'/mes/qc/template/item/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询产品关联详情 */
|
||||
export function getTemplateItem(id: number) {
|
||||
return requestClient.get<MesQcTemplateItemApi.TemplateItem>(
|
||||
`/mes/qc/template/item/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增产品关联 */
|
||||
export function createTemplateItem(data: MesQcTemplateItemApi.TemplateItem) {
|
||||
return requestClient.post('/mes/qc/template/item/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品关联 */
|
||||
export function updateTemplateItem(data: MesQcTemplateItemApi.TemplateItem) {
|
||||
return requestClient.put('/mes/qc/template/item/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品关联 */
|
||||
export function deleteTemplateItem(id: number) {
|
||||
return requestClient.delete(`/mes/qc/template/item/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesWmBarcodeConfigApi {
|
||||
/** MES 条码配置 */
|
||||
export interface BarcodeConfig {
|
||||
id?: number; // 编号
|
||||
format?: number; // 条码格式
|
||||
bizType?: number; // 业务类型
|
||||
contentFormat?: string; // 内容格式模板
|
||||
contentExample?: string; // 内容样例
|
||||
autoGenerateFlag?: boolean; // 是否自动生成
|
||||
defaultTemplate?: string; // 默认打印模板
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询条码配置分页 */
|
||||
export function getBarcodeConfigPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesWmBarcodeConfigApi.BarcodeConfig>>(
|
||||
'/mes/wm/barcode-config/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询条码配置详情 */
|
||||
export function getBarcodeConfig(id: number) {
|
||||
return requestClient.get<MesWmBarcodeConfigApi.BarcodeConfig>(
|
||||
`/mes/wm/barcode-config/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增条码配置 */
|
||||
export function createBarcodeConfig(data: MesWmBarcodeConfigApi.BarcodeConfig) {
|
||||
return requestClient.post('/mes/wm/barcode-config/create', data);
|
||||
}
|
||||
|
||||
/** 修改条码配置 */
|
||||
export function updateBarcodeConfig(data: MesWmBarcodeConfigApi.BarcodeConfig) {
|
||||
return requestClient.put('/mes/wm/barcode-config/update', data);
|
||||
}
|
||||
|
||||
/** 删除条码配置 */
|
||||
export function deleteBarcodeConfig(id: number) {
|
||||
return requestClient.delete(`/mes/wm/barcode-config/delete?id=${id}`);
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ export function getBarcode(id: number) {
|
|||
export function getBarcodeByBusiness(bizType: number, bizId: number) {
|
||||
return requestClient.get<MesWmBarcodeApi.Barcode>(
|
||||
'/mes/wm/barcode/get-by-business',
|
||||
{ params: { bizType, bizId } },
|
||||
{ params: { bizId, bizType } },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -57,9 +57,14 @@ export function deleteBarcode(id: number) {
|
|||
return requestClient.delete(`/mes/wm/barcode/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出条码 */
|
||||
export function exportBarcode(params: any) {
|
||||
return requestClient.download('/mes/wm/barcode/export-excel', { params });
|
||||
}
|
||||
|
||||
/** 生成条码内容 */
|
||||
export function generateBarcodeContent(bizType: number, bizCode: string) {
|
||||
return requestClient.get<string>('/mes/wm/barcode/generate-content', {
|
||||
params: { bizType, bizCode },
|
||||
params: { bizCode, bizType },
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesWmItemConsumeLineApi {
|
||||
/** MES 物料消耗行 */
|
||||
export interface ItemConsumeLine {
|
||||
id?: number;
|
||||
feedbackId?: number; // 报工编号
|
||||
itemId?: number; // 物料编号
|
||||
itemCode?: string; // 物资编码
|
||||
itemName?: string; // 物资名称
|
||||
specification?: string; // 规格型号
|
||||
unitId?: number; // 单位编号
|
||||
unitName?: string; // 单位
|
||||
quantity?: number; // 消耗数量
|
||||
batchCode?: string; // 批次号
|
||||
locationId?: number; // 库位编号
|
||||
locationName?: string; // 库位名称
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** MES 物料消耗行分页查询参数 */
|
||||
export interface PageParams extends PageParam {
|
||||
feedbackId?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询物料消耗行分页 */
|
||||
export function getItemConsumeLinePage(
|
||||
params: MesWmItemConsumeLineApi.PageParams,
|
||||
) {
|
||||
return requestClient.get<PageResult<MesWmItemConsumeLineApi.ItemConsumeLine>>(
|
||||
'/mes/wm/item-consume-line/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesWmMaterialStockApi {
|
||||
/** MES 库存台账 */
|
||||
export interface MaterialStock {
|
||||
id?: number; // 编号
|
||||
itemTypeId?: number; // 物料分类编号
|
||||
itemId?: number; // 物料编号
|
||||
itemCode?: string; // 物料编码
|
||||
itemName?: string; // 物料名称
|
||||
specification?: string; // 规格型号
|
||||
unitMeasureName?: string; // 计量单位名称
|
||||
batchId?: number; // 批次编号
|
||||
batchCode?: string; // 批次号
|
||||
warehouseId?: number; // 仓库编号
|
||||
warehouseCode?: string; // 仓库编码
|
||||
warehouseName?: string; // 仓库名称
|
||||
locationId?: number; // 库区编号
|
||||
locationName?: string; // 库区名称
|
||||
areaId?: number; // 库位编号
|
||||
areaName?: string; // 库位名称
|
||||
vendorId?: number; // 供应商编号
|
||||
vendorName?: string; // 供应商名称
|
||||
quantity?: number; // 在库数量
|
||||
receiptTime?: string; // 入库日期
|
||||
frozen?: boolean; // 是否冻结
|
||||
createTime?: Date; // 创建时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询库存台账分页 */
|
||||
export function getMaterialStockPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MesWmMaterialStockApi.MaterialStock>>(
|
||||
'/mes/wm/material-stock/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询库存台账详情 */
|
||||
export function getMaterialStock(id: number) {
|
||||
return requestClient.get<MesWmMaterialStockApi.MaterialStock>(
|
||||
`/mes/wm/material-stock/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新库存冻结状态 */
|
||||
export function updateMaterialStockFrozen(data: {
|
||||
frozen: boolean;
|
||||
id: number;
|
||||
}) {
|
||||
return requestClient.put('/mes/wm/material-stock/update-frozen', data);
|
||||
}
|
||||
|
||||
/** 导出库存台账 */
|
||||
export function exportMaterialStock(params: any) {
|
||||
return requestClient.download('/mes/wm/material-stock/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace MesWmProductProduceLineApi {
|
||||
/** MES 产品产出行 */
|
||||
export interface ProductProduceLine {
|
||||
id?: number;
|
||||
feedbackId?: number; // 报工编号
|
||||
itemId?: number; // 物料编号
|
||||
itemCode?: string; // 物资编码
|
||||
itemName?: string; // 物资名称
|
||||
specification?: string; // 规格型号
|
||||
unitMeasureId?: number; // 单位编号
|
||||
unitMeasureName?: string; // 单位
|
||||
quantity?: number; // 产出数量
|
||||
batchCode?: string; // 批次号
|
||||
qualityStatus?: number; // 质量状态
|
||||
locationId?: number; // 库位编号
|
||||
locationName?: string; // 库位名称
|
||||
remark?: string; // 备注
|
||||
}
|
||||
|
||||
/** MES 产品产出行分页查询参数 */
|
||||
export interface PageParams extends PageParam {
|
||||
feedbackId?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品产出行分页 */
|
||||
export function getProductProduceLinePage(
|
||||
params: MesWmProductProduceLineApi.PageParams,
|
||||
) {
|
||||
return requestClient.get<
|
||||
PageResult<MesWmProductProduceLineApi.ProductProduceLine>
|
||||
>('/mes/wm/product-produce-line/page', { params });
|
||||
}
|
||||
|
|
@ -48,3 +48,18 @@ export function getWarehouseArea(id: number) {
|
|||
`/mes/wm/warehouse-area/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增库位 */
|
||||
export function createWarehouseArea(data: MesWmWarehouseAreaApi.WarehouseArea) {
|
||||
return requestClient.post('/mes/wm/warehouse-area/create', data);
|
||||
}
|
||||
|
||||
/** 修改库位 */
|
||||
export function updateWarehouseArea(data: MesWmWarehouseAreaApi.WarehouseArea) {
|
||||
return requestClient.put('/mes/wm/warehouse-area/update', data);
|
||||
}
|
||||
|
||||
/** 删除库位 */
|
||||
export function deleteWarehouseArea(id: number) {
|
||||
return requestClient.delete(`/mes/wm/warehouse-area/delete?id=${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,18 @@ export function getWarehouse(id: number) {
|
|||
`/mes/wm/warehouse/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增仓库 */
|
||||
export function createWarehouse(data: MesWmWarehouseApi.Warehouse) {
|
||||
return requestClient.post('/mes/wm/warehouse/create', data);
|
||||
}
|
||||
|
||||
/** 修改仓库 */
|
||||
export function updateWarehouse(data: MesWmWarehouseApi.Warehouse) {
|
||||
return requestClient.put('/mes/wm/warehouse/update', data);
|
||||
}
|
||||
|
||||
/** 删除仓库 */
|
||||
export function deleteWarehouse(id: number) {
|
||||
return requestClient.delete(`/mes/wm/warehouse/delete?id=${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,35 @@ export function getWarehouseLocation(id: number) {
|
|||
`/mes/wm/warehouse-location/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增库区 */
|
||||
export function createWarehouseLocation(
|
||||
data: MesWmWarehouseLocationApi.WarehouseLocation,
|
||||
) {
|
||||
return requestClient.post('/mes/wm/warehouse-location/create', data);
|
||||
}
|
||||
|
||||
/** 修改库区 */
|
||||
export function updateWarehouseLocation(
|
||||
data: MesWmWarehouseLocationApi.WarehouseLocation,
|
||||
) {
|
||||
return requestClient.put('/mes/wm/warehouse-location/update', data);
|
||||
}
|
||||
|
||||
/** 删除库区 */
|
||||
export function deleteWarehouseLocation(id: number) {
|
||||
return requestClient.delete(`/mes/wm/warehouse-location/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 批量设置库区下所有库位的混放规则 */
|
||||
export function updateAreaByLocationId(
|
||||
locationId: number,
|
||||
allowItemMixing?: boolean,
|
||||
allowBatchMixing?: boolean,
|
||||
) {
|
||||
return requestClient.put(
|
||||
'/mes/wm/warehouse-location/update-by-location-id',
|
||||
null,
|
||||
{ params: { allowBatchMixing, allowItemMixing, locationId } },
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,24 +38,21 @@ async function handleUpdatePublicStatusChange(
|
|||
row: AiImageApi.Image,
|
||||
): Promise<boolean | undefined> {
|
||||
const text = newStatus ? '公开' : '私有';
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要将该图片切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新图片状态
|
||||
await updateImage({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新图片状态
|
||||
await updateImage({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -76,24 +76,21 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: AiKnowledgeDocumentApi.KnowledgeDocument,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.name}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新文档状态
|
||||
await updateKnowledgeDocumentStatus({
|
||||
id: row.id,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新文档状态
|
||||
await updateKnowledgeDocumentStatus({
|
||||
id: row.id,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -64,21 +64,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: AiKnowledgeSegmentApi.KnowledgeSegment,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将片段 ${row.id} 的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新片段状态
|
||||
await updateKnowledgeSegmentStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新片段状态
|
||||
await updateKnowledgeSegmentStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -38,24 +38,21 @@ async function handleUpdatePublicStatusChange(
|
|||
row: AiMusicApi.Music,
|
||||
): Promise<boolean | undefined> {
|
||||
const text = newStatus ? '公开' : '私有';
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要将该音乐切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新音乐状态
|
||||
await updateMusic({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新音乐状态
|
||||
await updateMusic({
|
||||
id: row.id,
|
||||
publicStatus: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -74,28 +74,24 @@ async function handleDeleteContactBusinessList() {
|
|||
message.error('请先选择商机后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteContactBusinessList({
|
||||
contactId: props.bizId,
|
||||
businessIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error($t('ui.actionMessage.operationFailed')));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deleteContactBusinessList({
|
||||
contactId: props.bizId,
|
||||
businessIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (!res) {
|
||||
throw new Error($t('ui.actionMessage.operationFailed'));
|
||||
}
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 查看商机详情 */
|
||||
|
|
|
|||
|
|
@ -83,21 +83,18 @@ function handleTransfer() {
|
|||
|
||||
/** 转化为客户 */
|
||||
async function handleTransform(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: '确定将该线索转化为客户吗?',
|
||||
})
|
||||
.then(async () => {
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
message.success('转化客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 转化为客户
|
||||
await transformClue(clueId.value);
|
||||
// 提示并返回成功
|
||||
message.success('转化客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -71,28 +71,24 @@ async function handleDeleteContactBusinessList() {
|
|||
message.error('请先选择联系人后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteBusinessContactList({
|
||||
businessId: props.bizId,
|
||||
contactIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error($t('ui.actionMessage.operationFailed')));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deleteBusinessContactList({
|
||||
businessId: props.bizId,
|
||||
contactIds: checkedRows.value.map((item) => item.id),
|
||||
});
|
||||
if (!res) {
|
||||
throw new Error($t('ui.actionMessage.operationFailed'));
|
||||
}
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 创建商机联系人关联 */
|
||||
|
|
|
|||
|
|
@ -100,41 +100,35 @@ function handleTransfer() {
|
|||
}
|
||||
|
||||
/** 锁定客户 */
|
||||
function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定锁定客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
message.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 锁定客户
|
||||
await lockCustomer(customerId.value, lockStatus);
|
||||
// 提示并返回成功
|
||||
message.success(lockStatus ? '锁定客户成功' : '解锁客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 领取客户 */
|
||||
function handleReceive(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handleReceive(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定领取客户【${customer.value.name}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
message.success('领取客户成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 领取客户
|
||||
await receiveCustomer([customerId.value]);
|
||||
// 提示并返回成功
|
||||
message.success('领取客户成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 分配客户 */
|
||||
|
|
@ -143,42 +137,36 @@ function handleDistributeForm() {
|
|||
}
|
||||
|
||||
/** 客户放入公海 */
|
||||
function handlePutPool(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
async function handlePutPool(): Promise<boolean | undefined> {
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定将客户【${customer.value.name}】放入公海吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
message.success('放入公海成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 放入公海
|
||||
await putCustomerPool(customerId.value);
|
||||
// 提示并返回成功
|
||||
message.success('放入公海成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 更新成交状态操作 */
|
||||
async function handleUpdateDealStatus(): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
confirm({
|
||||
const dealStatus = !customer.value.dealStatus;
|
||||
try {
|
||||
await confirm({
|
||||
content: `确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
message.success('更新成交状态成功');
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新成交状态
|
||||
await updateCustomerDealStatus(customerId.value, dealStatus);
|
||||
// 提示并返回成功
|
||||
message.success('更新成交状态成功');
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
|
|
|
|||
|
|
@ -94,32 +94,28 @@ function handleEdit() {
|
|||
}
|
||||
|
||||
/** 删除团队成员 */
|
||||
function handleDelete() {
|
||||
async function handleDelete() {
|
||||
if (checkedRows.value.length === 0) {
|
||||
message.error('请先选择团队成员后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deletePermissionBatch(
|
||||
checkedRows.value.map((item) => item.id!),
|
||||
);
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error('移出失败'));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const res = await deletePermissionBatch(
|
||||
checkedRows.value.map((item) => item.id!),
|
||||
);
|
||||
if (!res) {
|
||||
throw new Error('移出失败');
|
||||
}
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 退出团队 */
|
||||
|
|
|
|||
|
|
@ -65,23 +65,20 @@ async function handleDefaultStatusChange(
|
|||
newStatus: boolean,
|
||||
row: ErpAccountApi.Account,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
confirm({
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}"${row.name}"默认吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新默认状态
|
||||
await updateAccountDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新默认状态
|
||||
await updateAccountDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增付款单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑付款单 */
|
||||
function handleEdit(row: ErpFinancePaymentApi.FinancePayment) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除付款单 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpFinancePaymentApi.FinancePayment) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -40,7 +42,7 @@ const formData = ref<
|
|||
status: 0,
|
||||
});
|
||||
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -145,8 +147,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ import { getCustomerSimpleList } from '#/api/erp/sale/customer';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增收款单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑收款单 */
|
||||
function handleEdit(row: ErpFinanceReceiptApi.FinanceReceipt) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除收款单 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpFinanceReceiptApi.FinanceReceipt) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpFinanceReceiptApi } from '#/api/erp/finance/receipt';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -40,7 +42,7 @@ const formData = ref<
|
|||
status: 0,
|
||||
});
|
||||
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -159,8 +161,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增采购入库 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑采购入库 */
|
||||
function handleEdit(row: ErpPurchaseInApi.PurchaseIn) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除采购入库 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpPurchaseInApi.PurchaseIn) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpPurchaseInApi } from '#/api/erp/purchase/in';
|
||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
|
||||
|
|
@ -46,7 +48,7 @@ const formData = ref<
|
|||
otherPrice: 0,
|
||||
items: [],
|
||||
});
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -175,8 +177,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@ import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增采购订单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑采购订单 */
|
||||
function handleEdit(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除采购订单 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -21,7 +23,7 @@ import PurchaseOrderItemForm from './item-form.vue';
|
|||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpPurchaseOrderApi.PurchaseOrder>();
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof PurchaseOrderItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -124,8 +126,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -45,17 +45,17 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 新增采购退货 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑采购退货 */
|
||||
function handleEdit(row: ErpPurchaseReturnApi.PurchaseReturn) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpPurchaseReturnApi.PurchaseReturn) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除采购退货 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
import type { ErpPurchaseReturnApi } from '#/api/erp/purchase/return';
|
||||
|
||||
|
|
@ -46,7 +48,7 @@ const formData = ref<
|
|||
otherPrice: 0,
|
||||
items: [],
|
||||
});
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
/* eslint-disable unicorn/no-nested-ternary */
|
||||
|
|
@ -175,8 +177,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@ import { getCustomerSimpleList } from '#/api/erp/sale/customer';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增销售订单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑销售订单 */
|
||||
function handleEdit(row: ErpSaleOrderApi.SaleOrder) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除销售订单 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpSaleOrderApi.SaleOrder) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -21,7 +23,7 @@ import ItemForm from './item-form.vue';
|
|||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpSaleOrderApi.SaleOrder>();
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -114,8 +116,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增销售出库 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑销售出库 */
|
||||
function handleEdit(row: ErpSaleOutApi.SaleOut) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除销售出库 */
|
||||
|
|
@ -91,7 +91,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpSaleOutApi.SaleOut) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
|
||||
import type { ErpSaleOutApi } from '#/api/erp/sale/out';
|
||||
|
||||
|
|
@ -42,7 +44,7 @@ const formData = ref<
|
|||
otherPrice: 0,
|
||||
items: [],
|
||||
});
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
/* eslint-disable unicorn/no-nested-ternary */
|
||||
|
|
@ -170,8 +172,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增销售退货 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑销售退货 */
|
||||
function handleEdit(row: ErpSaleReturnApi.SaleReturn) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除销售退货 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpSaleReturnApi.SaleReturn) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
|
||||
import type { ErpSaleReturnApi } from '#/api/erp/sale/return';
|
||||
|
||||
|
|
@ -46,7 +48,7 @@ const formData = ref<
|
|||
otherPrice: 0,
|
||||
items: [],
|
||||
});
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -175,8 +177,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增库存盘点单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑库存盘点单 */
|
||||
function handleEdit(row: ErpStockCheckApi.StockCheck) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除库存盘点单 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpStockCheckApi.StockCheck) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpStockCheckApi } from '#/api/erp/stock/check';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -20,7 +22,7 @@ import ItemForm from './item-form.vue';
|
|||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpStockCheckApi.StockCheck>();
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -93,8 +95,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增其它入库单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑其它入库单 */
|
||||
function handleEdit(row: ErpStockInApi.StockIn) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除其它入库单 */
|
||||
|
|
@ -91,7 +91,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpStockInApi.StockIn) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpStockInApi } from '#/api/erp/stock/in';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -16,7 +18,7 @@ import ItemForm from './item-form.vue';
|
|||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpStockInApi.StockIn>();
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -89,8 +91,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增库存调拨单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑库存调拨单 */
|
||||
function handleEdit(row: ErpStockMoveApi.StockMove) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除库存调拨单 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpStockMoveApi.StockMove) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpStockMoveApi } from '#/api/erp/stock/move';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -20,7 +22,7 @@ import ItemForm from './item-form.vue';
|
|||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpStockMoveApi.StockMove>();
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -93,8 +95,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'edit';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ async function handleExport() {
|
|||
|
||||
/** 新增其它出库单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑其它出库单 */
|
||||
function handleEdit(row: ErpStockOutApi.StockOut) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除其它出库单 */
|
||||
|
|
@ -94,7 +94,7 @@ function handleRowCheckboxChange({
|
|||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpStockOutApi.StockOut) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
formModalApi.setData({ formType: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { ErpStockOutApi } from '#/api/erp/stock/out';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -20,7 +22,7 @@ import ItemForm from './item-form.vue';
|
|||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<ErpStockOutApi.StockOut>();
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const formType = ref<FormType>('create'); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
|
|
@ -93,8 +95,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
|
|
|
|||
|
|
@ -63,23 +63,20 @@ async function handleDefaultStatusChange(
|
|||
newStatus: boolean,
|
||||
row: ErpWarehouseApi.Warehouse,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
confirm({
|
||||
const text = newStatus ? '设置' : '取消';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}"${row.name}"默认吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新默认状态
|
||||
await updateWarehouseDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新默认状态
|
||||
await updateWarehouseDefaultStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}默认成功`);
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ function handleRefresh() {
|
|||
|
||||
/** 创建固件 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑固件 */
|
||||
function handleEdit(row: IoTOtaFirmwareApi.Firmware) {
|
||||
formModalApi.setData({ type: 'update', id: row.id }).open();
|
||||
formModalApi.setData({ id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除固件 */
|
||||
|
|
|
|||
|
|
@ -63,25 +63,22 @@ async function handleStatusChange(
|
|||
newStatus: boolean,
|
||||
row: MallCommentApi.Comment,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newStatus ? '展示' : '隐藏';
|
||||
confirm({
|
||||
const text = newStatus ? '展示' : '隐藏';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text}该评论吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateCommentVisible({
|
||||
id: row.id!,
|
||||
visible: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateCommentVisible({
|
||||
id: row.id!,
|
||||
visible: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -107,26 +107,23 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallSpuApi.Spu,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
confirm({
|
||||
// 二次确认
|
||||
const text = newStatus ? '上架' : '下架';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateStatus({
|
||||
id: row.id!,
|
||||
status: newStatus,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 添加到仓库 / 回收站的状态 */
|
||||
|
|
|
|||
|
|
@ -60,21 +60,18 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallCouponTemplateApi.CouponTemplate,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.name}的状态切换为【${newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用'}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新优惠券模板状态
|
||||
await updateCouponTemplateStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新优惠券模板状态
|
||||
await updateCouponTemplateStatus(row.id!, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -59,23 +59,20 @@ async function handleStatusChange(
|
|||
newStatus: number,
|
||||
row: MallSeckillConfigApi.SeckillConfig,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 二次确认
|
||||
const text = row.status === 0 ? '启用' : '停用';
|
||||
confirm({
|
||||
// 二次确认
|
||||
const text = row.status === 0 ? '启用' : '停用';
|
||||
try {
|
||||
await confirm({
|
||||
content: `确认要${text + row.name}吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新状态
|
||||
await updateSeckillConfigStatus(row.id, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新状态
|
||||
await updateSeckillConfigStatus(row.id, newStatus);
|
||||
// 提示并返回成功
|
||||
message.success(`${text}成功`);
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -87,26 +87,23 @@ async function handleBrokerageEnabledChange(
|
|||
newEnabled: boolean,
|
||||
row: MallBrokerageUserApi.BrokerageUser,
|
||||
): Promise<boolean | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const text = newEnabled ? '开通' : '关闭';
|
||||
confirm({
|
||||
const text = newEnabled ? '开通' : '关闭';
|
||||
try {
|
||||
await confirm({
|
||||
content: `你要将${row.nickname}的推广资格切换为【${text}】吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
// 更新推广资格
|
||||
await updateBrokerageEnabled({
|
||||
id: row.id!,
|
||||
enabled: newEnabled,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
// 更新推广资格
|
||||
await updateBrokerageEnabled({
|
||||
id: row.id!,
|
||||
enabled: newEnabled,
|
||||
});
|
||||
// 提示并返回成功
|
||||
message.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import {
|
|||
MesCalShiftTypeEnum,
|
||||
} from '#/views/mes/utils/constants';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'update';
|
||||
|
||||
/** 新增/修改排班计划的表单 */
|
||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -27,17 +27,17 @@ function handleRefresh() {
|
|||
|
||||
/** 创建排班计划 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 查看排班计划 */
|
||||
function handleDetail(row: MesCalPlanApi.Plan) {
|
||||
formModalApi.setData({ id: row.id, type: 'detail' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'detail' }).open();
|
||||
}
|
||||
|
||||
/** 编辑排班计划 */
|
||||
function handleEdit(row: MesCalPlanApi.Plan) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'update' }).open();
|
||||
}
|
||||
|
||||
/** 删除排班计划 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { MesCalPlanApi } from '#/api/mes/cal/plan';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -16,21 +18,19 @@ import { useFormSchema } from '../data';
|
|||
import ShiftList from './shift-list.vue';
|
||||
import PlanTeamList from './team-list.vue';
|
||||
|
||||
type FormMode = 'create' | 'detail' | 'update';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<FormMode>('create'); // 表单模式
|
||||
const formType = ref<FormType>('create'); // 表单模式
|
||||
const subTabsName = ref('shift'); // 当前资源页签
|
||||
const formData = ref<MesCalPlanApi.Plan>();
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const isDetail = computed(() => formType.value === 'detail'); // 是否查看模式
|
||||
const canConfirm = computed(
|
||||
() => formMode.value === 'update' && formData.value?.status === MesCalPlanStatusEnum.PREPARE,
|
||||
() => formType.value === 'update' && formData.value?.status === MesCalPlanStatusEnum.PREPARE,
|
||||
); // 是否可确认计划
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
if (formType.value === 'detail') {
|
||||
return $t('ui.actionTitle.view', ['排班计划']);
|
||||
}
|
||||
return formMode.value === 'update'
|
||||
return formType.value === 'update'
|
||||
? $t('ui.actionTitle.edit', ['排班计划'])
|
||||
: $t('ui.actionTitle.create', ['排班计划']);
|
||||
});
|
||||
|
|
@ -86,11 +86,11 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MesCalPlanApi.Plan;
|
||||
try {
|
||||
if (formMode.value === 'create') {
|
||||
if (formType.value === 'create') {
|
||||
const id = await createPlan(data);
|
||||
formData.value = { ...data, id: id as number, status: MesCalPlanStatusEnum.PREPARE };
|
||||
await formApi.setFieldValue('id', id);
|
||||
formMode.value = 'update';
|
||||
formType.value = 'update';
|
||||
} else {
|
||||
await updatePlan(data);
|
||||
formData.value = { ...formData.value, ...data };
|
||||
|
|
@ -109,10 +109,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||
await formApi.resetForm();
|
||||
subTabsName.value = 'shift';
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type?: FormMode }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
formApi.setDisabled(formMode.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formMode.value !== 'detail' });
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||
if (!data?.id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -132,15 +132,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||
<Modal :title="getTitle" class="w-4/5">
|
||||
<Form class="mx-4" />
|
||||
<Tabs
|
||||
v-if="formMode !== 'create' && formData?.id"
|
||||
v-if="formType !== 'create' && formData?.id"
|
||||
v-model:active-key="subTabsName"
|
||||
class="mx-4 mt-4"
|
||||
>
|
||||
<Tabs.TabPane key="shift" tab="班次">
|
||||
<ShiftList :form-type="formMode" :plan-id="formData.id" />
|
||||
<ShiftList :form-type="formType" :plan-id="formData.id" />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="team" tab="班组">
|
||||
<PlanTeamList :form-type="formMode" :plan-id="formData.id" />
|
||||
<PlanTeamList :form-type="formType" :plan-id="formData.id" />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
<template #prepend-footer>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesCalPlanShiftApi } from '#/api/mes/cal/plan/shift';
|
||||
|
||||
|
|
@ -16,7 +18,7 @@ import {
|
|||
} from '#/api/mes/cal/plan/shift';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
const props = withDefaults(defineProps<{ formType?: string; planId: number }>(), {
|
||||
const props = withDefaults(defineProps<{ formType?: FormType; planId: number }>(), {
|
||||
formType: 'update',
|
||||
});
|
||||
const isEditable = computed(() => props.formType !== 'detail'); // 是否可编辑
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesCalPlanTeamApi } from '#/api/mes/cal/plan/team';
|
||||
import type { MesCalTeamApi } from '#/api/mes/cal/team';
|
||||
|
|
@ -14,7 +16,7 @@ import { getTeamMemberListByTeam } from '#/api/mes/cal/team/member';
|
|||
import { $t } from '#/locales';
|
||||
import { CalTeamSelectDialog } from '#/views/mes/cal/team/components';
|
||||
|
||||
const props = withDefaults(defineProps<{ formType?: string; planId: number }>(), {
|
||||
const props = withDefaults(defineProps<{ formType?: FormType; planId: number }>(), {
|
||||
formType: 'update',
|
||||
});
|
||||
const isEditable = computed(() => props.formType !== 'detail'); // 是否可编辑
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import { z } from '#/adapter/form';
|
|||
import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
||||
import { MesAutoCodeRuleCode } from '#/views/mes/utils/constants';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'update';
|
||||
|
||||
/** 新增/修改班组的表单 */
|
||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -26,17 +26,17 @@ function handleRefresh() {
|
|||
|
||||
/** 创建班组 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 查看班组 */
|
||||
function handleDetail(row: MesCalTeamApi.Team) {
|
||||
formModalApi.setData({ id: row.id, type: 'detail' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'detail' }).open();
|
||||
}
|
||||
|
||||
/** 编辑班组 */
|
||||
function handleEdit(row: MesCalTeamApi.Team) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'update' }).open();
|
||||
}
|
||||
|
||||
/** 删除班组 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { MesCalTeamApi } from '#/api/mes/cal/team';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -15,18 +17,16 @@ import { useFormSchema } from '../data';
|
|||
import MemberList from './member-list.vue';
|
||||
|
||||
|
||||
type FormMode = 'create' | 'detail' | 'update';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<FormMode>('create'); // 表单模式
|
||||
const formType = ref<FormType>('create'); // 表单模式
|
||||
const subTabsName = ref('member'); // 当前资源页签
|
||||
const formData = ref<MesCalTeamApi.Team>();
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const isDetail = computed(() => formType.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
if (formType.value === 'detail') {
|
||||
return $t('ui.actionTitle.view', ['班组']);
|
||||
}
|
||||
return formMode.value === 'update'
|
||||
return formType.value === 'update'
|
||||
? $t('ui.actionTitle.edit', ['班组'])
|
||||
: $t('ui.actionTitle.create', ['班组']);
|
||||
});
|
||||
|
|
@ -62,11 +62,11 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MesCalTeamApi.Team;
|
||||
try {
|
||||
if (formMode.value === 'create') {
|
||||
if (formType.value === 'create') {
|
||||
const id = await createTeam(data);
|
||||
formData.value = { ...data, id: id as number };
|
||||
await formApi.setFieldValue('id', id);
|
||||
formMode.value = 'update';
|
||||
formType.value = 'update';
|
||||
} else {
|
||||
await updateTeam(data);
|
||||
formData.value = { ...formData.value, ...data };
|
||||
|
|
@ -85,10 +85,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||
await formApi.resetForm();
|
||||
subTabsName.value = 'member';
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type?: FormMode }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
formApi.setDisabled(formMode.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formMode.value !== 'detail' });
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||
if (!data?.id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -108,12 +108,12 @@ const [Modal, modalApi] = useVbenModal({
|
|||
<Modal :title="getTitle" class="w-4/5">
|
||||
<Form class="mx-4" />
|
||||
<Tabs
|
||||
v-if="formMode !== 'create' && formData?.id"
|
||||
v-if="formType !== 'create' && formData?.id"
|
||||
v-model:active-key="subTabsName"
|
||||
class="mx-4 mt-4"
|
||||
>
|
||||
<Tabs.TabPane key="member" tab="班组成员">
|
||||
<MemberList :form-type="formMode" :team-id="formData.id" />
|
||||
<MemberList :form-type="formType" :team-id="formData.id" />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</Modal>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesCalTeamMemberApi } from '#/api/mes/cal/team/member';
|
||||
|
||||
|
|
@ -16,7 +18,7 @@ import {
|
|||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
const props = withDefaults(defineProps<{ formType?: string; teamId: number }>(), {
|
||||
const props = withDefaults(defineProps<{ formType?: FormType; teamId: number }>(), {
|
||||
formType: 'update',
|
||||
});
|
||||
const isEditable = computed(() => ['create', 'update'].includes(props.formType)); // 是否可编辑
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import {
|
|||
MesDvSubjectTypeEnum,
|
||||
} from '#/views/mes/utils/constants';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'update';
|
||||
|
||||
/** 新增/修改点检保养方案的表单 */
|
||||
export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -34,17 +34,17 @@ function handleRefresh() {
|
|||
|
||||
/** 创建点检计划 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 查看点检计划 */
|
||||
function handleDetail(row: MesDvCheckPlanApi.CheckPlan) {
|
||||
formModalApi.setData({ id: row.id, type: 'detail' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'detail' }).open();
|
||||
}
|
||||
|
||||
/** 编辑点检计划 */
|
||||
function handleEdit(row: MesDvCheckPlanApi.CheckPlan) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'update' }).open();
|
||||
}
|
||||
|
||||
/** 删除点检计划 */
|
||||
|
|
@ -113,13 +113,19 @@ function getTableActions(row: MesDvCheckPlanApi.CheckPlan): ActionItem[] {
|
|||
label: '启用',
|
||||
type: 'link',
|
||||
auth: ['mes:dv-check-plan:update'],
|
||||
onClick: handleEnable.bind(null, row),
|
||||
popConfirm: {
|
||||
title: `确认启用"${row.name}"点检保养方案?启用后将不可修改或删除。`,
|
||||
confirm: handleEnable.bind(null, row),
|
||||
},
|
||||
}
|
||||
: {
|
||||
label: '停用',
|
||||
type: 'link',
|
||||
auth: ['mes:dv-check-plan:update'],
|
||||
onClick: handleDisable.bind(null, row),
|
||||
popConfirm: {
|
||||
title: `确认停用"${row.name}"点检保养方案?`,
|
||||
confirm: handleDisable.bind(null, row),
|
||||
},
|
||||
},
|
||||
);
|
||||
return actions;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { MesDvCheckPlanApi } from '#/api/mes/dv/checkplan';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -16,18 +18,16 @@ import { useFormSchema } from '../data';
|
|||
import MachineryList from './machinery-list.vue';
|
||||
import SubjectList from './subject-list.vue';
|
||||
|
||||
type FormMode = 'create' | 'detail' | 'update';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<FormMode>('create');
|
||||
const formType = ref<FormType>('create');
|
||||
const subTabsName = ref('machinery');
|
||||
const formData = ref<MesDvCheckPlanApi.CheckPlan>();
|
||||
const isDetail = computed(() => formMode.value === 'detail');
|
||||
const isDetail = computed(() => formType.value === 'detail');
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
if (formType.value === 'detail') {
|
||||
return '查看点检保养方案';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检保养方案' : '新增点检保养方案';
|
||||
return formType.value === 'update' ? '修改点检保养方案' : '新增点检保养方案';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
@ -61,11 +61,11 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MesDvCheckPlanApi.CheckPlan;
|
||||
try {
|
||||
if (formMode.value === 'create') {
|
||||
if (formType.value === 'create') {
|
||||
const id = await createCheckPlan(data);
|
||||
formData.value = { ...data, id: id as number, status: MesDvCheckPlanStatusEnum.PREPARE };
|
||||
await formApi.setFieldValue('id', id);
|
||||
formMode.value = 'update';
|
||||
formType.value = 'update';
|
||||
} else {
|
||||
await updateCheckPlan(data);
|
||||
formData.value = { ...formData.value, ...data };
|
||||
|
|
@ -84,10 +84,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||
await formApi.resetForm();
|
||||
subTabsName.value = 'machinery';
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type?: FormMode }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
formApi.setDisabled(formMode.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formMode.value !== 'detail' });
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||
if (!data?.id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -106,15 +106,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||
<Modal :title="getTitle" class="w-4/5">
|
||||
<Form class="mx-4" />
|
||||
<Tabs
|
||||
v-if="formMode !== 'create' && formData?.id"
|
||||
v-if="formType !== 'create' && formData?.id"
|
||||
v-model:active-key="subTabsName"
|
||||
class="mx-4 mt-4"
|
||||
>
|
||||
<Tabs.TabPane key="machinery" tab="设备">
|
||||
<MachineryList :form-type="formMode" :plan-id="formData.id" />
|
||||
<MachineryList :form-type="formType" :plan-id="formData.id" />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane key="subject" tab="项目">
|
||||
<SubjectList :form-type="formMode" :plan-id="formData.id" :plan-type="formData.type" />
|
||||
<SubjectList :form-type="formType" :plan-id="formData.id" :plan-type="formData.type" />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</Modal>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvCheckPlanMachineryApi } from '#/api/mes/dv/checkplan/machinery';
|
||||
|
||||
|
|
@ -17,7 +19,7 @@ import { $t } from '#/locales';
|
|||
import { DvMachinerySelect } from '#/views/mes/dv/machinery/components';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{ formType?: string; planId: number; planType?: number }>(),
|
||||
defineProps<{ formType?: FormType; planId: number; planType?: number }>(),
|
||||
{ formType: 'update', planType: undefined },
|
||||
);
|
||||
const isEditable = computed(() => props.formType !== 'detail');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvCheckPlanSubjectApi } from '#/api/mes/dv/checkplan/subject';
|
||||
|
||||
|
|
@ -19,7 +21,7 @@ import { $t } from '#/locales';
|
|||
import { DvSubjectSelect } from '#/views/mes/dv/subject/components';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{ formType?: string; planId: number; planType?: number }>(),
|
||||
defineProps<{ formType?: FormType; planId: number; planType?: number }>(),
|
||||
{ formType: 'update', planType: undefined },
|
||||
);
|
||||
const isEditable = computed(() => props.formType !== 'detail');
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ import {
|
|||
MesDvSubjectTypeEnum,
|
||||
} from '#/views/mes/utils/constants';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'update';
|
||||
|
||||
/** 新增/修改点检记录的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -27,17 +27,17 @@ function handleRefresh() {
|
|||
|
||||
/** 创建点检记录 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 查看点检记录 */
|
||||
function handleDetail(row: MesDvCheckRecordApi.CheckRecord) {
|
||||
formModalApi.setData({ id: row.id, type: 'detail' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'detail' }).open();
|
||||
}
|
||||
|
||||
/** 编辑点检记录 */
|
||||
function handleEdit(row: MesDvCheckRecordApi.CheckRecord) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'update' }).open();
|
||||
}
|
||||
|
||||
/** 删除点检记录 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { MesDvCheckRecordApi } from '#/api/mes/dv/checkrecord';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -20,20 +22,18 @@ import { MesDvCheckRecordStatusEnum } from '#/views/mes/utils/constants';
|
|||
import { useFormSchema } from '../data';
|
||||
import LineList from './line-list.vue';
|
||||
|
||||
type FormMode = 'create' | 'detail' | 'update';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<FormMode>('create');
|
||||
const formType = ref<FormType>('create');
|
||||
const formData = ref<MesDvCheckRecordApi.CheckRecord>();
|
||||
const isDetail = computed(() => formMode.value === 'detail');
|
||||
const isDetail = computed(() => formType.value === 'detail');
|
||||
const canSubmit = computed(
|
||||
() => formMode.value === 'update' && formData.value?.status === MesDvCheckRecordStatusEnum.DRAFT,
|
||||
() => formType.value === 'update' && formData.value?.status === MesDvCheckRecordStatusEnum.DRAFT,
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
if (formType.value === 'detail') {
|
||||
return '查看点检记录';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改点检记录' : '新增点检记录';
|
||||
return formType.value === 'update' ? '修改点检记录' : '新增点检记录';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
@ -83,11 +83,11 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MesDvCheckRecordApi.CheckRecord;
|
||||
try {
|
||||
if (formMode.value === 'create') {
|
||||
if (formType.value === 'create') {
|
||||
const id = await createCheckRecord(data);
|
||||
formData.value = { ...data, id: id as number, status: MesDvCheckRecordStatusEnum.DRAFT };
|
||||
await formApi.setFieldValue('id', id);
|
||||
formMode.value = 'update';
|
||||
formType.value = 'update';
|
||||
} else {
|
||||
await updateCheckRecord(data);
|
||||
formData.value = { ...formData.value, ...data };
|
||||
|
|
@ -105,10 +105,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||
}
|
||||
await formApi.resetForm();
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type?: FormMode }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
formApi.setDisabled(formMode.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formMode.value !== 'detail' });
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||
if (!data?.id) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import type { Ref } from 'vue';
|
||||
|
||||
import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MesDvMachineryApi } from '#/api/mes/dv/machinery';
|
||||
|
|
@ -18,8 +16,11 @@ import { MesAutoCodeRuleCode, MesDvMachineryStatusEnum } from '#/views/mes/utils
|
|||
|
||||
import { DvMachineryTypeSelect } from './type/components';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'update';
|
||||
|
||||
/** 新增/修改设备的表单 */
|
||||
export function useFormSchema(formApi?: VbenFormApi, formMode?: Ref<string>): VbenFormSchema[] {
|
||||
export function useFormSchema(formType: FormType, formApi?: VbenFormApi): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
|
|
@ -125,7 +126,7 @@ export function useFormSchema(formApi?: VbenFormApi, formMode?: Ref<string>): Vb
|
|||
},
|
||||
dependencies: {
|
||||
triggerFields: ['id'],
|
||||
show: () => formMode?.value === 'detail',
|
||||
show: () => formType === 'detail',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -141,7 +142,7 @@ export function useFormSchema(formApi?: VbenFormApi, formMode?: Ref<string>): Vb
|
|||
},
|
||||
dependencies: {
|
||||
triggerFields: ['id'],
|
||||
show: () => formMode?.value === 'detail',
|
||||
show: () => formType === 'detail',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ function handleRefresh() {
|
|||
|
||||
/** 创建设备 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 查看设备 */
|
||||
function handleDetail(row: MesDvMachineryApi.Machinery) {
|
||||
formModalApi.setData({ id: row.id, type: 'detail' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'detail' }).open();
|
||||
}
|
||||
|
||||
/** 编辑设备 */
|
||||
function handleEdit(row: MesDvMachineryApi.Machinery) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'update' }).open();
|
||||
}
|
||||
|
||||
/** 删除设备 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { MesDvMachineryApi } from '#/api/mes/dv/machinery';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -18,19 +20,17 @@ import CheckRecordList from './check-record-list.vue';
|
|||
import MaintenRecordList from './mainten-record-list.vue';
|
||||
import RepairList from './repair-list.vue';
|
||||
|
||||
type FormMode = 'create' | 'detail' | 'update';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formMode = ref<FormMode>('create'); // 表单模式
|
||||
const formType = ref<FormType>('create'); // 表单模式
|
||||
const subTabsName = ref('check'); // 当前资源页签
|
||||
const formData = ref<MesDvMachineryApi.Machinery>();
|
||||
const barcodeDetailRef = ref<InstanceType<typeof BarcodeDetail>>(); // 条码详情弹窗
|
||||
const isDetail = computed(() => formMode.value === 'detail'); // 是否查看模式
|
||||
const isDetail = computed(() => formType.value === 'detail'); // 是否查看模式
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
if (formType.value === 'detail') {
|
||||
return '查看设备';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改设备' : '新增设备';
|
||||
return formType.value === 'update' ? '修改设备' : '新增设备';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
@ -48,7 +48,7 @@ const [Form, formApi] = useVbenForm({
|
|||
});
|
||||
|
||||
/** 表单 schema 需要 formApi 引用,所以通过 setState 设置 schema */
|
||||
formApi.setState({ schema: useFormSchema(formApi, formMode) });
|
||||
formApi.setState({ schema: useFormSchema(formType.value, formApi) });
|
||||
|
||||
/** 查看设备条码 */
|
||||
function handleBarcode() {
|
||||
|
|
@ -94,10 +94,11 @@ const [Modal, modalApi] = useVbenModal({
|
|||
await formApi.resetForm();
|
||||
subTabsName.value = 'check';
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type?: FormMode }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
formApi.setDisabled(formMode.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formMode.value !== 'detail' });
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setState({ schema: useFormSchema(formType.value, formApi) });
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||
if (!data?.id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -117,7 +118,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
<Modal :title="getTitle" class="w-4/5">
|
||||
<Form class="mx-4" />
|
||||
<Tabs
|
||||
v-if="formMode !== 'create' && formData?.id"
|
||||
v-if="formType !== 'create' && formData?.id"
|
||||
v-model:active-key="subTabsName"
|
||||
class="mx-4 mt-4"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ import {
|
|||
MesDvSubjectTypeEnum,
|
||||
} from '#/views/mes/utils/constants';
|
||||
|
||||
/** 表单类型 */
|
||||
export type FormType = 'create' | 'detail' | 'update';
|
||||
|
||||
/** 新增/修改保养记录的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -31,17 +31,17 @@ function handleRefresh() {
|
|||
|
||||
/** 创建保养记录 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
formModalApi.setData({ formType: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 查看保养记录 */
|
||||
function handleDetail(row: MesDvMaintenRecordApi.MaintenRecord) {
|
||||
formModalApi.setData({ id: row.id, type: 'detail' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'detail' }).open();
|
||||
}
|
||||
|
||||
/** 编辑保养记录 */
|
||||
function handleEdit(row: MesDvMaintenRecordApi.MaintenRecord) {
|
||||
formModalApi.setData({ id: row.id, type: 'update' }).open();
|
||||
formModalApi.setData({ id: row.id, formType: 'update' }).open();
|
||||
}
|
||||
|
||||
/** 删除保养记录 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormType } from '../data';
|
||||
|
||||
import type { MesDvMaintenRecordApi } from '#/api/mes/dv/maintenrecord';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
|
@ -21,22 +23,20 @@ import { MesDvMaintenRecordStatusEnum } from '#/views/mes/utils/constants';
|
|||
import { useFormSchema } from '../data';
|
||||
import LineList from './line-list.vue';
|
||||
|
||||
type FormMode = 'create' | 'detail' | 'update';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const userStore = useUserStore();
|
||||
const formMode = ref<FormMode>('create');
|
||||
const formType = ref<FormType>('create');
|
||||
const formData = ref<MesDvMaintenRecordApi.MaintenRecord>();
|
||||
const isDetail = computed(() => formMode.value === 'detail');
|
||||
const isDetail = computed(() => formType.value === 'detail');
|
||||
const canSubmit = computed(
|
||||
() =>
|
||||
formMode.value === 'update' && formData.value?.status === MesDvMaintenRecordStatusEnum.PREPARE,
|
||||
formType.value === 'update' && formData.value?.status === MesDvMaintenRecordStatusEnum.PREPARE,
|
||||
);
|
||||
const getTitle = computed(() => {
|
||||
if (formMode.value === 'detail') {
|
||||
if (formType.value === 'detail') {
|
||||
return '查看保养记录';
|
||||
}
|
||||
return formMode.value === 'update' ? '修改保养记录' : '新增保养记录';
|
||||
return formType.value === 'update' ? '修改保养记录' : '新增保养记录';
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
|
@ -86,7 +86,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MesDvMaintenRecordApi.MaintenRecord;
|
||||
try {
|
||||
if (formMode.value === 'create') {
|
||||
if (formType.value === 'create') {
|
||||
const id = await createMaintenRecord(data);
|
||||
formData.value = {
|
||||
...data,
|
||||
|
|
@ -94,7 +94,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
status: MesDvMaintenRecordStatusEnum.PREPARE,
|
||||
};
|
||||
await formApi.setFieldValue('id', id);
|
||||
formMode.value = 'update';
|
||||
formType.value = 'update';
|
||||
} else {
|
||||
await updateMaintenRecord(data);
|
||||
formData.value = { ...formData.value, ...data };
|
||||
|
|
@ -112,10 +112,10 @@ const [Modal, modalApi] = useVbenModal({
|
|||
}
|
||||
await formApi.resetForm();
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type?: FormMode }>();
|
||||
formMode.value = data?.type || 'create';
|
||||
formApi.setDisabled(formMode.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formMode.value !== 'detail' });
|
||||
const data = modalApi.getData<{ formType: FormType; id?: number }>();
|
||||
formType.value = data.formType;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
modalApi.setState({ showConfirmButton: formType.value !== 'detail' });
|
||||
if (!data?.id) {
|
||||
await formApi.setFieldValue('userId', userStore.userInfo?.id);
|
||||
return;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue