add:添加调拨其他出库下推功能 fix:修复sys菜单组件名称问题

This commit is contained in:
zhangzq
2026-07-14 20:42:54 +08:00
parent 7be392563a
commit daa7151a83
14 changed files with 394 additions and 102 deletions

View File

@@ -38,6 +38,7 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(Throwable.class)
public ResponseEntity handleException(Throwable e) {
e.printStackTrace();
return ResponseData.error(e.getMessage());
}
@@ -57,6 +58,7 @@ public class GlobalExceptionHandler {
*/
@ExceptionHandler(value = BadRequestException.class)
public ResponseEntity badRequestException(BadRequestException e) {
e.printStackTrace();
return ResponseData.error(e.getMessage());
}
}

View File

@@ -81,4 +81,10 @@ public class PurchaseController {
public ResponseEntity pushZD(@RequestBody BillChangeDto billChangeDto){
return wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
}
@PostMapping("/outPush")
@Log("下推出库单")
public ResponseEntity outPush(@RequestBody PurchaseDto purchaseDto){
purchaseService.pushPurchase(purchaseDto);
return ResponseData.build();
}
}

View File

@@ -35,4 +35,5 @@ public interface PurchaseService extends IService<Purchasemst> {
void print(Set<String> ids);
List<PurchaseMatInfoVo> selectPdaInMat(HashMap of);
void pushPurchase(PurchaseDto purchaseDto);
}

View File

@@ -1,5 +1,7 @@
package org.nl.wms.pm_manage.purchase.service.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
@@ -24,9 +26,11 @@ public class PurchaseDto implements Serializable {
private String supplier_name;
private String creator;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date create_time;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date modify_date;
private Integer status;

View File

@@ -1,11 +1,13 @@
package org.nl.wms.pm_manage.purchase.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -13,9 +15,13 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
import org.nl.wms.ext_manage.enums.EXTConstant;
import org.nl.wms.ext_manage.purchase.service.dto.EasAuditRequestDto;
import org.nl.wms.ext_manage.service.WmsToErpService;
import org.nl.wms.pda_manage.ios_manage.purchase.service.vo.PurchaseMatInfoVo;
import org.nl.wms.pm_manage.SourceBillTypeEnum;
import org.nl.wms.pm_manage.purchase.service.PurchaseService;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
@@ -25,15 +31,20 @@ import org.nl.wms.pm_manage.purchase.service.dto.PurchaseDto;
import org.nl.wms.pm_manage.purchase.service.vo.PurchasemstListVo;
import org.nl.common.utils.ZplUtil;
import org.nl.wms.system_manage.service.param.ISysParamService;
import org.nl.wms.system_manage.service.param.dao.Param;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@Service
@@ -52,7 +63,10 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchasemstMapper, Purchase
private WmsToErpService wmsToErpService;
@Autowired
private ISysParamService sysParamService;
private IOutBillService iOutBillService;
@Autowired
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
@Override
public IPage<PurchasemstListVo> queryAll(Map whereJson, PageQuery page) {
@@ -227,4 +241,79 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchasemstMapper, Purchase
public List<PurchaseMatInfoVo> selectPdaInMat(HashMap of) {
return purchasemstMapper.selectPdaInMat(of);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void pushPurchase(PurchaseDto purchaseDto) {
if (purchaseDto == null) {
throw new BadRequestException("下推失败,下推出库单不能为空");
}
if (IOSEnum.BILL_STATUS.code("完成").equals(purchaseDto.getBill_status())) {
throw new BadRequestException("下推失败,单据状态已经完成");
}
final List<Purchasedtl> purchasedtls = this.selectListByBillId(purchaseDto.getBill_id());
if (CollectionUtils.isEmpty(purchasedtls)){
throw new BadRequestException("下推失败,单据明细数据不存在");
}
Map<String, List<Purchasedtl>> detailsByHouse = purchasedtls.stream()
.peek(detail -> {
if (ObjectUtil.isEmpty(detail.getHouse_code())) {
throw new BadRequestException("下推失败,物料" + detail.getSku_code() + "的仓库编码不能为空");
}
})
.collect(Collectors.groupingBy(Purchasedtl::getHouse_code));
for (Map.Entry<String, List<Purchasedtl>> entry : detailsByHouse.entrySet()) {
iOutBillService.saveBill(convertPurchaseToOutBillParam(purchaseDto, entry.getKey(), entry.getValue()));
}
this.update(new LambdaUpdateWrapper<Purchasemst>()
.set(Purchasemst::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
.eq(Purchasemst::getId,purchaseDto.getId()));
}
private JSONObject convertPurchaseToOutBillParam(PurchaseDto purchase, String houseCode,
List<Purchasedtl> details) {
List<String> materialCodes = details.stream()
.map(Purchasedtl::getSku_code)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
List<MdMeMaterialbase> materials = iMdMeMaterialbaseService.list(
new LambdaQueryWrapper<MdMeMaterialbase>()
.in(MdMeMaterialbase::getMaterial_code, materialCodes)
.select(MdMeMaterialbase::getMaterial_id, MdMeMaterialbase::getMaterial_code,
MdMeMaterialbase::getQty_unit_id));
Map<String, MdMeMaterialbase> materialsByCode = materials.stream()
.collect(Collectors.toMap(MdMeMaterialbase::getMaterial_code, Function.identity()));
List<JSONObject> tableData = new ArrayList<>();
for (Purchasedtl detail : details) {
MdMeMaterialbase material = materialsByCode.get(detail.getSku_code());
if (material == null) {
throw new BadRequestException("下推失败,物料" + detail.getSku_code() + "在WMS中不存在");
}
JSONObject row = new JSONObject();
row.put("material_id", material.getMaterial_id());
row.put("material_code", detail.getSku_code());
row.put("qty_unit_id", material.getQty_unit_id());
row.put("qty_unit_name", detail.getUnit());
row.put("qty", detail.getQty());
row.put("pcsn", detail.getBatch_no());
row.put("source_bill_code", purchase.getBill_id());
row.put("source_bill_type", SourceBillTypeEnum.PM_PURCHASE.getBillType());
row.put("source_billdtl_id", detail.getItem_no());
row.put("callback_strategy", "DealPurchaseRecBillCallback");
row.put("remark", "关联采购单:" + purchase.getOrder_no());
tableData.add(row);
}
JSONObject billParam = new JSONObject();
billParam.put("stor_code", houseCode);
billParam.put("biz_date", DateUtil.today());
billParam.put("bill_type", IOSEnum.BILL_TYPE.code("生产出库"));
billParam.put("remark", "采购单下推生成,采购单号:" + purchase.getOrder_no());
billParam.put("tableData", tableData);
return billParam;
}
}

View File

@@ -57,8 +57,7 @@
FROM
sys_menu
WHERE
type != '2'
and system_type = #{systemType}
system_type = #{systemType}
and
menu_id IN (
SELECT

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -49,6 +50,11 @@ import java.util.stream.Collectors;
@Slf4j
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
private static final String MENU_TYPE_SYSTEM = "1";
private static final String MENU_TYPE_DIRECTORY = "2";
private static final String MENU_TYPE_MENU = "3";
private static final String MENU_TYPE_BUTTON = "4";
@Autowired
private SysMenuMapper baseMapper;
@@ -129,7 +135,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
resources.setPid(null);
addSystemTypeDict(resources);
}
if (MENU_TYPE_DIRECTORY.equals(resources.getType())){
resources.setComponent("ParentView");
}
baseMapper.insert(resources);
// 计算子节点数目
resources.setSub_count(0);
@@ -240,8 +248,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
updateSubCnt(oldPid);
updateSubCnt(newPid);
//更新SystemType
if (!resources.getSystem_type().equals(menu.getSystem_type())){
this.update(new UpdateWrapper<SysMenu>().set(DictConstantPool.DICT_SYS_CODE,resources.getSystem_type()).in("menu_id",allChildIds));
if (!resources.getSystem_type().equals(menu.getSystem_type()) && !CollectionUtils.isEmpty(allChildIds)){
this.update(new LambdaUpdateWrapper<SysMenu>()
.set(SysMenu::getSystem_type,resources.getSystem_type())
.in(SysMenu::getMenu_id,allChildIds));
}
}
@@ -394,6 +404,27 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
return menuDto;
}
private boolean isDirectoryType(MenuDto menuDTO) {
return MENU_TYPE_DIRECTORY.equals(menuDTO.getType());
}
private boolean isRootMenu(MenuDto menuDTO, String rootPid) {
return rootPid.equals(menuDTO.getPid());
}
private String resolveRouteComponent(MenuDto menuDTO, String rootPid) {
if (menuDTO.getIframe()) {
return null;
}
if (isRootMenu(menuDTO, rootPid)) {
return StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent();
}
if (isDirectoryType(menuDTO)) {
return StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent();
}
return StrUtil.isEmpty(menuDTO.getComponent()) ? null : menuDTO.getComponent();
}
@Override
public List<MenuVo> buildMenus(String systemType) {
Dict dict = sysDictMapper.selectOne(new QueryWrapper<Dict>().eq("code", DictConstantPool.DICT_SYS_CODE).eq("value", systemType));
@@ -412,54 +443,44 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
public List<MenuVo> buildMenus(List<MenuDto> menuDtos, String pid) {
List<MenuVo> list = new LinkedList<>();
String lang = LocaleContextHolder.getLocale().getLanguage();
//剔除系统级菜单
menuDtos.forEach(menuDTO -> {
if (menuDTO != null) {
List<MenuDto> menuDtoList = menuDTO.getChildren();
MenuVo menuVo = new MenuVo();
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
// 一级目录需要加斜杠,不然会报警告
menuVo.setPath(pid.equals(menuDTO.getPid())? "/" + menuDTO.getPath() : menuDTO.getPath());
menuVo.setHidden(menuDTO.getHidden());
// 如果不是外链
if (!menuDTO.getIframe()) {
if (pid.equals(menuDTO.getPid())) {
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
} else if (!pid.equals(menuDTO.getPid()) && "0".equals(menuDTO.getType())) {
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
if (menuDTO != null) {
List<MenuDto> menuDtoList = menuDTO.getChildren();
MenuVo menuVo = new MenuVo();
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
menuVo.setPath(isRootMenu(menuDTO, pid) ? "/" + menuDTO.getPath() : menuDTO.getPath());
menuVo.setHidden(menuDTO.getHidden());
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
menuVo.setComponent(menuDTO.getComponent());
}
}
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
if (menuDtoList != null && menuDtoList.size() != 0) {
menuVo.setAlwaysShow(true);
menuVo.setRedirect("noredirect");
menuVo.setChildren(buildMenus(menuDtoList,pid));
// 处理是一级菜单并且没有子菜单的情况
} else if (StrUtil.isEmpty(menuDTO.getPid())) {
MenuVo menuVo1 = new MenuVo();
menuVo1.setMeta(menuVo.getMeta());
// 非外链
if (!menuDTO.getIframe()) {
menuVo1.setPath("index");
menuVo1.setName(menuVo.getName());
menuVo1.setComponent(menuVo.getComponent());
} else {
menuVo1.setPath(menuDTO.getPath());
}
menuVo.setName(null);
menuVo.setMeta(null);
menuVo.setComponent("Layout");
List<MenuVo> list1 = new ArrayList<>();
list1.add(menuVo1);
menuVo.setChildren(list1);
}
list.add(menuVo);
}
String routeComponent = resolveRouteComponent(menuDTO, pid);
if (StrUtil.isNotEmpty(routeComponent)) {
menuVo.setComponent(routeComponent);
}
);
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
if (menuDtoList != null && menuDtoList.size() != 0) {
menuVo.setAlwaysShow(true);
menuVo.setRedirect("noredirect");
menuVo.setChildren(buildMenus(menuDtoList, pid));
} else if (StrUtil.isEmpty(menuDTO.getPid())) {
MenuVo menuVo1 = new MenuVo();
menuVo1.setMeta(menuVo.getMeta());
if (!menuDTO.getIframe()) {
menuVo1.setPath("index");
menuVo1.setName(menuVo.getName());
menuVo1.setComponent(menuVo.getComponent());
} else {
menuVo1.setPath(menuDTO.getPath());
}
menuVo.setName(null);
menuVo.setMeta(null);
menuVo.setComponent("Layout");
List<MenuVo> list1 = new ArrayList<>();
list1.add(menuVo1);
menuVo.setChildren(list1);
}
list.add(menuVo);
}
});
return list;
}

View File

@@ -2,6 +2,8 @@ import { constantRouterMap } from '@/router/routers'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView'
const MENU_TYPE_DIRECTORY = '2'
const permission = {
state: {
routers: constantRouterMap,
@@ -42,6 +44,7 @@ export const filterAsyncRouter = (routers, lastRouter = false, type = false) =>
if (type && router.children) {
router.children = filterChildren(router.children)
}
const hasChildren = router.children != null && router.children && router.children.length
if (router.component) {
if (router.component === 'Layout') { // Layout组件特殊处理
router.component = Layout
@@ -51,8 +54,10 @@ export const filterAsyncRouter = (routers, lastRouter = false, type = false) =>
const component = router.component
router.component = loadView(component)
}
} else if (hasChildren && router.type === MENU_TYPE_DIRECTORY) {
router.component = ParentView
}
if (router.children != null && router.children && router.children.length) {
if (hasChildren) {
router.children = filterAsyncRouter(router.children, router, type)
} else {
delete router['children']

View File

@@ -80,13 +80,13 @@
placeholder="菜单标题"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() === '2'" label="按钮名称" prop="title">
<el-form-item v-if="form.type.toString() === '4'" label="按钮名称" prop="title">
<el-input v-model="form.title" placeholder="按钮名称" style="width: 190px;" />
</el-form-item>
<el-form-item v-show="form.type.toString() !== '1' " label="权限标识" prop="permission">
<el-input v-model="form.permission" :disabled="form.iframe=='1'" placeholder="权限标识" style="width: 190px;" />
</el-form-item>
<el-form-item v-if="form.type.toString() !== '1' && form.type.toString() !== '2'" label="路由地址" prop="path">
<el-form-item v-if="form.type.toString() !== '1'" label="路由地址" prop="path">
<el-input v-model="form.path" placeholder="路由地址" style="width: 190px;" />
</el-form-item>
<el-form-item label="菜单排序" prop="menu_sort">
@@ -101,7 +101,7 @@
<el-form-item v-show="!form.iframe && form.type.toString() === '3' " label="组件名称" prop="componentName">
<el-input v-model="form.componentName" style="width: 190px;" placeholder="匹配组件内Name字段" />
</el-form-item>
<el-form-item v-show="!form.iframe && (form.type.toString() === '2' ||form.type.toString() === '3' ) " label="组件路径" prop="component">
<el-form-item v-show="!form.iframe && form.type.toString() === '3' " label="组件路径" prop="component">
<el-input v-model="form.component" style="width: 190px;" placeholder="组件路径" />
</el-form-item>
<el-form-item label="上级类目" prop="pid">

View File

@@ -38,16 +38,16 @@
:title="crud.status.title"
:width="computedLabelWidth"
>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" :label-width="computedFormLabelWidth">
<el-form ref="form" :inline="true" :model="form" :rules="formRules" size="mini" :label-width="computedFormLabelWidth">
<el-form-item :label="$t('menu.dialog.menu_type')" prop="type">
<el-radio-group v-model="form.type" size="mini">
<el-radio-button label="1">{{ $t('menu.dialog.system') }}</el-radio-button>
<el-radio-button label="2">{{ $t('menu.dialog.catalogue') }}</el-radio-button>
<el-radio-button label="3">{{ $t('menu.dialog.menu') }}</el-radio-button>
<el-radio-button label="4">{{ $t('menu.dialog.button') }}</el-radio-button>
<!-- <el-radio-button label="4">{{ $t('menu.dialog.button') }}</el-radio-button>-->
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '1' && form.type.toString() !== '4' " :label="$t('menu.dialog.menu_icon')" prop="icon">
<el-form-item v-show="!isSystemType && !isButtonType" :label="$t('menu.dialog.menu_icon')" prop="icon">
<el-popover
placement="bottom-start"
width="450"
@@ -67,59 +67,59 @@
</el-input>
</el-popover>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2' && form.type.toString() !== '1'" :label="$t('menu.dialog.menu_chain')" prop="iframe">
<el-form-item v-show="!isDirectoryType && !isSystemType" :label="$t('menu.dialog.menu_chain')" prop="iframe">
<el-radio-group v-model="form.iframe" size="mini">
<el-radio-button label="true">{{ $t('common.Yes') }}</el-radio-button>
<el-radio-button label="false">{{ $t('common.No') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() === '2'" :label="$t('menu.dialog.menu_cache')" prop="cache">
<el-form-item v-show="isDirectoryType" :label="$t('menu.dialog.menu_cache')" prop="cache">
<el-radio-group v-model="form.cache" size="mini">
<el-radio-button label="true">{{ $t('common.Yes') }}</el-radio-button>
<el-radio-button label="false">{{ $t('common.No') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2' && form.type.toString() !== '1' " :label="$t('menu.dialog.menu_visible')" prop="hidden">
<el-form-item v-show="!isDirectoryType && !isSystemType" :label="$t('menu.dialog.menu_visible')" prop="hidden">
<el-radio-group v-model="form.hidden" size="mini">
<el-radio-button label="false">{{ $t('common.Yes') }}</el-radio-button>
<el-radio-button label="true">{{ $t('common.No') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" :label="$t('menu.dialog.default_title')" prop="title">
<el-form-item v-if="showTitleFields" :label="$t('menu.dialog.default_title')" prop="title">
<el-input
v-model="form.title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
:style=" isSystemType ? 'width: 450px' : 'width: 190px'"
:placeholder="$t('menu.dialog.default_title')"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" :label="$t('menu.dialog.zh_title')" prop="zh_title">
<el-form-item v-if="showTitleFields" :label="$t('menu.dialog.zh_title')" prop="zh_title">
<el-input
v-model="form.zh_title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
:style=" isSystemType ? 'width: 450px' : 'width: 190px'"
:placeholder="$t('menu.dialog.zh_title')"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" :label="$t('menu.dialog.en_title')" prop="en_title">
<el-form-item v-if="showTitleFields" :label="$t('menu.dialog.en_title')" prop="en_title">
<el-input
v-model="form.en_title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
:style=" isSystemType ? 'width: 450px' : 'width: 190px'"
:placeholder="$t('menu.dialog.en_title')"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" :label="$t('menu.dialog.id_title')" prop="in_title">
<el-form-item v-if="showTitleFields" :label="$t('menu.dialog.id_title')" prop="in_title">
<el-input
v-model="form.in_title"
:style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 190px'"
:style=" isSystemType ? 'width: 450px' : 'width: 190px'"
:placeholder="$t('menu.dialog.id_title')"
/>
</el-form-item>
<el-form-item v-if="form.type.toString() === '2'" :label="$t('menu.dialog.button_name')" prop="title">
<el-form-item v-if="isButtonType" :label="$t('menu.dialog.button_name')" prop="title">
<el-input v-model="form.title" :placeholder="$t('menu.dialog.button_name')" style="width: 190px;" />
</el-form-item>
<el-form-item v-show="form.type.toString() !== '1' " :label="$t('menu.table.permission_ident')" prop="permission">
<el-form-item v-show="showPermissionField" :label="$t('menu.table.permission_ident')" prop="permission">
<el-input v-model="form.permission" :disabled="form.iframe" :placeholder="$t('menu.table.permission_ident')" style="width: 190px;" />
</el-form-item>
<el-form-item v-if="form.type.toString() !== '1' && form.type.toString() !== '2'" :label="$t('menu.dialog.router_path')" prop="path">
<el-form-item v-if="showPathField" :label="$t('menu.dialog.router_path')" prop="path">
<el-input v-model="form.path" :placeholder="$t('menu.dialog.router_path')" style="width: 190px;" />
</el-form-item>
<el-form-item :label="$t('menu.dialog.menu_sort')" prop="menu_sort">
@@ -131,10 +131,10 @@
style="width: 190px;"
/>
</el-form-item>
<el-form-item v-show="!form.iframe && form.type.toString() === '3' " :label="$t('menu.dialog.component_name')" prop="component_name">
<el-form-item v-show="showComponentNameField" :label="$t('menu.dialog.component_name')" prop="component_name">
<el-input v-model="form.component_name" style="width: 190px;" :placeholder="$t('menu.placeholder.component_tip')" />
</el-form-item>
<el-form-item v-show="!form.iframe && (form.type.toString() === '2' ||form.type.toString() === '3' ) " :label="$t('menu.dialog.component_path')" prop="component">
<el-form-item v-show="showComponentField" :label="$t('menu.dialog.component_path')" prop="component">
<el-input v-model="form.component" style="width: 190px;" :placeholder="$t('menu.dialog.component_path')" />
</el-form-item>
<el-form-item :label="$t('menu.dialog.superior_class')" prop="pid">
@@ -170,7 +170,7 @@
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column :label="$t('menu.table.menu_title')" :prop="$langPre.computedProp('title')" :min-width="flexWidth($langPre.computedProp('title'),crud.data,$t('menu.table.menu_title'))" />
<el-table-column :label="$t('menu.table.menu_title')" :prop="$langPre.computedProp('title')" width="180" />
<el-table-column :label="$t('menu.table.system')" prop="system_type" :min-width="flexWidth('system_type',crud.data,$t('menu.table.system'))">
<template slot-scope="scope">
{{ dict.label.system_type[scope.row.system_type] }} : {{ scope.row.system_type }}
@@ -240,6 +240,13 @@ import DateRangePicker from '@/components/DateRangePicker'
import Dict from '../../../components/Dict/Dict'
import i18n from '@/i18n'
const MENU_TYPE = {
SYSTEM: '1',
DIRECTORY: '2',
MENU: '3',
BUTTON: '4'
}
// crud交由presenter持有
const defaultForm = {
menu_id: null,
@@ -280,26 +287,55 @@ export default {
edit: ['admin', 'menu:edit'],
del: ['admin', 'menu:del']
},
rules: {
title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
zh_title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
en_title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
in_title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
path: [
{ required: true, message: '请输入地址', trigger: 'blur' }
]
}
rules: {}
}
},
computed: {
isSystemType() {
return String(this.form.type) === MENU_TYPE.SYSTEM
},
isDirectoryType() {
return String(this.form.type) === MENU_TYPE.DIRECTORY
},
isMenuType() {
return String(this.form.type) === MENU_TYPE.MENU
},
isButtonType() {
return String(this.form.type) === MENU_TYPE.BUTTON
},
showTitleFields() {
return this.isSystemType || this.isDirectoryType || this.isMenuType
},
showPermissionField() {
return this.isMenuType || this.isButtonType
},
showPathField() {
return String(this.form.type) === MENU_TYPE.MENU || String(this.form.type) === MENU_TYPE.DIRECTORY
},
showComponentNameField() {
return !this.form.iframe && this.isMenuType
},
showComponentField() {
return !this.form.iframe && String(this.form.type) === MENU_TYPE.MENU
},
formRules() {
const titleRules = [{ required: true, message: '请输入标题', trigger: 'blur' }]
const pathRules = this.showPathField ? [{ required: true, message: '请输入地址', trigger: 'blur' }] : []
const componentRules = this.showComponentField ? [{ required: true, message: '请输入组件路径', trigger: 'blur' }] : []
const componentNameRules = this.showComponentNameField ? [{ required: true, message: '请输入组件名称', trigger: 'blur' }] : []
const permissionRules = this.isButtonType ? [{ required: true, message: '请输入权限标识', trigger: 'blur' }] : []
return {
title: titleRules,
zh_title: this.showTitleFields ? titleRules : [],
en_title: this.showTitleFields ? titleRules : [],
in_title: this.showTitleFields ? titleRules : [],
path: pathRules,
component: componentRules,
component_name: componentNameRules,
permission: permissionRules
}
},
computedLabelWidth() {
const item = localStorage.getItem('lang')
if (item === 'en') {
@@ -321,7 +357,61 @@ export default {
return `100px`
}
},
watch: {
'form.type'(value) {
this.applyTypeDefaults(value)
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
'form.iframe'(value) {
this.applyIframeDefaults(value)
this.$nextTick(() => {
if (this.$refs.form) {
this.$refs.form.clearValidate(['component', 'component_name'])
}
})
}
},
methods: {
applyTypeDefaults(type) {
const currentType = String(type)
if (currentType === MENU_TYPE.SYSTEM) {
this.form.icon = null
this.form.iframe = false
this.form.cache = false
this.form.hidden = false
this.form.permission = null
this.form.path = null
this.form.component = null
this.form.component_name = null
} else if (currentType === MENU_TYPE.DIRECTORY) {
this.form.iframe = false
this.form.cache = false
this.form.hidden = false
this.form.permission = null
this.form.path = null
this.form.component_name = null
} else if (currentType === MENU_TYPE.MENU) {
this.form.cache = false
} else if (currentType === MENU_TYPE.BUTTON) {
this.form.icon = null
this.form.iframe = false
this.form.cache = false
this.form.hidden = false
this.form.path = null
this.form.component = null
this.form.component_name = null
}
},
applyIframeDefaults(iframe) {
if (iframe) {
this.form.component = null
this.form.component_name = null
}
},
normalizer(node) {
return {
id: node.menu_id,
@@ -348,6 +438,10 @@ export default {
},
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
if (!form.menu_id) {
this.applyTypeDefaults(form.type)
this.applyIframeDefaults(form.iframe)
}
this.menus = []
if (form.menu_id) { // 修改
if (!form.pid) { // 一级菜单一级的父级菜单的pid为0.
@@ -386,6 +480,7 @@ export default {
},
getSupMenus(menu_id) {
crudMenu.getMenuSuperior(menu_id).then(res => {
res = res.data
const children = res.map(function(obj) {
if (!obj.leaf && !obj.children) {
obj.children = null
@@ -398,6 +493,7 @@ export default {
loadMenus({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudMenu.getMenusTree(parentNode.menu_id).then(res => {
res = res.data
parentNode.children = res.map(function(obj) {
if (!obj.leaf) {
obj.children = null

View File

@@ -26,8 +26,9 @@
<rrOperation />
</el-form>
</div>
<crudOperation :permission="permission">
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">下发回传</el-button>
<crudOperation>
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">下发回传</el-button>
<el-button slot="right" class="filter-item" type="success" icon="el-icon-s-promotion" size="mini" :disabled="!multipleSelection.length || multipleSelection.length>1" @click="handleBatchPush">下推出库</el-button>
</crudOperation>
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange" @select="handleSelectionChange">
<el-table-column type="selection" width="55" />
@@ -76,7 +77,7 @@
</template>
<script>
import crudPurchase from '@/views/wms/pm_manage/allocationOut/purchase'
import crudPurchase, {outPush} from '@/views/wms/pm_manage/allocationOut/purchase'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
@@ -84,6 +85,7 @@ import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
import {push} from "@/views/wms/pm_manage/demand/demand";
export default {
name: 'AllocationOut',
@@ -106,6 +108,7 @@ export default {
edit: ['admin', 'purchasemst:edit'],
del: ['admin', 'purchasemst:del']
},
multipleSelection: [],
viewShow: false,
mstrow: {},
currentRow: null,
@@ -129,6 +132,34 @@ export default {
const map = { '0': '未审核', '1': '已审核' }
return map[row.status] || row.status || '-'
},
handleBatchPush() {
if (!this.multipleSelection.length) {
this.$message.warning('请先勾选要下推的调拨出库单')
return
}
// eslint-disable-next-line eqeqeq
const invalidRows = this.multipleSelection.filter(item => String(item.bill_status) === '99')
if (invalidRows.length) {
this.$message.warning('仅支持批量下推状态为“分配”的需求单')
return
}
this.$confirm(`确认批量下推已勾选的 ${this.multipleSelection.length} 条需求单吗?`, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPurchase.outPush(this.multipleSelection[0]).then(res => {
if (res.code === 200) {
this.$message.success('下推成功')
this.crud.toQuery()
} else {
this.$message.error(res.message)
}
}).catch(() => {
this.$message.error('下推失败')
})
}).catch(() => {})
},
formatDate(val) {
if (!val) return ''
if (typeof val === 'string') return val
@@ -156,6 +187,7 @@ export default {
},
handleSelectionChange(val, row) {
console.log(val.length)
this.multipleSelection = val
if (val.length == 0) {
this.audit_flag = true
} else {

View File

@@ -54,5 +54,12 @@ export function pushZD(data) {
data
})
}
export function outPush(data) {
return request({
url: '/api/purchasemst/outPush',
method: 'post',
data
})
}
export default { add, edit, del, get, issueReturnBill, print, pushZD }
export default { add, edit, del, get, issueReturnBill, print, pushZD, outPush }

View File

@@ -20,10 +20,9 @@
<rrOperation :crud="crud" />
</el-form>
</div>
<div style="margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
<crudOperation :permission="permission" />
<el-button size="mini" type="success" :disabled="!multipleSelection.length" @click="handleBatchPush">下推</el-button>
</div>
<crudOperation :permission="permission" >
<el-button slot="right" class="filter-item" type="success" icon="el-icon-s-promotion" size="mini" :disabled="!multipleSelection.length" @click="handleBatchPush">下推出库</el-button>
</crudOperation>
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="900px">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px" label-suffix=":" style="border: 1px solid #cfe0df;margin-top: 10px;padding: 10px;">
<el-row>

View File

@@ -28,6 +28,7 @@
</div>
<crudOperation :permission="permission">
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">下发回传单</el-button>
<el-button slot="right" class="filter-item" type="success" icon="el-icon-s-promotion" size="mini" :disabled="!multipleSelection.length || multipleSelection.length>1" @click="handleBatchPush">下推出库</el-button>
</crudOperation>
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange" @select="handleSelectionChange">
<el-table-column type="selection" width="55" />
@@ -108,6 +109,7 @@ export default {
},
viewShow: false,
mstrow: {},
multipleSelection: [],
currentRow: null,
audit_flag: true,
billStatusOptions: [
@@ -173,6 +175,35 @@ export default {
querytable() {
this.crud.toQuery()
},
handleBatchPush() {
if (!this.multipleSelection.length) {
this.$message.warning('请先勾选要下推的调拨出库单')
return
}
// eslint-disable-next-line eqeqeq
const invalidRows = this.multipleSelection.filter(item => String(item.bill_status) === '99')
if (invalidRows.length) {
this.$message.warning('仅支持批量下推状态为“分配”的需求单')
return
}
this.$confirm(`确认批量下推已勾选的 ${this.multipleSelection.length} 条需求单吗?`, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPurchase.outPush(this.multipleSelection[0]).then(res => {
if (res.code === 200) {
this.$message.success('下推成功')
this.crud.toQuery()
} else {
this.$message.error(res.message)
}
}).catch(() => {
this.$message.error('下推失败')
})
}).catch(() => {})
},
issueReturnBill() {
const selections = this.crud.selections
if (!selections || selections.length === 0) {