Merge remote-tracking branch 'origin/master'

master
zengchenxi 9 months ago
commit 241ff6bd1c

@ -30,7 +30,7 @@ public enum CodeEnum {
CUSTOMER("客户", "Cus", 6), CUSTOMER("客户", "Cus", 6),
SUPPLIER("供应商", "Sup", 6), SUPPLIER("供应商", "Sup", 6),
PROCEDURE("工序", "Prs", 6), PROCEDURE("工序", "Prs", 6),
WAREHOUSE("仓库", "St", 4), WAREHOUSE("仓库", "Wa", 4),
; ;

@ -31,4 +31,10 @@ public interface ErrorCodeConstants {
ErrorCode WORKSHOP_NOT_EXISTS = new ErrorCode(1_002_001, "车间不存在"); ErrorCode WORKSHOP_NOT_EXISTS = new ErrorCode(1_002_001, "车间不存在");
ErrorCode CLASSES_NOT_EXISTS = new ErrorCode(1_002_002, "生产班组不存在"); ErrorCode CLASSES_NOT_EXISTS = new ErrorCode(1_002_002, "生产班组不存在");
ErrorCode MOULD_TYPE_NOT_EXISTS = new ErrorCode(1_002_003, "模具类型不存在"); ErrorCode MOULD_TYPE_NOT_EXISTS = new ErrorCode(1_002_003, "模具类型不存在");
/*********库存管理************/
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_003_001, "仓库不存在");
} }

@ -0,0 +1,95 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.warehouse;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.warehouse.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.warehouse.WarehouseDO;
import com.chanko.yunxi.mes.module.heli.service.warehouse.WarehouseService;
@Tag(name = "管理后台 - 仓库")
@RestController
@RequestMapping("/heli/warehouse")
@Validated
public class WarehouseController {
@Resource
private WarehouseService warehouseService;
@PostMapping("/create")
@Operation(summary = "创建仓库")
@PreAuthorize("@ss.hasPermission('heli:warehouse:create')")
public CommonResult<Long> createWarehouse(@Valid @RequestBody WarehouseSaveReqVO createReqVO) {
return success(warehouseService.createWarehouse(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新仓库")
@PreAuthorize("@ss.hasPermission('heli:warehouse:update')")
public CommonResult<Boolean> updateWarehouse(@Valid @RequestBody WarehouseSaveReqVO updateReqVO) {
warehouseService.updateWarehouse(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除仓库")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('heli:warehouse:delete')")
public CommonResult<Boolean> deleteWarehouse(@RequestParam("id") Long id) {
warehouseService.deleteWarehouse(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得仓库")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:warehouse:query')")
public CommonResult<WarehouseRespVO> getWarehouse(@RequestParam("id") Long id) {
WarehouseDO warehouse = warehouseService.getWarehouse(id);
return success(BeanUtils.toBean(warehouse, WarehouseRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得仓库分页")
@PreAuthorize("@ss.hasPermission('heli:warehouse:query')")
public CommonResult<PageResult<WarehouseRespVO>> getWarehousePage(@Valid WarehousePageReqVO pageReqVO) {
PageResult<WarehouseDO> pageResult = warehouseService.getWarehousePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, WarehouseRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出仓库 Excel")
@PreAuthorize("@ss.hasPermission('heli:warehouse:export')")
@OperateLog(type = EXPORT)
public void exportWarehouseExcel(@Valid WarehousePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<WarehouseDO> list = warehouseService.getWarehousePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "仓库.xls", "数据", WarehouseRespVO.class,
BeanUtils.toBean(list, WarehouseRespVO.class));
}
}

@ -0,0 +1,50 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.warehouse.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 仓库分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class WarehousePageReqVO extends PageParam {
@Schema(description = "主键id", example = "18985")
private Long id;
@Schema(description = "仓库编号,唯一")
private String whNo;
@Schema(description = "仓库名称,唯一", example = "王五")
private String whName;
@Schema(description = "联系人")
private String contact;
@Schema(description = "联系电话")
private String telephone;
@Schema(description = "状态,1 表示正常2 表示禁用", example = "2")
private Integer whStatus;
@Schema(description = "记录的创建人,对应员工表中的 Id")
private String creator;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "记录的修改人,对应员工表中的 Id")
private String updater;
@Schema(description = "更新时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] updateTime;
}

@ -0,0 +1,59 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.warehouse.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat;
import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 仓库 Response VO")
@Data
@ExcelIgnoreUnannotated
public class WarehouseRespVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18985")
@ExcelProperty("主键id")
private Long id;
@Schema(description = "仓库编号,唯一")
@ExcelProperty("仓库编号,唯一")
private String whNo;
@Schema(description = "仓库名称,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("仓库名称,唯一")
private String whName;
@Schema(description = "联系人")
@ExcelProperty("联系人")
private String contact;
@Schema(description = "联系电话")
@ExcelProperty("联系电话")
private String telephone;
@Schema(description = "状态,1 表示正常2 表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty(value = "状态,1 表示正常2 表示禁用", converter = DictConvert.class)
@DictFormat("heli_common_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Integer whStatus;
@Schema(description = "记录的创建人,对应员工表中的 Id", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("记录的创建人,对应员工表中的 Id")
private String creator;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "记录的修改人,对应员工表中的 Id")
@ExcelProperty("记录的修改人,对应员工表中的 Id")
private String updater;
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("更新时间")
private LocalDateTime updateTime;
}

@ -0,0 +1,33 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.warehouse.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
@Schema(description = "管理后台 - 仓库新增/修改 Request VO")
@Data
public class WarehouseSaveReqVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18985")
private Long id;
@Schema(description = "仓库编号,唯一")
private String whNo;
@Schema(description = "仓库名称,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "仓库名称,唯一不能为空")
private String whName;
@Schema(description = "联系人")
private String contact;
@Schema(description = "联系电话")
private String telephone;
@Schema(description = "状态,1 表示正常2 表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "状态,1 表示正常2 表示禁用不能为空")
private Integer whStatus;
}

@ -0,0 +1,53 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.warehouse;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("wms_wh")
@KeySequence("wms_wh_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WarehouseDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
*
*/
private String whNo;
/**
*
*/
private String whName;
/**
*
*/
private String contact;
/**
*
*/
private String telephone;
/**
* ,1 2
*
* {@link TODO heli_common_status }
*/
private Integer whStatus;
}

@ -0,0 +1,35 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.warehouse;
import java.util.*;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.warehouse.WarehouseDO;
import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.warehouse.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
default PageResult<WarehouseDO> selectPage(WarehousePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<WarehouseDO>()
.eqIfPresent(WarehouseDO::getId, reqVO.getId())
.likeIfPresent(WarehouseDO::getWhNo, reqVO.getWhNo())
.likeIfPresent(WarehouseDO::getWhName, reqVO.getWhName())
.eqIfPresent(WarehouseDO::getContact, reqVO.getContact())
.eqIfPresent(WarehouseDO::getTelephone, reqVO.getTelephone())
.eqIfPresent(WarehouseDO::getWhStatus, reqVO.getWhStatus())
.eqIfPresent(WarehouseDO::getCreator, reqVO.getCreator())
.betweenIfPresent(WarehouseDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(WarehouseDO::getUpdater, reqVO.getUpdater())
.betweenIfPresent(WarehouseDO::getUpdateTime, reqVO.getUpdateTime())
.orderByDesc(WarehouseDO::getId));
}
}

@ -0,0 +1,55 @@
package com.chanko.yunxi.mes.module.heli.service.warehouse;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.warehouse.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.warehouse.WarehouseDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface WarehouseService {
/**
*
*
* @param createReqVO
* @return
*/
Long createWarehouse(@Valid WarehouseSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateWarehouse(@Valid WarehouseSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteWarehouse(Long id);
/**
*
*
* @param id
* @return
*/
WarehouseDO getWarehouse(Long id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<WarehouseDO> getWarehousePage(WarehousePageReqVO pageReqVO);
}

@ -0,0 +1,81 @@
package com.chanko.yunxi.mes.module.heli.service.warehouse;
import cn.hutool.core.lang.UUID;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.warehouse.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.warehouse.WarehouseDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.warehouse.WarehouseMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.SUPPLIER;
import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.WAREHOUSE;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class WarehouseServiceImpl implements WarehouseService {
@Resource
private WarehouseMapper warehouseMapper;
@Override
public Long createWarehouse(WarehouseSaveReqVO createReqVO) {
// 插入
WarehouseDO warehouse = BeanUtils.toBean(createReqVO, WarehouseDO.class);
warehouse.setWhNo(UUID.fastUUID().toString(true));
warehouseMapper.insert(warehouse);
warehouse.setWhNo(WAREHOUSE.getCode(warehouse.getId().toString()));
warehouseMapper.updateById(warehouse);
// 返回
return warehouse.getId();
}
@Override
public void updateWarehouse(WarehouseSaveReqVO updateReqVO) {
// 校验存在
validateWarehouseExists(updateReqVO.getId());
// 更新
WarehouseDO updateObj = BeanUtils.toBean(updateReqVO, WarehouseDO.class);
warehouseMapper.updateById(updateObj);
}
@Override
public void deleteWarehouse(Long id) {
// 校验存在
validateWarehouseExists(id);
// 删除
warehouseMapper.deleteById(id);
}
private void validateWarehouseExists(Long id) {
if (warehouseMapper.selectById(id) == null) {
throw exception(WAREHOUSE_NOT_EXISTS);
}
}
@Override
public WarehouseDO getWarehouse(Long id) {
return warehouseMapper.selectById(id);
}
@Override
public PageResult<WarehouseDO> getWarehousePage(WarehousePageReqVO pageReqVO) {
return warehouseMapper.selectPage(pageReqVO);
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chanko.yunxi.mes.module.heli.dal.mysql.warehouse.WarehouseMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -0,0 +1,40 @@
import request from '@/config/axios'
export interface WarehouseVO {
id: number
whNo: string
whName: string
contact: string
telephone: string
whStatus: number
}
// 查询仓库分页
export const getWarehousePage = async (params) => {
return await request.get({ url: `/heli/warehouse/page`, params })
}
// 查询仓库详情
export const getWarehouse = async (id: number) => {
return await request.get({ url: `/heli/warehouse/get?id=` + id })
}
// 新增仓库
export const createWarehouse = async (data: WarehouseVO) => {
return await request.post({ url: `/heli/warehouse/create`, data })
}
// 修改仓库
export const updateWarehouse = async (data: WarehouseVO) => {
return await request.put({ url: `/heli/warehouse/update`, data })
}
// 删除仓库
export const deleteWarehouse = async (id: number) => {
return await request.delete({ url: `/heli/warehouse/delete?id=` + id })
}
// 导出仓库 Excel
export const exportWarehouse = async (params) => {
return await request.download({ url: `/heli/warehouse/export-excel`, params })
}

@ -19,7 +19,7 @@ const title = computed(() => appStore.getTitle)
:class="prefixCls" :class="prefixCls"
class="h-[var(--app-footer-height)] bg-[var(--app-content-bg-color)] text-center leading-[var(--app-footer-height)] text-[var(--el-text-color-placeholder)] dark:bg-[var(--el-bg-color)]" class="h-[var(--app-footer-height)] bg-[var(--app-content-bg-color)] text-center leading-[var(--app-footer-height)] text-[var(--el-text-color-placeholder)] dark:bg-[var(--el-bg-color)]"
> >
<span class="text-14px">Copyright ©2022 上海长江云息数字科技有限公司,All Rights Reserved. <span class="text-14px">Copyright ©上海长江云息数字科技有限公司,All Rights Reserved.
<br/>专注工业信息化-供应链解决方案 <br/>专注工业信息化-供应链解决方案
</span> </span>

@ -11,11 +11,14 @@
* { * {
font-size: 18px !important; font-size: 18px !important;
box-sizing: border-box; box-sizing: border-box;
.el-form-item__error{
font-size: 14px !important;
}
} }
.hl-card { .hl-card {
margin: 0px; margin: 0px;
margin-top: var(--hl-margin); // margin-top: var(--hl-margin);
border-radius: 10px !important; border-radius: 10px !important;
.el-card__header { .el-card__header {
@ -100,3 +103,5 @@
} }
} }

@ -10,7 +10,7 @@
:model="queryParams" :model="queryParams"
ref="queryFormRef" ref="queryFormRef"
:inline="true" :inline="true"
label-width="68px" label-width="108px"
> >
<el-form-item label="部门名称" label-width="108px" prop="title"> <el-form-item label="部门名称" label-width="108px" prop="title">
<el-input <el-input

@ -38,7 +38,7 @@
</Dialog> </Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getIntDictOptions,getBoolDictOptions, DICT_TYPE } from '@/utils/dict' import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as ProcedureApi from '@/api/heli/procedure' import * as ProcedureApi from '@/api/heli/procedure'
import * as WorkshopApi from '@/api/heli/workshop' import * as WorkshopApi from '@/api/heli/workshop'

@ -1,54 +1,27 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="工序编号" prop="code"> <el-form-item label="工序编号" prop="code">
<el-input <el-input v-model="queryParams.code" placeholder="工序编号" clearable @keyup.enter="handleQuery" class="!w-240px" />
v-model="queryParams.code"
placeholder="工序编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item> </el-form-item>
<el-form-item label="工序名称" prop="name"> <el-form-item label="工序名称" prop="name">
<el-input <el-input v-model="queryParams.name" placeholder="工序名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
v-model="queryParams.name"
placeholder="工序名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item> </el-form-item>
<el-form-item label="启用状态" prop="status"> <el-form-item label="启用状态" prop="status">
<el-select <el-select v-model="queryParams.status" placeholder="启用状态" clearable class="!w-240px">
v-model="queryParams.status" <el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_COMMON_STATUS)" :key="dict.value" :label="dict.label"
placeholder="请选择启用状态" :value="dict.value" />
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_COMMON_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery">
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <Icon icon="ep:search" class="mr-5px" /> 搜索
<el-button </el-button>
type="primary" <el-button @click="resetQuery">
plain <Icon icon="ep:refresh" class="mr-5px" /> 重置
@click="openForm('create')" </el-button>
> <el-button type="primary" plain @click="openForm('create')">
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
<!-- <el-button <!-- <el-button
@ -69,7 +42,7 @@
<!-- <el-table-column label="自增字段,唯一" align="center" prop="id" /> --> <!-- <el-table-column label="自增字段,唯一" align="center" prop="id" /> -->
<el-table-column label="工序编号" align="center" prop="code" /> <el-table-column label="工序编号" align="center" prop="code" />
<el-table-column label="工序名称" align="center" prop="name" /> <el-table-column label="工序名称" align="center" prop="name" />
<el-table-column label="所属车间" align="center" prop="wid" /> <el-table-column label="所属车间" align="center" prop="wname" />
<el-table-column label="是否需要报工" align="center" prop="isReport"> <el-table-column label="是否需要报工" align="center" prop="isReport">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_COMMON_IS_OR_NOT" :value="scope.row.isReport" /> <dict-tag :type="DICT_TYPE.HELI_COMMON_IS_OR_NOT" :value="scope.row.isReport" />
@ -83,30 +56,18 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button <el-button link type="primary" @click="openForm('update', scope.row.id)">
link
type="primary"
@click="openForm('update', scope.row.id)"
>
编辑 编辑
</el-button> </el-button>
<el-button <el-button link type="danger" @click="handleDelete(scope.row.id)">
link
type="danger"
@click="handleDelete(scope.row.id)"
>
删除 删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<Pagination <Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
:total="total" @pagination="getList" />
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
@ -119,6 +80,7 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import * as ProcedureApi from '@/api/heli/procedure' import * as ProcedureApi from '@/api/heli/procedure'
import ProcedureForm from './ProcedureForm.vue' import ProcedureForm from './ProcedureForm.vue'
import * as WorkshopApi from '@/api/heli/workshop'
defineOptions({ name: 'Procedure' }) defineOptions({ name: 'Procedure' })
@ -153,6 +115,21 @@ const getList = async () => {
try { try {
const data = await ProcedureApi.getProcedurePage(queryParams) const data = await ProcedureApi.getProcedurePage(queryParams)
const queryParamsWorkShop = reactive({
pageNo: 1,
pageSize: 100,
})
const workShopList = await WorkshopApi.getWorkshopPage(queryParamsWorkShop)
data.list.forEach((item: any) => {
workShopList.list.forEach((record: any) => {
if (item.wid === record.id) {
item.wname = record.name
}
})
})
list.value = data.list list.value = data.list
total.value = data.total total.value = data.total
} finally { } finally {
@ -188,7 +165,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
} catch {} } catch { }
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -208,6 +185,8 @@ const handleExport = async () => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
await getList() await getList()
}) })
</script> </script>

@ -0,0 +1,119 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="仓库编号" prop="whNo">
<el-input v-model="formData.whNo" disabled />
</el-form-item>
<el-form-item label="仓库名称" prop="whName">
<el-input v-model="formData.whName" placeholder="请输入仓库名称" />
</el-form-item>
<el-form-item label="联系人" prop="contact">
<el-input v-model="formData.contact" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="联系电话" prop="telephone">
<el-input v-model="formData.telephone" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="状态" prop="whStatus">
<el-radio-group v-model="formData.whStatus">
<el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_COMMON_STATUS)"
:key="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as WarehouseApi from '@/api/heli/warehouse'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
whNo: undefined,
whName: undefined,
contact: undefined,
telephone: undefined,
whStatus: 1,
})
const formRules = reactive({
whName: [{ required: true, message: '仓库名称,唯一不能为空', trigger: 'blur' }],
// whStatus: [{ required: true, message: ',1 2 ', trigger: 'blur' }],
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await WarehouseApi.getWarehouse(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as WarehouseApi.WarehouseVO
if (formType.value === 'create') {
await WarehouseApi.createWarehouse(data)
message.success(t('common.createSuccess'))
} else {
await WarehouseApi.updateWarehouse(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
whNo: undefined,
whName: undefined,
contact: undefined,
telephone: undefined,
whStatus: 1,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,156 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
<el-form-item label="仓库编号" prop="whNo">
<el-input v-model="queryParams.whNo" placeholder="仓库编号" clearable @keyup.enter="handleQuery" class="!w-240px" />
</el-form-item>
<el-form-item label="仓库名称" prop="whName">
<el-input v-model="queryParams.whName" placeholder="仓库名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
</el-form-item>
<el-form-item label="启用状态" prop="whStatus">
<el-select v-model="queryParams.whStatus" placeholder="启用状态" clearable class="!w-240px">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_COMMON_STATUS)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button>
<el-button @click="resetQuery">
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
<el-button type="primary" plain @click="openForm('create')" v-hasPermi="['heli:warehouse:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<!-- <el-button type="success" plain @click="handleExport" :loading="exportLoading"
v-hasPermi="['heli:warehouse:export']">
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> -->
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="仓库编号" align="center" prop="whNo" />
<el-table-column label="仓库名称" align="center" prop="whName" />
<el-table-column label="负责人" align="center" prop="contact" />
<el-table-column label="负责人电话" align="center" prop="telephone" />
<el-table-column label="状态" align="center" prop="whStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_COMMON_STATUS" :value="scope.row.whStatus" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button link type="primary" @click="openForm('update', scope.row.id)" v-hasPermi="['heli:warehouse:update']">
编辑
</el-button>
<!-- <el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['heli:warehouse:delete']">
删除
</el-button> -->
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
@pagination="getList" />
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<WarehouseForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as WarehouseApi from '@/api/heli/warehouse'
import WarehouseForm from './WarehouseForm.vue'
defineOptions({ name: 'Warehouse' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
whNo: undefined,
whName: undefined,
whStatus: 1,
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await WarehouseApi.getWarehousePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await WarehouseApi.deleteWarehouse(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await WarehouseApi.exportWarehouse(queryParams)
download.excel(data, '仓库.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(async () => {
await getList()
})
</script>
Loading…
Cancel
Save