提交代码

pull/1/head
tengxi 1 year ago
parent da0160b7cb
commit 1fc227d2d2

@ -167,6 +167,7 @@ public interface ErrorCodeConstants {
// ========== 企业信息 TODO 补充编号 ==========
ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1002004015, "企业信息不存在");
ErrorCode ENTERPRISE_OPERATE_NOT_EXISTS = new ErrorCode(1002004015, "企业信息操作记录不存在");
ErrorCode ENTERPRISE_BRANCH_NOT_EXISTS = new ErrorCode(1002005015, "企业信息分支机构不存在");
// ========== 业务线表 TODO 补充编号 ==========
ErrorCode BUSINESS_WAREHOUSE_NOT_EXISTS = new ErrorCode(1002025019, "业务线表不存在");

@ -1,7 +1,10 @@
package com.yunxi.scm.module.system.controller.admin.enterprise;
import com.yunxi.scm.framework.datapermission.core.annotation.DataPermission;
import com.yunxi.scm.module.system.controller.admin.enterpriseoperate.vo.EnterpriseOperateRespVO;
import com.yunxi.scm.module.system.controller.admin.user.vo.user.UserUpdateStatusReqVO;
import com.yunxi.scm.module.system.convert.enterpriseoperate.EnterpriseOperateConvert;
import com.yunxi.scm.module.system.dal.dataobject.enterpriseoperate.EnterpriseOperateDO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -123,4 +126,13 @@ public class EnterpriseController {
return success(EnterpriseConvert.INSTANCE.convertList(list));
}
@GetMapping("/getenterperiseOperate")
@Operation(summary = "获得企业信息操作记录所有信息")
@DataPermission(enable = false) // 关闭数据权限,避免只查看自己时,查询不到部门。
@PreAuthorize("@ss.hasPermission('system:enterprise:getenterperiseOperate')")
public CommonResult<List<EnterpriseOperateRespVO>> getEnterpriseOperatePage1() {
List <EnterpriseOperateDO> list = enterpriseService.getEnterpriseOperate();
return success(EnterpriseOperateConvert.INSTANCE.convertList(list));
}
}

@ -0,0 +1,110 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.common.pojo.CommonResult;
import static com.yunxi.scm.framework.common.pojo.CommonResult.success;
import com.yunxi.scm.framework.excel.core.util.ExcelUtils;
import com.yunxi.scm.framework.operatelog.core.annotations.OperateLog;
import static com.yunxi.scm.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo.*;
import com.yunxi.scm.module.system.dal.dataobject.enterprisebranch.EnterpriseBranchDO;
import com.yunxi.scm.module.system.convert.enterprisebranch.EnterpriseBranchConvert;
import com.yunxi.scm.module.system.service.enterprisebranch.EnterpriseBranchService;
@Tag(name = "管理后台 - 分支机构")
@RestController
@RequestMapping("/system/enterprise-branch")
@Validated
public class EnterpriseBranchController {
@Resource
private EnterpriseBranchService enterpriseBranchService;
@PostMapping("/create")
@Operation(summary = "创建分支机构")
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:create')")
public CommonResult<Long> createEnterpriseBranch(@Valid @RequestBody EnterpriseBranchCreateReqVO createReqVO) {
return success(enterpriseBranchService.createEnterpriseBranch(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新分支机构")
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:update')")
public CommonResult<Boolean> updateEnterpriseBranch(@Valid @RequestBody EnterpriseBranchUpdateReqVO updateReqVO) {
enterpriseBranchService.updateEnterpriseBranch(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除分支机构")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:delete')")
public CommonResult<Boolean> deleteEnterpriseBranch(@RequestParam("id") Long id) {
enterpriseBranchService.deleteEnterpriseBranch(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得分支机构")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:query')")
public CommonResult<EnterpriseBranchRespVO> getEnterpriseBranch(@RequestParam("id") Long id) {
EnterpriseBranchDO enterpriseBranch = enterpriseBranchService.getEnterpriseBranch(id);
return success(EnterpriseBranchConvert.INSTANCE.convert(enterpriseBranch));
}
@GetMapping("/list")
@Operation(summary = "获得分支机构列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:query')")
public CommonResult<List<EnterpriseBranchRespVO>> getEnterpriseBranchList(@RequestParam("ids") Collection<Long> ids) {
List<EnterpriseBranchDO> list = enterpriseBranchService.getEnterpriseBranchList(ids);
return success(EnterpriseBranchConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得分支机构分页")
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:query')")
public CommonResult<PageResult<EnterpriseBranchRespVO>> getEnterpriseBranchPage(@Valid EnterpriseBranchPageReqVO pageVO) {
PageResult<EnterpriseBranchDO> pageResult = enterpriseBranchService.getEnterpriseBranchPage(pageVO);
return success(EnterpriseBranchConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/page1")
@Operation(summary = "自定义获得分支机构分页1")
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:query1')")
public CommonResult<PageResult<EnterpriseBranchRespVO>> getEnterpriseBranchPage1(@Valid EnterpriseBranchPageReqVO pageVO) {
PageResult<EnterpriseBranchDO> pageResult = enterpriseBranchService.getEnterpriseBranchPageList(pageVO);
return success(EnterpriseBranchConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出分支机构 Excel")
@PreAuthorize("@ss.hasPermission('system:enterprise-branch:export')")
@OperateLog(type = EXPORT)
public void exportEnterpriseBranchExcel(@Valid EnterpriseBranchExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<EnterpriseBranchDO> list = enterpriseBranchService.getEnterpriseBranchList(exportReqVO);
// 导出 Excel
List<EnterpriseBranchExcelVO> datas = EnterpriseBranchConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "分支机构.xls", "数据", EnterpriseBranchExcelVO.class, datas);
}
}

@ -0,0 +1,50 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class EnterpriseBranchBaseVO {
@Schema(description = "机构名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotNull(message = "机构名称不能为空")
private String branchName;
@Schema(description = "机构类型1总公司 2子公司", example = "2")
private String branchType;
@Schema(description = "管理员", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotNull(message = "管理员不能为空")
private String adminName;
@Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "联系电话不能为空")
private String telephone;
@Schema(description = "备注", example = "随便")
private String branchRemark;
@Schema(description = "上级机构")
private String branchSuperior;
@Schema(description = "图片")
private String logo;
@Schema(description = "关联公司")
private Integer enterprise;
@Schema(description = "关联业务线")
private Integer businesNum;
@Schema(description = "关联员工")
private Integer userNum;
}

@ -0,0 +1,14 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 分支机构创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EnterpriseBranchCreateReqVO extends EnterpriseBranchBaseVO {
}

@ -0,0 +1,53 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yunxi.scm.framework.excel.core.annotations.DictFormat;
import com.yunxi.scm.framework.excel.core.convert.DictConvert;
/**
* Excel VO
*
* @author
*/
@Data
public class EnterpriseBranchExcelVO {
@ExcelProperty("ID")
private Long id;
@ExcelProperty("机构名称")
private String branchName;
@ExcelProperty(value = "机构类型1总公司 2子公司", converter = DictConvert.class)
@DictFormat("enterprise_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
private String branchType;
@ExcelProperty("管理员")
private String adminName;
@ExcelProperty("联系电话")
private String telephone;
@ExcelProperty("备注")
private String branchRemark;
@ExcelProperty("上级机构")
private String branchSuperior;
@ExcelProperty("图片")
private String logo;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("更新时间")
private LocalDateTime updateTime;
}

@ -0,0 +1,41 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunxi.scm.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 分支机构 Excel 导出 Request VO参数和 EnterpriseBranchPageReqVO 是一致的")
@Data
public class EnterpriseBranchExportReqVO {
@Schema(description = "机构名称", example = "王五")
private String branchName;
@Schema(description = "机构类型1总公司 2子公司", example = "2")
private String branchType;
@Schema(description = "管理员", example = "赵六")
private String adminName;
@Schema(description = "联系电话")
private String telephone;
@Schema(description = "备注", example = "随便")
private String branchRemark;
@Schema(description = "上级机构")
private String branchSuperior;
@Schema(description = "图片")
private String logo;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,45 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.yunxi.scm.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.yunxi.scm.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 分支机构分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EnterpriseBranchPageReqVO extends PageParam {
@Schema(description = "机构名称", example = "王五")
private String branchName;
@Schema(description = "机构类型1总公司 2子公司", example = "2")
private String branchType;
@Schema(description = "管理员", example = "赵六")
private String adminName;
@Schema(description = "联系电话")
private String telephone;
@Schema(description = "备注", example = "随便")
private String branchRemark;
@Schema(description = "上级机构")
private String branchSuperior;
@Schema(description = "图片")
private String logo;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "关联员工", example = "王五")
private String userNum;
}

@ -0,0 +1,22 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 分支机构 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EnterpriseBranchRespVO extends EnterpriseBranchBaseVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7497")
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime updateTime;
}

@ -0,0 +1,18 @@
package com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 分支机构更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EnterpriseBranchUpdateReqVO extends EnterpriseBranchBaseVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7497")
@NotNull(message = "ID不能为空")
private Long id;
}

@ -0,0 +1,34 @@
package com.yunxi.scm.module.system.convert.enterprisebranch;
import java.util.*;
import com.yunxi.scm.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo.*;
import com.yunxi.scm.module.system.dal.dataobject.enterprisebranch.EnterpriseBranchDO;
/**
* Convert
*
* @author
*/
@Mapper
public interface EnterpriseBranchConvert {
EnterpriseBranchConvert INSTANCE = Mappers.getMapper(EnterpriseBranchConvert.class);
EnterpriseBranchDO convert(EnterpriseBranchCreateReqVO bean);
EnterpriseBranchDO convert(EnterpriseBranchUpdateReqVO bean);
EnterpriseBranchRespVO convert(EnterpriseBranchDO bean);
List<EnterpriseBranchRespVO> convertList(List<EnterpriseBranchDO> list);
PageResult<EnterpriseBranchRespVO> convertPage(PageResult<EnterpriseBranchDO> page);
List<EnterpriseBranchExcelVO> convertList02(List<EnterpriseBranchDO> list);
}

@ -0,0 +1,82 @@
package com.yunxi.scm.module.system.dal.dataobject.enterprisebranch;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.yunxi.scm.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("system_enterprise_branch")
@KeySequence("system_enterprise_branch_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EnterpriseBranchDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
*
*/
private String branchName;
/**
* 1 2
*
* {@link TODO enterprise_type }
*/
private String branchType;
/**
*
*/
private String adminName;
/**
*
*/
private String telephone;
/**
*
*/
private String branchRemark;
/**
*
*/
private String branchSuperior;
/**
*
*/
private String logo;
@TableField(exist = false)
private Integer enterpriseNum;
@TableField(exist = false)
private Integer businessNum;
/**
*
*/
@TableField(exist = false)
private Integer enterprise;
/**
* 线
*/
@TableField(exist = false)
private Integer businesNum;
/**
*
*/
@TableField(exist = false)
private Integer userNum;
}

@ -6,6 +6,7 @@ import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.scm.module.system.dal.dataobject.enterprise.EnterpriseDO;
import com.yunxi.scm.module.system.dal.dataobject.enterpriseoperate.EnterpriseOperateDO;
import org.apache.ibatis.annotations.Mapper;
import com.yunxi.scm.module.system.controller.admin.enterprise.vo.*;
import org.apache.ibatis.annotations.Param;
@ -55,4 +56,6 @@ public interface EnterpriseMapper extends BaseMapperX<EnterpriseDO> {
List<EnterpriseDO> getEnterpriseListByTenantId(@Param("tenantId") Long tenantId, @Param("userId") Long userId);
List<EnterpriseDO> getEnterpriseList();
List<EnterpriseOperateDO> getEnterpriseOperateList();
}

@ -0,0 +1,51 @@
package com.yunxi.scm.module.system.dal.mysql.enterprisebranch;
import java.util.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yunxi.scm.framework.mybatis.core.mapper.BaseMapperX;
import com.yunxi.scm.module.system.dal.dataobject.enterprisebranch.EnterpriseBranchDO;
import org.apache.ibatis.annotations.Mapper;
import com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author
*/
@Mapper
public interface EnterpriseBranchMapper extends BaseMapperX<EnterpriseBranchDO> {
default PageResult<EnterpriseBranchDO> selectPage(EnterpriseBranchPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseBranchDO>()
.likeIfPresent(EnterpriseBranchDO::getBranchName, reqVO.getBranchName())
.eqIfPresent(EnterpriseBranchDO::getBranchType, reqVO.getBranchType())
.likeIfPresent(EnterpriseBranchDO::getAdminName, reqVO.getAdminName())
.eqIfPresent(EnterpriseBranchDO::getTelephone, reqVO.getTelephone())
.eqIfPresent(EnterpriseBranchDO::getBranchRemark, reqVO.getBranchRemark())
.eqIfPresent(EnterpriseBranchDO::getBranchSuperior, reqVO.getBranchSuperior())
.eqIfPresent(EnterpriseBranchDO::getLogo, reqVO.getLogo())
.betweenIfPresent(EnterpriseBranchDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(EnterpriseBranchDO::getId));
}
default List<EnterpriseBranchDO> selectList(EnterpriseBranchExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<EnterpriseBranchDO>()
.likeIfPresent(EnterpriseBranchDO::getBranchName, reqVO.getBranchName())
.eqIfPresent(EnterpriseBranchDO::getBranchType, reqVO.getBranchType())
.likeIfPresent(EnterpriseBranchDO::getAdminName, reqVO.getAdminName())
.eqIfPresent(EnterpriseBranchDO::getTelephone, reqVO.getTelephone())
.eqIfPresent(EnterpriseBranchDO::getBranchRemark, reqVO.getBranchRemark())
.eqIfPresent(EnterpriseBranchDO::getBranchSuperior, reqVO.getBranchSuperior())
.eqIfPresent(EnterpriseBranchDO::getLogo, reqVO.getLogo())
.betweenIfPresent(EnterpriseBranchDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(EnterpriseBranchDO::getId));
}
//自定义分页
IPage<EnterpriseBranchDO> selectListPage(IPage<EnterpriseBranchDO> page, @Param("reqVO") EnterpriseBranchPageReqVO reqVO);
}

@ -5,6 +5,7 @@ import javax.validation.*;
import com.yunxi.scm.module.system.controller.admin.enterprise.vo.*;
import com.yunxi.scm.module.system.dal.dataobject.enterprise.EnterpriseDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.module.system.dal.dataobject.enterpriseoperate.EnterpriseOperateDO;
/**
* Service
@ -86,4 +87,12 @@ public interface EnterpriseService {
* @return
*/
List <EnterpriseDO> getEnterprise();
/**
*
*
* @param
* @return
*/
List <EnterpriseOperateDO> getEnterpriseOperate();
}

@ -1,5 +1,6 @@
package com.yunxi.scm.module.system.service.enterprise;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -7,6 +8,7 @@ import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.yunxi.scm.module.system.controller.admin.enterprise.vo.*;
import com.yunxi.scm.module.system.dal.dataobject.enterprise.EnterpriseDO;
import com.yunxi.scm.module.system.dal.dataobject.enterpriseoperate.EnterpriseOperateDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.module.system.convert.enterprise.EnterpriseConvert;
@ -89,4 +91,9 @@ public class EnterpriseServiceImpl implements EnterpriseService {
return enterpriseMapper.getEnterpriseList();
}
@Override
public List<EnterpriseOperateDO> getEnterpriseOperate() {
return enterpriseMapper.getEnterpriseOperateList();
}
}

@ -0,0 +1,80 @@
package com.yunxi.scm.module.system.service.enterprisebranch;
import java.util.*;
import javax.validation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo.*;
import com.yunxi.scm.module.system.dal.dataobject.enterprisebranch.EnterpriseBranchDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
/**
* Service
*
* @author
*/
public interface EnterpriseBranchService {
/**
*
*
* @param createReqVO
* @return
*/
Long createEnterpriseBranch(@Valid EnterpriseBranchCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateEnterpriseBranch(@Valid EnterpriseBranchUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteEnterpriseBranch(Long id);
/**
*
*
* @param id
* @return
*/
EnterpriseBranchDO getEnterpriseBranch(Long id);
/**
*
*
* @param ids
* @return
*/
List<EnterpriseBranchDO> getEnterpriseBranchList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<EnterpriseBranchDO> getEnterpriseBranchPage(EnterpriseBranchPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<EnterpriseBranchDO> getEnterpriseBranchList(EnterpriseBranchExportReqVO exportReqVO);
/**
*
*
* @param reqVO
* @return
*/
PageResult<EnterpriseBranchDO> getEnterpriseBranchPageList(EnterpriseBranchPageReqVO reqVO);
}

@ -0,0 +1,91 @@
package com.yunxi.scm.module.system.service.enterprisebranch;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo.*;
import com.yunxi.scm.module.system.dal.dataobject.enterprisebranch.EnterpriseBranchDO;
import com.yunxi.scm.framework.common.pojo.PageResult;
import com.yunxi.scm.module.system.convert.enterprisebranch.EnterpriseBranchConvert;
import com.yunxi.scm.module.system.dal.mysql.enterprisebranch.EnterpriseBranchMapper;
import static com.yunxi.scm.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.yunxi.scm.module.system.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class EnterpriseBranchServiceImpl implements EnterpriseBranchService {
@Resource
private EnterpriseBranchMapper enterpriseBranchMapper;
@Override
public Long createEnterpriseBranch(EnterpriseBranchCreateReqVO createReqVO) {
// 插入
EnterpriseBranchDO enterpriseBranch = EnterpriseBranchConvert.INSTANCE.convert(createReqVO);
enterpriseBranchMapper.insert(enterpriseBranch);
// 返回
return enterpriseBranch.getId();
}
@Override
public void updateEnterpriseBranch(EnterpriseBranchUpdateReqVO updateReqVO) {
// 校验存在
validateEnterpriseBranchExists(updateReqVO.getId());
// 更新
EnterpriseBranchDO updateObj = EnterpriseBranchConvert.INSTANCE.convert(updateReqVO);
enterpriseBranchMapper.updateById(updateObj);
}
@Override
public void deleteEnterpriseBranch(Long id) {
// 校验存在
validateEnterpriseBranchExists(id);
// 删除
enterpriseBranchMapper.deleteById(id);
}
private void validateEnterpriseBranchExists(Long id) {
if (enterpriseBranchMapper.selectById(id) == null) {
throw exception(ENTERPRISE_BRANCH_NOT_EXISTS);
}
}
@Override
public EnterpriseBranchDO getEnterpriseBranch(Long id) {
return enterpriseBranchMapper.selectById(id);
}
@Override
public List<EnterpriseBranchDO> getEnterpriseBranchList(Collection<Long> ids) {
return enterpriseBranchMapper.selectBatchIds(ids);
}
@Override
public PageResult<EnterpriseBranchDO> getEnterpriseBranchPage(EnterpriseBranchPageReqVO pageReqVO) {
return enterpriseBranchMapper.selectPage(pageReqVO);
}
@Override
public List<EnterpriseBranchDO> getEnterpriseBranchList(EnterpriseBranchExportReqVO exportReqVO) {
return enterpriseBranchMapper.selectList(exportReqVO);
}
@Override
public PageResult<EnterpriseBranchDO> getEnterpriseBranchPageList(EnterpriseBranchPageReqVO reqVO) {
IPage<EnterpriseBranchDO> page=new Page<>(reqVO.getPageNo(),reqVO.getPageSize());
enterpriseBranchMapper.selectListPage(page,reqVO);
return new PageResult<>(page.getRecords(),page.getTotal());
}
}

@ -17,4 +17,11 @@
SELECT * from system_enterprise
</select>
<select id="getEnterpriseOperateList" resultType="com.yunxi.scm.module.system.dal.dataobject.enterpriseoperate.EnterpriseOperateDO" >
SELECT * from system_enterprise_operate
order by
id
desc
</select>
</mapper>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yunxi.scm.module.system.dal.mysql.enterprisebranch.EnterpriseBranchMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectListPage" resultType="com.yunxi.scm.module.system.dal.dataobject.enterprisebranch.EnterpriseBranchDO" >
SELECT
a.*,
'3' AS enterprise,
count(c.id) AS businesNum,
count(b.id) AS userNum
FROM
system_enterprise_branch a
LEFT JOIN system_users b ON b.enterprise_id = a.id
LEFT JOIN system_business_enterprise_relational c ON c.enterprise_id=a.id
<where>
<if test="reqVO.branchName != null and reqVO.branchName !=''">
a.branchName LIKE CONCAT('%',# {reqVO.branchName}'%')
</if>
</where>
GROUP BY
a.id
</select>
</mapper>

@ -0,0 +1,207 @@
package com.yunxi.scm.module.system.service.enterprisebranch;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import com.yunxi.scm.framework.test.core.ut.BaseDbUnitTest;
import com.yunxi.scm.module.system.controller.admin.enterprisebranch.vo.*;
import com.yunxi.scm.module.system.dal.dataobject.enterprisebranch.EnterpriseBranchDO;
import com.yunxi.scm.module.system.dal.mysql.enterprisebranch.EnterpriseBranchMapper;
import com.yunxi.scm.framework.common.pojo.PageResult;
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.*;
import static com.yunxi.scm.module.system.enums.ErrorCodeConstants.*;
import static com.yunxi.scm.framework.test.core.util.AssertUtils.*;
import static com.yunxi.scm.framework.test.core.util.RandomUtils.*;
import static com.yunxi.scm.framework.common.util.date.LocalDateTimeUtils.*;
import static com.yunxi.scm.framework.common.util.object.ObjectUtils.*;
import static com.yunxi.scm.framework.common.util.date.DateUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* {@link EnterpriseBranchServiceImpl}
*
* @author
*/
@Import(EnterpriseBranchServiceImpl.class)
public class EnterpriseBranchServiceImplTest extends BaseDbUnitTest {
@Resource
private EnterpriseBranchServiceImpl enterpriseBranchService;
@Resource
private EnterpriseBranchMapper enterpriseBranchMapper;
@Test
public void testCreateEnterpriseBranch_success() {
// 准备参数
EnterpriseBranchCreateReqVO reqVO = randomPojo(EnterpriseBranchCreateReqVO.class);
// 调用
Long enterpriseBranchId = enterpriseBranchService.createEnterpriseBranch(reqVO);
// 断言
assertNotNull(enterpriseBranchId);
// 校验记录的属性是否正确
EnterpriseBranchDO enterpriseBranch = enterpriseBranchMapper.selectById(enterpriseBranchId);
assertPojoEquals(reqVO, enterpriseBranch);
}
@Test
public void testUpdateEnterpriseBranch_success() {
// mock 数据
EnterpriseBranchDO dbEnterpriseBranch = randomPojo(EnterpriseBranchDO.class);
enterpriseBranchMapper.insert(dbEnterpriseBranch);// @Sql: 先插入出一条存在的数据
// 准备参数
EnterpriseBranchUpdateReqVO reqVO = randomPojo(EnterpriseBranchUpdateReqVO.class, o -> {
o.setId(dbEnterpriseBranch.getId()); // 设置更新的 ID
});
// 调用
enterpriseBranchService.updateEnterpriseBranch(reqVO);
// 校验是否更新正确
EnterpriseBranchDO enterpriseBranch = enterpriseBranchMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, enterpriseBranch);
}
@Test
public void testUpdateEnterpriseBranch_notExists() {
// 准备参数
EnterpriseBranchUpdateReqVO reqVO = randomPojo(EnterpriseBranchUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> enterpriseBranchService.updateEnterpriseBranch(reqVO), ENTERPRISE_BRANCH_NOT_EXISTS);
}
@Test
public void testDeleteEnterpriseBranch_success() {
// mock 数据
EnterpriseBranchDO dbEnterpriseBranch = randomPojo(EnterpriseBranchDO.class);
enterpriseBranchMapper.insert(dbEnterpriseBranch);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbEnterpriseBranch.getId();
// 调用
enterpriseBranchService.deleteEnterpriseBranch(id);
// 校验数据不存在了
assertNull(enterpriseBranchMapper.selectById(id));
}
@Test
public void testDeleteEnterpriseBranch_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> enterpriseBranchService.deleteEnterpriseBranch(id), ENTERPRISE_BRANCH_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetEnterpriseBranchPage() {
// mock 数据
EnterpriseBranchDO dbEnterpriseBranch = randomPojo(EnterpriseBranchDO.class, o -> { // 等会查询到
o.setBranchName(null);
o.setBranchType(null);
o.setAdminName(null);
o.setTelephone(null);
o.setBranchRemark(null);
o.setBranchSuperior(null);
o.setLogo(null);
o.setCreateTime(null);
});
enterpriseBranchMapper.insert(dbEnterpriseBranch);
// 测试 branchName 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchName(null)));
// 测试 branchType 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchType(null)));
// 测试 adminName 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setAdminName(null)));
// 测试 telephone 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setTelephone(null)));
// 测试 branchRemark 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchRemark(null)));
// 测试 branchSuperior 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchSuperior(null)));
// 测试 logo 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setLogo(null)));
// 测试 createTime 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setCreateTime(null)));
// 准备参数
EnterpriseBranchPageReqVO reqVO = new EnterpriseBranchPageReqVO();
reqVO.setBranchName(null);
reqVO.setBranchType(null);
reqVO.setAdminName(null);
reqVO.setTelephone(null);
reqVO.setBranchRemark(null);
reqVO.setBranchSuperior(null);
reqVO.setLogo(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
PageResult<EnterpriseBranchDO> pageResult = enterpriseBranchService.getEnterpriseBranchPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbEnterpriseBranch, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetEnterpriseBranchList() {
// mock 数据
EnterpriseBranchDO dbEnterpriseBranch = randomPojo(EnterpriseBranchDO.class, o -> { // 等会查询到
o.setBranchName(null);
o.setBranchType(null);
o.setAdminName(null);
o.setTelephone(null);
o.setBranchRemark(null);
o.setBranchSuperior(null);
o.setLogo(null);
o.setCreateTime(null);
});
enterpriseBranchMapper.insert(dbEnterpriseBranch);
// 测试 branchName 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchName(null)));
// 测试 branchType 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchType(null)));
// 测试 adminName 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setAdminName(null)));
// 测试 telephone 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setTelephone(null)));
// 测试 branchRemark 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchRemark(null)));
// 测试 branchSuperior 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setBranchSuperior(null)));
// 测试 logo 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setLogo(null)));
// 测试 createTime 不匹配
enterpriseBranchMapper.insert(cloneIgnoreId(dbEnterpriseBranch, o -> o.setCreateTime(null)));
// 准备参数
EnterpriseBranchExportReqVO reqVO = new EnterpriseBranchExportReqVO();
reqVO.setBranchName(null);
reqVO.setBranchType(null);
reqVO.setAdminName(null);
reqVO.setTelephone(null);
reqVO.setBranchRemark(null);
reqVO.setBranchSuperior(null);
reqVO.setLogo(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
List<EnterpriseBranchDO> list = enterpriseBranchService.getEnterpriseBranchList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbEnterpriseBranch, list.get(0));
}
}

@ -41,6 +41,11 @@ export function getEnterpriseList() {
return defHttp.get({ url: '/system/enterprise/getenterperise' })
}
// 查询企业操作记录信息
export function getEnterpriseOperateList() {
return defHttp.get({ url: '/system/enterprise/getenterperiseOperate' })
}
// // 查询企业信息
// export function getEnterpriseList() {
// return defHttp.put({ url: '/system/enterprise/querylist' })

@ -0,0 +1,47 @@
import { defHttp } from '@/utils/http/axios'
// export interface EnterpriseBranchPageReqVO extends PageParam {
// branchName?: string
// branchType?: string
// adminName?: string
// telephone?: string
// branchRemark?: string
// createTime?: Date[]
// }
// 查询分支机构列表
export function getEnterpriseBranchPage(params) {
return defHttp.get({ url: '/system/enterprise-branch/page', params })
}
// 查询分支机构列表
export function getEnterpriseBranchPage1(params) {
return defHttp.get({ url: '/system/enterprise-branch/page1', params })
}
// 查询分支机构详情
export function getEnterpriseBranch(id: number) {
return defHttp.get({ url: '/system/enterprise-branch/get?id=' + id })
}
// 新增分支机构
export function createEnterpriseBranch(data) {
return defHttp.post({ url: '/system/enterprise-branch/create', data })
}
// 修改分支机构
export function updateEnterpriseBranch(data) {
return defHttp.put({ url: '/system/enterprise-branch/update', data })
}
// 删除分支机构
export function deleteEnterpriseBranch(id: number) {
return defHttp.delete({ url: '/system/enterprise-branch/delete?id=' + id })
}
// 导出分支机构 Excel
export function exportEnterpriseBranch(params) {
return defHttp.download({ url: '/system/enterprise-branch/export-excel', params }, '分支机构.xls')
}

@ -170,4 +170,5 @@ export enum DICT_TYPE {
customerSource = 'customer_source', //客户星级
enterpriseNature = 'enterprise_nature', //客户星级
XUELI = 'XUELI', //学历
ENTERPRISE_OPERATE_TYPE = 'enterprise_operate_type', //客户星级
}

@ -0,0 +1,357 @@
<script lang="ts" setup>
import ModalAdd from './src/ModalAdd.vue'
import ModalEdit from './src/ModalEdit.vue'
import DrawerFilter from './src/DrawerFilter.vue'
import { ref, h,onMounted,reactive } from 'vue'
import { EditOutlined, DeleteOutlined, PlusOutlined, SearchOutlined, UndoOutlined, FilterOutlined } from '@ant-design/icons-vue';
import { getEnterpriseBranchPage,getEnterpriseBranch,createEnterpriseBranch,updateEnterpriseBranch,deleteEnterpriseBranch,exportEnterpriseBranch,getEnterpriseBranchPage1 } from '@/api/system/enterpriseBranch'
import { getEnterpriseOperateList } from '@/api/system/enterprise'
const headStyleV: any = { color: '#262626', 'background-color': '#F7F8FA', 'border-radius': '3px' }
const activeKey = ref('1');
const enterpriseBranch = reactive({
checked1: true,
EnterpriseBranchPage: [],
})
onMounted( async () => {
enterpriseBranch.EnterpriseBranchPage = await getEnterpriseBranchPage1()
// enterpriseBranch.EnterpriseBranchPage.list.forEach((item,index)=>{
// dataSource.value.push(
// {
// key: item.id,
// k1a: item.branchName,
// k1b: item.branchType,
// k1c: '',
// k2: item.branchType,
// k3: '',
// k4: '',
// k5: item.userNum,
// k6: item.adminName,
// k7: '',
// k8: new Date(item.updateTime).toLocaleString(),
// k9: '',
// }
// )
// console.log('dataSource.value',dataSource.value[index])
// })
})
const columns: any = [
{
title: '分支机构名称',
dataIndex: 'k1a',
key: 'k1a',
},
{
title: '机构类型',
dataIndex: 'k2',
key: 'k2',
sorter: true,
},
{
title: '关联子公司',
dataIndex: 'k3',
key: 'k3',
},
{
title: '包含业务线',
dataIndex: 'k4',
key: 'k4',
},
{
title: '关联员工',
dataIndex: 'k5',
key: 'k5',
},
{
title: '管理员',
dataIndex: 'k6',
key: 'k6',
},
{
title: '联系电话',
dataIndex: 'k7',
key: 'k7',
sorter: true,
},
{
title: '更新时间',
dataIndex: 'k8',
key: 'k8',
sorter: true,
},
{
title: '操作',
key: 'action',
}
]
const dataSource: any = [
// const dataSource: any = ref([
// {
// key: '1',
// k1a: '',
// k1b: 'JGCSKC202309030001',
// k1c: 'JGCSKC202309030001',
// k2: '',
// k3: 4,
// k4: 100,
// k5: 100,
// k6: '',
// k7: '18612345678',
// k8: '2023-09-11 23:26:08',
// k9: '',
// },
// {
// key: '2',
// k1a: '',
// k1b: 'JGCSKC202309030001',
// k1c: 'JGCSKC202309030001',
// k2: '',
// k3: 1,
// k4: 100,
// k5: 100,
// k6: '',
// k7: '18612345678',
// k8: '2023-09-11 23:26:08',
// k9: '',
// },
// {
// key: '3',
// k1a: '',
// k1b: 'JGCSKC202309030001',
// k1c: 'JGCSKC202309030001',
// k2: '',
// k3: 1,
// k4: 50,
// k5: 200,
// k6: '',
// k7: '18612344321',
// k8: '2023-09-11 23:26:08',
// k9: '',
// },
// {
// key: '4',
// k1a: '',
// k1b: 'JGCSKC202309030001',
// k1c: 'JGCSKC202309030001',
// k2: '',
// k3: 2,
// k4: 20,
// k5: 300,
// k6: '',
// k7: '18612344321',
// k8: '2023-09-11 23:26:08',
// k9: '',
// },
// {
// key: '5',
// k1a: '',
// k1b: 'JGCSKC202309030001',
// k1c: 'JGCSKC202309030001',
// k2: '',
// k3: 1,
// k4: 30,
// k5: 400,
// k6: '',
// k7: '18612344321',
// k8: '2023-09-11 23:26:08',
// k9: '',
// }
// ]);
];
//
let isShowModalAdd = ref(false);
const doShowModalAdd = (isshow: boolean) => {
isShowModalAdd.value = isshow;
}
//
let isShowModalEdit = ref(false);
const doShowModalEdit = (isshow: boolean, record: any) => {
console.log(record);
isShowModalEdit.value = isshow;
}
//
let isShowDrawerFilter = ref(false);
const doShowDrawerFilter = (isshow: boolean) => {
isShowDrawerFilter.value = isshow;
}
const doCloseDrawerFilter = (isshow: boolean) => {
isShowDrawerFilter.value = isshow;
}
</script>
<template>
<a-row :wrap="false" class="y1-enterprise-centre-branch">
<a-col flex="1 1 auto">
<a-card title="分支机构" :bordered="false" style="border-radius: 3px;" :headStyle="headStyleV">
<a-row :wrap="false" class="y1y1">
<a-col flex="1 1 auto">
<a-row :wrap="false">
<a-col flex="1 1 auto" class="y1y1x1">
<a-space>
<a-input placeholder="部门名称" />
<a-button type="primary" :icon="h(SearchOutlined)">查询</a-button>
<a-button :icon="h(UndoOutlined)">重置</a-button>
<a-button type="link" :icon="h(FilterOutlined)" @click="doShowDrawerFilter(true)"></a-button>
</a-space>
</a-col>
</a-row>
</a-col>
</a-row>
<a-row :wrap="false" class="y1y2">
<a-col flex="1 1 auto">
<a-row :wrap="false">
<a-col flex="1 1 300px" class="y1y1x1">
<a-space>
<a-button type="primary" :icon="h(PlusOutlined)" @click="doShowModalAdd(true)"></a-button>
</a-space>
</a-col>
<a-col flex="0 0 250px" class="y1y1x2">
<a-space>
</a-space>
</a-col>
</a-row>
</a-col>
</a-row>
<a-row :wrap="false" class="y1y3">
<a-col flex="1 1 auto">
<a-table class="ant-table-striped" :dataSource="enterpriseBranch.EnterpriseBranchPage.list" :columns="columns"
:row-class-name="(_record, index) => (index % 2 === 1 ? 'table-tr-b' : 'table-tr-a')">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'k1a'">
<a-row>
<a-col :span="5">
<div style="text-align: center;">
<a-image :width="40"
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
</div>
</a-col>
<a-col :span="19">
<div>{{ record.branchName }}</div>
</a-col>
</a-row>
</template>
<template v-else-if="column.key === 'k2'">
<a-row>
<a-col :span="24">
<div>{{ record.branchType }}</div>
</a-col>
</a-row>
</template>
<template v-else-if="column.key === 'k3'">
<a-row>
<a-col :span="24">
<div>{{ record.enterprise }}</div>
</a-col>
</a-row>
</template>
<template v-else-if="column.key === 'k4'">
<a-row>
<a-col :span="24">
<div>{{ record.businesNum }}</div>
</a-col>
</a-row>
</template>
<template v-else-if="column.key === 'k5'">
<a-row>
<a-col :span="24">
<div>{{ record.userNum }}</div>
</a-col>
</a-row>
</template>
<template v-else-if="column.key === 'k6'">
<a-row>
<a-col :span="24">
<div>{{ record.adminName }}</div>
</a-col>
</a-row>
</template>
<!-- <template v-else-if="column.key === 'k7'">
<template v-if="record.k7 == true">
<a-row>
<a-col :span="6">
<div class="dot-true"></div>
</a-col>
<a-col :span="18">
<div>启用</div>
</a-col>
</a-row>
</template>
<template v-else>
<a-row>
<a-col :span="6">
<div class="dot-false"></div>
</a-col>
<a-col :span="18">
<div>禁用</div>
</a-col>
</a-row>
</template>
</template> -->
<template v-else-if="column.key === 'k7'">
<a-row>
<a-col :span="24">
<div>{{ record.telephone }}</div>
</a-col>
</a-row>
</template>
<template v-else-if="column.key === 'k8'">
<a-row>
<a-col :span="24">
<div>{{ new Date(record.updateTime).toLocaleString() }}</div>
</a-col>
</a-row>
</template>
<template v-else-if="column.key === 'action'">
<a-space size="0">
<template #split>
<a-divider type="vertical" />
</template>
<!-- <a-button type="link" :icon="h(EditOutlined)" @click=doShowModalEdit(true, record)>编辑</a-button> -->
<a-button type="link" :icon="h(DeleteOutlined)" danger>删除</a-button>
</a-space>
</template>
</template>
</a-table>
</a-col>
</a-row>
</a-card>
<ModalAdd :isShow="isShowModalAdd" @do-cancel="doShowModalAdd"></ModalAdd>
<ModalEdit :isShow="isShowModalEdit" :record="record" @do-cancel="doShowModalEdit"></ModalEdit>
<DrawerFilter :isShow="isShowDrawerFilter" @do-close="doCloseDrawerFilter"></DrawerFilter>
</a-col>
</a-row>
</template>
<style lang="less" scoped>
.y1-enterprise-centre-branch {
margin: 24px;
border-radius: 3px;
font-size: 14px;
background-color: #FFFFFF;
.y1y1 {
margin: 24px;
}
.y1y2 {
margin: 24px;
}
.y1y3 {
margin: 24px;
}
}
</style>

@ -0,0 +1,89 @@
<script lang="ts" setup>
import { createEnterpriseBranch } from '@/api/system/enterpriseBranch'
import { reactive, ref } from 'vue'
import TransferList from './TransferList.vue'
interface FormState {
k1: string;
k2: string;
k3: string;
k4: string;
k5: string;
}
const formState = reactive<FormState>({
k1: '',
k2: '济钢城市矿产科技有限公司',
k3: '',
k4: '',
k5: '',
});
const props = defineProps({
isShow: Boolean
})
const emit = defineEmits(['doCancel'])
//
// const isOpen: any = ref(true);
//
const doOk = async () => {
const result = await createEnterpriseBranch(FormState.userInfo);
console.log('ok');
emit('doCancel', false)
}
//
const doCancel = () => {
emit('doCancel', false)
}
const onFinish = (values: any) => {
console.log('Success:', values);
};
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo);
};
//
let isShowTransferList = ref(false);
// const doShowModalAdd = (isshow: boolean) => {
// isShowModalAdd.value = isshow;
// }
const onSelect = (formState: any) => {
isShowTransferList.value = true;
console.log(formState.k3);
};
//
const doCancelA = (isshow: boolean) => {
isShowTransferList.value = isshow
}
</script>
<template>
<template v-if="props.isShow">
<a-modal :open="true" title="新建机构" @ok="doOk" @cancel="doCancel">
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off"
@finish="onFinish" @finishFailed="onFinishFailed">
<a-form-item label="机构名称" name="k1" :rules="[{ required: true, message: '请输入机构名称!' }]">
<a-input v-model:value="formState.k1" placeholder="输入内容" />
</a-form-item>
<a-form-item label="上级机构" name="k2" :rules="[]">
<a-input v-model:value="formState.k2" disabled />
</a-form-item>
<a-form-item label=" 负责人员" name="k3" :rules="[{ required: true, message: '请选择负责人员!' }]">
<a-input v-model:value="formState.k3" placeholder="选择人员" @click="onSelect(formState)" />
</a-form-item>
<a-form-item label=" 联系电话" name="k4" :rules="[{ required: true, message: '请输入联系电话!' }]">
<a-input v-model:value="formState.k4" placeholder="输入内容" />
</a-form-item>
<a-form-item label=" 机构描述" name="k5" :rules="[]">
<a-textarea v-model:value="formState.k5" placeholder="输入内容" :auto-size="{ minRows: 4, maxRows: 6 }" />
</a-form-item>
</a-form>
</a-modal>
<TransferList :isShow="isShowTransferList" @do-cancel="doCancelA"></TransferList>
</template>
</template>
<style lang="less" scoped></style>

@ -1,140 +1,181 @@
<script lang="ts" setup>
import { getCurrentInstance, onMounted, reactive, ref, toRefs } from 'vue'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { getEnterpriseOperateList } from '@/api/system/enterprise'
import { CLIENT_RENEG_LIMIT } from 'tls';
const enterpriseoperate = reactive({
checked1: true,
enterpriseoperate: [],
})
onMounted( async () => {
enterpriseoperate.enterpriseoperate = await getEnterpriseOperateList()
// enterpriseoperate.enterpriseoperate.forEach((item,index)=>{
// // dataSource.value[index].k2=item.operateName;
// // console.log('item',item)
// dataSource.value.push(
// {
// key: item.id,
// k1: new Date(item.operateTime).toLocaleString(),
// k2: item.operateName,
// k3: item.operateType,
// k4: item.operateDetail,
// }
// )
// console.log('dataSource.value',dataSource.value[index])
// })
})
const headStyleV: any = { color: '#262626', 'background-color': '#F7F8FA', 'border-radius': '3px' }
const columns: any = [
{
title: '操作时间',
dataIndex: 'k1',
key: 'k1',
dataIndex: 'operateTime',
key: 'operateTime',
width: 250,
customRender: ({ text }) => {
return useRender.renderDate(text)
}
},
{
title: '操作者',
dataIndex: 'k2',
key: 'k2',
title: '客户名称',
dataIndex: 'operateName',
key: 'operateName',
width: 250
},
{
title: '操作类型',
dataIndex: 'k3',
key: 'k3',
dataIndex: 'operateType',
key: 'operateType',
width: 250,
customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.ENTERPRISE_OPERATE_TYPE)
},
},
{
title: '操作详情',
dataIndex: 'k4',
key: 'k4',
dataIndex: 'operateDetail',
key: 'operateDetail',
width: 300,
}
]
const dataSource: any = [
{
key: '1',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为启用(备注内容:***'
},
{
key: '2',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为停用(备注内容:***'
},
{
key: '3',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改部门',
k4: '修改部门(旧值:*** 新值:***'
},
{
key: '4',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改职务',
k4: '修改职务(旧值:*** 新值:***'
},
{
key: '5',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为启用(备注内容:***'
},
{
key: '6',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为停用(备注内容:***'
},
{
key: '7',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改部门',
k4: '修改部门(旧值:*** 新值:***'
},
{
key: '8',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改职务',
k4: '修改职务(旧值:*** 新值:***'
},
{
key: '9',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为启用(备注内容:***'
},
{
key: '10',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为停用(备注内容:***'
},
{
key: '11',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改部门',
k4: '修改部门(旧值:*** 新值:***'
},
{
key: '12',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改职务',
k4: '修改职务(旧值:*** 新值:***'
},
{
key: '13',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为启用(备注内容:***'
},
{
key: '14',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改状态',
k4: '设为停用(备注内容:***'
},
{
key: '15',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改部门',
k4: '修改部门(旧值:*** 新值:***'
},
{
key: '16',
k1: '2023-09-03 15:43:23',
k2: '康宁',
k3: '修改职务',
k4: '修改职务(旧值:*** 新值:***'
},
let dataSource: any = [
// {
// key: '1',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '2',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '3',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
// {
// key: '4',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
// {
// key: '5',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '6',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '7',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
// {
// key: '8',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
// {
// key: '9',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '10',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '11',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
// {
// key: '12',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
// {
// key: '13',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '14',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '***'
// },
// {
// key: '15',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
// {
// key: '16',
// k1: '2023-09-03 15:43:23',
// k2: '',
// k3: '',
// k4: '*** ***'
// },
];
</script>
@ -142,10 +183,12 @@ const dataSource: any = [
<a-row :wrap="false" class="basic-info-y1">
<a-col flex="1 1 auto">
<a-card title="操作记录" :bordered="false" style="border-radius: 3px;" :headStyle="headStyleV">
<a-table class="ant-table-striped" :dataSource="dataSource" :columns="columns"
<a-table class="ant-table-striped" :dataSource="enterpriseoperate.enterpriseoperate" :columns="columns"
:row-class-name="(_record, index) => (index % 2 === 1 ? 'table-tr-b' : 'table-tr-a')"
:pagination="{ defaultPageSize: 100, hideOnSinglePage: true }">
<template #bodyCell="{ column, record }">
</template>
</a-table>
</a-card>

@ -98,6 +98,7 @@ onMounted( async () => {
state.userInfo = await getUserProfileApi()
state.userUpdatePasswordReqVO.id = state.userInfo.id;
state.loginLog = await getLoginLogPage();
state.noticePage = await getNoticePage();
state.enterpriseList = userStore.getUserInfo.user.enterpriseList;
})

Loading…
Cancel
Save