add:基础分类,客户维护,设备维护
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbClassstandardService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础分类表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/Classstandard")
|
||||
@Slf4j
|
||||
public class ClassStandardController {
|
||||
|
||||
@Autowired
|
||||
private IMdPbClassstandardService iMdPbClassstandardService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询基础分类")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增基础分类")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdPbClassstandard dto) {
|
||||
iMdPbClassstandardService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改基础分类")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdPbClassstandard dto) {
|
||||
iMdPbClassstandardService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除基础分类")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iMdPbClassstandardService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/loadClass")
|
||||
@Log("查询基础类型")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.loadClass(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/superior")
|
||||
@Log("获取树形结构")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody String id) {
|
||||
MdPbClassstandard classDao = iMdPbClassstandardService.getById(id);
|
||||
List<MdPbClassstandard> superiorList = iMdPbClassstandardService.getSuperior(classDao, new ArrayList<>());
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.buildTree(superiorList), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getClassName")
|
||||
@Log("获取分类名称下拉框")
|
||||
public ResponseEntity<Object> getClassName() {
|
||||
return new ResponseEntity<>(iMdPbClassstandardService.getClassName(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.IMdCsCustomerbaseService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户信息表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/customerbase")
|
||||
@Slf4j
|
||||
public class CustomerController {
|
||||
|
||||
@Autowired
|
||||
private IMdCsCustomerbaseService iMdCsCustomerbaseService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询客户")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iMdCsCustomerbaseService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增客户")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdCsCustomerbase dto) {
|
||||
iMdCsCustomerbaseService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改客户")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdCsCustomerbase dto) {
|
||||
iMdCsCustomerbaseService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除客户")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iMdCsCustomerbaseService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.IEmBiDeviceinfoService;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备基础信息表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/deviceinfo")
|
||||
@Slf4j
|
||||
public class DeviceInfoController {
|
||||
|
||||
@Autowired
|
||||
private IEmBiDeviceinfoService iEmBiDeviceinfoService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iEmBiDeviceinfoService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody EmBiDeviceinfo dto) {
|
||||
iEmBiDeviceinfoService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody EmBiDeviceinfo dto) {
|
||||
iEmBiDeviceinfoService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除设备")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iEmBiDeviceinfoService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.basedata_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface IEmBiDeviceinfoService extends IService<EmBiDeviceinfo> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param pageable : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<EmBiDeviceinfo> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(EmBiDeviceinfo dto);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void update(EmBiDeviceinfo dto);
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
* @param ids 设备标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.basedata_manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface IMdCsCustomerbaseService extends IService<MdCsCustomerbase> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param pageable : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<MdCsCustomerbase> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 新增客户
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(MdCsCustomerbase dto);
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void update(MdCsCustomerbase dto);
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
* @param ids 客户标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.basedata_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface IMdPbClassstandardService extends IService<MdPbClassstandard> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 新增基础分类
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(MdPbClassstandard dto);
|
||||
|
||||
/**
|
||||
* 修改基础分类
|
||||
* @param dto 物料实体类
|
||||
*/
|
||||
void update(MdPbClassstandard dto);
|
||||
|
||||
/**
|
||||
* 删除基础分类
|
||||
* @param ids 分类标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 查询基础类型
|
||||
* @param whereJson : 参数
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject loadClass(Map whereJson);
|
||||
|
||||
/**
|
||||
* 获取树形结构
|
||||
* @param classDao 实体类
|
||||
* @return List<MdPbClassstandard>
|
||||
*/
|
||||
List<MdPbClassstandard> getSuperior(MdPbClassstandard classDao, List<MdPbClassstandard> daoList);
|
||||
|
||||
/**
|
||||
* 处理树形结构
|
||||
* @param superiorList 实体类集合
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject buildTree(List<MdPbClassstandard> superiorList);
|
||||
|
||||
/**
|
||||
* 获取分类名称下拉框
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getClassName();
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("em_bi_deviceinfo")
|
||||
public class EmBiDeviceinfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 设备标识
|
||||
*/
|
||||
@TableId(value = "device_id")
|
||||
private String device_id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String device_name;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String device_model;
|
||||
|
||||
/**
|
||||
* 设备规格
|
||||
*/
|
||||
private String device_specification;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
/**
|
||||
* 外部编码
|
||||
*/
|
||||
private String extend_code;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人名称
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 生产规划
|
||||
*/
|
||||
private String manufactureplanning;
|
||||
|
||||
/**
|
||||
* 生产区域
|
||||
*/
|
||||
private String manufacturearea;
|
||||
|
||||
/**
|
||||
* 外部设备编码
|
||||
*/
|
||||
private String extend_code_mes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_cs_customerbase")
|
||||
public class MdCsCustomerbase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 客户标识
|
||||
*/
|
||||
@TableId(value = "cust_id")
|
||||
private String cust_id;
|
||||
|
||||
/**
|
||||
* 客户编码
|
||||
*/
|
||||
private String cust_code;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String cust_name;
|
||||
|
||||
/**
|
||||
* 客户简称
|
||||
*/
|
||||
private String cust_simple_name;
|
||||
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String faxnumber;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String webSite;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
private String jurid_name;
|
||||
|
||||
/**
|
||||
* 税务登记号
|
||||
*/
|
||||
private String tax_no;
|
||||
|
||||
/**
|
||||
* 工商注册号
|
||||
*/
|
||||
private String register_no;
|
||||
|
||||
/**
|
||||
* 经营许可证号
|
||||
*/
|
||||
private String manage_lice_no;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String busi_char_name;
|
||||
|
||||
/**
|
||||
* 邮政编码
|
||||
*/
|
||||
private String zip_code;
|
||||
|
||||
/**
|
||||
* 公司电话
|
||||
*/
|
||||
private String corp_tele_no;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
private String corp_address;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 启用时间
|
||||
*/
|
||||
private String is_used_time;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_pb_classstandard")
|
||||
public class MdPbClassstandard implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 分类标识
|
||||
*/
|
||||
@TableId(value = "class_id")
|
||||
private String class_id;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
private String class_code;
|
||||
|
||||
/**
|
||||
* 分类长编码
|
||||
*/
|
||||
private String long_class_code;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String class_name;
|
||||
|
||||
/**
|
||||
* 分类简要描述
|
||||
*/
|
||||
private String class_desc;
|
||||
|
||||
/**
|
||||
* 上级分类标识
|
||||
*/
|
||||
private String parent_class_id;
|
||||
|
||||
/**
|
||||
* 子部门数目
|
||||
*/
|
||||
private String sub_count;
|
||||
|
||||
/**
|
||||
* 是否叶子
|
||||
*/
|
||||
private String is_leaf;
|
||||
|
||||
/**
|
||||
* 是否可修改
|
||||
*/
|
||||
private String is_modify;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
private String class_level;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 外部上级标识
|
||||
*/
|
||||
private String ext_parent_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.basedata_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface EmBiDeviceinfoMapper extends BaseMapper<EmBiDeviceinfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="org.nl.wms.basedata_manage.service.dao.mapper.EmBiDeviceinfoMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.basedata_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface MdCsCustomerbaseMapper extends BaseMapper<MdCsCustomerbase> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="org.nl.wms.basedata_manage.service.dao.mapper.MdCsCustomerbaseMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.basedata_manage.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
public interface MdPbClassstandardMapper extends BaseMapper<MdPbClassstandard> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="org.nl.wms.basedata_manage.service.dao.mapper.MdPbClassstandardMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,147 @@
|
||||
package org.nl.wms.basedata_manage.service.dto;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础分类DTO
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Data
|
||||
public class ClassstandardDto {
|
||||
|
||||
/**
|
||||
* 分类标识
|
||||
*/
|
||||
private String class_id;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
private String class_code;
|
||||
|
||||
/**
|
||||
* 分类长编码
|
||||
*/
|
||||
private String long_class_code;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String class_name;
|
||||
|
||||
/**
|
||||
* 分类简要描述
|
||||
*/
|
||||
private String class_desc;
|
||||
|
||||
/**
|
||||
* 上级分类标识
|
||||
*/
|
||||
private String parent_class_id;
|
||||
|
||||
/**
|
||||
* 子部门数目
|
||||
*/
|
||||
private String sub_count;
|
||||
|
||||
/**
|
||||
* 是否叶子
|
||||
*/
|
||||
private String is_leaf;
|
||||
|
||||
/**
|
||||
* 是否可修改
|
||||
*/
|
||||
private String is_modify;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
private String class_level;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 外部上级标识
|
||||
*/
|
||||
private String ext_parent_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 扩展属性1
|
||||
*/
|
||||
private Boolean hasChildren;
|
||||
|
||||
/**
|
||||
* 扩展属性2
|
||||
*/
|
||||
private Boolean leaf;
|
||||
|
||||
/**
|
||||
* 扩展属性3
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 扩展属性4
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 扩展属性5
|
||||
*/
|
||||
private String create_user_name;
|
||||
|
||||
/**
|
||||
* 扩展属性6
|
||||
*/
|
||||
private String update_user_name;
|
||||
|
||||
/**
|
||||
* 扩展属性7
|
||||
*/
|
||||
private JSONArray children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IEmBiDeviceinfoService;
|
||||
import org.nl.wms.basedata_manage.service.dao.EmBiDeviceinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.EmBiDeviceinfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产设备基础信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Service
|
||||
public class EmBiDeviceinfoServiceImpl extends ServiceImpl<EmBiDeviceinfoMapper, EmBiDeviceinfo> implements IEmBiDeviceinfoService {
|
||||
|
||||
@Override
|
||||
public IPage<EmBiDeviceinfo> queryAll(Map whereJson, PageQuery page) {
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<EmBiDeviceinfo> queryWrapper = new QueryWrapper<EmBiDeviceinfo>().lambda();
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(search)) {
|
||||
queryWrapper.likeRight(EmBiDeviceinfo::getDevice_code, search)
|
||||
.or(item -> item.likeRight(EmBiDeviceinfo::getDevice_name, search));
|
||||
}
|
||||
queryWrapper.eq(EmBiDeviceinfo::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
queryWrapper.orderByDesc(EmBiDeviceinfo::getUpdate_time);
|
||||
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
queryWrapper
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(EmBiDeviceinfo dto) {
|
||||
EmBiDeviceinfo emBiDeviceinfo = this.baseMapper.selectOne(
|
||||
new QueryWrapper<EmBiDeviceinfo>().lambda()
|
||||
.eq(EmBiDeviceinfo::getDevice_code, dto.getDevice_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(emBiDeviceinfo)) {
|
||||
throw new BadRequestException("当前设备编码已存在【"+dto.getDevice_code()+"】");
|
||||
}
|
||||
|
||||
// 新增
|
||||
dto.setDevice_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(EmBiDeviceinfo dto) {
|
||||
EmBiDeviceinfo emBiDeviceinfo = this.baseMapper.selectById(dto.getDevice_id());
|
||||
if (ObjectUtil.isEmpty(emBiDeviceinfo)) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
// 修改
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IMdCsCustomerbaseService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsCustomerbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdCsCustomerbaseMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户基本信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Service
|
||||
public class MdCsCustomerbaseServiceImpl extends ServiceImpl<MdCsCustomerbaseMapper, MdCsCustomerbase> implements IMdCsCustomerbaseService {
|
||||
|
||||
@Override
|
||||
public IPage<MdCsCustomerbase> queryAll(Map whereJson, PageQuery page) {
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<MdCsCustomerbase> queryWrapper = new QueryWrapper<MdCsCustomerbase>().lambda();
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(search)) {
|
||||
queryWrapper.likeRight(MdCsCustomerbase::getCust_code, search)
|
||||
.or(item -> item.likeRight(MdCsCustomerbase::getCust_name, search));
|
||||
}
|
||||
queryWrapper.eq(MdCsCustomerbase::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
queryWrapper.orderByDesc(MdCsCustomerbase::getUpdate_time);
|
||||
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
queryWrapper
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(MdCsCustomerbase dto) {
|
||||
MdCsCustomerbase mdCsCustomerbase = this.baseMapper.selectOne(
|
||||
new QueryWrapper<MdCsCustomerbase>().lambda()
|
||||
.eq(MdCsCustomerbase::getCust_code, dto.getCust_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(mdCsCustomerbase)) {
|
||||
throw new BadRequestException("当前客户编码已存在【"+dto.getCust_code()+"】");
|
||||
}
|
||||
|
||||
// 新增
|
||||
dto.setCust_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(MdCsCustomerbase dto) {
|
||||
MdCsCustomerbase mdCsCustomerbase = this.baseMapper.selectById(dto.getCust_id());
|
||||
if (ObjectUtil.isEmpty(mdCsCustomerbase)) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
// 修改
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class MdCsSupplierbaseServiceImpl extends ServiceImpl<MdCsSupplierbaseMap
|
||||
.eq(MdCsSupplierbase::getSupp_code, dto.getSupp_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(mdCsSupplierbase)) {
|
||||
throw new BadRequestException("当前计量单位编码已存在【"+dto.getSupp_code()+"】");
|
||||
throw new BadRequestException("当前供应商编码已存在【"+dto.getSupp_code()+"】");
|
||||
}
|
||||
|
||||
// 新增
|
||||
|
||||
@@ -0,0 +1,345 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.PageUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbClassstandardService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbClassstandard;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbClassstandardMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.ClassstandardDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础数据分类标准表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-14
|
||||
*/
|
||||
@Service
|
||||
public class MdPbClassstandardServiceImpl extends ServiceImpl<MdPbClassstandardMapper, MdPbClassstandard> implements IMdPbClassstandardService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object>queryAll(Map whereJson, Pageable page) {
|
||||
// 查询所有分类
|
||||
String class_code = MapUtil.getStr(whereJson, "class_code");
|
||||
LambdaQueryWrapper<MdPbClassstandard> lambda = new QueryWrapper<MdPbClassstandard>().lambda();
|
||||
lambda.eq(MdPbClassstandard::getParent_class_id, null)
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
lambda.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
if (ObjectUtil.isNotEmpty(class_code)) {
|
||||
lambda.eq(MdPbClassstandard::getClass_code, class_code);
|
||||
}
|
||||
lambda.orderByDesc(MdPbClassstandard::getUpdate_time);
|
||||
|
||||
// 处理后的数据
|
||||
List<ClassstandardDto> dtoList = new ArrayList<>();
|
||||
// 处理数据
|
||||
List<MdPbClassstandard> classList = this.list(lambda);
|
||||
for (MdPbClassstandard dao : classList) {
|
||||
ClassstandardDto dto = JSONObject.parseObject(JSONObject.toJSONString(dao), ClassstandardDto.class);
|
||||
|
||||
if (Integer.parseInt(dto.getSub_count()) > 0) {
|
||||
dto.setHasChildren(true);
|
||||
dto.setLeaf(false);
|
||||
} else {
|
||||
dto.setHasChildren(false);
|
||||
dto.setLeaf(true);
|
||||
}
|
||||
dto.setId(dto.getClass_id());
|
||||
dto.setLabel(dto.getClass_name());
|
||||
dtoList.add(dto);
|
||||
}
|
||||
|
||||
// 组织分页查询并返回
|
||||
Map<String, Object> json = PageUtil.toPage(
|
||||
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), dtoList),
|
||||
dtoList.size()
|
||||
);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(MdPbClassstandard dto) {
|
||||
MdPbClassstandard mdPbClassstandard = this.baseMapper.selectOne(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getClass_code, dto.getClass_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(mdPbClassstandard)) {
|
||||
throw new BadRequestException("当前分类编码已存在【"+dto.getClass_code()+"】");
|
||||
}
|
||||
// 新增
|
||||
dto.setClass_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setIs_leaf(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dto.setClass_level(Math.ceil(dto.getClass_code().length() / 2.0) + "");
|
||||
dto.setSub_count(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
dto.setLong_class_code(dto.getClass_code());
|
||||
this.save(dto);
|
||||
|
||||
// 更新节点
|
||||
if (ObjectUtil.isNotEmpty(dto.getParent_class_id())) {
|
||||
updateSubCnt(dto.getParent_class_id());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(MdPbClassstandard dto) {
|
||||
MdPbClassstandard mdPbClassstandard = this.baseMapper.selectById(dto.getClass_id());
|
||||
if (ObjectUtil.isEmpty(mdPbClassstandard)) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
if ( ObjectUtil.isNotEmpty(dto.getParent_class_id()) && dto.getClass_id().equals(dto.getParent_class_id())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
|
||||
// 修改
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
this.updateById(dto);
|
||||
|
||||
//更新父节点中子节点数目
|
||||
updateSubCnt(mdPbClassstandard.getParent_class_id());
|
||||
updateSubCnt(dto.getClass_id());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<String> ids) {
|
||||
// 查询所有数据
|
||||
List<MdPbClassstandard> daoList = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
|
||||
for (String class_id : ids) {
|
||||
MdPbClassstandard mdPbClassstandard = daoList.stream()
|
||||
.filter(item -> item.getClass_id().equals(class_id))
|
||||
.findFirst().orElse(null);
|
||||
mdPbClassstandard.setIs_delete(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
this.baseMapper.updateById(mdPbClassstandard);
|
||||
|
||||
List<MdPbClassstandard> parentList = daoList.stream()
|
||||
.filter(item -> item.getParent_class_id().equals(class_id))
|
||||
.collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(parentList)) {
|
||||
Set<String> child_ids = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < parentList.size(); i++) {
|
||||
MdPbClassstandard child_row = parentList.get(i);
|
||||
child_ids.add(child_row.getClass_id());
|
||||
}
|
||||
this.delete(child_ids);
|
||||
}
|
||||
updateSubCnt(mdPbClassstandard.getParent_class_id());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject loadClass(Map whereJson) {
|
||||
String pid = MapUtil.getStr(whereJson, "pid");
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<MdPbClassstandard> lambda = new QueryWrapper<MdPbClassstandard>().lambda();
|
||||
if (ObjectUtil.isEmpty(pid) || pid.equals(BaseDataEnum.IS_YES_NOT.code("否")) ) {
|
||||
lambda.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, null));
|
||||
lambda.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
lambda.orderByAsc(MdPbClassstandard::getClass_id);
|
||||
} else {
|
||||
lambda.eq(MdPbClassstandard::getParent_class_id, pid)
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
lambda.orderByAsc(MdPbClassstandard::getClass_id);
|
||||
}
|
||||
|
||||
// 定义需返回的集合
|
||||
List<ClassstandardDto> dtoList = new ArrayList<>();
|
||||
|
||||
List<MdPbClassstandard> daoList = this.list(lambda);
|
||||
for (MdPbClassstandard dao : daoList) {
|
||||
// 类型转换
|
||||
ClassstandardDto dto = JSONObject.parseObject(JSONObject.toJSONString(dao), ClassstandardDto.class);
|
||||
|
||||
if (Integer.parseInt(dto.getSub_count()) > 0) {
|
||||
dto.setHasChildren(true);
|
||||
dto.setLeaf(false);
|
||||
} else {
|
||||
dto.setHasChildren(false);
|
||||
dto.setLeaf(true);
|
||||
}
|
||||
dto.setId(dto.getClass_id());
|
||||
dto.setLabel(dto.getClass_name());
|
||||
dto.setCreate_user_name(dto.getCreate_name());
|
||||
dto.setUpdate_user_name(dto.getUpdate_optname());
|
||||
dtoList.add(dto);
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("content", dtoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MdPbClassstandard> getSuperior(MdPbClassstandard classDao, List<MdPbClassstandard> daoList) {
|
||||
if (ObjectUtil.isEmpty(classDao.getParent_class_id()) || classDao.getParent_class_id().equals(BaseDataEnum.IS_YES_NOT.code("否"))) {
|
||||
List<MdPbClassstandard> list = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, null))
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
daoList.addAll(list);
|
||||
return daoList;
|
||||
}
|
||||
|
||||
List<MdPbClassstandard> list = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, classDao.getParent_class_id())
|
||||
);
|
||||
daoList.addAll(list);
|
||||
MdPbClassstandard pidDao = this.getById(classDao.getParent_class_id());
|
||||
return getSuperior(pidDao,daoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject buildTree(List<MdPbClassstandard> superiorList) {
|
||||
Set<ClassstandardDto> trees = new LinkedHashSet<>();
|
||||
Set<ClassstandardDto> maters = new LinkedHashSet<>();
|
||||
List<String> mater_name = new LinkedList<>();
|
||||
superiorList.forEach(item -> {
|
||||
mater_name.add(item.getClass_name());
|
||||
});
|
||||
|
||||
boolean isChild;
|
||||
for (MdPbClassstandard dao : superiorList) {
|
||||
ClassstandardDto dto1 = JSONObject.parseObject(JSONObject.toJSONString(dao), ClassstandardDto.class);
|
||||
isChild = false;
|
||||
if (dto1.getParent_class_id().equals(BaseDataEnum.IS_YES_NOT.code("否")) || ObjectUtil.isEmpty(dto1.getParent_class_id())) {
|
||||
dto1.setId(dto1.getClass_id());
|
||||
dto1.setLabel(dto1.getClass_name());
|
||||
if (Integer.parseInt(dto1.getSub_count()) > 0) {
|
||||
dto1.setHasChildren(true);
|
||||
dto1.setLeaf(false);
|
||||
} else {
|
||||
dto1.setHasChildren(false);
|
||||
dto1.setLeaf(true);
|
||||
}
|
||||
trees.add(dto1);
|
||||
}
|
||||
|
||||
for (MdPbClassstandard dao2 : superiorList) {
|
||||
ClassstandardDto dto2 = JSONObject.parseObject(JSONObject.toJSONString(dao2), ClassstandardDto.class);
|
||||
if (!dto2.getClass_id().equals(BaseDataEnum.IS_YES_NOT.code("否")) && dto1.getClass_id().equals(dto2.getParent_class_id())) {
|
||||
isChild = true;
|
||||
if (ObjectUtil.isEmpty(dto1.getChildren())) {
|
||||
dto1.setChildren(new JSONArray());
|
||||
}
|
||||
JSONArray child_ja = dto1.getChildren();
|
||||
dto2.setId(dto2.getClass_id());
|
||||
dto2.setLabel(dto2.getClass_name());
|
||||
if (Integer.parseInt(dto2.getSub_count()) > 0) {
|
||||
dto2.setHasChildren(true);
|
||||
dto2.setLeaf(false);
|
||||
} else {
|
||||
dto2.setHasChildren(false);
|
||||
dto2.setLeaf(true);
|
||||
}
|
||||
child_ja.add(dto2);
|
||||
}
|
||||
}
|
||||
if (isChild) {
|
||||
dto1.setId(dto1.getClass_id());
|
||||
dto1.setLabel(dto1.getClass_name());
|
||||
if (Integer.parseInt(dto1.getSub_count()) > 0) {
|
||||
dto1.setHasChildren(true);
|
||||
dto1.setLeaf(false);
|
||||
} else {
|
||||
dto1.setHasChildren(false);
|
||||
dto1.setLeaf(true);
|
||||
}
|
||||
maters.add(dto1);
|
||||
} else if (!dto1.getClass_id().equals(BaseDataEnum.IS_YES_NOT.code("否"))) {
|
||||
dto1.setId(dto1.getClass_id());
|
||||
dto1.setLabel(dto1.getClass_name());
|
||||
if (Integer.parseInt(dto1.getSub_count()) > 0) {
|
||||
dto1.setHasChildren(true);
|
||||
dto1.setLeaf(false);
|
||||
} else {
|
||||
dto1.setHasChildren(false);
|
||||
dto1.setLeaf(true);
|
||||
}
|
||||
maters.add(dto1);
|
||||
}
|
||||
}
|
||||
if (maters.size() == 0) {
|
||||
maters = trees;
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("totalElements", superiorList.size());
|
||||
jo.put("content", maters.size() == 0 ? superiorList : trees);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getClassName() {
|
||||
List<MdPbClassstandard> daoList = this.list(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, null)
|
||||
.or(item -> item.eq(MdPbClassstandard::getParent_class_id, BaseDataEnum.IS_YES_NOT.code("否")))
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
daoList.forEach(row -> {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("label", row.getClass_name());
|
||||
json.put("value", row.getClass_code());
|
||||
result.add(json);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新节点
|
||||
* @param parent_class_id 父级id
|
||||
*/
|
||||
private void updateSubCnt(String parent_class_id) {
|
||||
if (ObjectUtil.isNotEmpty(parent_class_id) && !parent_class_id.equals(BaseDataEnum.IS_YES_NOT.code("否"))) {
|
||||
int count = this.baseMapper.selectCount(
|
||||
new QueryWrapper<MdPbClassstandard>().lambda()
|
||||
.eq(MdPbClassstandard::getParent_class_id, parent_class_id)
|
||||
.eq(MdPbClassstandard::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
);
|
||||
|
||||
MdPbClassstandard pidDao = this.getById(parent_class_id);
|
||||
pidDao.setSub_count(String.valueOf(count));
|
||||
pidDao.setIs_leaf(count > 0 ? BaseDataEnum.IS_YES_NOT.code("否") : BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
this.updateById(pidDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
104
wms/nladmin-ui/src/views/wms/basedata/class/classstandard.js
Normal file
104
wms/nladmin-ui/src/views/wms/basedata/class/classstandard.js
Normal file
@@ -0,0 +1,104 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/Classstandard',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/Classstandard/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/Classstandard',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getClass(params) {
|
||||
return request({
|
||||
url: 'api/Classstandard/loadClass',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getClassSuperior(ids) {
|
||||
const data = ids.length || ids.length === 0 ? ids : Array.of(ids)
|
||||
return request({
|
||||
url: 'api/Classstandard/superior',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getClassType(params) {
|
||||
return request({
|
||||
url: 'api/Classstandard/getClass',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function queryClassById(params) {
|
||||
return request({
|
||||
url: 'api/Classstandard/queryClassById',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 传入分类标识和级别
|
||||
export function getType(params) {
|
||||
return request({
|
||||
url: 'api/Classstandard/getType',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getClassTable(params) {
|
||||
return request({
|
||||
url: 'api/Classstandard/getClassTable',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getClassName() {
|
||||
return request({
|
||||
url: 'api/Classstandard/getClassName',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getCasClass(data) {
|
||||
return request({
|
||||
url: 'api/Classstandard/getCasClass',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
add,
|
||||
edit,
|
||||
del,
|
||||
getClass,
|
||||
getClassSuperior,
|
||||
getClassType,
|
||||
getClassTable,
|
||||
getType,
|
||||
queryClassById,
|
||||
getClassName,
|
||||
getCasClass
|
||||
}
|
||||
389
wms/nladmin-ui/src/views/wms/basedata/class/index.vue
Normal file
389
wms/nladmin-ui/src/views/wms/basedata/class/index.vue
Normal file
@@ -0,0 +1,389 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="分类名称">
|
||||
<el-select
|
||||
v-model="query.class_code"
|
||||
placeholder="请选择分类名称"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
style="width: 185px;"
|
||||
@change="hand">
|
||||
<el-option
|
||||
v-for="item in classNames"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="success"
|
||||
icon="el-icon-s-operation"
|
||||
@click="ToExpandall"
|
||||
>
|
||||
全部展开
|
||||
</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="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-form-item label="分类编码" prop="class_code">
|
||||
<el-input v-model="form.class_code" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="class_name">
|
||||
<el-input v-model="form.class_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="简要描述" prop="class_desc">
|
||||
<el-input v-model="form.class_desc" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="顶级类目">
|
||||
<el-radio-group v-model="form.isTop" style="width: 140px">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.isTop === '0'" style="margin-bottom: 0;" label="上级类目" prop="pid">
|
||||
<treeselect
|
||||
v-model="form.parent_class_id"
|
||||
:load-options="loadClass"
|
||||
:options="classes"
|
||||
style="width: 370px;"
|
||||
placeholder="选择上级类目"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
lazy
|
||||
:load="getClassDatas"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
:data="crud.data"
|
||||
row-key="id"
|
||||
@select="crud.selectChange"
|
||||
@select-all="crud.selectAllChange"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="class_code" label="分类编码" />
|
||||
<el-table-column prop="class_name" label="分类名称" />
|
||||
<el-table-column prop="class_desc" label="分类简要描述" />
|
||||
<el-table-column prop="update_optname" label="修改人" />
|
||||
<el-table-column prop="update_time" label="修改时间" />
|
||||
<el-table-column prop="is_modify" :formatter="modifyFormat" label="是否可修改" />
|
||||
<el-table-column
|
||||
v-permission="['admin','Classstandard:edit','Classstandard:del']"
|
||||
label="操作"
|
||||
width="250px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
style="display: inline"
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-edit="scope.row.is_modify === '0'"
|
||||
:disabled-dle="scope.row.is_modify === '0'"
|
||||
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
|
||||
/>
|
||||
<el-button slot="right" size="mini" type="text" icon="el-icon-circle-plus-outline" @click="crud.toAddAndData(addSibling(scope.row))">新增同级</el-button>
|
||||
<el-button slot="right" size="mini" type="text" icon="el-icon-circle-plus" @click="crud.toAddAndData(addChildren(scope.row))">新增子级</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudClassstandard from '@/views/wms/basedata/class/classstandard'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
let defaultForm = {
|
||||
class_id: null,
|
||||
base_data_type: null,
|
||||
path_code: null,
|
||||
class_code: null,
|
||||
long_class_code: null,
|
||||
class_name: null,
|
||||
class_desc: null,
|
||||
parent_class_id: null,
|
||||
is_leaf: null,
|
||||
sub_count: null,
|
||||
is_modify: null,
|
||||
is_delete: null,
|
||||
class_level: null,
|
||||
ext_id: null,
|
||||
ext_parent_id: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
isTop: '1'
|
||||
}
|
||||
export default {
|
||||
name: 'Classstandard',
|
||||
dicts: [],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '基础类别',
|
||||
url: 'api/Classstandard',
|
||||
idField: 'class_id',
|
||||
sort: 'class_id,desc',
|
||||
crudMethod: { ...crudClassstandard },
|
||||
optShow: {
|
||||
add: true,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classes: [],
|
||||
classNames: [],
|
||||
permission: {},
|
||||
rules: {
|
||||
path_code: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
class_code: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
class_name: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
is_leaf: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
is_modify: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getClassNames() // 获取分类
|
||||
},
|
||||
methods: {
|
||||
getClassNames() {
|
||||
crudClassstandard.getClassName().then((res) => { // 获取分类名称,查询根据分类编码查找对应分支树
|
||||
this.classNames = res
|
||||
})
|
||||
},
|
||||
getClassDatas(tree, treeNode, resolve) {
|
||||
const params = { pid: tree.id }
|
||||
setTimeout(() => {
|
||||
crudClassstandard.getClass(params).then(res => {
|
||||
resolve(res.content)
|
||||
})
|
||||
}, 100)
|
||||
},
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
modifyFormat(row, index) {
|
||||
if (row.is_modify === '1') {
|
||||
return '是'
|
||||
} else {
|
||||
return '否'
|
||||
}
|
||||
},
|
||||
dataTypeChange(data) {
|
||||
crudClassstandard.getClass({ base_data_type: data }).then(res => {
|
||||
this.classes = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
// 新增与编辑前做的操作
|
||||
[CRUD.HOOK.afterToCU](crud, form) {
|
||||
if (form.parent_class_id !== '0' && form.parent_class_id !== null) {
|
||||
form.isTop = '0'
|
||||
} else if (form.class_id !== '0' && form.class_id !== null) {
|
||||
form.isTop = '1'
|
||||
}
|
||||
form.enabled = `${form.enabled}`
|
||||
if (form.class_id != null) {
|
||||
this.getSubTypes(form.id)
|
||||
} else {
|
||||
this.getClass()
|
||||
}
|
||||
},
|
||||
// 提交前的验证
|
||||
[CRUD.HOOK.afterValidateCU]() {
|
||||
if (this.form.parent_class_id !== null && this.form.parent_class_id === this.form.class_id) {
|
||||
this.$message({
|
||||
message: '顶级类目不能为空',
|
||||
type: 'warning'
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (this.form.isTop === '1') {
|
||||
this.form.parent_class_id = 0
|
||||
}
|
||||
return true
|
||||
},
|
||||
getSubTypes(id) {
|
||||
crudClassstandard.getClassSuperior(id).then(res => {
|
||||
const date = res.content
|
||||
this.buildClass(date)
|
||||
this.classes = date
|
||||
})
|
||||
},
|
||||
getClass() {
|
||||
crudClassstandard.getClass({ enabled: true }).then(res => {
|
||||
this.classes = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
buildClass(classes) {
|
||||
classes.forEach(data => {
|
||||
if (data.children) {
|
||||
this.buildClass(data.children)
|
||||
}
|
||||
if (data.hasChildren && !data.children) {
|
||||
data.children = null
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取弹窗内部门数据
|
||||
loadClass({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
},
|
||||
clearFrom() {
|
||||
defaultForm = {
|
||||
id: null,
|
||||
class_id: null,
|
||||
base_data_type: null,
|
||||
path_code: null,
|
||||
class_code: null,
|
||||
long_class_code: null,
|
||||
class_name: null,
|
||||
class_desc: null,
|
||||
parent_class_id: null,
|
||||
is_leaf: null,
|
||||
sub_count: null,
|
||||
is_modify: null,
|
||||
is_delete: null,
|
||||
class_level: null,
|
||||
ext_id: null,
|
||||
ext_parent_id: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
isTop: null
|
||||
}
|
||||
},
|
||||
addSibling(row) {
|
||||
this.clearFrom() // 将默认的表单数据清除
|
||||
defaultForm.id = row.id // 获取分类树的id - 懒加载依赖此id,不可为空
|
||||
defaultForm.class_id = row.class_id
|
||||
defaultForm.parent_class_id = row.parent_class_id // 同级为父类class_id
|
||||
defaultForm.isTop = row.isTop
|
||||
return defaultForm
|
||||
},
|
||||
addChildren(row) {
|
||||
this.clearFrom()
|
||||
defaultForm.id = row.id // 获取分类树的id
|
||||
defaultForm.class_id = row.parent_class_id
|
||||
defaultForm.parent_class_id = row.id // 子级为本身的class_id
|
||||
defaultForm.isTop = row.isTop
|
||||
return defaultForm
|
||||
},
|
||||
// 全部展开 参考:https://www.cnblogs.com/toughy/p/12667805.html
|
||||
ToExpandall() {
|
||||
const els = document.getElementsByClassName('el-table__expand-icon')
|
||||
if (this.crud.data.length !== 0 && els.length !== 0) {
|
||||
for (let j1 = 0; j1 < els.length; j1++) {
|
||||
els[j1].classList.add('dafult')
|
||||
}
|
||||
if (this.$el.getElementsByClassName('el-table__expand-icon--expanded')) {
|
||||
const open = this.$el.getElementsByClassName('el-table__expand-icon--expanded')
|
||||
for (let j = 0; j < open.length; j++) {
|
||||
open[j].classList.remove('dafult')
|
||||
}
|
||||
const dafult = this.$el.getElementsByClassName('dafult')
|
||||
for (let a = 0; a < dafult.length; a++) {
|
||||
debugger
|
||||
dafult[a].click()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/customerbase',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/customerbase/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/customerbase',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
313
wms/nladmin-ui/src/views/wms/basedata/customer/index.vue
Normal file
313
wms/nladmin-ui/src/views/wms/basedata/customer/index.vue
Normal file
@@ -0,0 +1,313 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
clearable
|
||||
style="width: 300px"
|
||||
size="mini"
|
||||
placeholder="输入客户编码或客户名称"
|
||||
prefix-icon="el-icon-search"
|
||||
class="filter-item"
|
||||
/>
|
||||
<rrOperation />
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="1100px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="140px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户编码" prop="cust_code">
|
||||
<el-input v-model="form.cust_code" style="width: 200px;" :disabled="crud.status.edit > 0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户名称 " prop="cust_name">
|
||||
<el-input v-model="form.cust_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户简称 " prop="cust_simple_name">
|
||||
<el-input v-model="form.cust_simple_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="税务登记号">
|
||||
<el-input v-model="form.tax_no" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工商注册号">
|
||||
<el-input v-model="form.register_no" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="经营许可证号">
|
||||
<el-input v-model="form.manage_lice_no" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="营业执照">
|
||||
<el-input v-model="form.busi_char_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="邮政编码">
|
||||
<el-input v-model="form.zip_code" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="公司电话">
|
||||
<el-input v-model="form.corp_tele_no" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="公司地址">
|
||||
<el-input v-model="form.corp_address" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="外部标识">
|
||||
<el-input v-model="form.ext_id" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否启用" prop="is_used">
|
||||
<el-radio v-model="form.is_used" label="0">否</el-radio>
|
||||
<el-radio v-model="form.is_used" label="1">是</el-radio>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="法人代表">
|
||||
<el-input v-model="form.jurid_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="16">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" style="width: 550px;" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="cust_code" label="客户编码" show-overflow-tooltip />
|
||||
<el-table-column prop="cust_name" label="客户名称 " show-overflow-tooltip width="150px" />
|
||||
<el-table-column prop="cust_simple_name" label="客户简称 " show-overflow-tooltip />
|
||||
<el-table-column prop="corp_tele_no" label="公司电话" show-overflow-tooltip />
|
||||
<el-table-column prop="corp_address" label="公司地址" show-overflow-tooltip />
|
||||
<el-table-column prop="jurid_name" label="法人代表" show-overflow-tooltip />
|
||||
<el-table-column prop="update_optname" label="修改者" width="150px"/>
|
||||
<el-table-column prop="update_time" label="修改时间" width="150" />
|
||||
<el-table-column label="启用" align="center" prop="is_used">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.is_used"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-permission="['admin','customerbase:edit','customerbase:del']"
|
||||
label="操作"
|
||||
width="150px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudCustomerbase from '@/views/wms/basedata/customer/customerbase'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = {
|
||||
cust_id: null,
|
||||
cust_code: null,
|
||||
cust_name: null,
|
||||
cust_simple_name: null,
|
||||
country: null,
|
||||
state: null,
|
||||
city: null,
|
||||
faxnumber: null,
|
||||
webSite: null,
|
||||
jurid_name: null,
|
||||
tax_no: null,
|
||||
register_no: null,
|
||||
manage_lice_no: null,
|
||||
busi_char_name: null,
|
||||
area_id: null,
|
||||
zip_code: null,
|
||||
corp_tele_no: null,
|
||||
corp_address: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
is_used_time: null,
|
||||
is_used: null,
|
||||
is_delete: null,
|
||||
ext_id: null,
|
||||
remark: null,
|
||||
class_id: null,
|
||||
class_code: null,
|
||||
class_name: null,
|
||||
zj_print_no: null,
|
||||
bz_print_no: null,
|
||||
shd_print_no: null,
|
||||
is_auto_table: '1',
|
||||
bz_print_within: null,
|
||||
sales_owner: null
|
||||
}
|
||||
export default {
|
||||
name: 'Customerbase',
|
||||
dicts: ['is_used'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '客户基础表',
|
||||
url: 'api/customerbase',
|
||||
optShow: {
|
||||
add: true,
|
||||
reset: true
|
||||
},
|
||||
idField: 'cust_id',
|
||||
sort: 'cust_id,desc',
|
||||
crudMethod: { ...crudCustomerbase }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
classes: [],
|
||||
rules: {
|
||||
cust_id: [
|
||||
{ required: true, message: '客户标识不能为空', trigger: 'blur' }
|
||||
],
|
||||
cust_code: [
|
||||
{ required: true, message: '客户编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
cust_name: [
|
||||
{ required: true, message: '客户名称 不能为空', trigger: 'blur' }
|
||||
],
|
||||
create_id: [
|
||||
{ required: true, message: '创建人不能为空', trigger: 'blur' }
|
||||
],
|
||||
create_name: [
|
||||
{ required: true, message: '创建人不能为空', trigger: 'blur' }
|
||||
],
|
||||
create_time: [
|
||||
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
is_used: [
|
||||
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
|
||||
],
|
||||
is_delete: [
|
||||
{ required: true, message: '是否删除不能为空', trigger: 'blur' }
|
||||
],
|
||||
class_id: [
|
||||
{ required: true, message: '基础分类不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
// 改变状态
|
||||
changeEnabled(data, val) {
|
||||
this.$confirm('此操作将 "' + this.dict.label.is_used[val] + '" ' + data.cust_name + ', 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudCustomerbase.edit(data).then(res => {
|
||||
this.crud.notify(this.dict.label.is_used[val] + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
if (data.is_used === '0') {
|
||||
data.is_used = '1'
|
||||
return
|
||||
}
|
||||
if (data.is_used === '1') {
|
||||
data.is_used = '0'
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
if (data.is_used === '0') {
|
||||
data.is_used = '1'
|
||||
return
|
||||
}
|
||||
if (data.is_used === '1') {
|
||||
data.is_used = '0'
|
||||
}
|
||||
})
|
||||
},
|
||||
printTemple(row) {
|
||||
return this.dict.label.print_temple[row.bz_print_no]
|
||||
},
|
||||
printTemple2(row) {
|
||||
return this.dict.label.two_print_temple[row.bz_print_within]
|
||||
},
|
||||
autoTable(row) {
|
||||
return this.dict.label.is_used[row.is_auto_table]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/deviceinfo',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/deviceinfo/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/deviceinfo',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function changeActive(data) {
|
||||
return request({
|
||||
url: 'api/deviceinfo/changeActive',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, changeActive }
|
||||
304
wms/nladmin-ui/src/views/wms/basedata/deviceInfo/index.vue
Normal file
304
wms/nladmin-ui/src/views/wms/basedata/deviceInfo/index.vue
Normal file
@@ -0,0 +1,304 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="模糊搜索">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入设备编码、名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0 || crud.status.view" :title="crud.status.title" width="700px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备编码" prop="device_code">
|
||||
<el-input v-model.trim="form.device_code" :disabled="crud.status.edit > 0" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备名称" prop="device_name">
|
||||
<el-input v-model.trim="form.device_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备规格">
|
||||
<el-input v-model.trim="form.device_specification" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备型号">
|
||||
<el-input v-model.trim="form.device_model" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商">
|
||||
<el-input v-model.trim="form.manufacturer" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="外部编码">
|
||||
<el-input v-model.trim="form.extend_code" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否启用" prop="is_active">
|
||||
<el-radio v-model="form.is_active" :disabled="crud.status.view > 0" label="0">否</el-radio>
|
||||
<el-radio v-model="form.is_active" :disabled="crud.status.view > 0" label="1">是</el-radio>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model.trim="form.remark" type="textarea" style="width: 530px;" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :disabled="crud.status.view > 0" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column show-overflow-tooltip prop="device_code" label="设备编码" />
|
||||
<el-table-column prop="device_name" label="设备名称" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="extend_code" label="外部编码" />
|
||||
<el-table-column prop="device_model" label="设备型号" />
|
||||
<el-table-column prop="device_specification" label="设备规格" />
|
||||
<el-table-column prop="is_active" label="是否启用">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.is_used"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="manufacturer" label="供应商" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150px" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudDeviceinfo from '@/views/wms/basedata/deviceInfo/deviceinfo'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = { device_id: null, device_code: null, device_name: null, device_model: null, device_specification: null, device_attribute_scode: null, is_produceuse: null, manufacturer: null, remark: null, is_active: '1', extend_code: null, workprocedure_id: null, workprocedure_code: null, workprocedure_name: null, create_id: null, create_name: null, create_time: null, is_delete: null, devicebill_id: null, device_capacity_qty: null, honor_time: null }
|
||||
export default {
|
||||
name: 'Deviceinfo',
|
||||
dicts: [],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '设备信息维护',
|
||||
url: 'api/deviceinfo',
|
||||
idField: 'device_id',
|
||||
sort: 'device_id,desc',
|
||||
crudMethod: { ...crudDeviceinfo },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
workProcedureList: [],
|
||||
rules: {
|
||||
device_name: [
|
||||
{ required: true, message: '设备名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
is_used: [
|
||||
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
|
||||
],
|
||||
device_code: [
|
||||
{ required: true, message: '设备编码不能为空', trigger: 'blur' }
|
||||
]
|
||||
}}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
changeEnabled(data, val) {
|
||||
let msg = '此操作将停用设备,是否继续!'
|
||||
if (val !== '1') {
|
||||
msg = '此操作将启用设备,是否继续!'
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudDeviceinfo.edit(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
data.is_used = !data.is_used
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep {
|
||||
|
||||
.vue-treeselect__menu {
|
||||
|
||||
overflow-x: auto !important;
|
||||
|
||||
width: 300px;
|
||||
|
||||
max-height: 300px !important;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect__label {
|
||||
|
||||
overflow: unset;
|
||||
|
||||
text-overflow: unset;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect__control {
|
||||
|
||||
height: 20px !important;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect__multi-value-item-container,
|
||||
|
||||
.vue-treeselect--has-value .vue-treeselect__multi-value {
|
||||
|
||||
height: 30px;
|
||||
|
||||
line-height: 24px;
|
||||
|
||||
padding: 0;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect__limit-tip,
|
||||
|
||||
.vue-treeselect--searchable.vue-treeselect--multi.vue-treeselect--has-value
|
||||
|
||||
.vue-treeselect__input-container {
|
||||
|
||||
padding-top: 0;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect--has-value .vue-treeselect__multi-value {
|
||||
|
||||
// margin-bottom: 15px;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect--has-value .vue-treeselect__input {
|
||||
|
||||
height: 18px !important;
|
||||
|
||||
line-height: 18px !important;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect div,
|
||||
|
||||
.vue-treeselect span {
|
||||
|
||||
box-sizing: content-box;
|
||||
|
||||
}
|
||||
|
||||
// 选中后的溢出隐藏
|
||||
|
||||
.vue-treeselect__multi-value-label {
|
||||
|
||||
display: block;
|
||||
|
||||
width: 140px;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
text-overflow: ellipsis;
|
||||
|
||||
}
|
||||
|
||||
.vue-treeselect__value-container {
|
||||
|
||||
display: block;
|
||||
|
||||
height: 32px;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user